configure.ac 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918
  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 tar-pax])
  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([RPM_VERSION])
  21. AC_SUBST([RPM_RELEASE])
  22. AC_SUBST([VERSION_PREREL])
  23. AC_SUBST([CONSOLE_VERSION])
  24. AM_MAINTAINER_MODE
  25. AC_CANONICAL_HOST
  26. AC_CONFIG_MACRO_DIRS([m4])
  27. # Checks for programs.
  28. : ${CXXFLAGS=""}
  29. AC_PROG_CXX
  30. : ${CFLAGS=""}
  31. AC_PROG_CC
  32. AM_PROG_CC_C_O
  33. AM_PROG_AS
  34. AC_PROG_CC_STDC
  35. PKG_PROG_PKG_CONFIG
  36. # disable static libs by default - we only use a couple
  37. AC_DISABLE_STATIC
  38. AC_PROG_LIBTOOL
  39. # Checks for header files.
  40. AC_HEADER_DIRENT
  41. AC_HEADER_STDC
  42. AC_HEADER_SYS_WAIT
  43. AC_CHECK_HEADERS([arpa/inet.h errno.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 syslog.h unistd.h mntent.h sys/sysinfo.h sys/endian.h endian.h])
  44. # These are *required* headers without option.
  45. AC_CHECK_HEADERS([inttypes.h], [], AC_MSG_ERROR([unable to locate required header inttypes.h]))
  46. AC_CHECK_HEADERS([crack.h], [], AC_MSG_ERROR([unable to locate required header crack.h]))
  47. # Checks for typedefs, structures, and compiler characteristics.
  48. AC_HEADER_STAT
  49. AC_C_CONST
  50. AC_HEADER_STDBOOL
  51. AC_TYPE_UID_T
  52. AC_TYPE_PID_T
  53. AC_TYPE_SIZE_T
  54. AC_HEADER_TIME
  55. AC_STRUCT_TM
  56. # Checks for library functions.
  57. AC_FUNC_CHOWN
  58. AC_FUNC_CLOSEDIR_VOID
  59. AC_FUNC_ERROR_AT_LINE
  60. AC_FUNC_FORK
  61. AC_FUNC_LSTAT
  62. AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
  63. AC_FUNC_MALLOC
  64. AC_FUNC_MEMCMP
  65. AC_FUNC_MMAP
  66. AC_TYPE_SIGNAL
  67. AC_FUNC_STAT
  68. AC_FUNC_STRERROR_R
  69. AC_FUNC_STRFTIME
  70. AC_FUNC_VPRINTF
  71. AC_CHECK_FUNCS([endpwent ftruncate getcwd getaddrinfo inet_pton inet_ntop localtime_r memmove memset mkdir munmap putenv rmdir setrlimit socket strcasecmp strchr strcspn strdup strerror strncasecmp strpbrk strrchr strstr strtol tzset])
  72. # These functions are *required* without option.
  73. AC_CHECK_FUNCS([clock_gettime], [], AC_MSG_ERROR([unable to locate required symbol clock_gettime]))
  74. # This will detect if we need to add the LIBADD_DL value for us.
  75. LT_LIB_DLLOAD
  76. # Optional rust component support.
  77. AC_MSG_CHECKING(for --enable-rust-offline)
  78. AC_ARG_ENABLE(rust_offline, AS_HELP_STRING([--enable-rust-offline], [Enable rust building offline. you MUST have run vendor! (default: no)]),
  79. [], [ enable_rust_offline=no ])
  80. AC_MSG_RESULT($enable_rust_offline)
  81. AM_CONDITIONAL([RUST_ENABLE_OFFLINE],[test "$enable_rust_offline" = yes])
  82. AC_MSG_CHECKING(for --enable-rust)
  83. AC_ARG_ENABLE(rust, AS_HELP_STRING([--enable-rust], [Enable rust language features (default: no)]),
  84. [], [ enable_rust=no ])
  85. AC_MSG_RESULT($enable_rust)
  86. if test "$enable_rust" = yes -o "$enable_rust_offline" = yes; then
  87. AC_CHECK_PROG(CARGO, [cargo], [yes], [no])
  88. AC_CHECK_PROG(RUSTC, [rustc], [yes], [no])
  89. AS_IF([test "$CARGO" != "yes" -o "$RUSTC" != "yes"], [
  90. AC_MSG_FAILURE("Rust based plugins cannot be built cargo=$CARGO rustc=$RUSTC")
  91. ])
  92. fi
  93. AM_CONDITIONAL([RUST_ENABLE],[test "$enable_rust" = yes -o "$enable_rust_offline" = yes])
  94. AC_MSG_CHECKING(for --enable-debug)
  95. AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]),
  96. [], [ enable_debug=no ])
  97. AC_MSG_RESULT($enable_debug)
  98. if test "$enable_debug" = yes ; then
  99. debug_defs="-DDEBUG -DMCC_DEBUG"
  100. debug_cflags="-g3 -O0 -rdynamic"
  101. debug_cxxflags="-g3 -O0 -rdynamic"
  102. debug_rust_defs="-C debuginfo=2"
  103. cargo_defs=""
  104. rust_target_dir="debug"
  105. else
  106. debug_defs=""
  107. # set the default safe CFLAGS that would be set by AC_PROG_CC otherwise
  108. debug_cflags="-g -O2"
  109. debug_cxxflags="-g -O2"
  110. debug_rust_defs="-C debuginfo=2"
  111. cargo_defs="--release"
  112. rust_target_dir="release"
  113. fi
  114. AC_SUBST([debug_defs])
  115. AC_SUBST([debug_cflags])
  116. AC_SUBST([debug_cxxflags])
  117. AC_SUBST([debug_rust_defs])
  118. AC_SUBST([cargo_defs])
  119. AC_SUBST([rust_target_dir])
  120. AM_CONDITIONAL([DEBUG],[test "$enable_debug" = yes])
  121. AC_MSG_CHECKING(for --enable-asan)
  122. AC_ARG_ENABLE(asan, AS_HELP_STRING([--enable-asan], [Enable gcc/clang address sanitizer options (default: no)]),
  123. [], [ enable_asan=no ])
  124. AC_MSG_RESULT($enable_asan)
  125. if test "$enable_asan" = yes ; then
  126. asan_cflags="-fsanitize=address -fno-omit-frame-pointer -lasan"
  127. asan_rust_defs="-Z sanitizer=address"
  128. else
  129. asan_cflags=""
  130. asan_rust_defs=""
  131. fi
  132. AC_SUBST([asan_cflags])
  133. AC_SUBST([asan_rust_defs])
  134. AM_CONDITIONAL(enable_asan,test "$enable_asan" = "yes")
  135. AC_MSG_CHECKING(for --enable-msan)
  136. AC_ARG_ENABLE(msan, AS_HELP_STRING([--enable-msan], [Enable gcc/clang memory sanitizer options (default: no)]),
  137. [], [ enable_msan=no ])
  138. AC_MSG_RESULT($enable_msan)
  139. if test "$enable_msan" = yes ; then
  140. msan_cflags="-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer"
  141. msan_rust_defs="-Z sanitizer=memory"
  142. else
  143. msan_cflags=""
  144. msan_rust_defs=""
  145. fi
  146. AC_SUBST([msan_cflags])
  147. AC_SUBST([msan_rust_defs])
  148. AM_CONDITIONAL(enable_msan,test "$enable_msan" = "yes")
  149. AC_MSG_CHECKING(for --enable-tsan)
  150. AC_ARG_ENABLE(tsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang thread sanitizer options (default: no)]),
  151. [], [ enable_tsan=no ])
  152. AC_MSG_RESULT($enable_tsan)
  153. if test "$enable_tsan" = yes ; then
  154. tsan_cflags="-fsanitize=thread -fno-omit-frame-pointer"
  155. tsan_rust_defs="-Z sanitizer=thread"
  156. else
  157. tsan_cflags=""
  158. tsan_rust_defs=""
  159. fi
  160. AC_SUBST([tsan_cflags])
  161. AC_SUBST([tsan_rust_defs])
  162. AM_CONDITIONAL(enable_tsan,test "$enable_tsan" = "yes")
  163. AC_MSG_CHECKING(for --enable-ubsan)
  164. AC_ARG_ENABLE(ubsan, AS_HELP_STRING([--enable-tsan], [Enable gcc/clang undefined behaviour sanitizer options (default: no)]),
  165. [], [ enable_ubsan=no ])
  166. AC_MSG_RESULT($enable_ubsan)
  167. if test "$enable_ubsan" = yes ; then
  168. ubsan_cflags="-fsanitize=undefined -fno-omit-frame-pointer"
  169. ubsan_rust_defs=""
  170. else
  171. ubsan_cflags=""
  172. ubsan_rust_defs=""
  173. fi
  174. AC_SUBST([ubsan_cflags])
  175. AC_SUBST([ubsan_rust_defs])
  176. AM_CONDITIONAL(enable_ubsan,test "$enable_ubsan" = "yes")
  177. AM_CONDITIONAL(with_sanitizer,test "$enable_asan" = "yes" -o "$enable_msan" = "yes" -o "$enable_tsan" = "yes" -o "$enable_ubsan" = "yes")
  178. AC_MSG_CHECKING(for --enable-clang)
  179. AC_ARG_ENABLE(clang, AS_HELP_STRING([--enable-clang], [Enable clang (default: no)]),
  180. [], [ enable_clang=no ])
  181. AC_MSG_RESULT($enable_clang)
  182. AM_CONDITIONAL(CLANG_ENABLE,test "$enable_clang" = "yes")
  183. AC_MSG_CHECKING(for --enable-legacy)
  184. AC_ARG_ENABLE(legacy, AS_HELP_STRING([--enable-legacy], [Enable deprecated legacy functionality (default: no)]),
  185. [], [ enable_legacy=no ])
  186. AC_MSG_RESULT($enable_legacy)
  187. AC_SUBST([enable_legacy])
  188. AM_CONDITIONAL(ENABLE_LEGACY,test "$enable_legacy" = "yes")
  189. if test "$enable_legacy" = yes ; then
  190. enable_perl=yes
  191. fi
  192. AC_MSG_CHECKING(for --enable-perl)
  193. AC_ARG_ENABLE(perl, AS_HELP_STRING([--enable-perl], [Enable deprecated legacy perl scripts (default: no)]),
  194. [], [ enable_perl=no ])
  195. AC_MSG_RESULT($enable_perl)
  196. AC_SUBST([enable_perl])
  197. AM_CONDITIONAL(ENABLE_PERL,test "$enable_perl" = "yes")
  198. AM_CONDITIONAL([RPM_HARDEND_CC], [test -f /usr/lib/rpm/redhat/redhat-hardened-cc1])
  199. AC_MSG_CHECKING(for --enable-gcc-security)
  200. AC_ARG_ENABLE(gcc-security, AS_HELP_STRING([--enable-gcc-security], [Enable gcc secure compilation options (default: no)]),
  201. [], [ enable_gcc_security=no ])
  202. AC_MSG_RESULT($enable_gcc_security)
  203. if test "$enable_gcc_security" = yes ; then
  204. gccsec_cflags="-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -Werror=format-security"
  205. else
  206. # Without this, -fPIC doesn't work on generic fedora builds, --disable-gcc-sec.
  207. gccsec_cflags=""
  208. fi
  209. AM_COND_IF([RPM_HARDEND_CC],
  210. [ gccsec_cflags="$gccsec_flags -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1" ],
  211. [])
  212. AC_SUBST([gccsec_cflags])
  213. # Pull in profiling.
  214. AC_MSG_CHECKING(for --enable-profiling)
  215. AC_ARG_ENABLE(profiling, AS_HELP_STRING([--enable-profiling], [Enable gcov profiling features (default: no)]),
  216. [], [ enable_profiling=no ])
  217. AC_MSG_RESULT($enable_profiling)
  218. if test "$enable_profiling" = yes ; then
  219. profiling_defs="-fprofile-arcs -ftest-coverage -g3 -O0"
  220. profiling_links="-lgcov --coverage"
  221. else
  222. profiling_defs=""
  223. profiling_links=""
  224. fi
  225. AC_SUBST([profiling_defs])
  226. AC_SUBST([profiling_links])
  227. AC_MSG_CHECKING(for --enable-systemtap)
  228. AC_ARG_ENABLE(systemtap, AS_HELP_STRING([--enable-systemtap], [Enable systemtap probe features (default: no)]),
  229. [], [ enable_systemtap=no ])
  230. AC_MSG_RESULT($enable_systemtap)
  231. if test "$enable_systemtap" = yes ; then
  232. systemtap_defs="-DSYSTEMTAP"
  233. else
  234. systemtap_defs=""
  235. fi
  236. AC_SUBST([systemtap_defs])
  237. # these enables are for optional or experimental features
  238. AC_MSG_CHECKING(for --enable-pam-passthru)
  239. AC_ARG_ENABLE(pam-passthru,
  240. AS_HELP_STRING([--enable-pam-passthru],
  241. [enable the PAM passthrough auth plugin (default: yes)]),
  242. [], [ enable_pam_passthru=yes ])
  243. AC_MSG_RESULT($enable_pam_passthru)
  244. if test "$enable_pam_passthru" = yes ; then
  245. # check for pam header file used by plugins/pass_passthru/pam_ptimpl.c
  246. AC_CHECK_HEADER([security/pam_appl.h], [], [AC_MSG_ERROR([Missing header file security/pam_appl.h])])
  247. AC_DEFINE([ENABLE_PAM_PASSTHRU], [1], [enable the pam passthru auth plugin])
  248. fi
  249. AM_CONDITIONAL(enable_pam_passthru,test "$enable_pam_passthru" = "yes")
  250. if test -z "$enable_dna" ; then
  251. enable_dna=yes # if not set on cmdline, set default
  252. fi
  253. AC_MSG_CHECKING(for --enable-dna)
  254. AC_ARG_ENABLE(dna,
  255. AS_HELP_STRING([--enable-dna],
  256. [enable the Distributed Numeric Assignment (DNA) plugin (default: yes)]))
  257. if test "$enable_dna" = yes ; then
  258. AC_MSG_RESULT(yes)
  259. AC_DEFINE([ENABLE_DNA], [1], [enable the dna plugin])
  260. else
  261. AC_MSG_RESULT(no)
  262. fi
  263. AM_CONDITIONAL(enable_dna,test "$enable_dna" = "yes")
  264. if test -z "$enable_ldapi" ; then
  265. enable_ldapi=yes # if not set on cmdline, set default
  266. fi
  267. AC_MSG_CHECKING(for --enable-ldapi)
  268. AC_ARG_ENABLE(ldapi,
  269. AS_HELP_STRING([--enable-ldapi],
  270. [enable LDAP over unix domain socket (LDAPI) support (default: yes)]))
  271. if test "$enable_ldapi" = yes ; then
  272. AC_MSG_RESULT(yes)
  273. AC_DEFINE([ENABLE_LDAPI], [1], [enable ldapi support in the server])
  274. else
  275. AC_MSG_RESULT(no)
  276. fi
  277. AM_CONDITIONAL(enable_ldapi,test "$enable_ldapi" = "yes")
  278. if test -z "$enable_autobind" ; then
  279. enable_autobind=yes # if not set on cmdline, set default
  280. fi
  281. AC_MSG_CHECKING(for --enable-autobind)
  282. AC_ARG_ENABLE(autobind,
  283. AS_HELP_STRING([--enable-autobind],
  284. [enable auto bind over unix domain socket (LDAPI) support (default: no)]))
  285. if test "$enable_ldapi" = yes -a "$enable_autobind" = yes ; then
  286. AC_MSG_RESULT(yes)
  287. AC_DEFINE([ENABLE_AUTOBIND], [1], [enable ldapi auto bind support in the server])
  288. else
  289. AC_MSG_RESULT(no)
  290. fi
  291. AM_CONDITIONAL(enable_autobind,test "$enable_autobind" = "yes")
  292. if test -z "$enable_auto_dn_suffix" ; then
  293. enable_auto_dn_suffix=no # if not set on cmdline, set default
  294. fi
  295. AC_MSG_CHECKING(for --enable-auto-dn-suffix)
  296. AC_ARG_ENABLE(auto-dn-suffix,
  297. AS_HELP_STRING([--enable-auto-dn-suffix],
  298. [enable auto bind with auto dn suffix over unix domain socket (LDAPI) support (default: no)]))
  299. if test "$enable_ldapi" = yes -a "$enable_autobind" = yes -a "$enable_auto_dn_suffix" = "yes"; then
  300. AC_MSG_RESULT(yes)
  301. AC_DEFINE([ENABLE_AUTO_DN_SUFFIX], [1], [enable ldapi auto bind with auto dn suffix support in the server])
  302. else
  303. AC_MSG_RESULT(no)
  304. fi
  305. AM_CONDITIONAL(enable_auto_dn_suffix,test "$enable_auto_dn_suffix" = "yes")
  306. if test -z "$enable_bitwise" ; then
  307. enable_bitwise=yes # if not set on cmdline, set default
  308. fi
  309. AC_MSG_CHECKING(for --enable-bitwise)
  310. AC_ARG_ENABLE(bitwise,
  311. AS_HELP_STRING([--enable-bitwise],
  312. [enable the bitwise matching rule plugin (default: yes)]))
  313. if test "$enable_bitwise" = yes ; then
  314. AC_MSG_RESULT(yes)
  315. AC_DEFINE([ENABLE_BITWISE], [1], [enable the bitwise plugin])
  316. else
  317. AC_MSG_RESULT(no)
  318. fi
  319. AM_CONDITIONAL(enable_bitwise,test "$enable_bitwise" = "yes")
  320. if test -z "$enable_presence" ; then
  321. enable_presence=no # if not set on cmdline, set default
  322. fi
  323. AC_MSG_CHECKING(for --enable-presence)
  324. AC_ARG_ENABLE(presence,
  325. AS_HELP_STRING([--enable-presence],
  326. [enable the presence plugin (default: no)]))
  327. if test "$enable_presence" = yes ; then
  328. AC_MSG_RESULT(yes)
  329. AC_DEFINE([ENABLE_PRESENCE], [1], [enable the presence plugin])
  330. else
  331. AC_MSG_RESULT(no)
  332. fi
  333. AM_CONDITIONAL(enable_presence,test "$enable_presence" = "yes")
  334. if test -z "$enable_acctpolicy" ; then
  335. enable_acctpolicy=yes # if not set on cmdline, set default
  336. fi
  337. AC_MSG_CHECKING(for --enable-acctpolicy)
  338. AC_ARG_ENABLE(acctpolicy,
  339. AS_HELP_STRING([--enable-acctpolicy],
  340. [enable the account policy plugin (default: yes)]))
  341. if test "$enable_acctpolicy" = yes ; then
  342. AC_MSG_RESULT(yes)
  343. AC_DEFINE([ENABLE_ACCTPOLICY], [1], [enable the account policy plugin])
  344. else
  345. AC_MSG_RESULT(no)
  346. fi
  347. AM_CONDITIONAL(enable_acctpolicy,test "$enable_acctpolicy" = "yes")
  348. if test -z "$enable_posix_winsync" ; then
  349. enable_posix_winsync=yes # if not set on cmdline, set default
  350. fi
  351. AC_MSG_CHECKING(for --enable-posix-winsync)
  352. AC_ARG_ENABLE(posix_winsync,
  353. AS_HELP_STRING([--enable-posix-winsync],
  354. [enable support for POSIX user/group attributes in winsync (default: yes)]))
  355. if test "$enable_posix_winsync" = yes ; then
  356. AC_MSG_RESULT(yes)
  357. AC_DEFINE([ENABLE_POSIX_WINSYNC], [1], [enable support for POSIX user/group attributes in winsync])
  358. else
  359. AC_MSG_RESULT(no)
  360. fi
  361. AM_CONDITIONAL(enable_posix_winsync,test "$enable_posix_winsync" = "yes")
  362. # the default prefix - override with --prefix or --with-fhs
  363. AC_PREFIX_DEFAULT([/opt/$PACKAGE_NAME])
  364. # If we have no prefix specified, we need to fix the prefix variable.
  365. # If we don't what happens is $prefixdir ends up as NONE, and then
  366. # later configure changes $prefix to $ac_default_prefix underneath us.
  367. if test "$prefix" = "NONE"; then
  368. prefix=$ac_default_prefix
  369. fi
  370. m4_include(m4/fhs.m4)
  371. localrundir='/run'
  372. cockpitdir=/389-console
  373. # installation paths - by default, we store everything
  374. # under the prefix. The with-fhs option will use /usr,
  375. # /etc, and /var. The with-fhs-opt option will use the
  376. # prefix, but it's sysconfdir and localstatedir will be
  377. # /etc/opt, and /var/opt.
  378. if test "$with_fhs_opt" = "yes"; then
  379. # Override sysconfdir and localstatedir if FHS optional
  380. # package was requested.
  381. prefixdir=$prefix
  382. sysconfdir='/etc/opt'
  383. localstatedir='/var/opt'
  384. localrundir='/var/opt/run'
  385. # relative to datadir
  386. sampledatadir=/data
  387. # relative to datadir
  388. systemschemadir=/schema
  389. # relative to datadir
  390. scripttemplatedir=/script-templates
  391. # relative to datadir
  392. updatedir=/updates
  393. # relative to libdir
  394. serverdir=
  395. # relative to includedir
  396. serverincdir=
  397. # relative to libdir
  398. serverplugindir=/plugins
  399. # relative to datadir
  400. infdir=/inf
  401. # relative to datadir
  402. mibdir=/mibs
  403. # location of property/resource files, relative to datadir
  404. propertydir=/properties
  405. # relative to libdir
  406. perldir=/perl
  407. # relative to libdir
  408. pythondir=/python
  409. else
  410. if test "$with_fhs" = "yes"; then
  411. ac_default_prefix=/usr
  412. prefix=$ac_default_prefix
  413. exec_prefix=$prefix
  414. dnl as opposed to the default /usr/etc
  415. sysconfdir='/etc'
  416. dnl as opposed to the default /usr/var
  417. localstatedir='/var'
  418. localrundir='/run'
  419. fi
  420. prefixdir=$prefix
  421. # relative to datadir
  422. sampledatadir=/$PACKAGE_NAME/data
  423. # relative to datadir
  424. systemschemadir=/$PACKAGE_NAME/schema
  425. # relative to datadir
  426. scripttemplatedir=/$PACKAGE_NAME/script-templates
  427. # relative to datadir
  428. updatedir=/$PACKAGE_NAME/updates
  429. # relative to libdir
  430. serverdir=$PACKAGE_NAME
  431. # relative to includedir
  432. serverincdir=$PACKAGE_NAME
  433. # relative to libdir
  434. serverplugindir=/$PACKAGE_NAME/plugins
  435. # relative to datadir
  436. infdir=/$PACKAGE_NAME/inf
  437. # relative to datadir
  438. mibdir=/$PACKAGE_NAME/mibs
  439. # location of property/resource files, relative to datadir
  440. propertydir=/$PACKAGE_NAME/properties
  441. # relative to libdir
  442. perldir=/$PACKAGE_NAME/perl
  443. # relative to libdir
  444. pythondir=/$PACKAGE_NAME/python
  445. fi
  446. # if mandir is the default value, override it
  447. # otherwise, the user must have set it - just use it
  448. if test X"$mandir" = X'${prefix}/man' ; then
  449. mandir='$(datadir)/man'
  450. fi
  451. # Shared paths for all layouts
  452. # relative to sysconfdir
  453. configdir=/$PACKAGE_NAME/config
  454. # relative to sysconfdir
  455. schemadir=/$PACKAGE_NAME/schema
  456. # default user, group
  457. defaultuser=dirsrv
  458. defaultgroup=dirsrv
  459. AC_MSG_CHECKING(for --with-perldir)
  460. AC_ARG_WITH([perldir],
  461. AS_HELP_STRING([--with-perldir=PATH],
  462. [Directory for perl])
  463. )
  464. if test -n "$with_perldir"; then
  465. if test "$with_perldir" = yes ; then
  466. AC_MSG_ERROR([You must specify --with-perldir=/full/path/to/perl])
  467. elif test "$with_perldir" = no ; then
  468. with_perldir=
  469. else
  470. AC_MSG_RESULT([$with_perldir])
  471. fi
  472. else
  473. with_perldir=
  474. fi
  475. AC_MSG_CHECKING(for --with-pythonexec)
  476. AC_ARG_WITH([pythonexec],
  477. AS_HELP_STRING([--with-pythonexec=PATH],
  478. [Path to executable for python])
  479. )
  480. if test -n "$with_pythonexec"; then
  481. if test "$with_pythonexec" = yes ; then
  482. AC_MSG_ERROR([You must specify --with-pythonexec=/full/path/to/python])
  483. elif test "$with_pythonexec" = no ; then
  484. with_pythonexec=/usr/bin/python3
  485. else
  486. AC_MSG_RESULT([$with_pythonexec])
  487. fi
  488. else
  489. with_pythonexec=/usr/bin/python3
  490. fi
  491. AC_SUBST(prefixdir)
  492. AC_SUBST(configdir)
  493. AC_SUBST(sampledatadir)
  494. AC_SUBST(systemschemadir)
  495. AC_SUBST(propertydir)
  496. AC_SUBST(schemadir)
  497. AC_SUBST(serverdir)
  498. AC_SUBST(serverincdir)
  499. AC_SUBST(serverplugindir)
  500. AC_SUBST(scripttemplatedir)
  501. AC_SUBST(perldir)
  502. AC_SUBST(pythondir)
  503. AC_SUBST(infdir)
  504. AC_SUBST(mibdir)
  505. AC_SUBST(mandir)
  506. AC_SUBST(updatedir)
  507. AC_SUBST(defaultuser)
  508. AC_SUBST(defaultgroup)
  509. AC_SUBST(cockpitdir)
  510. # check for --with-instconfigdir
  511. AC_MSG_CHECKING(for --with-instconfigdir)
  512. AC_ARG_WITH(instconfigdir,
  513. AS_HELP_STRING([--with-instconfigdir=/path],
  514. [Base directory for instance specific writable configuration directories (default $sysconfdir/$PACKAGE_NAME)]),
  515. [
  516. if test $withval = yes ; then
  517. AC_ERROR([Please specify a full path with --with-instconfigdir])
  518. fi
  519. instconfigdir="$withval"
  520. AC_MSG_RESULT($withval)
  521. ],
  522. [
  523. dnl this value is expanded out in Makefile.am
  524. instconfigdir='$(sysconfdir)/$(PACKAGE_NAME)'
  525. AC_MSG_RESULT(no)
  526. ])
  527. AC_SUBST(instconfigdir)
  528. # WINNT should be true if building on Windows system not using
  529. # cygnus, mingw, or the like and using cmd.exe as the shell
  530. AM_CONDITIONAL([WINNT], false)
  531. # Deal with platform dependent defines
  532. # initdir is the location for the SysV init scripts - very heavily platform
  533. # dependent and not specified in fhs or lsb
  534. # and not used if systemd is used
  535. initdir='$(sysconfdir)/rc.d'
  536. AC_MSG_CHECKING(for --with-initddir)
  537. AC_ARG_WITH(initddir,
  538. AS_HELP_STRING([--with-initddir=/path],
  539. [Absolute path (not relative like some of the other options) that should contain the SysV init scripts (default '$(sysconfdir)/rc.d')]),
  540. [
  541. AC_MSG_RESULT($withval)
  542. ],
  543. [
  544. AC_MSG_RESULT(no)
  545. ])
  546. AM_CONDITIONAL([INITDDIR], [test -n "$with_initddir" -a "$with_initddir" != "no"])
  547. # on most platforms, we will just use perl from PATH
  548. # On some platforms, we cannot. Why not just use any old
  549. # perl? Because of perldap. We use a perldap that is
  550. # compiled to either 32bit or 64bit, so we must use a native
  551. # perl binary compiled with the same bitsize. On Solaris
  552. # and HP-UX, /usr/bin/perl is 32 bit, so we cannot use
  553. # those with our 64 bit compiled product.
  554. if test -n "$with_perldir"; then
  555. perlexec="$with_perldir/perl"
  556. else
  557. perlexec='/usr/bin/env perl'
  558. fi
  559. # This will let us change over the python version easier in the future.
  560. if test -n "$with_pythonexec"; then
  561. pythonexec="$with_pythonexec"
  562. else
  563. pythonexec='/usr/bin/python3'
  564. fi
  565. # Default to no atomic queue operations.
  566. with_atomic_queue="no"
  567. # we use stty in perl scripts to disable password echo
  568. # this doesn't work unless the full absolute path of the
  569. # stty command is used e.g. system("stty -echo") does not
  570. # work but system("/bin/stty -echo") does work
  571. # since the path of stty may not be the same on all
  572. # platforms, we set the default here to /bin/stty and
  573. # allow that value to be overridden in the platform
  574. # specific section below
  575. sttyexec=/bin/stty
  576. case $host in
  577. *-*-linux*)
  578. AC_DEFINE([LINUX], [1], [Linux])
  579. AC_DEFINE([_GNU_SOURCE], [1], [GNU Source])
  580. platform="linux"
  581. initdir='$(sysconfdir)/rc.d/init.d'
  582. # do arch specific linux stuff here
  583. case $host in
  584. i*86-*-linux*)
  585. AC_DEFINE([CPU_x86], [], [cpu type x86])
  586. ;;
  587. x86_64-*-linux*)
  588. AC_DEFINE([CPU_x86_64], [1], [cpu type x86_64])
  589. # This turns on and off LFDS inside of libsds
  590. # wibrown -- 2017-02-21 disabled temporarily
  591. # with_atomic_queue="yes"
  592. # AC_DEFINE([ATOMIC_QUEUE_OPERATIONS], [1], [enabling atomic queue operations])
  593. ;;
  594. aarch64-*-linux*)
  595. AC_DEFINE([CPU_arm], [], [cpu type arm])
  596. ;;
  597. arm-*-linux*)
  598. AC_DEFINE([CPU_arm], [], [cpu type arm])
  599. ;;
  600. ppc64le-*-linux*)
  601. ;;
  602. ppc64-*-linux*)
  603. ;;
  604. ppc-*-linux*)
  605. ;;
  606. s390-*-linux*)
  607. ;;
  608. s390x-*-linux*)
  609. ;;
  610. esac
  611. # some programs use the native thread library directly
  612. THREADLIB=-lpthread
  613. AC_SUBST([THREADLIB], [$THREADLIB])
  614. LIBCRYPT=-lcrypt
  615. AC_SUBST([LIBCRYPT], [$LIBCRYPT])
  616. AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks])
  617. ;;
  618. *-*-freebsd*)
  619. AC_DEFINE([FREEBSD], [1], [FreeBSD])
  620. platform="freebsd"
  621. initdir='$(sysconfdir)/rc.d'
  622. THREADLIB=-lthr
  623. AC_SUBST([THREADLIB], [$THREADLIB])
  624. AC_DEFINE([USE_POSIX_RWLOCKS], [1], [POSIX rwlocks])
  625. LIBDL=
  626. ;;
  627. ia64-hp-hpux*)
  628. AC_DEFINE([hpux], [1], [HP-UX])
  629. AC_DEFINE([HPUX], [1], [HP-UX])
  630. AC_DEFINE([HPUX11], [1], [HP-UX 11])
  631. AC_DEFINE([HPUX11_23], [1], [HP-UX 11.23])
  632. AC_DEFINE([CPU_ia64], [], [cpu type ia64])
  633. AC_DEFINE([OS_hpux], [1], [OS HP-UX])
  634. AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
  635. AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
  636. AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
  637. # assume 64 bit
  638. perlexec='/opt/perl_64/bin/perl'
  639. platform="hpux"
  640. initconfigdir="/$PACKAGE_NAME/config"
  641. # HPUX doesn't use /etc for this
  642. initdir=/init.d
  643. ;;
  644. hppa*-hp-hpux*)
  645. AC_DEFINE([hpux], [1], [HP-UX])
  646. AC_DEFINE([HPUX], [1], [HP-UX])
  647. AC_DEFINE([HPUX11], [1], [HP-UX 11])
  648. AC_DEFINE([HPUX11_11], [1], [HP-UX 11.11])
  649. AC_DEFINE([CPU_hppa], [], [cpu type pa-risc])
  650. AC_DEFINE([OS_hpux], [1], [OS HP-UX])
  651. AC_DEFINE([_POSIX_C_SOURCE], [199506L], [POSIX revision])
  652. AC_DEFINE([_HPUX_SOURCE], [1], [Source namespace])
  653. AC_DEFINE([_INCLUDE_STDC__SOURCE_199901], [1], [to pick up all of the printf format macros in inttypes.h])
  654. # assume 64 bit
  655. initconfigdir="/$PACKAGE_NAME/config"
  656. perlexec='/opt/perl_64/bin/perl'
  657. platform="hpux"
  658. # HPUX doesn't use /etc for this
  659. initdir=/init.d
  660. ;;
  661. *-*-solaris*)
  662. AC_DEFINE([SVR4], [1], [SVR4])
  663. AC_DEFINE([__svr4], [1], [SVR4])
  664. AC_DEFINE([__svr4__], [1], [SVR4])
  665. AC_DEFINE([_SVID_GETTOD], [1], [SVID_GETTOD])
  666. AC_DEFINE([SOLARIS], [1], [SOLARIS])
  667. AC_DEFINE([OS_solaris], [1], [OS SOLARIS])
  668. AC_DEFINE([sunos5], [1], [SunOS5])
  669. AC_DEFINE([OSVERSION], [509], [OS version])
  670. AC_DEFINE([_REENTRANT], [1], [_REENTRANT])
  671. AC_DEFINE([NO_DOMAINNAME], [1], [no getdomainname])
  672. dnl socket nsl and dl are required to link several programs and libdb
  673. LIBSOCKET=-lsocket
  674. AC_SUBST([LIBSOCKET], [$LIBSOCKET])
  675. LIBNSL=-lnsl
  676. AC_SUBST([LIBNSL], [$LIBNSL])
  677. LIBDL=-ldl
  678. AC_SUBST([LIBDL], [$LIBDL])
  679. dnl Cstd and Crun are required to link any C++ related code
  680. LIBCSTD=-lCstd
  681. AC_SUBST([LIBCSTD], [$LIBCSTD])
  682. LIBCRUN=-lCrun
  683. AC_SUBST([LIBCRUN], [$LIBCRUN])
  684. platform="solaris"
  685. initdir='$(sysconfdir)/init.d'
  686. case $host in
  687. i?86-*-solaris2.1[[0-9]]*)
  688. dnl I dont know why i386 need this explicit
  689. AC_DEFINE([HAVE_GETPEERUCRED], [1], [have getpeerucred])
  690. ;;
  691. sparc-*-solaris*)
  692. dnl includes some assembler stuff in counter.o
  693. AC_DEFINE([CPU_sparc], [], [cpu type sparc])
  694. TARGET='SPARC'
  695. ;;
  696. esac
  697. ;;
  698. *)
  699. platform=""
  700. ;;
  701. esac
  702. ### TO CHECK FOR SSE4.2!!!
  703. # gcc -march=native -dM -E - < /dev/null | grep SSE
  704. # We can just use the define in GCC instead!
  705. AC_MSG_CHECKING([for GCC provided 64-bit atomic operations])
  706. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  707. #include <inttypes.h>
  708. ]],
  709. [[
  710. uint64_t t_counter = 0;
  711. uint64_t t_oldval = 0;
  712. uint64_t t_newval = 1;
  713. __atomic_compare_exchange_8(&t_counter, &t_oldval, t_newval, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
  714. __atomic_add_fetch_8(&t_counter, t_newval, __ATOMIC_SEQ_CST);
  715. __atomic_sub_fetch_8(&t_counter, t_newval, __ATOMIC_SEQ_CST);
  716. __atomic_load(&t_counter, &t_oldval, __ATOMIC_SEQ_CST);
  717. return 0;
  718. ]])],
  719. [
  720. AC_DEFINE([ATOMIC_64BIT_OPERATIONS], [1], [have 64-bit atomic operation functions provided by gcc])
  721. AC_MSG_RESULT([yes])
  722. ],
  723. [
  724. AC_MSG_RESULT([no])
  725. ]
  726. )
  727. # cmd line overrides default setting above
  728. if test -n "$with_initddir" ; then
  729. initdir="$with_initddir"
  730. fi
  731. # sysv init scripts not used when systemd is used
  732. AC_SUBST(initdir)
  733. AC_SUBST(perlexec)
  734. AC_SUBST(pythonexec)
  735. AC_SUBST(sttyexec)
  736. # set default initconfigdir if not already set
  737. # value will be set so as to be relative to $(sysconfdir)
  738. if test -z "$initconfigdir" ; then
  739. if test -d /etc/sysconfig ; then
  740. initconfigdir=/sysconfig
  741. elif test -d /etc/default ; then
  742. initconfigdir=/default
  743. else
  744. initconfigdir="/$PACKAGE_NAME/config"
  745. fi
  746. fi
  747. AC_SUBST(initconfigdir)
  748. # Conditionals for makefile.am
  749. AM_CONDITIONAL([ATOMIC_QUEUE_OPERATIONS], [test "$with_atomic_queue" = "yes"])
  750. AM_CONDITIONAL([HPUX],[test "$platform" = "hpux"])
  751. AM_CONDITIONAL([SOLARIS],[test "$platform" = "solaris"])
  752. AM_CONDITIONAL([FREEBSD],[test "$platform" = "freebsd"])
  753. AM_CONDITIONAL([SPARC],[test "x$TARGET" = xSPARC])
  754. # Check for library dependencies
  755. PKG_CHECK_MODULES([EVENT], [libevent])
  756. if $PKG_CONFIG --exists nspr; then
  757. PKG_CHECK_MODULES([NSPR], [nspr])
  758. else
  759. PKG_CHECK_MODULES([NSPR], [dirsec-nspr])
  760. fi
  761. if $PKG_CONFIG --exists nss; then
  762. PKG_CHECK_MODULES([NSS], [nss])
  763. nss_libdir=`$PKG_CONFIG --libs-only-L nss | sed -e s/-L// | sed -e s/\ .*$//`
  764. else
  765. PKG_CHECK_MODULES([NSS], [dirsec-nss])
  766. nss_libdir=`$PKG_CONFIG --libs-only-L dirsec-nss | sed -e s/-L// | sed -e s/\ .*$//`
  767. fi
  768. AC_SUBST(nss_libdir)
  769. m4_include(m4/openldap.m4)
  770. m4_include(m4/db.m4)
  771. PKG_CHECK_MODULES([SASL], [libsasl2])
  772. PKG_CHECK_MODULES([ICU], [icu-i18n >= 60.2])
  773. m4_include(m4/netsnmp.m4)
  774. PKG_CHECK_MODULES([KERBEROS], [krb5])
  775. krb5_vendor=`$PKG_CONFIG --variable=vendor krb5`
  776. if test "$krb5_vendor" = "MIT"; then
  777. AC_DEFINE(HAVE_KRB5, 1, [Define if you have Kerberos V])
  778. save_LIBS="$LIBS"
  779. LIBS="$KERBEROS_LIBS"
  780. AC_CHECK_FUNCS([krb5_cc_new_unique])
  781. LIBS="$save_LIBS"
  782. elif test "$krb5_vendor" = "Heimdal"; then
  783. AC_DEFINE(HAVE_HEIMDAL_KERBEROS, 1, [Define if you have Heimdal Kerberos])
  784. fi
  785. if $PKG_CONFIG --exists pcre; then
  786. PKG_CHECK_MODULES([PCRE], [pcre])
  787. pcre_libdir=`$PKG_CONFIG --libs-only-L pcre | sed -e s/-L// | sed -e s/\ .*$//`
  788. else
  789. PKG_CHECK_MODULES([PCRE], [libpcre])
  790. pcre_libdir=`$PKG_CONFIG --libs-only-L libpcre | sed -e s/-L// | sed -e s/\ .*$//`
  791. fi
  792. AC_SUBST(pcre_libdir)
  793. m4_include(m4/selinux.m4)
  794. m4_include(m4/systemd.m4)
  795. AC_MSG_CHECKING(whether to enable cmocka unit tests)
  796. AC_ARG_ENABLE(cmocka, AS_HELP_STRING([--enable-cmocka], [Enable cmocka unit tests (default: no)]))
  797. if test "x$enable_cmocka" = "xyes"; then
  798. AC_MSG_RESULT(yes)
  799. PKG_CHECK_MODULES([CMOCKA], [cmocka])
  800. AC_DEFINE([ENABLE_CMOCKA], [1], [Enable cmocka unit tests])
  801. else
  802. AC_MSG_RESULT(no)
  803. fi
  804. AM_CONDITIONAL([ENABLE_CMOCKA], [test "x$enable_cmocka" = "xyes"])
  805. m4_include(m4/doxygen.m4)
  806. PACKAGE_BASE_VERSION=`echo $PACKAGE_VERSION | awk -F\. '{print $1"."$2}'`
  807. AC_SUBST(PACKAGE_BASE_VERSION)
  808. AM_CONDITIONAL(OPENLDAP,test "$with_openldap" = "yes")
  809. # write out paths for binary components
  810. AC_SUBST(ldaplib)
  811. AC_SUBST(ldaplib_defs)
  812. AC_SUBST(ldaptool_bindir)
  813. AC_SUBST(ldaptool_opts)
  814. AC_SUBST(plainldif_opts)
  815. AC_SUBST(localrundir)
  816. AC_SUBST(brand)
  817. AC_SUBST(capbrand)
  818. AC_SUBST(vendor)
  819. # AC_DEFINE([USE_OLD_UNHASHED], [], [Use old unhashed code])
  820. # Internally we use a macro function slapi_log_err() to call slapi_log_error()
  821. # which gives us the option to do performance testing without the presence of
  822. # logging. To remove the presence of error logging undefine LDAP_ERROR_LOGGING.
  823. AC_DEFINE([LDAP_ERROR_LOGGING], [1], [LDAP error logging flag])
  824. # Build our pkgconfig files
  825. # This currently conflicts with %.in: rule in Makefile.am, which should be removed eventually.
  826. # AC_CONFIG_FILES([ldap/admin/src/defaults.inf])
  827. AC_CONFIG_FILES([src/pkgconfig/dirsrv.pc src/pkgconfig/libsds.pc src/pkgconfig/svrcore.pc])
  828. AC_CONFIG_FILES([Makefile rpm/389-ds-base.spec ])
  829. AC_OUTPUT