From c30d127e8780dc678168ee121b9f2eeb1a8aaafa Mon Sep 17 00:00:00 2001 From: wangbiao Date: Thu, 16 Nov 2023 18:17:42 +0900 Subject: Upgrade version to 4.14 Change-Id: I21bf1a3a7c25cbec43022202cf2e5865b603a309 Signed-off-by: wangbiao --- configure.ac | 464 +++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 359 insertions(+), 105 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index acdc5204c..0c29311eb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ AC_PREREQ(2.61) -AC_INIT(rpm, 4.11.0.1, rpm-maint@lists.rpm.org) +AC_INIT(rpm, 4.14.1, rpm-maint@lists.rpm.org) AC_CONFIG_SRCDIR([rpmqv.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([1.10 foreign tar-ustar dist-bzip2 subdir-objects nostdinc]) +AM_INIT_AUTOMAKE([1.10 foreign tar-pax dist-bzip2 subdir-objects nostdinc]) dnl Allow silent build on automake versions that support it m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) @@ -37,21 +37,24 @@ fi AS=${AS-as} AC_SUBST(AS) if test "$GCC" = yes; then - cflags_to_try="-fno-strict-aliasing -fstack-protector -Wempty-body" + cflags_to_try="-fno-strict-aliasing -fstack-protector-strong -Wempty-body" AC_MSG_CHECKING([supported compiler flags]) old_cflags=$CFLAGS echo for flag in $cflags_to_try; do CFLAGS="$CFLAGS $flag -Werror" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[ + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[#include + alloca(100);]])],[ echo " $flag" RPMCFLAGS="$RPMCFLAGS $flag" ],[]) CFLAGS=$old_cflags done - CFLAGS="$CFLAGS -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes $RPMCFLAGS" + RPMCFLAGS="-fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes $RPMCFLAGS" + CFLAGS="$RPMCFLAGS" fi export CFLAGS +AC_SUBST(RPMCFLAGS) AC_SYS_LARGEFILE @@ -90,7 +93,7 @@ fi dnl dnl Find some common programs dnl -AC_PATH_PROG(__7ZIP, 7zip, /usr/bin/7za, $MYPATH) +AC_PATH_PROGS(__7ZIP, [7zip 7za 7z], /usr/bin/7za, $MYPATH) AC_PATH_PROG(__BZIP2, bzip2, /usr/bin/bzip2, $MYPATH) AC_PATH_PROG(__CAT, cat, /bin/cat, $MYPATH) AC_PATH_PROG(__CHGRP, chgrp, /bin/chgrp, $MYPATH) @@ -100,7 +103,7 @@ AC_PATH_PROG(__CP, cp, /bin/cp, $MYPATH) AC_PATH_PROG(__CPIO, cpio, /bin/cpio, $MYPATH) AC_PATH_PROG(__CURL, curl, /usr/bin/curl, $MYPATH) AC_PATH_PROG(__FILE, file, /usr/bin/file, $MYPATH) -AC_PATH_PROG(__GPG, gpg, /usr/bin/gpg, $MYPATH) +AC_PATH_PROGS(__GPG, gpg2 gpg, /usr/bin/gpg2, $MYPATH) AC_PATH_PROG(__GREP, grep, /bin/grep, $MYPATH) AC_PATH_PROG(__GZIP, gzip, /bin/gzip, $MYPATH) AC_PATH_PROG(__UNZIP, unzip, /usr/bin/unzip, $MYPATH) @@ -109,6 +112,7 @@ AC_PATH_PROG(__INSTALL, install, /usr/bin/install, $MYPATH) AC_PATH_PROG(__LRZIP, lrzip, /usr/bin/lrzip, $MYPATH) AC_PATH_PROG(__LZIP, lzip, /usr/bin/lzip, $MYPATH) AC_PATH_PROG(__XZ, xz, /usr/bin/xz, $MYPATH) +AC_PATH_PROG(__GEM, gem, /usr/bin/gem, $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) @@ -127,13 +131,14 @@ AC_MSG_CHECKING(old version of patch) AC_PATH_PROG(__PERL, perl, /usr/bin/perl, $MYPATH) AC_PATH_PROG(__PGP, pgp, /usr/bin/pgp, $MYPATH) -AC_PATH_PROG(__PYTHON, python, /usr/bin/python3, $MYPATH) +AC_PATH_PROG(__PYTHON, python, /usr/bin/python, $MYPATH) AC_PATH_PROG(__RM, rm, /bin/rm, $MYPATH) AC_PATH_PROG(__RSH, rsh, /usr/bin/rsh, $MYPATH) AC_PATH_PROG(__SED, sed, /bin/sed, $MYPATH) AC_PATH_PROG(__SEMODULE, semodule, /usr/bin/semodule, $MYPATH) AC_PATH_PROG(__SSH, ssh, /usr/bin/ssh, $MYPATH) AC_PATH_PROG(__TAR, tar, /bin/tar, $MYPATH) +AC_PATH_PROG(__ZSTD, zstd, /usr/bin/zstd, $MYPATH) AC_PATH_PROG(__LD, ld, /usr/bin/ld, $MYPATH) AC_PATH_PROG(__NM, nm, /usr/bin/nm, $MYPATH) @@ -200,6 +205,31 @@ AC_CHECK_HEADERS([lzma.h],[ ]) AC_SUBST(WITH_LZMA_LIB) +#================= +# Check for zstd. + +AC_ARG_ENABLE([zstd], + [AS_HELP_STRING([--enable-zstd=@<:@yes/no/auto@:>@], + [build without zstd support (default=auto)])], + [enable_zstd="$enableval"], + [enable_zstd=auto]) + +AS_IF([test "x$enable_zstd" != "xno"], [ + PKG_CHECK_MODULES([ZSTD], [libzstd], [have_zstd=yes], [have_zstd=no]) + AS_IF([test "$enable_zstd" = "yes"], [ + if test "$have_zstd" = "no"; then + AC_MSG_ERROR([--enable-zstd specified, but not available]) + fi + ]) +]) + +if test "x$have_zstd" = "xyes"; then + AC_DEFINE([HAVE_ZSTD], [1], [Define if libzstd is available]) + ZSTD_REQUIRES=libzstd + AC_SUBST(ZSTD_REQUIRES) +fi +AM_CONDITIONAL([HAVE_ZSTD], [test "x$have_zstd" = "xyes"]) + #================= dnl @@ -243,18 +273,30 @@ AC_CHECK_HEADERS([dwarf.h], [ AM_CONDITIONAL(LIBDWARF,[test "$WITH_LIBDWARF" = yes]) #================= +# Select crypto library +AC_ARG_WITH(crypto, + [AC_HELP_STRING([--with-crypto=CRYPTO_LIB], + [The cryptographic library to use (nss|beecrypt|openssl). The default is nss.]) + ],[], + [with_crypto=nss]) + +# Refuse to proceed if someone specified --with-beecrypt (removed) +AC_ARG_WITH(beecrypt, + [AC_HELP_STRING([--with-beecrypt (OBSOLETE)], [Obsolete argument. Use --with-crypto=beecrypt]) + ],[AC_MSG_ERROR([--with-beecrypt no longer supported. Use --with-crypto=beecrypt])], + []) + # Check for beecrypt library if requested. -AC_ARG_WITH(beecrypt, [ --with-beecrypt build with beecrypt support ],,[with_beecrypt=no]) AC_ARG_WITH(internal_beecrypt, [ --with-internal-beecrypt build with internal beecrypt library ],,[with_internal_beecrypt=no]) AM_CONDITIONAL([WITH_INTERNAL_BEECRYPT],[test "$with_internal_beecrypt" = yes]) if test "$with_internal_beecrypt" = yes ; then - with_beecrypt=yes + with_crypto=beecrypt fi -AM_CONDITIONAL([WITH_BEECRYPT],[test "$with_beecrypt" = yes]) +AM_CONDITIONAL([WITH_BEECRYPT],[test "$with_crypto" = beecrypt]) WITH_BEECRYPT_INCLUDE= WITH_BEECRYPT_LIB= -if test "$with_beecrypt" = yes ; then +if test "$with_crypto" = beecrypt ; then AC_DEFINE(WITH_BEECRYPT, 1, [Build with beecrypt instead of nss3 support?]) if test "$with_internal_beecrypt" = yes ; then WITH_BEECRYPT_INCLUDE="-I\$(top_srcdir)/beecrypt" @@ -263,7 +305,7 @@ if test "$with_beecrypt" = yes ; then AC_CHECK_LIB(beecrypt, mpfprintln, [ WITH_BEECRYPT_LIB="-lbeecrypt" ],[ - AC_MSG_ERROR([missing required library 'beecrypt']) + AC_MSG_ERROR([missing required library 'beecrypt']) ]) AC_CHECK_HEADER([beecrypt/api.h], [AC_DEFINE(HAVE_BEECRYPT_API_H, 1, [Define to 1 if you have the header file.]) ]) @@ -272,14 +314,101 @@ fi AC_SUBST(WITH_BEECRYPT_LIB) AC_SUBST(WITH_BEECRYPT_INCLUDE) +#================= +# Check for OpenSSL library. +# We need evp.h from OpenSSL. + +WITH_OPENSSL_INCLUDE= +WITH_OPENSSL_LIB= +if test "$with_crypto" = openssl; then +# If we have pkgconfig make sure CPPFLAGS are setup correctly for the OpenSSL +# -I include path. +AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no], [$PATH:/usr/bin:/usr/local/bin]) +if test "x$PKGCONFIG" != "xno"; then + CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags libcrypto)" + WITH_OPENSSL_LIB=$($PKGCONFIG --libs libcrypto) +else + WITH_OPENSSL_LIB=-lcrypto +fi + +AC_CHECK_HEADERS([openssl/evp.h], [], [ + AC_MSG_ERROR([missing required OpenSSL header]) +]) +AC_CHECK_HEADERS([openssl/rsa.h], [], [ + AC_MSG_ERROR([missing required OpenSSL header]) +]) +AC_CHECK_HEADERS([openssl/dsa.h], [], [ + AC_MSG_ERROR([missing required OpenSSL header]) +]) + +AC_CHECK_LIB(crypto, EVP_DigestInit_ex, [], [ + AC_MSG_ERROR([required OpenSSL library 'libcrypto' missing or too old]) +]) + +AC_CHECK_LIB(crypto, EVP_MD_CTX_new, [ + AC_DEFINE(HAVE_EVP_MD_CTX_NEW, 1, [Define to 1 if OpenSSL has EVP_MD_CTX_new]) + AC_SUBST(HAVE_EVP_MD_CTX_NEW, [1]) + ], [ + AC_CHECK_LIB(crypto, EVP_MD_CTX_create, [], [ + AC_MSG_ERROR([required OpenSSL library 'libcrypto' missing or too old]) + ]) +]) + +AC_CHECK_LIB(crypto, EVP_PKEY_CTX_new, [], [ + AC_MSG_ERROR([required OpenSSL library 'libcrypto' missing or too old]) +]) + +AC_CHECK_LIB(crypto, DSA_set0_key, [ + AC_DEFINE(HAVE_DSA_SET0_KEY, 1, [Define to 1 if OpenSSL has DSA_set0_key]) + AC_SUBST(HAVE_DSA_SET0_KEY, [1]) + ], [] +) + +AC_CHECK_LIB(crypto, DSA_set0_pqg, [ + AC_DEFINE(HAVE_DSA_SET0_PQG, 1, [Define to 1 if OpenSSL has DSA_set0_pqg]) + AC_SUBST(HAVE_DSA_SET0_PQG, [1]) + ], [] +) + +AC_CHECK_LIB(crypto, DSA_SIG_set0, [ + AC_DEFINE(HAVE_DSA_SIG_SET0, 1, [Define to 1 if OpenSSL has DSA_SIG_set0]) + AC_SUBST(HAVE_DSA_SIG_SET0, [1]) + ], [] +) + +AC_CHECK_LIB(crypto, RSA_set0_key, [ + AC_DEFINE(HAVE_RSA_SET0_KEY, 1, [Define to 1 if OpenSSL has RSA_set0_key]) + AC_SUBST(HAVE_RSA_SET0_KEY, [1]) + ], [] +) + +AC_CHECK_LIB(crypto, BN_bn2binpad, [ + AC_DEFINE(HAVE_BN2BINPAD, 1, [Define to 1 if OpenSSL has BN_bn2binpad]) + AC_SUBST(HAVE_BN2BINPAD, [1]) + ], [] +) + +fi + +AM_CONDITIONAL([WITH_OPENSSL],[test "$with_crypto" = openssl]) +AC_SUBST(WITH_OPENSSL_INCLUDE) +AC_SUBST(WITH_OPENSSL_LIB) + #================= # Check for NSS library. -# We need nss.h from NSS which needs nspr.h. Unfortunately both glibc and NSS -# have a header named nss.h... so make extra check for NSS's sechash.h +# We need nss.h from NSS which needs nspr.h. Unfortunately both glibc and NSS +# have a header named nss.h... so make extra check for NSS's sechash.h # which we use too and hopefully is slightly more unique to NSS. WITH_NSS_INCLUDE= WITH_NSS_LIB= -if test "$with_beecrypt" != yes ; then +if test "$with_crypto" = nss; then +# If we have pkgconfig make sure CPPFLAGS are setup correctly for the nss +# -I include path. Otherwise the below checks will fail because nspr.h +# cannot be found. +AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no], [$PATH:/usr/bin:/usr/local/bin]) +if test "x$PKGCONFIG" != "xno"; then + CPPFLAGS="$CPPFLAGS $($PKGCONFIG --cflags nss)" +fi AC_CHECK_HEADERS([nspr.h nss.h sechash.h], [], [ AC_MSG_ERROR([missing required NSPR / NSS header]) ]) @@ -334,6 +463,53 @@ AC_CHECK_HEADER([popt.h], [ AC_SUBST(WITH_POPT_INCLUDE) AC_SUBST(WITH_POPT_LIB) +#================= +# Check for libarchive library. +AC_ARG_WITH([archive], [AS_HELP_STRING([--with-archive], [build rpm2archive - requires libarchive])], + [], + [with_archive=yes]) + +WITH_ARCHIVE_INCLUDE= +WITH_ARCHIVE_LIB= +AS_IF([test "$with_archive" != no],[ + AC_CHECK_HEADER([archive.h], [ + AC_CHECK_LIB(archive, archive_write_open_filename, [ + WITH_ARCHIVE_INCLUDE= + WITH_ARCHIVE_LIB="-larchive" + ],[ + AC_MSG_ERROR([missing required library 'libarchive']) + ]) +],[ + AC_MSG_ERROR([missing required header archive.h]) + ]) +]) + +AC_SUBST(WITH_ARCHIVE_INCLUDE) +AC_SUBST(WITH_ARCHIVE_LIB) +AM_CONDITIONAL(WITH_ARCHIVE,[test "$with_archive" = yes]) + +#================= +# Check for elfutils libdw library with dwelf_elf_gnu_build_id. +WITH_LIBDW_LIB= +HAVE_LIBDW_STRTAB= +AS_IF([test "$WITH_LIBELF" = yes],[ + AC_CHECK_HEADERS([elfutils/libdwelf.h],[ + # dwelf_elf_gnu_build_id was introduced in elfutils 0.159 + AC_CHECK_LIB(dw, dwelf_elf_gnu_build_id, [ + AC_DEFINE(HAVE_LIBDW, 1, + [Define to 1 if you have elfutils libdw library]) + WITH_LIBDW_LIB="-ldw" + WITH_LIBDW=yes + # If possible we also want the strtab functions from elfutils 0.167. + # But we can fall back on the (unsupported) ebl alternatives if not. + AC_CHECK_LIB(dw, dwelf_strtab_init, [HAVE_LIBDW_STRTAB=yes]) + ]) + ]) +]) +AC_SUBST(WITH_LIBDW_LIB) +AM_CONDITIONAL(LIBDW,[test "$WITH_LIBDW" = yes]) +AM_CONDITIONAL(HAVE_LIBDW_STRTAB,[test "$HAVE_LIBDW_STRTAB" = yes]) + #================= # Process --with/without-external-db AC_ARG_WITH(external_db, [AS_HELP_STRING([--with-external-db],[build against an external Berkeley db])], @@ -359,25 +535,96 @@ yes ) ],[ AC_MSG_ERROR([missing required header db.h]) ]) - AC_DEFINE(WITH_EXTERNAL_DB, 1, [Use external db?]) ;; -* ) # Fall back to internal db if available +no|maybe ) + # Try internal database first, then fall back to external + # unless --without-external-db (no) was explicitly given. if [ test -x db/dist/configure ]; then AC_DEFINE(HAVE_DB_H, 1, [Define if you have the header file]) else - AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL]) + case "$with_external_db" in + maybe) + AC_CHECK_HEADERS([db.h],[ + AC_PREPROC_IFELSE([ + AC_LANG_SOURCE([ + #include + #if ((DB_VERSION_MAJOR < 4) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 5)) + #error Berkeley DB too old + #endif + ]) + ],[ WITH_DB_LIB=-ldb ], + [ AC_MSG_ERROR([Berkeley DB version >= 4.5 required]) + ]) + ],[ + AC_MSG_ERROR([missing required header db.h]) + ]) + ;; + no) + AC_MSG_ERROR([internal Berkeley DB directory not present, see INSTALL]) + ;; + esac fi ;; esac AC_SUBST([WITH_DB_LIB]) +#================= +# Process --enable-ndb +AC_ARG_ENABLE([ndb], [AS_HELP_STRING([--enable-ndb (EXPERIMENTAL)],[enable the new rpm database format])], +[case "$enable_ndb" in +yes|no) ;; +*) AC_MSG_ERROR([invalid argument to --enable-ndb]) + ;; +esac], +[enable_ndb=no]) +AS_IF([test "$enable_ndb" = yes],[ + AC_CHECK_FUNCS([mremap], + [AC_DEFINE(ENABLE_NDB, 1, [Enable new rpm database format?])], + [AC_MSG_ERROR([mremap function required by ndb])], + [#include ]) +]) +AM_CONDITIONAL([NDB], [test "$enable_ndb" = yes]) + +#================= +# Check for LMDB support +AC_ARG_ENABLE([lmdb], + [AS_HELP_STRING([--enable-lmdb=@<:@yes/no/auto@:>@ (EXPERIMENTAL)], + [build with LMDB rpm database format support (default=auto)])], + [enable_lmdb="$enableval"], + [enable_lmdb=auto]) + +AS_IF([test "x$enable_lmdb" != "xno"], [ + PKG_CHECK_MODULES([LMDB], [lmdb], [have_lmdb=yes], [have_lmdb=no]) + AS_IF([test "$enable_lmdb" = "yes"], [ + if test "$have_lmdb" = "no"; then + AC_MSG_ERROR([--enable-lmdb specified, but not available]) + fi + ]) +]) + +if test "x$have_lmdb" = "xyes"; then + AC_DEFINE([WITH_LMDB], [1], [Define if LMDB is available]) + LMDB_REQUIRES=lmdb + AC_SUBST(LMDB_REQUIRES) +fi +AM_CONDITIONAL([LMDB], [test "x$have_lmdb" = "xyes"]) + AM_GNU_GETTEXT_VERSION([0.16.1]) AM_GNU_GETTEXT([external]) +AM_ICONV dnl Checks for header files we can live without. AC_HEADER_STDC +dnl glibc and autoconf don't really play well together. +dnl glibc will produce a warning when including the wrong header. +dnl but still define major and minor. Causing us to include the header +dnl that produces a giant warning for each major/minor use. +dnl Use -Werror to work around that. +old_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS -Werror" AC_HEADER_MAJOR +CFLAGS=$old_CFLAGS AC_STRUCT_DIRENT_D_TYPE AC_CHECK_HEADERS(limits.h) @@ -387,6 +634,7 @@ AC_CHECK_HEADERS(sys/utsname.h) AC_CHECK_HEADERS(sys/systemcfg.h) AC_CHECK_HEADERS(sys/param.h) +AC_CHECK_HEADERS(sys/auxv.h) dnl statfs portability fiddles. dnl @@ -401,25 +649,25 @@ dnl found_struct_statfs=no if test X$found_struct_statfs = Xno ; then -dnl first try including sys/vfs.h +dnl Solaris 2.6+ wants to use statvfs AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif -#include ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h) - AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in (for linux systems)]) +#include ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h) + AC_DEFINE(STATFS_IN_SYS_STATVFS, 1, + [statfs in (for solaris 2.6+ systems)]) found_struct_statfs=yes],[]) fi if test X$found_struct_statfs = Xno ; then -dnl Solaris 2.6+ wants to use statvfs +dnl first try including sys/vfs.h AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #ifdef HAVE_SYS_TYPES_H #include #endif -#include ]], [[struct statvfs sfs;]])],[AC_MSG_RESULT(in sys/statvfs.h) - AC_DEFINE(STATFS_IN_SYS_STATVFS, 1, - [statfs in (for solaris 2.6+ systems)]) +#include ]], [[struct statfs sfs;]])],[AC_MSG_RESULT(in sys/vfs.h) + AC_DEFINE(STATFS_IN_SYS_VFS, 1, [statfs in (for linux systems)]) found_struct_statfs=yes],[]) fi @@ -519,13 +767,26 @@ dnl Checks for library functions. AC_CHECK_FUNCS(putenv) AC_CHECK_FUNCS(mempcpy) AC_CHECK_FUNCS(fdatasync) +AC_CHECK_DECLS(fdatasync, [], [], [#include ]) +AC_CHECK_FUNCS(lutimes) +AC_CHECK_FUNCS(mergesort) +AC_CHECK_FUNCS(getauxval) +AC_CHECK_FUNCS(setprogname, [], [], [#include ]) + +AC_MSG_CHECKING([whether __progname is defined]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([extern const char *__progname;], + [if (*__progname == 0) return 0;])], + AC_DEFINE([HAVE___PROGNAME], [1], [Define if __progname is defined]) + AC_MSG_RESULT([yes]), + AC_MSG_RESULT([no])) AC_REPLACE_FUNCS(stpcpy stpncpy) AC_CHECK_FUNCS([secure_getenv __secure_getenv]) AC_CHECK_FUNCS( - [mkstemp getcwd basename dirname realpath setenv unsetenv regcomp lchown], + [mkstemp getcwd basename dirname realpath setenv unsetenv regcomp lchown \ + utimes getline], [], [AC_MSG_ERROR([function required by rpm])]) AC_LIBOBJ(fnmatch) @@ -539,33 +800,15 @@ yes|no) ;; esac], [enable_python=no]) +WITH_PYTHON_SUBPACKAGE=0 AS_IF([test "$enable_python" = yes],[ - AM_PATH_PYTHON([3.2],[ - WITH_PYTHON_INCLUDE=`${PYTHON} -c 'from distutils.sysconfig import *; import sys; sys.stdout.write(get_python_inc())'` - WITH_PYTHON_SUBPACKAGE=1 - save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$WITH_PYTHON_INCLUDE" - AC_CHECK_HEADER([Python.h],[], - [AC_MSG_ERROR([missing Python.h]) - ]) - CPPFLAGS="$save_CPPFLAGS" - save_LIBS="$LIBS" - - AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python3.6m],[ - WITH_PYTHON_LIB="$ac_res" - ],[AC_MSG_ERROR([missing python library, ${PYTHON_VERSION} vvv${PYTHON_ABI}vvv]) - ]) - LIBS="$save_LIBS" + AM_PATH_PYTHON([2.6],[ + PKG_CHECK_MODULES([PYTHON], [python-${PYTHON_VERSION}], [WITH_PYTHON_SUBPACKAGE=1]) + AC_SUBST(PYTHON_CFLAGS) + AC_SUBST(PYTHON_LIB) ]) -],[ - WITH_PYTHON_INCLUDE= - WITH_PYTHON_LIB= - WITH_PYTHON_SUBPACKAGE=0 ]) -AC_SUBST(WITH_PYTHON_INCLUDE) -AC_SUBST(WITH_PYTHON_LIB) - AM_CONDITIONAL(ENABLE_PYTHON,[test "$WITH_PYTHON_SUBPACKAGE" = 1]) AC_PATH_PROG(DOXYGEN, doxygen, no) @@ -603,6 +846,8 @@ AS_IF([test "$with_selinux" = yes],[ AC_MSG_ERROR([--with-selinux given, but selinux_getpolicytype not found in libselinux])]) AC_CHECK_LIB([selinux],[selinux_reset_config],[],[ AC_MSG_ERROR([--with-selinux given, but selinux_reset_config not found in libselinux])]) + AC_CHECK_LIB([selinux],[setexecfilecon],[ + AC_DEFINE([HAVE_SETEXECFILECON],[1],[Define to 1 if SELinux setexecfilecon is present])]) LIBS="$save_LIBS" ],[ AC_MSG_ERROR([--with-selinux given, but selinux/selinux.h not found]) @@ -620,48 +865,11 @@ AS_IF([test "$with_selinux" = yes],[ ],[ AC_MSG_ERROR([--with-selinux given, but selinux/label.h not found]) ]) - - dnl FIXME: semanage is only needed for the sepolicy plugin - AC_CHECK_HEADER([semanage/semanage.h],[ - save_LIBS="$LIBS" - AC_CHECK_LIB([semanage],[semanage_begin_transaction],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_begin_transaction missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_commit],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_commit missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_connect],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_connect missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_disconnect],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_disconnect missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_handle_create],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_handle_create missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_handle_destroy],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_handle_destroy missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_is_connected],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_is_connected missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_module_install_base_file],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_module_install_base_file missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_module_install_file],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_module_install_file missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_module_remove],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_module_remove missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_select_store],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_select_store missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_set_check_contexts],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_set_check_contexts missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_set_create_store],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_set_create_store missing in libsemanage])]) - AC_CHECK_LIB([semanage],[semanage_set_reload],[],[ - AC_MSG_ERROR([--with-selinux given, but semanage_set_reload missing in libsemanage])]) - LIBS="$save_LIBS" - ],[ - AC_MSG_ERROR([--with-selinux given, but semanage/semanage.h not found]) - ]) ]) AS_IF([test "$with_selinux" = yes],[ AC_DEFINE(WITH_SELINUX, 1, [Build with selinux support?]) WITH_SELINUX_LIB="-lselinux" - WITH_SEMANAGE_LIB="-lsemanage" ]) AC_SUBST(WITH_SELINUX_LIB) AC_SUBST(WITH_SEMANAGE_LIB) @@ -700,13 +908,13 @@ AS_IF([test "$with_msm" = yes],[ AC_SUBST(LIBXML2_CFLAGS) AC_SUBST(LIBXML2_LIBS) - AC_CHECK_HEADER([attr/xattr.h],[ + AC_CHECK_HEADER([sys/xattr.h],[ save_LIBS="$LIBS" AC_CHECK_LIB([attr],[setxattr],[],[ AC_MSG_ERROR([--with-msm given, but setxattr not found in libattr])]) LIBS="$save_LIBS" ],[ - AC_MSG_ERROR([--with-msm given, but attr/xattr.h not found]) + AC_MSG_ERROR([--with-msm given, but sys/xattr.h not found]) ]) AC_CHECK_HEADER([uthash.h],[ save_LIBS="$LIBS" @@ -731,6 +939,27 @@ AC_SUBST(WITH_MSM_LIB) AC_SUBST(WITH_MSM_INCLUDE) AM_CONDITIONAL(MSM,[test "$with_msm" = yes]) + +# libimaevm +with_iamevm=no +AC_ARG_WITH(imaevm, [AS_HELP_STRING([--with-imaevm],[build with imaevm support])]) +if test "$with_imaevm" = yes ; then + AC_MSG_CHECKING([libimaevm >= 1.0]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[return sign_hash(NULL, NULL, 0, NULL, NULL, NULL);]] + )], + [AC_MSG_RESULT(yes) + AC_DEFINE(WITH_IMAEVM, 1, [Build with imaevm support?]) + WITH_IMAEVM_LIB="-limaevm" + ], + [AC_MSG_ERROR([libimaevm not present or too old (< 1.0)])] + ) +fi +AM_CONDITIONAL(WITH_IMAEVM,[test "$with_imaevm" = yes]) +AC_SUBST(WITH_IMAEVM_LIB) + # libcap WITH_CAP_LIB= AC_ARG_WITH(cap, [AS_HELP_STRING([--with-cap],[build with capability support])], @@ -794,12 +1023,9 @@ AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [build with lua support])], [], [with_lua=yes]) -if test X"$LUA_PKGCONFIG_NAME" = X ; then - LUA_PKGCONFIG_NAME=lua -fi AS_IF([test "$with_lua" != no],[ PKG_CHECK_MODULES([LUA], - [${LUA_PKGCONFIG_NAME} >= 5.1], + [lua >= 5.1], [AC_DEFINE(WITH_LUA, 1, [Build with lua support?])], [AC_MSG_ERROR([lua not present (--without-lua to disable)])]) AC_SUBST(LUA_CFLAGS) @@ -813,6 +1039,21 @@ AS_IF([test "$enable_plugins" = yes],[ ]) AM_CONDITIONAL(ENABLE_PLUGINS,[test "$enable_plugins" = yes]) +with_dbus=no +AS_IF([test "$enable_plugins" != no],[ + PKG_CHECK_MODULES([DBUS], + [dbus-1 >= 1.3], + [AC_DEFINE(DBUS, 1, [Build with dbus support?]) with_dbus=yes], + [with_dbus=no]) + AC_SUBST(DBUS_CFLAGS) + AC_SUBST(DBUS_LIBS) +]) +AM_CONDITIONAL(DBUS, [test "$with_dbus" = yes]) + +AS_IF([test "$enable_plugins" != no],[ + AC_CHECK_FUNCS(lsetxattr, [], [], [#include ]) +]) +AM_CONDITIONAL(IMA, [test "x$ac_cv_func_lsetxattr" = xyes]) with_dmalloc=no AC_ARG_WITH(dmalloc, [AS_HELP_STRING([--with-dmalloc],[build with dmalloc debugging support])]) @@ -821,7 +1062,10 @@ if test "$with_dmalloc" = yes ; then LIBS="$LIBS -ldmalloc" fi -AC_CHECK_FUNCS(getpassphrase) +user_with_uid0=$(awk -F: '$3==0 {print $1;exit}' /etc/passwd) +group_with_gid0=$(awk -F: '$3==0 {print $1;exit}' /etc/group) +AC_DEFINE_UNQUOTED([UID_0_USER],["$user_with_uid0"],[Get the user name having userid 0]) +AC_DEFINE_UNQUOTED([GID_0_GROUP],["$group_with_gid0"],[Get the group name having groupid 0]) # # get rid of the 4-th tuple, if config.guess returned "linux-gnu" for host_os @@ -830,6 +1074,10 @@ host_os_gnu=-gnu if echo "$host_os" | grep '.*-gnulibc1' > /dev/null ; then host_os=`echo "${host_os}" | sed 's/-gnulibc1$//'` fi +if echo "$host_os" | grep '.*-gnueabihf' > /dev/null ; then + host_os=`echo "${host_os}" | sed 's/-gnueabihf$//'` + host_os_gnu=-gnueabihf +fi if echo "$host_os" | grep '.*-gnueabi' > /dev/null ; then host_os=`echo "${host_os}" | sed 's/-gnueabi$//'` host_os_gnu=-gnueabi @@ -837,6 +1085,9 @@ fi if echo "$host_os" | grep '.*-gnu' > /dev/null ; then host_os=`echo "${host_os}" | sed 's/-gnu$//'` fi +if echo "$host_os" | grep '.*-uclibc' > /dev/null ; then + host_os=`echo "${host_os}" | sed 's/-uclibc$//'` +fi changequote(<, >) host_os_exact="${host_os}" @@ -882,13 +1133,26 @@ AC_SUBST(RPMCANONVENDOR) AC_SUBST(RPMCANONOS) AC_SUBST(RPMCANONGNU) +RUNDIR="/run" +AC_ARG_WITH([rundir], + AS_HELP_STRING([--with-rundir=RUNDIR], [specify run-time variable directory]), + [RUNDIR=$withval]) +AC_DEFINE_UNQUOTED([RUNDIR],["${RUNDIR}"],[run-time variable directory]) +AC_SUBST(RUNDIR) + if test X"$prefix" = XNONE ; then usrprefix="$ac_default_prefix" else usrprefix=$prefix fi -RPMCONFIGDIR="`echo ${libdir}/rpm`" +RPMCONFIGDIR= +AC_ARG_WITH([rpmconfigdir], + [AS_HELP_STRING([--with-rpmconfigdir], + [Set up rpm config not into /usr/lib/rpm @<:@default=check@:>@])], + [RPMCONFIGDIR=$withval], + [RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"]) + AC_SUBST(RPMCONFIGDIR) AC_SUBST(OBJDUMP) @@ -901,14 +1165,6 @@ AM_CONDITIONAL([WITH_INTERNAL_DB],[test "$with_external_db" = no]) AM_CONDITIONAL([DOXYGEN],[test "$DOXYGEN" != no]) AM_CONDITIONAL([HACKINGDOCS],[test "$with_hackingdocs" = yes]) -AC_ARG_VAR([PYTHON_MODULENAME], [Name of the rpm python module. Defaults to 'rpm']) -if test X"$PYTHON_MODULENAME" = X ; then - PYTHON_MODULENAME="$PACKAGE" -fi -AC_DEFINE_UNQUOTED(PYTHON_MODULENAME, ["$PYTHON_MODULENAME"],[python module name]) -AC_SUBST(PYTHON_MODULENAME) - - AC_PATH_PROG(AUTOM4TE,autom4te,:) AC_SUBST([dirstamp],[\${am__leading_dot}dirstamp]) @@ -919,8 +1175,6 @@ AC_CONFIG_FILES([Makefile misc/Makefile doc/Makefile python/Makefile - python/rpm/__init__.py - python/rpm/transaction.py luaext/Makefile tests/Makefile plugins/Makefile -- cgit v1.2.3