configure.ac 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. dnl
  2. dnl Process this file with autoconf to produce a configure script
  3. dnl
  4. AC_PREREQ(2.50)
  5. AC_INIT(export_vars.sh.in)
  6. AC_CONFIG_HEADERS(include/private/apu_config.h)
  7. AC_CONFIG_AUX_DIR(build)
  8. sinclude(build/apu-conf.m4)
  9. sinclude(build/apu-iconv.m4)
  10. sinclude(build/apu-hints.m4)
  11. sinclude(build/apr_common.m4)
  12. sinclude(build/find_apr.m4)
  13. sinclude(build/dbm.m4)
  14. sinclude(build/dbd.m4)
  15. dnl Generate ./config.nice for reproducing runs of configure
  16. dnl
  17. APR_CONFIG_NICE(config.nice)
  18. CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
  19. CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
  20. LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
  21. dnl # Some initial steps for configuration. We setup the default directory
  22. dnl # and which files are to be configured.
  23. dnl Absolute source/build directory
  24. abs_srcdir=`(cd $srcdir && pwd)`
  25. abs_builddir=`pwd`
  26. if test "$abs_builddir" != "$abs_srcdir"; then
  27. USE_VPATH=1
  28. APU_CONFIG_LOCATION=build
  29. else
  30. APU_CONFIG_LOCATION=source
  31. fi
  32. AC_SUBST(APU_CONFIG_LOCATION)
  33. AC_CANONICAL_SYSTEM
  34. AC_PROG_INSTALL
  35. dnl
  36. dnl compute the top directory of the build
  37. dnl note: this is needed for LIBTOOL and exporting the bundled Expat
  38. dnl
  39. top_builddir="$abs_builddir"
  40. AC_SUBST(top_builddir)
  41. AC_SUBST(abs_srcdir)
  42. AC_SUBST(abs_builddir)
  43. dnl Initialize mkdir -p functionality.
  44. APR_MKDIR_P_CHECK($abs_srcdir/build/mkdir.sh)
  45. dnl get our version information
  46. get_version="$abs_srcdir/build/get-version.sh"
  47. version_hdr="$abs_srcdir/include/apu_version.h"
  48. APRUTIL_MAJOR_VERSION="`$get_version major $version_hdr APU`"
  49. APRUTIL_DOTTED_VERSION="`$get_version all $version_hdr APU`"
  50. AC_SUBST(APRUTIL_DOTTED_VERSION)
  51. AC_SUBST(APRUTIL_MAJOR_VERSION)
  52. echo "APR-util Version: ${APRUTIL_DOTTED_VERSION}"
  53. dnl Enable the layout handling code, then reparse the prefix-style
  54. dnl arguments due to autoconf being a PITA.
  55. APR_ENABLE_LAYOUT(apr-util)
  56. APR_PARSE_ARGUMENTS
  57. dnl load os-specific hints for apr-util
  58. APU_PRELOAD
  59. dnl
  60. dnl set up the compilation flags and stuff
  61. dnl
  62. APRUTIL_INCLUDES=""
  63. APRUTIL_PRIV_INCLUDES="-I$top_builddir/include -I$top_builddir/include/private"
  64. if test -n "$USE_VPATH"; then
  65. APRUTIL_PRIV_INCLUDES="$APRUTIL_PRIV_INCLUDES -I$abs_srcdir/include/private -I$abs_srcdir/include"
  66. fi
  67. dnl
  68. dnl Find the APR includes directory and (possibly) the source (base) dir.
  69. dnl
  70. APU_FIND_APR
  71. dnl
  72. dnl even though we use apr_rules.mk for building apr-util, we need
  73. dnl to grab CC and CPP ahead of time so that apr-util config tests
  74. dnl use the same compiler as APR; we need the same compiler options
  75. dnl and feature test macros as well
  76. dnl
  77. APR_SETIFNULL(CC, `$apr_config --cc`)
  78. APR_SETIFNULL(CPP, `$apr_config --cpp`)
  79. APR_ADDTO(CFLAGS, `$apr_config --cflags`)
  80. APR_ADDTO(CPPFLAGS, `$apr_config --cppflags`)
  81. dnl
  82. dnl Find the APR-ICONV directory.
  83. dnl
  84. if test -d ../apr-iconv; then
  85. APR_SUBDIR_CONFIG(../apr-iconv,
  86. [$apache_apr_flags --prefix=$prefix --exec-prefix=$exec_prefix --libdir=$libdir --includedir=$includedir --bindir=$bindir --datadir=$datadir --with-installbuilddir=$installbuilddir],
  87. [--enable-layout=*|\'--enable-layout=*])
  88. APRUTIL_EXPORT_LIBS="$abs_srcdir/../apr-iconv/lib/libapriconv.la $APRUTIL_EXPORT_LIBS"
  89. APRUTIL_INCLUDES="-I$abs_srcdir/../apr-iconv/include $APRUTIL_INCLUDES"
  90. APR_ICONV_DIR=../apr-iconv
  91. else
  92. APR_ICONV_DIR=""
  93. fi
  94. AC_SUBST(APR_ICONV_DIR)
  95. dnl Find LDAP library
  96. dnl Determine what DBM backend type to use.
  97. dnl Find Expat
  98. dnl Find an iconv library
  99. APU_FIND_LDAP
  100. APU_CHECK_DBM
  101. APU_CHECK_DBD
  102. APU_CHECK_DBD_MYSQL
  103. APU_CHECK_DBD_SQLITE3
  104. APU_CHECK_DBD_SQLITE2
  105. APU_FIND_EXPAT
  106. APU_FIND_ICONV
  107. AC_SEARCH_LIBS(crypt, crypt ufc)
  108. AC_MSG_CHECKING(if system crypt() function is threadsafe)
  109. if test "x$apu_crypt_threadsafe" = "x1"; then
  110. AC_DEFINE(APU_CRYPT_THREADSAFE, 1, [Define if the system crypt() function is threadsafe])
  111. msg="yes"
  112. else
  113. msg="no"
  114. fi
  115. AC_MSG_RESULT([$msg])
  116. AC_CHECK_FUNCS(crypt_r, [ crypt_r="1" ], [ crypt_r="0" ])
  117. if test "$crypt_r" = "1"; then
  118. APU_CHECK_CRYPT_R_STYLE
  119. fi
  120. so_ext=$APR_SO_EXT
  121. lib_target=$APR_LIB_TARGET
  122. AC_SUBST(so_ext)
  123. AC_SUBST(lib_target)
  124. APRUTIL_LIBNAME="aprutil${libsuffix}"
  125. AC_SUBST(APRUTIL_LIBNAME)
  126. dnl
  127. dnl Prep all the flags and stuff for compilation and export to other builds
  128. dnl
  129. APR_ADDTO(APRUTIL_LIBS, [$APR_LIBS])
  130. AC_SUBST(APRUTIL_EXPORT_LIBS)
  131. AC_SUBST(APRUTIL_PRIV_INCLUDES)
  132. AC_SUBST(APRUTIL_INCLUDES)
  133. AC_SUBST(APRUTIL_LDFLAGS)
  134. AC_SUBST(APRUTIL_LIBS)
  135. AC_SUBST(LDFLAGS)
  136. dnl copy apr's rules.mk into our build directory.
  137. if test ! -d ./build; then
  138. $mkdir_p build
  139. fi
  140. cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
  141. dnl
  142. dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
  143. dnl
  144. case "$host_alias" in
  145. *bsdi* | BSD/OS)
  146. # Check whether they've installed GNU make
  147. if make --version > /dev/null 2>&1; then
  148. INCLUDE_RULES="include $abs_builddir/build/rules.mk"
  149. INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
  150. else
  151. INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
  152. INCLUDE_OUTPUTS=".include \"$abs_srcdir/build-outputs.mk\""
  153. fi
  154. ;;
  155. *)
  156. INCLUDE_RULES="include $abs_builddir/build/rules.mk"
  157. INCLUDE_OUTPUTS="include $abs_srcdir/build-outputs.mk"
  158. ;;
  159. esac
  160. AC_SUBST(INCLUDE_RULES)
  161. AC_SUBST(INCLUDE_OUTPUTS)
  162. for d in include include/private; do
  163. test -d $top_builddir/$d || mkdir $top_builddir/$d
  164. done
  165. AC_CONFIG_FILES([Makefile export_vars.sh
  166. build/pkg/pkginfo apr-util.pc
  167. apu-$APRUTIL_MAJOR_VERSION-config:apu-config.in
  168. include/private/apu_select_dbm.h
  169. include/apr_ldap.h
  170. include/apu.h include/apu_want.h])
  171. AC_CONFIG_COMMANDS([default], [
  172. chmod +x apu-$APRUTIL_MAJOR_VERSION-config
  173. ],[
  174. APRUTIL_MAJOR_VERSION=$APRUTIL_MAJOR_VERSION
  175. ])
  176. if test -d $srcdir/test; then
  177. AC_CONFIG_FILES([test/Makefile])
  178. fi
  179. AC_OUTPUT