From: Marcus Brinkmann Date: Wed, 3 Sep 2003 01:15:56 +0000 (+0000) Subject: 2003-09-03 Marcus Brinkmann X-Git-Tag: gpgme-0-4-3~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d772a96a624609526438a80cf97a9ae55cf4d563;p=gpgme.git 2003-09-03 Marcus Brinkmann * configure.ac: Remove GPGME_CONFIG_LIBS and GPGME_CONFIG_CFLAGS. doc/ 2003-09-03 Marcus Brinkmann * gpgme.texi (Header): We don't use the assuan namespace anymore. Document new thread options. gpgme/ 2003-09-03 Marcus Brinkmann * gpgme-config.in: Rewritten. * gpgme.m4: Rewritten. --- diff --git a/ChangeLog b/ChangeLog index c013709..6e055d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-09-03 Marcus Brinkmann + + * configure.ac: Remove GPGME_CONFIG_LIBS and GPGME_CONFIG_CFLAGS. + 2003-09-02 Marcus Brinkmann * configure.ac: Move invocation of AC_CANONICAL_HOST up to diff --git a/NEWS b/NEWS index 34e461e..5ebcac5 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,13 @@ Noteworthy changes in version 0.4.3 (unreleased) The old code for automagically detecting the thread library is still part of libgpgme, but it is DEPRECATED. + * There are new automake macros AM_PATH_GPGME_PTH and + AM_PATH_GPGME_PTHREAD, which support checking for thread-enabled + versions of GPGME. They define GPGME_PTH_CFLAGS, GPGME_PTH_LIBS, + GPGME_PTHREAD_CFLAGS and GPGME_PTHREAD_LIBS respectively. These + variables of course also include the configuration for the thread + package itself. Alternatively, use libtool. + * gpgme_get_key fails with GPG_ERR_AMBIGUOUS_NAME if the key ID provided was not unique, instead returning the first matching key. diff --git a/doc/ChangeLog b/doc/ChangeLog index ac6f9aa..7306592 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2003-09-03 Marcus Brinkmann + + * gpgme.texi (Header): We don't use the assuan namespace anymore. + Document new thread options. + 2003-08-14 Marcus Brinkmann * gpgme.texi (Creating a Signature): Change type of member class diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 7dd261d..1ec4ef5 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -105,6 +105,7 @@ Preparation * Header:: What header file you need to include. * Building the Source:: Compiler options to be used. * Using Automake:: Compiler options to be used the easy way. +* Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Multi Threading:: How @acronym{GPGME} can be used in an MT environment. @@ -318,6 +319,7 @@ of the library are verified. * Header:: What header file you need to include. * Building the Source:: Compiler options to be used. * Using Automake:: Compiler options to be used the easy way. +* Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Multi Threading:: How @acronym{GPGME} can be used in an MT environment. @end menu @@ -341,10 +343,6 @@ The name space of @acronym{GPGME} is @code{gpgme_*} for function names and data types and @code{GPGME_*} for other symbols. Symbols internal to @acronym{GPGME} take the form @code{_gpgme_*} and @code{_GPGME_*}. -Because @acronym{GPGME} links to the Assuan library, linking to -@acronym{GPGME} will also use the @code{assuan_*} and @code{_assuan_*} -name space indirectly. - Because @acronym{GPGME} makes use of the GPG Error library, using @acronym{GPGME} will also use the @code{GPG_ERR_*} name space directly, and the @code{gpg_err*} and @code{gpg_str*} name space @@ -399,6 +397,12 @@ specifying both options to @command{gpgme-config}: gcc -o foo foo.c `gpgme-config --cflags --libs` @end example +If you want to link to one of the thread-safe versions of +@acronym{GPGME}, you must specify the @option{--thread} option before +any other option to select the thread package you want to link with. +Supported thread packages are @option{--thread=pth} and +@option{--thread=pthread}. + @node Using Automake @section Using Automake @@ -415,6 +419,8 @@ provides an extension to Automake that does all the work for you. @r{[}@var{\varname\}@r{]} @end macro @defmac AM_PATH_GPGME (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@defmacx AM_PATH_GPGME_PTH (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@defmacx AM_PATH_GPGME_PTHREAD (@ovar{minimum-version}, @ovar{action-if-found}, @ovar{action-if-not-found}) Check whether @acronym{GPGME} (at least version @var{minimum-version}, if given) exists on the host system. If it is found, execute @var{action-if-found}, otherwise do @var{action-if-not-found}, if @@ -424,6 +430,14 @@ Additionally, the function defines @code{GPGME_CFLAGS} to the flags needed for compilation of the program to find the @file{gpgme.h} header file, and @code{GPGME_LIBS} to the linker flags needed to link the program to the @acronym{GPGME} library. + +@code{AM_PATH_GPGME_PTH} checks for the version of @acronym{GPGME} +that can be used with GNU Pth, and defines @code{GPGME_PTH_CFLAGS} and +@code{GPGME_PTH_LIBS}. + +@code{AM_PATH_GPGME_PTHREAD} checks for the version of @acronym{GPGME} +that can be used with the native pthread implementation, and defines +@code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}. @end defmac You can use the defined Autoconf variables like this in your @@ -435,6 +449,16 @@ LDADD = $(GPGME_LIBS) @end example +@node Using Libtool +@section Using Libtool +@cindex libtool + +The easiest way is to just use GNU Libtool. If you use libtool, and +link to @code{libgpgme.la}, @code{libgpgme-pth.la} or +@code{libgpgme-pthread.la} respectively, everything will be done +automatically by Libtool. + + @node Library Version Check @section Library Version Check @cindex version check, of the library diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index c860269..9be8f3f 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2003-09-03 Marcus Brinkmann + + * gpgme-config.in: Rewritten. + * gpgme.m4: Rewritten. + 2003-08-19 Marcus Brinkmann The ath files (ath.h, ath.c, ath-pth.c, ath-pthread.c, diff --git a/gpgme/gpgme-config.in b/gpgme/gpgme-config.in index a1010f1..4e428db 100644 --- a/gpgme/gpgme-config.in +++ b/gpgme/gpgme-config.in @@ -9,110 +9,109 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -PGM=gpgme-config -libs="@GPGME_CONFIG_LIBS@" -cflags="@GPGME_CONFIG_CFLAGS@" prefix=@prefix@ exec_prefix=@exec_prefix@ -includes="" -libdirs="" -exec_prefix_set=no -echo_libs=no -echo_cflags=no -echo_prefix=no -echo_exec_prefix=no +includedir=@includedir@ +libdir=@libdir@ +# Configure libgpg-error. gpg_error_cflags="@GPG_ERROR_CFLAGS@" gpg_error_libs="@GPG_ERROR_LIBS@" +# Configure thread packages. +thread_modules="" + +@HAVE_PTH_TRUE@thread_modules="$thread_modules pth" +libs_pth="@PTH_LDFLAGS@ @PTH_LIBS@" +cflags_pth="@PTH_CFLAGS@" + +@HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread" +libs_pthread="-lpthread" +cflags_pthread="" + +output="" usage() { - cat <&2 + 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 + -*=*) + 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 + case $1 in + --prefix) + output="$output $prefix" + ;; + --exec-prefix) + output="$output $exec_prefix" + ;; + --version) + echo "@VERSION@" + exit 0 + ;; + --cflags) + output="$output -I$includedir" + case "$thread_module" in + pthread) + output="$output $cflags_pthread" + ;; + pth) + output="$output $cflags_pth" + ;; + esac + output="$output $gpg_error_cflags" + ;; + --libs) + output="$output -L@libdir@" + case "$thread_module" in + pthread) + output="$output -lgpgme-pthread $libs_pthread" + ;; + pth) + output="$output -lgpgme-pth $libs_pth" + ;; + *) + output="$output -lgpgme" + esac + output="$output $gpg_error_libs" + ;; + --thread=*) + for thread_mod in $thread_modules; do + if test "$thread_mod" = "$optarg"; then + thread_module="$optarg"; + fi + done + if test "x$thread_module" = "x"; then + usage 1 1>&2 + fi + ;; + *) + 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 $cflags ; do - if test "$i" = "-I@includedir@" ; then - includes="" - fi - done - fi - echo $includes $cflags $gpg_error_cflags -fi - -if test "$echo_libs" = "yes"; then - if test "@libdir@" != "/usr/lib" ; then - libdirs="-L@libdir@" - for i in $libs ; do - if test "$i" = "-L@libdir@" ; then - libdirs="" - fi - done - fi - echo $libdirs $libs $gpg_error_libs -fi - +echo $output diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 6c6c97e..2970810 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -92,8 +92,8 @@ gpgme_err_make (gpgme_err_source_t source, gpgme_err_code_t code) } -/* The user can define GPG_ERR_SOURCE_DEFAULT before including this - file to specify a default source for gpg_error. */ +/* The user can define GPGME_ERR_SOURCE_DEFAULT before including this + file to specify a default source for gpgme_error. */ #ifndef GPGME_ERR_SOURCE_DEFAULT #define GPGME_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1 #endif diff --git a/gpgme/gpgme.m4 b/gpgme/gpgme.m4 index dbfb983..5cdbca8 100644 --- a/gpgme/gpgme.m4 +++ b/gpgme/gpgme.m4 @@ -1,25 +1,32 @@ dnl Autoconf macros for libgpgme dnl $Id$ - -dnl AM_PATH_GPGME([MINIMUM-VERSION, -dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) -dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS -dnl -AC_DEFUN(AM_PATH_GPGME, +AC_DEFUN(_AM_PATH_GPGME_CONFIG, [ AC_ARG_WITH(gpgme-prefix, AC_HELP_STRING([--with-gpgme-prefix=PFX], [prefix where GPGME is installed (optional)]), gpgme_config_prefix="$withval", gpgme_config_prefix="") - if test x$gpgme_config_prefix != x ; then - gpgme_config_args="$gpgme_config_args --prefix=$gpgme_config_prefix" - if test x${GPGME_CONFIG+set} != xset ; then - GPGME_CONFIG=$gpgme_config_prefix/bin/gpgme-config - fi + if test "x$gpgme_config_prefix" != x ; then + GPGME_CONFIG="$gpgme_config_prefix/bin/gpgme-config" fi - AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) - min_gpgme_version=ifelse([$1], ,0.3.9,$1) + + gpgme_version=`$GPGME_CONFIG --version` + gpgme_version_major=`echo $gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` + gpgme_version_minor=`echo $gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` + gpgme_version_micro=`echo $gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` +]) + +dnl AM_PATH_GPGME([MINIMUM-VERSION, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS. +dnl +AC_DEFUN([AM_PATH_GPGME], +[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl + min_gpgme_version=ifelse([$1], ,0.4.2,$1) AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) ok=no if test "$GPGME_CONFIG" != "no" ; then @@ -29,22 +36,15 @@ AC_DEFUN(AM_PATH_GPGME, sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` req_micro=`echo $min_gpgme_version | \ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` - gpgme_config_version=`$GPGME_CONFIG $gpgme_config_args --version` - major=`echo $gpgme_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - minor=`echo $gpgme_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - micro=`echo $gpgme_config_version | \ - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` - if test "$major" -gt "$req_major"; then + if test "$gpgme_version_major" -gt "$req_major"; then ok=yes else - if test "$major" -eq "$req_major"; then - if test "$minor" -gt "$req_minor"; then + if test "$gpgme_version_major" -eq "$req_major"; then + if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes else - if test "$minor" -eq "$req_minor"; then - if test "$micro" -ge "$req_micro"; then + if test "$gpgme_version_minor" -eq "$req_minor"; then + if test "$gpgme_version_micro" -ge "$req_micro"; then ok=yes fi fi @@ -53,8 +53,8 @@ AC_DEFUN(AM_PATH_GPGME, fi fi if test $ok = yes; then - GPGME_CFLAGS=`$GPGME_CONFIG $gpgme_config_args --cflags` - GPGME_LIBS=`$GPGME_CONFIG $gpgme_config_args --libs` + GPGME_CFLAGS=`$GPGME_CONFIG --cflags` + GPGME_LIBS=`$GPGME_CONFIG --libs` AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else @@ -67,3 +67,101 @@ AC_DEFUN(AM_PATH_GPGME, AC_SUBST(GPGME_LIBS) ]) +dnl AM_PATH_GPGME_PTH([MINIMUM-VERSION, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libgpgme and define GPGME_PTH_CFLAGS and GPGME_PTH_LIBS. +dnl +AC_DEFUN([AM_PATH_GPGME_PTH], +[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl + min_gpgme_version=ifelse([$1], ,0.4.2,$1) + AC_MSG_CHECKING(for GPGME Pth - version >= $min_gpgme_version) + ok=no + if test "$GPGME_CONFIG" != "no" ; then + if `$GPGME_CONFIG --thread=pth 2> /dev/null` ; then + req_major=`echo $min_gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + req_minor=`echo $min_gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + req_micro=`echo $min_gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + if test "$gpgme_version_major" -gt "$req_major"; then + ok=yes + else + if test "$gpgme_version_major" -eq "$req_major"; then + if test "$gpgme_version_minor" -gt "$req_minor"; then + ok=yes + else + if test "$gpgme_version_minor" -eq "$req_minor"; then + if test "$gpgme_version_micro" -ge "$req_micro"; then + ok=yes + fi + fi + fi + fi + fi + fi + fi + if test $ok = yes; then + GPGME_PTH_CFLAGS=`$GPGME_CONFIG --thread=pth --cflags` + GPGME_PTH_LIBS=`$GPGME_CONFIG --thread=pth --libs` + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + GPGME_PTH_CFLAGS="" + GPGME_PTH_LIBS="" + AC_MSG_RESULT(no) + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GPGME_PTH_CFLAGS) + AC_SUBST(GPGME_PTH_LIBS) +]) + +dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS +dnl and GPGME_PTHREAD_LIBS. +dnl +AC_DEFUN([AM_PATH_GPGME_PTHREAD], +[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl + min_gpgme_version=ifelse([$1], ,0.4.2,$1) + AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version) + ok=no + if test "$GPGME_CONFIG" != "no" ; then + if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then + req_major=`echo $min_gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + req_minor=`echo $min_gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + req_micro=`echo $min_gpgme_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + if test "$gpgme_version_major" -gt "$req_major"; then + ok=yes + else + if test "$gpgme_version_major" -eq "$req_major"; then + if test "$gpgme_version_minor" -gt "$req_minor"; then + ok=yes + else + if test "$gpgme_version_minor" -eq "$req_minor"; then + if test "$gpgme_version_micro" -ge "$req_micro"; then + ok=yes + fi + fi + fi + fi + fi + fi + fi + if test $ok = yes; then + GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags` + GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs` + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + GPGME_PTHREAD_CFLAGS="" + GPGME_PTHREAD_LIBS="" + AC_MSG_RESULT(no) + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GPGME_PTHREAD_CFLAGS) + AC_SUBST(GPGME_PTHREAD_LIBS) +])