configure.ac 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. m4_define([MAJOR_VERSION], 3)
  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, 3)
  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_LIBTOOL_WIN32_DLL
  21. AC_PROG_LIBTOOL
  22. AC_CONFIG_HEADERS([config.h])
  23. AM_INIT_AUTOMAKE(subdir-objects)
  24. AM_PROG_CC_C_O
  25. # needed to handle 64-bit architecture
  26. AC_CHECK_SIZEOF(int)
  27. AC_CHECK_SIZEOF(long)
  28. AC_CHECK_SIZEOF(size_t)
  29. #########################################
  30. # See if linker supports version scripts
  31. #########################################
  32. # Check if LD supports linker scripts,
  33. # and define automake conditional HAVE_LD_VERSION_SCRIPT if so.
  34. AC_ARG_ENABLE([ld-version-script],
  35. AS_HELP_STRING([--enable-ld-version-script],
  36. [enable linker version script (default is enabled when possible)]),
  37. [have_ld_version_script=$enableval], [])
  38. if test -z "$have_ld_version_script"; then
  39. AC_MSG_CHECKING([if LD -Wl,--version-script works])
  40. save_LDFLAGS="$LDFLAGS"
  41. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  42. cat > conftest.map <<EOF
  43. VERS_1 {
  44. global: sym;
  45. };
  46. VERS_2 {
  47. global: sym;
  48. } VERS_1;
  49. EOF
  50. AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 0; }])],
  51. [have_ld_version_script=yes], [have_ld_version_script=no])
  52. rm -f conftest.map
  53. LDFLAGS="$save_LDFLAGS"
  54. AC_MSG_RESULT($have_ld_version_script)
  55. fi
  56. AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  57. ################################
  58. # Deal with debugging options
  59. ################################
  60. AC_ARG_ENABLE(debug,
  61. [AS_HELP_STRING([--enable-debug],
  62. [Turn on debugging including asserts [default=no]])],
  63. [],
  64. [enable_debug=no])
  65. AM_CONDITIONAL(DEBUG,test x$enable_debug = xyes)
  66. ################################
  67. # Variables to install plugins
  68. ################################
  69. PLUGINS_SUBDIR=plugins
  70. AC_SUBST(PLUGINS_SUBDIR)
  71. ################################
  72. # Check for mandatory faux library
  73. ################################
  74. AC_ARG_WITH(faux,
  75. [AS_HELP_STRING([--with-faux=DIR],
  76. [Search DIR directory for faux library files [default=yes]])],
  77. [use_faux=$withval],
  78. [use_faux=yes])
  79. AS_IF([test x$use_faux != xyes],
  80. [
  81. CPPFLAGS="-I${use_faux} ${CPPFLAGS}"
  82. LDFLAGS="-L${use_faux}/.libs ${LDFLAGS}"
  83. ]
  84. )
  85. AC_CHECK_HEADERS([faux/faux.h],
  86. [],
  87. [AC_MSG_ERROR([cannot find <faux/faux.h> header file])]
  88. )
  89. AC_SEARCH_LIBS([faux_zmalloc], [faux],
  90. [],
  91. [AC_MSG_ERROR([cannot find working faux library])]
  92. )
  93. ################################
  94. # Check for mandatory libyang library
  95. ################################
  96. AC_ARG_WITH(libyang,
  97. [AS_HELP_STRING([--with-libyang=DIR],
  98. [Search DIR directory for libyang library files [default=yes]])],
  99. [use_libyang=$withval],
  100. [use_libyang=yes])
  101. AS_IF([test x$use_libyang != xyes],
  102. [
  103. CPPFLAGS="-I${use_libyang} ${CPPFLAGS}"
  104. LDFLAGS="-L${use_libyang}/.libs ${LDFLAGS}"
  105. ]
  106. )
  107. AC_CHECK_HEADERS([libyang/libyang.h],
  108. [],
  109. [AC_MSG_ERROR([cannot find <libyang/libyang.h> header file])]
  110. )
  111. AC_SEARCH_LIBS([lysc_node_child], [yang],
  112. [],
  113. [AC_MSG_ERROR([cannot find working libyang library])]
  114. )
  115. ################################
  116. # Check for mandatory sysrepo library
  117. ################################
  118. AC_ARG_WITH(sysrepo,
  119. [AS_HELP_STRING([--with-sysrepo=DIR],
  120. [Search DIR directory for sysrepo library files [default=yes]])],
  121. [use_sysrepo=$withval],
  122. [use_sysrepo=yes])
  123. AS_IF([test x$use_sysrepo != xyes],
  124. [
  125. CPPFLAGS="-I${use_sysrepo} ${CPPFLAGS}"
  126. LDFLAGS="-L${use_sysrepo}/.libs ${LDFLAGS}"
  127. ]
  128. )
  129. AC_CHECK_HEADERS([sysrepo/xpath.h],
  130. [],
  131. [AC_MSG_ERROR([cannot find <sysrepo/xpath.h> header file])]
  132. )
  133. AC_SEARCH_LIBS([sr_connect], [sysrepo],
  134. [],
  135. [AC_MSG_ERROR([cannot find working sysrepo library])]
  136. )
  137. AC_CONFIG_FILES([Makefile])
  138. AC_OUTPUT