1 dnl Autoconf macros for libtasn1
4 # Modified for LIBTASN1 -- nmav
5 # Configure paths for LIBGCRYPT
6 # Shamelessly stolen from the one of XDELTA by Owen Taylor
9 dnl AM_PATH_LIBTASN1([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
10 dnl Test for libtasn1, and define LIBTASN1_CFLAGS and LIBTASN1_LIBS
12 AC_DEFUN([AM_PATH_LIBTASN1],
14 dnl Get the cflags and libraries from the libtasn1-config script
16 AC_ARG_WITH(libtasn1-prefix,
17 [ --with-libtasn1-prefix=PFX Prefix where libtasn1 is installed (optional)],
18 libtasn1_config_prefix="$withval", libtasn1_config_prefix="")
20 if test x$libtasn1_config_prefix != x ; then
21 if test x${LIBTASN1_CONFIG+set} != xset ; then
22 LIBTASN1_CONFIG=$libtasn1_config_prefix/bin/libtasn1-config
26 AC_PATH_PROG(LIBTASN1_CONFIG, libtasn1-config, no)
27 min_libtasn1_version=ifelse([$1], ,0.1.0,$1)
28 AC_MSG_CHECKING(for libtasn1 - version >= $min_libtasn1_version)
30 if test "$LIBTASN1_CONFIG" = "no" ; then
33 LIBTASN1_CFLAGS=`$LIBTASN1_CONFIG $libtasn1_config_args --cflags`
34 LIBTASN1_LIBS=`$LIBTASN1_CONFIG $libtasn1_config_args --libs`
35 libtasn1_config_version=`$LIBTASN1_CONFIG $libtasn1_config_args --version`
38 ac_save_CFLAGS="$CFLAGS"
40 CFLAGS="$CFLAGS $LIBTASN1_CFLAGS"
41 LIBS="$LIBS $LIBTASN1_LIBS"
43 dnl Now check if the installed libtasn1 is sufficiently new. Also sanity
44 dnl checks the results of libtasn1-config to some extent
46 rm -f conf.libtasn1test
56 system ("touch conf.libtasn1test");
58 if( strcmp( asn1_check_version(NULL), "$libtasn1_config_version" ) )
60 printf("\n*** 'libtasn1-config --version' returned %s, but LIBTASN1 (%s)\n",
61 "$libtasn1_config_version", asn1_check_version(NULL) );
62 printf("*** was found! If libtasn1-config was correct, then it is best\n");
63 printf("*** to remove the old version of LIBTASN1. You may also be able to fix the error\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");
66 printf("*** required on your system.\n");
67 printf("*** If libtasn1-config was wrong, set the environment variable LIBTASN1_CONFIG\n");
68 printf("*** to point to the correct copy of libtasn1-config, and remove the file config.cache\n");
69 printf("*** before re-running configure\n");
71 else if ( strcmp(asn1_check_version(NULL), LIBTASN1_VERSION ) )
73 printf("\n*** LIBTASN1 header file (version %s) does not match\n", LIBTASN1_VERSION);
74 printf("*** library (version %s)\n", asn1_check_version(NULL) );
78 if ( asn1_check_version( "$min_libtasn1_version" ) )
84 printf("no\n*** An old version of LIBTASN1 (%s) was found.\n",
85 asn1_check_version(NULL) );
86 printf("*** You need a version of LIBTASN1 newer than %s. The latest version of\n",
87 "$min_libtasn1_version" );
88 printf("*** LIBTASN1 is always available from ftp://gnutls.hellug.gr/pub/gnutls/libtasn1.\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 libtasn1-config shell script is\n");
92 printf("*** being found. The easiest way to fix this is to remove the old version\n");
93 printf("*** of LIBTASN1, but you can also set the LIBTASN1_CONFIG environment to point to the\n");
94 printf("*** correct copy of libtasn1-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");
96 printf("*** so that the correct libraries are found at run-time))\n");
101 ],, no_libtasn1=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
102 CFLAGS="$ac_save_CFLAGS"
106 if test "x$no_libtasn1" = x ; then
108 ifelse([$2], , :, [$2])
110 if test -f conf.libtasn1test ; then
115 if test "$LIBTASN1_CONFIG" = "no" ; then
116 echo "*** The libtasn1-config script installed by LIBTASN1 could not be found"
117 echo "*** If LIBTASN1 was installed in PREFIX, make sure PREFIX/bin is in"
118 echo "*** your path, or set the LIBTASN1_CONFIG environment variable to the"
119 echo "*** full path to libtasn1-config."
121 if test -f conf.libtasn1test ; then
124 echo "*** Could not run libtasn1 test program, checking why..."
125 CFLAGS="$CFLAGS $LIBTASN1_CFLAGS"
126 LIBS="$LIBS $LIBTASN1_LIBS"
131 #include <libtasn1.h>
132 ], [ return !!asn1_check_version(NULL); ],
133 [ echo "*** The test program compiled, but did not run. This usually means"
134 echo "*** that the run-time linker is not finding LIBTASN1 or finding the wrong"
135 echo "*** version of LIBTASN1. If it is not finding LIBTASN1, you'll need to set your"
136 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
137 echo "*** to the installed location Also, make sure you have run ldconfig if that"
138 echo "*** is required on your system"
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"
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 LIBTASN1 was incorrectly installed"
145 echo "*** or that you have moved LIBTASN1 since it was installed. In the latter case, you"
146 echo "*** may want to edit the libtasn1-config script: $LIBTASN1_CONFIG" ])
147 CFLAGS="$ac_save_CFLAGS"
153 ifelse([$3], , :, [$3])
155 rm -f conf.libtasn1test
156 AC_SUBST(LIBTASN1_CFLAGS)
157 AC_SUBST(LIBTASN1_LIBS)
160 dnl *-*wedit:notab*-* Please keep this as the last line.