diff --git a/configure.ac b/configure.ac index e1ec7a0..352b07e 100644 --- a/configure.ac +++ b/configure.ac @@ -1,467 +1,466 @@ # configure.ac for GPA # Copyright (C) 2000, 2001 Werner Koch # Copyright (C) 2002, 2003, 2004 Miguel Coca # Copyright (C) 2005-2016 g10 Code GmbH # # This file is part of GPA. # # GPA is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation; either version 3 of the License, or (at your # option) any later version. # # GPA is distributed in the hope that it will be useful but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public # License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # (Process this file with autoconf to produce a configure script.) AC_PREREQ([2.61]) min_automake_version="1.10" # To build a release you need to create a tag with the version number # (git tag -s pinentry-n.m.k) and run "./autogen.sh --force". Please # bump the version number immediately after the release and do another # commit and push so that the git magic is able to work. m4_define([mym4_package],[gpa]) m4_define([mym4_major], [0]) m4_define([mym4_minor], [11]) m4_define([mym4_micro], [0]) # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a # flag indicating a development version (mym4_isbeta). Note that the # m4 processing is done by autoconf and not during the configure run. m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \ mym4_package mym4_major mym4_minor mym4_micro),[:])) m4_define([mym4_isbeta], m4_argn(2, mym4_verslist)) m4_define([mym4_version], m4_argn(4, mym4_verslist)) m4_define([mym4_revision], m4_argn(7, mym4_verslist)) m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist)) m4_esyscmd([echo ]mym4_version[>VERSION]) AC_INIT([mym4_package],[mym4_version],[https://bugs.gnupg.org]) NEED_GPG_ERROR_VERSION=1.27 NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_VERSION=2.4.2 NEED_GPGME_API=1 NEED_GPGME_VERSION=1.9.0 AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_SRCDIR(src/gpa.c) AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip]) PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION AC_SUBST(PACKAGE) AC_SUBST(VERSION) AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package]) AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT", [address for reporting bugs]) have_gpg_error=no have_gpgme=no have_libassuan=no # # Provide information about the build. # BUILD_REVISION="mym4_revision" AC_SUBST(BUILD_REVISION) AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION", [GIT commit id revision used to build this package]) changequote(,)dnl BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` changequote([,])dnl BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec" AC_SUBST(BUILD_FILEVERSION) BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date` AC_SUBST(BUILD_TIMESTAMP) AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP", [The time this package was configured for a build]) AC_USE_SYSTEM_EXTENSIONS AH_BOTTOM([ /* We don't want the old assuan codes anymore. */ #define _ASSUAN_ONLY_GPG_ERRORS 1 #include "gpadefs.h" ]) AM_MAINTAINER_MODE AM_SILENT_RULES dnl Check for libraries AC_CHECK_LIB(m, sin) CHECK_ZLIB AC_CHECK_FUNCS([strsep stpcpy]) development_version=no # Allow users to append something to the version string (other than -cvs) # without flagging it as development version. The user version parts is # considered everything after a dash. if test "$development_version" != yes; then changequote(,)dnl tmp_pat='[a-zA-Z]' changequote([,])dnl if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null || echo "$VERSION" | grep -- "-cvs$" >/dev/null; then development_version=yes fi fi if test "$development_version" = yes; then AC_DEFINE(IS_DEVELOPMENT_VERSION,1, [Defined if this is not a regular release]) fi # Define HAVE_W32_SYSTEM as an alternative to the other macros which # might led the naive reader assume that W32 is actually a win. Also # needed later to enable certain gcc options. have_w32_system=no case "${host}" in *-mingw32*) have_w32_system=yes ;; esac if test "$have_w32_system" = yes; then AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system]) fi AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes) dnl dnl Checks for programs dnl AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) AC_PROG_CC AC_SEARCH_LIBS([strerror],[cposix]) -AC_HEADER_STDC AC_PROG_RANLIB AC_CHECK_TOOL(WINDRES, windres, :) # # Options to disable features # card_manager=yes AC_MSG_CHECKING([whether to build the card manager]) AC_ARG_ENABLE(card-manager, AS_HELP_STRING([--disable-card-manager], [build without the card manager]), card_manager=$enableval) AC_MSG_RESULT($card_manager) if test "$card_manager" = yes ; then AC_DEFINE(ENABLE_CARD_MANAGER, 1, [Include the card manager in the build]) fi AM_CONDITIONAL(ENABLE_CARD_MANAGER, test "$card_manager" = yes) keyserver_support=yes AC_MSG_CHECKING([whether to include keyserver support]) AC_ARG_ENABLE(keyserver-support, AS_HELP_STRING([--disable-keyserver-support], [build without keyserver support]), keyserver_support=$enableval) AC_MSG_RESULT($keyserver_support) if test "$keyserver_support" = yes ; then AC_DEFINE(ENABLE_KEYSERVER_SUPPORT, 1, [Include keyserver support in the build]) fi AM_CONDITIONAL(ENABLE_KEYSERVER_SUPPORT, test "$keyserver_support" = yes) # # Find the keyserver plugins. Assume that gpgkeys_ldap is always available # if test "$keyserver_support" = yes ; then AC_PATH_PROGS(GPGKEYS_LDAP, gpg2keys_ldap gpgkeys_ldap, [${libexecdir}/gnupg/gpg2keys_ldap], [$PATH:/usr/libexec/gnupg:/usr/lib/gnupg2:/usr/lib/gnupg]) KEYSERVER_HELPERS_DIR=`dirname $GPGKEYS_LDAP` if test -z "$KEYSERVER_HELPERS_DIR"; then AC_MSG_ERROR([[ *** *** Keyserver helpers not found. They should be contained in the GnuPG package. *** ]]) fi AC_DEFINE_UNQUOTED(KEYSERVER_HELPERS_DIR, "$KEYSERVER_HELPERS_DIR", [Path to keyserver helper tools]) fi dnl dnl Checks for compiler features dnl dnl dnl Checks for libraries dnl NETLIBS= if test "$have_w32_system" = yes; then NETLIBS="${NETLIBS} -lws2_32" fi AC_SUBST(NETLIBS) AM_PO_SUBDIRS AM_GNU_GETTEXT_VERSION([0.18.1]) AM_GNU_GETTEXT([external],[need-ngettext]) dnl Where is the GTK+ toolkit -AM_PATH_GTK_3_0(3.0.0,, AC_MSG_ERROR(Cannot find GTK+ 3.0)) +PKG_CHECK_MODULES([GTK], [gtk+-3.0]) # # The GnuPG shared error codes library. # AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION", have_gpg_error=yes,have_gpg_error=no) AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, 12, [The default error source for GPA.]) # # Libassuan is the IPC library used for the server mode # AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION", have_libassuan=yes,have_libassuan=no) # We need this for GPGME AC_SYS_LARGEFILE # # Depending on the OS we need to test for different versions of gpgme. # _AM_PATH_GPGME_CONFIG if test "$have_w32_system" = yes; then AM_PATH_GPGME_GLIB("$NEED_GPGME_API:$NEED_GPGME_VERSION", have_gpgme=yes,have_gpgme=no) GPGME_LIBS="$GPGME_GLIB_LIBS" GPGME_CFLAGS="$GPGME_GLIB_CFLAGS" AC_SUBST(GPGME_CFLAGS) AC_SUBST(GPGME_LIBS) else AM_PATH_GPGME("$NEED_GPGME_API:$NEED_GPGME_VERSION", have_gpgme=yes,have_gpgme=no) fi _save_libs=$LIBS _save_cflags=$CFLAGS LIBS="$LIBS $GPGME_LIBS" CFLAGS="$CFLAGS $GPGME_CFLAGS" AC_CHECK_FUNCS([gpgme_data_identify]) LIBS=$_save_libs CFLAGS="$_save_cflags" dnl The tests below are not anymore used because we now depend on a dnl gpgme which has all these features. However, I keep the code here dnl for future work. dnl dnl _save_libs=$LIBS dnl _save_cflags=$CFLAGS dnl LIBS="$LIBS $GPGME_LIBS" dnl CFLAGS="$CFLAGS $GPGME_CFLAGS" dnl AC_CHECK_FUNCS([gpgme_op_assuan_transact]) dnl AC_CHECK_FUNCS([gpgme_io_write]) dnl # Fixme: We should write a test based on gpgme_subkey_t dnl # We might even want to put such a test into gpgme.m4. dnl AC_CHECK_MEMBERS([struct _gpgme_subkey.card_number],,,[#include ]) dnl LIBS=$_save_libs dnl CFLAGS="$_save_cflags" dnl # We build the card manager only if we have a decent libgpgme. */ dnl if test "x$ac_cv_func_gpgme_op_assuan_transact" = "xyes"; then dnl AC_DEFINE(BUILD_CARD_MANAGER, 1, dnl [Defined if the card manager shall be build.]) dnl fi dnl AM_CONDITIONAL(BUILD_CARD_MANAGER, dnl test "x$ac_cv_func_gpgme_op_assuan_transact" = "xyes") # # Checks for header files. # AC_MSG_NOTICE([checking for header files]) AC_CHECK_HEADERS([locale.h]) # # Checks for typedefs and structures # AC_CHECK_TYPES([byte, ushort, ulong, u16, u32]) # # Check for library functions # # See whether libc supports the Linux inotify interface case "${host}" in *-*-linux*) AC_CHECK_FUNCS([inotify_init]) ;; esac # # Set extra compiler flags # AC_MSG_NOTICE([checking for cc features]) if test "$GCC" = yes; then if test "$USE_MAINTAINER_MODE" = "yes"; then # # Enable all kinds of warnings. # CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes" CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security" AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers]) _gcc_cflags_save=$CFLAGS CFLAGS="-Wno-missing-field-initializers" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no) AC_MSG_RESULT($_gcc_wopt) CFLAGS=$_gcc_cflags_save; if test x"$_gcc_wopt" = xyes ; then CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers" fi AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement]) _gcc_cflags_save=$CFLAGS CFLAGS="-Wdeclaration-after-statement" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no) AC_MSG_RESULT($_gcc_wopt) CFLAGS=$_gcc_cflags_save; if test x"$_gcc_wopt" = xyes ; then CFLAGS="$CFLAGS -Wdeclaration-after-statement" fi # We should keep -Wstrict-prototypes here. However, it causes # too many warnings in gtkitemfactory.h:51 (see comment over # there). This might be solved with GTK 3. AC_MSG_CHECKING([if gcc supports -Wno-strict-prototypes]) _gcc_cflags_save=$CFLAGS CFLAGS="-Wno-strict-prototypes" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no) AC_MSG_RESULT($_gcc_wopt) CFLAGS=$_gcc_cflags_save; if test x"$_gcc_wopt" = xyes ; then CFLAGS="$CFLAGS -Wno-strict-prototypes" fi else CFLAGS="$CFLAGS -Wall" fi AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign]) _gcc_cflags_save=$CFLAGS CFLAGS="-Wno-pointer-sign" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no) AC_MSG_RESULT($_gcc_wopt) CFLAGS=$_gcc_cflags_save; if test x"$_gcc_wopt" = xyes ; then CFLAGS="$CFLAGS -Wno-pointer-sign" fi AC_MSG_CHECKING([if gcc supports -Wno-unused-parameter]) _gcc_cflags_save=$CFLAGS CFLAGS="-Wno-unused-parameter" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no) AC_MSG_RESULT($_gcc_wopt) CFLAGS=$_gcc_cflags_save; if test x"$_gcc_wopt" = xyes ; then CFLAGS="$CFLAGS -Wno-unused-parameter" fi # We need to use ms-bitfields. if test "$have_w32_system" = yes; then CFLAGS="$CFLAGS -mms-bitfields" fi fi # # Define name strings AC_DEFINE_UNQUOTED(GPA_NAME, "GPA", [The name of this program]) AC_DEFINE_UNQUOTED(GPA_LONG_NAME, "GNU Privacy Assistant", [The spelled out name of this program]) # # Print errors here so that they are visible all # together and the user can acquire them all together. # die=no if test "$have_gpg_error" = "no"; then die=yes AC_MSG_NOTICE([[ *** *** You need libgpg-error to build this program. ** This library is for example available at *** ftp://ftp.gnupg.org/gcrypt/libgpg-error *** (at least version $NEED_GPG_ERROR_VERSION is required.) ***]]) fi if test "$have_gpgme" = "no"; then die=yes AC_MSG_NOTICE([[ *** *** You need gpgme to build this program. ** This library is for example available at *** ftp://ftp.gnupg.org/gcrypt/gpgme/ *** (at least version $NEED_GPGME_VERSION is required.) ***]]) fi if test "$have_libassuan" = "no"; then die=yes AC_MSG_NOTICE([[ *** *** You need libassuan to build this program. *** This library is for example available at *** ftp://ftp.gnupg.org/gcrypt/libassuan/ *** (at least version $NEED_LIBASSUAN_VERSION is required). ***]]) fi if test "$die" = "yes"; then AC_MSG_ERROR([[ *** *** Required libraries not found. Please consult the above messages *** and install them before running configure again. ***]]) fi AC_CONFIG_FILES([ m4/Makefile Makefile po/Makefile.in src/Makefile src/versioninfo.rc doc/Makefile ]) AC_OUTPUT echo " GPA v${VERSION} has been configured as follows: Revision: mym4_revision (mym4_revision_dec) Platform: $host " diff --git a/m4/gpg-error.m4 b/m4/gpg-error.m4 index 56a5d07..908e604 100644 --- a/m4/gpg-error.m4 +++ b/m4/gpg-error.m4 @@ -1,207 +1,227 @@ # gpg-error.m4 - autoconf macro to detect libgpg-error. -# Copyright (C) 2002, 2003, 2004, 2011, 2014, 2018, 2020, 2021 +# Copyright (C) 2002, 2003, 2004, 2011, 2014, 2018, 2020, 2021, 2022 # g10 Code GmbH # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This file is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2021-03-31 +# Last-changed: 2022-11-15 - -dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, -dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl -dnl Test for libgpg-error and define GPG_ERROR_CFLAGS, GPG_ERROR_LIBS, -dnl GPG_ERROR_MT_CFLAGS, and GPG_ERROR_MT_LIBS. The _MT_ variants are -dnl used for programs requireing real multi thread support. +dnl Find gpg-error-config, for backward compatibility dnl -dnl If a prefix option is not used, the config script is first -dnl searched in $SYSROOT/bin and then along $PATH. If the used -dnl config script does not match the host specification the script -dnl is added to the gpg_config_script_warn variable. -dnl -AC_DEFUN([AM_PATH_GPG_ERROR], -[ AC_REQUIRE([AC_CANONICAL_HOST]) +dnl _AM_PATH_POSSIBLE_GPG_ERROR_CONFIG +AC_DEFUN([_AM_PATH_POSSIBLE_GPG_ERROR_CONFIG],[dnl gpg_error_config_prefix="" dnl --with-libgpg-error-prefix=PFX is the preferred name for this option, dnl since that is consistent with how our three siblings use the directory/ dnl package name in --with-$dir_name-prefix=PFX. AC_ARG_WITH(libgpg-error-prefix, AS_HELP_STRING([--with-libgpg-error-prefix=PFX], [prefix where GPG Error is installed (optional)]), [gpg_error_config_prefix="$withval"]) dnl Accept --with-gpg-error-prefix and make it work the same as dnl --with-libgpg-error-prefix above, for backwards compatibility, dnl but do not document this old, inconsistently-named option. AC_ARG_WITH(gpg-error-prefix,, [gpg_error_config_prefix="$withval"]) if test x"${GPG_ERROR_CONFIG}" = x ; then if test x"${gpg_error_config_prefix}" != x ; then GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config" else case "${SYSROOT}" in /*) if test -x "${SYSROOT}/bin/gpg-error-config" ; then GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config" fi ;; '') ;; *) AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) ;; esac fi fi AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) - min_gpg_error_version=ifelse([$1], ,1.33,$1) - ok=no +]) +dnl +dnl Find gpgrt-config, which uses .pc file +dnl (minimum pkg-config functionality, supporting cross build) +dnl +dnl _AM_PATH_GPGRT_CONFIG +AC_DEFUN([_AM_PATH_GPGRT_CONFIG],[dnl AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no, [$prefix/bin:$PATH]) if test "$GPGRT_CONFIG" != "no"; then # Determine gpgrt_libdir # # Get the prefix of gpgrt-config assuming it's something like: # /bin/gpgrt-config gpgrt_prefix=${GPGRT_CONFIG%/*/*} possible_libdir1=${gpgrt_prefix}/lib # Determine by using system libdir-format with CC, it's like: # Normal style: /usr/lib # GNU cross style: /usr//lib # Debian style: /usr/lib/ # Fedora/openSUSE style: /usr/lib, /usr/lib32 or /usr/lib64 # It is assumed that CC is specified to the one of host on cross build. if libdir_candidates=$(${CC:-cc} -print-search-dirs | \ sed -n -e "/^libraries/{s/libraries: =//;s/:/\\ /g;p;}"); then # From the output of -print-search-dirs, select valid pkgconfig dirs. libdir_candidates=$(for dir in $libdir_candidates; do if p=$(cd $dir 2>/dev/null && pwd); then test -d "$p/pkgconfig" && echo $p; fi done) for possible_libdir0 in $libdir_candidates; do # possible_libdir0: # Fallback candidate, the one of system-installed (by $CC) # (/usr//lib, /usr/lib/ or /usr/lib32) # possible_libdir1: # Another candidate, user-locally-installed # (/lib) # possible_libdir2 # Most preferred # (//lib, # /lib/ or /lib32) if test "${possible_libdir0##*/}" = "lib"; then possible_prefix0=${possible_libdir0%/lib} possible_prefix0_triplet=${possible_prefix0##*/} if test -z "$possible_prefix0_triplet"; then continue fi possible_libdir2=${gpgrt_prefix}/$possible_prefix0_triplet/lib else possible_prefix0=${possible_libdir0%%/lib*} possible_libdir2=${gpgrt_prefix}${possible_libdir0#$possible_prefix0} fi if test -f ${possible_libdir2}/pkgconfig/gpg-error.pc; then gpgrt_libdir=${possible_libdir2} elif test -f ${possible_libdir1}/pkgconfig/gpg-error.pc; then gpgrt_libdir=${possible_libdir1} elif test -f ${possible_libdir0}/pkgconfig/gpg-error.pc; then gpgrt_libdir=${possible_libdir0} fi if test -n "$gpgrt_libdir"; then break; fi done + if test -z "$libdir_candidates"; then + # No valid pkgconfig dir in any of the system directories, fallback + gpgrt_libdir=${possible_libdir1} + fi else # When we cannot determine system libdir-format, use this: gpgrt_libdir=${possible_libdir1} fi else unset GPGRT_CONFIG fi if test -n "$gpgrt_libdir"; then GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` else unset GPGRT_CONFIG fi elif test "$GPG_ERROR_CONFIG" != "no"; then gpg_error_config_version=`$GPG_ERROR_CONFIG --version` + unset GPGRT_CONFIG fi +]) + +dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl +dnl Test for libgpg-error and define GPG_ERROR_CFLAGS, GPG_ERROR_LIBS, +dnl GPG_ERROR_MT_CFLAGS, and GPG_ERROR_MT_LIBS. The _MT_ variants are +dnl used for programs requireing real multi thread support. +dnl +dnl If a prefix option is not used, the config script is first +dnl searched in $SYSROOT/bin and then along $PATH. If the used +dnl config script does not match the host specification the script +dnl is added to the gpg_config_script_warn variable. +dnl +AC_DEFUN([AM_PATH_GPG_ERROR],[dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([_AM_PATH_POSSIBLE_GPG_ERROR_CONFIG])dnl +AC_REQUIRE([_AM_PATH_GPGRT_CONFIG])dnl + min_gpg_error_version=ifelse([$1], ,1.33,$1) + ok=no if test "$GPG_ERROR_CONFIG" != "no"; then req_major=`echo $min_gpg_error_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_gpg_error_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` major=`echo $gpg_error_config_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` minor=`echo $gpg_error_config_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` if test "$major" -gt "$req_major"; then ok=yes else if test "$major" -eq "$req_major"; then if test "$minor" -ge "$req_minor"; then ok=yes fi fi fi fi AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs` if test -z "$GPGRT_CONFIG"; then GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null` GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null` else GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --variable=mtcflags 2>/dev/null` GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS${GPG_ERROR_CFLAGS:+ }$GPG_ERROR_MT_CFLAGS" GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --variable=mtlibs 2>/dev/null` GPG_ERROR_MT_LIBS="$GPG_ERROR_LIBS${GPG_ERROR_LIBS:+ }$GPG_ERROR_MT_LIBS" fi AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) if test -z "$GPGRT_CONFIG"; then gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none` else gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none` fi if test x"$gpg_error_config_host" != xnone ; then if test x"$gpg_error_config_host" != x"$host" ; then AC_MSG_WARN([[ *** *** The config script "$GPG_ERROR_CONFIG" was *** built for $gpg_error_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-libgpg-error-prefix *** to specify a matching config script or use \$SYSROOT. ***]]) gpg_config_script_warn="$gpg_config_script_warn libgpg-error" fi fi else GPG_ERROR_CFLAGS="" GPG_ERROR_LIBS="" GPG_ERROR_MT_CFLAGS="" GPG_ERROR_MT_LIBS="" AC_MSG_RESULT(no) ifelse([$3], , :, [$3]) fi AC_SUBST(GPG_ERROR_CFLAGS) AC_SUBST(GPG_ERROR_LIBS) AC_SUBST(GPG_ERROR_MT_CFLAGS) AC_SUBST(GPG_ERROR_MT_LIBS) ]) diff --git a/m4/gpgme.m4 b/m4/gpgme.m4 index c749a5d..363a84f 100644 --- a/m4/gpgme.m4 +++ b/m4/gpgme.m4 @@ -1,321 +1,410 @@ # gpgme.m4 - autoconf macro to detect GPGME. -# Copyright (C) 2002, 2003, 2004, 2014, 2018 g10 Code GmbH +# Copyright (C) 2002, 2003, 2004, 2014, 2018, 2022 g10 Code GmbH # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # # This file is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Last-changed: 2020-11-20 +# Last-changed: 2022-11-15 -AC_DEFUN([_AM_PATH_GPGME_CONFIG], -[ AC_ARG_WITH(gpgme-prefix, - AS_HELP_STRING([--with-gpgme-prefix=PFX], - [prefix where GPGME is installed (optional)]), +dnl +dnl Find gpgrt-config, which uses .pc file +dnl (minimum pkg-config functionality, supporting cross build) +dnl +dnl _AM_PATH_GPGRT_CONFIG +AC_DEFUN([_AM_PATH_GPGRT_CONFIG],[dnl + AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no, [$prefix/bin:$PATH]) + if test "$GPGRT_CONFIG" != "no"; then + # Determine gpgrt_libdir + # + # Get the prefix of gpgrt-config assuming it's something like: + # /bin/gpgrt-config + gpgrt_prefix=${GPGRT_CONFIG%/*/*} + possible_libdir1=${gpgrt_prefix}/lib + # Determine by using system libdir-format with CC, it's like: + # Normal style: /usr/lib + # GNU cross style: /usr//lib + # Debian style: /usr/lib/ + # Fedora/openSUSE style: /usr/lib, /usr/lib32 or /usr/lib64 + # It is assumed that CC is specified to the one of host on cross build. + if libdir_candidates=$(${CC:-cc} -print-search-dirs | \ + sed -n -e "/^libraries/{s/libraries: =//;s/:/\\ +/g;p;}"); then + # From the output of -print-search-dirs, select valid pkgconfig dirs. + libdir_candidates=$(for dir in $libdir_candidates; do + if p=$(cd $dir 2>/dev/null && pwd); then + test -d "$p/pkgconfig" && echo $p; + fi + done) + + for possible_libdir0 in $libdir_candidates; do + # possible_libdir0: + # Fallback candidate, the one of system-installed (by $CC) + # (/usr//lib, /usr/lib/ or /usr/lib32) + # possible_libdir1: + # Another candidate, user-locally-installed + # (/lib) + # possible_libdir2 + # Most preferred + # (//lib, + # /lib/ or /lib32) + if test "${possible_libdir0##*/}" = "lib"; then + possible_prefix0=${possible_libdir0%/lib} + possible_prefix0_triplet=${possible_prefix0##*/} + if test -z "$possible_prefix0_triplet"; then + continue + fi + possible_libdir2=${gpgrt_prefix}/$possible_prefix0_triplet/lib + else + possible_prefix0=${possible_libdir0%%/lib*} + possible_libdir2=${gpgrt_prefix}${possible_libdir0#$possible_prefix0} + fi + if test -f ${possible_libdir2}/pkgconfig/gpg-error.pc; then + gpgrt_libdir=${possible_libdir2} + elif test -f ${possible_libdir1}/pkgconfig/gpg-error.pc; then + gpgrt_libdir=${possible_libdir1} + elif test -f ${possible_libdir0}/pkgconfig/gpg-error.pc; then + gpgrt_libdir=${possible_libdir0} + fi + if test -n "$gpgrt_libdir"; then break; fi + done + if test -z "$libdir_candidates"; then + # No valid pkgconfig dir in any of the system directories, fallback + gpgrt_libdir=${possible_libdir1} + fi + else + # When we cannot determine system libdir-format, use this: + gpgrt_libdir=${possible_libdir1} + fi + else + unset GPGRT_CONFIG + fi + + if test -n "$gpgrt_libdir"; then + GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir" + if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then + GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error" + AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config]) + gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion` + else + unset GPGRT_CONFIG + fi + elif test "$GPG_ERROR_CONFIG" != "no"; then + gpg_error_config_version=`$GPG_ERROR_CONFIG --version` + unset GPGRT_CONFIG + fi +]) + +AC_DEFUN([_AM_PATH_GPGME_CONFIG],[dnl +AC_REQUIRE([_AM_PATH_GPGRT_CONFIG])dnl + AC_ARG_WITH(gpgme-prefix, + AS_HELP_STRING([--with-gpgme-prefix=PFX], + [prefix where GPGME is installed (optional)]), gpgme_config_prefix="$withval", gpgme_config_prefix="") if test x"${GPGME_CONFIG}" = x ; then if test x"${gpgme_config_prefix}" != x ; then GPGME_CONFIG="${gpgme_config_prefix}/bin/gpgme-config" else case "${SYSROOT}" in /*) if test -x "${SYSROOT}/bin/gpgme-config" ; then GPGME_CONFIG="${SYSROOT}/bin/gpgme-config" fi ;; '') ;; *) AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) ;; esac fi fi use_gpgrt_config="" - if test x"${GPGME_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then + if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG gpgme --exists; then GPGME_CONFIG="$GPGRT_CONFIG gpgme" AC_MSG_NOTICE([Use gpgrt-config as gpgme-config]) use_gpgrt_config=yes fi fi if test -z "$use_gpgrt_config"; then AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) fi if test "$GPGME_CONFIG" != "no" ; then if test -z "$use_gpgrt_config"; then gpgme_version=`$GPGME_CONFIG --version` else gpgme_version=`$GPGME_CONFIG --modversion` fi fi gpgme_version_major=`echo $gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` gpgme_version_minor=`echo $gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` gpgme_version_micro=`echo $gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` ]) AC_DEFUN([_AM_PATH_GPGME_CONFIG_HOST_CHECK], [ if test -z "$use_gpgrt_config"; then gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none` else gpgme_config_host=`$GPGME_CONFIG --variable=host 2>/dev/null || echo none` fi if test x"$gpgme_config_host" != xnone ; then if test x"$gpgme_config_host" != x"$host" ; then AC_MSG_WARN([[ *** *** The config script "$GPGME_CONFIG" was *** built for $gpgme_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-gpgme-prefix *** to specify a matching config script or use \$SYSROOT. ***]]) gpg_config_script_warn="$gpg_config_script_warn gpgme" fi fi ]) dnl AM_PATH_GPGME([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS. dnl dnl If a prefix option is not used, the config script is first dnl searched in $SYSROOT/bin and then along $PATH. If the used dnl config script does not match the host specification the script dnl is added to the gpg_config_script_warn variable. dnl AC_DEFUN([AM_PATH_GPGME], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl tmp=ifelse([$1], ,1:0.4.2,$1) if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` else req_gpgme_api=0 min_gpgme_version="$tmp" fi AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then req_major=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` req_micro=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test "$gpgme_version_major" -gt "$req_major"; then ok=yes else if test "$gpgme_version_major" -eq "$req_major"; then if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes else if test "$gpgme_version_minor" -eq "$req_minor"; then if test "$gpgme_version_micro" -ge "$req_micro"; then ok=yes fi fi fi fi fi fi if test $ok = yes; then # If we have a recent GPGME, we should also check that the # API is compatible. if test "$req_gpgme_api" -gt 0 ; then if test -z "$use_gpgrt_config"; then tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` else tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0` fi if test "$tmp" -gt 0 ; then if test "$req_gpgme_api" -ne "$tmp" ; then ok=no fi fi fi fi if test $ok = yes; then GPGME_CFLAGS=`$GPGME_CONFIG --cflags` GPGME_LIBS=`$GPGME_CONFIG --libs` AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) _AM_PATH_GPGME_CONFIG_HOST_CHECK else GPGME_CFLAGS="" GPGME_LIBS="" AC_MSG_RESULT(no) ifelse([$3], , :, [$3]) fi AC_SUBST(GPGME_CFLAGS) AC_SUBST(GPGME_LIBS) ]) dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS dnl and GPGME_PTHREAD_LIBS. dnl AC_DEFUN([AM_PATH_GPGME_PTHREAD], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl tmp=ifelse([$1], ,1:0.4.2,$1) if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` else req_gpgme_api=0 min_gpgme_version="$tmp" fi AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then req_major=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` req_micro=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test "$gpgme_version_major" -gt "$req_major"; then ok=yes else if test "$gpgme_version_major" -eq "$req_major"; then if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes else if test "$gpgme_version_minor" -eq "$req_minor"; then if test "$gpgme_version_micro" -ge "$req_micro"; then ok=yes fi fi fi fi fi fi fi if test $ok = yes; then # If we have a recent GPGME, we should also check that the # API is compatible. if test "$req_gpgme_api" -gt 0 ; then tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` if test "$tmp" -gt 0 ; then if test "$req_gpgme_api" -ne "$tmp" ; then ok=no fi fi fi fi if test $ok = yes; then GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags` GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs` AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) _AM_PATH_GPGME_CONFIG_HOST_CHECK else GPGME_PTHREAD_CFLAGS="" GPGME_PTHREAD_LIBS="" AC_MSG_RESULT(no) ifelse([$3], , :, [$3]) fi AC_SUBST(GPGME_PTHREAD_CFLAGS) AC_SUBST(GPGME_PTHREAD_LIBS) ]) dnl AM_PATH_GPGME_GLIB([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libgpgme-glib and define GPGME_GLIB_CFLAGS and GPGME_GLIB_LIBS. dnl AC_DEFUN([AM_PATH_GPGME_GLIB], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl tmp=ifelse([$1], ,1:0.4.2,$1) if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` else req_gpgme_api=0 min_gpgme_version="$tmp" fi AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then req_major=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` req_micro=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test "$gpgme_version_major" -gt "$req_major"; then ok=yes else if test "$gpgme_version_major" -eq "$req_major"; then if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes else if test "$gpgme_version_minor" -eq "$req_minor"; then if test "$gpgme_version_micro" -ge "$req_micro"; then ok=yes fi fi fi fi fi fi if test $ok = yes; then # If we have a recent GPGME, we should also check that the # API is compatible. if test "$req_gpgme_api" -gt 0 ; then if test -z "$use_gpgrt_config"; then tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` else tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0` fi if test "$tmp" -gt 0 ; then if test "$req_gpgme_api" -ne "$tmp" ; then ok=no fi fi fi fi if test $ok = yes; then if test -z "$use_gpgrt_config"; then GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags` GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs` else if $GPGRT_CONFIG gpgme-glib --exists; then GPGME_CONFIG="$GPGRT_CONFIG gpgme-glib" GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --cflags` GPGME_GLIB_LIBS=`$GPGME_CONFIG --libs` else ok = no fi fi fi if test $ok = yes; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) _AM_PATH_GPGME_CONFIG_HOST_CHECK else GPGME_GLIB_CFLAGS="" GPGME_GLIB_LIBS="" AC_MSG_RESULT(no) ifelse([$3], , :, [$3]) fi AC_SUBST(GPGME_GLIB_CFLAGS) AC_SUBST(GPGME_GLIB_LIBS) ]) diff --git a/m4/libassuan.m4 b/m4/libassuan.m4 index df50484..79391bb 100644 --- a/m4/libassuan.m4 +++ b/m4/libassuan.m4 @@ -1,172 +1,172 @@ dnl Autoconf macros for libassuan dnl Copyright (C) 2002, 2003, 2011 Free Software Foundation, Inc. dnl dnl This file is free software; as a special exception the author gives dnl unlimited permission to copy and/or distribute it, with or without dnl modifications, as long as this notice is preserved. dnl dnl This file is distributed in the hope that it will be useful, but dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. dnl SPDX-License-Identifier: FSFULLR -# Last-changed: 2020-11-17 +# Last-changed: 2022-11-01 dnl dnl Common code used for libassuan detection [internal] dnl Returns ok set to yes or no. dnl AC_DEFUN([_AM_PATH_LIBASSUAN_COMMON], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_ARG_WITH(libassuan-prefix, AS_HELP_STRING([--with-libassuan-prefix=PFX], [prefix where LIBASSUAN is installed (optional)]), libassuan_config_prefix="$withval", libassuan_config_prefix="") if test x$libassuan_config_prefix != x ; then if test x${LIBASSUAN_CONFIG+set} != xset ; then LIBASSUAN_CONFIG=$libassuan_config_prefix/bin/libassuan-config fi fi use_gpgrt_config="" - if test x"${LIBASSUAN_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then + if test x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then if $GPGRT_CONFIG libassuan --exists; then LIBASSUAN_CONFIG="$GPGRT_CONFIG libassuan" AC_MSG_NOTICE([Use gpgrt-config as libassuan-config]) use_gpgrt_config=yes fi fi if test -z "$use_gpgrt_config"; then AC_PATH_PROG(LIBASSUAN_CONFIG, libassuan-config, no) fi tmp=ifelse([$1], ,1:0.9.2,$1) if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then req_libassuan_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` min_libassuan_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` else req_libassuan_api=0 min_libassuan_version="$tmp" fi AC_MSG_CHECKING(for LIBASSUAN - version >= $min_libassuan_version) ok=no if test "$LIBASSUAN_CONFIG" != "no"; then req_major=`echo $min_libassuan_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` req_minor=`echo $min_libassuan_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` req_micro=`echo $min_libassuan_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test -z "$use_gpgrt_config"; then libassuan_config_version=`$LIBASSUAN_CONFIG --version` else libassuan_config_version=`$LIBASSUAN_CONFIG --modversion` fi major=`echo $libassuan_config_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` minor=`echo $libassuan_config_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` micro=`echo $libassuan_config_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` if test "$major" -gt "$req_major"; then ok=yes else if test "$major" -eq "$req_major"; then if test "$minor" -gt "$req_minor"; then ok=yes else if test "$minor" -eq "$req_minor"; then if test "$micro" -ge "$req_micro"; then ok=yes fi fi fi fi fi fi if test $ok = yes; then AC_MSG_RESULT([yes ($libassuan_config_version)]) else AC_MSG_RESULT(no) fi if test $ok = yes; then if test "$req_libassuan_api" -gt 0 ; then if test -z "$use_gpgrt_config"; then tmp=`$LIBASSUAN_CONFIG --api-version 2>/dev/null || echo 0` else tmp=`$LIBASSUAN_CONFIG --variable=api_version 2>/dev/null || echo 0` fi if test "$tmp" -gt 0 ; then AC_MSG_CHECKING([LIBASSUAN API version]) if test "$req_libassuan_api" -eq "$tmp" ; then AC_MSG_RESULT(okay) else ok=no AC_MSG_RESULT([does not match. want=$req_libassuan_api got=$tmp.]) fi fi fi fi if test $ok = yes; then if test x"$host" != x ; then if test -z "$use_gpgrt_config"; then libassuan_config_host=`$LIBASSUAN_CONFIG --host 2>/dev/null || echo none` else libassuan_config_host=`$LIBASSUAN_CONFIG --variable=host 2>/dev/null || echo none` fi if test x"$libassuan_config_host" != xnone ; then if test x"$libassuan_config_host" != x"$host" ; then AC_MSG_WARN([[ *** *** The config script "$LIBASSUAN_CONFIG" was *** built for $libassuan_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-libassuan-prefix *** to specify a matching config script. ***]]) fi fi fi fi ]) dnl AM_CHECK_LIBASSUAN([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test whether libassuan has at least MINIMUM-VERSION. This is dnl used to test for features only available in newer versions. dnl AC_DEFUN([AM_CHECK_LIBASSUAN], [ _AM_PATH_LIBASSUAN_COMMON($1) if test $ok = yes; then ifelse([$2], , :, [$2]) else ifelse([$3], , :, [$3]) fi ]) dnl AM_PATH_LIBASSUAN([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libassuan and define LIBASSUAN_CFLAGS and LIBASSUAN_LIBS dnl AC_DEFUN([AM_PATH_LIBASSUAN], [ _AM_PATH_LIBASSUAN_COMMON($1) if test $ok = yes; then LIBASSUAN_CFLAGS=`$LIBASSUAN_CONFIG --cflags` LIBASSUAN_LIBS=`$LIBASSUAN_CONFIG --libs` ifelse([$2], , :, [$2]) else LIBASSUAN_CFLAGS="" LIBASSUAN_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(LIBASSUAN_CFLAGS) AC_SUBST(LIBASSUAN_LIBS) ]) diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 0000000..13a8890 --- /dev/null +++ b/m4/pkg.m4 @@ -0,0 +1,275 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) + +dnl Copyright © 2004 Scott James Remnant . +dnl Copyright © 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29.2]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes ], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $2]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed = untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=$PKG_CONFIG +PKG_CONFIG="$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable="][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR