configure.ac 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.59)
  4. # This version is the version returned by ns-slapd -v
  5. AC_INIT([dirsrv], [1.1.0b2], [http://bugzilla.redhat.com/])
  6. # AC_CONFIG_HEADER must be called right after AC_INIT.
  7. AC_CONFIG_HEADERS([config.h])
  8. AM_INIT_AUTOMAKE([1.9 foreign subdir-objects])
  9. AM_MAINTAINER_MODE
  10. AC_CANONICAL_HOST
  11. # Checks for programs.
  12. AC_PROG_CXX
  13. AC_PROG_CC
  14. AM_PROG_CC_C_O
  15. # disable static libs by default - we only use a couple
  16. AC_DISABLE_STATIC
  17. AC_PROG_LIBTOOL
  18. # Checks for header files.
  19. AC_HEADER_DIRENT
  20. AC_HEADER_STDC
  21. AC_HEADER_SYS_WAIT
  22. AC_CHECK_HEADERS([arpa/inet.h fcntl.h malloc.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/file.h sys/socket.h sys/time.h unistd.h])
  23. # Checks for typedefs, structures, and compiler characteristics.
  24. AC_HEADER_STAT
  25. AC_C_CONST
  26. AC_HEADER_STDBOOL
  27. AC_TYPE_UID_T
  28. AC_TYPE_PID_T
  29. AC_TYPE_SIZE_T
  30. AC_HEADER_TIME
  31. AC_STRUCT_TM
  32. # Checks for library functions.
  33. AC_FUNC_CHOWN
  34. AC_FUNC_CLOSEDIR_VOID
  35. AC_FUNC_ERROR_AT_LINE
  36. AC_FUNC_FORK
  37. AC_FUNC_LSTAT
  38. AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  39. AC_FUNC_MALLOC
  40. AC_FUNC_MEMCMP
  41. AC_FUNC_MMAP
  42. AC_TYPE_SIGNAL
  43. AC_FUNC_STAT
  44. AC_FUNC_STRERROR_R
  45. AC_FUNC_STRFTIME
  46. AC_FUNC_VPRINTF
  47. AC_CHECK_FUNCS([setrlimit endpwent ftruncate getcwd gethostbyname inet_ntoa localtime_r memmove memset mkdir munmap putenv rmdir socket strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strstr strtol tzset])
  48. AC_MSG_CHECKING(for --enable-debug)
  49. AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]),
  50. [
  51. AC_MSG_RESULT(yes)
  52. debug_defs="-DDEBUG -DMCC_DEBUG"
  53. ],
  54. [
  55. AC_MSG_RESULT(no)
  56. debug_defs=""
  57. ])
  58. AC_SUBST([debug_defs])
  59. # Used for legacy style packaging where we bundle all of the dependencies.
  60. AC_MSG_CHECKING(for --enable-bundle)
  61. AC_ARG_ENABLE(bundle, AS_HELP_STRING([--enable-bundle], [Enable bundled dependencies (default: no)]),
  62. [
  63. AC_MSG_RESULT(yes)
  64. bundle="1";
  65. ],
  66. [
  67. AC_MSG_RESULT(no)
  68. bundle="";
  69. ])
  70. AM_CONDITIONAL(BUNDLE,test "$bundle" = "1")
  71. # these enables are for optional or experimental features
  72. if test -z "$enable_pam_passthru" ; then
  73. enable_pam_passthru=yes # if not set on cmdline, set default
  74. fi
  75. AC_MSG_CHECKING(for --enable-pam-passthru)
  76. AC_ARG_ENABLE(pam-passthru,
  77. AS_HELP_STRING([--enable-pam-passthru],
  78. [enable the PAM passthrough auth plugin (default: yes)]))
  79. if test "$enable_pam_passthru" = yes ; then
  80. AC_MSG_RESULT(yes)
  81. AC_DEFINE([ENABLE_PAM_PASSTHRU], [1], [enable the pam passthru auth plugin])
  82. else
  83. AC_MSG_RESULT(no)
  84. fi
  85. AM_CONDITIONAL(enable_pam_passthru,test "$enable_pam_passthru" = "yes")
  86. if test -z "$enable_dna" ; then
  87. enable_dna=yes # if not set on cmdline, set default
  88. fi
  89. AC_MSG_CHECKING(for --enable-dna)
  90. AC_ARG_ENABLE(dna,
  91. AS_HELP_STRING([--enable-dna],
  92. [enable the Distributed Numeric Assignment (DNA) plugin (default: yes)]))
  93. if test "$enable_dna" = yes ; then
  94. AC_MSG_RESULT(yes)
  95. AC_DEFINE([ENABLE_DNA], [1], [enable the dna plugin])
  96. else
  97. AC_MSG_RESULT(no)
  98. fi
  99. AM_CONDITIONAL(enable_dna,test "$enable_dna" = "yes")
  100. if test -z "$enable_ldapi" ; then
  101. enable_ldapi=yes # if not set on cmdline, set default
  102. fi
  103. AC_MSG_CHECKING(for --enable-ldapi)
  104. AC_ARG_ENABLE(ldapi,
  105. AS_HELP_STRING([--enable-ldapi],
  106. [enable LDAP over unix domain socket (LDAPI) support (default: yes)]))
  107. if test "$enable_ldapi" = yes ; then
  108. AC_MSG_RESULT(yes)
  109. AC_DEFINE([ENABLE_LDAPI], [1], [enable ldapi support in the server])
  110. else
  111. AC_MSG_RESULT(no)
  112. fi
  113. AM_CONDITIONAL(enable_ldapi,test "$enable_ldapi" = "yes")
  114. if test -z "$enable_bitwise" ; then
  115. enable_bitwise=yes # if not set on cmdline, set default
  116. fi
  117. AC_MSG_CHECKING(for --enable-bitwise)
  118. AC_ARG_ENABLE(bitwise,
  119. AS_HELP_STRING([--enable-bitwise],
  120. [enable the bitwise matching rule plugin (default: yes)]))
  121. if test "$enable_bitwise" = yes ; then
  122. AC_MSG_RESULT(yes)
  123. AC_DEFINE([ENABLE_BITWISE], [1], [enable the bitwise plugin])
  124. else
  125. AC_MSG_RESULT(no)
  126. fi
  127. AM_CONDITIONAL(enable_bitwise,test "$enable_bitwise" = "yes")
  128. # the default prefix - override with --prefix or --with-fhs
  129. AC_PREFIX_DEFAULT([/opt/$PACKAGE_NAME])
  130. brand=fedora
  131. capbrand=Fedora
  132. vendor="Fedora Project"
  133. m4_include(m4/fhs.m4)
  134. # installation paths - by default, we store everything
  135. # under the prefix. The with-fhs option will use /usr,
  136. # /etc, and /var. The with-fhs-opt option will use the
  137. # prefix, but it's sysconfdir and localstatedir will be
  138. # /etc/opt, and /var/opt.
  139. if test "$with_fhs_opt" = "yes"; then
  140. # Override sysconfdir and localstatedir if FHS optional
  141. # package was requested.
  142. sysconfdir='/etc/opt'
  143. localstatedir='/var/opt'
  144. # relative to datadir
  145. sampledatadir=/data
  146. # relative to datadir
  147. scripttemplatedir=/script-templates
  148. # relative to libdir
  149. serverdir=
  150. # relative to libdir
  151. serverplugindir=/plugins
  152. # relative to datadir
  153. infdir=/inf
  154. # relative to datadir
  155. mibdir=/mibs
  156. # location of property/resource files, relative to datadir
  157. propertydir=/properties
  158. # relative to libdir
  159. perldir=/perl
  160. else
  161. if test "$with_fhs" = "yes"; then
  162. ac_default_prefix=/usr
  163. prefix=$ac_default_prefix
  164. exec_prefix=$prefix
  165. dnl as opposed to the default /usr/etc
  166. sysconfdir='/etc'
  167. dnl as opposed to the default /usr/var
  168. localstatedir='/var'
  169. fi
  170. # relative to datadir
  171. sampledatadir=/$PACKAGE_NAME/data
  172. # relative to datadir
  173. scripttemplatedir=/$PACKAGE_NAME/script-templates
  174. # relative to libdir
  175. serverdir=/$PACKAGE_NAME
  176. # relative to libdir
  177. serverplugindir=/$PACKAGE_NAME/plugins
  178. # relative to datadir
  179. infdir=/$PACKAGE_NAME/inf
  180. # relative to datadir
  181. mibdir=/$PACKAGE_NAME/mibs
  182. # location of property/resource files, relative to datadir
  183. propertydir=/$PACKAGE_NAME/properties
  184. # relative to libdir
  185. perldir=/$PACKAGE_NAME/perl
  186. fi
  187. # Shared paths for all layouts
  188. # relative to sysconfdir
  189. configdir=/$PACKAGE_NAME/config
  190. # relative to sysconfdir
  191. schemadir=/$PACKAGE_NAME/schema
  192. # default user, group
  193. defaultuser=nobody
  194. defaultgroup=nobody
  195. AC_SUBST(configdir)
  196. AC_SUBST(sampledatadir)
  197. AC_SUBST(propertydir)
  198. AC_SUBST(schemadir)
  199. AC_SUBST(serverdir)
  200. AC_SUBST(serverplugindir)
  201. AC_SUBST(scripttemplatedir)
  202. AC_SUBST(perldir)
  203. AC_SUBST(infdir)
  204. AC_SUBST(mibdir)
  205. AC_SUBST(defaultuser)
  206. AC_SUBST(defaultgroup)
  207. # check for --with-instconfigdir
  208. AC_MSG_CHECKING(for --with-instconfigdir)
  209. AC_ARG_WITH(instconfigdir,
  210. AS_HELP_STRING([--with-instconfigdir=/path],
  211. [Base directory for instance specific writable configuration directories (default $sysconfdir/$PACKAGE_NAME)]),
  212. [
  213. if test $withval = yes ; then
  214. AC_ERROR([Please specify a full path with --with-instconfigdir])
  215. fi
  216. instconfigdir="$withval"
  217. ],
  218. [
  219. dnl this value is expanded out in Makefile.am
  220. instconfigdir='$(sysconfdir)/$(PACKAGE_NAME)'
  221. ])
  222. AC_SUBST(instconfigdir)
  223. # WINNT should be true if building on Windows system not using
  224. # cygnus, mingw, or the like and using cmd.exe as the shell
  225. AM_CONDITIONAL([WINNT], false)
  226. # Deal with platform dependent defines
  227. # relative to sysconfdir
  228. initdir=/rc.d
  229. # on most platforms, we will just use perl from PATH
  230. # On some platforms, we cannot. Why not just use any old
  231. # perl? Because of perldap. We use a perldap that is
  232. # compiled to either 32bit or 64bit, so we must use a native
  233. # perl binary compiled with the same bitsize. On Solaris
  234. # and HP-UX, /usr/bin/perl is 32 bit, so we cannot use
  235. # those with our 64 bit compiled product.
  236. perlexec='/usr/bin/env perl'
  237. case $host in
  238. *-*-linux*)
  239. AC_DEFINE([XP_UNIX], [1], [UNIX])
  240. AC_DEFINE([Linux], [1], [Linux])
  241. AC_DEFINE([LINUX], [1], [Linux])
  242. AC_DEFINE([LINUX2_0], [1], [Linux 2.0])
  243. AC_DEFINE([LINUX2_2], [1], [Linux 2.2])
  244. AC_DEFINE([LINUX2_4], [1], [Linux 2.4])
  245. platform="linux"
  246. # relative to sysconfdir
  247. initdir=/rc.d/init.d
  248. ;;
  249. ia64-hp-hpux*)
  250. AC_DEFINE([XP_UNIX], [1], [UNIX])
  251. AC_DEFINE([hpux], [1], [HP-UX])
  252. AC_DEFINE([HPUX], [1], [HP-UX])
  253. AC_DEFINE([HPUX11], [1], [HP-UX 11])
  254. AC_DEFINE([HPUX11_23], [1], [HP-UX 11.23])
  255. AC_DEFINE([CPU_ia64], [], [cpu type ia64])
  256. AC_DEFINE([OS_hpux], [1], [OS HP-UX])
  257. AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
  258. AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
  259. # assume 64 bit
  260. perlexec='/opt/perl_64/bin/perl'
  261. platform="hpux"
  262. initconfigdir="/$PACKAGE_NAME/config"
  263. ;;
  264. hppa*-hp-hpux*)
  265. AC_DEFINE([XP_UNIX], [1], [UNIX])
  266. AC_DEFINE([hpux], [1], [HP-UX])
  267. AC_DEFINE([HPUX], [1], [HP-UX])
  268. AC_DEFINE([HPUX11], [1], [HP-UX 11])
  269. AC_DEFINE([HPUX11_11], [1], [HP-UX 11.11])
  270. AC_DEFINE([CPU_hppa], [], [cpu type pa-risc])
  271. AC_DEFINE([OS_hpux], [1], [OS HP-UX])
  272. AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
  273. AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
  274. # assume 64 bit
  275. initconfigdir="/$PACKAGE_NAME/config"
  276. perlexec='/opt/perl_64/bin/perl'
  277. platform="hpux"
  278. ;;
  279. sparc-sun-solaris*)
  280. AC_DEFINE([XP_UNIX], [1], [UNIX])
  281. AC_DEFINE([SVR4], [1], [SVR4])
  282. AC_DEFINE([__svr4], [1], [SVR4])
  283. AC_DEFINE([__svr4__], [1], [SVR4])
  284. AC_DEFINE([_SVID_GETTOD], [1], [SVID_GETTOD])
  285. AC_DEFINE([SOLARIS], [1], [SOLARIS])
  286. AC_DEFINE([CPU_sparc], [], [cpu type sparc])
  287. AC_DEFINE([OS_solaris], [1], [OS SOLARIS])
  288. AC_DEFINE([sunos5], [1], [SunOS5])
  289. AC_DEFINE([OSVERSION], [509], [OS version])
  290. AC_DEFINE([_REENTRANT], [1], [_REENTRANT])
  291. AC_DEFINE([NO_DOMAINNAME], [1], [no getdomainname])
  292. dnl socket nsl and dl are required to link several programs and libdb
  293. LIBSOCKET=-lsocket
  294. AC_SUBST([LIBSOCKET], [$LIBSOCKET])
  295. LIBNSL=-lnsl
  296. AC_SUBST([LIBNSL], [$LIBNSL])
  297. LIBDL=-ldl
  298. AC_SUBST([LIBDL], [$LIBDL])
  299. dnl Cstd and Crun are required to link any C++ related code
  300. LIBCSTD=-lCstd
  301. AC_SUBST([LIBCSTD], [$LIBCSTD])
  302. LIBCRUN=-lCrun
  303. AC_SUBST([LIBCRUN], [$LIBCRUN])
  304. platform="solaris"
  305. # assume 64 bit
  306. perlexec='/opt/perl5x/bin/perl'
  307. # relative to sysconfdir
  308. initdir=/init.d
  309. ;;
  310. *)
  311. platform=""
  312. ;;
  313. esac
  314. AC_SUBST(initdir)
  315. AC_SUBST(perlexec)
  316. # set default initconfigdir if not already set
  317. # value will be set so as to be relative to $(sysconfdir)
  318. if test -z "$initconfigdir" ; then
  319. if test -d /etc/sysconfig ; then
  320. initconfigdir=/sysconfig
  321. elif test -d /etc/default ; then
  322. initconfigdir=/default
  323. else
  324. initconfigdir="/$PACKAGE_NAME/config"
  325. fi
  326. fi
  327. AC_SUBST(initconfigdir)
  328. AM_CONDITIONAL(HPUX,test "$platform" = "hpux")
  329. AM_CONDITIONAL(SOLARIS,test "$platform" = "solaris")
  330. # Check for library dependencies
  331. m4_include(m4/nspr.m4)
  332. m4_include(m4/nss.m4)
  333. m4_include(m4/mozldap.m4)
  334. m4_include(m4/db.m4)
  335. m4_include(m4/sasl.m4)
  336. m4_include(m4/svrcore.m4)
  337. m4_include(m4/icu.m4)
  338. m4_include(m4/netsnmp.m4)
  339. PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
  340. AC_SUBST(PACKAGE_BASE_VERSION)
  341. # set sasl_path for wrapper scripts
  342. if test -z "$sasl_libdir" ; then
  343. sasl_path="$libdir/sasl2"
  344. else
  345. sasl_path="$sasl_libdir/sasl2"
  346. fi
  347. # write out paths for binary components
  348. AC_SUBST(nspr_inc)
  349. AC_SUBST(nspr_lib)
  350. AC_SUBST(nspr_libdir)
  351. AC_SUBST(nss_inc)
  352. AC_SUBST(nss_lib)
  353. AC_SUBST(nss_libdir)
  354. AC_SUBST(ldapsdk_inc)
  355. AC_SUBST(ldapsdk_lib)
  356. AC_SUBST(ldapsdk_libdir)
  357. AC_SUBST(ldapsdk_bindir)
  358. AC_SUBST(db_inc)
  359. AC_SUBST(db_incdir)
  360. AC_SUBST(db_lib)
  361. AC_SUBST(db_libdir)
  362. AC_SUBST(db_bindir)
  363. AC_SUBST(db_libver)
  364. AC_SUBST(sasl_inc)
  365. AC_SUBST(sasl_lib)
  366. AC_SUBST(sasl_libdir)
  367. AC_SUBST(sasl_path)
  368. AC_SUBST(svrcore_inc)
  369. AC_SUBST(svrcore_lib)
  370. AC_SUBST(icu_lib)
  371. AC_SUBST(icu_inc)
  372. AC_SUBST(icu_bin)
  373. AC_SUBST(netsnmp_inc)
  374. AC_SUBST(netsnmp_lib)
  375. AC_SUBST(netsnmp_libdir)
  376. AC_SUBST(netsnmp_link)
  377. AC_SUBST(brand)
  378. AC_SUBST(capbrand)
  379. AC_SUBST(vendor)
  380. AC_DEFINE([LDAP_DEBUG], [1], [LDAP debug flag])
  381. AC_DEFINE([LDAP_DONT_USE_SMARTHEAP], [1], [Don't use smartheap])
  382. # libtool on fedora/rhel contains some gcc-isms which cause problems
  383. # if not using gcc (e.g. Forte on Solaris, aCC on HP-UX)
  384. # we remove them here
  385. if test "$GCC" != yes ; then
  386. AC_MSG_NOTICE([Not using gcc - fixing libtool to remove gcc-isms . . .])
  387. cp -p libtool libtool.orig
  388. cp -p libtool libtool.tmp
  389. # dnl note the special chars @<:@ and @:>@ - since m4 treats [ and ] specially,
  390. # we have to use the quadrigraph @<:@ for [ and @:>@ for ] - and you thought
  391. # perl produced write-only code . . .
  392. sed -e '/^gcc_dir/ d' \
  393. -e '/^gcc_ver/ d' \
  394. -e 's/^predep_objects=.*echo \("@<:@^"@:>@*"\).*$/predep_objects=\1/' \
  395. -e 's/^postdep_objects=.*echo \("@<:@^"@:>@*"\).*$/postdep_objects=\1/' \
  396. -e 's/^compiler_lib_search_path=.*echo \("@<:@^"@:>@*"\).*$/compiler_lib_search_path=\1/' \
  397. -e 's/^sys_lib_search_path_spec=.*echo \("@<:@^"@:>@*"\).*$/sys_lib_search_path_spec=\1/' \
  398. libtool > libtool.tmp
  399. cp -p libtool.tmp libtool
  400. rm -f libtool.tmp
  401. fi
  402. AC_CONFIG_FILES([Makefile])
  403. AC_OUTPUT