configure.ac 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. AC_PREREQ(2.58) dnl 2.58 required for AS_HELP_STRING
  2. dnl Extract the version (sans LF) from .version, created at release-time.
  3. m4_define(ne_version, [m4_translit(m4_include(.version), [
  4. ])])
  5. AC_INIT(neon, ne_version,,,[https://notroj.github.io/neon/])
  6. AC_COPYRIGHT([Copyright 2000-2022 Joe Orton and others
  7. This configure script may be copied, distributed and modified under the
  8. terms of the GNU Library General Public license; see src/COPYING.LIB for
  9. more details.])
  10. AC_CONFIG_MACRO_DIR([macros])
  11. AC_CONFIG_HEADERS([config.h])
  12. AC_CONFIG_SRCDIR(src/ne_request.c)
  13. NEON_WITH_LIBS
  14. # Pass through initial LDFLAGS verbatim to neon-config, so that extra
  15. # libraries which are detected (e.g. OpenSSL) can still be found when
  16. # building using the --libs output of neon-config.
  17. user_LDFLAGS=$LDFLAGS
  18. # By default, allow 'make install' to work.
  19. ALLOW_INSTALL=yes
  20. AC_DEFINE([_GNU_SOURCE], 1, [Always defined to enable GNU extensions])
  21. AC_DEFINE([NEON_IS_LIBRARY], 1, [Defined when neon is built as a library])
  22. AH_BOTTOM([
  23. /* Enable leak-tracking versions of ne_*alloc when NEON_MEMLEAK is enabled */
  24. #ifdef NEON_MEMLEAK
  25. # include "memleak.h"
  26. #endif])
  27. AC_PROG_INSTALL
  28. AC_ARG_ENABLE(webdav,
  29. AS_HELP_STRING([--disable-webdav],[disable WebDAV support]))
  30. if test "$enable_webdav" = "no"; then
  31. NEON_WITHOUT_WEBDAV
  32. else
  33. # Yes, we do need an XML parser. The _BUNDLED macros handle
  34. # this normally.
  35. NEON_NEED_XML_PARSER=yes
  36. fi
  37. # The bundled macros also set this, which makes sure we recurse
  38. # into the 'src' directory.
  39. NEON_BUILD_BUNDLED=yes
  40. # Define NEON_VERSION etc and make the appropriate substitutions.
  41. NE_VERSIONS_BUNDLED
  42. LIBNEON_SOURCE_CHECKS
  43. dnl Avoid libtool 1.5 bug where configure fails if a C++ compiler
  44. dnl is not available.
  45. m4_ifdef([AC_LIBTOOL_TAGS], [AC_LIBTOOL_TAGS([])])
  46. AC_DISABLE_SHARED
  47. m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL])
  48. AC_EXEEXT
  49. # Checks to compile test suite
  50. NEON_TEST
  51. # Use the libtool-type build.
  52. NEON_LIBTOOL_BUILD
  53. # Find an XML parser
  54. NEON_XML_PARSER
  55. # Internationalization support.
  56. NEON_I18N()
  57. # Extra checks for debugging, compiler warnings
  58. NEON_DEBUG
  59. # Leave till last to prevent CFLAGS affecting checks.
  60. NEON_WARNINGS
  61. CPPFLAGS="$CPPFLAGS -I\${top_builddir}"
  62. AC_ARG_ENABLE(memleak,
  63. AS_HELP_STRING([--enable-memleak],
  64. [for test builds only: enable memory leak checking]))
  65. if test "$enable_memleak" = "yes"; then
  66. CPPFLAGS="$CPPFLAGS -DNEON_MEMLEAK -I\$(top_srcdir)/src"
  67. # disable 'make install'
  68. ALLOW_INSTALL=memleak
  69. fi
  70. AC_ARG_ENABLE(auto-libproxy,
  71. AS_HELP_STRING([--enable-auto-libproxy],
  72. [for using libproxy during session creation]))
  73. if test "$enable_auto_libproxy" = "yes"; then
  74. AC_DEFINE(NE_ENABLE_AUTO_LIBPROXY, 1, [to use libproxy automatically])
  75. fi
  76. # Enable tests for optional features
  77. TESTS="\$(BASIC_TESTS)"
  78. HELPERS=""
  79. if test $NE_FLAG_SSL = yes; then
  80. # Only enable SSL tests if an openssl binary is found (needed to make
  81. # certs etc).
  82. AC_PATH_PROG(OPENSSL, openssl, notfound)
  83. if test "$OPENSSL" != "notfound"; then
  84. TESTS="$TESTS \$(SSL_TESTS)"
  85. HELPERS="$HELPERS \$(SSL_HELPERS)"
  86. else
  87. AC_MSG_WARN([no openssl binary in \$PATH: SSL tests disabled])
  88. fi
  89. AC_PATH_PROG(CERTUTIL, certutil, notfound)
  90. AC_PATH_PROG(PK12UTIL, pk12util, notfound)
  91. fi
  92. if test $NE_FLAG_ZLIB = yes; then
  93. TESTS="$TESTS \$(ZLIB_TESTS)"
  94. HELPERS="$HELPERS \$(ZLIB_HELPERS)"
  95. fi
  96. if test x$enable_webdav != xno; then
  97. TESTS="$TESTS \$(DAV_TESTS)"
  98. fi
  99. AC_ARG_ENABLE(tests-install,
  100. AS_HELP_STRING([--enable-tests-install],
  101. [enable installation of the test suite]),,
  102. [enable_tests_install=no])
  103. # If test suite installation is not required, it's more
  104. # efficient to link the test programs using -no-install:
  105. if test "$enable_tests_install" = "no"; then
  106. TEST_LDFLAGS="-no-install"
  107. fi
  108. AC_SUBST(TEST_LDFLAGS)
  109. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  110. if test "$PKG_CONFIG" != "no"; then
  111. # pkg-config >= 0.18 will use "Libs.private" iff necessary,
  112. # older versions which don't recognize that field may always
  113. # need all libraries in Libs.
  114. if $PKG_CONFIG --atleast-pkgconfig-version=0.18; then :; else
  115. NEON_PC_LIBS=${NEON_LIBS}
  116. fi
  117. fi
  118. AC_SUBST(NEON_PC_LIBS)
  119. # Pass the interface version on to libtool when linking libneon.la
  120. NEON_LINK_FLAGS="-version-info ${NE_LIBTOOL_VERSINFO}"
  121. # If any non-default ABI variations are used, add them to the SONAME:
  122. ### disabled for backwards-compat with 0.27.x
  123. #if test "x${NE_LIBTOOL_RELEASE}y" != "xy"; then
  124. # NEON_LINK_FLAGS="${NEON_LINK_FLAGS} -release ${NE_LIBTOOL_RELEASE}"
  125. #fi
  126. gl_LD_VERSION_SCRIPT
  127. # If ld version scripts are supported, enable symbol versioning.
  128. # Otherwise, fall back to any libtool-supported symbol export
  129. # restrictions; ne__* symbols are not exported.
  130. if test "x$have_ld_version_script" = "xyes"; then
  131. NEON_LINK_FLAGS="$NEON_LINK_FLAGS -Wl,--version-script=\$(top_srcdir)/src/neon.vers"
  132. else
  133. NEON_LINK_FLAGS="$NEON_LINK_FLAGS -export-symbols-regex '^ne_[[^_]]'"
  134. fi
  135. if test x${enable_shared}${pic_mode}z = xnodefaultz; then
  136. CFLAGS="$CFLAGS -prefer-pic"
  137. AC_MSG_NOTICE([Using PIC for static library build])
  138. fi
  139. if test x${enable_shared} = xno; then
  140. # Defining NE_PRIVATE as the empty string would work; using a
  141. # non-empty but redundant string 'extern' avoids any possible cpp
  142. # confusion with from an empty macro.
  143. CPPFLAGS="$CPPFLAGS -DNE_PRIVATE=extern"
  144. AC_MSG_NOTICE([Private symbol suppression disabled for static library build])
  145. fi
  146. # Bundled language catalogs
  147. ALL_LINGUAS="cs de fr ja ka nn pl ru tr zh_CN"
  148. AC_SUBST(ALL_LINGUAS)
  149. AC_CONFIG_FILES([neon-config], [chmod +x neon-config])
  150. AC_CONFIG_FILES([Makefile src/Makefile test/Makefile neon.pc])
  151. AC_CONFIG_FILES([test/makekeys:test/makekeys.sh], [chmod +x test/makekeys])
  152. AC_SUBST(NEON_VERSION)
  153. AC_SUBST(NEON_BUILD_BUNDLED)
  154. AC_SUBST(top_builddir)
  155. AC_SUBST(user_LDFLAGS)
  156. AC_SUBST(HELPERS)
  157. AC_SUBST(TESTS)
  158. AC_SUBST(ALLOW_INSTALL)
  159. AC_OUTPUT
  160. # for VPATH builds:
  161. test -d test/common || mkdir test/common
  162. AC_MSG_NOTICE([Configured to build AC_PACKAGE_STRING:
  163. Install prefix: ${prefix}
  164. Compiler: ${CC}
  165. XML Parser: ${neon_xml_parser_message}
  166. SSL library: ${ne_SSL_message}
  167. zlib support: ${ne_ZLIB_message}
  168. GSSAPI support: ${ne_GSSAPI_message}
  169. Build libraries: Shared=${enable_shared}, Static=${enable_static}
  170. ])
  171. case $ALLOW_INSTALL in
  172. memleak)
  173. AC_MSG_NOTICE([Configured with development-only flags:
  174. WARNING: This copy of neon has been configured with memory leak checking
  175. WARNING: enabled, which should only be used in a development build of neon.
  176. WARNING: This neon library should not be installed for use by applications.
  177. ]);;
  178. esac