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