908 lines
25 KiB
Plaintext
908 lines
25 KiB
Plaintext
dnl configure.in for RPM
|
|
dnl
|
|
dnl Don't add checks for things we can't work around, unless those checks
|
|
dnl failing causes the script to bomb out with a message. If we can't fix
|
|
dnl it, why check it?
|
|
|
|
AC_INIT(rpm.c)
|
|
AC_CANONICAL_SYSTEM
|
|
|
|
AM_INIT_AUTOMAKE(rpm, 3.0.4)
|
|
AM_CONFIG_HEADER(config.h)
|
|
|
|
AC_PREREQ(2.12) dnl Minimum Autoconf version required.
|
|
|
|
dnl XXX AM_MAINTAINER_MODE
|
|
|
|
dnl Set of available languages.
|
|
ALL_LINGUAS="cs de fi fr pl pt_BR ru sk sr sv tr"
|
|
|
|
LIBOBJS=
|
|
|
|
dnl Checks for programs.
|
|
AC_ARG_PROGRAM
|
|
AC_PROG_CC
|
|
if test "$ac_cv_prog_gcc" = yes; then
|
|
CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts"
|
|
fi
|
|
|
|
AC_PROG_CPP
|
|
AC_PROG_GCC_TRADITIONAL
|
|
AC_PROG_INSTALL
|
|
|
|
dnl
|
|
dnl This now uses libtool. Put
|
|
dnl LDFLAGS_STATIC="-all"
|
|
dnl to attempt static executables using libtool. Otherwise
|
|
dnl LDFLAGS_STATIC=""
|
|
dnl
|
|
AC_MSG_CHECKING(flag used by libtool to link rpm)
|
|
if test X"$GCC" = Xyes ; then
|
|
case "$target" in
|
|
*-*-solaris*) LDFLAGS_STATIC="";;
|
|
*-*-hpux*) LDFLAGS_STATIC="";;
|
|
*-*-*) LDFLAGS_STATIC="-all";;
|
|
esac
|
|
elif test X"$CC" = Xcc ; then
|
|
case "$target" in
|
|
*-*-linux*) LDFLAGS_STATIC="-all";;
|
|
*-*-freebsd*) LDFLAGS_STATIC="-all";;
|
|
*-*-osf*) LDFLAGS_STATIC="-all";;
|
|
*-*-aix*) LDFLAGS_STATIC="";; # -Wl,-bnso doesn't seem to work...
|
|
*-*-hpux*) LDFLAGS_STATIC="";;
|
|
*-*-solaris*) LDFLAGS_STATIC="";;
|
|
*-*-irix*) LDFLAGS_STATIC="";; #should be -non_shared, but can't
|
|
# link because of crt1.o then.
|
|
*-*-ultrix*) LDFLAGS_STATIC="-all";; #ultrix doesn't have shared libs.
|
|
*-*-*) LDFLAGS_STATIC=""
|
|
AC_MSG_WARN([
|
|
|
|
Unable to guess what option to pass to $CC to generate a static
|
|
executable. You will need to set the LDFLAGS_STATIC macro in Makefile.inc to
|
|
the appropriate argument(s) if you want to build a static rpm executable.
|
|
|
|
])
|
|
;;
|
|
esac
|
|
else
|
|
# just link it dynamically
|
|
LDFLAGS_STATIC=""
|
|
fi
|
|
LDFLAGS_STATIC="${LDFLAGS} ${LDFLAGS_STATIC}-static" # libtool format
|
|
AC_MSG_RESULT($LDFLAGS_STATIC)
|
|
AC_SUBST(LDFLAGS_STATIC)
|
|
|
|
dnl
|
|
dnl look for POSIX chmod attributes
|
|
dnl
|
|
AC_MSG_CHECKING(POSIX chmod)
|
|
touch foo.chmodtest
|
|
chmod 744 foo.chmodtest
|
|
chmod +X foo.chmodtest 2>/dev/null
|
|
a=`ls -l foo.chmodtest | awk '{print $1}'`
|
|
rm -f foo.chmodtest
|
|
if test "$a" = "-rwxr-xr-x"; then
|
|
AC_MSG_RESULT(yes)
|
|
FIXPERMS=a+rX,g-w,o-w
|
|
else
|
|
AC_MSG_RESULT(no (tell your OS vendor about GNU fileutils))
|
|
FIXPERMS=a+r,g-w,o-w
|
|
fi
|
|
AC_SUBST(FIXPERMS)
|
|
|
|
dnl
|
|
dnl see if we have a mkdir that supports `-p'.
|
|
dnl
|
|
AC_PATH_PROGS(MKDIR, mkdir, mkdir)
|
|
AC_MSG_CHECKING(if $MKDIR supports -p)
|
|
rm -rf conftest
|
|
$MKDIR -p conftest/a 2>/dev/null
|
|
if test $? = 0 ; then
|
|
rmdir conftest/a 2>/dev/null
|
|
if test $? = 0 ; then
|
|
:
|
|
else
|
|
MKDIR_P=0
|
|
fi
|
|
|
|
rmdir conftest 2>/dev/null
|
|
if test $? = 0 ; then
|
|
MKDIR_P="$MKDIR -p"
|
|
else
|
|
MKDIR_P=0
|
|
fi
|
|
else
|
|
MKDIR_P=0
|
|
fi
|
|
|
|
if test X"$MKDIR_P" = X0 ; then
|
|
AC_MSG_RESULT(no)
|
|
MKDIR_P="`echo ${prefix}/lib/rpm/mkinstalldirs`"
|
|
else
|
|
AC_MSG_RESULT(yes)
|
|
fi
|
|
dnl
|
|
dnl substitute this into config.h, so the C source picks it up.
|
|
dnl
|
|
AC_DEFINE_UNQUOTED(MKDIR_P, "${MKDIR_P}")
|
|
AC_SUBST(MKDIR_P)
|
|
|
|
AC_AIX
|
|
AC_MINIX
|
|
AC_ISC_POSIX
|
|
|
|
dnl This test must precede tests of compiler characteristics like
|
|
dnl that for the inline keyword, since it may change the degree to
|
|
dnl which the compiler supports such features.
|
|
AM_C_PROTOTYPES
|
|
|
|
AC_PROG_AWK
|
|
AC_PROG_LN_S
|
|
AC_PROG_MAKE_SET
|
|
|
|
dnl AM_DISABLE_SHARED
|
|
AM_PROG_LIBTOOL
|
|
|
|
AC_CHECK_TOOL(AR, ar, :)
|
|
|
|
if test "$cross_compiling" != "yes"; then
|
|
dnl
|
|
dnl Set search path for common programs
|
|
dnl
|
|
MYPATH="/bin:/usr/bin:/usr/local/bin:$PATH:/opt/gnu/bin"
|
|
|
|
dnl
|
|
dnl Find some common programs
|
|
dnl
|
|
AC_PATH_PROG(BZIP2BIN, bzip2, /usr/bin/bzip2, $MYPATH)
|
|
|
|
AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH)
|
|
AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH)
|
|
AC_PATH_PROG(__CHMOD, chmod, /bin/chmod, $MYPATH)
|
|
AC_PATH_PROG(__CHOWN, chown, /bin/chown, $MYPATH)
|
|
AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH)
|
|
AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH)
|
|
|
|
AC_PATH_PROG(GZIPBIN, gzip, /bin/gzip, $MYPATH)
|
|
dnl Solaris prefers /usr/xpg4/bin/id
|
|
AC_PATH_PROG(__ID, id, /usr/bin/id, $MYPATH)
|
|
AC_PATH_PROG(__MAKE, make, /usr/bin/make, $MYPATH)
|
|
AC_PATH_PROG(__MKDIR, mkdir, /bin/mkdir, $MYPATH)
|
|
AC_PATH_PROG(__MV, mv, /bin/mv, $MYPATH)
|
|
|
|
AC_PATH_PROG(__PATCH, patch, /usr/bin/patch, $MYPATH)
|
|
AC_MSG_CHECKING(old version of patch)
|
|
PATCHVERSION=`patch --version 2>&1`
|
|
|
|
if test "$PATCHVERSION" = "Patch version 2.1"; then
|
|
AC_DEFINE(HAVE_OLDPATCH_21)
|
|
AC_MSG_RESULT(patch older then 2.2 found)
|
|
else
|
|
AC_MSG_RESULT(patch later then 2.2 found)
|
|
fi
|
|
|
|
AC_PATH_PROG(PGPBIN, pgp, /usr/bin/pgp, $MYPATH)
|
|
AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH)
|
|
AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH)
|
|
fi
|
|
|
|
addlib() {
|
|
l=$1
|
|
shift
|
|
case "$target" in
|
|
*-*-solaris*) LIBS="$LIBS -L$l -R$l $*";;
|
|
*) LIBS="$LIBS -L$l $*";;
|
|
esac
|
|
}
|
|
|
|
localdone=
|
|
for dir in $prefix /usr/local
|
|
do
|
|
case $dir in
|
|
NONE|/usr) continue;;
|
|
/usr/local)
|
|
if test X$localdone != X ; then continue; fi
|
|
localdone="$dir"
|
|
;;
|
|
esac
|
|
|
|
AC_MSG_CHECKING(for $dir/lib in LIBS)
|
|
if test -d $dir/lib ; then
|
|
addlib $dir/lib
|
|
AC_MSG_RESULT(yes)
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
fi
|
|
|
|
AC_MSG_CHECKING(for $dir/include in INCPATH)
|
|
if test -d $dir/include ; then
|
|
INCPATH="$INCPATH -I$dir/include"
|
|
AC_MSG_RESULT(yes)
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
fi
|
|
done
|
|
|
|
AC_MSG_CHECKING(for /usr/ucblib in LIBS)
|
|
if test -d /usr/ucblib ; then
|
|
if test "$build" = "mips-sni-sysv4" ; then
|
|
addlib /usr/ccs/lib -lc
|
|
fi
|
|
|
|
addlib /usr/ucblib
|
|
|
|
AC_MSG_RESULT(yes)
|
|
else
|
|
AC_MSG_RESULT(no)
|
|
fi
|
|
|
|
dnl
|
|
dnl Check for features
|
|
dnl
|
|
|
|
### use option --disable-v1-packages to turn off support for rpm-1.x packages
|
|
AC_MSG_CHECKING(if you want support for rpm-1.0 packages)
|
|
AC_ARG_ENABLE(v1-packages,
|
|
[ --disable-v1-packages[=no] disable support for rpm-1.x packages],
|
|
[with_v1_packages=$enableval],
|
|
[with_v1_packages=yes])
|
|
AC_MSG_RESULT($with_v1_packages)
|
|
test "$with_v1_packages" = yes && AC_DEFINE(ENABLE_V1_PACKAGES)
|
|
|
|
### use option --enable-v4-packages to turn on support for rpm-4.x packages
|
|
AC_MSG_CHECKING(if you want experimental rpm-4.0 packages)
|
|
AC_ARG_ENABLE(v4-packages,
|
|
[ --enable-v4-packages[=no] [experimental] support for rpm-4.x packages],
|
|
[with_v4_packages=$enableval],
|
|
[with_v4_packages=no])
|
|
AC_MSG_RESULT($with_v4_packages)
|
|
test "$with_v4_packages" = yes && AC_DEFINE(ENABLE_V4_PACKAGES)
|
|
|
|
dnl Checks for libraries.
|
|
|
|
AC_CHECK_FUNC(strcasecmp, [], [
|
|
AC_CHECK_LIB(ucb, strcasecmp, [LIBS="$LIBS -lc -lucb" USEUCB=y])
|
|
])
|
|
AC_CHECK_FUNC(setreuid, [], [
|
|
AC_CHECK_LIB(ucb, setreuid, [if echo $LIBS | grep -- -lucb >/dev/null ;then :; else LIBS="$LIBS -lc -lucb" USEUCB=y;fi])
|
|
])
|
|
|
|
AC_CHECK_FUNC(rand, [], [
|
|
AC_CHECK_LIB(rand, rand, [LIBS="$LIBS -lm"])
|
|
])
|
|
|
|
AC_CHECK_FUNC(getdomainname, [], [
|
|
AC_CHECK_LIB(nsl, getdomainname, [LIBS="$LIBS -lnsl"])
|
|
])
|
|
AC_CHECK_FUNC(socket, [], [
|
|
AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
|
|
])
|
|
|
|
dnl Better not use fchmod at all.
|
|
AC_CHECK_FUNC(fchmod)
|
|
|
|
|
|
dnl Temporary hack for MiNT. Some functions (writev, snprintf) are
|
|
dnl not in the libc but in libport (for political reasons). This check
|
|
dnl can hopefully be removed soon. Please use the default action
|
|
dnl for this macro (not LIBS=...), otherwise the check for dbopen
|
|
dnl will fail.
|
|
AC_CHECK_LIB(port, writev)
|
|
|
|
AC_CHECK_FUNC(dbopen, [],
|
|
AC_CHECK_LIB(db1, dbopen, [LIBS="$LIBS -ldb1"],
|
|
AC_CHECK_LIB(db, dbopen, [LIBS="$LIBS -ldb"],
|
|
AC_MSG_WARN([sorry this package needs libdb.a (from the db package)])))
|
|
)
|
|
|
|
AC_CHECK_FUNC(fork, [], [echo "using vfork() instead of fork()";
|
|
LIBOBJS=fakefork.o])
|
|
|
|
dnl AmigaOS and IXEmul have a fork() dummy
|
|
case "$target" in
|
|
m68k-*-amigaos )
|
|
echo "Building for AmigaOS: using vfork() instead of fork()";
|
|
CFLAGS="$CFLAGS -Dfork=vfork"
|
|
;;
|
|
esac
|
|
|
|
|
|
ZLIB=
|
|
for zlib in z gz ; do
|
|
AC_CHECK_LIB(${zlib}, gzread,
|
|
[LIBS="$LIBS -l${zlib}"; break],
|
|
[if test ${zlib} = gz; then
|
|
AC_MSG_WARN([sorry this package needs libz.a or libgz.a (from the zlib package)])
|
|
fi]
|
|
)
|
|
done
|
|
|
|
for bz2lib in bz2 ; do
|
|
AC_CHECK_LIB(${bz2lib}, bzread,
|
|
[LIBS="$LIBS -l${bz2lib}"; break],
|
|
[if test ${bz2lib} = bz2; then
|
|
AC_MSG_WARN([missing libbz2.a (from the bzip2 package)])
|
|
fi]
|
|
)
|
|
done
|
|
|
|
dnl XXX these are needed only by rpmgettext right now
|
|
AM_FUNC_ERROR_AT_LINE
|
|
|
|
dnl ==> AM_GNU_GETTEXT does this (and more)
|
|
dnl AC_CHECK_HEADERS(unistd.h limits.h locale.h malloc.h string.h sys/param.h)
|
|
|
|
AM_GNU_GETTEXT
|
|
dnl TVM:
|
|
dnl horrible *temporary* hack to make sure that if we found gettext() in
|
|
dnl -lintl that we add -lintl *back* to $LIBS.
|
|
dnl
|
|
if test X$gt_cv_func_gettext_libintl = Xyes ; then
|
|
LIBS="-lintl $LIBS"
|
|
fi
|
|
|
|
dnl Checks for header files we can live without.
|
|
AC_HEADER_STDC
|
|
AC_HEADER_MAJOR
|
|
AC_HEADER_DIRENT
|
|
AC_HEADER_TIME
|
|
|
|
AC_CHECK_HEADERS(db_185.h db1/db.h)
|
|
AC_CHECK_HEADERS(fcntl.h getopt.h grp.h memory.h netdb.h pwd.h utime.h)
|
|
|
|
AC_CHECK_HEADERS(sys/socket.h sys/select.h)
|
|
AC_CHECK_HEADERS(sys/types.h sys/stdtypes.h)
|
|
AC_CHECK_HEADERS(sys/mman.h sys/resource.h sys/utsname.h sys/wait.h)
|
|
|
|
AC_CHECK_HEADERS(netinet/in_systm.h)
|
|
AC_CHECK_HEADERS(machine/types.h)
|
|
AC_CHECK_HEADERS(mntent.h sys/mnttab.h sys/systemcfg.h)
|
|
AC_CHECK_HEADERS(sys/mount.h sys/mntctl.h sys/vmount.h)
|
|
AC_CHECK_HEADERS(bzlib.h libio.h zlib.h)
|
|
AC_CHECK_HEADERS(err.h mcheck.h)
|
|
|
|
dnl whether or not we should try build rpmconvert, which is used to convert
|
|
dnl rpm databases from rpm 1.x to rpm 2.x or later. It requires the gdbm
|
|
dnl library and header file.
|
|
BUILD_RPMCONVERT=yes
|
|
AC_CHECK_HEADERS(gdbm.h,BUILD_RPMCONVERT=yes,BUILD_RPMCONVERT=no)
|
|
AC_MSG_CHECKING(if rpmconvert should be built)
|
|
if test X"$BUILD_RPMCONVERT" = X"yes"; then
|
|
BUILD_RPMCONVERT=rpmconvert
|
|
AC_MSG_RESULT(yes)
|
|
else
|
|
BUILD_RPMCONVERT=
|
|
AC_MSG_RESULT(no)
|
|
fi
|
|
AC_SUBST(BUILD_RPMCONVERT)
|
|
|
|
dnl whether or not we should try to build rpmgettext/rpmputtext.
|
|
if test X"$USE_NLS" = Xyes; then
|
|
BUILD_RPMNLSTOOLS="rpmgettext rpmputtext"
|
|
if test X"$USE_INCLUDED_LIBINTL" = Xyes; then
|
|
INCPATH="$INCPATH -I\$(top_builddir)/intl"
|
|
fi
|
|
else
|
|
BUILD_RPMNLSTOOLS=
|
|
fi
|
|
AC_SUBST(BUILD_RPMNLSTOOLS)
|
|
|
|
AC_CHECK_HEADERS(glob.h)
|
|
|
|
dnl statfs portability fiddles.
|
|
dnl
|
|
dnl We should really emulate/steal sections of the statfs and struct statfs
|
|
dnl checks from GNU fileutils.
|
|
dnl
|
|
AC_MSG_CHECKING(for struct statfs)
|
|
dnl
|
|
dnl this is easier than nesting AC_TRY_COMPILEs...
|
|
dnl
|
|
found_struct_statfs=no
|
|
|
|
if test X$found_struct_statfs = Xno ; then
|
|
dnl Solaris 2.6+ wants to use statvfs
|
|
AC_TRY_COMPILE([
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#include <sys/statvfs.h> ],
|
|
[struct statvfs sfs;],
|
|
[AC_MSG_RESULT(in sys/statvfs.h)
|
|
AC_DEFINE(STATFS_IN_SYS_STATVFS)
|
|
found_struct_statfs=yes],
|
|
)
|
|
fi
|
|
|
|
if test X$found_struct_statfs = Xno ; then
|
|
dnl first try including sys/vfs.h
|
|
AC_TRY_COMPILE([
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#include <sys/vfs.h> ],
|
|
[struct statfs sfs;],
|
|
[AC_MSG_RESULT(in sys/vfs.h)
|
|
AC_DEFINE(STATFS_IN_SYS_VFS)
|
|
found_struct_statfs=yes],
|
|
)
|
|
fi
|
|
|
|
if test X$found_struct_statfs = Xno ; then
|
|
dnl ...next try including sys/mount.h
|
|
AC_TRY_COMPILE([
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#include <sys/mount.h> ],
|
|
[struct statfs sfs;],
|
|
[AC_MSG_RESULT(in sys/mount.h)
|
|
AC_DEFINE(STATFS_IN_SYS_MOUNT)
|
|
found_struct_statfs=yes],
|
|
)
|
|
fi
|
|
|
|
if test X$found_struct_statfs = Xno ; then
|
|
dnl ...still no joy. Try sys/statfs.h
|
|
AC_TRY_COMPILE([
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#include <sys/statfs.h> ],
|
|
[struct statfs sfs;],
|
|
[AC_MSG_RESULT(in sys/statfs.h)
|
|
AC_DEFINE(STATFS_IN_SYS_STATFS)
|
|
found_struct_statfs=yes],
|
|
)
|
|
fi
|
|
|
|
if test X$found_struct_statfs = Xno ; then
|
|
dnl ...no luck. Warn the user of impending doom.
|
|
AC_MSG_WARN(not found)
|
|
fi
|
|
|
|
dnl
|
|
dnl if we found the struct, see if it has the f_bavail member. Some OSes
|
|
dnl don't, including IRIX 6.5+
|
|
dnl
|
|
if test X$found_struct_statfs = Xyes ; then
|
|
AC_MSG_CHECKING(for f_bavail member in struct statfs)
|
|
AC_TRY_COMPILE([
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#if STATFS_IN_SYS_STATVFS
|
|
# include <sys/statvfs.h>
|
|
typedef struct statvfs STATFS_t;
|
|
#else
|
|
typedef struct statfs STATFS_t;
|
|
# if STATFS_IN_SYS_VFS
|
|
# include <sys/vfs.h>
|
|
# elif STATFS_IN_SYS_MOUNT
|
|
# include <sys/mouht.h>
|
|
# elif STATFS_IN_SYS_STATFS
|
|
# include <sys/statfs.h>
|
|
# endif
|
|
#endif ],
|
|
[STATFS_t sfs;
|
|
sfs.f_bavail = 0;],
|
|
[AC_MSG_RESULT(yes)
|
|
AC_DEFINE(STATFS_HAS_F_BAVAIL)],
|
|
[AC_MSG_RESULT(no)]
|
|
)
|
|
fi
|
|
|
|
if test X$found_struct_statfs = Xyes ; then
|
|
dnl
|
|
dnl now check to see if we have the 4-argument variant of statfs()
|
|
dnl this pretty much requires AC_TRY_RUN
|
|
dnl
|
|
AC_MSG_CHECKING([if statfs() requires 4 arguments])
|
|
AC_TRY_RUN([
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
#include <sys/types.h>
|
|
#endif
|
|
#ifdef STATFS_IN_SYS_VFS
|
|
#include <sys/vfs.h>
|
|
#elif STATFS_IN_SYS_MOUNT
|
|
#include <sys/mouht.h>
|
|
#elif STATFS_IN_SYS_STATFS
|
|
#include <sys/statfs.h>
|
|
#endif
|
|
main() {
|
|
struct statfs sfs;
|
|
exit (statfs(".", &sfs, sizeof(sfs), 0));
|
|
}
|
|
],
|
|
[AC_MSG_RESULT(yes)
|
|
AC_DEFINE(STAT_STATFS4)],
|
|
[AC_MSG_RESULT(no)],
|
|
[AC_MSG_RESULT(no)]
|
|
)
|
|
fi
|
|
|
|
AC_C_INLINE
|
|
|
|
dnl look for libc features
|
|
PROVIDES_ERRNO=no
|
|
AC_MSG_CHECKING(if <netdb.h> defines h_errno)
|
|
AC_TRY_LINK([#include <netdb.h>],printf("%d",h_errno),PROVIDES_ERRNO=yes)
|
|
AC_MSG_RESULT($PROVIDES_ERRNO)
|
|
if test $PROVIDES_ERRNO = yes; then
|
|
AC_DEFINE(HAVE_HERRNO)
|
|
fi
|
|
|
|
dnl If a system doesn't have S_IFSOCK, define it as 0 which will
|
|
dnl make S_ISSOCK always return false (nice, eh?)
|
|
AC_MSG_CHECKING(if <sys/stat.h> defines S_IFSOCK)
|
|
AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_IFSOCK),
|
|
HAS_S_IFSOCK=yes,HAS_S_IFSOCK=no)
|
|
AC_MSG_RESULT($HAS_S_IFSOCK)
|
|
if test $HAS_S_IFSOCK = yes; then
|
|
AC_DEFINE(HAVE_S_IFSOCK)
|
|
fi
|
|
|
|
dnl Some Unix's are missing S_ISLNK, S_ISSOCK
|
|
AC_MSG_CHECKING(if <sys/stat.h> defines S_ISLNK)
|
|
AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISLNK(0755)),
|
|
HAS_S_ISLNK=yes,HAS_S_ISLNK=no)
|
|
AC_MSG_RESULT($HAS_S_ISLNK)
|
|
if test $HAS_S_ISLNK = yes; then
|
|
AC_DEFINE(HAVE_S_ISLNK)
|
|
fi
|
|
|
|
AC_MSG_CHECKING(if <sys/stat.h> defines S_ISSOCK)
|
|
AC_TRY_LINK([#include <sys/stat.h>],printf("%d", S_ISSOCK(0755)),
|
|
HAS_S_ISSOCK=yes,HAS_S_ISSOCK=no)
|
|
AC_MSG_RESULT($HAS_S_ISSOCK)
|
|
if test $HAS_S_ISSOCK = yes; then
|
|
AC_DEFINE(HAVE_S_ISSOCK)
|
|
fi
|
|
|
|
AC_MSG_CHECKING(if timezone is defined)
|
|
AC_TRY_LINK([#include <time.h>],printf("%ld", timezone),
|
|
HAS_TIMEZONE=yes,HAS_TIMEZONE=no)
|
|
AC_MSG_RESULT($HAS_TIMEZONE)
|
|
|
|
dnl Check for missing typedefs
|
|
AC_TYPE_MODE_T
|
|
AC_TYPE_PID_T
|
|
|
|
dnl Checks for library functions.
|
|
AC_FUNC_ALLOCA
|
|
AC_FUNC_VPRINTF
|
|
|
|
AC_FUNC_FNMATCH
|
|
if test $ac_cv_func_fnmatch_works = no; then
|
|
LIBOBJS="$LIBOBJS fnmatch.o"
|
|
AC_DEFINE_UNQUOTED(fnmatch, rpl_fnmatch)
|
|
fi
|
|
|
|
dnl XXX AC_FUNC_MEMCMP
|
|
dnl XXX AC_FUNC_MMAP
|
|
dnl XXX AC_TYPE_SIGNAL
|
|
dnl XXX AC_FUNC_STRCOLL
|
|
dnl XXX AC_FUNC_STRFTIME
|
|
dnl XXX AC_FUNC_UTIME_NULL
|
|
dnl XXX AC_FUNC_VFORK
|
|
dnl XXX AC_CHECK_FUNCS(gethostname mkdir mkfifo rmdir select uname)
|
|
|
|
AC_CHECK_FUNCS(mtrace)
|
|
|
|
AC_REPLACE_FUNCS(getcwd getwd inet_aton putenv realpath)
|
|
AC_REPLACE_FUNCS(strdup strerror strtol strtoul strspn strstr)
|
|
|
|
dnl XXX stpcpy/stpncpy needed by rpmgettext
|
|
AC_REPLACE_FUNCS(stpcpy stpncpy strcasecmp strncasecmp strcspn)
|
|
AC_REPLACE_FUNCS(basename)
|
|
|
|
dnl
|
|
dnl XXX Regex replacement isn't known to be needed yet.
|
|
dnl
|
|
AC_ARG_WITH(regex, [ --with-regex use the GNU regex library ],
|
|
[rpm_cv_regex=yes],
|
|
[AC_CHECK_FUNCS(regcomp, rpm_cv_regex=no, rpm_cv_regex=yes)])
|
|
|
|
if test $rpm_cv_regex = no ; then
|
|
AC_MSG_CHECKING(whether the regexp library is broken)
|
|
AC_TRY_RUN([
|
|
#include <unistd.h>
|
|
#include <regex.h>
|
|
main() { regex_t blah ; exit(regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0)); }],
|
|
rpm_cv_regex_broken=no, rpm_cv_regex_broken=yes, rpm_cv_regex_broken=yes)
|
|
AC_MSG_RESULT([$rpm_cv_regex_broken])
|
|
if test $rpm_cv_regex_broken = yes ; then
|
|
echo " --> using the included GNU regex instead." >&AC_FD_MSG
|
|
rpm_cv_regex=yes
|
|
fi
|
|
fi
|
|
|
|
if test $rpm_cv_regex = yes; then
|
|
AC_DEFINE(USE_GNU_REGEX)
|
|
LIBOBJS="$LIBOBJS regex.o"
|
|
fi
|
|
|
|
dnl
|
|
dnl XXX Glob may be broken on solaris and aix when %files gets something like
|
|
dnl /usr/share/locale/*/LC_MESSAGES/*.mo
|
|
dnl (Note: two asterisks in glob pattern.)
|
|
dnl
|
|
AC_ARG_WITH(glob, [ --with-glob use the internal GNU glob ],
|
|
[rpm_cv_glob=yes],
|
|
[AC_CHECK_FUNCS(glob, rpm_cv_glob=no, rpm_cv_glob=yes)])
|
|
|
|
if test $rpm_cv_glob = no ; then
|
|
AC_MSG_CHECKING(whether the glob library is broken)
|
|
AC_TRY_RUN([
|
|
#include <unistd.h>
|
|
#include <glob.h>
|
|
main() { glob_t blah ; exit(glob("doc/*/*.8", 0, NULL, &blah) || blah.gl_pathc < 1); } ],
|
|
rpm_cv_glob_broken=no, rpm_cv_glob_broken=yes, rpm_cv_glob_broken=yes)
|
|
AC_MSG_RESULT([$rpm_cv_glob_broken])
|
|
if test $rpm_cv_glob_broken = yes ; then
|
|
echo " --> using the included GNU glob instead." >&AC_FD_MSG
|
|
rpm_cv_glob=yes
|
|
fi
|
|
fi
|
|
|
|
if test $rpm_cv_glob = yes; then
|
|
AC_DEFINE(USE_GNU_GLOB)
|
|
LIBOBJS="$LIBOBJS glob.o"
|
|
fi
|
|
|
|
AC_CHECK_FUNCS(setlocale)
|
|
|
|
dnl XXX Solaris <= 2.6 only permits 8 chars in password.
|
|
AC_CHECK_FUNCS(getpassphrase)
|
|
|
|
AC_CHECK_FUNC(getmntent, AC_DEFINE(HAVE_GETMNTENT), [
|
|
AC_CHECK_FUNC(mntctl, AC_DEFINE(HAVE_MNTCTL),[
|
|
AC_CHECK_FUNC(getmntinfo_r, AC_DEFINE(HAVE_GETMNTINFO_R), [
|
|
AC_CHECK_LIB(c_r, getmntinfo_r, [LIBS="$LIBS -lc_r";
|
|
AC_DEFINE(HAVE_GETMNTINFO_R)],
|
|
LIBOBJS="$LIBOBJS getmntent.o")])])])
|
|
|
|
LCHOWN=no
|
|
AC_CHECK_FUNC(lchown, [LCHOWN=yes; AC_DEFINE(HAVE_LCHOWN)])
|
|
if test "$LCHOWN" = no; then
|
|
dnl Does chown() follow symlinks? This should be a good enough test.
|
|
AC_MSG_CHECKING(whether chown() follows symlinks)
|
|
AC_ARG_ENABLE([broken-chown],
|
|
[ --enable-broken-chown this system's chown follows symbolic links],
|
|
result=$enableval, result=unknown)
|
|
if echo "$build" | egrep "(aix)|(hpux)|(linux)" > /dev/null ; then
|
|
result=yes
|
|
elif echo "$build" | egrep "(nextstep)" > /dev/null ; then
|
|
result=no
|
|
fi
|
|
if test $result = unknown; then
|
|
if test `id | cut -f2 -d\= | cut -f1 -d\(` = 0; then
|
|
rm -f foo bar
|
|
touch foo
|
|
ln -s foo bar
|
|
chown 10 bar
|
|
if test `ls -l foo | awk '{print $3}'` != "root"; then
|
|
result=yes
|
|
else
|
|
result=no
|
|
fi
|
|
rm -f foo bar
|
|
else
|
|
AC_MSG_CHECKING((cannot check by non-root user))
|
|
result=no
|
|
fi
|
|
fi
|
|
|
|
AC_MSG_RESULT($result)
|
|
if test $result = yes; then
|
|
AC_DEFINE(CHOWN_FOLLOWS_SYMLINK)
|
|
fi
|
|
fi
|
|
|
|
|
|
dnl
|
|
dnl figure out what root's primary group is
|
|
dnl
|
|
AC_MSG_CHECKING(root's primary group)
|
|
AC_TRY_RUN([#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <pwd.h>
|
|
#include <grp.h>
|
|
|
|
int main()
|
|
{
|
|
struct passwd *root = NULL;
|
|
struct group *roots_group = NULL;
|
|
FILE * tempfile = NULL;
|
|
|
|
root = getpwuid( (uid_t) 0 );
|
|
if (root != NULL) {
|
|
roots_group = getgrgid(root->pw_gid);
|
|
if (roots_group != NULL) {
|
|
tempfile = fopen("conftest_rootg", "w");
|
|
if (tempfile != NULL) {
|
|
fprintf(tempfile, "%s\n", roots_group->gr_name);
|
|
fclose(tempfile);
|
|
exit(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
exit(1);
|
|
}], ROOT_GROUP=`cat conftest_rootg`,
|
|
ROOT_GROUP="root",ROOT_GROUP="root"
|
|
)
|
|
AC_MSG_RESULT($ROOT_GROUP)
|
|
AC_SUBST(ROOT_GROUP)
|
|
|
|
if test "x$varprefix" = "x"; then
|
|
varprefix=`echo $prefix | sed 's/usr/var/'`
|
|
test "x$prefix" = xNONE && varprefix=`echo $ac_default_prefix | sed 's/usr/var/'`
|
|
fi
|
|
AC_SUBST(varprefix)
|
|
|
|
if test "x$tmpdir" = "x"; then
|
|
if test -d $varprefix/tmp; then
|
|
tmpdir=$varprefix/tmp
|
|
else
|
|
if test -d /var/tmp; then
|
|
tmpdir=/var/tmp
|
|
else
|
|
tmpdir=/tmp
|
|
fi
|
|
fi
|
|
fi
|
|
AC_SUBST(tmpdir)
|
|
|
|
if echo "$build_os" | grep sco > /dev/null; then
|
|
echo "hacking things up for sco"
|
|
AC_DEFINE(NEED_STRINGS_H)
|
|
AC_DEFINE(HAVE_STRUCT_MNTTAB)
|
|
elif echo "$build_os" | grep sunos > /dev/null; then
|
|
echo "hacking things up for sunos"
|
|
CFLAGS="$CFLAGS -D__USE_FIXED_PROTOTYPES__"
|
|
AC_DEFINE(NEED_STRINGS_H)
|
|
AC_DEFINE(NEED_MYREALLOC)
|
|
LIBOBJS="$LIBOBJS myrealloc.o"
|
|
fi
|
|
|
|
#
|
|
# get rid of the 4-th tuple, if config.guess returned "linux-gnu" for build_os
|
|
#
|
|
if echo "$build_os" | grep '.*-gnulibc1' > /dev/null ; then
|
|
build_os=`echo "${build_os}" | sed 's/-gnulibc1$//'`
|
|
fi
|
|
if echo "$build_os" | grep '.*-gnu' > /dev/null ; then
|
|
build_os=`echo "${build_os}" | sed 's/-gnu$//'`
|
|
fi
|
|
|
|
changequote(<, >)
|
|
build_os_exact="${build_os}"
|
|
build_os_major=`echo "${build_os}" | sed 's/\..*$//'`
|
|
build_os_noversion=`echo "${build_os}" | sed 's/[0-9]*\..*$//'`
|
|
changequote([, ])
|
|
|
|
rm -f ./find-provides
|
|
if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ; then
|
|
echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov for automatic provides generation"
|
|
ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.prov ./find-provides
|
|
elif test -f ${srcdir}/autodeps/${build_os_exact}.prov ; then
|
|
echo "using ${srcdir}/autodeps/${build_os_exact}.prov for automatic provides generation"
|
|
ln -s ${srcdir}/autodeps/${build_os_exact}.prov ./find-provides
|
|
elif test -f ${srcdir}/autodeps/${build_os_major}.prov ; then
|
|
echo "using ${srcdir}/autodeps/${build_os_major}.prov for automatic provides generation"
|
|
ln -s ${srcdir}/autodeps/${build_os_major}.prov ./find-provides
|
|
elif test -f ${srcdir}/autodeps/${build_os_noversion}.prov ; then
|
|
echo "using ${srcdir}/autodeps/${build_os_noversion}.prov for automatic provides generation"
|
|
ln -s ${srcdir}/autodeps/${build_os_noversion}.prov ./find-provides
|
|
else
|
|
echo "*** no default provides information is available for ${build_os_noversion}"
|
|
ln -s ${srcdir}/autodeps/none ./find-provides
|
|
fi
|
|
|
|
rm -f ./find-requires
|
|
if test -f ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ; then
|
|
echo "using ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req for automatic requires generation"
|
|
ln -s ${srcdir}/autodeps/${build_cpu}-${build_os_exact}.req ./find-requires
|
|
elif test -f ${srcdir}/autodeps/${build_os_exact}.req ; then
|
|
echo "using ${srcdir}/autodeps/${build_os_exact}.req for automatic requires generation"
|
|
ln -s ${srcdir}/autodeps/${build_os_exact}.req ./find-requires
|
|
elif test -f ${srcdir}/autodeps/${build_os_major}.req ; then
|
|
echo "using ${srcdir}/autodeps/${build_os_major}.req for automatic requires generation"
|
|
ln -s ${srcdir}/autodeps/${build_os_major}.req ./find-requires
|
|
elif test -f ${srcdir}/autodeps/${build_os_noversion}.req ; then
|
|
echo "using ${srcdir}/autodeps/${build_os_noversion}.req for automatic requires generation"
|
|
ln -s ${srcdir}/autodeps/${build_os_noversion}.req ./find-requires
|
|
else
|
|
echo "*** no default requires information is available for ${build_os_noversion}"
|
|
ln -s ${srcdir}/autodeps/none ./find-requires
|
|
fi
|
|
|
|
dnl Determine the canonical arch-vendor-os for the build machine
|
|
case "${build_cpu}" in
|
|
i386|i486|i586|i686|ix86) RPMCANONARCH=i386 ;;
|
|
alpha*) RPMCANONARCH=alpha ;;
|
|
sparc*) RPMCANONARCH=sparc ;;
|
|
powerpc*) RPMCANONARCH=ppc ;;
|
|
armv4l*) RPMCANONARCH=armv4l ;;
|
|
armv4b*) RPMCANONARCH=armv4b ;;
|
|
arm*) RPMCANONARCH=arm ;;
|
|
*) RPMCANONARCH=unknown ;;
|
|
esac
|
|
case "${build_os_noversion}" in
|
|
mint) RPMCANONARCH=m68kmint ;;
|
|
esac
|
|
RPMCANONVENDOR="$build_vendor"
|
|
case "${build_vendor}" in
|
|
unknown|pc) test -f /etc/redhat-release && RPMCANONVENDOR=redhat ;;
|
|
esac
|
|
RPMCANONOS="$build_os_noversion"
|
|
AC_SUBST(RPMCANONARCH)
|
|
AC_SUBST(RPMCANONVENDOR)
|
|
AC_SUBST(RPMCANONOS)
|
|
|
|
if test -n "$LIBOBJS" ; then
|
|
LIBMISC='$(top_builddir)/misc/libmisc.a'
|
|
fi
|
|
AC_SUBST(LIBOBJS)
|
|
AC_SUBST(LIBMISC)
|
|
|
|
if test X"$prefix" = XNONE ; then
|
|
usrprefix="$ac_default_prefix"
|
|
else
|
|
usrprefix=$prefix
|
|
fi
|
|
LOCALEDIR="`echo ${usrprefix}/share/locale`"
|
|
AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR")
|
|
AC_SUBST(LOCALEDIR)
|
|
RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
|
|
AC_DEFINE_UNQUOTED(RPMCONFIGDIR, "$RPMCONFIGDIR")
|
|
AC_SUBST(RPMCONFIGDIR)
|
|
SYSCONFIGDIR="`echo /etc/rpm`"
|
|
AC_DEFINE_UNQUOTED(SYSCONFIGDIR, "$SYSCONFIGDIR")
|
|
AC_SUBST(SYSCONFIGDIR)
|
|
LIBRPMRC_FILENAME="${RPMCONFIGDIR}/rpmrc"
|
|
AC_DEFINE_UNQUOTED(LIBRPMRC_FILENAME, "$LIBRPMRC_FILENAME")
|
|
AC_SUBST(LIBRPMRC_FILENAME)
|
|
LIBRPMALIAS_FILENAME="${RPMCONFIGDIR}/rpmpopt"
|
|
AC_DEFINE_UNQUOTED(LIBRPMALIAS_FILENAME, "$LIBRPMALIAS_FILENAME")
|
|
AC_SUBST(LIBRPMALIAS_FILENAME)
|
|
FINDREQUIRES="${RPMCONFIGDIR}/find-requires"
|
|
AC_DEFINE_UNQUOTED(FINDREQUIRES, "$FINDREQUIRES")
|
|
AC_SUBST(FINDREQUIRES)
|
|
FINDPROVIDES="${RPMCONFIGDIR}/find-provides"
|
|
AC_DEFINE_UNQUOTED(FINDPROVIDES, "$FINDPROVIDES")
|
|
AC_SUBST(FINDPROVIDES)
|
|
MACROFILES="${RPMCONFIGDIR}/macros"
|
|
AC_DEFINE_UNQUOTED(MACROFILES, "$MACROFILES")
|
|
AC_SUBST(MACROFILES)
|
|
|
|
testdir="`pwd`/tests"
|
|
dnl AC_DEFINE_UNQUOTED(testdir, "$testdir")
|
|
AC_SUBST(testdir)
|
|
|
|
if test -n "$LIBOBJS"; then
|
|
INCPATH="$INCPATH -I\$(top_builddir)/misc"
|
|
fi
|
|
AC_SUBST(INCPATH)
|
|
|
|
AC_SUBST(LIBS)
|
|
|
|
AC_SUBST(RPM)
|
|
|
|
# XXX Propagate -lucb to popt ...
|
|
export LIBS INCPATH CONFIG_SITE
|
|
|
|
AC_CONFIG_SUBDIRS(popt)
|
|
AC_OUTPUT([Makefile rpmrc macros lib/Makefile
|
|
build/Makefile tools/Makefile scripts/Makefile
|
|
tests/Makefile tests/rpmrc tests/macros tests/hello-test/Makefile
|
|
misc/Makefile po/Makefile.in intl/Makefile
|
|
doc/Makefile doc/manual/Makefile doc/pl/Makefile doc/ru/Makefile
|
|
python/Makefile],
|
|
[echo timestamp > popt/stamp-h.in
|
|
echo timestamp > stamp-h.in])
|
|
dnl touch Makefile.in
|
|
dnl sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile])
|
|
|