"Fossies" - the Fresh Open Source Software Archive

Member "libksba-1.6.0/m4/gpg-error.m4" (18 May 2021, 8171 Bytes) of package /linux/privat/libksba-1.6.0.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "gpg-error.m4": 1.5.1_vs_1.6.0.

    1 # gpg-error.m4 - autoconf macro to detect libgpg-error.
    2 # Copyright (C) 2002, 2003, 2004, 2011, 2014, 2018, 2020, 2021
    3 #               g10 Code GmbH
    4 #
    5 # This file is free software; as a special exception the author gives
    6 # unlimited permission to copy and/or distribute it, with or without
    7 # modifications, as long as this notice is preserved.
    8 #
    9 # This file is distributed in the hope that it will be useful, but
   10 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
   11 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   12 #
   13 # Last-changed: 2021-03-31
   14 
   15 
   16 dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION,
   17 dnl                   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
   18 dnl
   19 dnl Test for libgpg-error and define GPG_ERROR_CFLAGS, GPG_ERROR_LIBS,
   20 dnl GPG_ERROR_MT_CFLAGS, and GPG_ERROR_MT_LIBS.  The _MT_ variants are
   21 dnl used for programs requireing real multi thread support.
   22 dnl
   23 dnl If a prefix option is not used, the config script is first
   24 dnl searched in $SYSROOT/bin and then along $PATH.  If the used
   25 dnl config script does not match the host specification the script
   26 dnl is added to the gpg_config_script_warn variable.
   27 dnl
   28 AC_DEFUN([AM_PATH_GPG_ERROR],
   29 [ AC_REQUIRE([AC_CANONICAL_HOST])
   30   gpg_error_config_prefix=""
   31   dnl --with-libgpg-error-prefix=PFX is the preferred name for this option,
   32   dnl since that is consistent with how our three siblings use the directory/
   33   dnl package name in --with-$dir_name-prefix=PFX.
   34   AC_ARG_WITH(libgpg-error-prefix,
   35               AS_HELP_STRING([--with-libgpg-error-prefix=PFX],
   36                              [prefix where GPG Error is installed (optional)]),
   37               [gpg_error_config_prefix="$withval"])
   38 
   39   dnl Accept --with-gpg-error-prefix and make it work the same as
   40   dnl --with-libgpg-error-prefix above, for backwards compatibility,
   41   dnl but do not document this old, inconsistently-named option.
   42   AC_ARG_WITH(gpg-error-prefix,,
   43               [gpg_error_config_prefix="$withval"])
   44 
   45   if test x"${GPG_ERROR_CONFIG}" = x ; then
   46      if test x"${gpg_error_config_prefix}" != x ; then
   47         GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config"
   48      else
   49        case "${SYSROOT}" in
   50          /*)
   51            if test -x "${SYSROOT}/bin/gpg-error-config" ; then
   52              GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config"
   53            fi
   54            ;;
   55          '')
   56            ;;
   57           *)
   58            AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
   59            ;;
   60        esac
   61      fi
   62   fi
   63 
   64   AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
   65   min_gpg_error_version=ifelse([$1], ,1.33,$1)
   66   ok=no
   67 
   68   AC_PATH_PROG(GPGRT_CONFIG, gpgrt-config, no, [$prefix/bin:$PATH])
   69   if test "$GPGRT_CONFIG" != "no"; then
   70     # Determine gpgrt_libdir
   71     #
   72     # Get the prefix of gpgrt-config assuming it's something like:
   73     #   <PREFIX>/bin/gpgrt-config
   74     gpgrt_prefix=${GPGRT_CONFIG%/*/*}
   75     possible_libdir1=${gpgrt_prefix}/lib
   76     # Determine by using system libdir-format with CC, it's like:
   77     #   Normal style: /usr/lib
   78     #   GNU cross style: /usr/<triplet>/lib
   79     #   Debian style: /usr/lib/<multiarch-name>
   80     #   Fedora/openSUSE style: /usr/lib, /usr/lib32 or /usr/lib64
   81     # It is assumed that CC is specified to the one of host on cross build.
   82     if libdir_candidates=$(${CC:-cc} -print-search-dirs | \
   83           sed -n -e "/^libraries/{s/libraries: =//;s/:/\\
   84 /g;p;}"); then
   85       # From the output of -print-search-dirs, select valid pkgconfig dirs.
   86       libdir_candidates=$(for dir in $libdir_candidates; do
   87         if p=$(cd $dir 2>/dev/null && pwd); then
   88           test -d "$p/pkgconfig" && echo $p;
   89         fi
   90       done)
   91 
   92       for possible_libdir0 in $libdir_candidates; do
   93         # possible_libdir0:
   94         #   Fallback candidate, the one of system-installed (by $CC)
   95         #   (/usr/<triplet>/lib, /usr/lib/<multiarch-name> or /usr/lib32)
   96         # possible_libdir1:
   97         #   Another candidate, user-locally-installed
   98         #   (<gpgrt_prefix>/lib)
   99         # possible_libdir2
  100         #   Most preferred
  101         #   (<gpgrt_prefix>/<triplet>/lib,
  102         #    <gpgrt_prefix>/lib/<multiarch-name> or <gpgrt_prefix>/lib32)
  103         if test "${possible_libdir0##*/}" = "lib"; then
  104           possible_prefix0=${possible_libdir0%/lib}
  105           possible_prefix0_triplet=${possible_prefix0##*/}
  106           if test -z "$possible_prefix0_triplet"; then
  107             continue
  108           fi
  109           possible_libdir2=${gpgrt_prefix}/$possible_prefix0_triplet/lib
  110         else
  111           possible_prefix0=${possible_libdir0%%/lib*}
  112           possible_libdir2=${gpgrt_prefix}${possible_libdir0#$possible_prefix0}
  113         fi
  114         if test -f ${possible_libdir2}/pkgconfig/gpg-error.pc; then
  115           gpgrt_libdir=${possible_libdir2}
  116         elif test -f ${possible_libdir1}/pkgconfig/gpg-error.pc; then
  117           gpgrt_libdir=${possible_libdir1}
  118         elif test -f ${possible_libdir0}/pkgconfig/gpg-error.pc; then
  119           gpgrt_libdir=${possible_libdir0}
  120         fi
  121         if test -n "$gpgrt_libdir"; then break; fi
  122       done
  123     else
  124       # When we cannot determine system libdir-format, use this:
  125       gpgrt_libdir=${possible_libdir1}
  126     fi
  127   else
  128     unset GPGRT_CONFIG
  129   fi
  130 
  131   if test -n "$gpgrt_libdir"; then
  132     GPGRT_CONFIG="$GPGRT_CONFIG --libdir=$gpgrt_libdir"
  133     if $GPGRT_CONFIG gpg-error >/dev/null 2>&1; then
  134       GPG_ERROR_CONFIG="$GPGRT_CONFIG gpg-error"
  135       AC_MSG_NOTICE([Use gpgrt-config with $gpgrt_libdir as gpg-error-config])
  136       gpg_error_config_version=`$GPG_ERROR_CONFIG --modversion`
  137     else
  138       unset GPGRT_CONFIG
  139     fi
  140   elif test "$GPG_ERROR_CONFIG" != "no"; then
  141     gpg_error_config_version=`$GPG_ERROR_CONFIG --version`
  142   fi
  143   if test "$GPG_ERROR_CONFIG" != "no"; then
  144     req_major=`echo $min_gpg_error_version | \
  145                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
  146     req_minor=`echo $min_gpg_error_version | \
  147                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
  148     major=`echo $gpg_error_config_version | \
  149                sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
  150     minor=`echo $gpg_error_config_version | \
  151                sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
  152     if test "$major" -gt "$req_major"; then
  153         ok=yes
  154     else
  155         if test "$major" -eq "$req_major"; then
  156             if test "$minor" -ge "$req_minor"; then
  157                ok=yes
  158             fi
  159         fi
  160     fi
  161   fi
  162   AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
  163   if test $ok = yes; then
  164     GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG --cflags`
  165     GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG --libs`
  166     if test -z "$GPGRT_CONFIG"; then
  167       GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --mt --cflags 2>/dev/null`
  168       GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --mt --libs 2>/dev/null`
  169     else
  170       GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG --variable=mtcflags 2>/dev/null`
  171       GPG_ERROR_MT_CFLAGS="$GPG_ERROR_CFLAGS${GPG_ERROR_CFLAGS:+ }$GPG_ERROR_MT_CFLAGS"
  172       GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG --variable=mtlibs 2>/dev/null`
  173       GPG_ERROR_MT_LIBS="$GPG_ERROR_LIBS${GPG_ERROR_LIBS:+ }$GPG_ERROR_MT_LIBS"
  174     fi
  175     AC_MSG_RESULT([yes ($gpg_error_config_version)])
  176     ifelse([$2], , :, [$2])
  177     if test -z "$GPGRT_CONFIG"; then
  178       gpg_error_config_host=`$GPG_ERROR_CONFIG --host 2>/dev/null || echo none`
  179     else
  180       gpg_error_config_host=`$GPG_ERROR_CONFIG --variable=host 2>/dev/null || echo none`
  181     fi
  182     if test x"$gpg_error_config_host" != xnone ; then
  183       if test x"$gpg_error_config_host" != x"$host" ; then
  184   AC_MSG_WARN([[
  185 ***
  186 *** The config script "$GPG_ERROR_CONFIG" was
  187 *** built for $gpg_error_config_host and thus may not match the
  188 *** used host $host.
  189 *** You may want to use the configure option --with-libgpg-error-prefix
  190 *** to specify a matching config script or use \$SYSROOT.
  191 ***]])
  192         gpg_config_script_warn="$gpg_config_script_warn libgpg-error"
  193       fi
  194     fi
  195   else
  196     GPG_ERROR_CFLAGS=""
  197     GPG_ERROR_LIBS=""
  198     GPG_ERROR_MT_CFLAGS=""
  199     GPG_ERROR_MT_LIBS=""
  200     AC_MSG_RESULT(no)
  201     ifelse([$3], , :, [$3])
  202   fi
  203   AC_SUBST(GPG_ERROR_CFLAGS)
  204   AC_SUBST(GPG_ERROR_LIBS)
  205   AC_SUBST(GPG_ERROR_MT_CFLAGS)
  206   AC_SUBST(GPG_ERROR_MT_LIBS)
  207 ])