1 dnl Autoconf macros for libgpgme
4 # Configure paths for GPGME
5 # Shamelessly stolen from the one of XDELTA by Owen Taylor
6 # Werner Koch 2000-11-17
8 dnl AM_PATH_GPGME([MINIMUM-VERSION,
9 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
10 dnl Test for gpgme, and define GPGME_CFLAGS and GPGME_LIBS
12 AC_DEFUN([AM_PATH_GPGME],
14 dnl Get the cflags and libraries from the gpgme-config script
16 AC_ARG_WITH(gpgme-prefix,
17 [ --with-gpgme-prefix=PFX Prefix where gpgme is installed (optional)],
18 gpgme_config_prefix="$withval", gpgme_config_prefix="")
19 AC_ARG_ENABLE(gpgmetest,
20 [ --disable-gpgmetest Do not try to compile and run a test gpgme program],
21 , enable_gpgmetest=yes)
23 if test x$gpgme_config_prefix != x ; then
24 gpgme_config_args="$gpgme_config_args --prefix=$gpgme_config_prefix"
25 if test x${GPGME_CONFIG+set} != xset ; then
26 GPGME_CONFIG=$gpgme_config_prefix/bin/gpgme-config
30 AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
31 min_gpgme_version=ifelse([$1], ,1.0.0,$1)
32 AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
34 if test "$GPGME_CONFIG" = "no" ; then
37 GPGME_CFLAGS=`$GPGME_CONFIG $gpgme_config_args --cflags`
38 GPGME_LIBS=`$GPGME_CONFIG $gpgme_config_args --libs`
39 gpgme_config_version=`$GPGME_CONFIG $gpgme_config_args --version`
40 if test "x$enable_gpgmetest" = "xyes" ; then
41 ac_save_CFLAGS="$CFLAGS"
43 CFLAGS="$CFLAGS $GPGME_CFLAGS"
44 LIBS="$LIBS $GPGME_LIBS"
46 dnl Now check if the installed gpgme is sufficiently new. Also sanity
47 dnl checks the results of gpgme-config to some extent
59 system ("touch conf.gpgmetest");
61 if( strcmp( gpgme_check_version(NULL), "$gpgme_config_version" ) )
64 "*** 'gpgme-config --version' returned %s, but GPGME (%s) was found!\n",
65 "$gpgme_config_version", gpgme_check_version(NULL) );
67 "*** If gpgme-config was correct, then it is best to remove the old\n"
68 "*** version of GPGME. You may also be able to fix the error\n"
69 "*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"
70 "*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"
71 "*** required on your system.\n"
72 "*** If gpgme-config was wrong, set the environment variable GPGME_CONFIG\n"
73 "*** to point to the correct copy of gpgme-config, \n"
74 "*** and remove the file config.cache before re-running configure\n"
77 else if ( strcmp(gpgme_check_version(NULL), GPGME_VERSION ) )
79 printf("\n*** GPGME header file (version %s) does not match\n",
81 printf("*** library (version %s)\n", gpgme_check_version(NULL) );
85 if ( gpgme_check_version( "$min_gpgme_version" ) )
88 "*** An old version of GPGME (%s) was found.\n", gpgme_check_version(NULL) );
90 "*** You need a version of GPGME newer than %s.\n", "$min_gpgme_version" );
92 "*** The latest version of GPGME is always available at\n"
93 "*** ftp://ftp.gnupg.org/pub/gcrypt/alpha/gpgme/\n"
95 "*** If you have already installed a sufficiently new version, this error\n"
96 "*** probably means that the wrong copy of the gpgme-config shell script is\n"
97 "*** being found. The easiest way to fix this is to remove the old version\n"
98 "*** of GPGME, but you can also set the GPGME_CONFIG environment to point to\n"
99 "*** the correct copy of gpgme-config. (In this case, you will have to\n"
100 "*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"
101 "*** so that the correct libraries are found at run-time).\n"
106 ],, no_gpgme=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
107 CFLAGS="$ac_save_CFLAGS"
111 if test "x$no_gpgme" = x ; then
113 ifelse([$2], , :, [$2])
115 if test -f conf.gpgmetest ; then
120 if test "$GPGME_CONFIG" = "no" ; then
121 echo "*** The gpgme-config script installed by GPGME could not be found"
122 echo "*** If GPGME was installed in PREFIX, make sure PREFIX/bin is in"
123 echo "*** your path, or set the GPGME_CONFIG environment variable to the"
124 echo "*** full path to gpgme-config."
126 if test -f conf.gpgmetest ; then
129 echo "*** Could not run gpgme test program, checking why..."
130 CFLAGS="$CFLAGS $GPGME_CFLAGS"
131 LIBS="$LIBS $GPGME_LIBS"
137 ], [ gpgme_check_version(NULL); return 0 ],
139 echo "*** The test program compiled, but did not run. This usually means"
140 echo "*** that the run-time linker is not finding GPGME or finding the wrong"
141 echo "*** version of GPGME. If it is not finding GPGME, you'll need to set your"
142 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
143 echo "*** to the installed location Also, make sure you have run ldconfig if"
144 echo "*** that is required on your system"
146 echo "*** If you have an old version installed, it is best to remove it,"
147 echo "*** although you may also be able to get things to work by"
148 echo "*** modifying LD_LIBRARY_PATH"
152 echo "*** The test program failed to compile or link. See the file config.log"
153 echo "*** for the exact error that occured. This usually means GPGME was"
154 echo "*** incorrectly installed or that you have moved GPGME since it was"
155 echo "*** installed. In the latter case, you may want to edit the"
156 echo "*** gpgme-config script: $GPGME_CONFIG"
158 CFLAGS="$ac_save_CFLAGS"
164 ifelse([$3], , :, [$3])
166 AC_SUBST(GPGME_CFLAGS)