[svn] ksba - r274 - in trunk: . src
svn author wk
cvs at cvs.gnupg.org
Tue May 29 19:36:54 CEST 2007
Author: wk
Date: 2007-05-29 19:36:24 +0200 (Tue, 29 May 2007)
New Revision: 274
Added:
trunk/src/libksba.def
trunk/src/versioninfo.rc.in
trunk/ylwrap
Modified:
trunk/ChangeLog
trunk/autogen.sh
trunk/configure.ac
trunk/src/ChangeLog
trunk/src/Makefile.am
Log:
Support for building as a W32 DLL.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/ChangeLog 2007-05-29 17:36:24 UTC (rev 274)
@@ -1,3 +1,17 @@
+2007-05-29 Werner Koch <wk at g10code.com>
+
+ * configure.ac (AC_LIBTOOL_WIN32_DLL): New.
+ (HAVE_W32_SYSTEM): New.
+ (BUILD_REVISION, BUILD_TIMESTAMP, BUILD_FILEVERSION): New.
+ (AC_CANONICAL_TARGET): New.
+
+ * autogen.sh: Add Option --force. Modernized cross compiler
+ selection for --build-w32.
+
+2007-05-24 Werner Koch <wk at g10code.com>
+
+ * configure.ac: Use -Wpointer-arith if possible.
+
2007-04-06 Werner Koch <wk at g10code.com>
* configure.ac: Require libgpg-error 1.4.
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/autogen.sh 2007-05-29 17:36:24 UTC (rev 274)
@@ -29,6 +29,11 @@
}
DIE=no
+FORCE=
+if test "$1" == "--force"; then
+ FORCE=" --force"
+ shift
+fi
# ***** W32 build script *******
@@ -46,27 +51,23 @@
[ -z "$w32root" ] && w32root="$HOME/w32root"
echo "Using $w32root as standard install directory" >&2
- # See whether we have the Debian cross compiler package or the
- # old mingw32/cpd system
- if i586-mingw32msvc-gcc --version >/dev/null 2>&1 ; then
- host=i586-mingw32msvc
- crossbindir=/usr/$host/bin
- else
- host=i386--mingw32
- if ! mingw32 --version >/dev/null; then
- echo "We need at least version 0.3 of MingW32/CPD" >&2
- exit 1
- fi
- crossbindir=`mingw32 --install-dir`/bin
- # Old autoconf version required us to setup the environment
- # with the proper tool names.
- CC=`mingw32 --get-path gcc`
- CPP=`mingw32 --get-path cpp`
- AR=`mingw32 --get-path ar`
- RANLIB=`mingw32 --get-path ranlib`
- export CC CPP AR RANLIB
+ crossbindir=
+ for host in i586-mingw32msvc i386-mingw32msvc mingw32; do
+ if ${host}-gcc --version >/dev/null 2>&1 ; then
+ crossbindir=/usr/${host}/bin
+ conf_CC="CC=${host}-gcc"
+ break;
+ fi
+ done
+ if [ -z "$crossbindir" ]; then
+ echo "Cross compiler kit not installed" >&2
+ echo "Under Debian GNU/Linux, you may install it using" >&2
+ echo " apt-get install mingw32 mingw32-runtime mingw32-binutils" >&2
+ echo "Stop." >&2
+ exit 1
fi
+
if [ -f "$tsdir/config.log" ]; then
if ! head $tsdir/config.log | grep "$host" >/dev/null; then
echo "Pease run a 'make distclean' first" >&2
@@ -75,9 +76,8 @@
fi
./configure --enable-maintainer-mode --prefix=${w32root} \
- --host=i586-mingw32msvc --build=${build} \
+ --host=${host} --build=${build} \
--with-gpg-error-prefix=${w32root} \
- --disable-shared
exit $?
fi
@@ -198,7 +198,7 @@
$AUTOHEADER
echo "Running automake --gnu ..."
$AUTOMAKE --gnu;
-echo "Running autoconf..."
-$AUTOCONF
+echo "Running autoconf${FORCE} ..."
+$AUTOCONF${FORCE}
echo "You may now run \"./configure --enable-maintainer-mode && make\"."
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/configure.ac 2007-05-29 17:36:24 UTC (rev 274)
@@ -1,5 +1,5 @@
# configure.ac - for libksba
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 g10 Code GmbH
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH
#
# This file is part of KSBA
#
@@ -19,8 +19,8 @@
# USA.
# Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.57)
-min_automake_version="1.9.3"
+AC_PREREQ(2.61)
+min_automake_version="1.10"
# Remember to change the version number immediately *after* a release.
@@ -32,7 +32,7 @@
m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \
|| echo 'Revision: 0')|sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)]))
AC_INIT([libksba], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
- [gpa-dev at gnupg.org])
+ [gnupg-devel at gnupg.org])
# LT Version numbers: Remember to change them just *before* a release.
# (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
@@ -49,11 +49,12 @@
NEED_GPG_ERROR_VERSION=1.4
-
+BUILD_REVISION=svn_revision
PACKAGE=$PACKAGE_NAME
VERSION=$PACKAGE_VERSION
AC_CONFIG_SRCDIR([src/ksba.h])
+AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_CONFIG_HEADER(config.h)
AB_INIT
@@ -84,6 +85,10 @@
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
+AM_PROG_CC_C_O
+if test "x$ac_cv_prog_cc_c89" = "xno" ; then
+ AC_MSG_ERROR([[No C-89 compiler found]])
+fi
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
@@ -92,11 +97,23 @@
AC_PROG_YACC
AC_C_INLINE
+AC_LIBTOOL_WIN32_DLL
+AC_LIBTOOL_RC
AM_PROG_LIBTOOL
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
+ AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
+ _gcc_cflags_save=$CFLAGS
+ CFLAGS="-Wpointer-arith"
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
+ AC_MSG_RESULT($_gcc_wopt)
+ CFLAGS=$_gcc_cflags_save;
+ if test x"$_gcc_wopt" = xyes ; then
+ CFLAGS="$CFLAGS -Wpointer-arith"
+ fi
+
AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wno-pointer-sign"
@@ -109,7 +126,21 @@
fi
+# Setup some stuff depending on host/target.
+have_w32_system=no
+case "${target}" in
+ *-*-mingw32*)
+ have_w32_system=yes
+ ;;
+ *)
+ ;;
+esac
+if test "$have_w32_system" = yes; then
+ AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
+fi
+AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
+
# For some systems we know that we have ld_version scripts.
# Use it then as default.
have_ld_version_script=no
@@ -141,6 +172,7 @@
AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_KSBA,
[The default error source for libksba.])
+
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h])
@@ -175,11 +207,28 @@
# The Makefiles need to know about cross compiling
AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
+
+# Generate extended version information for W32.
+if test "$have_w32_system" = yes; then
+ BUILD_TIMESTAMP=`date --iso-8601=minutes`
+ changequote(,)dnl
+ BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
+ changequote([,])dnl
+ BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
+fi
+AC_SUBST(BUILD_REVISION)
+AC_SUBST(BUILD_TIMESTAMP)
+AC_SUBST(BUILD_FILEVERSION)
+AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
+ [Subversion revision used to build this package])
+
+
AC_CONFIG_FILES([
Makefile
gl/Makefile
src/Makefile
src/ksba-config
+src/versioninfo.rc
tests/Makefile
doc/Makefile
])
Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/src/ChangeLog 2007-05-29 17:36:24 UTC (rev 274)
@@ -1,3 +1,10 @@
+2007-05-29 Werner Koch <wk at g10code.com>
+
+ * versioninfo.rc.in: New.
+ * libksba.def: New.
+ * Makefile.am: Add code to build a W32 DLL.
+ (install-data-local, uninstall-local): New.
+
2007-05-14 Werner Koch <wk at g10code.com>
* sexp-parse.h (smklen): New.
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/src/Makefile.am 2007-05-29 17:36:24 UTC (rev 274)
@@ -1,5 +1,5 @@
# Makefile.am - for the KSBA ASN.1 and X.509 library
-# Copyright (C) 2001, 2002, 2004, 2005 g10 Code GmbH
+# Copyright (C) 2001, 2002, 2004, 2005, 2007 g10 Code GmbH
#
# This file is part of KSBA.
#
@@ -22,7 +22,7 @@
asn1_modules = tmttv2.asn cms.asn
-EXTRA_DIST = ksba-config.in $(asn1_modules) ksba.m4 libksba.vers \
+EXTRA_DIST = ksba-config.in $(asn1_modules) ksba.m4 libksba.vers libksba.def \
asn1-parse.c asn1-tables.c
BUILT_SOURCES = asn1-parse.c asn1-tables.c
bin_SCRIPTS = ksba-config
@@ -47,12 +47,45 @@
endif
+if HAVE_W32_SYSTEM
+LTRCCOMPILE = $(LIBTOOL) --mode=compile $(RC) \
+ `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) | \
+ sed -e 's/-I/--include-dir /g;s/-D/--define /g'`
-libksba_la_LDFLAGS = $(libksba_version_script_cmd) -version-info \
+.rc.lo:
+ $(LTRCCOMPILE) -i $< -o $@
+
+ksba_res = versioninfo.lo
+ksba_res_ldflag = -Wl,.libs/versioninfo.o
+no_undefined = -no-undefined
+export_symbols = -export-symbols $(srcdir)/libksba.def
+ksba_deps = $(ksba_res) libksba.def
+
+install-def-file:
+ $(INSTALL) $(srcdir)/libksba.def $(DESTDIR)$(libdir)/libksba.def
+
+uninstall-def-file:
+ -rm $(DESTDIR)$(libdir)/libksba.def
+
+else !HAVE_W32_SYSTEM
+ksba_res =
+ksba_ldflag =
+no_undefined =
+export_symbols =
+ksba_deps =
+install-def-file:
+uninstall-def-file:
+endif !HAVE_W32_SYSTEM
+
+
+libksba_la_LDFLAGS = $(gcrypt_res_ldflag) $(no_undefined) $(export_symbols) \
+ $(libksba_version_script_cmd) -version-info \
@LIBKSBA_LT_CURRENT@:@LIBKSBA_LT_REVISION@:@LIBKSBA_LT_AGE@
libksba_la_INCLUDES = -I$(top_srcdir)/lib
-libksba_la_DEPENDENCIES = $(srcdir)/libksba.vers
+libksba_la_DEPENDENCIES = $(srcdir)/libksba.vers $(ksba_deps)
+libksba_la_LIBADD = @LTLIBOBJS@ @GPG_ERROR_LIBS@
+
libksba_la_SOURCES = \
ksba.h \
reader.c reader.h \
@@ -96,3 +129,8 @@
endif
+install-data-local: install-def-file
+
+uninstall-local: uninstall-def-file
+
+
Added: trunk/src/libksba.def
===================================================================
--- trunk/src/libksba.def 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/src/libksba.def 2007-05-29 17:36:24 UTC (rev 274)
@@ -0,0 +1,180 @@
+;; libksba.def - Exported symbols for W32
+;; Copyright (C) 2007 g10 Code GmbH
+;;
+;; This file is part of KSBA.
+;;
+;; KSBA is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2 of the License, or
+;; (at your option) any later version.
+;;
+;; KSBA is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+;; USA.
+
+
+EXPORTS
+ ksba_check_version @1
+
+ ksba_set_hash_buffer_function @2
+ ksba_set_malloc_hooks @3
+ ksba_free @4
+ ksba_malloc @5
+ ksba_calloc @6
+ ksba_realloc @7
+ ksba_strdup @8
+
+ ksba_asn_create_tree @9
+ ksba_asn_delete_structure @10
+ ksba_asn_parse_file @11
+ ksba_asn_tree_dump @12
+ ksba_asn_tree_release @13
+
+ ksba_cert_get_auth_key_id @14
+ ksba_cert_get_cert_policies @15
+ ksba_cert_get_crl_dist_point @16
+ ksba_cert_get_digest_algo @17
+ ksba_cert_get_ext_key_usages @18
+ ksba_cert_get_extension @19
+ ksba_cert_get_image @20
+ ksba_cert_get_issuer @21
+ ksba_cert_get_key_usage @22
+ ksba_cert_get_public_key @23
+ ksba_cert_get_serial @24
+ ksba_cert_get_sig_val @25
+ ksba_cert_get_subject @26
+ ksba_cert_get_validity @27
+ ksba_cert_hash @28
+ ksba_cert_init_from_mem @29
+ ksba_cert_is_ca @30
+ ksba_cert_new @31
+ ksba_cert_read_der @32
+ ksba_cert_ref @33
+ ksba_cert_release @34
+ ksba_cert_get_authority_info_access @35
+ ksba_cert_get_subject_info_access @36
+ ksba_cert_get_subj_key_id @37
+ ksba_cert_set_user_data @38
+ ksba_cert_get_user_data @39
+
+ ksba_certreq_add_subject @40
+ ksba_certreq_build @41
+ ksba_certreq_new @42
+ ksba_certreq_release @43
+ ksba_certreq_set_hash_function @44
+ ksba_certreq_set_public_key @45
+ ksba_certreq_set_sig_val @46
+ ksba_certreq_set_writer @47
+ ksba_certreq_add_extension @48
+
+ ksba_cms_add_cert @49
+ ksba_cms_add_digest_algo @50
+ ksba_cms_add_recipient @51
+ ksba_cms_add_signer @52
+ ksba_cms_build @53
+ ksba_cms_get_cert @54
+ ksba_cms_get_content_enc_iv @55
+ ksba_cms_get_content_oid @56
+ ksba_cms_get_content_type @57
+ ksba_cms_get_digest_algo @58
+ ksba_cms_get_digest_algo_list @59
+ ksba_cms_get_enc_val @60
+ ksba_cms_get_issuer_serial @61
+ ksba_cms_get_message_digest @62
+ ksba_cms_get_sig_val @63
+ ksba_cms_get_sigattr_oids @64
+ ksba_cms_get_signing_time @65
+ ksba_cms_hash_signed_attrs @66
+ ksba_cms_identify @67
+ ksba_cms_new @68
+ ksba_cms_parse @69
+ ksba_cms_release @70
+ ksba_cms_set_content_enc_algo @71
+ ksba_cms_set_content_type @72
+ ksba_cms_set_enc_val @73
+ ksba_cms_set_hash_function @74
+ ksba_cms_set_message_digest @75
+ ksba_cms_set_reader_writer @76
+ ksba_cms_set_sig_val @77
+ ksba_cms_set_signing_time @78
+ ksba_cms_add_smime_capability @79
+
+ ksba_crl_get_digest_algo @80
+ ksba_crl_get_issuer @81
+ ksba_crl_get_item @82
+ ksba_crl_get_sig_val @83
+ ksba_crl_get_update_times @84
+ ksba_crl_new @85
+ ksba_crl_parse @86
+ ksba_crl_release @87
+ ksba_crl_set_hash_function @88
+ ksba_crl_set_reader @89
+ ksba_crl_get_extension @90
+ ksba_crl_get_auth_key_id @91
+ ksba_crl_get_crl_number @92
+
+ ksba_name_enum @93
+ ksba_name_get_uri @94
+ ksba_name_new @95
+ ksba_name_ref @96
+ ksba_name_release @97
+
+ ksba_ocsp_add_cert @98
+ ksba_ocsp_add_target @99
+ ksba_ocsp_build_request @100
+ ksba_ocsp_get_cert @101
+ ksba_ocsp_get_digest_algo @102
+ ksba_ocsp_get_responder_id @103
+ ksba_ocsp_get_sig_val @104
+ ksba_ocsp_get_status @105
+ ksba_ocsp_hash_request @106
+ ksba_ocsp_hash_response @107
+ ksba_ocsp_new @108
+ ksba_ocsp_parse_response @109
+ ksba_ocsp_prepare_request @110
+ ksba_ocsp_release @111
+ ksba_ocsp_set_digest_algo @112
+ ksba_ocsp_set_nonce @113
+ ksba_ocsp_set_requestor @114
+ ksba_ocsp_set_sig_val @115
+ ksba_ocsp_get_extension @116
+
+ ksba_oid_from_str @117
+ ksba_oid_to_str @118
+
+ ksba_dn_der2str @119
+ ksba_dn_str2der @120
+ ksba_dn_teststr @121
+
+ ksba_reader_clear @122
+ ksba_reader_error @123
+ ksba_reader_new @124
+ ksba_reader_read @125
+ ksba_reader_release @126
+ ksba_reader_set_cb @127
+ ksba_reader_set_fd @128
+ ksba_reader_set_file @129
+ ksba_reader_set_mem @130
+ ksba_reader_tell @131
+ ksba_reader_unread @132
+
+ ksba_writer_error @133
+ ksba_writer_get_mem @134
+ ksba_writer_new @135
+ ksba_writer_release @136
+ ksba_writer_set_cb @137
+ ksba_writer_set_fd @138
+ ksba_writer_set_file @139
+ ksba_writer_set_filter @140
+ ksba_writer_set_mem @141
+ ksba_writer_snatch_mem @142
+ ksba_writer_tell @143
+ ksba_writer_write @144
+ ksba_writer_write_octet_string @145
+
Added: trunk/src/versioninfo.rc.in
===================================================================
--- trunk/src/versioninfo.rc.in 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/src/versioninfo.rc.in 2007-05-29 17:36:24 UTC (rev 274)
@@ -0,0 +1,53 @@
+/* versioninfo.rc.in - for libksba
+ * Copyright (C) 2007 g10 Code GmbH
+ *
+ * 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 program 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.
+ */
+
+/* This file is processed by configure to create versioninfo.rc */
+
+#line __LINE__ "versioninfo.rc.in"
+
+#include <afxres.h>
+
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION @LIBKSBA_LT_CURRENT@, at LIBKSBA_LT_AGE@, at LIBKSBA_LT_REVISION@, at BUILD_REVISION@
+ PRODUCTVERSION @BUILD_FILEVERSION@
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x21L
+#else
+ FILEFLAGS 0x20L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ /* Note that the Windows version falls under the GPL. */
+ VALUE "Comments", "Provided under the terms of the GNU General Public License.\0"
+ VALUE "CompanyName", "g10 Code GmbH\0"
+ VALUE "FileDescription", "Libksba - X.509 and CMS Library\0"
+ VALUE "FileVersion", "@LIBKSBA_LT_CURRENT at .@LIBKSBA_LT_AGE at .@LIBKSBA_LT_REVISION at .@BUILD_REVISION@\0"
+ VALUE "InternalName", "libksba\0"
+ VALUE "LegalCopyright", "Copyright © 2007 g10 Code GmbH\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "libksba.dll\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", "libksba\0"
+ VALUE "ProductVersion", "@VERSION@\0"
+ VALUE "SpecialBuild", "@BUILD_TIMESTAMP@\0"
+ END
+ END
+END
+
Added: trunk/ylwrap
===================================================================
--- trunk/ylwrap 2007-05-14 08:29:14 UTC (rev 273)
+++ trunk/ylwrap 2007-05-29 17:36:24 UTC (rev 274)
@@ -0,0 +1,223 @@
+#! /bin/sh
+# ylwrap - wrapper for lex/yacc invocations.
+
+scriptversion=2005-05-14.22
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# Written by Tom Tromey <tromey at cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake at gnu.org> or send patches to
+# <automake-patches at gnu.org>.
+
+case "$1" in
+ '')
+ echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
+ exit 1
+ ;;
+ --basedir)
+ basedir=$2
+ shift 2
+ ;;
+ -h|--h*)
+ cat <<\EOF
+Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
+
+Wrapper for lex/yacc invocations, renaming files as desired.
+
+ INPUT is the input file
+ OUTPUT is one file PROG generates
+ DESIRED is the file we actually want instead of OUTPUT
+ PROGRAM is program to run
+ ARGS are passed to PROG
+
+Any number of OUTPUT,DESIRED pairs may be used.
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v|--v*)
+ echo "ylwrap $scriptversion"
+ exit $?
+ ;;
+esac
+
+
+# The input.
+input="$1"
+shift
+case "$input" in
+ [\\/]* | ?:[\\/]*)
+ # Absolute path; do nothing.
+ ;;
+ *)
+ # Relative path. Make it absolute.
+ input="`pwd`/$input"
+ ;;
+esac
+
+pairlist=
+while test "$#" -ne 0; do
+ if test "$1" = "--"; then
+ shift
+ break
+ fi
+ pairlist="$pairlist $1"
+ shift
+done
+
+# The program to run.
+prog="$1"
+shift
+# Make any relative path in $prog absolute.
+case "$prog" in
+ [\\/]* | ?:[\\/]*) ;;
+ *[\\/]*) prog="`pwd`/$prog" ;;
+esac
+
+# FIXME: add hostname here for parallel makes that run commands on
+# other machines. But that might take us over the 14-char limit.
+dirname=ylwrap$$
+trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15
+mkdir $dirname || exit 1
+
+cd $dirname
+
+case $# in
+ 0) $prog "$input" ;;
+ *) $prog "$@" "$input" ;;
+esac
+ret=$?
+
+if test $ret -eq 0; then
+ set X $pairlist
+ shift
+ first=yes
+ # Since DOS filename conventions don't allow two dots,
+ # the DOS version of Bison writes out y_tab.c instead of y.tab.c
+ # and y_tab.h instead of y.tab.h. Test to see if this is the case.
+ y_tab_nodot="no"
+ if test -f y_tab.c || test -f y_tab.h; then
+ y_tab_nodot="yes"
+ fi
+
+ # The directory holding the input.
+ input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
+ # Quote $INPUT_DIR so we can use it in a regexp.
+ # FIXME: really we should care about more than `.' and `\'.
+ input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
+
+ while test "$#" -ne 0; do
+ from="$1"
+ # Handle y_tab.c and y_tab.h output by DOS
+ if test $y_tab_nodot = "yes"; then
+ if test $from = "y.tab.c"; then
+ from="y_tab.c"
+ else
+ if test $from = "y.tab.h"; then
+ from="y_tab.h"
+ fi
+ fi
+ fi
+ if test -f "$from"; then
+ # If $2 is an absolute path name, then just use that,
+ # otherwise prepend `../'.
+ case "$2" in
+ [\\/]* | ?:[\\/]*) target="$2";;
+ *) target="../$2";;
+ esac
+
+ # We do not want to overwrite a header file if it hasn't
+ # changed. This avoid useless recompilations. However the
+ # parser itself (the first file) should always be updated,
+ # because it is the destination of the .y.c rule in the
+ # Makefile. Divert the output of all other files to a temporary
+ # file so we can compare them to existing versions.
+ if test $first = no; then
+ realtarget="$target"
+ target="tmp-`echo $target | sed s/.*[\\/]//g`"
+ fi
+ # Edit out `#line' or `#' directives.
+ #
+ # We don't want the resulting debug information to point at
+ # an absolute srcdir; it is better for it to just mention the
+ # .y file with no path.
+ #
+ # We want to use the real output file name, not yy.lex.c for
+ # instance.
+ #
+ # We want the include guards to be adjusted too.
+ FROM=`echo "$from" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
+ TARGET=`echo "$2" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
+
+ sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
+ -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
+
+ # Check whether header files must be updated.
+ if test $first = no; then
+ if test -f "$realtarget" && cmp -s "$realtarget" "$target"; then
+ echo "$2" is unchanged
+ rm -f "$target"
+ else
+ echo updating "$2"
+ mv -f "$target" "$realtarget"
+ fi
+ fi
+ else
+ # A missing file is only an error for the first file. This
+ # is a blatant hack to let us support using "yacc -d". If -d
+ # is not specified, we don't want an error when the header
+ # file is "missing".
+ if test $first = yes; then
+ ret=1
+ fi
+ fi
+ shift
+ shift
+ first=no
+ done
+else
+ ret=$?
+fi
+
+# Remove the directory.
+cd ..
+rm -rf $dirname
+
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
Property changes on: trunk/ylwrap
___________________________________________________________________
Name: svn:executable
+ *
More information about the Gnupg-commits
mailing list