configure.ac 4.8 KB

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