diff options
author | Simon Josefsson <simon@josefsson.org> | 2004-08-04 23:36:13 +0000 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2004-08-04 23:36:13 +0000 |
commit | bc28abf47efa552f690d6462a51f87754b0d0482 (patch) | |
tree | a365aaaabc5a673ef6b9e23862200d5f9fde3a2a /m4 | |
parent | 3cdec8ace5f049af22839cdd741753a4e24ba0e5 (diff) | |
download | gnutls-bc28abf47efa552f690d6462a51f87754b0d0482.tar.gz |
Move *.m4's to m4/.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/libgcrypt.m4 | 108 | ||||
-rw-r--r-- | m4/libtasn1.m4 | 160 | ||||
-rw-r--r-- | m4/opencdk.m4 | 163 |
3 files changed, 431 insertions, 0 deletions
diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4 new file mode 100644 index 0000000000..20bd105561 --- /dev/null +++ b/m4/libgcrypt.m4 @@ -0,0 +1,108 @@ +dnl Autoconf macros for libgcrypt +dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc. +dnl +dnl This file is free software; as a special exception the author gives +dnl unlimited permission to copy and/or distribute it, with or without +dnl modifications, as long as this notice is preserved. +dnl +dnl This file is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + +dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS. +dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed +dnl with the API version to also check the API compatibility. Example: +dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed +dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using +dnl this features allows to prevent build against newer versions of libgcrypt +dnl with a changed API. +dnl +AC_DEFUN([AM_PATH_LIBGCRYPT], +[ AC_ARG_WITH(libgcrypt-prefix, + AC_HELP_STRING([--with-libgcrypt-prefix=PFX], + [prefix where LIBGCRYPT is installed (optional)]), + libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="") + if test x$libgcrypt_config_prefix != x ; then + if test x${LIBGCRYPT_CONFIG+set} != xset ; then + LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config + fi + fi + + AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no) + tmp=ifelse([$1], ,1:1.2.0,$1) + if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then + req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` + min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'` + else + req_libgcrypt_api=0 + min_libgcrypt_version="$tmp" + fi + + AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version) + ok=no + if test "$LIBGCRYPT_CONFIG" != "no" ; then + req_major=`echo $min_libgcrypt_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + req_minor=`echo $min_libgcrypt_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + req_micro=`echo $min_libgcrypt_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version` + major=`echo $libgcrypt_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` + minor=`echo $libgcrypt_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` + micro=`echo $libgcrypt_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` + if test "$major" -gt "$req_major"; then + ok=yes + else + if test "$major" -eq "$req_major"; then + if test "$minor" -gt "$req_minor"; then + ok=yes + else + if test "$minor" -eq "$req_minor"; then + if test "$micro" -ge "$req_micro"; then + ok=yes + fi + fi + fi + fi + fi + fi + if test $ok = yes; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + if test $ok = yes; then + # If we have a recent libgcrypt, we should also check that the + # API is compatible + if test "$req_libgcrypt_api" -gt 0 ; then + tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0` + if test "$tmp" -gt 0 ; then + AC_MSG_CHECKING([LIBGCRYPT API version]) + if test "$req_libgcrypt_api" -eq "$tmp" ; then + AC_MSG_RESULT(okay) + else + ok=no + AC_MSG_RESULT([does not match (want=$req_libgcrypt_api got=$tmp)]) + fi + fi + fi + fi + if test $ok = yes; then + LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags` + LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs` + ifelse([$2], , :, [$2]) + else + LIBGCRYPT_CFLAGS="" + LIBGCRYPT_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(LIBGCRYPT_CFLAGS) + AC_SUBST(LIBGCRYPT_LIBS) +]) diff --git a/m4/libtasn1.m4 b/m4/libtasn1.m4 new file mode 100644 index 0000000000..ea2e10f56d --- /dev/null +++ b/m4/libtasn1.m4 @@ -0,0 +1,160 @@ +dnl Autoconf macros for libtasn1 +dnl $id$ + +# Modified for LIBTASN1 -- nmav +# Configure paths for LIBGCRYPT +# Shamelessly stolen from the one of XDELTA by Owen Taylor +# Werner Koch 99-12-09 + +dnl AM_PATH_LIBTASN1([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libtasn1, and define LIBTASN1_CFLAGS and LIBTASN1_LIBS +dnl +AC_DEFUN([AM_PATH_LIBTASN1], +[dnl +dnl Get the cflags and libraries from the libtasn1-config script +dnl +AC_ARG_WITH(libtasn1-prefix, + [ --with-libtasn1-prefix=PFX Prefix where libtasn1 is installed (optional)], + libtasn1_config_prefix="$withval", libtasn1_config_prefix="") + + if test x$libtasn1_config_prefix != x ; then + if test x${LIBTASN1_CONFIG+set} != xset ; then + LIBTASN1_CONFIG=$libtasn1_config_prefix/bin/libtasn1-config + fi + fi + + AC_PATH_PROG(LIBTASN1_CONFIG, libtasn1-config, no) + min_libtasn1_version=ifelse([$1], ,0.1.0,$1) + AC_MSG_CHECKING(for libtasn1 - version >= $min_libtasn1_version) + no_libtasn1="" + if test "$LIBTASN1_CONFIG" = "no" ; then + no_libtasn1=yes + else + LIBTASN1_CFLAGS=`$LIBTASN1_CONFIG $libtasn1_config_args --cflags` + LIBTASN1_LIBS=`$LIBTASN1_CONFIG $libtasn1_config_args --libs` + libtasn1_config_version=`$LIBTASN1_CONFIG $libtasn1_config_args --version` + + + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $LIBTASN1_CFLAGS" + LIBS="$LIBS $LIBTASN1_LIBS" +dnl +dnl Now check if the installed libtasn1 is sufficiently new. Also sanity +dnl checks the results of libtasn1-config to some extent +dnl + rm -f conf.libtasn1test + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <libtasn1.h> + +int +main () +{ + system ("touch conf.libtasn1test"); + + if( strcmp( asn1_check_version(NULL), "$libtasn1_config_version" ) ) + { + printf("\n*** 'libtasn1-config --version' returned %s, but LIBTASN1 (%s)\n", + "$libtasn1_config_version", asn1_check_version(NULL) ); + printf("*** was found! If libtasn1-config was correct, then it is best\n"); + printf("*** to remove the old version of LIBTASN1. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If libtasn1-config was wrong, set the environment variable LIBTASN1_CONFIG\n"); + printf("*** to point to the correct copy of libtasn1-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else if ( strcmp(asn1_check_version(NULL), LIBTASN1_VERSION ) ) + { + printf("\n*** LIBTASN1 header file (version %s) does not match\n", LIBTASN1_VERSION); + printf("*** library (version %s)\n", asn1_check_version(NULL) ); + } + else + { + if ( asn1_check_version( "$min_libtasn1_version" ) ) + { + return 0; + } + else + { + printf("no\n*** An old version of LIBTASN1 (%s) was found.\n", + asn1_check_version(NULL) ); + printf("*** You need a version of LIBTASN1 newer than %s. The latest version of\n", + "$min_libtasn1_version" ); + printf("*** LIBTASN1 is always available from ftp://gnutls.hellug.gr/pub/gnutls/libtasn1.\n"); + printf("*** \n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the libtasn1-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of LIBTASN1, but you can also set the LIBTASN1_CONFIG environment to point to the\n"); + printf("*** correct copy of libtasn1-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_libtasn1=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + + if test "x$no_libtasn1" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + if test -f conf.libtasn1test ; then + : + else + AC_MSG_RESULT(no) + fi + if test "$LIBTASN1_CONFIG" = "no" ; then + echo "*** The libtasn1-config script installed by LIBTASN1 could not be found" + echo "*** If LIBTASN1 was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the LIBTASN1_CONFIG environment variable to the" + echo "*** full path to libtasn1-config." + else + if test -f conf.libtasn1test ; then + : + else + echo "*** Could not run libtasn1 test program, checking why..." + CFLAGS="$CFLAGS $LIBTASN1_CFLAGS" + LIBS="$LIBS $LIBTASN1_LIBS" + AC_TRY_LINK([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <libtasn1.h> +], [ return !!asn1_check_version(NULL); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding LIBTASN1 or finding the wrong" + echo "*** version of LIBTASN1. If it is not finding LIBTASN1, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means LIBTASN1 was incorrectly installed" + echo "*** or that you have moved LIBTASN1 since it was installed. In the latter case, you" + echo "*** may want to edit the libtasn1-config script: $LIBTASN1_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + LIBTASN1_CFLAGS="" + LIBTASN1_LIBS="" + ifelse([$3], , :, [$3]) + fi + rm -f conf.libtasn1test + AC_SUBST(LIBTASN1_CFLAGS) + AC_SUBST(LIBTASN1_LIBS) +]) + +dnl *-*wedit:notab*-* Please keep this as the last line. diff --git a/m4/opencdk.m4 b/m4/opencdk.m4 new file mode 100644 index 0000000000..1957e51225 --- /dev/null +++ b/m4/opencdk.m4 @@ -0,0 +1,163 @@ +dnl Autoconf macros for opencdk +dnl $id$ + +# Configure paths for LIBOPENCDK +# Shamelessly stolen from the one of XDELTA by Owen Taylor +# Werner Koch 99-12-09 +# Modified for OpenCDK +# Timo Schulz 02-04-06 + +dnl AM_PATH_LIBOPENCDK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libopencdk, and define CDK_CFLAGS and CDK_LIBS +dnl +AC_DEFUN([AM_PATH_LIBOPENCDK], +[dnl +dnl Get the cflags and libraries from the opencdk-config script +dnl +AC_ARG_WITH(libopencdk-prefix, + [ --with-libopencdk-prefix=PFX Prefix where libopencdk is installed (optional)], + libopencdk_config_prefix="$withval", libopencdk_config_prefix="") +AC_ARG_ENABLE(libopencdktest, + [ --disable-libopencdktest Do not try to compile and run a test libopencdk program], + , enable_libopencdktest=yes) + + if test x$libopencdk_config_prefix != x ; then + if test x${LIBOPENCDK_CONFIG+set} != xset ; then + LIBOPENCDK_CONFIG=$libopencdk_config_prefix/bin/opencdk-config + fi + fi + + AC_PATH_PROG(LIBOPENCDK_CONFIG, opencdk-config, no) + min_libopencdk_version=ifelse([$1], ,1.1.0,$1) + AC_MSG_CHECKING(for libopencdk - version >= $min_libopencdk_version) + no_libopencdk="" + if test "$LIBOPENCDK_CONFIG" = "no" ; then + no_libopencdk=yes + else + LIBOPENCDK_CFLAGS=`$LIBOPENCDK_CONFIG $libopencdk_config_args --cflags` + LIBOPENCDK_LIBS=`$LIBOPENCDK_CONFIG $libopencdk_config_args --libs` + libopencdk_config_version=`$LIBOPENCDK_CONFIG $libopencdk_config_args --version` + if test "x$enable_libopencdktest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $LIBOPENCDK_CFLAGS" + LIBS="$LIBS $LIBOPENCDK_LIBS" +dnl +dnl Now check if the installed libopencdk is sufficiently new. Also sanity +dnl checks the results of opencdk-config to some extent +dnl + rm -f conf.libopencdktest + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <opencdk.h> + +int +main () +{ + system ("touch conf.libopencdktest"); + + if( strcmp( cdk_check_version(NULL), "$libopencdk_config_version" ) ) + { + printf("\n*** 'opencdk-config --version' returned %s, but LIBOPENCDK (%s)\n", + "$libopencdk_config_version", cdk_check_version(NULL) ); + printf("*** was found! If opencdk-config was correct, then it is best\n"); + printf("*** to remove the old version of LIBOPENCDK. You may also be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); + printf("*** required on your system.\n"); + printf("*** If opencdk-config was wrong, set the environment variable LIBOPENCDK_CONFIG\n"); + printf("*** to point to the correct copy of opencdk-config, and remove the file config.cache\n"); + printf("*** before re-running configure\n"); + } + else if ( strcmp(cdk_check_version(NULL), OPENCDK_VERSION ) ) + { + printf("\n*** LIBOPENCDK header file (version %s) does not match\n", OPENCDK_VERSION); + printf("*** library (version %s)\n", cdk_check_version(NULL) ); + } + else + { + if ( cdk_check_version( "$min_libopencdk_version" ) ) + { + return 0; + } + else + { + printf("no\n*** An old version of LIBOPENCDK (%s) was found.\n", + cdk_check_version(NULL) ); + printf("*** You need a version of LIBOPENCDK newer than %s. The latest version of\n", + "$min_libopencdk_version" ); + printf("*** LIBOPENCDK is always available from ftp://ftp.gnutls.org/pub/gnutls/opencdk/.\n"); + printf("*** \n"); + printf("*** If you have already installed a sufficiently new version, this error\n"); + printf("*** probably means that the wrong copy of the opencdk-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to remove the old version\n"); + printf("*** of LIBOPENCDK, but you can also set the LIBOPENCDK_CONFIG environment to point to the\n"); + printf("*** correct copy of opencdk-config. (In this case, you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at run-time))\n"); + } + } + return 1; +} +],, no_libopencdk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_libopencdk" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + if test -f conf.libopencdktest ; then + : + else + AC_MSG_RESULT(no) + fi + if test "$LIBOPENCDK_CONFIG" = "no" ; then + echo "*** The opencdk-config script installed by LIBOPENCDK could not be found" + echo "*** If LIBOPENCDK was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the LIBOPENCDK_CONFIG environment variable to the" + echo "*** full path to opencdk-config." + else + if test -f conf.libopencdktest ; then + : + else + echo "*** Could not run libopencdk test program, checking why..." + CFLAGS="$CFLAGS $LIBOPENCDK_CFLAGS" + LIBS="$LIBS $LIBOPENCDK_LIBS" + AC_TRY_LINK([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <opencdk.h> +], [ return !!cdk_check_version(NULL); ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding LIBOPENCDK or finding the wrong" + echo "*** version of LIBOPENCDK. If it is not finding LIBOPENCDK, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" + echo "***" ], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means LIBOPENCDK was incorrectly installed" + echo "*** or that you have moved LIBOPENCDK since it was installed. In the latter case, you" + echo "*** may want to edit the opencdk-config script: $LIBOPENCDK_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + LIBOPENCDK_CFLAGS="" + LIBOPENCDK_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(LIBOPENCDK_CFLAGS) + AC_SUBST(LIBOPENCDK_LIBS) + rm -f conf.libopencdktest +]) + +dnl *-*wedit:notab*-* Please keep this as the last line. |