configure.ac 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. # -*- Autoconf -*-
  2. # Process this file with autoconf to produce a configure script.
  3. AC_PREREQ(2.59)
  4. AC_INIT([dirsrv],[1.0],[http://bugzilla.redhat.com/])
  5. # AC_CONFIG_HEADER must be called right after AC_INIT.
  6. AC_CONFIG_HEADERS([config.h])
  7. # include the version information
  8. . $srcdir/VERSION.sh
  9. AC_MSG_NOTICE(This is configure for $PACKAGE_TARNAME $PACKAGE_VERSION)
  10. AC_DEFINE_UNQUOTED([DS_PACKAGE_VERSION], "$PACKAGE_VERSION", [package version])
  11. AC_DEFINE_UNQUOTED([DS_PACKAGE_TARNAME], "$PACKAGE_TARNAME", [package tarball name])
  12. AC_DEFINE_UNQUOTED([DS_PACKAGE_BUGREPORT], "$PACKAGE_BUGREPORT", [package bug report url])
  13. AC_DEFINE_UNQUOTED([DS_PACKAGE_STRING], "$PACKAGE_STRING", [package string])
  14. AM_INIT_AUTOMAKE([1.9 foreign subdir-objects dist-bzip2 no-dist-gzip no-define])
  15. # define these for automake distdir
  16. VERSION=$PACKAGE_VERSION
  17. PACKAGE=$PACKAGE_TARNAME
  18. AC_DEFINE_UNQUOTED([VERSION], "$VERSION", [package version])
  19. AC_DEFINE_UNQUOTED([PACKAGE], "$PACKAGE", [package tar name])
  20. AC_SUBST([CONSOLE_VERSION])
  21. AM_MAINTAINER_MODE
  22. AC_CANONICAL_HOST
  23. # Checks for programs.
  24. AC_PROG_CXX
  25. AC_PROG_CC
  26. AM_PROG_CC_C_O
  27. AM_PROG_AS
  28. # disable static libs by default - we only use a couple
  29. AC_DISABLE_STATIC
  30. AC_PROG_LIBTOOL
  31. # Checks for header files.
  32. AC_HEADER_DIRENT
  33. AC_HEADER_STDC
  34. AC_HEADER_SYS_WAIT
  35. 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 inttypes.h mntent.h])
  36. # Checks for typedefs, structures, and compiler characteristics.
  37. AC_HEADER_STAT
  38. AC_C_CONST
  39. AC_HEADER_STDBOOL
  40. AC_TYPE_UID_T
  41. AC_TYPE_PID_T
  42. AC_TYPE_SIZE_T
  43. AC_HEADER_TIME
  44. AC_STRUCT_TM
  45. # Checks for library functions.
  46. AC_FUNC_CHOWN
  47. AC_FUNC_CLOSEDIR_VOID
  48. AC_FUNC_ERROR_AT_LINE
  49. AC_FUNC_FORK
  50. AC_FUNC_LSTAT
  51. AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  52. AC_FUNC_MALLOC
  53. AC_FUNC_MEMCMP
  54. AC_FUNC_MMAP
  55. AC_TYPE_SIGNAL
  56. AC_FUNC_STAT
  57. AC_FUNC_STRERROR_R
  58. AC_FUNC_STRFTIME
  59. AC_FUNC_VPRINTF
  60. 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])
  61. AC_MSG_CHECKING(for --enable-debug)
  62. AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]),
  63. [
  64. AC_MSG_RESULT(yes)
  65. debug_defs="-DDEBUG -DMCC_DEBUG"
  66. ],
  67. [
  68. AC_MSG_RESULT(no)
  69. debug_defs=""
  70. ])
  71. AC_SUBST([debug_defs])
  72. # Used for legacy style packaging where we bundle all of the dependencies.
  73. AC_MSG_CHECKING(for --enable-bundle)
  74. AC_ARG_ENABLE(bundle, AS_HELP_STRING([--enable-bundle], [Enable bundled dependencies (default: no)]),
  75. [
  76. AC_MSG_RESULT(yes)
  77. bundle="1";
  78. ],
  79. [
  80. AC_MSG_RESULT(no)
  81. bundle="";
  82. ])
  83. AM_CONDITIONAL(BUNDLE,test "$bundle" = "1")
  84. # these enables are for optional or experimental features
  85. if test -z "$enable_pam_passthru" ; then
  86. enable_pam_passthru=yes # if not set on cmdline, set default
  87. fi
  88. AC_MSG_CHECKING(for --enable-pam-passthru)
  89. AC_ARG_ENABLE(pam-passthru,
  90. AS_HELP_STRING([--enable-pam-passthru],
  91. [enable the PAM passthrough auth plugin (default: yes)]))
  92. if test "$enable_pam_passthru" = yes ; then
  93. # check for pam header file used by plugins/pass_passthru/pam_ptimpl.c
  94. AC_CHECK_HEADER([security/pam_appl.h], [], [AC_MSG_ERROR([Missing header file security/pam_appl.h])])
  95. AC_MSG_RESULT(yes)
  96. AC_DEFINE([ENABLE_PAM_PASSTHRU], [1], [enable the pam passthru auth plugin])
  97. else
  98. AC_MSG_RESULT(no)
  99. fi
  100. AM_CONDITIONAL(enable_pam_passthru,test "$enable_pam_passthru" = "yes")
  101. if test -z "$enable_dna" ; then
  102. enable_dna=yes # if not set on cmdline, set default
  103. fi
  104. AC_MSG_CHECKING(for --enable-dna)
  105. AC_ARG_ENABLE(dna,
  106. AS_HELP_STRING([--enable-dna],
  107. [enable the Distributed Numeric Assignment (DNA) plugin (default: yes)]))
  108. if test "$enable_dna" = yes ; then
  109. AC_MSG_RESULT(yes)
  110. AC_DEFINE([ENABLE_DNA], [1], [enable the dna plugin])
  111. else
  112. AC_MSG_RESULT(no)
  113. fi
  114. AM_CONDITIONAL(enable_dna,test "$enable_dna" = "yes")
  115. if test -z "$enable_ldapi" ; then
  116. enable_ldapi=yes # if not set on cmdline, set default
  117. fi
  118. AC_MSG_CHECKING(for --enable-ldapi)
  119. AC_ARG_ENABLE(ldapi,
  120. AS_HELP_STRING([--enable-ldapi],
  121. [enable LDAP over unix domain socket (LDAPI) support (default: yes)]))
  122. if test "$enable_ldapi" = yes ; then
  123. AC_MSG_RESULT(yes)
  124. AC_DEFINE([ENABLE_LDAPI], [1], [enable ldapi support in the server])
  125. else
  126. AC_MSG_RESULT(no)
  127. fi
  128. AM_CONDITIONAL(enable_ldapi,test "$enable_ldapi" = "yes")
  129. if test -z "$enable_autobind" ; then
  130. enable_autobind=no # if not set on cmdline, set default
  131. fi
  132. AC_MSG_CHECKING(for --enable-autobind)
  133. AC_ARG_ENABLE(autobind,
  134. AS_HELP_STRING([--enable-autobind],
  135. [enable auto bind over unix domain socket (LDAPI) support (default: no)]))
  136. if test "$enable_ldapi" = yes -a "$enable_autobind" = yes ; then
  137. AC_MSG_RESULT(yes)
  138. AC_DEFINE([ENABLE_AUTOBIND], [1], [enable ldapi auto bind support in the server])
  139. else
  140. AC_MSG_RESULT(no)
  141. fi
  142. AM_CONDITIONAL(enable_autobind,test "$enable_autobind" = "yes")
  143. if test -z "$enable_auto_dn_suffix" ; then
  144. enable_auto_dn_suffix=no # if not set on cmdline, set default
  145. fi
  146. AC_MSG_CHECKING(for --enable-auto-dn-suffix)
  147. AC_ARG_ENABLE(autobind,
  148. AS_HELP_STRING([--enable-auto-dn-suffix],
  149. [enable auto bind with auto dn suffix over unix domain socket (LDAPI) support (default: no)]))
  150. if test "$enable_ldapi" = yes -a "$enable_autobind" = yes -a "$enable_auto_dn_suffix" = "yes"; then
  151. AC_MSG_RESULT(yes)
  152. AC_DEFINE([ENABLE_AUTO_DN_SUFFIX], [1], [enable ldapi auto bind with auto dn suffix support in the server])
  153. else
  154. AC_MSG_RESULT(no)
  155. fi
  156. AM_CONDITIONAL(enable_auto_dn_suffix,test "$enable_auto_dn_suffix" = "yes")
  157. if test -z "$enable_bitwise" ; then
  158. enable_bitwise=yes # if not set on cmdline, set default
  159. fi
  160. AC_MSG_CHECKING(for --enable-bitwise)
  161. AC_ARG_ENABLE(bitwise,
  162. AS_HELP_STRING([--enable-bitwise],
  163. [enable the bitwise matching rule plugin (default: yes)]))
  164. if test "$enable_bitwise" = yes ; then
  165. AC_MSG_RESULT(yes)
  166. AC_DEFINE([ENABLE_BITWISE], [1], [enable the bitwise plugin])
  167. else
  168. AC_MSG_RESULT(no)
  169. fi
  170. AM_CONDITIONAL(enable_bitwise,test "$enable_bitwise" = "yes")
  171. if test -z "$enable_presence" ; then
  172. enable_presence=no # if not set on cmdline, set default
  173. fi
  174. AC_MSG_CHECKING(for --enable-presence)
  175. AC_ARG_ENABLE(presence,
  176. AS_HELP_STRING([--enable-presence],
  177. [enable the presence plugin (default: no)]))
  178. if test "$enable_presence" = yes ; then
  179. AC_MSG_RESULT(yes)
  180. AC_DEFINE([ENABLE_PRESENCE], [1], [enable the presence plugin])
  181. else
  182. AC_MSG_RESULT(no)
  183. fi
  184. AM_CONDITIONAL(enable_presence,test "$enable_presence" = "yes")
  185. if test -z "$enable_acctpolicy" ; then
  186. enable_acctpolicy=yes # if not set on cmdline, set default
  187. fi
  188. AC_MSG_CHECKING(for --enable-acctpolicy)
  189. AC_ARG_ENABLE(acctpolicy,
  190. AS_HELP_STRING([--enable-acctpolicy],
  191. [enable the account policy plugin (default: yes)]))
  192. if test "$enable_acctpolicy" = yes ; then
  193. AC_MSG_RESULT(yes)
  194. AC_DEFINE([ENABLE_ACCTPOLICY], [1], [enable the account policy plugin])
  195. else
  196. AC_MSG_RESULT(no)
  197. fi
  198. AM_CONDITIONAL(enable_acctpolicy,test "$enable_acctpolicy" = "yes")
  199. if test -z "$enable_posix_winsync" ; then
  200. enable_posix_winsync=yes # if not set on cmdline, set default
  201. fi
  202. AC_MSG_CHECKING(for --enable-posix-winsync)
  203. AC_ARG_ENABLE(posix_winsync,
  204. AS_HELP_STRING([--enable-posix-winsync],
  205. [enable support for POSIX user/group attributes in winsync (default: yes)]))
  206. if test "$enable_posix_winsync" = yes ; then
  207. AC_MSG_RESULT(yes)
  208. AC_DEFINE([ENABLE_POSIX_WINSYNC], [1], [enable support for POSIX user/group attributes in winsync])
  209. else
  210. AC_MSG_RESULT(no)
  211. fi
  212. AM_CONDITIONAL(enable_posix_winsync,test "$enable_posix_winsync" = "yes")
  213. AC_MSG_CHECKING(for --enable-nunc-stans)
  214. AC_ARG_ENABLE(nunc_stans,
  215. AS_HELP_STRING([--enable-nunc-stans],
  216. [enable support for nunc-stans event framework (default: no)]))
  217. if test "$enable_nunc_stans" = yes ; then
  218. AC_MSG_RESULT(yes)
  219. AC_DEFINE([ENABLE_NUNC_STANS], [1], [enable support for nunc-stans event framework])
  220. else
  221. AC_MSG_RESULT(no)
  222. fi
  223. AM_CONDITIONAL(enable_nunc_stans,test "$enable_nunc_stans" = "yes")
  224. # the default prefix - override with --prefix or --with-fhs
  225. AC_PREFIX_DEFAULT([/opt/$PACKAGE_NAME])
  226. m4_include(m4/fhs.m4)
  227. localrundir='/run'
  228. # installation paths - by default, we store everything
  229. # under the prefix. The with-fhs option will use /usr,
  230. # /etc, and /var. The with-fhs-opt option will use the
  231. # prefix, but it's sysconfdir and localstatedir will be
  232. # /etc/opt, and /var/opt.
  233. if test "$with_fhs_opt" = "yes"; then
  234. # Override sysconfdir and localstatedir if FHS optional
  235. # package was requested.
  236. sysconfdir='/etc/opt'
  237. localstatedir='/var/opt'
  238. localrundir='/var/opt/run'
  239. # relative to datadir
  240. sampledatadir=/data
  241. # relative to datadir
  242. scripttemplatedir=/script-templates
  243. # relative to datadir
  244. updatedir=/updates
  245. # relative to libdir
  246. serverdir=
  247. # relative to includedir
  248. serverincdir=
  249. # relative to libdir
  250. serverplugindir=/plugins
  251. # relative to datadir
  252. infdir=/inf
  253. # relative to datadir
  254. mibdir=/mibs
  255. # location of property/resource files, relative to datadir
  256. propertydir=/properties
  257. # relative to libdir
  258. perldir=/perl
  259. # relative to libdir
  260. pythondir=/python
  261. else
  262. if test "$with_fhs" = "yes"; then
  263. ac_default_prefix=/usr
  264. prefix=$ac_default_prefix
  265. exec_prefix=$prefix
  266. dnl as opposed to the default /usr/etc
  267. sysconfdir='/etc'
  268. dnl as opposed to the default /usr/var
  269. localstatedir='/var'
  270. localrundir='/run'
  271. fi
  272. # relative to datadir
  273. sampledatadir=/$PACKAGE_NAME/data
  274. # relative to datadir
  275. scripttemplatedir=/$PACKAGE_NAME/script-templates
  276. # relative to datadir
  277. updatedir=/$PACKAGE_NAME/updates
  278. # relative to libdir
  279. serverdir=/$PACKAGE_NAME
  280. # relative to includedir
  281. serverincdir=/$PACKAGE_NAME
  282. # relative to libdir
  283. serverplugindir=/$PACKAGE_NAME/plugins
  284. # relative to datadir
  285. infdir=/$PACKAGE_NAME/inf
  286. # relative to datadir
  287. mibdir=/$PACKAGE_NAME/mibs
  288. # location of property/resource files, relative to datadir
  289. propertydir=/$PACKAGE_NAME/properties
  290. # relative to libdir
  291. perldir=/$PACKAGE_NAME/perl
  292. # relative to libdir
  293. pythondir=/$PACKAGE_NAME/python
  294. fi
  295. # if mandir is the default value, override it
  296. # otherwise, the user must have set it - just use it
  297. if test X"$mandir" = X'${prefix}/man' ; then
  298. mandir='$(datadir)/man'
  299. fi
  300. # Shared paths for all layouts
  301. # relative to sysconfdir
  302. configdir=/$PACKAGE_NAME/config
  303. # relative to sysconfdir
  304. schemadir=/$PACKAGE_NAME/schema
  305. # default user, group
  306. defaultuser=nobody
  307. defaultgroup=nobody
  308. if test -z "$with_tmpfiles_d" ; then
  309. if test -d $sysconfdir/tmpfiles.d ; then
  310. with_tmpfiles_d='$(sysconfdir)/tmpfiles.d'
  311. fi
  312. fi
  313. AC_MSG_CHECKING(for --with-tmpfiles-d)
  314. AC_ARG_WITH(tmpfiles-d,
  315. AS_HELP_STRING([--with-tmpfiles-d=PATH],
  316. [system uses tmpfiles.d to handle temp files/dirs (default: $with_tmpfiles_d)])
  317. )
  318. if test "$with_tmpfiles_d" = yes ; then
  319. AC_MSG_ERROR([You must specify --with-tmpfiles-d=/full/path/to/tmpfiles.d directory])
  320. elif test "$with_tmpfiles_d" = no ; then
  321. with_tmpfiles_d=
  322. else
  323. AC_MSG_RESULT([$with_tmpfiles_d])
  324. fi
  325. AC_SUBST(with_tmpfiles_d)
  326. PKG_PROG_PKG_CONFIG
  327. if test -n "$PKG_CONFIG" ; then
  328. default_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
  329. default_systemdsystemconfdir=`$PKG_CONFIG --variable=systemdsystemconfdir systemd`
  330. fi
  331. AC_MSG_CHECKING(for --with-perldir)
  332. AC_ARG_WITH([perldir],
  333. AS_HELP_STRING([--with-perldir=PATH],
  334. [Directory for perl)])
  335. )
  336. if test -n "$with_perldir"; then
  337. if test "$with_perldir" = yes ; then
  338. AC_MSG_ERROR([You must specify --with-perldir=/full/path/to/perl])
  339. elif test "$with_perldir" = no ; then
  340. with_perldir=
  341. else
  342. AC_MSG_RESULT([$with_perldir])
  343. fi
  344. else
  345. with_perldir=
  346. fi
  347. AC_MSG_CHECKING(for --with-pythondir)
  348. AC_ARG_WITH([pythondir],
  349. AS_HELP_STRING([--with-pythondir=PATH],
  350. [Directory for python)])
  351. )
  352. if test -n "$with_pythondir"; then
  353. if test "$with_pythondir" = yes ; then
  354. AC_MSG_ERROR([You must specify --with-pythondir=/full/path/to/python])
  355. elif test "$with_pythondir" = no ; then
  356. with_pythondir=
  357. else
  358. AC_MSG_RESULT([$with_pythondir])
  359. fi
  360. else
  361. with_pythondir=
  362. fi
  363. AC_MSG_CHECKING(for --with-systemdsystemunitdir)
  364. AC_ARG_WITH([systemdsystemunitdir],
  365. AS_HELP_STRING([--with-systemdsystemunitdir=PATH],
  366. [Directory for systemd service files (default: $with_systemdsystemunitdir)])
  367. )
  368. if test "$with_systemdsystemunitdir" = yes ; then
  369. if test -n "$default_systemdsystemunitdir" ; then
  370. with_systemdsystemunitdir=$default_systemdsystemunitdir
  371. AC_MSG_RESULT([$with_systemdsystemunitdir])
  372. else
  373. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  374. fi
  375. elif test "$with_systemdsystemunitdir" = no ; then
  376. with_systemdsystemunitdir=
  377. else
  378. AC_MSG_RESULT([$with_systemdsystemunitdir])
  379. fi
  380. AC_SUBST(with_systemdsystemunitdir)
  381. AC_MSG_CHECKING(for --with-systemdsystemconfdir)
  382. AC_ARG_WITH([systemdsystemconfdir],
  383. AS_HELP_STRING([--with-systemdsystemconfdir=PATH],
  384. [Directory for systemd service files (default: $with_systemdsystemconfdir)])
  385. )
  386. if test "$with_systemdsystemconfdir" = yes ; then
  387. if test -n "$default_systemdsystemconfdir" ; then
  388. with_systemdsystemconfdir=$default_systemdsystemconfdir
  389. AC_MSG_RESULT([$with_systemdsystemconfdir])
  390. else
  391. AC_MSG_ERROR([You must specify --with-systemdsystemconfdir=/full/path/to/systemd/system directory])
  392. fi
  393. elif test "$with_systemdsystemconfdir" = no ; then
  394. with_systemdsystemconfdir=
  395. else
  396. AC_MSG_RESULT([$with_systemdsystemconfdir])
  397. fi
  398. AC_SUBST(with_systemdsystemconfdir)
  399. if test -n "$with_systemdsystemunitdir" -o -n "$with_systemdsystemconfdir" ; then
  400. if test -z "$with_systemdgroupname" ; then
  401. with_systemdgroupname=$PACKAGE_NAME.target
  402. fi
  403. AC_MSG_CHECKING(for --with-systemdgroupname)
  404. AC_ARG_WITH([systemdgroupname],
  405. AS_HELP_STRING([--with-systemdgroupname=NAME],
  406. [Name of group target for all instances (default: $with_systemdgroupname)])
  407. )
  408. if test "$with_systemdgroupname" = yes ; then
  409. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  410. elif test "$with_systemdgroupname" = no ; then
  411. AC_MSG_ERROR([You must specify --with-systemdgroupname=name.of.group])
  412. else
  413. AC_MSG_RESULT([$with_systemdgroupname])
  414. fi
  415. AC_SUBST(with_systemdgroupname)
  416. fi
  417. AC_SUBST(configdir)
  418. AC_SUBST(sampledatadir)
  419. AC_SUBST(propertydir)
  420. AC_SUBST(schemadir)
  421. AC_SUBST(serverdir)
  422. AC_SUBST(serverincdir)
  423. AC_SUBST(serverplugindir)
  424. AC_SUBST(scripttemplatedir)
  425. AC_SUBST(perldir)
  426. AC_SUBST(pythondir)
  427. AC_SUBST(infdir)
  428. AC_SUBST(mibdir)
  429. AC_SUBST(mandir)
  430. AC_SUBST(updatedir)
  431. AC_SUBST(defaultuser)
  432. AC_SUBST(defaultgroup)
  433. # check for --with-instconfigdir
  434. AC_MSG_CHECKING(for --with-instconfigdir)
  435. AC_ARG_WITH(instconfigdir,
  436. AS_HELP_STRING([--with-instconfigdir=/path],
  437. [Base directory for instance specific writable configuration directories (default $sysconfdir/$PACKAGE_NAME)]),
  438. [
  439. if test $withval = yes ; then
  440. AC_ERROR([Please specify a full path with --with-instconfigdir])
  441. fi
  442. instconfigdir="$withval"
  443. AC_MSG_RESULT($withval)
  444. ],
  445. [
  446. dnl this value is expanded out in Makefile.am
  447. instconfigdir='$(sysconfdir)/$(PACKAGE_NAME)'
  448. AC_MSG_RESULT(no)
  449. ])
  450. AC_SUBST(instconfigdir)
  451. # WINNT should be true if building on Windows system not using
  452. # cygnus, mingw, or the like and using cmd.exe as the shell
  453. AM_CONDITIONAL([WINNT], false)
  454. # Deal with platform dependent defines
  455. # initdir is the location for the SysV init scripts - very heavily platform
  456. # dependent and not specified in fhs or lsb
  457. # and not used if systemd is used
  458. initdir='$(sysconfdir)/rc.d'
  459. AC_MSG_CHECKING(for --with-initddir)
  460. AC_ARG_WITH(initddir,
  461. AS_HELP_STRING([--with-initddir=/path],
  462. [Absolute path (not relative like some of the other options) that should contain the SysV init scripts (default '$(sysconfdir)/rc.d')]),
  463. [
  464. if test "$withval" = yes -o "$withval" = no ; then
  465. AC_ERROR([Please specify a full path with --with-initddir])
  466. fi
  467. AC_MSG_RESULT($withval)
  468. ],
  469. [
  470. AC_MSG_RESULT(no)
  471. ])
  472. # on most platforms, we will just use perl from PATH
  473. # On some platforms, we cannot. Why not just use any old
  474. # perl? Because of perldap. We use a perldap that is
  475. # compiled to either 32bit or 64bit, so we must use a native
  476. # perl binary compiled with the same bitsize. On Solaris
  477. # and HP-UX, /usr/bin/perl is 32 bit, so we cannot use
  478. # those with our 64 bit compiled product.
  479. if test -n "$with_perldir"; then
  480. perlexec="$with_perldir/perl"
  481. else
  482. perlexec='/usr/bin/env perl'
  483. fi
  484. # we use stty in perl scripts to disable password echo
  485. # this doesn't work unless the full absolute path of the
  486. # stty command is used e.g. system("stty -echo") does not
  487. # work but system("/bin/stty -echo") does work
  488. # since the path of stty may not be the same on all
  489. # platforms, we set the default here to /bin/stty and
  490. # allow that value to be overridden in the platform
  491. # specific section below
  492. sttyexec=/bin/stty
  493. case $host in
  494. *-*-linux*)
  495. AC_DEFINE([Linux], [1], [Linux])
  496. AC_DEFINE([LINUX], [1], [Linux])
  497. AC_DEFINE([LINUX2_0], [1], [Linux 2.0])
  498. AC_DEFINE([LINUX2_2], [1], [Linux 2.2])
  499. AC_DEFINE([LINUX2_4], [1], [Linux 2.4])
  500. AC_DEFINE([_GNU_SOURCE], [1], [GNU Source])
  501. platform="linux"
  502. initdir='$(sysconfdir)/rc.d/init.d'
  503. # do arch specific linux stuff here
  504. case $host in
  505. i*86-*-linux*)
  506. AC_DEFINE([CPU_x86], [], [cpu type x86])
  507. AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
  508. ;;
  509. x86_64-*-linux*)
  510. AC_DEFINE([CPU_x86_64], [], [cpu type x86_64])
  511. AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
  512. ;;
  513. aarch64-*-linux*)
  514. AC_DEFINE([CPU_arm], [], [cpu type arm])
  515. ;;
  516. arm*-linux*)
  517. AC_DEFINE([CPU_arm], [], [cpu type arm])
  518. ;;
  519. esac
  520. AC_MSG_CHECKING([for GCC provided 64-bit atomic bool cas function ...])
  521. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
  522. [[long long ptrval = 0, val = 0, newval = 1; (void)__sync_bool_compare_and_swap_8(&ptrval, val, newval);]])],
  523. [AC_DEFINE([HAVE_64BIT_ATOMIC_CAS_FUNC], [1], [have 64-bit atomic bool compare and swap function provided by gcc])AC_MSG_RESULT([yes])],
  524. [AC_MSG_RESULT([no])])
  525. AC_MSG_CHECKING([for GCC provided 64-bit atomic ops functions ...])
  526. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
  527. [[long long ptrval = 0, val = 0; (void)__sync_add_and_fetch_8(&ptrval, val);]])],
  528. [AC_DEFINE([HAVE_64BIT_ATOMIC_OP_FUNCS], [1], [have 64-bit atomic operation functions provided by gcc])AC_MSG_RESULT([yes])],
  529. [AC_MSG_RESULT([no])])
  530. # some programs use the native thread library directly
  531. THREADLIB=-lpthread
  532. AC_SUBST([THREADLIB], [$THREADLIB])
  533. LIBCRYPT=-lcrypt
  534. AC_SUBST([LIBCRYPT], [$LIBCRYPT])
  535. AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks])
  536. ;;
  537. ia64-hp-hpux*)
  538. AC_DEFINE([hpux], [1], [HP-UX])
  539. AC_DEFINE([HPUX], [1], [HP-UX])
  540. AC_DEFINE([HPUX11], [1], [HP-UX 11])
  541. AC_DEFINE([HPUX11_23], [1], [HP-UX 11.23])
  542. AC_DEFINE([CPU_ia64], [], [cpu type ia64])
  543. AC_DEFINE([OS_hpux], [1], [OS HP-UX])
  544. AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
  545. AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
  546. AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
  547. # assume 64 bit
  548. perlexec='/opt/perl_64/bin/perl'
  549. platform="hpux"
  550. initconfigdir="/$PACKAGE_NAME/config"
  551. # HPUX doesn't use /etc for this
  552. initdir=/init.d
  553. ;;
  554. hppa*-hp-hpux*)
  555. AC_DEFINE([hpux], [1], [HP-UX])
  556. AC_DEFINE([HPUX], [1], [HP-UX])
  557. AC_DEFINE([HPUX11], [1], [HP-UX 11])
  558. AC_DEFINE([HPUX11_11], [1], [HP-UX 11.11])
  559. AC_DEFINE([CPU_hppa], [], [cpu type pa-risc])
  560. AC_DEFINE([OS_hpux], [1], [OS HP-UX])
  561. AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
  562. AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
  563. AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
  564. AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
  565. # assume 64 bit
  566. initconfigdir="/$PACKAGE_NAME/config"
  567. perlexec='/opt/perl_64/bin/perl'
  568. platform="hpux"
  569. # HPUX doesn't use /etc for this
  570. initdir=/init.d
  571. ;;
  572. *-*-solaris*)
  573. AC_DEFINE([SVR4], [1], [SVR4])
  574. AC_DEFINE([__svr4], [1], [SVR4])
  575. AC_DEFINE([__svr4__], [1], [SVR4])
  576. AC_DEFINE([_SVID_GETTOD], [1], [SVID_GETTOD])
  577. AC_DEFINE([SOLARIS], [1], [SOLARIS])
  578. AC_DEFINE([OS_solaris], [1], [OS SOLARIS])
  579. AC_DEFINE([sunos5], [1], [SunOS5])
  580. AC_DEFINE([OSVERSION], [509], [OS version])
  581. AC_DEFINE([_REENTRANT], [1], [_REENTRANT])
  582. AC_DEFINE([NO_DOMAINNAME], [1], [no getdomainname])
  583. dnl socket nsl and dl are required to link several programs and libdb
  584. LIBSOCKET=-lsocket
  585. AC_SUBST([LIBSOCKET], [$LIBSOCKET])
  586. LIBNSL=-lnsl
  587. AC_SUBST([LIBNSL], [$LIBNSL])
  588. LIBDL=-ldl
  589. AC_SUBST([LIBDL], [$LIBDL])
  590. dnl Cstd and Crun are required to link any C++ related code
  591. LIBCSTD=-lCstd
  592. AC_SUBST([LIBCSTD], [$LIBCSTD])
  593. LIBCRUN=-lCrun
  594. AC_SUBST([LIBCRUN], [$LIBCRUN])
  595. platform="solaris"
  596. initdir='$(sysconfdir)/init.d'
  597. case $host in
  598. i?86-*-solaris2.1[[0-9]]*)
  599. dnl I dont know why i386 need this explicit
  600. AC_DEFINE([HAVE_GETPEERUCRED], [1], [have getpeerucred])
  601. ;;
  602. sparc-*-solaris*)
  603. dnl includes some assembler stuff in counter.o
  604. AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [enabling atomic counter])
  605. AC_DEFINE([CPU_sparc], [], [cpu type sparc])
  606. TARGET='SPARC'
  607. ;;
  608. esac
  609. ;;
  610. *)
  611. platform=""
  612. ;;
  613. esac
  614. # cmd line overrides default setting above
  615. if test -n "$with_initddir" ; then
  616. initdir="$with_initddir"
  617. fi
  618. # sysv init scripts not used when systemd is used
  619. AC_SUBST(initdir)
  620. AC_SUBST(perlexec)
  621. AC_SUBST(sttyexec)
  622. # set default initconfigdir if not already set
  623. # value will be set so as to be relative to $(sysconfdir)
  624. if test -z "$initconfigdir" ; then
  625. if test -d /etc/sysconfig ; then
  626. initconfigdir=/sysconfig
  627. elif test -d /etc/default ; then
  628. initconfigdir=/default
  629. else
  630. initconfigdir="/$PACKAGE_NAME/config"
  631. fi
  632. fi
  633. AC_SUBST(initconfigdir)
  634. AM_CONDITIONAL([HPUX],[test "$platform" = "hpux"])
  635. AM_CONDITIONAL([SOLARIS],[test "$platform" = "solaris"])
  636. AM_CONDITIONAL([SYSTEMD],[test -n "$with_systemdsystemunitdir" -o -n "$with_systemdsystemconfdir"])
  637. # Check for library dependencies
  638. m4_include(m4/nspr.m4)
  639. m4_include(m4/nss.m4)
  640. m4_include(m4/openldap.m4)
  641. m4_include(m4/mozldap.m4)
  642. m4_include(m4/db.m4)
  643. m4_include(m4/sasl.m4)
  644. m4_include(m4/svrcore.m4)
  645. m4_include(m4/icu.m4)
  646. m4_include(m4/netsnmp.m4)
  647. m4_include(m4/kerberos.m4)
  648. m4_include(m4/pcre.m4)
  649. m4_include(m4/selinux.m4)
  650. m4_include(m4/nunc-stans.m4)
  651. PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
  652. AC_SUBST(PACKAGE_BASE_VERSION)
  653. # set sasl_path for wrapper scripts
  654. if test -z "$sasl_libdir" ; then
  655. sasl_path="$libdir/sasl2"
  656. else
  657. sasl_path="$sasl_libdir/sasl2"
  658. fi
  659. AM_CONDITIONAL(SELINUX,test "$with_selinux" = "yes")
  660. AM_CONDITIONAL(OPENLDAP,test "$with_openldap" = "yes")
  661. AM_CONDITIONAL(SOLARIS,test "$platform" = "solaris")
  662. AM_CONDITIONAL(SPARC,test "x$TARGET" = xSPARC)
  663. # write out paths for binary components
  664. AC_SUBST(nspr_inc)
  665. AC_SUBST(nspr_lib)
  666. AC_SUBST(nspr_libdir)
  667. AC_SUBST(nss_inc)
  668. AC_SUBST(nss_lib)
  669. AC_SUBST(nss_libdir)
  670. AC_SUBST(ldapsdk_inc)
  671. AC_SUBST(ldapsdk_lib)
  672. AC_SUBST(ldapsdk_libdir)
  673. AC_SUBST(ldapsdk_bindir)
  674. AC_SUBST(openldap_inc)
  675. AC_SUBST(openldap_lib)
  676. AC_SUBST(openldap_libdir)
  677. AC_SUBST(openldap_bindir)
  678. AC_SUBST(ldaptool_bindir)
  679. AC_SUBST(ldaptool_opts)
  680. AC_SUBST(plainldif_opts)
  681. AC_SUBST(ol_libver)
  682. AC_SUBST(db_inc)
  683. AC_SUBST(db_incdir)
  684. AC_SUBST(db_lib)
  685. AC_SUBST(db_libdir)
  686. AC_SUBST(db_bindir)
  687. AC_SUBST(db_libver)
  688. AC_SUBST(sasl_inc)
  689. AC_SUBST(sasl_lib)
  690. AC_SUBST(sasl_libdir)
  691. AC_SUBST(sasl_path)
  692. AC_SUBST(svrcore_inc)
  693. AC_SUBST(svrcore_lib)
  694. AC_SUBST(icu_lib)
  695. AC_SUBST(icu_inc)
  696. AC_SUBST(icu_bin)
  697. AC_SUBST(netsnmp_inc)
  698. AC_SUBST(netsnmp_lib)
  699. AC_SUBST(netsnmp_libdir)
  700. AC_SUBST(netsnmp_link)
  701. AC_SUBST(pcre_inc)
  702. AC_SUBST(pcre_lib)
  703. AC_SUBST(pcre_libdir)
  704. AC_SUBST(nunc_stans_inc)
  705. AC_SUBST(nunc_stans_lib)
  706. AC_SUBST(nunc_stans_libdir)
  707. AC_SUBST(localrundir)
  708. AC_SUBST(brand)
  709. AC_SUBST(capbrand)
  710. AC_SUBST(vendor)
  711. # AC_DEFINE([USE_OLD_UNHASHED], [], [Use old unhashed code])
  712. AC_DEFINE([LDAP_DEBUG], [1], [LDAP debug flag])
  713. AC_DEFINE([LDAP_DONT_USE_SMARTHEAP], [1], [Don't use smartheap])
  714. # libtool on fedora/rhel contains some gcc-isms which cause problems
  715. # if not using gcc (e.g. Forte on Solaris, aCC on HP-UX)
  716. # we remove them here
  717. if test "$GCC" != yes ; then
  718. AC_MSG_NOTICE([Not using gcc - fixing libtool to remove gcc-isms . . .])
  719. cp -p libtool libtool.orig
  720. cp -p libtool libtool.tmp
  721. # dnl note the special chars @<:@ and @:>@ - since m4 treats [ and ] specially,
  722. # we have to use the quadrigraph @<:@ for [ and @:>@ for ] - and you thought
  723. # perl produced write-only code . . .
  724. sed -e '/^gcc_dir/ d' \
  725. -e '/^gcc_ver/ d' \
  726. -e 's/^predep_objects=.*echo \("@<:@^"@:>@*"\).*$/predep_objects=\1/' \
  727. -e 's/^postdep_objects=.*echo \("@<:@^"@:>@*"\).*$/postdep_objects=\1/' \
  728. -e 's/^compiler_lib_search_path=.*echo \("@<:@^"@:>@*"\).*$/compiler_lib_search_path=\1/' \
  729. -e 's/^sys_lib_search_path_spec=.*echo \("@<:@^"@:>@*"\).*$/sys_lib_search_path_spec=\1/' \
  730. libtool > libtool.tmp
  731. cp -p libtool.tmp libtool
  732. rm -f libtool.tmp
  733. fi
  734. AC_CONFIG_FILES([Makefile])
  735. AC_OUTPUT