summaryrefslogtreecommitdiffstatsabout
path: root/m4
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2009-01-04 16:14:30 (GMT)
committer Nokis Mavrogiannopoulos <nmav@gnutls.org>2009-01-04 16:14:30 (GMT)
commitf46e1f257c865f5445ea48d169af7ef7c6f764aa (patch)
tree6ea9be18a0d3b4538ac1c55956e9fac31899f555 /m4
parent56f36286c885bf4e3d53083dcc32ba6eb4a0797f (diff)
bumped version and updated the detection script to work with pkg-config.
Diffstat (limited to 'm4')
-rw-r--r--m4/libgnutls.m455
1 files changed, 27 insertions, 28 deletions
diff --git a/m4/libgnutls.m4 b/m4/libgnutls.m4
index 8479388..ef0bb04 100644
--- a/m4/libgnutls.m4
+++ b/m4/libgnutls.m4
@@ -11,28 +11,28 @@ dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
11dnl 11dnl
12AC_DEFUN([AM_PATH_LIBGNUTLS], 12AC_DEFUN([AM_PATH_LIBGNUTLS],
13[dnl 13[dnl
14dnl Get the cflags and libraries from the libgnutls-config script 14dnl Get the cflags and libraries from the pkg-config script
15dnl 15dnl
16AC_ARG_WITH(libgnutls-prefix, 16AC_ARG_WITH(libgnutls-prefix,
17 [ --with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)], 17 [ --with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)],
18 libgnutls_config_prefix="$withval", libgnutls_config_prefix="") 18 pkg_config_prefix="$withval", pkg_config_prefix="")
19 19
20 if test x$libgnutls_config_prefix != x ; then 20 if test x$pkg_config_prefix != x ; then
21 if test x${LIBGNUTLS_CONFIG+set} != xset ; then 21 if test x${PKG_CONFIG+set} != xset ; then
22 LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config 22 PKG_CONFIG=$pkg_config_prefix/bin/pkg-config
23 fi 23 fi
24 fi 24 fi
25 25
26 AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no) 26 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
27 min_libgnutls_version=ifelse([$1], ,0.1.0,$1) 27 min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
28 AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version) 28 AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
29 no_libgnutls="" 29 no_libgnutls=""
30 if test "$LIBGNUTLS_CONFIG" = "no" ; then 30 if test "$PKG_CONFIG" = "no" ; then
31 no_libgnutls=yes 31 no_libgnutls=yes
32 else 32 else
33 LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags` 33 LIBGNUTLS_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags gnutls`
34 LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs` 34 LIBGNUTLS_LIBS=`$PKG_CONFIG $pkg_config_args --libs gnutls`
35 libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version` 35 pkg_config_version=`$PKG_CONFIG $pkg_config_args --modversion gnutls`
36 36
37 37
38 ac_save_CFLAGS="$CFLAGS" 38 ac_save_CFLAGS="$CFLAGS"
@@ -41,7 +41,7 @@ AC_ARG_WITH(libgnutls-prefix,
41 LIBS="$LIBS $LIBGNUTLS_LIBS" 41 LIBS="$LIBS $LIBGNUTLS_LIBS"
42dnl 42dnl
43dnl Now check if the installed libgnutls is sufficiently new. Also sanity 43dnl Now check if the installed libgnutls is sufficiently new. Also sanity
44dnl checks the results of libgnutls-config to some extent 44dnl checks the results of pkg-config to some extent
45dnl 45dnl
46 rm -f conf.libgnutlstest 46 rm -f conf.libgnutlstest
47 AC_TRY_RUN([ 47 AC_TRY_RUN([
@@ -55,17 +55,17 @@ main ()
55{ 55{
56 system ("touch conf.libgnutlstest"); 56 system ("touch conf.libgnutlstest");
57 57
58 if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) ) 58 if( strcmp( gnutls_check_version(NULL), "$pkg_config_version" ) )
59 { 59 {
60 printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n", 60 printf("\n*** 'pkg-config --version' returned %s, but LIBGNUTLS (%s)\n",
61 "$libgnutls_config_version", gnutls_check_version(NULL) ); 61 "$pkg_config_version", gnutls_check_version(NULL) );
62 printf("*** was found! If libgnutls-config was correct, then it is best\n"); 62 printf("*** was found! If pkg-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"); 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"); 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"); 65 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
66 printf("*** required on your system.\n"); 66 printf("*** required on your system.\n");
67 printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n"); 67 printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG\n");
68 printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n"); 68 printf("*** to point to the correct copy of pkg-config, and remove the file config.cache\n");
69 printf("*** before re-running configure\n"); 69 printf("*** before re-running configure\n");
70 } 70 }
71 else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) ) 71 else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
@@ -88,10 +88,10 @@ main ()
88 printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n"); 88 printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
89 printf("*** \n"); 89 printf("*** \n");
90 printf("*** If you have already installed a sufficiently new version, this error\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"); 91 printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
92 printf("*** being found. The easiest way to fix this is to remove the old version\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"); 93 printf("*** of LIBGNUTLS, but you can also set the PKG_CONFIG environment to point to the\n");
94 printf("*** correct copy of libgnutls-config. (In this case, you will have to\n"); 94 printf("*** correct copy of pkg-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"); 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"); 96 printf("*** so that the correct libraries are found at run-time))\n");
97 } 97 }
@@ -112,11 +112,11 @@ main ()
112 else 112 else
113 AC_MSG_RESULT(no) 113 AC_MSG_RESULT(no)
114 fi 114 fi
115 if test "$LIBGNUTLS_CONFIG" = "no" ; then 115 if test "$PKG_CONFIG" = "no" ; then
116 echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found" 116 echo "*** The pkg-config script installed by LIBGNUTLS could not be found"
117 echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in" 117 echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
118 echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the" 118 echo "*** your path, or set the PKG_CONFIG environment variable to the"
119 echo "*** full path to libgnutls-config." 119 echo "*** full path to pkg-config."
120 else 120 else
121 if test -f conf.libgnutlstest ; then 121 if test -f conf.libgnutlstest ; then
122 : 122 :
@@ -143,7 +143,7 @@ main ()
143 [ echo "*** The test program failed to compile or link. See the file config.log for the" 143 [ echo "*** The test program failed to compile or link. See the file config.log for the"
144 echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed" 144 echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
145 echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you" 145 echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
146 echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ]) 146 echo "*** may want to edit the pkg-config script: $PKG_CONFIG" ])
147 CFLAGS="$ac_save_CFLAGS" 147 CFLAGS="$ac_save_CFLAGS"
148 LIBS="$ac_save_LIBS" 148 LIBS="$ac_save_LIBS"
149 fi 149 fi
@@ -154,9 +154,8 @@ main ()
154 fi 154 fi
155 rm -f conf.libgnutlstest 155 rm -f conf.libgnutlstest
156 156
157 LIBGNUTLS_VERSION=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version` 157 LIBGNUTLS_VERSION="$pkg_config_version"
158 LIBGNUTLS_PREFIX="`$LIBGNUTLS_CONFIG $libgnutls_config_args --prefix`" 158 AC_PATH_PROG(GNUTLS_CERTTOOL, certtool, no)
159 GNUTLS_CERTTOOL="${LIBGNUTLS_PREFIX}/bin/certtool"
160 159
161 AC_SUBST(LIBGNUTLS_CFLAGS) 160 AC_SUBST(LIBGNUTLS_CFLAGS)
162 AC_SUBST(LIBGNUTLS_LIBS) 161 AC_SUBST(LIBGNUTLS_LIBS)