summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>1999-12-09 16:23:36 +0000
committerWerner Koch <wk@gnupg.org>1999-12-09 16:23:36 +0000
commitf2c7540d7eedc25d07133a7ee2d199c63d337754 (patch)
tree4c258c94c57e6b595becacb4487334dd551b7c30
parent2af22dd84e396dc2baf12d37d4642ceba4dffc83 (diff)
downloadlibgcrypt-f2c7540d7eedc25d07133a7ee2d199c63d337754.tar.gz
See ChangeLog: Thu Dec 9 17:22:27 CET 1999 Werner Koch
-rw-r--r--ChangeLog6
-rw-r--r--acinclude.m426
-rw-r--r--configure.in8
-rw-r--r--src/Makefile.am4
-rw-r--r--src/gcrypt-config.in95
-rw-r--r--src/gcrypt.h10
-rw-r--r--src/gcrypt.m474
7 files changed, 171 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 1ff56c48..31c21738 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Dec 9 17:22:27 CET 1999 Werner Koch <wk@gnupg.de>
+
+ * acinclude.m4 (GNUPG_FIX_HDR_VERSION): New.
+ * configure.in: Check and fix the version number of gcrypt/gcrypt.h
+ so that it is always the save as VERSION.
+
Thu Oct 28 16:17:46 CEST 1999 Werner Koch <wk@gnupg.de>
* Started with development series 1.1 on 1999-10-26
diff --git a/acinclude.m4 b/acinclude.m4
index aa721ea8..4a8f0a2b 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -27,6 +27,28 @@ AC_DEFUN(GNUPG_CHECK_TYPEDEF,
])
+dnl GNUPG_FIX_HDR_VERSION(FILE, NAME)
+dnl Make the version number in gcrypt/gcrypt.h the same as the one here.
+dnl (this is easier than to have a .in file just for one substitution)
+dnl
+AC_DEFUN(GNUPG_FIX_HDR_VERSION,
+ [ sed "s/^#define $2 \".*/#define $2 \"$VERSION\"/" $1 > $1.tmp
+ if cmp -s $1 $1.tmp 2>/dev/null; then
+ rm -f $1.tmp
+ else
+ rm -f $1
+ if mv $1.tmp $1 ; then
+ :
+ else
+ AC_MSG_ERROR([[
+*** Failed to fix the version string macro $2 in $1.
+*** The old file has been saved as $1.tmp
+ ]])
+ fi
+ AC_MSG_WARN([fixed the $2 macro in $1])
+ fi
+ ])
+
dnl GNUPG_LINK_FILES( SRC, DEST )
dnl same as AC_LINK_FILES, but collect the files to link in
@@ -49,6 +71,8 @@ define(GNUPG_DO_LINK_FILES,
])
+
+
dnl GNUPG_CHECK_ENDIAN
dnl define either LITTLE_ENDIAN_HOST or BIG_ENDIAN_HOST
dnl
@@ -633,7 +657,7 @@ AC_DEFUN(GNUPG_FUNC_MKDIR_TAKES_ONE_ARG,
#ifdef HAVE_DIRECT_H
# include <direct.h>
#endif], [mkdir ("foo", 0);],
- gnupg_cv_mkdir_takes_one_arg=no, gnupg_cv_mkdir_takes_one_arg=yes)])
+ gnupg_cv_mkdir_takes_one_arg=no, gnupg_cv_mkdir_takes_one_arg=yes)])
if test $gnupg_cv_mkdir_takes_one_arg = yes ; then
AC_DEFINE(MKDIR_TAKES_ONE_ARG)
fi
diff --git a/configure.in b/configure.in
index e553917a..2651b87a 100644
--- a/configure.in
+++ b/configure.in
@@ -678,8 +678,15 @@ AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
GNUPG_DO_LINK_FILES
+dnl
+dnl Make the version number in gcrypt/gcrypt.h the same as the one here.
+dnl (this is easier than to have a .in file just for one substitution)
+dnl
+GNUPG_FIX_HDR_VERSION(gcrypt/gcrypt.h, GCRYPT_VERSION)
+
AC_OUTPUT_COMMANDS([
+chmod +x gcrypt/gcrypt-config
cat >g10defs.tmp <<G10EOF
/* Generated automatically by configure */
#ifdef HAVE_DRIVE_LETTERS
@@ -700,7 +707,6 @@ else
mv g10defs.tmp g10defs.h
echo "g10defs.h created"
fi
-chmod +x gcrypt/gcrypt-config
],[
prefix=$prefix
exec_prefix=$exec_prefix
diff --git a/src/Makefile.am b/src/Makefile.am
index 74862a24..e88bba14 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-## EXTRA_DIST =
+EXTRA_DIST = gcrypt-config.in
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl
lib_LTLIBRARIES = libgcrypt.la
@@ -40,3 +40,5 @@ libgcrypt.sym: $(libgcrypt_la_OBJECTS)
$(NM) $(libgcrypt_la_OBJECTS) \
| $(AWK) '$$2=="T" && $$3 ~ /^gcry_/ {print $$3}' >libgcrypt.sym
+
+
diff --git a/src/gcrypt-config.in b/src/gcrypt-config.in
new file mode 100644
index 00000000..b86f0f66
--- /dev/null
+++ b/src/gcrypt-config.in
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+
+#gcrypt_libs="@GCRYPT_LIBS@"
+#gcrypt_cflags="@GCRYPT_CFLAGS@"
+gcrypt_libs="-L/negev/gcrypt/gnupg/gcrypt/.libs -lgcrypt"
+gcrypt_cflags="-I/negev/gcrypt/gnupg/gcrypt"
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+exec_prefix_set=no
+
+usage()
+{
+ cat <<EOF
+Usage: gcrypt-config [OPTIONS]
+Options:
+ [--prefix[=DIR]]
+ [--exec-prefix[=DIR]]
+ [--version]
+ [--libs]
+ [--cflags]
+EOF
+ exit $1
+}
+
+if test $# -eq 0; then
+ usage 1 1>&2
+fi
+
+while test $# -gt 0; do
+ case "$1" in
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ case $1 in
+ --prefix=*)
+ prefix=$optarg
+ if test $exec_prefix_set = no ; then
+ exec_prefix=$optarg
+ fi
+ ;;
+ --prefix)
+ echo_prefix=yes
+ ;;
+ --exec-prefix=*)
+ exec_prefix=$optarg
+ exec_prefix_set=yes
+ ;;
+ --exec-prefix)
+ echo_exec_prefix=yes
+ ;;
+ --version)
+ echo "@VERSION@"
+ exit 0
+ ;;
+ --cflags)
+ echo_cflags=yes
+ ;;
+ --libs)
+ echo_libs=yes
+ ;;
+ *)
+ usage 1 1>&2
+ ;;
+ esac
+ shift
+done
+
+if test "$echo_prefix" = "yes"; then
+ echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+ echo $exec_prefix
+fi
+
+if test "$echo_cflags" = "yes"; then
+ if test "@includedir@" != "/usr/include" ; then
+ includes="-I@includedir@"
+ for i in $gcrypt_cflags ; do
+ if test "$i" = "-I@includedir@" ; then
+ includes=""
+ fi
+ done
+ fi
+ echo $includes $gcrypt_cflags
+fi
+
+if test "$echo_libs" = "yes"; then
+ echo ${gcrypt_libs}
+fi
+
+
diff --git a/src/gcrypt.h b/src/gcrypt.h
index be58ce7e..aea01190 100644
--- a/src/gcrypt.h
+++ b/src/gcrypt.h
@@ -27,6 +27,16 @@
extern "C" {
#endif
+/*
+ * The version of this header should match the one of the library
+ * It should not be used by a program because gcry_check_version()
+ * should reurn the same version. The purpose of this macro is to
+ * let autoconf (using the AM_PATH_GCRYPT macro) check that this
+ * header matches the installed library.
+ * Note: Do not edit the next line as configure may fix the string here.
+ */
+#define GCRYPT_VERSION "1.1.0a"
+
#ifndef HAVE_BYTE_TYPEDEF
# undef byte /* maybe there is a macro with this name */
diff --git a/src/gcrypt.m4 b/src/gcrypt.m4
index fd1ee889..4ac46f12 100644
--- a/src/gcrypt.m4
+++ b/src/gcrypt.m4
@@ -1,8 +1,9 @@
dnl Autoconf macros for libgcrypt
+dnl $id$
# Configure paths for GCRYPT
# Shamelessly stolen from the one of XDELTA by Owen Taylor
-# Werner Koch 99-12-08
+# Werner Koch 99-12-09
dnl AM_PATH_GCRYPT([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for gcrypt, and define GCRYPT_CFLAGS and GCRYPT_LIBS
@@ -34,12 +35,7 @@ AC_ARG_ENABLE(gcrypttest,
else
GCRYPT_CFLAGS=`$GCRYPT_CONFIG $gcrypt_config_args --cflags`
GCRYPT_LIBS=`$GCRYPT_CONFIG $gcrypt_config_args --libs`
- gcrypt_config_major_version=`$GCRYPT_CONFIG $gcrypt_config_args --version | \
- sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
- gcrypt_config_minor_version=`$GCRYPT_CONFIG $gcrypt_config_args --version | \
- sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
- gcrypt_config_micro_version=`$GCRYPT_CONFIG $gcrypt_config_args --version | \
- sed 's/.* \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+ gcrypt_config_version=`$GCRYPT_CONFIG $gcrypt_config_args --version`
if test "x$enable_gcrypttest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
@@ -51,44 +47,20 @@ dnl checks the results of gcrypt-config to some extent
dnl
rm -f conf.gcrypttest
AC_TRY_RUN([
-#include <gcrypt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <gcrypt.h>
int
main ()
{
- int major, minor, micro;
- unsigned int major_gcrypt, minor_gcrypt, micro_gcrypt, patlvl_gcrypt;
- char *tmp_version;
- char ver_string[20];
-
system ("touch conf.gcrypttest");
- /* HP/UX 9 (%@#!) writes to sscanf strings */
- tmp_version = strdup("$min_gcrypt_version");
- if( !tmp_version )
- exit(1);
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
- printf("%s, bad version string\n", "$min_gcrypt_version");
- exit(1);
- }
-
- sprintf( ver_string, "%lX", gcrypt_version() );
- if ( sscanf(ver_string, "%1x%2x%1x%2x",
- &major_gcrypt, &minor_gcrypt, &patlvl_gcrypt, &micro_gcrypt) != 4) {
- printf("%s, gcrypt returned bad version string\n", ver_string );
- exit(1);
- }
-
- if ((major_gcrypt != $gcrypt_config_major_version) ||
- (minor_gcrypt != $gcrypt_config_minor_version) ||
- (micro_gcrypt != $gcrypt_config_micro_version))
+ if( strcmp( gcry_check_version(NULL), "$gcrypt_config_version" ) )
{
- printf("\n*** 'gcrypt-config --version' returned %d.%d.%d, but GCRYPT (%u.%u.%u)\n",
- $gcrypt_config_major_version, $gcrypt_config_minor_version, $gcrypt_config_micro_version,
- major_gcrypt, minor_gcrypt, micro_gcrypt);
+ printf("\n*** 'gcrypt-config --version' returned %s, but GCRYPT (%s)\n",
+ "$gcrypt_config_version", gcry_check_version(NULL) );
printf("*** was found! If gcrypt-config was correct, then it is best\n");
printf("*** to remove the old version of GCRYPT. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
@@ -98,27 +70,25 @@ main ()
printf("*** to point to the correct copy of gcrypt-config, and remove the file config.cache\n");
printf("*** before re-running configure\n");
}
- else if ( gcrypt_version() != GCRYPT_VERSION )
+ else if ( strcmp(gcry_check_version(NULL), GCRYPT_VERSION ) )
{
- printf("*** GCRYPT header file (version %lx) does not match\n", GCRYPT_VERSION);
- printf("*** library (version %lx)\n", gcrypt_version() );
+ printf("\n*** GCRYPT header file (version %s) does not match\n", GCRYPT_VERSION);
+ printf("*** library (version %s)\n", gcry_check_version(NULL) );
}
else
{
- if ((major_gcrypt > major) ||
- ((major_gcrypt == major) && (minor_gcrypt > minor)) ||
- ((major_gcrypt == major) && (minor_gcrypt == minor) && (micro_gcrypt >= micro)))
+ if ( gcry_check_version( "$min_gcrypt_version" ) )
{
return 0;
}
else
{
- printf("\n*** An old version of GCRYPT (%u.%u.%u) was found.\n",
- major_gcrypt, minor_gcrypt, micro_gcrypt);
- printf("*** You need a version of GCRYPT newer than %d.%d.%d. The latest version of\n",
- major, minor, micro);
+ printf("no\n*** An old version of GCRYPT (%s) was found.\n",
+ gcry_check_version(NULL) );
+ printf("*** You need a version of GCRYPT newer than %s. The latest version of\n",
+ "$min_gcrypt_version" );
printf("*** GCRYPT is always available from ftp://ftp.gnupg.org/pub/gcrypt/gnupg.\n");
- printf("*** (It comes along with GnuPG).\n");
+ printf("*** (It is distributed along with GnuPG).\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 gcrypt-config shell script is\n");
@@ -140,7 +110,11 @@ main ()
AC_MSG_RESULT(yes)
ifelse([$2], , :, [$2])
else
- AC_MSG_RESULT(no)
+ if test -f conf.gcrypttest ; then
+ :
+ else
+ AC_MSG_RESULT(no)
+ fi
if test "$GCRYPT_CONFIG" = "no" ; then
echo "*** The gcrypt-config script installed by GCRYPT could not be found"
echo "*** If GCRYPT was installed in PREFIX, make sure PREFIX/bin is in"
@@ -154,9 +128,11 @@ main ()
CFLAGS="$CFLAGS $GCRYPT_CFLAGS"
LIBS="$LIBS $GCRYPT_LIBS"
AC_TRY_LINK([
-#include <gcrypt.h>
#include <stdio.h>
-], [ return !!gcrypt_version(); ],
+#include <stdlib.h>
+#include <string.h>
+#include <gcrypt.h>
+], [ return !!gcry_check_version(NULL); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GCRYPT or finding the wrong"
echo "*** version of GCRYPT. If it is not finding GCRYPT, you'll need to set your"