1 |
dnl Autoconf macros for libgnutls |
2 |
dnl $id$ |
3 |
|
4 |
# Modified for LIBGNUTLS -- nmav |
5 |
# Configure paths for LIBGCRYPT |
6 |
# Shamelessly stolen from the one of XDELTA by Owen Taylor |
7 |
# Werner Koch 99-12-09 |
8 |
|
9 |
dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) |
10 |
dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS |
11 |
dnl |
12 |
AC_DEFUN(AM_PATH_LIBGNUTLS, |
13 |
[dnl |
14 |
dnl Get the cflags and libraries from the libgnutls-config script |
15 |
dnl |
16 |
AC_ARG_WITH(libgnutls-prefix, |
17 |
[ --with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)], |
18 |
libgnutls_config_prefix="$withval", libgnutls_config_prefix="") |
19 |
|
20 |
if test x$libgnutls_config_prefix != x ; then |
21 |
libgnutls_config_args="$libgnutls_config_args --prefix=$libgnutls_config_prefix" |
22 |
if test x${LIBGNUTLS_CONFIG+set} != xset ; then |
23 |
LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config |
24 |
fi |
25 |
fi |
26 |
|
27 |
AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no) |
28 |
min_libgnutls_version=ifelse([$1], ,0.1.0,$1) |
29 |
AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version) |
30 |
no_libgnutls="" |
31 |
if test "$LIBGNUTLS_CONFIG" = "no" ; then |
32 |
no_libgnutls=yes |
33 |
else |
34 |
LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags` |
35 |
LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs` |
36 |
libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version` |
37 |
|
38 |
|
39 |
ac_save_CFLAGS="$CFLAGS" |
40 |
ac_save_LIBS="$LIBS" |
41 |
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS" |
42 |
LIBS="$LIBS $LIBGNUTLS_LIBS" |
43 |
dnl |
44 |
dnl Now check if the installed libgnutls is sufficiently new. Also sanity |
45 |
dnl checks the results of libgnutls-config to some extent |
46 |
dnl |
47 |
rm -f conf.libgnutlstest |
48 |
AC_TRY_RUN([ |
49 |
#include <stdio.h> |
50 |
#include <stdlib.h> |
51 |
#include <string.h> |
52 |
#include <gnutls/gnutls.h> |
53 |
|
54 |
int |
55 |
main () |
56 |
{ |
57 |
system ("touch conf.libgnutlstest"); |
58 |
|
59 |
if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) ) |
60 |
{ |
61 |
printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n", |
62 |
"$libgnutls_config_version", gnutls_check_version(NULL) ); |
63 |
printf("*** was found! If libgnutls-config was correct, then it is best\n"); |
64 |
printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n"); |
65 |
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); |
66 |
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); |
67 |
printf("*** required on your system.\n"); |
68 |
printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n"); |
69 |
printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n"); |
70 |
printf("*** before re-running configure\n"); |
71 |
} |
72 |
else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) ) |
73 |
{ |
74 |
printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION); |
75 |
printf("*** library (version %s)\n", gnutls_check_version(NULL) ); |
76 |
} |
77 |
else |
78 |
{ |
79 |
if ( gnutls_check_version( "$min_libgnutls_version" ) ) |
80 |
{ |
81 |
return 0; |
82 |
} |
83 |
else |
84 |
{ |
85 |
printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n", |
86 |
gnutls_check_version(NULL) ); |
87 |
printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n", |
88 |
"$min_libgnutls_version" ); |
89 |
printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n"); |
90 |
printf("*** \n"); |
91 |
printf("*** If you have already installed a sufficiently new version, this error\n"); |
92 |
printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n"); |
93 |
printf("*** being found. The easiest way to fix this is to remove the old version\n"); |
94 |
printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n"); |
95 |
printf("*** correct copy of libgnutls-config. (In this case, you will have to\n"); |
96 |
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); |
97 |
printf("*** so that the correct libraries are found at run-time))\n"); |
98 |
} |
99 |
} |
100 |
return 1; |
101 |
} |
102 |
],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) |
103 |
CFLAGS="$ac_save_CFLAGS" |
104 |
LIBS="$ac_save_LIBS" |
105 |
fi |
106 |
|
107 |
if test "x$no_libgnutls" = x ; then |
108 |
AC_MSG_RESULT(yes) |
109 |
ifelse([$2], , :, [$2]) |
110 |
else |
111 |
if test -f conf.libgnutlstest ; then |
112 |
: |
113 |
else |
114 |
AC_MSG_RESULT(no) |
115 |
fi |
116 |
if test "$LIBGNUTLS_CONFIG" = "no" ; then |
117 |
echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found" |
118 |
echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in" |
119 |
echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the" |
120 |
echo "*** full path to libgnutls-config." |
121 |
else |
122 |
if test -f conf.libgnutlstest ; then |
123 |
: |
124 |
else |
125 |
echo "*** Could not run libgnutls test program, checking why..." |
126 |
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS" |
127 |
LIBS="$LIBS $LIBGNUTLS_LIBS" |
128 |
AC_TRY_LINK([ |
129 |
#include <stdio.h> |
130 |
#include <stdlib.h> |
131 |
#include <string.h> |
132 |
#include <gnutls/gnutls.h> |
133 |
], [ return !!gnutls_check_version(NULL); ], |
134 |
[ echo "*** The test program compiled, but did not run. This usually means" |
135 |
echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong" |
136 |
echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your" |
137 |
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" |
138 |
echo "*** to the installed location Also, make sure you have run ldconfig if that" |
139 |
echo "*** is required on your system" |
140 |
echo "***" |
141 |
echo "*** If you have an old version installed, it is best to remove it, although" |
142 |
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" |
143 |
echo "***" ], |
144 |
[ echo "*** The test program failed to compile or link. See the file config.log for the" |
145 |
echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed" |
146 |
echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you" |
147 |
echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ]) |
148 |
CFLAGS="$ac_save_CFLAGS" |
149 |
LIBS="$ac_save_LIBS" |
150 |
fi |
151 |
fi |
152 |
LIBGNUTLS_CFLAGS="" |
153 |
LIBGNUTLS_LIBS="" |
154 |
ifelse([$3], , :, [$3]) |
155 |
fi |
156 |
rm -f conf.libgnutlstest |
157 |
AC_SUBST(LIBGNUTLS_CFLAGS) |
158 |
AC_SUBST(LIBGNUTLS_LIBS) |
159 |
]) |
160 |
|
161 |
dnl *-*wedit:notab*-* Please keep this as the last line. |