configure.ac 29 KB

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