diff options
author | Marcus Brinkmann <mb@g10code.com> | 2003-06-06 01:55:13 +0000 |
---|---|---|
committer | Marcus Brinkmann <mb@g10code.com> | 2003-06-06 01:55:13 +0000 |
commit | 56d2cbdc9620015a836ba2b78d639196e7b0362e (patch) | |
tree | 6bbbc118778bb5c4fb7b4c91af1eca8683f12efe | |
parent | 99230768cdb0afc296cb03431f31929e8161d46d (diff) | |
download | libgpg-error-56d2cbdc9620015a836ba2b78d639196e7b0362e.tar.gz |
2003-06-06 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Define GPG_ERROR_CONFIG_LIBS and
GPG_ERROR_CONFIG_CFLAGS.
Add src/gpg-error-config to config files.
* src/Makefile.am (EXTRA_DIST): Add gpg-error-config.in and
gpg-error.m4.
(bin_SCRIPTS): New variable.
(m4datadir, m4data_DATA): New variables.
* src/gpg-error-config.in: New file.
* src/gpg-error.m4: New file.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/gpg-error-config.in | 115 | ||||
-rw-r--r-- | src/gpg-error.m4 | 67 |
5 files changed, 206 insertions, 1 deletions
@@ -1,3 +1,15 @@ +2003-06-06 Marcus Brinkmann <marcus@g10code.de> + + * configure.ac: Define GPG_ERROR_CONFIG_LIBS and + GPG_ERROR_CONFIG_CFLAGS. + Add src/gpg-error-config to config files. + * src/Makefile.am (EXTRA_DIST): Add gpg-error-config.in and + gpg-error.m4. + (bin_SCRIPTS): New variable. + (m4datadir, m4data_DATA): New variables. + * src/gpg-error-config.in: New file. + * src/gpg-error.m4: New file. + 2003-06-05 Marcus Brinkmann <marcus@g10code.de> * src/gpg-error.h (gpg_err_make_from_errno): Fix implementation. diff --git a/configure.ac b/configure.ac index 2016894..01d5448 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,13 @@ AC_CHECK_HEADERS([stdlib.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST +# Substitution used for gpg-error-config +GPG_ERROR_CONFIG_LIBS="-lgpg-error" +GPG_ERROR_CONFIG_CFLAGS="" +AC_SUBST(GPG_ERROR_CONFIG_LIBS) +AC_SUBST(GPG_ERROR_CONFIG_CFLAGS) +AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) + # Checks for library functions. AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([po/Makefile.in m4/Makefile]) diff --git a/src/Makefile.am b/src/Makefile.am index 266c217..8a8a56d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,10 +22,14 @@ # depend on the configuration anyway. EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ mkerrnos.awk errnos.in mkerrcodes1.awk mkerrcodes2.awk \ - err-sources.h err-codes.h + err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h +bin_SCRIPTS = gpg-error-config +m4datadir = $(datadir)/aclocal +m4data_DATA = gpg-error.m4 + include_HEADERS = gpg-error.h lib_LTLIBRARIES = libgpg-error.la diff --git a/src/gpg-error-config.in b/src/gpg-error-config.in new file mode 100644 index 0000000..f4f9115 --- /dev/null +++ b/src/gpg-error-config.in @@ -0,0 +1,115 @@ +#!/bin/sh +# Copyright (C) 1999, 2002 Free Software Foundation, Inc. +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +PGM=gpg-error-config +libs="@GPG_ERROR_CONFIG_LIBS@" +cflags="@GPG_ERROR_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 + + +usage() +{ + cat <<EOF +Usage: $PGM [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 $cflags ; do + if test "$i" = "-I@includedir@" ; then + includes="" + fi + done + fi + echo $includes $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 +fi + diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 new file mode 100644 index 0000000..00d1510 --- /dev/null +++ b/src/gpg-error.m4 @@ -0,0 +1,67 @@ +dnl Autoconf macros for libgpg-error + +dnl AM_PATH_GPG_ERROR([MINIMUM-VERSION, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) +dnl Test for libgpg-error and define GPG_ERROR_CFLAGS and GPG_ERROR_LIBS +dnl +AC_DEFUN(AM_PATH_GPG_ERROR, +[ AC_ARG_WITH(gpg-error-prefix, + AC_HELP_STRING([--with-gpg-error-prefix=PFX], + [prefix where GPG Error is installed (optional)]), + gpg_error_config_prefix="$withval", gpg_error_config_prefix="") + if test x$gpg_error_config_prefix != x ; then + gpg_error_config_args="$gpg_error_config_args --prefix=$gpg_error_config_prefix" + if test x${GPG_ERROR_CONFIG+set} != xset ; then + GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config + fi + fi + + AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) + min_gpg_error_version=ifelse([$1], ,0.0.0,$1) + AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) + ok=no + if test "$GPG_ERROR_CONFIG" != "no" ; then + req_major=`echo $min_gpg_error_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` + req_minor=`echo $min_gpg_error_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` + req_micro=`echo $min_gpg_error_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` + gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version` + major=`echo $gpg_error_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` + minor=`echo $gpg_error_config_version | \ + sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` + micro=`echo $gpg_error_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 + GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` + GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + GPG_ERROR_CFLAGS="" + GPG_ERROR_LIBS="" + AC_MSG_RESULT(no) + ifelse([$3], , :, [$3]) + fi + AC_SUBST(GPG_ERROR_CFLAGS) + AC_SUBST(GPG_ERROR_LIBS) +]) + |