2 AC_INIT(rpm, 4.7.0, rpm-maint@lists.rpm.org)
4 AC_CONFIG_SRCDIR([rpmqv.c])
5 AC_CONFIG_HEADERS([config.h])
7 AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects nostdinc])
9 AC_CONFIG_TESTDIR(tests)
11 AC_USE_SYSTEM_EXTENSIONS
15 dnl Checks for programs.
27 if test "$ac_cv_prog_cc_c99" = no; then
28 AC_MSG_ERROR([ISO C99 capable compiler required])
33 if test "$GCC" = yes; then
34 CFLAGS="$CFLAGS -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wno-char-subscripts"
35 # XXX disabled for now due to noise from NSPR headers
36 # CFLAGS="$CFLAGS -Wstrict-prototypes"
37 cflags_to_try="-fno-strict-aliasing -fstack-protector"
38 AC_MSG_CHECKING([supported compiler flags])
41 for flag in $cflags_to_try; do
42 CFLAGS="$CFLAGS $flag"
43 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[
45 RPMCFLAGS="$RPMCFLAGS $flag"
49 CFLAGS="$CFLAGS $RPMCFLAGS"
56 dnl look for POSIX chmod attributes
58 AC_MSG_CHECKING(POSIX chmod)
60 chmod 744 foo.chmodtest
61 chmod +X foo.chmodtest 2>/dev/null
62 a=`ls -l foo.chmodtest | awk '{print $1}'`
64 if test "$a" = "-rwxr-xr-x"; then
66 FIXPERMS=a+rX,u+w,g-w,o-w
68 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
69 FIXPERMS=a+r,u+w,g-w,o-w
74 dnl see if we have a mkdir that supports `-p'.
76 AC_PATH_PROGS(RPM_MKDIR, mkdir, mkdir)
77 AC_MSG_CHECKING(if $RPM_MKDIR supports -p)
79 $RPM_MKDIR -p conftest/a 2>/dev/null
81 rmdir conftest/a 2>/dev/null
88 rmdir conftest 2>/dev/null
90 RPM_MKDIR_P="$RPM_MKDIR -p"
98 if test X"$RPM_MKDIR_P" = X0 ; then
100 RPM_MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
105 dnl substitute this into config.h, so the C source picks it up.
107 AC_DEFINE_UNQUOTED(RPM_MKDIR_P, "${RPM_MKDIR_P}",
108 [A full path to a program, possibly with arguments, that will create a
109 directory and all necessary parent directories, ala 'mkdir -p'])
110 AC_SUBST(RPM_MKDIR_P)
112 dnl AM_DISABLE_SHARED
115 AC_CHECK_TOOL(AR, ar, :)
118 dnl use defaults if cross-compiling, otherwise use the default path.
120 if test "$cross_compiling" = "yes"; then
127 dnl Find some common programs
129 AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH)
130 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
131 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
132 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
133 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
134 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
135 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
136 AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH)
137 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
138 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
139 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
140 AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH)
141 AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH)
143 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
144 AC_MSG_CHECKING(checking whether id supports -u)
145 if ${__ID} -u 2>&1 > /dev/null ; then
149 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
154 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
155 AC_PATH_PROG(__LZMA, lzma, /usr/bin/lzma, $MYPATH)
156 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
157 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
158 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
159 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
160 AC_MSG_CHECKING(old version of patch)
161 PATCHVERSION=`patch --version 2>&1`
163 if test "$PATCHVERSION" = "Patch version 2.1"; then
164 AC_DEFINE(HAVE_OLDPATCH_21, 1,
165 [Define if the patch call you'll be using is 2.1 or older])
166 AC_MSG_RESULT(patch older then 2.2 found)
168 AC_MSG_RESULT(patch later then 2.2 found)
171 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
172 AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH)
173 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
174 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
175 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
176 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
177 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
178 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
180 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
181 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
182 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
183 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
184 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
187 # Check for zlib library.
192 AC_CHECK_HEADERS([zlib.h],[
193 AS_IF([test -z "${WITH_ZLIB_LIB}"],[
194 for zlib in z gz ; do
195 AC_CHECK_LIB(${zlib}, gzread,
196 [WITH_ZLIB_LIB="-l${zlib}"; break])
199 dnl zlib-1.0.4 has not gzseek
200 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
204 AC_SUBST(WITH_ZLIB_INCLUDE)
205 AC_SUBST(WITH_ZLIB_LIB)
208 # Check for bzip2 library.
210 AC_CHECK_HEADERS([bzlib.h],[
211 AC_CHECK_LIB(bz2, bzread, [WITH_BZ2_LIB=-lbz2],
213 AC_CHECK_LIB(bz2, BZ2_bzread,[
215 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0])
219 AC_SUBST(WITH_BZ2_LIB)
222 # Check for lzma library.
224 AC_CHECK_HEADERS([lzma.h],[
225 AC_CHECK_LIB(lzma, lzma_auto_decoder, [WITH_LZMA_LIB=-llzma])
227 AC_SUBST(WITH_LZMA_LIB)
232 dnl Check for features
235 dnl Checks for libraries.
237 AC_CHECK_FUNC(setreuid, [], [
238 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
241 AC_CHECK_FUNC(rand, [], [
242 AC_CHECK_LIB(rand, rand, [])
245 AC_CHECK_FUNC(getdomainname, [], [
246 AC_CHECK_LIB(nsl, getdomainname)
248 AC_CHECK_FUNC(socket, [], [
249 AC_CHECK_LIB(socket, socket)
252 AC_CHECK_HEADERS(error.h)
253 AC_CHECK_FUNCS(error)
255 AC_CHECK_HEADERS(poll.h)
257 AC_CHECK_HEADERS(pthread.h)
259 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
260 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
261 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
262 AC_CHECK_LIB(thread, mutex_lock)
266 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
268 AC_CHECK_FUNCS(vsnprintf snprintf)
270 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
271 dnl not in the libc but in libport (for political reasons). This check
272 dnl can hopefully be removed soon. Please use the default action
273 dnl for this macro (not LIBS=...), otherwise the check for dbopen
275 AC_CHECK_LIB(port, writev)
278 # Check for libelf library. Prefer external, otherwise none.
281 AC_CHECK_HEADER([libelf.h])
282 AC_CHECK_HEADERS([gelf.h], [
283 AC_CHECK_LIB(elf, gelf_getvernaux, [
284 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
285 WITH_LIBELF_LIB="-lelf"
289 AC_SUBST(WITH_LIBELF_INCLUDE)
290 AC_SUBST(WITH_LIBELF_LIB)
291 AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
293 AC_CHECK_HEADERS([dwarf.h], [
296 AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes])
299 # Check for NSS library.
300 # We need nss.h from NSS which needs nspr.h. Unfortunately both glibc and NSS
301 # have a header named nss.h... so make extra check for NSS's sechash.h
302 # which we use too and hopefully is slightly more unique to NSS.
305 AC_CHECK_HEADERS([nspr.h nss.h sechash.h], [], [
306 AC_MSG_ERROR([missing required NSPR / NSS header])
308 AC_CHECK_LIB(nss3, NSS_NoDB_Init, [
311 AC_MSG_ERROR([missing required NSS library 'nss3'])
313 AC_SUBST(WITH_NSS_INCLUDE)
314 AC_SUBST(WITH_NSS_LIB)
317 # Check for magic library.
321 AC_CHECK_HEADER([magic.h], [
322 AC_CHECK_LIB(magic, magic_open, [
324 WITH_MAGIC_LIB="-lmagic"
326 AC_MSG_ERROR([missing required library 'libmagic'])
329 AC_MSG_ERROR([missing required header magic.h])
332 AC_SUBST(WITH_MAGIC_INCLUDE)
333 AC_SUBST(WITH_MAGIC_LIB)
336 # Check for popt library.
340 AC_CHECK_HEADER([popt.h], [
341 AC_CHECK_LIB(popt, poptGetContext, [
343 WITH_POPT_LIB="-lpopt"
345 AC_MSG_ERROR([missing required library popt])
348 AC_MSG_ERROR([missing required header popt.h])
351 AC_SUBST(WITH_POPT_INCLUDE)
352 AC_SUBST(WITH_POPT_LIB)
355 # Process --with/without-external-db
356 AC_ARG_WITH(external_db, [ --with-external-db build against an external Berkeley db],
357 [case "$with_external_db" in
359 *) AC_MSG_ERROR([invalid argument to --with-external-db]) ;;
361 [with_external_db=no])
363 case "$with_external_db" in
365 AC_CHECK_HEADERS([db.h],[
366 AC_CHECK_TYPE([db_threadid_t],[],
367 [AC_MSG_WARN([missing type db_threadid_t])],
370 AC_CHECK_LIB([db],[db_create],[],[
371 AC_MSG_ERROR([missing db_create in libdb])
373 AC_CHECK_LIB([db],[db_env_create],[],[
374 AC_MSG_ERROR([missing db_env_create in libdb])
376 AC_CHECK_LIB([db],[db_env_set_func_fsync],[],[
377 AC_MSG_ERROR([missing db_env_set_func_fsync in libdb])
379 AC_CHECK_LIB([db],[db_strerror],[],[
380 AC_MSG_ERROR([missing db_strerror in libdb])
385 AC_MSG_ERROR([missing required header db.h])
388 * ) # Fall back to internal db if available
389 if [ test -x db/dist/configure ]; then
390 AC_DEFINE(HAVE_DB_H, 1, [Define if you have the <db3/db.h> header file])
392 AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL])
397 AC_SUBST([WITH_DB_LIB])
400 # Check for sqlite3 library.
401 AC_ARG_ENABLE(sqlite3, [ --enable-sqlite3 enable sqlite3 support],
402 [case "$enable_sqlite3" in
404 *) AC_MSG_ERROR([invalid argument to --enable-sqlite3])
409 WITH_SQLITE3_INCLUDE=
412 AS_IF([test "$enable_sqlite3" = yes],[
413 AC_CHECK_HEADERS([sqlite3.h],
414 [ AC_CHECK_LIB(sqlite3, sqlite3_open, [
415 WITH_SQLITE3_INCLUDE=
416 WITH_SQLITE3_LIB="-lsqlite3"
419 AC_MSG_ERROR([missing libsqlite3])
422 AC_MSG_ERROR([missing sqlite3.h])
426 AC_SUBST(WITH_SQLITE3_INCLUDE)
427 AC_SUBST(WITH_SQLITE3_LIB)
428 AM_CONDITIONAL([SQLITE3],[test "$WITH_SQLITE3" = yes])
432 dnl AmigaOS and IXEmul have a fork() dummy
435 echo "Building for AmigaOS: using vfork() instead of fork()";
436 CFLAGS="$CFLAGS -Dfork=vfork"
440 AM_GNU_GETTEXT_VERSION([0.16.1])
441 AM_GNU_GETTEXT([external])
443 dnl Checks for header files we can live without.
449 AC_CHECK_HEADERS(locale.h)
450 AC_CHECK_HEADERS(limits.h)
451 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
453 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
454 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
455 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
457 AC_CHECK_HEADERS(netinet/in_systm.h)
458 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
459 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
460 AC_CHECK_HEADERS(libio.h)
461 AC_CHECK_HEADERS(err.h mcheck.h)
463 AC_CHECK_HEADERS(glob.h)
465 dnl statfs portability fiddles.
467 dnl We should really emulate/steal sections of the statfs and struct statfs
468 dnl checks from GNU fileutils.
470 AC_MSG_CHECKING(for struct statfs)
473 dnl this is easier than nesting AC_TRY_COMPILEs...
475 found_struct_statfs=no
477 if test X$found_struct_statfs = Xno ; then
478 dnl Solaris 2.6+ wants to use statvfs
479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
480 #ifdef HAVE_SYS_TYPES_H
481 #include <sys/types.h>
483 #include <sys/statvfs.h> ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h)
484 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
485 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
486 found_struct_statfs=yes],[])
489 if test X$found_struct_statfs = Xno ; then
490 dnl first try including sys/vfs.h
491 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
492 #ifdef HAVE_SYS_TYPES_H
493 #include <sys/types.h>
495 #include <sys/vfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h)
496 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
497 found_struct_statfs=yes],[])
500 if test X$found_struct_statfs = Xno ; then
501 dnl ...next try including sys/mount.h
502 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
503 #ifdef HAVE_SYS_TYPES_H
504 #include <sys/types.h>
506 #ifdef HAVE_SYS_PARAM_H
507 #include <sys/param.h>
509 #include <sys/mount.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/mount.h)
510 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
511 found_struct_statfs=yes],[])
514 if test X$found_struct_statfs = Xno ; then
515 dnl ...still no joy. Try sys/statfs.h
516 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
517 #ifdef HAVE_SYS_TYPES_H
518 #include <sys/types.h>
520 #include <sys/statfs.h> ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/statfs.h)
521 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
522 found_struct_statfs=yes],[])
525 if test X$found_struct_statfs = Xno ; then
526 dnl ...no luck. Warn the user of impending doom.
527 AC_MSG_WARN(not found)
531 dnl if we found the struct, see if it has the f_bavail member. Some OSes
532 dnl don't, including IRIX 6.5+
534 if test X$found_struct_statfs = Xyes ; then
535 AC_MSG_CHECKING(for f_bavail member in struct statfs)
536 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
537 #ifdef HAVE_SYS_TYPES_H
538 #include <sys/types.h>
540 #if STATFS_IN_SYS_STATVFS
541 # include <sys/statvfs.h>
542 typedef struct statvfs STATFS_t;
544 typedef struct statfs STATFS_t;
545 # if STATFS_IN_SYS_VFS
546 # include <sys/vfs.h>
547 # elif STATFS_IN_SYS_MOUNT
548 # include <sys/mount.h>
549 # elif STATFS_IN_SYS_STATFS
550 # include <sys/statfs.h>
552 #endif ]], [[STATFS_t sfs;
553 sfs.f_bavail = 0;]])],[AC_MSG_RESULT(yes)
554 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],[AC_MSG_RESULT(no)
558 if test X$found_struct_statfs = Xyes ; then
560 dnl now check to see if we have the 4-argument variant of statfs()
561 dnl this pretty much requires AC_RUN_IFELSE([AC_LANG_SOURCE([[]])],[],[],[])
563 AC_MSG_CHECKING([if statfs() requires 4 arguments])
564 AC_RUN_IFELSE([AC_LANG_SOURCE([[
565 #ifdef HAVE_SYS_TYPES_H
566 #include <sys/types.h>
568 #ifdef STATFS_IN_SYS_VFS
570 #elif STATFS_IN_SYS_MOUNT
571 #include <sys/mouht.h>
572 #elif STATFS_IN_SYS_STATFS
573 #include <sys/statfs.h>
577 exit (statfs(".", &sfs, sizeof(sfs), 0));
579 ]])],[AC_MSG_RESULT(yes)
580 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)
586 dnl look for libc features
588 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
589 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netdb.h>]], [[printf("%d",h_errno)]])],[PROVIDES_ERRNO=yes],[])
590 AC_MSG_RESULT($PROVIDES_ERRNO)
591 if test $PROVIDES_ERRNO = yes; then
592 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
595 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
596 dnl make S_ISSOCK always return false (nice, eh?)
597 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
598 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_IFSOCK)]])],[HAS_S_IFSOCK=yes],[HAS_S_IFSOCK=no])
599 AC_MSG_RESULT($HAS_S_IFSOCK)
600 if test $HAS_S_IFSOCK = yes; then
601 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
604 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
605 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
606 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISLNK(0755))]])],[HAS_S_ISLNK=yes],[HAS_S_ISLNK=no])
607 AC_MSG_RESULT($HAS_S_ISLNK)
608 if test $HAS_S_ISLNK = yes; then
609 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
612 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
613 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/stat.h>]], [[printf("%d", S_ISSOCK(0755))]])],[HAS_S_ISSOCK=yes],[HAS_S_ISSOCK=no])
614 AC_MSG_RESULT($HAS_S_ISSOCK)
615 if test $HAS_S_ISSOCK = yes; then
616 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
619 dnl Check for missing typedefs
625 dnl Checks for library functions.
627 dnl XXX don't want to re-enable code that's been unused for years at this
628 dnl point, but should offer good performance improvements, check after
632 AC_CHECK_FUNCS(getaddrinfo getnameinfo inet_aton)
633 AC_CHECK_FUNCS(mtrace)
634 AC_CHECK_FUNCS(strndup strerror)
636 AC_REPLACE_FUNCS(basename getcwd getwd)
637 AC_REPLACE_FUNCS(putenv realpath setenv)
638 AC_REPLACE_FUNCS(stpcpy stpncpy strcspn)
639 AC_REPLACE_FUNCS(strdup strtol strtoul strspn strstr)
641 AC_CHECK_FUNCS(__secure_getenv)
643 AC_CHECK_FUNCS(regcomp)
647 AC_CHECK_FUNCS([mkstemp], [], [AC_MSG_ERROR([mkstemp() is required by rpm])])
649 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
650 dnl %files gets something like
651 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
652 dnl (Note: more than one asterisk in glob pattern.)
654 dnl XXX Glob is "fixed" in glibc-2.3.3-61, but the cost is that
655 dnl dangling symlinks are no longer globbed. Always use the internal glob.
656 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
660 dnl check if python is requested
661 AC_ARG_ENABLE(python, [ --enable-python build rpm python bindings ],
662 [case "$enable_python" in
664 *) AC_MSG_ERROR([invalid argument to --enable-python])
669 AS_IF([test "$enable_python" = yes],[
670 # rpm-python is based on python-2.5,
671 # with legacy hacks to allow building against python >= 2.3
672 AM_PATH_PYTHON([2.3],[
673 WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; print get_python_inc()'`
674 WITH_PYTHON_SUBPACKAGE=1
675 save_CPPFLAGS="$CPPFLAGS"
676 CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE"
677 AC_CHECK_HEADER([Python.h],[],
678 [AC_MSG_ERROR([missing Python.h])
680 CPPFLAGS="$save_CPPFLAGS"
682 AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
683 WITH_PYTHON_LIB="$ac_res"
684 ],[AC_MSG_ERROR([missing python library])
691 WITH_PYTHON_SUBPACKAGE=0
694 AC_SUBST(WITH_PYTHON_INCLUDE)
695 AC_SUBST(WITH_PYTHON_LIB)
697 AM_CONDITIONAL(PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1])
699 AC_PATH_PROG(DOXYGEN, doxygen, no)
701 dnl Only build internal API + source hacking docs on request
703 AC_ARG_WITH(hackingdocs, [ --with-hackingdocs build rpm hacking docs ],,[with_hackingdocs=no])
705 case "$with_hackingdocs" in
707 AS_IF([test "$DOXYGEN" = no],[with_hackingdocs=no],[with_hackingdocs=no])
710 AS_IF([test "$DOXYGEN" = no],
711 [AC_MSG_ERROR([rpm hacking docs eeds doxygen in PATH])])
714 AC_CHECK_PROG(HAVE_DOT,[dot],[YES],[NO])
717 AC_ARG_WITH(selinux, [ --with-selinux build with selinux support ],
718 [case "$with_selinux" in
720 *) AC_MSG_ERROR([invalid argument to --with-selinux])
725 AS_IF([test "$with_selinux" = yes],[
726 AC_CHECK_HEADER([selinux/selinux.h],[
727 AC_CHECK_LIB(selinux,[is_selinux_enabled],[with_selinux=yes],[
728 AC_MSG_ERROR([--with-selinux given, but libselinux not found])])
730 AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found])
734 AS_IF([test "$with_selinux" = yes],[
735 AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?])
736 WITH_SELINUX_LIB="-lselinux"
738 AC_SUBST(WITH_SELINUX_LIB)
739 AM_CONDITIONAL(SELINUX,[test "$with_selinux" = yes])
743 AC_ARG_WITH(cap, [ --with-cap build with capability support ],
746 *) AC_MSG_ERROR([invalid argument to --with-cap])
751 AS_IF([test "$with_cap" = yes],[
752 AC_CHECK_HEADER([sys/capability.h],[
753 AC_CHECK_LIB(cap,[cap_get_file],[with_cap=yes],[
754 AC_MSG_ERROR([--with-cap given, but libcap not found])])
756 AC_MSG_ERROR([--with-cap given, but sys/capability.h not found])
760 AS_IF([test "$with_cap" = yes],[
761 AC_DEFINE(WITH_CAP, 1, [Build with capability support?])
764 AC_SUBST(WITH_CAP_LIB)
765 AM_CONDITIONAL(CAP,[test "$with_cap" = yes])
768 AC_ARG_WITH(acl, [ --with-acl build with acl support ],
771 *) AC_MSG_ERROR([invalid argument to --with-acl])
776 AS_IF([test "$with_acl" = yes],[
777 dnl verification uses non-portable acl_equiv_mode()
778 AC_CHECK_HEADER([acl/libacl.h],[
779 AC_CHECK_LIB(acl,[acl_equiv_mode],[with_acl=yes],[
780 AC_MSG_ERROR([--with-acl given, but libacl not found or not suitable])])
782 AC_MSG_ERROR([--with-acl given, but acl/libacl.h not found])
786 AS_IF([test "$with_acl" = yes],[
787 AC_DEFINE(WITH_ACL, 1, [Build with acl support?])
790 AC_SUBST(WITH_ACL_LIB)
791 AM_CONDITIONAL(ACL,[test "$with_acl" = yes])
795 AC_ARG_WITH(lua, [ --with-lua build with lua support ],,[with_lua=yes])
796 AS_IF([test "$with_lua" = yes],[
797 AC_CHECK_HEADER([lua.h],[
798 AC_CHECK_LIB(lua,[luaL_openlibs],[with_lua=yes],[
799 AC_MSG_ERROR([--with-lua given, but liblua not found])
803 AC_MSG_ERROR([--with-lua given, but lua.h not found])
807 AS_IF([test "$with_lua" = yes],[
808 AC_DEFINE(WITH_LUA, 1, [Build with lua support?])
810 WITH_LUA_LIB="-llua -lm"
812 AC_SUBST(WITH_LUA_LIB)
813 AC_SUBST(WITH_LUA_INCLUDE)
814 AM_CONDITIONAL(WITH_LUAEXT,[test "$with_lua" = yes])
817 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
818 if test "$with_dmalloc" = yes ; then
819 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
820 LIBS="$LIBS -ldmalloc"
823 AC_CHECK_FUNCS(setlocale)
825 AC_CHECK_FUNCS(getpassphrase)
827 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
828 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
829 AC_CHECK_FUNC(getmntinfo, AC_DEFINE(HAVE_GETMNTINFO, 1, [Define as 1 if you have getmntinfo() (Mac OS X)]), [
830 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
831 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
832 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
833 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
834 AC_LIBOBJ(getmntent)])
840 AC_CHECK_FUNC(lchown,
841 [__CHOWN_RHF="%{__chown} -Rhf"
842 __CHGRP_RHF="%{__chgrp} -Rhf"
843 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
844 [__CHOWN_RHF="%{__chown} -Rf"
845 __CHGRP_RHF="%{__chgrp} -Rf"
846 dnl Does chown() follow symlinks? This should be a good enough test.
847 AC_MSG_CHECKING(whether chown() follows symlinks)
848 AC_ARG_ENABLE([broken-chown],
849 [ --enable-broken-chown this system's chown follows symbolic links],
850 result=$enableval, result=unknown)
851 if echo "$build" | ${EGREP} "(aix)|(hpux)|(linux)" > /dev/null ; then
853 elif echo "$build" | ${EGREP} "(nextstep)" > /dev/null ; then
856 if test $result = unknown; then
857 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
862 if test `ls -l foo | awk '{print $3}'` != "root"; then
869 AC_MSG_CHECKING((cannot check by non-root user))
874 AC_MSG_RESULT($result)
875 if test $result = yes; then
876 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
878 AC_SUBST(__CHOWN_RHF)
879 AC_SUBST(__CHGRP_RHF)
881 if echo "$host_os" | grep sco > /dev/null; then
882 echo "hacking things up for sco"
883 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
884 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
885 [Define as 1 if you have "struct mnttab" (only sco?)])
886 elif echo "$host_os" | grep sunos > /dev/null; then
887 echo "hacking things up for sunos"
888 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
889 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
890 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
895 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os
898 if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then
899 host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'`
901 if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then
902 host_os=`echo "${host_os}" | sed 's/-gnueabi$//'`
905 if echo "$host_os" | grep '.*-gnu' > /dev/null ; then
906 host_os=`echo "${host_os}" | sed 's/-gnu$//'`
910 host_os_exact="${host_os}"
911 host_os_major=`echo "${host_os}" | sed 's/\..*$//'`
912 host_os_noversion=`echo "${host_os}" | sed 's/[0-9]*\..*$//'`
915 rm -f ./find-provides
916 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ; then
917 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov for automatic provides generation"
918 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.prov ./find-provides
919 elif test -f ${srcdir}/autodeps/${host_os_exact}.prov ; then
920 echo "using ${srcdir}/autodeps/${host_os_exact}.prov for automatic provides generation"
921 ln -s ${srcdir}/autodeps/${host_os_exact}.prov ./find-provides
922 elif test -f ${srcdir}/autodeps/${host_os_major}.prov ; then
923 echo "using ${srcdir}/autodeps/${host_os_major}.prov for automatic provides generation"
924 ln -s ${srcdir}/autodeps/${host_os_major}.prov ./find-provides
925 elif test -f ${srcdir}/autodeps/${host_os_noversion}.prov ; then
926 echo "using ${srcdir}/autodeps/${host_os_noversion}.prov for automatic provides generation"
927 ln -s ${srcdir}/autodeps/${host_os_noversion}.prov ./find-provides
929 echo "*** no default provides information is available for ${host_os_noversion}"
930 ln -s ${srcdir}/autodeps/none ./find-provides
933 rm -f ./find-requires
934 if test -f ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ; then
935 echo "using ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req for automatic requires generation"
936 ln -s ${srcdir}/autodeps/${host_cpu}-${host_os_exact}.req ./find-requires
937 elif test -f ${srcdir}/autodeps/${host_os_exact}.req ; then
938 echo "using ${srcdir}/autodeps/${host_os_exact}.req for automatic requires generation"
939 ln -s ${srcdir}/autodeps/${host_os_exact}.req ./find-requires
940 elif test -f ${srcdir}/autodeps/${host_os_major}.req ; then
941 echo "using ${srcdir}/autodeps/${host_os_major}.req for automatic requires generation"
942 ln -s ${srcdir}/autodeps/${host_os_major}.req ./find-requires
943 elif test -f ${srcdir}/autodeps/${host_os_noversion}.req ; then
944 echo "using ${srcdir}/autodeps/${host_os_noversion}.req for automatic requires generation"
945 ln -s ${srcdir}/autodeps/${host_os_noversion}.req ./find-requires
947 echo "*** no default requires information is available for ${host_os_noversion}"
948 ln -s ${srcdir}/autodeps/none ./find-requires
951 dnl Determine the canonical arch-vendor-os for the host machine
952 case "${host_cpu}" in
953 *86) RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
954 ia32e*) RPMCANONCOLOR=3; RPMCANONARCH=ia32e ;;
955 amd64*) RPMCANONCOLOR=3; RPMCANONARCH=amd64 ;;
956 x86_64*) RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
957 alpha*) RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
958 sparc64*) RPMCANONCOLOR=3; RPMCANONARCH=sparc64 ;;
959 sparc*) RPMCANONCOLOR=3; RPMCANONARCH=sparc ;;
960 ia64*) RPMCANONCOLOR=2; RPMCANONARCH=ia64 ;;
961 s390x*) RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
962 s390*) RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
963 powerpc64*|ppc64*) RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
964 powerpc*|ppc*) RPMCANONCOLOR=0; RPMCANONARCH=ppc ;;
965 arm*) RPMCANONCOLOR=0; RPMCANONARCH=arm ;;
966 mipsel*) RPMCANONCOLOR=0; RPMCANONARCH=mipsel ;;
967 mips*) RPMCANONCOLOR=0; RPMCANONARCH=mips ;;
968 m68k*) RPMCANONCOLOR=0; RPMCANONARCH=m68k ;;
969 sh3*) RPMCANONCOLOR=0; RPMCANONARCH=sh3 ;;
970 sh4*) RPMCANONCOLOR=0; RPMCANONARCH=sh4 ;;
971 *) RPMCANONCOLOR=0; RPMCANONARCH=unknown ;;
973 case "${host_os_noversion}" in
974 mint) RPMCANONARCH=m68kmint ;;
976 RPMCANONVENDOR="$build_vendor"
977 case "${build_vendor}" in
978 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog|caos|suse)
979 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
980 test -f /etc/SuSE-release && RPMCANONVENDOR=suse
981 test -f /etc/pld-release && RPMCANONVENDOR=pld
982 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
983 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
984 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
985 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
986 test -f /etc/caos-release && RPMCANONVENDOR=caos
989 RPMCANONOS="$host_os_noversion"
990 RPMCANONGNU="$host_os_gnu"
991 AC_SUBST(RPMCANONCOLOR)
992 AC_SUBST(RPMCANONARCH)
993 AC_SUBST(RPMCANONVENDOR)
995 AC_SUBST(RPMCANONGNU)
996 AC_DEFINE_UNQUOTED([RPMCANONVENDOR],["${RPMCANONVENDOR}"],[canonical vendor])
998 if test X"$prefix" = XNONE ; then
999 usrprefix="$ac_default_prefix"
1004 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1005 AC_SUBST(RPMCONFIGDIR)
1009 if test "$with_external_db" = no; then
1010 AC_CONFIG_SUBDIRS(db3)
1013 AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no])
1014 AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no])
1015 AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes])
1017 AC_PATH_PROG(AUTOM4TE,autom4te,:)
1019 AS_IF([test "$ac_cv_header_stdint_h" = "yes"],[
1020 AC_DEFINE([__RPM_USES_STDINT_H__],[1],[if rpm uses stdint.h])
1023 AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp])
1025 AC_CONFIG_FILES([Makefile
1026 rpmio/Makefile lib/Makefile build/Makefile
1027 po/Makefile.in scripts/Makefile