source: mod_gnutls/m4/libgnutls.m4 @ df34f08

Last change on this file since df34f08 was 1897a1c, checked in by Nokis Mavrogiannopoulos <nmav@…>, 12 years ago

depend on main libgnutls library (and gnutls 2.4.x)

  • Property mode set to 100644
File size: 6.8 KB
[1897a1c]1dnl Autoconf macros for libgnutls
[d2439b9]2dnl $id$
[1897a1c]4# Modified for LIBGNUTLS -- nmav
[d2439b9]5# Configure paths for LIBGCRYPT
6# Shamelessly stolen from the one of XDELTA by Owen Taylor
7# Werner Koch   99-12-09
10dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
[1897a1c]14dnl Get the cflags and libraries from the libgnutls-config script
17          [  --with-libgnutls-prefix=PFX   Prefix where libgnutls is installed (optional)],
18          libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
[1897a1c]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
[d2439b9]23     fi
24  fi
[1897a1c]26  AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
[d2439b9]27  min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
28  AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
29  no_libgnutls=""
[1897a1c]30  if test "$LIBGNUTLS_CONFIG" = "no" ; then
[d2439b9]31    no_libgnutls=yes
32  else
[1897a1c]33    LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
34    LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
35    libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
38      ac_save_CFLAGS="$CFLAGS"
39      ac_save_LIBS="$LIBS"
43dnl Now check if the installed libgnutls is sufficiently new. Also sanity
[1897a1c]44dnl checks the results of libgnutls-config to some extent
46      rm -f conf.libgnutlstest
47      AC_TRY_RUN([
48#include <stdio.h>
49#include <stdlib.h>
50#include <string.h>
[1897a1c]51#include <gnutls/gnutls.h>
54main ()
56    system ("touch conf.libgnutlstest");
[1897a1c]58    if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
[d2439b9]59    {
[1897a1c]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");
[d2439b9]64      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
65      printf("*** /etc/ Make sure you have run ldconfig if that is\n");
66      printf("*** required on your system.\n");
[1897a1c]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");
[d2439b9]69      printf("*** before re-running configure\n");
70    }
[1897a1c]71    else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
[d2439b9]72    {
[1897a1c]73      printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
74      printf("*** library (version %s)\n", gnutls_check_version(NULL) );
[d2439b9]75    }
76    else
77    {
[1897a1c]78      if ( gnutls_check_version( "$min_libgnutls_version" ) )
[d2439b9]79      {
80        return 0;
81      }
82     else
83      {
[1897a1c]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",
[d2439b9]87               "$min_libgnutls_version" );
[1897a1c]88        printf("*** LIBGNUTLS is always available from\n");
[d2439b9]89        printf("*** \n");
90        printf("*** If you have already installed a sufficiently new version, this error\n");
[1897a1c]91        printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
[d2439b9]92        printf("*** being found. The easiest way to fix this is to remove the old version\n");
[1897a1c]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");
[d2439b9]95        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/\n");
96        printf("*** so that the correct libraries are found at run-time))\n");
97      }
98    }
99  return 1;
101],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
102       CFLAGS="$ac_save_CFLAGS"
103       LIBS="$ac_save_LIBS"
104  fi
106  if test "x$no_libgnutls" = x ; then
107     AC_MSG_RESULT(yes)
108     ifelse([$2], , :, [$2])
109  else
110     if test -f conf.libgnutlstest ; then
111        :
112     else
113        AC_MSG_RESULT(no)
114     fi
[1897a1c]115     if test "$LIBGNUTLS_CONFIG" = "no" ; then
116       echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
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"
119       echo "*** full path to libgnutls-config."
[d2439b9]120     else
121       if test -f conf.libgnutlstest ; then
122        :
123       else
124          echo "*** Could not run libgnutls test program, checking why..."
[1897a1c]125          CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
[d2439b9]127          AC_TRY_LINK([
128#include <stdio.h>
129#include <stdlib.h>
130#include <string.h>
[1897a1c]131#include <gnutls/gnutls.h>
132],      [ return !!gnutls_check_version(NULL); ],
[d2439b9]133        [ echo "*** The test program compiled, but did not run. This usually means"
[1897a1c]134          echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
135          echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
[d2439b9]136          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ to point"
137          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
138          echo "*** is required on your system"
139          echo "***"
140          echo "*** If you have an old version installed, it is best to remove it, although"
141          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
142          echo "***" ],
143        [ echo "*** The test program failed to compile or link. See the file config.log for the"
[1897a1c]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"
146          echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
[d2439b9]147          CFLAGS="$ac_save_CFLAGS"
148          LIBS="$ac_save_LIBS"
149       fi
150     fi
[1897a1c]151     LIBGNUTLS_CFLAGS=""
[d2439b9]153     ifelse([$3], , :, [$3])
154  fi
155  rm -f conf.libgnutlstest
[1897a1c]157  LIBGNUTLS_VERSION=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
158  LIBGNUTLS_PREFIX="`$LIBGNUTLS_CONFIG $libgnutls_config_args --prefix`"
[d2439b9]159  GNUTLS_CERTTOOL="${LIBGNUTLS_PREFIX}/bin/certtool"
169dnl *-*wedit:notab*-*  Please keep this as the last line.
Note: See TracBrowser for help on using the repository browser.