1dnl aclocal.m4 generated automatically by aclocal 1.4-p5 2 3dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc. 4dnl This file is free software; the Free Software Foundation 5dnl gives unlimited permission to copy and/or distribute it, 6dnl with or without modifications, as long as this notice is preserved. 7 8dnl This program is distributed in the hope that it will be useful, 9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without 10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A 11dnl PARTICULAR PURPOSE. 12 13dnl Autoconf macros for libmcrypt 14dnl $id$ 15 16# This script detects libmcrypt version and defines 17# LIBMCRYPT_CFLAGS, LIBMCRYPT_LIBS 18# and LIBMCRYPT24 or LIBMCRYPT22 depending on libmcrypt version 19# found. 20 21# Modified for LIBMCRYPT -- nmav 22# Configure paths for LIBGCRYPT 23# Shamelessly stolen from the one of XDELTA by Owen Taylor 24# Werner Koch 99-12-09 25 26dnl AM_PATH_LIBMCRYPT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) 27dnl Test for libmcrypt, and define LIBMCRYPT_CFLAGS and LIBMCRYPT_LIBS 28dnl 29AC_DEFUN(AM_PATH_LIBMCRYPT, 30[dnl 31dnl Get the cflags and libraries from the libmcrypt-config script 32dnl 33AC_ARG_WITH(libmcrypt-prefix, 34 [ --with-libmcrypt-prefix=PFX Prefix where libmcrypt is installed (optional)], 35 libmcrypt_config_prefix="$withval", libmcrypt_config_prefix="") 36 37 if test x$libmcrypt_config_prefix != x ; then 38 libmcrypt_config_args="$libmcrypt_config_args --prefix=$libmcrypt_config_prefix" 39 if test x${LIBMCRYPT_CONFIG+set} != xset ; then 40 LIBMCRYPT_CONFIG=$libmcrypt_config_prefix/bin/libmcrypt-config 41 fi 42 fi 43 44 AC_PATH_PROG(LIBMCRYPT_CONFIG, libmcrypt-config, no) 45 min_libmcrypt_version=ifelse([$1], ,2.4.0,$1) 46 AC_MSG_CHECKING(for libmcrypt - version >= $min_libmcrypt_version) 47 no_libmcrypt="" 48 if test "$LIBMCRYPT_CONFIG" = "no" ; then 49dnl libmcrypt-config was not found (pre 2.4.11 versions) 50dnl Try to detect libmcrypt version 51 AC_TRY_RUN([ 52#include <stdio.h> 53#include <stdlib.h> 54#include <string.h> 55#include <mcrypt.h> 56 57int 58main () 59{ 60#if MCRYPT_API_VERSION <= 19991015 61/* version 2.2 */ 62 return 0; 63#else 64/* version 2.4 */ 65 return 1; 66#endif /* 19991015 */ 67} 68], libmcrypt_config_version="2.2.0" 69 if test x$libmcrypt_config_prefix != x ; then 70 TTLIBS="-L${libmcrypt_config_prefix}/libs" 71 TTINCLUDE="-I${libmcrypt_config_prefix}/include" 72 fi 73 LIBMCRYPT_CFLAGS="${TTINCLUDE}" 74 LIBMCRYPT_LIBS="${TTLIBS} -lmcrypt" 75 AC_DEFINE(LIBMCRYPT22) 76 77, libmcrypt_config_version="2.4.0" 78 if test x$libmcrypt_config_prefix != x ; then 79 TTLIBS="-L${libmcrypt_config_prefix}/libs" 80 TTINCLUDE="-I${libmcrypt_config_prefix}/include" 81 fi 82 LIBMCRYPT_CFLAGS="${TTINCLUDE}" 83 LIBMCRYPT_LIBS="${TTLIBS} -lmcrypt -lltdl ${LIBADD_DL}" 84 AC_DEFINE(LIBMCRYPT24)) 85 else 86dnl libmcrypt-config was found 87 LIBMCRYPT_CFLAGS=`$LIBMCRYPT_CONFIG $libmcrypt_config_args --cflags` 88 LIBMCRYPT_LIBS=`$LIBMCRYPT_CONFIG $libmcrypt_config_args --libs` 89 libmcrypt_config_version=`$LIBMCRYPT_CONFIG $libmcrypt_config_args --version` 90 AC_DEFINE(LIBMCRYPT24) 91 fi 92 93 ac_save_CFLAGS="$CFLAGS" 94 ac_save_LIBS="$LIBS" 95 CFLAGS="$CFLAGS $LIBMCRYPT_CFLAGS" 96 LIBS="$LIBS $LIBMCRYPT_LIBS" 97 98dnl 99dnl Now check if the installed libmcrypt is sufficiently new. Also sanity 100dnl checks the results of libmcrypt-config to some extent 101dnl 102 rm -f conf.libmcrypttest 103 AC_TRY_RUN([ 104#include <stdio.h> 105#include <stdlib.h> 106#include <string.h> 107#include <mcrypt.h> 108 109#define TWO "2.2" 110 111int 112main () 113{ 114#if MCRYPT_API_VERSION <= 20010201 115 116#if MCRYPT_API_VERSION <= 19991015 117/* version 2.2 */ 118 int x = mcrypt_get_key_size(MCRYPT_TWOFISH_128); 119 system ("touch conf.libmcrypttest"); 120 121 if( strncmp( TWO, "$min_libmcrypt_version", strlen(TWO))) { 122 printf("\n*** Requested libmcrypt %s, but LIBMCRYPT (%s)\n", 123 "$min_libmcrypt_version", TWO ); 124 printf("*** was found!\n"); 125 return 1; 126 } 127 return 0; 128#else 129/* version 2.4 before 11 */ 130 MCRYPT td = mcrypt_module_open("twofish", NULL, "cbc", NULL); 131 system ("touch conf.libmcrypttest"); 132 mcrypt_module_close(td); 133 134 return 0; 135#endif /* 19991015 */ 136 137#else 138 139 system ("touch conf.libmcrypttest"); 140 141 if( strcmp( mcrypt_check_version(NULL), "$libmcrypt_config_version" ) ) 142 { 143 printf("\n*** 'libmcrypt-config --version' returned %s, but LIBMCRYPT (%s)\n", 144 "$libmcrypt_config_version", mcrypt_check_version(NULL) ); 145 printf("*** was found! If libmcrypt-config was correct, then it is best\n"); 146 printf("*** to remove the old version of LIBMCRYPT. You may also be able to fix the error\n"); 147 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); 148 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); 149 printf("*** required on your system.\n"); 150 printf("*** If libmcrypt-config was wrong, set the environment variable LIBMCRYPT_CONFIG\n"); 151 printf("*** to point to the correct copy of libmcrypt-config, and remove the file config.cache\n"); 152 printf("*** before re-running configure\n"); 153 } 154 else if ( strcmp(mcrypt_check_version(NULL), LIBMCRYPT_VERSION ) ) 155 { 156 printf("\n*** LIBMCRYPT header file (version %s) does not match\n", LIBMCRYPT_VERSION); 157 printf("*** library (version %s)\n", mcrypt_check_version(NULL) ); 158 } 159 else 160 { 161 if ( mcrypt_check_version( "$min_libmcrypt_version" ) ) 162 { 163 return 0; 164 } 165 else 166 { 167 printf("no\n*** An old version of LIBMCRYPT (%s) was found.\n", 168 mcrypt_check_version(NULL) ); 169 printf("*** You need a version of LIBMCRYPT newer than %s. The latest version of\n", 170 "$min_libmcrypt_version" ); 171 printf("*** LIBMCRYPT is always available from ftp://mcrypt.hellug.gr/pub/mcrypt.\n"); 172 printf("*** \n"); 173 printf("*** If you have already installed a sufficiently new version, this error\n"); 174 printf("*** probably means that the wrong copy of the libmcrypt-config shell script is\n"); 175 printf("*** being found. The easiest way to fix this is to remove the old version\n"); 176 printf("*** of LIBMCRYPT, but you can also set the LIBMCRYPT_CONFIG environment to point to the\n"); 177 printf("*** correct copy of libmcrypt-config. (In this case, you will have to\n"); 178 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); 179 printf("*** so that the correct libraries are found at run-time))\n"); 180 } 181 } 182 return 1; 183 184#endif /* 20010201 */ 185 186} 187],, no_libmcrypt=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) 188 CFLAGS="$ac_save_CFLAGS" 189 LIBS="$ac_save_LIBS" 190 191 192 if test "x$no_libmcrypt" = x ; then 193 AC_MSG_RESULT(yes) 194 ifelse([$2], , :, [$2]) 195 else 196 if test -f conf.libmcrypttest ; then 197 : 198 else 199 AC_MSG_RESULT(no) 200 fi 201 202 if test -f conf.libmcrypttest ; then 203 : 204 else 205 echo "*** Could not run libmcrypt test program, checking why..." 206 CFLAGS="$CFLAGS $LIBMCRYPT_CFLAGS" 207 LIBS="$LIBS $LIBMCRYPT_LIBS" 208 AC_TRY_LINK([ 209#include <stdio.h> 210#include <stdlib.h> 211#include <string.h> 212#include <mcrypt.h> 213], [ 214#if MCRYPT_API_VERSION <= 20010201 215 216#if MCRYPT_API_VERSION <= 19991015 217/* version 2.2 */ 218 int x = mcrypt_get_key_size(MCRYPT_TWOFISH_128); 219 return 0; 220#else 221/* version 2.4 before 11 */ 222 MCRYPT td = mcrypt_module_open("twofish", NULL, "cbc", NULL); 223 mcrypt_module_close(td); 224 return 0; 225#endif /* 19991015 */ 226#else 227 228return !!mcrypt_check_version(NULL); 229 230#endif /* 20010201 */ 231 232], 233 [ echo "*** The test program compiled, but did not run. This usually means" 234 echo "*** that the run-time linker is not finding LIBMCRYPT or finding the wrong" 235 echo "*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your" 236 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" 237 echo "*** to the installed location Also, make sure you have run ldconfig if that" 238 echo "*** is required on your system" 239 echo "***" 240 echo "*** If you have an old version installed, it is best to remove it, although" 241 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" 242 echo "***" ], 243 [ echo "*** The test program failed to compile or link. See the file config.log for the" 244 echo "*** exact error that occured. This usually means LIBMCRYPT was incorrectly installed" 245 echo "*** or that you have moved LIBMCRYPT since it was installed. In the latter case, you" 246 echo "*** may want to edit the libmcrypt-config script: $LIBMCRYPT_CONFIG" ]) 247 CFLAGS="$ac_save_CFLAGS" 248 LIBS="$ac_save_LIBS" 249 fi 250 251 LIBMCRYPT_CFLAGS="" 252 LIBMCRYPT_LIBS="" 253 ifelse([$3], , :, [$3]) 254 fi 255 AC_SUBST(LIBMCRYPT_CFLAGS) 256 AC_SUBST(LIBMCRYPT_LIBS) 257]) 258 259dnl *-*wedit:notab*-* Please keep this as the last line. 260 261