2 AC_INIT(rpm, 4.8.0-beta1, 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)
106 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
107 AC_MSG_CHECKING(checking whether id supports -u)
108 if ${__ID} -u 2>&1 > /dev/null ; then
112 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
117 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
118 AC_PATH_PROG(__XZ, xz, /usr/bin/xz, $MYPATH)
119 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
120 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
121 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
122 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
123 AC_MSG_CHECKING(old version of patch)
124 PATCHVERSION=`patch --version 2>&1`
126 if test "$PATCHVERSION" = "Patch version 2.1"; then
127 AC_DEFINE(HAVE_OLDPATCH_21, 1,
128 [Define if the patch call you'll be using is 2.1 or older])
129 AC_MSG_RESULT(patch older then 2.2 found)
131 AC_MSG_RESULT(patch later then 2.2 found)
134 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
135 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
136 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
137 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
138 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
139 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
140 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
141 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
143 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
144 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
145 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
146 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
147 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
148 AC_PATH_PROG(__FAKECHROOT, fakechroot, /usr/bin/fakechroot, $MYPATH)
150 dnl see if we have a mkdir that supports `-p' for rpmbuild's purposes
152 if ! echo $MKDIR_P | grep -q mkdir; then
153 __MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
157 AC_DEFINE_UNQUOTED(__MKDIR_P, "${__MKDIR_P}",
158 [A full path to a program, possibly with arguments, that will create a
159 directory and all necessary parent directories, ala 'mkdir -p'])
163 # Check for zlib library.
168 AC_CHECK_HEADERS([zlib.h],[
169 AS_IF([test -z "${WITH_ZLIB_LIB}"],[
170 for zlib in z gz ; do
171 AC_CHECK_LIB(${zlib}, gzread,
172 [WITH_ZLIB_LIB="-l${zlib}"; break])
175 dnl zlib-1.0.4 has not gzseek
176 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
180 AC_SUBST(WITH_ZLIB_INCLUDE)
181 AC_SUBST(WITH_ZLIB_LIB)
184 # Check for bzip2 library.
186 AC_CHECK_HEADERS([bzlib.h],[
187 AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
189 AC_CHECK_LIB(bz2, BZ2_bzread,[
191 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
195 AC_SUBST(WITH_BZ2_LIB)
198 # Check for lzma library.
200 AC_CHECK_HEADERS([lzma.h],[
201 AC_CHECK_LIB(lzma, lzma_easy_encoder, [WITH_LZMA_LIB=-llzma])
203 AC_SUBST(WITH_LZMA_LIB)
208 dnl Check for features
211 dnl Checks for libraries.
213 AC_CHECK_FUNC(gethostname, [], [
214 AC_CHECK_LIB(nsl, gethostname)
217 AC_CHECK_HEADERS(poll.h)
219 AC_CHECK_HEADERS(pthread.h)
221 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
222 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
223 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
224 AC_CHECK_LIB(thread, mutex_lock)
228 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
230 AC_CHECK_FUNCS(vsnprintf snprintf)
232 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
233 dnl not in the libc but in libport (for political reasons). This check
234 dnl can hopefully be removed soon. Please use the default action
235 dnl for this macro (not LIBS=...), otherwise the check for dbopen
237 AC_CHECK_LIB(port, writev)
240 # Check for libelf library. Prefer external, otherwise none.
243 AC_CHECK_HEADER([libelf.h])
244 AC_CHECK_HEADERS([gelf.h], [
245 AC_CHECK_LIB(elf, gelf_getvernaux, [
246 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
247 WITH_LIBELF_LIB="-lelf"
251 AC_SUBST(WITH_LIBELF_INCLUDE)
252 AC_SUBST(WITH_LIBELF_LIB)
253 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
255 AC_CHECK_HEADERS([dwarf.h], [
258 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
261 # Check for NSS library.
262 # We need nss.h from NSS which needs nspr.h. Unfortunately both glibc and NSS
263 # have a header named nss.h... so make extra check for NSS's sechash.h
264 # which we use too and hopefully is slightly more unique to NSS.
267 AC_CHECK_HEADERS([nspr.h nss.h sechash.h], [], [
268 AC_MSG_ERROR([missing required NSPR / NSS header])
270 AC_CHECK_LIB(nss3, NSS_NoDB_Init, [
273 AC_MSG_ERROR([missing required NSS library 'nss3'])
275 AC_SUBST(WITH_NSS_INCLUDE)
276 AC_SUBST(WITH_NSS_LIB)
279 # Check for magic library.
283 AC_CHECK_HEADER([magic.h], [
284 AC_CHECK_LIB(magic, magic_open, [
286 WITH_MAGIC_LIB="-lmagic"
288 AC_MSG_ERROR([missing required library 'libmagic'])
291 AC_MSG_ERROR([missing required header magic.h])
294 AC_SUBST(WITH_MAGIC_INCLUDE)
295 AC_SUBST(WITH_MAGIC_LIB)
298 # Check for popt library.
302 AC_CHECK_HEADER([popt.h], [
303 AC_CHECK_LIB(popt, poptGetContext, [
305 WITH_POPT_LIB="-lpopt"
307 AC_MSG_ERROR([missing required library popt])
310 AC_MSG_ERROR([missing required header popt.h])
313 AC_SUBST(WITH_POPT_INCLUDE)
314 AC_SUBST(WITH_POPT_LIB)
317 # Process --with/without-external-db
318 AC_ARG_WITH(external_db, [AS_HELP_STRING([--with-external-db],[build against an external Berkeley db])],
319 [case "$with_external_db" in
321 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
323 [with_external_db=no])
325 case "$with_external_db" in
327 AC_CHECK_HEADERS([db.h],[
328 AC_CHECK_TYPE([db_threadid_t],[],
329 [AC_MSG_WARN([missing type db_threadid_t])],
332 AC_CHECK_LIB([db],[db_create],[],[
333 AC_MSG_ERROR([missing db_create in libdb])
335 AC_CHECK_LIB([db],[db_env_create],[],[
336 AC_MSG_ERROR([missing db_env_create in libdb])
338 AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
339 AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
341 AC_CHECK_LIB([db],[db_strerror],[],[
342 AC_MSG_ERROR([missing db_strerror in libdb])
347 AC_MSG_ERROR([missing required header db.h])
350 * ) # Fall back to internal db if available
351 if [ test -x db/dist/configure ]; then
352 AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
354 AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL])
359 AC_SUBST([WITH_DB_LIB])
361 dnl AmigaOS and IXEmul have a fork() dummy
364 echo "Building for AmigaOS: using vfork() instead of fork()";
365 CFLAGS="$CFLAGS -Dfork=vfork"
369 AM_GNU_GETTEXT_VERSION([0.16.1])
370 AM_GNU_GETTEXT([external])
372 dnl Checks for header files we can live without.
378 AC_CHECK_HEADERS(locale.h)
379 AC_CHECK_HEADERS(limits.h)
380 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
382 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
383 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
384 AC_CHECK_HEADERS(sys/mman.h sys/utsname.h sys/wait.h)
386 AC_CHECK_HEADERS(netinet/in_systm.h)
387 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
388 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
389 AC_CHECK_HEADERS(libio.h)
390 AC_CHECK_HEADERS(err.h mcheck.h)
392 AC_CHECK_HEADERS(glob.h)
394 dnl statfs portability fiddles.
396 dnl We should really emulate/steal sections of the statfs and struct statfs
397 dnl checks from GNU fileutils.
399 AC_MSG_CHECKING(for struct statfs)
402 dnl this is easier than nesting AC_TRY_COMPILEs...
404 found_struct_statfs=no
406 if test X$found_struct_statfs = Xno ; then
407 dnl Solaris 2.6+ wants to use statvfs
408 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
409 #ifdef HAVE_SYS_TYPES_H
410 #include <sys/types.h>
412 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
413 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
414 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
415 found_struct_statfs=yes],[])
418 if test X$found_struct_statfs = Xno ; then
419 dnl first try including sys/vfs.h
420 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
421 #ifdef HAVE_SYS_TYPES_H
422 #include <sys/types.h>
424 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
425 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
426 found_struct_statfs=yes],[])
429 if test X$found_struct_statfs = Xno ; then
430 dnl ...next try including sys/mount.h
431 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
432 #ifdef HAVE_SYS_TYPES_H
433 #include <sys/types.h>
435 #ifdef HAVE_SYS_PARAM_H
436 #include <sys/param.h>
438 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
439 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
440 found_struct_statfs=yes],[])
443 if test X$found_struct_statfs = Xno ; then
444 dnl ...still no joy. Try sys/statfs.h
445 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
446 #ifdef HAVE_SYS_TYPES_H
447 #include <sys/types.h>
449 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
450 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
451 found_struct_statfs=yes],[])
454 if test X$found_struct_statfs = Xno ; then
455 dnl ...no luck. Warn the user of impending doom.
456 AC_MSG_WARN(not found)
460 dnl if we found the struct, see if it has the f_bavail member. Some OSes
461 dnl don't, including IRIX 6.5+
463 if test X$found_struct_statfs = Xyes ; then
464 AC_MSG_CHECKING(for f_bavail member in struct statfs)
465 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
466 #ifdef HAVE_SYS_TYPES_H
467 #include <sys/types.h>
469 #if STATFS_IN_SYS_STATVFS
470 # include <sys/statvfs.h>
471 typedef struct statvfs STATFS_t;
473 typedef struct statfs STATFS_t;
474 # if STATFS_IN_SYS_VFS
475 # include <sys/vfs.h>
476 # elif STATFS_IN_SYS_MOUNT
477 # include <sys/mount.h>
478 # elif STATFS_IN_SYS_STATFS
479 # include <sys/statfs.h>
481 #endif ]], [[STATFS_t sfs;
482 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
483 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
487 if test X$found_struct_statfs = Xyes ; then
489 dnl now check to see if we have the 4-argument variant of statfs()
490 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
492 AC_MSG_CHECKING([if statfs() requires 4 arguments])
493 AC_RUN_IFELSE([AC_LANG_SOURCE([[
494 #ifdef HAVE_SYS_TYPES_H
495 #include <sys/types.h>
497 #ifdef STATFS_IN_SYS_VFS
499 #elif STATFS_IN_SYS_MOUNT
500 #include <sys/mouht.h>
501 #elif STATFS_IN_SYS_STATFS
502 #include <sys/statfs.h>
506 exit (statfs(".", &sfs, sizeof(sfs), 0));
508 ]])],[AC_MSG_RESULT(yes)
509 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
515 dnl look for libc features
517 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
518 dnl make S_ISSOCK always return false (nice, eh?)
519 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
520 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
521 AC_MSG_RESULT($HAS_S_IFSOCK)
522 if test $HAS_S_IFSOCK = yes; then
523 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
526 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
527 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
528 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
529 AC_MSG_RESULT($HAS_S_ISLNK)
530 if test $HAS_S_ISLNK = yes; then
531 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
534 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
535 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
536 AC_MSG_RESULT($HAS_S_ISSOCK)
537 if test $HAS_S_ISSOCK = yes; then
538 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
541 dnl Check for missing typedefs
547 dnl Checks for library functions.
549 dnl XXX don't want to re-enable code that's been unused for years at this
550 dnl point, but should offer good performance improvements, check after
554 AC_CHECK_FUNCS(mtrace)
555 AC_CHECK_FUNCS(strndup strerror)
557 AC_REPLACE_FUNCS(basename getcwd getwd)
558 AC_REPLACE_FUNCS(putenv realpath setenv)
559 AC_REPLACE_FUNCS(stpcpy stpncpy strcspn)
560 AC_REPLACE_FUNCS(strdup strtol strtoul strspn strstr)
562 AC_CHECK_FUNCS(__secure_getenv)
564 AC_CHECK_FUNCS(regcomp)
568 AC_CHECK_FUNCS([mkstemp], [], [AC_MSG_ERROR([mkstemp() is required by rpm])])
570 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
571 dnl %files gets something like
572 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
573 dnl (Note: more than one asterisk in glob pattern.)
575 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
576 dnl dangling symlinks are no longer globbed. Always use the internal glob.
577 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
581 dnl check if python is requested
582 AC_ARG_ENABLE(python, [AS_HELP_STRING([--enable-python],[build rpm python bindings])],
583 [case "$enable_python" in
585 *) AC_MSG_ERROR([invalid argument to --enable-python])
590 AS_IF([test "$enable_python" = yes],[
591 AM_PATH_PYTHON([2.6],[
592 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; import sys; sys.stdout.write(get_python_inc())'`
593 WITH_PYTHON_SUBPACKAGE=1
594 save_CPPFLAGS="$CPPFLAGS"
595 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
596 AC_CHECK_HEADER([Python.h],[],
597 [AC_MSG_ERROR([missing Python.h])
599 CPPFLAGS="$save_CPPFLAGS"
601 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
602 WITH_PYTHON_LIB="$ac_res"
603 ],[AC_MSG_ERROR([missing python library])
610 WITH_PYTHON_SUBPACKAGE=0
613 AC_SUBST(WITH_PYTHON_INCLUDE)
614 AC_SUBST(WITH_PYTHON_LIB)
616 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
618 AC_PATH_PROG(DOXYGEN, doxygen, no)
620 dnl Only build internal API + source hacking docs on request
622 AC_ARG_WITH(hackingdocs, [AS_HELP_STRING([--with-hackingdocs],[build rpm hacking docs])],,[with_hackingdocs=no])
624 case "$with_hackingdocs" in
626 AS_IF([test "$DOXYGEN" = no],[with_hackingdocs=no],[with_hackingdocs=no])
629 AS_IF([test "$DOXYGEN" = no],
630 [AC_MSG_ERROR([rpm hacking docs eeds doxygen in PATH])])
633 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
636 AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux],[build with selinux support])],
637 [case "$with_selinux" in
639 *) AC_MSG_ERROR([invalid argument to --with-selinux])
644 AS_IF([test "$with_selinux" = yes],[
645 AC_CHECK_HEADER([selinux/selinux.h],[
646 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
647 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
649 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
653 AS_IF([test "$with_selinux" = yes],[
654 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
655 WITH_SELINUX_LIB="-lselinux"
657 AC_SUBST(WITH_SELINUX_LIB)
658 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
662 AC_ARG_WITH(cap, [AS_HELP_STRING([--with-cap],[build with capability support])],
665 *) AC_MSG_ERROR([invalid argument to --with-cap])
670 AS_IF([test "$with_cap" = yes],[
671 AC_CHECK_HEADER([sys/capability.h],[
672 AC_CHECK_LIB(cap,[cap_get_file], [
675 AC_CHECK_LIB(cap,[cap_compare], [
676 AC_DEFINE(HAVE_CAP_COMPARE, 1, [Have cap_compare function?])
680 AC_MSG_ERROR([--with-cap given, but libcap not found])])
682 AC_MSG_ERROR([--with-cap given, but sys/capability.h not found])
686 AS_IF([test "$with_cap" = yes],[
687 AC_DEFINE(WITH_CAP, 1, [Build with capability support?])
690 AC_SUBST(WITH_CAP_LIB)
691 AM_CONDITIONAL(CAP,[test "$with_cap" = yes])
694 AC_ARG_WITH(acl, [AS_HELP_STRING([--with-acl],[build with acl support])],
697 *) AC_MSG_ERROR([invalid argument to --with-acl])
702 AS_IF([test "$with_acl" = yes],[
703 dnl verification uses non-portable acl_equiv_mode()
704 AC_CHECK_HEADER([acl/libacl.h],[
705 AC_CHECK_LIB(acl,[acl_equiv_mode],[with_acl=yes],[
706 AC_MSG_ERROR([--with-acl given, but libacl not found or not suitable])])
708 AC_MSG_ERROR([--with-acl given, but acl/libacl.h not found])
712 AS_IF([test "$with_acl" = yes],[
713 AC_DEFINE(WITH_ACL, 1, [Build with acl support?])
716 AC_SUBST(WITH_ACL_LIB)
717 AM_CONDITIONAL(ACL,[test "$with_acl" = yes])
721 AC_ARG_WITH(lua, [AS_HELP_STRING([--with-lua],[build with lua support])],,[with_lua=yes])
722 AS_IF([test "$with_lua" = yes],[
723 AC_CHECK_HEADER([lua.h],[
724 AC_CHECK_LIB(lua,[luaL_openlibs],[with_lua=yes],[
725 AC_MSG_ERROR([--with-lua given, but liblua not found])
729 AC_MSG_ERROR([--with-lua given, but lua.h not found])
733 AS_IF([test "$with_lua" = yes],[
734 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
736 WITH_LUA_LIB="-llua -lm"
738 AC_SUBST(WITH_LUA_LIB)
739 AC_SUBST(WITH_LUA_INCLUDE)
740 AM_CONDITIONAL(WITH_LUAEXT,[test "$with_lua" = yes])
743 AC_ARG_WITH(dmalloc, [AS_HELP_STRING([--with-dmalloc],[build with dmalloc debugging support])])
744 if test "$with_dmalloc" = yes ; then
745 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
746 LIBS="$LIBS -ldmalloc"
749 AC_CHECK_FUNCS(setlocale)
751 AC_CHECK_FUNCS(getpassphrase)
753 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
754 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
755 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
756 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
757 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
758 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
759 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
760 AC_LIBOBJ(getmntent)])
766 AC_CHECK_FUNC(lchown,
767 [__CHOWN_RHF="%{__chown} -Rhf"
768 __CHGRP_RHF="%{__chgrp} -Rhf"
769 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
770 [__CHOWN_RHF="%{__chown} -Rf"
771 __CHGRP_RHF="%{__chgrp} -Rf"
772 dnl Does chown() follow symlinks? This should be a good enough test.
773 AC_MSG_CHECKING(whether chown() follows symlinks)
774 AC_ARG_ENABLE([broken-chown],
775 [AS_HELP_STRING([--enable-broken-chown],[this system's chown follows symbolic links])],
776 result=$enableval, result=unknown)
777 if echo "$build" | ${EGREP} "(aix)|(hpux)|(linux)" > /dev/null ; then
779 elif echo "$build" | ${EGREP} "(nextstep)" > /dev/null ; then
782 if test $result = unknown; then
783 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
788 if test `ls -l foo | awk '{print $3}'` != "root"; then
795 AC_MSG_CHECKING((cannot check by non-root user))
800 AC_MSG_RESULT($result)
801 if test $result = yes; then
802 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
804 AC_SUBST(__CHOWN_RHF)
805 AC_SUBST(__CHGRP_RHF)
807 if echo "$host_os" | grep sco > /dev/null; then
808 echo "hacking things up for sco"
809 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
810 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
811 [Define as 1 if you have "struct mnttab" (only sco?)])
812 elif echo "$host_os" | grep sunos > /dev/null; then
813 echo "hacking things up for sunos"
814 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
815 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
816 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
821 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
824 if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
825 host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
827 if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
828 host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
831 if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
832 host_os=`echo "${host_os}" | sed 's/-gnu$//'`
836 host_os_exact="${host_os}"
837 host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
838 host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
841 rm -f ./find-provides
842 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ; then
843 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov for automatic provides generation"
844 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ./find-provides
845 elif test -f ${srcdir}/autodeps/${host_os_exact}.prov ; then
846 echo "using ${srcdir}/autodeps/${host_os_exact}.prov for automatic provides generation"
847 ln -s ${srcdir}/autodeps/${host_os_exact}.prov ./find-provides
848 elif test -f ${srcdir}/autodeps/${host_os_major}.prov ; then
849 echo "using ${srcdir}/autodeps/${host_os_major}.prov for automatic provides generation"
850 ln -s ${srcdir}/autodeps/${host_os_major}.prov ./find-provides
851 elif test -f ${srcdir}/autodeps/${host_os_noversion}.prov ; then
852 echo "using ${srcdir}/autodeps/${host_os_noversion}.prov for automatic provides generation"
853 ln -s ${srcdir}/autodeps/${host_os_noversion}.prov ./find-provides
855 echo "*** no default provides information is available for ${host_os_noversion}"
856 ln -s ${srcdir}/autodeps/none ./find-provides
859 rm -f ./find-requires
860 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ; then
861 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req for automatic requires generation"
862 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ./find-requires
863 elif test -f ${srcdir}/autodeps/${host_os_exact}.req ; then
864 echo "using ${srcdir}/autodeps/${host_os_exact}.req for automatic requires generation"
865 ln -s ${srcdir}/autodeps/${host_os_exact}.req ./find-requires
866 elif test -f ${srcdir}/autodeps/${host_os_major}.req ; then
867 echo "using ${srcdir}/autodeps/${host_os_major}.req for automatic requires generation"
868 ln -s ${srcdir}/autodeps/${host_os_major}.req ./find-requires
869 elif test -f ${srcdir}/autodeps/${host_os_noversion}.req ; then
870 echo "using ${srcdir}/autodeps/${host_os_noversion}.req for automatic requires generation"
871 ln -s ${srcdir}/autodeps/${host_os_noversion}.req ./find-requires
873 echo "*** no default requires information is available for ${host_os_noversion}"
874 ln -s ${srcdir}/autodeps/none ./find-requires
877 dnl Determine the canonical arch-vendor-os for the host machine
878 case "${host_cpu}" in
879 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
880 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
881 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
882 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
883 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
884 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
885 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
886 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64 ;;
887 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
888 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
889 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
890 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
891 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
892 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
893 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
894 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
895 sh3*) RPMCANONCOLOR=0; RPMCANONARCH=sh3 ;;
896 sh4*) RPMCANONCOLOR=0; RPMCANONARCH=sh4 ;;
897 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
899 case "${host_os_noversion}" in
900 mint) RPMCANONARCH=m68kmint ;;
902 RPMCANONVENDOR="$build_vendor"
903 case "${build_vendor}" in
904 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos|suse)
905 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
906 test -f /etc/SuSE-release && RPMCANONVENDOR=suse
907 test -f /etc/pld-release && RPMCANONVENDOR=pld
908 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
909 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
910 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
911 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
912 test -f /etc/caos-release && RPMCANONVENDOR=caos
915 RPMCANONOS="$host_os_noversion"
916 RPMCANONGNU="$host_os_gnu"
917 AC_SUBST(RPMCANONCOLOR)
918 AC_SUBST(RPMCANONARCH)
919 AC_SUBST(RPMCANONVENDOR)
921 AC_SUBST(RPMCANONGNU)
922 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
924 if test X"$prefix" = XNONE ; then
925 usrprefix="$ac_default_prefix"
930 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
931 AC_SUBST(RPMCONFIGDIR)
935 if test "$with_external_db" = no; then
936 AC_CONFIG_SUBDIRS(db3)
939 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
940 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
941 AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes])
943 AC_PATH_PROG(AUTOM4TE,autom4te,:)
945 AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
946 AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
949 AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
951 AC_CONFIG_FILES([Makefile
952 rpmio/Makefile lib/Makefile build/Makefile
953 po/Makefile.in scripts/Makefile