1 dnl Autoconf macros for libgnutls
4 # Modified for mutt 20050210 Brendan Cully
5 # Modified for LIBGNUTLS -- nmav
6 # Configure paths for LIBGCRYPT
7 # Shamelessly stolen from the one of XDELTA by Owen Taylor
10 dnl MUTT_AM_PATH_GNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
11 dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
13 AC_DEFUN([MUTT_AM_PATH_GNUTLS],
15 dnl Get the cflags and libraries from the libgnutls-config script
17 libgnutls_config_prefix=$1
18 min_libgnutls_version=0.1.0
20 if test x$libgnutls_config_prefix != x ; then
21 if test x${LIBGNUTLS_CONFIG+set} != xset ; then
22 LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
26 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
27 AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
29 if test "$LIBGNUTLS_CONFIG" = "no" ; then
32 LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
33 LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
34 libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
37 ac_save_CFLAGS="$CFLAGS"
39 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
40 LIBS="$LIBS $LIBGNUTLS_LIBS"
43 dnl Now check if the installed libgnutls is sufficiently new. Also sanity
44 dnl checks the results of libgnutls-config to some extent
46 rm -f conf.libgnutlstest
51 #include <gnutls/gnutls.h>
56 system ("touch conf.libgnutlstest");
58 if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
60 printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
61 "$libgnutls_config_version", gnutls_check_version(NULL) );
62 printf("*** was found! If libgnutls-config was correct, then it is best\n");
63 printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
64 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
65 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
66 printf("*** required on your system.\n");
67 printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
68 printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
69 printf("*** before re-running configure\n");
71 else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
73 printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
74 printf("*** library (version %s)\n", gnutls_check_version(NULL) );
78 if ( gnutls_check_version( "$min_libgnutls_version" ) )
84 printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
85 gnutls_check_version(NULL) );
86 printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
87 "$min_libgnutls_version" );
88 printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
90 printf("*** If you have already installed a sufficiently new version, this error\n");
91 printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
92 printf("*** being found. The easiest way to fix this is to remove the old version\n");
93 printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
94 printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
95 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
96 printf("*** so that the correct libraries are found at run-time))\n");
101 ],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
102 CFLAGS="$ac_save_CFLAGS"
106 if test "x$no_libgnutls" = x ; then
108 dnl some openssl compatibility code was moved in gnutls 1.2
109 AC_CHECK_HEADERS([gnutls/openssl.h])
110 ifelse([$2], , :, [$2])
112 if test -f conf.libgnutlstest ; then
117 if test "$LIBGNUTLS_CONFIG" = "no" ; then
118 echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
119 echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
120 echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
121 echo "*** full path to libgnutls-config."
123 if test -f conf.libgnutlstest ; then
126 echo "*** Could not run libgnutls test program, checking why..."
127 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
128 LIBS="$LIBS $LIBGNUTLS_LIBS"
133 #include <gnutls/gnutls.h>
134 ], [ return !!gnutls_check_version(NULL); ],
135 [ echo "*** The test program compiled, but did not run. This usually means"
136 echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
137 echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
138 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
139 echo "*** to the installed location Also, make sure you have run ldconfig if that"
140 echo "*** is required on your system"
142 echo "*** If you have an old version installed, it is best to remove it, although"
143 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
145 [ echo "*** The test program failed to compile or link. See the file config.log for the"
146 echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
147 echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
148 echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
149 CFLAGS="$ac_save_CFLAGS"
155 ifelse([$3], , :, [$3])
157 rm -f conf.libgnutlstest
158 AC_SUBST(LIBGNUTLS_CFLAGS)
159 AC_SUBST(LIBGNUTLS_LIBS)
162 dnl *-*wedit:notab*-* Please keep this as the last line.