"Fossies" - the Fresh Open Source Software Archive

Member "gpgme-1.15.1/src/gpgme.m4" (8 Jan 2021, 10608 Bytes) of package /linux/privat/gpgme-1.15.1.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 "gpgme.m4": 1.15.0_vs_1.15.1.

    1 # gpgme.m4 - autoconf macro to detect GPGME.
    2 # Copyright (C) 2002, 2003, 2004, 2014, 2018 g10 Code GmbH
    3 #
    4 # This file is free software; as a special exception the author gives
    5 # unlimited permission to copy and/or distribute it, with or without
    6 # modifications, as long as this notice is preserved.
    7 #
    8 # This file is distributed in the hope that it will be useful, but
    9 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
   10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   11 #
   12 # Last-changed: 2020-11-20
   13 
   14 
   15 AC_DEFUN([_AM_PATH_GPGME_CONFIG],
   16 [ AC_ARG_WITH(gpgme-prefix,
   17             AS_HELP_STRING([--with-gpgme-prefix=PFX],
   18                            [prefix where GPGME is installed (optional)]),
   19      gpgme_config_prefix="$withval", gpgme_config_prefix="")
   20   if test x"${GPGME_CONFIG}" = x ; then
   21      if test x"${gpgme_config_prefix}" != x ; then
   22         GPGME_CONFIG="${gpgme_config_prefix}/bin/gpgme-config"
   23      else
   24        case "${SYSROOT}" in
   25          /*)
   26            if test -x "${SYSROOT}/bin/gpgme-config" ; then
   27              GPGME_CONFIG="${SYSROOT}/bin/gpgme-config"
   28            fi
   29            ;;
   30          '')
   31            ;;
   32           *)
   33            AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
   34            ;;
   35        esac
   36      fi
   37   fi
   38 
   39   use_gpgrt_config=""
   40   if test x"${GPGME_CONFIG}" = x -a x"$GPGRT_CONFIG" != x -a "$GPGRT_CONFIG" != "no"; then
   41     if $GPGRT_CONFIG gpgme --exists; then
   42       GPGME_CONFIG="$GPGRT_CONFIG gpgme"
   43       AC_MSG_NOTICE([Use gpgrt-config as gpgme-config])
   44       use_gpgrt_config=yes
   45     fi
   46   fi
   47   if test -z "$use_gpgrt_config"; then
   48     AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
   49   fi
   50 
   51   if test "$GPGME_CONFIG" != "no" ; then
   52     if test -z "$use_gpgrt_config"; then
   53       gpgme_version=`$GPGME_CONFIG --version`
   54     else
   55       gpgme_version=`$GPGME_CONFIG --modversion`
   56     fi
   57   fi
   58   gpgme_version_major=`echo $gpgme_version | \
   59                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
   60   gpgme_version_minor=`echo $gpgme_version | \
   61                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
   62   gpgme_version_micro=`echo $gpgme_version | \
   63                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
   64 ])
   65 
   66 
   67 AC_DEFUN([_AM_PATH_GPGME_CONFIG_HOST_CHECK],
   68 [
   69     if test -z "$use_gpgrt_config"; then
   70       gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none`
   71     else
   72       gpgme_config_host=`$GPGME_CONFIG --variable=host 2>/dev/null || echo none`
   73     fi
   74     if test x"$gpgme_config_host" != xnone ; then
   75       if test x"$gpgme_config_host" != x"$host" ; then
   76   AC_MSG_WARN([[
   77 ***
   78 *** The config script "$GPGME_CONFIG" was
   79 *** built for $gpgme_config_host and thus may not match the
   80 *** used host $host.
   81 *** You may want to use the configure option --with-gpgme-prefix
   82 *** to specify a matching config script or use \$SYSROOT.
   83 ***]])
   84         gpg_config_script_warn="$gpg_config_script_warn gpgme"
   85       fi
   86     fi
   87 ])
   88 
   89 
   90 dnl AM_PATH_GPGME([MINIMUM-VERSION,
   91 dnl               [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
   92 dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS.
   93 dnl
   94 dnl If a prefix option is not used, the config script is first
   95 dnl searched in $SYSROOT/bin and then along $PATH.  If the used
   96 dnl config script does not match the host specification the script
   97 dnl is added to the gpg_config_script_warn variable.
   98 dnl
   99 AC_DEFUN([AM_PATH_GPGME],
  100 [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
  101   tmp=ifelse([$1], ,1:0.4.2,$1)
  102   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
  103      req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
  104      min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
  105   else
  106      req_gpgme_api=0
  107      min_gpgme_version="$tmp"
  108   fi
  109 
  110   AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
  111   ok=no
  112   if test "$GPGME_CONFIG" != "no" ; then
  113     req_major=`echo $min_gpgme_version | \
  114                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
  115     req_minor=`echo $min_gpgme_version | \
  116                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
  117     req_micro=`echo $min_gpgme_version | \
  118                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
  119     if test "$gpgme_version_major" -gt "$req_major"; then
  120         ok=yes
  121     else
  122         if test "$gpgme_version_major" -eq "$req_major"; then
  123             if test "$gpgme_version_minor" -gt "$req_minor"; then
  124                ok=yes
  125             else
  126                if test "$gpgme_version_minor" -eq "$req_minor"; then
  127                    if test "$gpgme_version_micro" -ge "$req_micro"; then
  128                      ok=yes
  129                    fi
  130                fi
  131             fi
  132         fi
  133     fi
  134   fi
  135   if test $ok = yes; then
  136      # If we have a recent GPGME, we should also check that the
  137      # API is compatible.
  138      if test "$req_gpgme_api" -gt 0 ; then
  139         if test -z "$use_gpgrt_config"; then
  140           tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
  141         else
  142           tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0`
  143         fi
  144         if test "$tmp" -gt 0 ; then
  145            if test "$req_gpgme_api" -ne "$tmp" ; then
  146              ok=no
  147            fi
  148         fi
  149      fi
  150   fi
  151   if test $ok = yes; then
  152     GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
  153     GPGME_LIBS=`$GPGME_CONFIG --libs`
  154     AC_MSG_RESULT(yes)
  155     ifelse([$2], , :, [$2])
  156     _AM_PATH_GPGME_CONFIG_HOST_CHECK
  157   else
  158     GPGME_CFLAGS=""
  159     GPGME_LIBS=""
  160     AC_MSG_RESULT(no)
  161     ifelse([$3], , :, [$3])
  162   fi
  163   AC_SUBST(GPGME_CFLAGS)
  164   AC_SUBST(GPGME_LIBS)
  165 ])
  166 
  167 dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION,
  168 dnl                       [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
  169 dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS
  170 dnl  and GPGME_PTHREAD_LIBS.
  171 dnl
  172 AC_DEFUN([AM_PATH_GPGME_PTHREAD],
  173 [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
  174   tmp=ifelse([$1], ,1:0.4.2,$1)
  175   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
  176      req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
  177      min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
  178   else
  179      req_gpgme_api=0
  180      min_gpgme_version="$tmp"
  181   fi
  182 
  183   AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version)
  184   ok=no
  185   if test "$GPGME_CONFIG" != "no" ; then
  186     if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
  187       req_major=`echo $min_gpgme_version | \
  188                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
  189       req_minor=`echo $min_gpgme_version | \
  190                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
  191       req_micro=`echo $min_gpgme_version | \
  192                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
  193       if test "$gpgme_version_major" -gt "$req_major"; then
  194         ok=yes
  195       else
  196         if test "$gpgme_version_major" -eq "$req_major"; then
  197           if test "$gpgme_version_minor" -gt "$req_minor"; then
  198             ok=yes
  199           else
  200             if test "$gpgme_version_minor" -eq "$req_minor"; then
  201               if test "$gpgme_version_micro" -ge "$req_micro"; then
  202                 ok=yes
  203               fi
  204             fi
  205           fi
  206         fi
  207       fi
  208     fi
  209   fi
  210   if test $ok = yes; then
  211      # If we have a recent GPGME, we should also check that the
  212      # API is compatible.
  213      if test "$req_gpgme_api" -gt 0 ; then
  214         tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
  215         if test "$tmp" -gt 0 ; then
  216            if test "$req_gpgme_api" -ne "$tmp" ; then
  217              ok=no
  218            fi
  219         fi
  220      fi
  221   fi
  222   if test $ok = yes; then
  223     GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
  224     GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
  225     AC_MSG_RESULT(yes)
  226     ifelse([$2], , :, [$2])
  227     _AM_PATH_GPGME_CONFIG_HOST_CHECK
  228   else
  229     GPGME_PTHREAD_CFLAGS=""
  230     GPGME_PTHREAD_LIBS=""
  231     AC_MSG_RESULT(no)
  232     ifelse([$3], , :, [$3])
  233   fi
  234   AC_SUBST(GPGME_PTHREAD_CFLAGS)
  235   AC_SUBST(GPGME_PTHREAD_LIBS)
  236 ])
  237 
  238 
  239 dnl AM_PATH_GPGME_GLIB([MINIMUM-VERSION,
  240 dnl               [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
  241 dnl Test for libgpgme-glib and define GPGME_GLIB_CFLAGS and GPGME_GLIB_LIBS.
  242 dnl
  243 AC_DEFUN([AM_PATH_GPGME_GLIB],
  244 [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
  245   tmp=ifelse([$1], ,1:0.4.2,$1)
  246   if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
  247      req_gpgme_api=`echo "$tmp"     | sed 's/\(.*\):\(.*\)/\1/'`
  248      min_gpgme_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
  249   else
  250      req_gpgme_api=0
  251      min_gpgme_version="$tmp"
  252   fi
  253 
  254   AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
  255   ok=no
  256   if test "$GPGME_CONFIG" != "no" ; then
  257     req_major=`echo $min_gpgme_version | \
  258                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
  259     req_minor=`echo $min_gpgme_version | \
  260                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
  261     req_micro=`echo $min_gpgme_version | \
  262                sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
  263     if test "$gpgme_version_major" -gt "$req_major"; then
  264         ok=yes
  265     else
  266         if test "$gpgme_version_major" -eq "$req_major"; then
  267             if test "$gpgme_version_minor" -gt "$req_minor"; then
  268                ok=yes
  269             else
  270                if test "$gpgme_version_minor" -eq "$req_minor"; then
  271                    if test "$gpgme_version_micro" -ge "$req_micro"; then
  272                      ok=yes
  273                    fi
  274                fi
  275             fi
  276         fi
  277     fi
  278   fi
  279   if test $ok = yes; then
  280      # If we have a recent GPGME, we should also check that the
  281      # API is compatible.
  282      if test "$req_gpgme_api" -gt 0 ; then
  283         if test -z "$use_gpgrt_config"; then
  284           tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
  285         else
  286           tmp=`$GPGME_CONFIG --variable=api_version 2>/dev/null || echo 0`
  287         fi
  288         if test "$tmp" -gt 0 ; then
  289            if test "$req_gpgme_api" -ne "$tmp" ; then
  290              ok=no
  291            fi
  292         fi
  293      fi
  294   fi
  295   if test $ok = yes; then
  296     if test -z "$use_gpgrt_config"; then
  297       GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
  298       GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
  299     else
  300       if $GPGRT_CONFIG gpgme-glib --exists; then
  301         GPGME_CONFIG="$GPGRT_CONFIG gpgme-glib"
  302         GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --cflags`
  303         GPGME_GLIB_LIBS=`$GPGME_CONFIG --libs`
  304       else
  305         ok = no
  306       fi
  307     fi
  308   fi
  309   if test $ok = yes; then
  310     AC_MSG_RESULT(yes)
  311     ifelse([$2], , :, [$2])
  312     _AM_PATH_GPGME_CONFIG_HOST_CHECK
  313   else
  314     GPGME_GLIB_CFLAGS=""
  315     GPGME_GLIB_LIBS=""
  316     AC_MSG_RESULT(no)
  317     ifelse([$3], , :, [$3])
  318   fi
  319   AC_SUBST(GPGME_GLIB_CFLAGS)
  320   AC_SUBST(GPGME_GLIB_LIBS)
  321 ])