source: trunk/third/libsoup/acinclude.m4 @ 21108

Revision 21108, 10.0 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21107, which included commits to RCS files with non-trunk default branches.
RevLine 
[21107]1dnl Autoconf macros for libgpg-error
2
3dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION,
4dnl                   [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
5dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS
6dnl
7AC_DEFUN(AM_PATH_GPG_ERROR,
8[ AC_ARG_WITH(gpg-error-prefix,
9            AC_HELP_STRING([--with-gpg-error-prefix=PFX],
10                           [prefix where GPG Error is installed (optional)]),
11     gpg_error_config_prefix="$withval", gpg_error_config_prefix="")
12  if test x$gpg_error_config_prefix != x ; then
13     gpg_error_config_args="$gpg_error_config_args --prefix=$gpg_error_config_prefix"
14     if test x${GPG_ERROR_CONFIG+set} != xset ; then
15        GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config
16     fi
17  fi
18
19  AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no)
20  min_gpg_error_version=ifelse([$1], ,0.0,$1)
21  AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version)
22  ok=no
23  if test "$GPG_ERROR_CONFIG" != "no" ; then
24    req_major=`echo $min_gpg_error_version | \
25               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
26    req_minor=`echo $min_gpg_error_version | \
27               sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
28    gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version`
29    major=`echo $gpg_error_config_version | \
30               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
31    minor=`echo $gpg_error_config_version | \
32               sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
33    if test "$major" -gt "$req_major"; then
34        ok=yes
35    else
36        if test "$major" -eq "$req_major"; then
37            if test "$minor" -ge "$req_minor"; then
38               ok=yes
39            fi
40        fi
41    fi
42  fi
43  if test $ok = yes; then
44    GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
45    GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
46    AC_MSG_RESULT(yes)
47    ifelse([$2], , :, [$2])
48  else
49    GPG_ERROR_CFLAGS=""
50    GPG_ERROR_LIBS=""
51    AC_MSG_RESULT(no)
52    ifelse([$3], , :, [$3])
53  fi
54  AC_SUBST(GPG_ERROR_CFLAGS)
55  AC_SUBST(GPG_ERROR_LIBS)
56])
57
58dnl Usage:
59dnl   GTK_DOC_CHECK([minimum-gtk-doc-version])
60AC_DEFUN([GTK_DOC_CHECK],
61[
62  AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
63  AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
64  dnl for overriding the documentation installation directory
65  AC_ARG_WITH(html-dir,
66    AC_HELP_STRING([--with-html-dir=PATH], [path to installed docs]),,
67    [with_html_dir='${datadir}/gtk-doc/html'])
68  HTML_DIR="$with_html_dir"
69  AC_SUBST(HTML_DIR)
70
71  dnl enable/disable documentation building
72  AC_ARG_ENABLE(gtk-doc,
73    AC_HELP_STRING([--enable-gtk-doc],
74                   [use gtk-doc to build documentation [default=no]]),,
75    enable_gtk_doc=no)
76
77  have_gtk_doc=no
78  if test -z "$PKG_CONFIG"; then
79    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
80  fi
81  if test "$PKG_CONFIG" != "no" && $PKG_CONFIG --exists gtk-doc; then
82    have_gtk_doc=yes
83  fi
84
85  dnl do we want to do a version check?
86ifelse([$1],[],,
87  [gtk_doc_min_version=$1
88  if test "$have_gtk_doc" = yes; then
89    AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
90    if $PKG_CONFIG --atleast-version $gtk_doc_min_version gtk-doc; then
91      AC_MSG_RESULT(yes)
92    else
93      AC_MSG_RESULT(no)
94      have_gtk_doc=no
95    fi
96  fi
97])
98  if test x$enable_gtk_doc = xyes; then
99    if test "$have_gtk_doc" != yes; then
100      enable_gtk_doc=no
101    fi
102  fi
103
104  AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
105  AM_CONDITIONAL(GTK_DOC_USE_LIBTOOL, test -n "$LIBTOOL")
106])
107dnl Autoconf macros for libgnutls
108dnl $id$
109
110# Modified for LIBGNUTLS -- nmav
111# Configure paths for LIBGCRYPT
112# Shamelessly stolen from the one of XDELTA by Owen Taylor
113# Werner Koch   99-12-09
114
115dnl AM_PATH_LIBGNUTLS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
116dnl Test for libgnutls, and define LIBGNUTLS_CFLAGS and LIBGNUTLS_LIBS
117dnl
118AC_DEFUN(AM_PATH_LIBGNUTLS,
119[dnl
120dnl Get the cflags and libraries from the libgnutls-config script
121dnl
122AC_ARG_WITH(libgnutls-prefix,
123          [  --with-libgnutls-prefix=PFX   Prefix where libgnutls is installed (optional)],
124          libgnutls_config_prefix="$withval", libgnutls_config_prefix="")
125
126  if test x$libgnutls_config_prefix != x ; then
127     if test x${LIBGNUTLS_CONFIG+set} != xset ; then
128        LIBGNUTLS_CONFIG=$libgnutls_config_prefix/bin/libgnutls-config
129     fi
130  fi
131
132  AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
133  min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
134  AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
135  no_libgnutls=""
136  if test "$LIBGNUTLS_CONFIG" = "no" ; then
137    no_libgnutls=yes
138  else
139    LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
140    LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
141    libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
142
143
144      ac_save_CFLAGS="$CFLAGS"
145      ac_save_LIBS="$LIBS"
146      CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
147      LIBS="$LIBS $LIBGNUTLS_LIBS"
148dnl
149dnl Now check if the installed libgnutls is sufficiently new. Also sanity
150dnl checks the results of libgnutls-config to some extent
151dnl
152      rm -f conf.libgnutlstest
153      AC_TRY_RUN([
154#include <stdio.h>
155#include <stdlib.h>
156#include <string.h>
157#include <gnutls/gnutls.h>
158
159int
160main ()
161{
162    system ("touch conf.libgnutlstest");
163
164    if( strcmp( gnutls_check_version(NULL), "$libgnutls_config_version" ) )
165    {
166      printf("\n*** 'libgnutls-config --version' returned %s, but LIBGNUTLS (%s)\n",
167             "$libgnutls_config_version", gnutls_check_version(NULL) );
168      printf("*** was found! If libgnutls-config was correct, then it is best\n");
169      printf("*** to remove the old version of LIBGNUTLS. You may also be able to fix the error\n");
170      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
171      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
172      printf("*** required on your system.\n");
173      printf("*** If libgnutls-config was wrong, set the environment variable LIBGNUTLS_CONFIG\n");
174      printf("*** to point to the correct copy of libgnutls-config, and remove the file config.cache\n");
175      printf("*** before re-running configure\n");
176    }
177    else if ( strcmp(gnutls_check_version(NULL), LIBGNUTLS_VERSION ) )
178    {
179      printf("\n*** LIBGNUTLS header file (version %s) does not match\n", LIBGNUTLS_VERSION);
180      printf("*** library (version %s)\n", gnutls_check_version(NULL) );
181    }
182    else
183    {
184      if ( gnutls_check_version( "$min_libgnutls_version" ) )
185      {
186        return 0;
187      }
188     else
189      {
190        printf("no\n*** An old version of LIBGNUTLS (%s) was found.\n",
191                gnutls_check_version(NULL) );
192        printf("*** You need a version of LIBGNUTLS newer than %s. The latest version of\n",
193               "$min_libgnutls_version" );
194        printf("*** LIBGNUTLS is always available from ftp://gnutls.hellug.gr/pub/gnutls.\n");
195        printf("*** \n");
196        printf("*** If you have already installed a sufficiently new version, this error\n");
197        printf("*** probably means that the wrong copy of the libgnutls-config shell script is\n");
198        printf("*** being found. The easiest way to fix this is to remove the old version\n");
199        printf("*** of LIBGNUTLS, but you can also set the LIBGNUTLS_CONFIG environment to point to the\n");
200        printf("*** correct copy of libgnutls-config. (In this case, you will have to\n");
201        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
202        printf("*** so that the correct libraries are found at run-time))\n");
203      }
204    }
205  return 1;
206}
207],, no_libgnutls=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
208       CFLAGS="$ac_save_CFLAGS"
209       LIBS="$ac_save_LIBS"
210  fi
211
212  if test "x$no_libgnutls" = x ; then
213     AC_MSG_RESULT(yes)
214     ifelse([$2], , :, [$2])
215  else
216     if test -f conf.libgnutlstest ; then
217        :
218     else
219        AC_MSG_RESULT(no)
220     fi
221     if test "$LIBGNUTLS_CONFIG" = "no" ; then
222       echo "*** The libgnutls-config script installed by LIBGNUTLS could not be found"
223       echo "*** If LIBGNUTLS was installed in PREFIX, make sure PREFIX/bin is in"
224       echo "*** your path, or set the LIBGNUTLS_CONFIG environment variable to the"
225       echo "*** full path to libgnutls-config."
226     else
227       if test -f conf.libgnutlstest ; then
228        :
229       else
230          echo "*** Could not run libgnutls test program, checking why..."
231          CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
232          LIBS="$LIBS $LIBGNUTLS_LIBS"
233          AC_TRY_LINK([
234#include <stdio.h>
235#include <stdlib.h>
236#include <string.h>
237#include <gnutls/gnutls.h>
238],      [ return !!gnutls_check_version(NULL); ],
239        [ echo "*** The test program compiled, but did not run. This usually means"
240          echo "*** that the run-time linker is not finding LIBGNUTLS or finding the wrong"
241          echo "*** version of LIBGNUTLS. If it is not finding LIBGNUTLS, you'll need to set your"
242          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
243          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
244          echo "*** is required on your system"
245          echo "***"
246          echo "*** If you have an old version installed, it is best to remove it, although"
247          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
248          echo "***" ],
249        [ echo "*** The test program failed to compile or link. See the file config.log for the"
250          echo "*** exact error that occured. This usually means LIBGNUTLS was incorrectly installed"
251          echo "*** or that you have moved LIBGNUTLS since it was installed. In the latter case, you"
252          echo "*** may want to edit the libgnutls-config script: $LIBGNUTLS_CONFIG" ])
253          CFLAGS="$ac_save_CFLAGS"
254          LIBS="$ac_save_LIBS"
255       fi
256     fi
257     LIBGNUTLS_CFLAGS=""
258     LIBGNUTLS_LIBS=""
259     ifelse([$3], , :, [$3])
260  fi
261  rm -f conf.libgnutlstest
262  AC_SUBST(LIBGNUTLS_CFLAGS)
263  AC_SUBST(LIBGNUTLS_LIBS)
264])
265
266dnl *-*wedit:notab*-*  Please keep this as the last line.
Note: See TracBrowser for help on using the repository browser.