1 AC_DEFUN(AM_GNOME_CHECK_TYPE,
2 [AC_CACHE_CHECK([$1 in <sys/types.h>], ac_cv_type_$1,
10 ac_cv_type_$1=yes, ac_cv_type_$1=no)])
11 if test $ac_cv_type_$1 = no; then
16 AC_DEFUN(AM_GNOME_SIZE_T,
17 [AM_GNOME_CHECK_TYPE(size_t, unsigned)
18 AC_PROVIDE([AC_TYPE_SIZE_T])
21 AC_DEFUN(AM_GNOME_OFF_T,
22 [AM_GNOME_CHECK_TYPE(off_t, long)
23 AC_PROVIDE([AC_TYPE_OFF_T])
26 dnl Autoconf macros for libgnutls
28 # Modified for LIBGNUTLS -- nmav
29 # Configure paths for LIBGCRYPT
30 # Shamelessly stolen from the one of XDELTA by Owen Taylor
31 # Werner Koch 99-12-09
33 dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
34 dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
36 AC_DEFUN(AM_PATH_LIBGNUTLS,
38 dnl Get the cflags and libraries from the libgnutls-config script
40 AC_ARG_WITH(libgnutls-prefix,
41 [ --with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)],
42 libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
44 if test x$libgnutls_config_prefix != x ; then
45 libgnutls_config_args="$libgnutls_config_args --prefix=$libgnutls_config_prefix"
46 if test x${LIBGNUTLS_CONFIG+set} != xset ; then
47 LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
51 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
52 min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
53 AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
55 if test "$LIBGNUTLS_CONFIG" = "no" ; then
58 LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
59 LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
60 libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
63 ac_save_CFLAGS="$CFLAGS"
65 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
66 LIBS="$LIBS $LIBGNUTLS_LIBS"
68 dnl Now check if the installed libgnutls is sufficiently new. Also sanity
69 dnl checks the results of libgnutls-config to some extent
71 rm -f conf.libgnutlstest
76 #include <gnutls/gnutls.h>
81 system ("touch conf.libgnutlstest");
83 if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
85 printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
86 "$libgnutls_config_version", gnutls_check_version(NULL) );
87 printf("*** was found! If libgnutls-config was correct, then it is best\n");
88 printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
89 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
90 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
91 printf("*** required on your system.\n");
92 printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
93 printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
94 printf("*** before re-running configure\n");
96 else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
98 printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
99 printf("*** library (version %s)\n", gnutls_check_version(NULL) );
103 if ( gnutls_check_version( "$min_libgnutls_version" ) )
109 printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
110 gnutls_check_version(NULL) );
111 printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
112 "$min_libgnutls_version" );
113 printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
115 printf("*** If you have already installed a sufficiently new version, this error\n");
116 printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
117 printf("*** being found. The easiest way to fix this is to remove the old version\n");
118 printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
119 printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
120 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
121 printf("*** so that the correct libraries are found at run-time))\n");
126 ],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
127 CFLAGS="$ac_save_CFLAGS"
131 if test "x$no_libgnutls" = x ; then
133 ifelse([$2], , :, [$2])
135 if test -f conf.libgnutlstest ; then
140 if test "$LIBGNUTLS_CONFIG" = "no" ; then
141 echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
142 echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
143 echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
144 echo "*** full path to libgnutls-config."
146 if test -f conf.libgnutlstest ; then
149 echo "*** Could not run libgnutls test program, checking why..."
150 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
151 LIBS="$LIBS $LIBGNUTLS_LIBS"
156 #include <gnutls/gnutls.h>
157 ], [ return !!gnutls_check_version(NULL); ],
158 [ echo "*** The test program compiled, but did not run. This usually means"
159 echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
160 echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
161 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
162 echo "*** to the installed location Also, make sure you have run ldconfig if that"
163 echo "*** is required on your system"
165 echo "*** If you have an old version installed, it is best to remove it, although"
166 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
168 [ echo "*** The test program failed to compile or link. See the file config.log for the"
169 echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
170 echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
171 echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
172 CFLAGS="$ac_save_CFLAGS"
178 ifelse([$3], , :, [$3])
180 rm -f conf.libgnutlstest
181 AC_SUBST(LIBGNUTLS_CFLAGS)
182 AC_SUBST(LIBGNUTLS_LIBS)
185 dnl end of Autoconf macros for libgnutls