2 AC_INIT(rpm, 4.9.90, rpm-maint@lists.rpm.org)
4 AC_CONFIG_SRCDIR([rpmqv.c])
5 AC_CONFIG_HEADERS([config.h])
6 AC_CONFIG_MACRO_DIR([m4])
8 AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects nostdinc])
10 AC_CONFIG_TESTDIR(tests)
12 AC_USE_SYSTEM_EXTENSIONS
16 dnl Checks for programs.
29 if test "$ac_cv_prog_cc_c99" = no; then
30 AC_MSG_ERROR([ISO C99 capable compiler required])
35 if test "$GCC" = yes; then
36 CFLAGS="$CFLAGS -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wno-char-subscripts"
37 # XXX disabled for now due to noise from NSPR headers
38 # CFLAGS="$CFLAGS -Wstrict-prototypes"
39 cflags_to_try="-fno-strict-aliasing -fstack-protector -Wempty-body"
40 AC_MSG_CHECKING([supported compiler flags])
43 for flag in $cflags_to_try; do
44 CFLAGS="$CFLAGS $flag"
45 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[
47 RPMCFLAGS="$RPMCFLAGS $flag"
51 CFLAGS="$CFLAGS $RPMCFLAGS"
58 dnl look for POSIX chmod attributes
60 AC_MSG_CHECKING(POSIX chmod)
62 chmod 744 foo.chmodtest
63 chmod +X foo.chmodtest 2>/dev/null
64 a=`ls -l foo.chmodtest | awk '{print substr($1,1,10)}'`
66 if test "$a" = "-rwxr-xr-x"; then
68 FIXPERMS=a+rX,u+w,g-w,o-w
70 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
71 FIXPERMS=a+r,u+w,g-w,o-w
78 AC_CHECK_TOOL(AR, ar, :)
81 dnl use defaults if cross-compiling, otherwise use the default path.
83 if test "$cross_compiling" = "yes"; then
90 dnl Find some common programs
92 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
93 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
94 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
95 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
96 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
97 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
98 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
99 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
100 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
101 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
102 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
103 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
104 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
105 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
106 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
107 AC_PATH_PROG(__XZ, xz, /usr/bin/xz, $MYPATH)
108 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
109 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
110 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
111 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
112 AC_PATH_PROG(__RESTORECON, restorecon, /sbin/restorecon, $MYPATH)
113 AC_MSG_CHECKING(old version of patch)
114 PATCHVERSION=`patch --version 2>&1`
116 if test "$PATCHVERSION" = "Patch version 2.1"; then
117 AC_DEFINE(HAVE_OLDPATCH_21, 1,
118 [Define if the patch call you'll be using is 2.1 or older])
119 AC_MSG_RESULT(patch older then 2.2 found)
121 AC_MSG_RESULT(patch later then 2.2 found)
124 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
125 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
126 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
127 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
128 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
129 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
130 AC_PATH_PROG(__SEMODULE, semodule, /usr/bin/semodule, $MYPATH)
131 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
132 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
134 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
135 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
136 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
137 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
138 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
139 AC_PATH_PROG(__FAKECHROOT, fakechroot, /usr/bin/fakechroot, $MYPATH)
141 dnl see if we have a mkdir that supports `-p' for rpmbuild's purposes
143 if ! echo $MKDIR_P | grep -q mkdir; then
144 __MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
148 AC_DEFINE_UNQUOTED(__MKDIR_P, "${__MKDIR_P}",
149 [A full path to a program, possibly with arguments, that will create a
150 directory and all necessary parent directories, ala 'mkdir -p'])
154 # Check for zlib library.
159 AC_CHECK_HEADERS([zlib.h],[
160 AS_IF([test -z "${WITH_ZLIB_LIB}"],[
161 for zlib in z gz ; do
162 AC_CHECK_LIB(${zlib}, gzread,
163 [WITH_ZLIB_LIB="-l${zlib}"; break])
166 dnl zlib-1.0.4 has not gzseek
167 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
171 AC_SUBST(WITH_ZLIB_INCLUDE)
172 AC_SUBST(WITH_ZLIB_LIB)
175 # Check for bzip2 library.
177 AC_CHECK_HEADERS([bzlib.h],[
178 AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
180 AC_CHECK_LIB(bz2, BZ2_bzread,[
182 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
186 AC_SUBST(WITH_BZ2_LIB)
189 # Check for lzma library.
191 AC_CHECK_HEADERS([lzma.h],[
192 AC_CHECK_LIB(lzma, lzma_easy_encoder, [WITH_LZMA_LIB=-llzma])
194 AC_SUBST(WITH_LZMA_LIB)
199 dnl Check for features
202 dnl Checks for libraries.
204 AC_CHECK_FUNC(gethostname, [], [
205 AC_CHECK_LIB(nsl, gethostname)
208 AC_CHECK_HEADERS(pthread.h)
210 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
211 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
212 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
213 AC_CHECK_LIB(thread, mutex_lock)
217 AC_SEARCH_LIBS(dlopen, [dl])
220 # Check for libelf library. Prefer external, otherwise none.
222 AC_CHECK_HEADER([libelf.h])
223 AC_CHECK_HEADERS([gelf.h], [
224 AC_CHECK_LIB(elf, gelf_getvernaux, [
225 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
226 WITH_LIBELF_LIB="-lelf"
230 AC_SUBST(WITH_LIBELF_LIB)
231 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
233 AC_CHECK_HEADERS([dwarf.h], [
236 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
239 # Check for NSS library.
240 # We need nss.h from NSS which needs nspr.h. Unfortunately both glibc and NSS
241 # have a header named nss.h... so make extra check for NSS's sechash.h
242 # which we use too and hopefully is slightly more unique to NSS.
245 AC_CHECK_HEADERS([nspr.h nss.h sechash.h], [], [
246 AC_MSG_ERROR([missing required NSPR / NSS header])
248 AC_CHECK_LIB(nss3, NSS_NoDB_Init, [
251 AC_MSG_ERROR([missing required NSS library 'nss3'])
253 AC_SUBST(WITH_NSS_INCLUDE)
254 AC_SUBST(WITH_NSS_LIB)
257 # Check for magic library.
261 AC_CHECK_HEADER([magic.h], [
262 AC_CHECK_LIB(magic, magic_open, [
264 WITH_MAGIC_LIB="-lmagic"
266 AC_MSG_ERROR([missing required library 'libmagic'])
269 AC_MSG_ERROR([missing required header magic.h])
272 AC_SUBST(WITH_MAGIC_INCLUDE)
273 AC_SUBST(WITH_MAGIC_LIB)
276 # Check for popt library.
280 AC_CHECK_HEADER([popt.h], [
281 AC_CHECK_LIB(popt, poptGetContext, [
283 WITH_POPT_LIB="-lpopt"
285 AC_MSG_ERROR([missing required library popt])
288 AC_MSG_ERROR([missing required header popt.h])
291 AC_SUBST(WITH_POPT_INCLUDE)
292 AC_SUBST(WITH_POPT_LIB)
295 # Process --with/without-external-db
296 AC_ARG_WITH(external_db, [AS_HELP_STRING([--with-external-db],[build against an external Berkeley db])],
297 [case "$with_external_db" in
299 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
301 [with_external_db=no])
303 case "$with_external_db" in
305 AC_CHECK_HEADERS([db.h],[
309 #if ((DB_VERSION_MAJOR < 4) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 5))
310 #error Berkeley DB too old
313 ],[ WITH_DB_LIB=-ldb ],
314 [ AC_MSG_ERROR([Berkeley DB version >= 4.5 required])
317 AC_MSG_ERROR([missing required header db.h])
320 * ) # Fall back to internal db if available
321 if [ test -x db/dist/configure ]; then
322 AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
324 AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL])
329 AC_SUBST([WITH_DB_LIB])
331 AM_GNU_GETTEXT_VERSION([0.16.1])
332 AM_GNU_GETTEXT([external])
334 dnl Checks for header files we can live without.
339 AC_CHECK_HEADERS(limits.h)
340 AC_CHECK_HEADERS(fcntl.h getopt.h)
342 AC_CHECK_HEADERS(sys/utsname.h)
344 AC_CHECK_HEADERS(sys/systemcfg.h)
345 AC_CHECK_HEADERS(sys/param.h)
347 AC_CHECK_HEADERS(glob.h)
349 dnl statfs portability fiddles.
351 dnl We should really emulate/steal sections of the statfs and struct statfs
352 dnl checks from GNU fileutils.
354 AC_MSG_CHECKING(for struct statfs)
357 dnl this is easier than nesting AC_TRY_COMPILEs...
359 found_struct_statfs=no
361 if test X$found_struct_statfs = Xno ; then
362 dnl Solaris 2.6+ wants to use statvfs
363 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
364 #ifdef HAVE_SYS_TYPES_H
365 #include <sys/types.h>
367 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
368 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
369 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
370 found_struct_statfs=yes],[])
373 if test X$found_struct_statfs = Xno ; then
374 dnl first try including sys/vfs.h
375 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
376 #ifdef HAVE_SYS_TYPES_H
377 #include <sys/types.h>
379 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
380 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
381 found_struct_statfs=yes],[])
384 if test X$found_struct_statfs = Xno ; then
385 dnl ...next try including sys/mount.h
386 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
387 #ifdef HAVE_SYS_TYPES_H
388 #include <sys/types.h>
390 #ifdef HAVE_SYS_PARAM_H
391 #include <sys/param.h>
393 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
394 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
395 found_struct_statfs=yes],[])
398 if test X$found_struct_statfs = Xno ; then
399 dnl ...still no joy. Try sys/statfs.h
400 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
401 #ifdef HAVE_SYS_TYPES_H
402 #include <sys/types.h>
404 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
405 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
406 found_struct_statfs=yes],[])
409 if test X$found_struct_statfs = Xno ; then
410 dnl ...no luck. Warn the user of impending doom.
411 AC_MSG_WARN(not found)
415 dnl if we found the struct, see if it has the f_bavail member. Some OSes
416 dnl don't, including IRIX 6.5+
418 if test X$found_struct_statfs = Xyes ; then
419 AC_MSG_CHECKING(for f_bavail member in struct statfs)
420 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
421 #ifdef HAVE_SYS_TYPES_H
422 #include <sys/types.h>
424 #if STATFS_IN_SYS_STATVFS
425 # include <sys/statvfs.h>
426 typedef struct statvfs STATFS_t;
428 typedef struct statfs STATFS_t;
429 # if STATFS_IN_SYS_VFS
430 # include <sys/vfs.h>
431 # elif STATFS_IN_SYS_MOUNT
432 # include <sys/mount.h>
433 # elif STATFS_IN_SYS_STATFS
434 # include <sys/statfs.h>
436 #endif ]], [[STATFS_t sfs;
437 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
438 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
442 if test X$found_struct_statfs = Xyes ; then
444 dnl now check to see if we have the 4-argument variant of statfs()
445 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
447 AC_MSG_CHECKING([if statfs() requires 4 arguments])
448 AC_RUN_IFELSE([AC_LANG_SOURCE([[
449 #ifdef HAVE_SYS_TYPES_H
450 #include <sys/types.h>
452 #ifdef STATFS_IN_SYS_VFS
454 #elif STATFS_IN_SYS_MOUNT
455 #include <sys/mouht.h>
456 #elif STATFS_IN_SYS_STATFS
457 #include <sys/statfs.h>
461 exit (statfs(".", &sfs, sizeof(sfs), 0));
463 ]])],[AC_MSG_RESULT(yes)
464 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
468 dnl look for libc features
470 dnl Check for missing typedefs
476 dnl Checks for library functions.
479 AC_CHECK_FUNCS(putenv)
481 AC_REPLACE_FUNCS(stpcpy stpncpy)
483 AC_CHECK_FUNCS(__secure_getenv)
486 [mkstemp getcwd basename dirname realpath setenv unsetenv regcomp lchown],
487 [], [AC_MSG_ERROR([function required by rpm])])
489 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
490 dnl %files gets something like
491 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
492 dnl (Note: more than one asterisk in glob pattern.)
494 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
495 dnl dangling symlinks are no longer globbed. Always use the internal glob.
496 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
500 dnl check if python is requested
501 AC_ARG_ENABLE(python, [AS_HELP_STRING([--enable-python],[build rpm python bindings])],
502 [case "$enable_python" in
504 *) AC_MSG_ERROR([invalid argument to --enable-python])
509 AS_IF([test "$enable_python" = yes],[
510 AM_PATH_PYTHON([2.6],[
511 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; import sys; sys.stdout.write(get_python_inc())'`
512 WITH_PYTHON_SUBPACKAGE=1
513 save_CPPFLAGS="$CPPFLAGS"
514 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
515 AC_CHECK_HEADER([Python.h],[],
516 [AC_MSG_ERROR([missing Python.h])
518 CPPFLAGS="$save_CPPFLAGS"
520 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
521 WITH_PYTHON_LIB="$ac_res"
522 ],[AC_MSG_ERROR([missing python library])
529 WITH_PYTHON_SUBPACKAGE=0
532 AC_SUBST(WITH_PYTHON_INCLUDE)
533 AC_SUBST(WITH_PYTHON_LIB)
535 AM_CONDITIONAL(ENABLE_PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
537 AC_PATH_PROG(DOXYGEN, doxygen, no)
539 dnl Only build internal API + source hacking docs on request
541 AC_ARG_WITH(hackingdocs, [AS_HELP_STRING([--with-hackingdocs],[build rpm hacking docs])],,[with_hackingdocs=no])
543 case "$with_hackingdocs" in
545 AS_IF([test "$DOXYGEN" = no],[with_hackingdocs=no],[with_hackingdocs=no])
548 AS_IF([test "$DOXYGEN" = no],
549 [AC_MSG_ERROR([rpm hacking docs eeds doxygen in PATH])])
552 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
555 AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux],[build with selinux support])],
556 [case "$with_selinux" in
558 *) AC_MSG_ERROR([invalid argument to --with-selinux])
563 AS_IF([test "$with_selinux" = yes],[
564 AC_CHECK_HEADER([selinux/selinux.h],[
566 AC_CHECK_LIB([selinux],[is_selinux_enabled],[],[
567 AC_MSG_ERROR([--with-selinux given, but is_selinux_enabled not found in libselinux])])
568 AC_CHECK_LIB([selinux],[selinux_getpolicytype],[],[
569 AC_MSG_ERROR([--with-selinux given, but selinux_getpolicytype not found in libselinux])])
570 AC_CHECK_LIB([selinux],[selinux_reset_config],[],[
571 AC_MSG_ERROR([--with-selinux given, but selinux_reset_config not found in libselinux])])
574 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
577 AC_CHECK_HEADER([selinux/label.h],[
579 AC_CHECK_LIB([selinux],[selabel_close],[],[
580 AC_MSG_ERROR([--with-selinux given, but selabel_close not found in libselinux])])
581 AC_CHECK_LIB([selinux],[selabel_lookup_raw],[],[
582 AC_MSG_ERROR([--with-selinux given, but selabel_lookup_raw not found in libselinux])])
583 AC_CHECK_LIB([selinux],[selabel_open],[],[
584 AC_MSG_ERROR([--with-selinux given, but selabel_open not found in libselinux])])
587 AC_MSG_ERROR([--with-selinux given, but selinux/label.h not found])
590 dnl FIXME: semanage is only needed for the sepolicy plugin
591 AC_CHECK_HEADER([semanage/semanage.h],[
593 AC_CHECK_LIB([semanage],[semanage_begin_transaction],[],[
594 AC_MSG_ERROR([--with-selinux given, but semanage_begin_transaction missing in libsemanage])])
595 AC_CHECK_LIB([semanage],[semanage_commit],[],[
596 AC_MSG_ERROR([--with-selinux given, but semanage_commit missing in libsemanage])])
597 AC_CHECK_LIB([semanage],[semanage_connect],[],[
598 AC_MSG_ERROR([--with-selinux given, but semanage_connect missing in libsemanage])])
599 AC_CHECK_LIB([semanage],[semanage_disconnect],[],[
600 AC_MSG_ERROR([--with-selinux given, but semanage_disconnect missing in libsemanage])])
601 AC_CHECK_LIB([semanage],[semanage_handle_create],[],[
602 AC_MSG_ERROR([--with-selinux given, but semanage_handle_create missing in libsemanage])])
603 AC_CHECK_LIB([semanage],[semanage_handle_destroy],[],[
604 AC_MSG_ERROR([--with-selinux given, but semanage_handle_destroy missing in libsemanage])])
605 AC_CHECK_LIB([semanage],[semanage_is_connected],[],[
606 AC_MSG_ERROR([--with-selinux given, but semanage_is_connected missing in libsemanage])])
607 AC_CHECK_LIB([semanage],[semanage_module_install_base_file],[],[
608 AC_MSG_ERROR([--with-selinux given, but semanage_module_install_base_file missing in libsemanage])])
609 AC_CHECK_LIB([semanage],[semanage_module_install_file],[],[
610 AC_MSG_ERROR([--with-selinux given, but semanage_module_install_file missing in libsemanage])])
611 AC_CHECK_LIB([semanage],[semanage_module_remove],[],[
612 AC_MSG_ERROR([--with-selinux given, but semanage_module_remove missing in libsemanage])])
613 AC_CHECK_LIB([semanage],[semanage_select_store],[],[
614 AC_MSG_ERROR([--with-selinux given, but semanage_select_store missing in libsemanage])])
615 AC_CHECK_LIB([semanage],[semanage_set_check_contexts],[],[
616 AC_MSG_ERROR([--with-selinux given, but semanage_set_check_contexts missing in libsemanage])])
617 AC_CHECK_LIB([semanage],[semanage_set_create_store],[],[
618 AC_MSG_ERROR([--with-selinux given, but semanage_set_create_store missing in libsemanage])])
619 AC_CHECK_LIB([semanage],[semanage_set_reload],[],[
620 AC_MSG_ERROR([--with-selinux given, but semanage_set_reload missing in libsemanage])])
623 AC_MSG_ERROR([--with-selinux given, but semanage/semanage.h not found])
627 AS_IF([test "$with_selinux" = yes],[
628 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
629 WITH_SELINUX_LIB="-lselinux"
630 WITH_SEMANAGE_LIB="-lsemanage"
632 AC_SUBST(WITH_SELINUX_LIB)
633 AC_SUBST(WITH_SEMANAGE_LIB)
634 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
638 AC_ARG_WITH(cap, [AS_HELP_STRING([--with-cap],[build with capability support])],
641 *) AC_MSG_ERROR([invalid argument to --with-cap])
646 AS_IF([test "$with_cap" = yes],[
647 AC_CHECK_HEADER([sys/capability.h],[
648 AC_CHECK_LIB(cap,[cap_get_file], [
651 AC_CHECK_LIB(cap,[cap_compare], [
652 AC_DEFINE(HAVE_CAP_COMPARE, 1, [Have cap_compare function?])
656 AC_MSG_ERROR([--with-cap given, but libcap not found])])
658 AC_MSG_ERROR([--with-cap given, but sys/capability.h not found])
662 AS_IF([test "$with_cap" = yes],[
663 AC_DEFINE(WITH_CAP, 1, [Build with capability support?])
666 AC_SUBST(WITH_CAP_LIB)
667 AM_CONDITIONAL(CAP,[test "$with_cap" = yes])
670 AC_ARG_WITH(acl, [AS_HELP_STRING([--with-acl],[build with acl support])],
673 *) AC_MSG_ERROR([invalid argument to --with-acl])
678 AS_IF([test "$with_acl" = yes],[
679 dnl verification uses non-portable acl_equiv_mode()
680 AC_CHECK_HEADER([acl/libacl.h],[
681 AC_CHECK_LIB(acl,[acl_equiv_mode],[with_acl=yes],[
682 AC_MSG_ERROR([--with-acl given, but libacl not found or not suitable])])
684 AC_MSG_ERROR([--with-acl given, but acl/libacl.h not found])
688 AS_IF([test "$with_acl" = yes],[
689 AC_DEFINE(WITH_ACL, 1, [Build with acl support?])
692 AC_SUBST(WITH_ACL_LIB)
693 AM_CONDITIONAL(ACL,[test "$with_acl" = yes])
697 AC_ARG_WITH(lua, [AS_HELP_STRING([--with-lua],[build with lua support])],,[with_lua=yes])
698 AS_IF([test "$with_lua" = yes],[
699 AC_CHECK_HEADER([lua.h],[
700 AC_CHECK_LIB(lua,[luaL_openlibs],[with_lua=yes],[
701 AC_MSG_ERROR([--with-lua given, but liblua not found])
705 AC_MSG_ERROR([--with-lua given, but lua.h not found])
709 AS_IF([test "$with_lua" = yes],[
710 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
712 WITH_LUA_LIB="-llua -lm"
714 AC_SUBST(WITH_LUA_LIB)
715 AC_SUBST(WITH_LUA_INCLUDE)
716 AM_CONDITIONAL(WITH_LUAEXT,[test "$with_lua" = yes])
718 AC_ARG_ENABLE(plugins, [AS_HELP_STRING([--disable-plugins],[build without plugin support])],,[enable_plugins=yes])
719 AS_IF([test "$enable_plugins" = yes],[
720 AC_DEFINE(ENABLE_PLUGINS, 1, [Build with plugin support?])
722 AM_CONDITIONAL(ENABLE_PLUGINS,[test "$enable_plugins" = yes])
726 AC_ARG_WITH(dmalloc, [AS_HELP_STRING([--with-dmalloc],[build with dmalloc debugging support])])
727 if test "$with_dmalloc" = yes ; then
728 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
729 LIBS="$LIBS -ldmalloc"
732 AC_CHECK_FUNCS(getpassphrase)
735 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
738 if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
739 host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
741 if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
742 host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
745 if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
746 host_os=`echo "${host_os}" | sed 's/-gnu$//'`
750 host_os_exact="${host_os}"
751 host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
752 host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
755 for provscript in ${host_cpu}-${host_os_exact}.prov ${host_os_exact}.prov ${host_os_major}.prov ${host_os_noversion}.prov none ; do {
756 if test -f ${srcdir}/autodeps/${provscript} ; then
757 if [[ ${provscript} == none ]] ; then
758 echo "*** no default provides information is available for ${host_os_noversion}"
760 echo "using ${srcdir}/autodeps/${provscript} for automatic provides generation"
762 ln -sf ${provscript} ${srcdir}/autodeps/find-provides
768 for reqscript in ${host_cpu}-${host_os_exact}.req ${host_os_exact}.req ${host_os_major}.req ${host_os_noversion}.req none ; do {
769 if test -f ${srcdir}/autodeps/${reqscript} ; then
770 if [[ ${reqscript} == none ]] ; then
771 echo "*** no default requires information is available for ${host_os_noversion}"
773 echo "using ${srcdir}/autodeps/${reqscript} for automatic requires generation"
775 ln -sf ${reqscript} ./autodeps/find-requires
780 dnl Determine the canonical arch-vendor-os for the host machine
781 case "${host_cpu}" in
782 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
783 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
784 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
785 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
786 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
787 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
788 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
789 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64 ;;
790 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
791 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
792 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
793 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
794 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
795 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
796 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
797 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
798 sh3*) RPMCANONCOLOR=0; RPMCANONARCH=sh3 ;;
799 sh4*) RPMCANONCOLOR=0; RPMCANONARCH=sh4 ;;
800 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
802 case "${host_os_noversion}" in
803 mint) RPMCANONARCH=m68kmint ;;
806 dnl permit overriding build_vendor for "canonical rpm vendor"
807 RPMCANONVENDOR="$build_vendor"
808 AC_ARG_WITH([vendor],
809 AS_HELP_STRING([--with-vendor=VENDOR], [specify rpm vendor name]),
810 [RPMCANONVENDOR=$withval])
811 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
813 RPMCANONOS="$host_os_noversion"
814 RPMCANONGNU="$host_os_gnu"
815 AC_SUBST(RPMCANONCOLOR)
816 AC_SUBST(RPMCANONARCH)
817 AC_SUBST(RPMCANONVENDOR)
819 AC_SUBST(RPMCANONGNU)
821 if test X"$prefix" = XNONE ; then
822 usrprefix="$ac_default_prefix"
827 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
828 AC_SUBST(RPMCONFIGDIR)
832 if test "$with_external_db" = no; then
833 AC_CONFIG_SUBDIRS(db3)
836 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
837 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
838 AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes])
840 AC_PATH_PROG(AUTOM4TE,autom4te,:)
842 AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
844 AC_CONFIG_FILES([Makefile
845 rpmio/Makefile lib/Makefile build/Makefile sign/Makefile
846 po/Makefile.in scripts/Makefile fileattrs/Makefile