1 dnl configure.in for RPM
3 dnl Don't add checks for things we can't work around, unless those checks
4 dnl failing causes the script to bomb out with a message. If we can't fix
9 AC_PREREQ(2.12) dnl Minimum Autoconf version required.
11 AM_INIT_AUTOMAKE(rpm, 4.2)
12 AM_CONFIG_HEADER(config.h)
14 dnl XXX AM_MAINTAINER_MODE
16 dnl Set of available languages.
17 ALL_LINGUAS="cs da de fi fr gl is ja ko no pl pt pt_BR ro ru sk sl sr sv tr"
20 ****************************************************************************
22 * *** WARNING WARNING WARNING *** *
24 * This is source code from the development branch of rpm-4.2. *
26 * If you want the "production" rpm-4.0.4 or rpm-4.1 code, then you should *
27 * either use an rpm-4.0.4 or rpm-4.1 src.rpm. Alternatively, if using a *
28 * CVS checkout, do the following: *
30 * cvs -d :pserver:anonymous@cvs.rpm.org:/cvs/devel login *
31 * (no password, just carriage return) *
32 * cvs -d :pserver:anonymous@cvs.rpm.org:/cvs/devel get rpm *
35 * Here's the rpm-4_1 branch: *
38 * Here's the rpm-4_0 branch: *
41 ****************************************************************************
45 dnl Checks for programs.
52 if test "$ac_cv_prog_gcc" = yes; then
53 CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -Wall"
58 AC_PROG_GCC_TRADITIONAL
61 dnl Does this platform require array notation to assign to a va_list?
62 dnl If cross-compiling, we assume va_list is "normal". If this breaks
63 dnl you, set ac_cv_valistisarray=true and maybe define HAVE_VA_LIST_AS_ARRAY
64 dnl also just to be sure.
65 AC_MSG_CHECKING(whether va_list assignments need array notation)
66 AC_CACHE_VAL(ac_cv_valistisarray,
67 [AC_TRY_RUN([#include <stdlib.h>
69 void foo(int i, ...) {
73 if (va_arg(ap2, int) != 123 || va_arg(ap1, int) != 123)
75 va_end(ap1); va_end(ap2);
77 int main() { foo(0, 123); return(0); }],
78 [ac_cv_valistisarray=false],
79 [ac_cv_valistisarray=true],
80 [ac_cv_valistisarray=false])])
82 if test "$ac_cv_valistisarray" = true ; then
83 AC_DEFINE(HAVE_VA_LIST_AS_ARRAY, 1,
84 [Define as 1 if your va_list type is an array])
94 export RPMUSER RPMUID RPMGROUP RPMGID
100 AC_PATH_PROG(CTAGS, ctags, /bin/true)
101 AC_PATH_PROG(CSCOPE, cscope, /bin/true)
104 dnl This now uses libtool. Put
105 dnl LDFLAGS_STATIC="-all"
106 dnl to attempt static executables using libtool. Otherwise
107 dnl LDFLAGS_STATIC=""
109 AC_MSG_CHECKING(flag used by libtool to link rpm)
110 if test X"$GCC" = Xyes ; then
112 *-*-solaris*) LDFLAGS_STATIC="-static";;
113 *-*-hpux*) LDFLAGS_STATIC="-static";;
114 *-*-sysv5uw*) LDFLAGS_STATUS="-static";; # Unixware has no shared libthread.
115 *-*-*) LDFLAGS_STATIC="-all-static";;
117 elif test X"$CC" = Xcc ; then
119 *-*-linux*) LDFLAGS_STATIC="-all-static";;
120 *-*-freebsd*) LDFLAGS_STATIC="-all-static";;
121 *-*-osf*) LDFLAGS_STATIC="";; # OSF5 has no shared pthreads libs
122 *-*-aix*) LDFLAGS_STATIC="-static";; # -Wl,-bnso doesn't seem to work...
123 *-*-hpux*) LDFLAGS_STATIC="-static";;
124 *-*-solaris*) LDFLAGS_STATIC="-static";;
125 *-*-irix*) LDFLAGS_STATIC="-static";; #should be -non_shared, but can't
126 # link because of crt1.o then.
127 *-*-ultrix*) LDFLAGS_STATIC="-all-static";; #ultrix doesn't have shared libs.
128 *-*-*) LDFLAGS_STATIC="-static"
131 Unable to guess what option to pass to $CC to generate a static
132 executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
133 the appropriate argument(s) if you want to build a static rpm executable.
139 # just link it dynamically
142 LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}" # libtool format
143 AC_MSG_RESULT($LDFLAGS_STATIC)
144 AC_SUBST(LDFLAGS_STATIC)
147 dnl look for POSIX chmod attributes
149 AC_MSG_CHECKING(POSIX chmod)
151 chmod 744 foo.chmodtest
152 chmod +X foo.chmodtest 2>/dev/null
153 a=`ls -l foo.chmodtest | awk '{print $1}'`
155 if test "$a" = "-rwxr-xr-x"; then
157 FIXPERMS=a+rX,g-w,o-w
159 AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
165 dnl see if we have a mkdir that supports `-p'.
167 AC_PATH_PROGS(MKDIR, mkdir, mkdir)
168 AC_MSG_CHECKING(if $MKDIR supports -p)
170 $MKDIR -p conftest/a 2>/dev/null
171 if test $? = 0 ; then
172 rmdir conftest/a 2>/dev/null
173 if test $? = 0 ; then
179 rmdir conftest 2>/dev/null
180 if test $? = 0 ; then
189 if test X"$MKDIR_P" = X0 ; then
191 MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
196 dnl substitute this into config.h, so the C source picks it up.
198 AC_DEFINE_UNQUOTED(MKDIR_P, "${MKDIR_P}",
199 [A full path to a program, possibly with arguments, that will create a
200 directory and all necessary parent directories, ala `mkdir -p'])
205 dnl This test must precede tests of compiler characteristics like
206 dnl that for the inline keyword, since it may change the degree to
207 dnl which the compiler supports such features.
214 dnl AM_DISABLE_SHARED
217 AC_CHECK_TOOL(AR, ar, :)
220 dnl use defaults if cross-compiling, otherwise use the default path.
222 if test "$cross_compiling" = "yes"; then
225 # MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/sbin:/usr/sbin:/usr/local/sbin:/opt/gnu/bin"
230 dnl Find some common programs
232 AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
233 AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
234 AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
235 AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
236 AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
237 AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
238 AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
239 AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH)
240 AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH)
241 AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH)
242 AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
243 AC_PATH_PROG(UNZIPBIN, unzip, /usr/bin/unzip, $MYPATH)
245 AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
246 AC_MSG_CHECKING(checking whether id supports -u)
247 if ${__ID} -u 2>&1 > /dev/null ; then
251 dnl XXX Watchout for square brackets fed to m4.
252 __ID_U="%{__id} | %{__sed} 's/[[^=]]*=\\\\([[0-9]][[0-9]]*\\\\).*$/\\\\1/'"
257 AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH)
258 AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
259 AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
260 AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
261 AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
262 AC_MSG_CHECKING(old version of patch)
263 PATCHVERSION=`patch --version 2>&1`
265 if test "$PATCHVERSION" = "Patch version 2.1"; then
266 AC_DEFINE(HAVE_OLDPATCH_21, 1,
267 [Define if the patch call you'll be using is 2.1 or older])
268 AC_MSG_RESULT(patch older then 2.2 found)
270 AC_MSG_RESULT(patch later then 2.2 found)
273 AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH)
274 AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
275 AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH)
276 AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
277 AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH)
278 AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH)
279 AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH)
280 AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
282 AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH)
283 AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH)
284 AC_PATH_PROG(__OBJCOPY, objcopy, /usr/bin/objcopy, $MYPATH)
285 AC_PATH_PROG(__OBJDUMP, objdump, /usr/bin/objdump, $MYPATH)
286 AC_PATH_PROG(__STRIP, strip, /usr/bin/strip, $MYPATH)
292 *-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
293 *) LIBS="$LIBS -L$l $*";;
300 if test -d zlib ; then
301 WITH_ZLIB_SUBDIR=zlib
302 addlib \${top_builddir}/zlib
303 WITH_ZLIB_INCLUDE="-I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
304 INCPATH="$INCPATH -I\${top_srcdir}/${WITH_ZLIB_SUBDIR}"
305 WITH_ZLIB_LIB="\${top_builddir}/${WITH_ZLIB_SUBDIR}/libz.la"
306 AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])
308 AC_SUBST(WITH_ZLIB_SUBDIR)
309 AC_SUBST(WITH_ZLIB_INCLUDE)
310 AC_SUBST(WITH_ZLIB_LIB)
315 if test "$cross_compiling" != "yes"; then
316 dirs="$dirs /usr/local"
321 NONE|/usr) continue;;
323 if test X$localdone != X ; then continue; fi
328 AC_MSG_CHECKING(for $dir/lib in LIBS)
329 if test -d $dir/lib 2> /dev/null ; then
336 AC_MSG_CHECKING(for $dir/include in INCPATH)
337 if test -d $dir/include 2>/dev/null ; then
338 if [ "$dir" != "/usr/local" ] ; then
339 INCPATH="$INCPATH -I$dir/include"
347 AC_MSG_CHECKING(for /usr/ucblib in LIBS)
348 if test -d /usr/ucblib ; then
349 if test "$build" = "mips-sni-sysv4" ; then
350 addlib /usr/ccs/lib -lc
361 dnl Check for features
364 dnl Checks for libraries.
366 WITH_ELFUTILS_SUBDIR=
369 AC_CHECK_HEADER([libelf.h])
370 AC_CHECK_HEADER([gelf.h], [
371 AC_CHECK_LIB(elf, gelf_getvernaux, [
372 WITH_LIBELF_LIB="/usr/lib/libelf.a"
375 if test -d elfutils/libelf ; then
376 AC_DEFINE(HAVE_GELF_H, 1, [Define to 1 if you have the <gelf.h> header file.])
377 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the `elf' library (-lelf).])
378 WITH_ELFUTILS_SUBDIR=elfutils
379 WITH_LIBELF_INCLUDE="-I\${top_srcdir}/${WITH_ELFUTILS_SUBDIR}/libelf"
380 WITH_LIBELF_LIB="\${top_builddir}/${WITH_ELFUTILS_SUBDIR}/libelf/libelf.a"
383 AC_SUBST(WITH_ELFUTILS_SUBDIR)
384 AC_SUBST(WITH_LIBELF_INCLUDE)
385 AC_SUBST(WITH_LIBELF_LIB)
387 WITH_LIBDWARF_INCLUDE=
388 AC_CHECK_HEADER([dwarf.h], [], [
389 if test -d elfutils/libdwarf ; then
390 AC_DEFINE(HAVE_DWARF_H, 1, [Define to 1 if you have the <dwarf.h> header file.])
391 AC_DEFINE(HAVE_LIBDWARF, 1, [Define to 1 if you have the `dwarf' library (-ldwarf).])
392 WITH_LIBDWARF_INCLUDE="-I\${top_srcdir}/${WITH_ELFUTILS_SUBDIR}/libdwarf"
395 AC_SUBST(WITH_LIBDWARF_INCLUDE)
397 AC_CHECK_FUNC(setreuid, [], [
398 AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
401 AC_CHECK_FUNC(rand, [], [
402 AC_CHECK_LIB(rand, rand, [])
405 AC_CHECK_FUNC(getdomainname, [], [
406 AC_CHECK_LIB(nsl, getdomainname)
408 AC_CHECK_FUNC(socket, [], [
409 AC_CHECK_LIB(socket, socket)
412 AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h)
414 AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [
415 dnl OSF 5.0 has the the symbols prefixed with __ in libpthread.
416 AC_CHECK_LIB(pthread, __pthread_mutex_trylock, [], [
417 AC_CHECK_LIB(thread, mutex_lock)
421 AC_CHECK_HEADERS(aio.h)
422 AC_SEARCH_LIBS(aio_read, [c rt aio posix4])
424 dnl Better not use fchmod at all.
425 AC_CHECK_FUNC(fchmod)
427 AC_CHECK_FUNCS(vsnprintf snprintf)
429 dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
430 dnl not in the libc but in libport (for political reasons). This check
431 dnl can hopefully be removed soon. Please use the default action
432 dnl for this macro (not LIBS=...), otherwise the check for dbopen
434 AC_CHECK_LIB(port, writev)
443 dnl Detect whether internal Berkeley DB should be built.
446 AC_ARG_WITH(db, [ --without-db do not use internal Berkeley db])
448 if test $withval = no ; then
449 dnl ------------------ without internal db
451 AC_CHECK_HEADERS(db3/db.h)
453 dnl Check for Berkeley db3 API.
454 AC_CHECK_FUNC(db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"],
455 AC_CHECK_LIB(db-3.2, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.2"],
456 AC_CHECK_LIB(db-3.1, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.1"],
457 AC_CHECK_LIB(db-3.0, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.0"],
458 AC_CHECK_LIB(db, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb"],
465 if test X"$DBLIBSRCS" = X; then
466 AC_MSG_ERROR([sorry rpm requires libdb-3.x.a (from the Berkeley db package)])
469 if test -n "$libdb3" -a -n "$libthread" ; then
470 AC_MSG_CHECKING(whether $libdb3 needs $libthread)
473 AC_TRY_LINK_FUNC(db_create, AC_MSG_RESULT(no),
474 [libdb3="$libdb3 $libthread"; AC_MSG_RESULT(yes)])
479 dnl ------------------ with internal db
480 AC_DEFINE(HAVE_DB3_DB_H, 1, [Define if you have the <db3/db.h> header file])
484 libdb3="# \$(top_builddir)/db3/libdb.la"
485 libdb3a="\$(top_builddir)/db3/libdb.a"
486 dnl INCPATH="-I\$(top_builddir)/$(WITH_DB_SUBDIR) $INCPATH"
489 AC_SUBST(WITH_DB_SUBDIR)
490 AC_SUBST(WITH_INTERNAL_DB)
492 DBLIBSRCS="$DBLIBSRCS"
493 DBLIBOBJS=`echo $DBLIBSRCS | sed -e "s/\.c/\.lo/g"`
500 for dbi in $DBLIBSRCS; do
502 db3.c) AC_DEFINE(USE_DB3, 1, [Use the Berkeley db3 API?]) ;;
503 db1.c) AC_DEFINE(USE_DB1, 1, [Use the Berkeley db1 retrofit to db3 API?]) ;;
507 dnl AmigaOS and IXEmul have a fork() dummy
510 echo "Building for AmigaOS: using vfork() instead of fork()";
511 CFLAGS="$CFLAGS -Dfork=vfork"
515 if test -z "${WITH_ZLIB_LIB}" ; then
516 for zlib in z gz ; do
517 AC_CHECK_LIB(${zlib}, gzread,
518 [LIBS="$LIBS -l${zlib}"; break],
519 [if test ${zlib} = gz; then
520 AC_MSG_ERROR([sorry rpm requires libz.a or libgz.a (from the zlib package)])
525 dnl zlib-1.0.4 has not gzseek
526 AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
529 AC_CHECK_LIB(bz2, bzread, [LIBS="$LIBS -lbz2"],
530 AC_CHECK_LIB(bz2, BZ2_bzread, [
533 AC_DEFINE(HAVE_BZ2_1_0, 1, [Define as 1 if you bzip2 1.0]) ],
539 dnl horrible *temporary* hack to make sure that if we found gettext() in
540 dnl -lintl that we add -lintl *back* to $LIBS.
542 if test X$gt_cv_func_gettext_libintl = Xyes ; then
546 dnl Checks for header files we can live without.
552 AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
554 AC_CHECK_HEADERS(sys/ipc.h sys/socket.h sys/select.h)
555 AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
556 AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
558 AC_CHECK_HEADERS(netinet/in_systm.h)
559 AC_CHECK_HEADERS(machine/types.h)
560 AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
561 AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/param.h sys/vmount.h)
562 AC_CHECK_HEADERS(bzlib.h libio.h zlib.h)
563 AC_CHECK_HEADERS(err.h mcheck.h)
564 AC_CHECK_HEADERS(pthread.h)
566 dnl popt w float/double needs.
567 AC_CHECK_HEADERS(float.h)
569 AC_CHECK_HEADERS(glob.h)
571 dnl statfs portability fiddles.
573 dnl We should really emulate/steal sections of the statfs and struct statfs
574 dnl checks from GNU fileutils.
576 AC_MSG_CHECKING(for struct statfs)
578 dnl this is easier than nesting AC_TRY_COMPILEs...
580 found_struct_statfs=no
582 if test X$found_struct_statfs = Xno ; then
583 dnl Solaris 2.6+ wants to use statvfs
585 #ifdef HAVE_SYS_TYPES_H
586 #include <sys/types.h>
588 #include <sys/statvfs.h> ],
589 [struct statvfs sfs;],
590 [AC_MSG_RESULT(in sys/statvfs.h)
591 AC_DEFINE(STATFS_IN_SYS_STATVFS, 1,
592 [statfs in <sys/statvfs.h> (for solaris 2.6+ systems)])
593 found_struct_statfs=yes],
597 if test X$found_struct_statfs = Xno ; then
598 dnl first try including sys/vfs.h
600 #ifdef HAVE_SYS_TYPES_H
601 #include <sys/types.h>
603 #include <sys/vfs.h> ],
604 [struct statfs sfs;],
605 [AC_MSG_RESULT(in sys/vfs.h)
606 AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in <sys/vfs.h> (for linux systems)])
607 found_struct_statfs=yes],
611 if test X$found_struct_statfs = Xno ; then
612 dnl ...next try including sys/mount.h
614 #ifdef HAVE_SYS_TYPES_H
615 #include <sys/types.h>
617 #ifdef HAVE_SYS_PARAM_H
618 #include <sys/param.h>
620 #include <sys/mount.h> ],
621 [struct statfs sfs;],
622 [AC_MSG_RESULT(in sys/mount.h)
623 AC_DEFINE(STATFS_IN_SYS_MOUNT, 1, [statfs in <sys/mount.h> (for Digital Unix 4.0D systems)])
624 found_struct_statfs=yes],
628 if test X$found_struct_statfs = Xno ; then
629 dnl ...still no joy. Try sys/statfs.h
631 #ifdef HAVE_SYS_TYPES_H
632 #include <sys/types.h>
634 #include <sys/statfs.h> ],
635 [struct statfs sfs;],
636 [AC_MSG_RESULT(in sys/statfs.h)
637 AC_DEFINE(STATFS_IN_SYS_STATFS, 1, [statfs in <sys/statfs.h> (for Irix 6.4 systems)])
638 found_struct_statfs=yes],
642 if test X$found_struct_statfs = Xno ; then
643 dnl ...no luck. Warn the user of impending doom.
644 AC_MSG_WARN(not found)
648 dnl if we found the struct, see if it has the f_bavail member. Some OSes
649 dnl don't, including IRIX 6.5+
651 if test X$found_struct_statfs = Xyes ; then
652 AC_MSG_CHECKING(for f_bavail member in struct statfs)
654 #ifdef HAVE_SYS_TYPES_H
655 #include <sys/types.h>
657 #if STATFS_IN_SYS_STATVFS
658 # include <sys/statvfs.h>
659 typedef struct statvfs STATFS_t;
661 typedef struct statfs STATFS_t;
662 # if STATFS_IN_SYS_VFS
663 # include <sys/vfs.h>
664 # elif STATFS_IN_SYS_MOUNT
665 # include <sys/mouht.h>
666 # elif STATFS_IN_SYS_STATFS
667 # include <sys/statfs.h>
673 AC_DEFINE(STATFS_HAS_F_BAVAIL, 1, [Define if struct statfs has the f_bavail member])],
678 if test X$found_struct_statfs = Xyes ; then
680 dnl now check to see if we have the 4-argument variant of statfs()
681 dnl this pretty much requires AC_TRY_RUN
683 AC_MSG_CHECKING([if statfs() requires 4 arguments])
685 #ifdef HAVE_SYS_TYPES_H
686 #include <sys/types.h>
688 #ifdef STATFS_IN_SYS_VFS
690 #elif STATFS_IN_SYS_MOUNT
691 #include <sys/mouht.h>
692 #elif STATFS_IN_SYS_STATFS
693 #include <sys/statfs.h>
697 exit (statfs(".", &sfs, sizeof(sfs), 0));
701 AC_DEFINE(STAT_STATFS4, 1, [Define if the statfs() call takes 4 arguments])],
709 dnl look for libc features
711 AC_MSG_CHECKING(if <netdb.h> defines h_errno)
712 AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
713 AC_MSG_RESULT($PROVIDES_ERRNO)
714 if test $PROVIDES_ERRNO = yes; then
715 AC_DEFINE(HAVE_HERRNO, 1, [ Define as 1 if <netdb.h> defines h_errno])
718 dnl If a system doesn't have S_IFSOCK, define it as 0 which will
719 dnl make S_ISSOCK always return false (nice, eh?)
720 AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
721 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
722 HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
723 AC_MSG_RESULT($HAS_S_IFSOCK)
724 if test $HAS_S_IFSOCK = yes; then
725 AC_DEFINE(HAVE_S_IFSOCK, 1, [Define as 1 if <sys/stat.h> defines S_IFSOCK])
728 dnl Some Unix's are missing S_ISLNK, S_ISSOCK
729 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
730 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
731 HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
732 AC_MSG_RESULT($HAS_S_ISLNK)
733 if test $HAS_S_ISLNK = yes; then
734 AC_DEFINE(HAVE_S_ISLNK, 1, [Define as 1 if <sys/stat.h> defines S_ISLNK])
737 AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
738 AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
739 HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
740 AC_MSG_RESULT($HAS_S_ISSOCK)
741 if test $HAS_S_ISSOCK = yes; then
742 AC_DEFINE(HAVE_S_ISSOCK, 1, [Define as 1 if <sys/stat.h> defines S_ISSOCK])
745 AC_MSG_CHECKING(if timezone is defined)
746 AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
747 HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
748 AC_MSG_RESULT($HAS_TIMEZONE)
750 dnl Check for missing typedefs
754 dnl Checks for library functions.
758 dnl XXX AC_FUNC_MEMCMP
760 dnl XXX AC_TYPE_SIGNAL
761 dnl XXX AC_FUNC_STRCOLL
762 dnl XXX AC_FUNC_STRFTIME
763 dnl XXX AC_FUNC_UTIME_NULL
764 dnl XXX AC_FUNC_VFORK
765 dnl XXX AC_CHECK_FUNCS(gethostname mkdir mkfifo rmdir select uname)
767 AC_CHECK_FUNCS(basename getcwd getwd inet_aton mtrace putenv realpath setenv)
768 AC_CHECK_FUNCS(stpcpy stpncpy strcspn)
769 AC_CHECK_FUNCS(strdup strerror strtol strtoul strspn strstr)
771 AC_CHECK_FUNCS(regcomp)
776 dnl XXX Regex replacement isn't known to be needed yet.
778 dnl AC_ARG_WITH(regex, [ --with-regex use the GNU regex library ],
779 dnl [rpm_cv_regex=yes],
780 dnl [AC_CHECK_FUNCS(regcomp, rpm_cv_regex=no, rpm_cv_regex=yes)])
782 dnl if test $rpm_cv_regex = no ; then
783 dnl AC_MSG_CHECKING(whether the regexp library is broken)
785 dnl #include <unistd.h>
786 dnl #include <regex.h>
787 dnl main() { regex_t blah ; exit(regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0)); }],
788 dnl rpm_cv_regex_broken=no, rpm_cv_regex_broken=yes, rpm_cv_regex_broken=yes)
789 dnl AC_MSG_RESULT([$rpm_cv_regex_broken])
790 dnl if test $rpm_cv_regex_broken = yes ; then
791 dnl echo " --> using the included GNU regex instead." >&AC_FD_MSG
796 dnl if test $rpm_cv_regex = yes; then
797 dnl AC_DEFINE(USE_GNU_REGEX, 1)
802 dnl XXX Glob *is* broken on linux with libc5, solaris and possibly aix when
803 dnl %files gets something like
804 dnl /usr/*/locale/*/LC_MESSAGES/*.mo
805 dnl (Note: more than one asterisk in glob pattern.)
807 AC_ARG_WITH(glob, [ --with-glob use the internal GNU glob ],
809 [AC_CHECK_FUNCS(glob, rpm_cv_glob=no, rpm_cv_glob=yes)])
811 if test $rpm_cv_glob = no ; then
812 AC_CACHE_CHECK([for GNU extensions to glob], rpm_cv_glob_ext, [
819 #include <sys/stat.h>
824 exit(glob("t/*/*.8", GLOB_PERIOD, NULL, &gl) || gl.gl_pathc < 1);
826 rpm_cv_glob_ext=yes, rpm_cv_glob_ext=no, rpm_cv_glob_ext=no)
829 if test "$rpm_cv_glob_ext" = no ; then
830 echo " --> using the included GNU glob instead." >&AC_FD_MSG
835 if test "$rpm_cv_glob" = yes; then
836 AC_DEFINE(USE_GNU_GLOB, 1, [Use the included glob.c?])
841 dnl Auto-detect which python bindings should be built.
844 AC_ARG_WITH(python, [ --with-python build rpm python bindings ])
846 WITH_PYTHON_VERSION=$withval
847 if test $withval = auto ; then
849 AC_MSG_CHECKING(for python 2.2)
851 #include <python2.2/Python.h>
853 exit(strncmp("2.2", PY_VERSION, 3));
855 withval=yes, withval=no, withval=yes)
856 AC_MSG_RESULT($withval)
857 if test $withval = yes ; then
858 WITH_PYTHON_VERSION="2.2"
861 AC_MSG_CHECKING(for python 1.5.2)
863 #include <python1.5/Python.h>
865 exit(strcmp("1.5.2", PY_VERSION));
867 withval=yes, withval=no, withval=yes)
868 AC_MSG_RESULT($withval)
869 if test $withval = yes ; then
870 WITH_PYTHON_VERSION="1.5"
876 if test "$WITH_PYTHON_VERSION" != no ; then
877 WITH_PYTHON_SUBDIR=python
878 WITH_PYTHON_SUBPACKAGE=1
881 WITH_PYTHON_SUBPACKAGE=0
883 AC_SUBST(WITH_PYTHON_SUBDIR)
884 AC_SUBST(WITH_PYTHON_SUBPACKAGE)
885 AC_SUBST(WITH_PYTHON_VERSION)
887 AC_PATH_PROG(__DOXYGEN, doxygen, no, $PATH)
889 dnl Auto-detect whether doxygen generated API docs should be included.
892 AC_ARG_WITH(apidocs, [ --with-apidocs build rpm API docs ])
894 if test $withval = auto -a $__DOXYGEN != no ; then
896 elif test $withval = yes -a $__DOXYGEN = no ; then
897 AC_MSG_ERROR(--> rpm API docs needs doxygen in PATH)
900 if test $withval = yes; then
901 WITH_APIDOCS_TARGET=apidocs
906 AC_SUBST(WITH_APIDOCS_TARGET)
907 AC_SUBST(WITH_APIDOCS)
910 AC_ARG_WITH(dmalloc, [ --with-dmalloc build with dmalloc debugging support ])
911 if test $withval = yes ; then
912 AC_DEFINE(DMALLOC, 1, [Build with dmalloc support?])
913 LIBS="$LIBS -ldmalloc"
917 AC_ARG_WITH(efence, [ --with-efence build with efence debugging support ])
918 if test $withval = yes ; then
919 AC_DEFINE(EFENCE, 1, [Build with libefence support?])
920 LIBS="$LIBS -lefence"
923 AC_CHECK_FUNCS(setlocale)
925 dnl XXX Solaris <= 2.6 only permits 8 chars in password.
926 AC_CHECK_FUNCS(getpassphrase)
928 AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT, 1, [Define if you have the getmntent() function]), [
929 AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL, 1, [Define as 1 if you have mntctl() (only aix?)]),[
930 AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)]), [
931 AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
932 AC_DEFINE(HAVE_GETMNTINFO_R, 1, [Define as 1 if you have getmntinfo_r() (only osf?)])], [
933 AC_DEFINE([USE_GETMNTENT], 1, [Defined if getmntent replacement is used])
934 AC_LIBOBJ(getmntent)])])])])
936 AC_CHECK_FUNC(lchown,
937 [__CHOWN_RHF="%{__chown} -Rhf"
938 __CHGRP_RHF="%{__chgrp} -Rhf"
939 AC_DEFINE(HAVE_LCHOWN, 1, [Define as 1 if you have lchown()])],
940 [__CHOWN_RHF="%{__chown} -Rf"
941 __CHGRP_RHF="%{__chgrp} -Rf"
942 dnl Does chown() follow symlinks? This should be a good enough test.
943 AC_MSG_CHECKING(whether chown() follows symlinks)
944 AC_ARG_ENABLE([broken-chown],
945 [ --enable-broken-chown this system's chown follows symbolic links],
946 result=$enableval, result=unknown)
947 if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
949 elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
952 if test $result = unknown; then
953 if test `${__ID} | cut -f2 -d\= | cut -f1 -d\(` = 0; then
958 if test `ls -l foo | awk '{print $3}'` != "root"; then
965 AC_MSG_CHECKING((cannot check by non-root user))
970 AC_MSG_RESULT($result)
971 if test $result = yes; then
972 AC_DEFINE(CHOWN_FOLLOWS_SYMLINK, 1, [Define as 1 if chown() follows symlinks and you don't have lchown()])
974 AC_SUBST(__CHOWN_RHF)
975 AC_SUBST(__CHGRP_RHF)
978 dnl figure out what root's primary group is
980 AC_MSG_CHECKING(root's primary group)
981 AC_TRY_RUN([#include <stdio.h>
982 #include <sys/types.h>
988 struct passwd *root = NULL;
989 struct group *roots_group = NULL;
990 FILE * tempfile = NULL;
992 root = getpwuid( (uid_t) 0 );
994 roots_group = getgrgid(root->pw_gid);
995 if (roots_group != NULL) {
996 tempfile = fopen("conftest_rootg", "w");
997 if (tempfile != NULL) {
998 fprintf(tempfile, "%s\n", roots_group->gr_name);
1006 }], ROOT_GROUP=`cat conftest_rootg`,
1007 ROOT_GROUP="root",ROOT_GROUP="root"
1009 AC_MSG_RESULT($ROOT_GROUP)
1010 AC_SUBST(ROOT_GROUP)
1012 if test "x$varprefix" = "x"; then
1013 # For /usr and /usr/local, we want the 'var' directory to go
1014 # in /var and /var/local respectively. For everything else,
1015 # just put the 'var' directory in prefix/var.
1018 varprefix=`echo $prefix | sed 's/usr/var/'` ;;
1020 varprefix=`echo $ac_default_prefix | sed 's/usr/var/'` ;;
1022 varprefix=$prefix/var ;;
1027 if test "x$tmpdir" = "x"; then
1028 if test -d $varprefix/tmp; then
1029 tmpdir=$varprefix/tmp
1031 if test -d /var/tmp; then
1040 if echo "$build_os" | grep sco > /dev/null; then
1041 echo "hacking things up for sco"
1042 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
1043 AC_DEFINE(HAVE_STRUCT_MNTTAB, 1,
1044 [Define as 1 if you have "struct mnttab" (only sco?)])
1045 elif echo "$build_os" | grep sunos > /dev/null; then
1046 echo "hacking things up for sunos"
1047 CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
1048 AC_DEFINE(NEED_STRINGS_H, 1, [Define as one if we need to include <strings.h> (along with <string.h>)])
1049 AC_DEFINE(NEED_MYREALLOC, 1, [Define as 1 if we need myrealloc])
1050 AC_LIBOBJ(myrealloc)
1054 # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
1056 if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
1057 build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
1059 if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
1060 build_os=`echo "${build_os}" | sed 's/-gnu$//'`
1064 build_os_exact="${build_os}"
1065 build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
1066 build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
1069 rm -f ./find-provides
1070 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
1071 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
1072 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
1073 elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
1074 echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
1075 ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
1076 elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
1077 echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
1078 ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
1079 elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
1080 echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
1081 ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
1083 echo "*** no default provides information is available for ${build_os_noversion}"
1084 ln -s ${srcdir}/autodeps/none ./find-provides
1087 rm -f ./find-requires
1088 if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
1089 echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
1090 ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
1091 elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
1092 echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
1093 ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
1094 elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
1095 echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
1096 ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
1097 elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
1098 echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
1099 ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
1101 echo "*** no default requires information is available for ${build_os_noversion}"
1102 ln -s ${srcdir}/autodeps/none ./find-requires
1105 dnl Determine the canonical arch-vendor-os for the build machine
1106 case "${build_cpu}" in
1107 *86) RPMCANONARCH=i386 ;;
1108 x86_64*) RPMCANONARCH=x86_64 ;;
1109 alpha*) RPMCANONARCH=alpha ;;
1110 sparc*) RPMCANONARCH=sparc ;;
1111 ia64*) RPMCANONARCH=ia64 ;;
1112 s390*) RPMCANONARCH=s390 ;;
1113 powerpc*) RPMCANONARCH=ppc ;;
1114 armv3l*) RPMCANONARCH=armv3l ;;
1115 armv4l*) RPMCANONARCH=armv4l ;;
1116 armv4b*) RPMCANONARCH=armv4b ;;
1117 arm*) RPMCANONARCH="${build_cpu}" ;;
1118 mipsel*) RPMCANONARCH=mipsel ;;
1119 mips*) RPMCANONARCH=mips ;;
1120 m68k*) RPMCANONARCH=m68k ;;
1121 *) RPMCANONARCH=unknown ;;
1123 case "${build_os_noversion}" in
1124 mint) RPMCANONARCH=m68kmint ;;
1126 RPMCANONVENDOR="$build_vendor"
1127 case "${build_vendor}" in
1128 unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog)
1129 test -f /etc/redhat-release && RPMCANONVENDOR=redhat
1130 test -f /etc/pld-release && RPMCANONVENDOR=pld
1131 test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake
1132 test -f /etc/conectiva-release && RPMCANONVENDOR=conectiva
1133 test -f /etc/lvr-release && RPMCANONVENDOR=lvr
1134 test -f /etc/yellowdog-release && RPMCANONVENDOR=yellowdog
1137 RPMCANONOS="$build_os_noversion"
1138 AC_SUBST(RPMCANONARCH)
1139 AC_SUBST(RPMCANONVENDOR)
1140 AC_SUBST(RPMCANONOS)
1142 if test X"$prefix" = XNONE ; then
1143 usrprefix="$ac_default_prefix"
1147 LOCALEDIR="`echo ${usrprefix}/share/locale`"
1148 AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR",
1149 [Full path to rpm locale directory (usually /usr/share/locale)])
1151 LIBDIR="`echo $libdir | sed 's-/lib$-/%{_lib}-'`"
1153 RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
1154 AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR",
1155 [Full path to rpm global configuration directory (usually /usr/lib/rpm)])
1156 AC_SUBST(RPMCONFIGDIR)
1158 SYSCONFIGDIR="`echo /etc/rpm`"
1159 AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR",
1160 [Full path to rpm system configuration directory (usually /etc/rpm)])
1161 AC_SUBST(SYSCONFIGDIR)
1163 MACROFILES="${RPMCONFIGDIR}/macros:${RPMCONFIGDIR}/%{_target_platform}/macros:${SYSCONFIGDIR}/macros:${SYSCONFIGDIR}/macros.specspo:${SYSCONFIGDIR}/macros.db1:${SYSCONFIGDIR}/%{_target_platform}/macros:~/.rpmmacros"
1164 AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES",
1165 [Colon separated paths of macro files to read.])
1166 AC_SUBST(MACROFILES)
1168 LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
1169 AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME",
1170 [Full path to rpmrc configuration file (usually /usr/lib/rpm/rpmrc)])
1171 AC_SUBST(LIBRPMRC_FILENAME)
1173 VENDORRPMRC_FILENAME="${RPMCONFIGDIR}/${RPMCANONVENDOR}/rpmrc"
1174 AC_DEFINE_UNQUOTED(VENDORRPMRC_FILENAME, "$VENDORRPMRC_FILENAME",
1175 [Full path to vendor rpmrc configuration file (usually /usr/lib/rpm/vendor/rpmrc)])
1176 AC_SUBST(VENDORRPMRC_FILENAME)
1178 LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt-${VERSION}"
1179 AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME",
1180 [Full path to rpmpopt configuration file (usually /usr/lib/rpm/rpmpopt)])
1181 AC_SUBST(LIBRPMALIAS_FILENAME)
1182 FINDREQUIRES="${RPMCONFIGDIR}/find-requires"
1183 AC_DEFINE_UNQUOTED(FINDREQUIRES, "$FINDREQUIRES",
1184 [Full path to find-requires script (usually /usr/lib/rpm/find-requires)])
1185 AC_SUBST(FINDREQUIRES)
1186 FINDPROVIDES="${RPMCONFIGDIR}/find-provides"
1187 AC_DEFINE_UNQUOTED(FINDPROVIDES, "$FINDPROVIDES",
1188 [Full path to find-provides script (usually /usr/lib/rpm/find-provides)])
1189 AC_SUBST(FINDPROVIDES)
1191 testdir="`pwd`/tests"
1192 dnl AC_DEFINE_UNQUOTED(testdir, "$testdir")
1202 dnl XXX this causes popt to depend on zlib et al
1203 dnl # XXX Propagate -lucb to popt ...
1204 dnl export LIBS INCPATH CONFIG_SITE
1206 AC_CONFIG_SUBDIRS(popt beecrypt zlib elfutils file db3)
1208 AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform rpmpopt rpm.spec
1209 rpmio/Makefile rpmdb/Makefile lib/Makefile build/Makefile
1210 scripts/Makefile scripts/brp-redhat
1211 scripts/macros.perl scripts/macros.php scripts/macros.python
1213 tests/Makefile tests/rpmrc tests/macros tests/hello-test/Makefile
1214 misc/Makefile intl/Makefile po/Makefile.in
1224 python/rpmdb/Makefile
1225 python/test/Makefile
1226 ], [ echo timestamp > popt/stamp-h.in
1227 echo timestamp > beecrypt/stamp-h.in
1228 echo timestamp > stamp-h.in