configure.ac 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([MAJOR_VERSION], 1)
  4. m4_define([MINOR_VERSION], 0)
  5. m4_define([MICRO_VERSION], 0)
  6. AC_PREREQ([2.71])
  7. AC_INIT([klish-plugin-sysrepo],[MAJOR_VERSION.MINOR_VERSION.MICRO_VERSION],[serj.kalichev at gmail dot com])
  8. AC_CONFIG_AUX_DIR(aux_scripts)
  9. AC_CONFIG_MACRO_DIR([m4])
  10. # Values for SONAME. See -version-info for details.
  11. AC_SUBST(SONAME_CURRENT, 1)
  12. AC_SUBST(SONAME_REVISION, 0)
  13. AC_SUBST(SONAME_AGE, 0)
  14. # Check for system extensions (_POSIX_THREAD_SEMANTICS for Solaris)
  15. AC_USE_SYSTEM_EXTENSIONS
  16. # Checks for programs.
  17. AC_PROG_CC
  18. LT_INIT
  19. AC_CONFIG_HEADERS([config.h])
  20. AM_INIT_AUTOMAKE(subdir-objects)
  21. AM_PROG_CC_C_O
  22. # needed to handle 64-bit architecture
  23. AC_CHECK_SIZEOF(int)
  24. AC_CHECK_SIZEOF(long)
  25. AC_CHECK_SIZEOF(size_t)
  26. #########################################
  27. # See if linker supports version scripts
  28. #########################################
  29. # Check if LD supports linker scripts,
  30. # and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
  31. AC_ARG_ENABLE([ld-version-script],
  32. AS_HELP_STRING([--enable-ld-version-script],
  33. [enable linker version script (default is enabled when possible)]),
  34. [have_ld_version_script=$enableval], [])
  35. if test -z "$have_ld_version_script"; then
  36. AC_MSG_CHECKING([if LD -Wl,--version-script works])
  37. save_LDFLAGS="$LDFLAGS"
  38. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  39. cat > conftest.map <<EOF
  40. VERS_1 {
  41. global: sym;
  42. };
  43. VERS_2 {
  44. global: sym;
  45. } VERS_1;
  46. EOF
  47. AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
  48. [have_ld_version_script=yes], [have_ld_version_script=no])
  49. rm -f conftest.map
  50. LDFLAGS="$save_LDFLAGS"
  51. AC_MSG_RESULT($have_ld_version_script)
  52. fi
  53. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  54. ################################
  55. # Deal with debugging options
  56. ################################
  57. AC_ARG_ENABLE(debug,
  58. [AS_HELP_STRING([--enable-debug],
  59. [Turn on debugging including asserts [default=no]])],
  60. [],
  61. [enable_debug=no])
  62. AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
  63. ################################
  64. # Variables to install plugins
  65. ################################
  66. PLUGINS_SUBDIR=klish/plugins
  67. AC_SUBST(PLUGINS_SUBDIR)
  68. ################################
  69. # Check for mandatory faux library
  70. ################################
  71. AC_ARG_WITH(faux,
  72. [AS_HELP_STRING([--with-faux=DIR],
  73. [Search DIR directory for faux library files [default=yes]])],
  74. [use_faux=$withval],
  75. [use_faux=yes])
  76. AS_IF([test x$use_faux != xyes],
  77. [
  78. CPPFLAGS="-I${use_faux} ${CPPFLAGS}"
  79. LDFLAGS="-L${use_faux}/.libs ${LDFLAGS}"
  80. ]
  81. )
  82. AC_CHECK_HEADERS([faux/faux.h],
  83. [],
  84. [AC_MSG_ERROR([cannot find <faux/faux.h> header file])]
  85. )
  86. AC_SEARCH_LIBS([faux_zmalloc], [faux],
  87. [],
  88. [AC_MSG_ERROR([cannot find working faux library])]
  89. )
  90. ################################
  91. # Check for mandatory libyang library
  92. ################################
  93. AC_ARG_WITH(libyang,
  94. [AS_HELP_STRING([--with-libyang=DIR],
  95. [Search DIR directory for libyang library files [default=yes]])],
  96. [use_libyang=$withval],
  97. [use_libyang=yes])
  98. AS_IF([test x$use_libyang != xyes],
  99. [
  100. CPPFLAGS="-I${use_libyang} ${CPPFLAGS}"
  101. LDFLAGS="-L${use_libyang}/.libs ${LDFLAGS}"
  102. ]
  103. )
  104. AC_CHECK_HEADERS([libyang/libyang.h],
  105. [],
  106. [AC_MSG_ERROR([cannot find <libyang/libyang.h> header file])]
  107. )
  108. AC_SEARCH_LIBS([lysc_node_child], [yang],
  109. [],
  110. [AC_MSG_ERROR([cannot find working libyang library])]
  111. )
  112. ################################
  113. # Check for mandatory sysrepo library
  114. ################################
  115. AC_ARG_WITH(sysrepo,
  116. [AS_HELP_STRING([--with-sysrepo=DIR],
  117. [Search DIR directory for sysrepo library files [default=yes]])],
  118. [use_sysrepo=$withval],
  119. [use_sysrepo=yes])
  120. AS_IF([test x$use_sysrepo != xyes],
  121. [
  122. CPPFLAGS="-I${use_sysrepo} ${CPPFLAGS}"
  123. LDFLAGS="-L${use_sysrepo}/.libs ${LDFLAGS}"
  124. ]
  125. )
  126. AC_CHECK_HEADERS([sysrepo/xpath.h],
  127. [],
  128. [AC_MSG_ERROR([cannot find <sysrepo/xpath.h> header file])]
  129. )
  130. AC_SEARCH_LIBS([sr_connect], [sysrepo],
  131. [],
  132. [AC_MSG_ERROR([cannot find working sysrepo library])]
  133. )
  134. ################################
  135. # Install XML
  136. ################################
  137. AC_ARG_ENABLE(xml-install,
  138. [AS_HELP_STRING([--enable-xml-install],
  139. [Install sysrepo related XML file(s) [default=no]])],
  140. [],
  141. [enable_xml_install=no])
  142. AM_CONDITIONAL(XML_INSTALL,test x$enable_xml_install = xyes)
  143. AC_CONFIG_FILES([Makefile])
  144. AC_OUTPUT