configuration changes

This commit is contained in:
Werner Koch 2000-11-17 21:20:53 +00:00
parent 08eaf1cea1
commit fabce92fe3
9 changed files with 198 additions and 67 deletions

View File

@ -40,6 +40,8 @@
/* Some systems have mkdir that takes a single argument. */ /* Some systems have mkdir that takes a single argument. */
#undef MKDIR_TAKES_ONE_ARG #undef MKDIR_TAKES_ONE_ARG
/* path to the gpg binary */
#undef GPG_PATH
@BOTTOM@ @BOTTOM@

23
acinclude.m4 Normal file
View File

@ -0,0 +1,23 @@
dnl Macros to configure gpgme
dnl GNUPG_FIX_HDR_VERSION(FILE, NAME)
dnl (wk 2000-11-17)
AC_DEFUN(GNUPG_FIX_HDR_VERSION,
[ sed "s/^#define $2 \".*/#define $2 \"$VERSION\"/" $srcdir/$1 > $srcdir/$1.tmp
if cmp -s $srcdir/$1 $srcdir/$1.tmp 2>/dev/null; then
rm -f $srcdir/$1.tmp
else
rm -f $srcdir/$1
if mv $srcdir/$1.tmp $srcdir/$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
])

View File

@ -13,7 +13,7 @@ AM_MAINTAINER_MODE
# AGE, set REVISION to 0. # AGE, set REVISION to 0.
# 3. Interfaces removed (BAD, breaks upward compatibility): Increment # 3. Interfaces removed (BAD, breaks upward compatibility): Increment
# CURRENT, set AGE and REVISION to 0. # CURRENT, set AGE and REVISION to 0.
AM_INIT_AUTOMAKE(gpgme,0.0.0) AM_INIT_AUTOMAKE(gpgme,0.0.1)
LIBGPGME_LT_CURRENT=0 LIBGPGME_LT_CURRENT=0
LIBGPGME_LT_AGE=0 LIBGPGME_LT_AGE=0
LIBGPGME_LT_REVISION=0 LIBGPGME_LT_REVISION=0
@ -63,11 +63,32 @@ dnl
dnl Checks for system services dnl Checks for system services
dnl dnl
AC_PATH_PROG(GPG, gpg)
if test -z "$GPG"; then
AC_MSG_ERROR([[
***
*** GnuPG not found. Please install GnuPG first.
*** See http://www.gnupg.org/download.html
***
]])
fi
AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG")
dnl dnl
dnl Create config files dnl Create config files
dnl dnl
dnl
dnl Make the version number in gpgme/gpgme.h the same as the one here.
dnl (this is easier than to have a *.in file just for one substitution)
GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
dnl Substitution used for gpgme-config
GPGME_LIBS="-L${libdir} -lgpgme"
GPGME_CFLAGS=""
AC_SUBST(GPGME_LIBS)
AC_SUBST(GPGME_CFLAGS)
AC_OUTPUT_COMMANDS([ AC_OUTPUT_COMMANDS([
chmod +x gpgme/gpgme-config chmod +x gpgme/gpgme-config

View File

@ -24,7 +24,7 @@ libgpgme_la_SOURCES = \
key.c key.h \ key.c key.h \
keylist.c \ keylist.c \
rungpg.c rungpg.h status-table.h \ rungpg.c rungpg.h status-table.h \
gpgme.c errors.c gpgme.c version.c errors.c
errors.c : gpgme.h errors.c : gpgme.h

View File

@ -210,6 +210,28 @@ _gpgme_data_release_and_return_string ( GpgmeData dh )
return val; return val;
} }
char *
gpgme_data_release_and_get_mem ( GpgmeData dh, size_t *r_len )
{
char *val = NULL;
if (r_len)
*r_len = 0;
if (dh) {
size_t len = dh->len;
val = dh->private_buffer;
if ( !val && dh->data ) {
val = xtrymalloc ( len );
if ( val )
memcpy ( val, dh->data, len );
}
xfree (dh);
if (val && r_len )
*r_len = len;
}
return val;
}
GpgmeDataType GpgmeDataType
gpgme_data_get_type ( GpgmeData dh ) gpgme_data_get_type ( GpgmeData dh )

View File

@ -27,6 +27,17 @@ extern "C" {
#endif #endif
#endif #endif
/*
* The version of this header should match the one of the library
* It should not be used by a program because gpgme_check_version(NULL)
* does return the same version. The purpose of this macro is to
* let autoconf (using the AM_PATH_GPGME macro) check that this
* header matches the installed library.
* Warning: Do not edit the next line. configure will do that for you! */
#define GPGME_VERSION "0.0.1"
struct gpgme_context_s; struct gpgme_context_s;
typedef struct gpgme_context_s *GpgmeCtx; typedef struct gpgme_context_s *GpgmeCtx;
@ -108,6 +119,7 @@ GpgmeError gpgme_data_new_from_file ( GpgmeData *r_dh,
const char *fname, const char *fname,
int copy ); int copy );
void gpgme_data_release ( GpgmeData dh ); void gpgme_data_release ( GpgmeData dh );
char * gpgme_data_release_and_get_mem ( GpgmeData dh, size_t *r_len );
GpgmeDataType gpgme_data_get_type ( GpgmeData dh ); GpgmeDataType gpgme_data_get_type ( GpgmeData dh );
GpgmeError gpgme_data_rewind ( GpgmeData dh ); GpgmeError gpgme_data_rewind ( GpgmeData dh );
GpgmeError gpgme_data_read ( GpgmeData dh, GpgmeError gpgme_data_read ( GpgmeData dh,
@ -144,6 +156,7 @@ GpgmeError gpgme_op_verify ( GpgmeCtx c, GpgmeData sig, GpgmeData text,
/* miscellaneous functions */ /* miscellaneous functions */
const char *gpgme_check_version ( const char *req_version );
const char *gpgme_strerror (GpgmeError err); const char *gpgme_strerror (GpgmeError err);

View File

@ -3,7 +3,7 @@ dnl $Id$
# Configure paths for GPGME # Configure paths for GPGME
# Shamelessly stolen from the one of XDELTA by Owen Taylor # Shamelessly stolen from the one of XDELTA by Owen Taylor
# Werner Koch 2000-10-27 # Werner Koch 2000-11-17
dnl AM_PATH_GPGME([MINIMUM-VERSION, dnl AM_PATH_GPGME([MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
@ -13,11 +13,11 @@ AC_DEFUN(AM_PATH_GPGME,
[dnl [dnl
dnl Get the cflags and libraries from the gpgme-config script dnl Get the cflags and libraries from the gpgme-config script
dnl dnl
AC_ARG_WITH(gpgme-prefix, AC_ARG_WITH(gpgme-prefix,
[ --with-gpgme-prefix=PFX Prefix where gpgme is installed (optional)], [ --with-gpgme-prefix=PFX Prefix where gpgme is installed (optional)],
gpgme_config_prefix="$withval", gpgme_config_prefix="") gpgme_config_prefix="$withval", gpgme_config_prefix="")
AC_ARG_ENABLE(gpgmetest, AC_ARG_ENABLE(gpgmetest,
[ --disable-gpgmetest Do not try to compile and run a test gpgme program], [ --disable-gpgmetest Do not try to compile and run a test gpgme program],
, enable_gpgmetest=yes) , enable_gpgmetest=yes)
if test x$gpgme_config_prefix != x ; then if test x$gpgme_config_prefix != x ; then
@ -28,7 +28,7 @@ AC_ARG_ENABLE(gpgmetest,
fi fi
AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no)
min_gpgme_version=ifelse([$1], ,1.1.0,$1) min_gpgme_version=ifelse([$1], ,1.0.0,$1)
AC_MSG_CHECKING(for gpgme - version >= $min_gpgme_version) AC_MSG_CHECKING(for gpgme - version >= $min_gpgme_version)
no_gpgme="" no_gpgme=""
if test "$GPGME_CONFIG" = "no" ; then if test "$GPGME_CONFIG" = "no" ; then
@ -56,49 +56,50 @@ dnl
int int
main () main ()
{ {
system ("touch conf.gpgmetest"); system ("touch conf.gpgmetest");
if( strcmp( gcry_check_version(NULL), "$gpgme_config_version" ) ) if( strcmp( gpgme_check_version(NULL), "$gpgme_config_version" ) )
{ {
printf("\n*** 'gpgme-config --version' returned %s, but GPGME (%s)\n", printf("\n"
"$gpgme_config_version", gcry_check_version(NULL) ); "*** 'gpgme-config --version' returned %s, but GPGME (%s) was found!\n",
printf("*** was found! If gpgme-config was correct, then it is best\n"); "$gpgme_config_version", gpgme_check_version(NULL) );
printf("*** to remove the old version of GPGME. You may also be able to fix the error\n"); printf(
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); "*** If gpgme-config was correct, then it is best to remove the old\n"
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); "*** version of GPGME. You may also be able to fix the error\n"
printf("*** required on your system.\n"); "*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"
printf("*** If gpgme-config was wrong, set the environment variable GPGME_CONFIG\n"); "*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"
printf("*** to point to the correct copy of gpgme-config, and remove the file config.cache\n"); "*** required on your system.\n"
printf("*** before re-running configure\n"); "*** If gpgme-config was wrong, set the environment variable GPGME_CONFIG\n"
} "*** to point to the correct copy of gpgme-config, \n"
else if ( strcmp(gcry_check_version(NULL), GPGME_VERSION ) ) "*** and remove the file config.cache before re-running configure\n"
{ );
printf("\n*** GPGME header file (version %s) does not match\n", GPGME_VERSION); }
printf("*** library (version %s)\n", gcry_check_version(NULL) ); else if ( strcmp(gpgme_check_version(NULL), GPGME_VERSION ) )
} {
else printf("\n*** GPGME header file (version %s) does not match\n",
{ GPGME_VERSION);
if ( gcry_check_version( "$min_gpgme_version" ) ) printf("*** library (version %s)\n", gpgme_check_version(NULL) );
{ }
return 0; else
} {
else if ( gpgme_check_version( "$min_gpgme_version" ) )
{ return 0;
printf("no\n*** An old version of GPGME (%s) was found.\n", printf("no\n"
gcry_check_version(NULL) ); "*** An old version of GPGME (%s) was found.\n", gpgme_check_version(NULL) );
printf("*** You need a version of GPGME newer than %s. The latest version of\n", printf(
"$min_gpgme_version" ); "*** You need a version of GPGME newer than %s.\n", "$min_gpgme_version" );
printf("*** GPGME is always available from ftp://ftp.gnupg.org/pub/gpgme/gnupg.\n"); printf(
printf("*** (It is distributed along with GnuPG).\n"); "*** The latest version of GPGME is always available at\n"
printf("*** \n"); "*** ftp://ftp.gnupg.org/pub/gcrypt/alpha/gpgme/\n"
printf("*** If you have already installed a sufficiently new version, this error\n"); "*** \n"
printf("*** probably means that the wrong copy of the gpgme-config shell script is\n"); "*** If you have already installed a sufficiently new version, this error\n"
printf("*** being found. The easiest way to fix this is to remove the old version\n"); "*** probably means that the wrong copy of the gpgme-config shell script is\n"
printf("*** of GPGME, but you can also set the GPGME_CONFIG environment to point to the\n"); "*** being found. The easiest way to fix this is to remove the old version\n"
printf("*** correct copy of gpgme-config. (In this case, you will have to\n"); "*** of GPGME, but you can also set the GPGME_CONFIG environment to point to\n"
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); "*** the correct copy of gpgme-config. (In this case, you will have to\n"
printf("*** so that the correct libraries are found at run-time))\n"); "*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"
} "*** so that the correct libraries are found at run-time).\n"
);
} }
return 1; return 1;
} }
@ -133,21 +134,27 @@ main ()
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <gpgme.h> #include <gpgme.h>
], [ return !!gcry_check_version(NULL); ], ], [ gpgme_check_version(NULL); return 0 ],
[ echo "*** The test program compiled, but did not run. This usually means" [
echo "*** that the run-time linker is not finding GPGME or finding the wrong" echo "*** The test program compiled, but did not run. This usually means"
echo "*** version of GPGME. If it is not finding GPGME, you'll need to set your" echo "*** that the run-time linker is not finding GPGME or finding the wrong"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** version of GPGME. If it is not finding GPGME, you'll need to set your"
echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** is required on your system" echo "*** to the installed location Also, make sure you have run ldconfig if"
echo "***" echo "*** that is required on your system"
echo "*** If you have an old version installed, it is best to remove it, although" echo "***"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" echo "*** If you have an old version installed, it is best to remove it,"
echo "***" ], echo "*** although you may also be able to get things to work by"
[ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** modifying LD_LIBRARY_PATH"
echo "*** exact error that occured. This usually means GPGME was incorrectly installed" echo "***"
echo "*** or that you have moved GPGME since it was installed. In the latter case, you" ],
echo "*** may want to edit the gpgme-config script: $GPGME_CONFIG" ]) [
echo "*** The test program failed to compile or link. See the file config.log"
echo "*** for the exact error that occured. This usually means GPGME was"
echo "*** incorrectly installed or that you have moved GPGME since it was"
echo "*** installed. In the latter case, you may want to edit the"
echo "*** gpgme-config script: $GPGME_CONFIG"
])
CFLAGS="$ac_save_CFLAGS" CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS" LIBS="$ac_save_LIBS"
fi fi
@ -161,4 +168,3 @@ main ()
rm -f conf.gpgmetest rm -f conf.gpgmetest
]) ])

View File

@ -548,7 +548,7 @@ _gpgme_gpg_spawn( GpgObject gpg, void *opaque )
close (fd); close (fd);
} }
execv ("/usr/local/bin/gpg", gpg->argv ); execv ( GPG_PATH, gpg->argv );
fprintf (stderr,"exec of gpg failed\n"); fprintf (stderr,"exec of gpg failed\n");
_exit (8); _exit (8);
} }

44
tests/mkdemodirs Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
set -e
GPG="gpg --batch --quiet --no-secmem-warning"
NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India
Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo
Sierra Tango Uniform Victor Whisky XRay Yankee Zulu'
if [ "$1" = "--clean" ]; then
(for i in $NAMES; do
[ -d $i ] && rm -r $i
done) || true
exit 0
fi
[ -z "$srcdir" ] && srcdir="../tests"
$GPG --dearmor -o secdemo.gpg --yes $srcdir/secdemo.asc
$GPG --dearmor -o pubdemo.gpg --yes $srcdir/pubdemo.asc
[ -f ./tdb.tmp ] && rm ./tdb.tmp
GPGDEMO="$GPG --homedir . --trustdb-name ./tdb.tmp --no-default-keyring
--keyring pubdemo.gpg --secret-keyring secdemo.gpg"
echo -n "Creating:"
for name in $NAMES; do
echo -n " $name"
[ -d $name ] && rm -r $name
mkdir $name
$GPGDEMO --export-secret-key -o - $name > $name/Secret.gpg
$GPG --homedir $name --import $name/Secret.gpg
$GPGDEMO --export -o - $name > $name/Public.gpg
$GPG --homedir $name --import $name/Public.gpg
[ -f $name/pubring.gpg~ ] && rm $name/pubring.gpg~
done
echo "."
[ -f ./tdb.tmp ] && rm ./tdb.tmp
rm pubdemo.gpg secdemo.gpg