configure.ac 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. # Check for mandatory faux library
  65. ################################
  66. AC_ARG_WITH(faux,
  67. [AS_HELP_STRING([--with-faux=DIR],
  68. [Search DIR directory for faux library files [default=yes]])],
  69. [use_faux=$withval],
  70. [use_faux=yes])
  71. AS_IF([test x$use_faux != xyes],
  72. [
  73. CPPFLAGS="-I${use_faux} ${CPPFLAGS}"
  74. LDFLAGS="-L${use_faux}/.libs ${LDFLAGS}"
  75. ]
  76. )
  77. AC_CHECK_HEADERS([faux/faux.h],
  78. [],
  79. [AC_MSG_ERROR([cannot find <faux/faux.h> header file])]
  80. )
  81. AC_SEARCH_LIBS([faux_zmalloc], [faux],
  82. [],
  83. [AC_MSG_ERROR([cannot find working faux library])]
  84. )
  85. ################################
  86. # Check for mandatory libyang library
  87. ################################
  88. AC_ARG_WITH(libyang,
  89. [AS_HELP_STRING([--with-libyang=DIR],
  90. [Search DIR directory for libyang library files [default=yes]])],
  91. [use_libyang=$withval],
  92. [use_libyang=yes])
  93. AS_IF([test x$use_libyang != xyes],
  94. [
  95. CPPFLAGS="-I${use_libyang} ${CPPFLAGS}"
  96. LDFLAGS="-L${use_libyang}/.libs ${LDFLAGS}"
  97. ]
  98. )
  99. AC_CHECK_HEADERS([libyang/libyang.h],
  100. [],
  101. [AC_MSG_ERROR([cannot find <libyang/libyang.h> header file])]
  102. )
  103. AC_SEARCH_LIBS([lysc_node_child], [yang],
  104. [],
  105. [AC_MSG_ERROR([cannot find working libyang library])]
  106. )
  107. ################################
  108. # Check for mandatory sysrepo library
  109. ################################
  110. AC_ARG_WITH(sysrepo,
  111. [AS_HELP_STRING([--with-sysrepo=DIR],
  112. [Search DIR directory for sysrepo library files [default=yes]])],
  113. [use_sysrepo=$withval],
  114. [use_sysrepo=yes])
  115. AS_IF([test x$use_sysrepo != xyes],
  116. [
  117. CPPFLAGS="-I${use_sysrepo} ${CPPFLAGS}"
  118. LDFLAGS="-L${use_sysrepo}/.libs ${LDFLAGS}"
  119. ]
  120. )
  121. AC_CHECK_HEADERS([sysrepo/xpath.h],
  122. [],
  123. [AC_MSG_ERROR([cannot find <sysrepo/xpath.h> header file])]
  124. )
  125. AC_SEARCH_LIBS([sr_connect], [sysrepo],
  126. [],
  127. [AC_MSG_ERROR([cannot find working sysrepo library])]
  128. )
  129. ################################
  130. # Install XML
  131. ################################
  132. AC_ARG_ENABLE(xml-install,
  133. [AS_HELP_STRING([--enable-xml-install],
  134. [Install sysrepo related XML file(s) [default=no]])],
  135. [],
  136. [enable_xml_install=no])
  137. AM_CONDITIONAL(XML_INSTALL,test x$enable_xml_install = xyes)
  138. AC_CONFIG_FILES([Makefile])
  139. AC_OUTPUT