From 54fc8fc0a9d25f866ca19f4986d6fe60753a7058 Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Sun, 9 Dec 2007 12:03:55 +0000 Subject: [PATCH] SVN Revision now put into config.h by configure; removed -lrt dependency (needs more testing) git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@823 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 10 ++++++++++ jtag/configure.ac | 22 +++++++++++++++++++++- jtag/src/Makefile.am | 10 ++++------ jtag/src/jtag.c | 21 ++++++++++++++++----- jtag/src/version.awk | 26 -------------------------- 5 files changed, 51 insertions(+), 38 deletions(-) delete mode 100644 jtag/src/version.awk diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 3ab647d0..c0288893 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,13 @@ +2007-12-09 [822] Kolja Waschk + + * configure.ac: Improve detection of flex version, get Subversion + revision from 1. svn info, or 2. ChangeLog, or 3. Revision tag + * src/version.awk: not needed anymore as SVN info is now put into + config.h by configure. + * src/Makefile.am: removed -lrt link (not available on Cygwin, need + more checks whether it is needed elsewhere); no version.h target + * doc/UrJTAG.txt: Added info about required libraries and ioperm + 2007-12-08 [819] Kolja Waschk * include/Makefile.am, src/Makefile.am, src/svf/Makefile.am diff --git a/jtag/configure.ac b/jtag/configure.ac index 3a9b3ee1..76563aaa 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -21,12 +21,26 @@ # Written by Marcel Telka , 2002, 2003. # -AC_INIT(JTAG Tools,0.6,,jtag) +AC_INIT(UrJTAG,0.6,,urjtag) AC_PREREQ(2.54) AC_COPYRIGHT([Copyright (C) 2002, 2003 ETC s.r.o.]) AC_REVISION($Revision$) +# Get SVN Revision - idea from xfce-power-manager (C) 2007 by B.Tarricone +dnl get svn revision +SVN=`which svn` +if test -n "$SVN" -a -x "$SVN"; then + SVN_REVISION=`LC_ALL=C svn info | awk '/^Revision: / {printf "%d\n", $2}'` +else if test -e "ChangeLog"; then + SVN_REVISION=`cat ChangeLog | awk '/^Revision: / {printf "%d\n", $2}'` +else + SVN_REVISION=`echo '$Revision$' | awk '/^Revision: / {printf "%d\n", $2}'` +fi fi + +AC_DEFINE_UNQUOTED([SVN_REVISION], "$SVN_REVISION", [subversion revision number]) +AC_SUBST([SVN_REVISION]) + AC_CONFIG_AUX_DIR(tools) AM_INIT_AUTOMAKE([check-news dist-bzip2]) @@ -74,6 +88,10 @@ if test "$LEX" == flex ; then modern_flex=no flex_version=`$LEX --version | $AWK '{print $2}'` + if test "$flex_version" == "version" ; then + flex_version=`$LEX --version | $AWK '{print $3}'` + fi + flex_v1=`echo $flex_version | $AWK -F . '{print $1}' | $SED -e 's/[a-zA-Z]//g'` flex_v2=`echo $flex_version | $AWK -F . '{print $2}' | $SED -e 's/[a-zA-Z]//g'` flex_v3=`echo $flex_version | $AWK -F . '{print $3}' | $SED -e 's/[a-zA-Z]//g'` @@ -100,6 +118,8 @@ if test "$LEX" == flex ; then AC_MSG_RESULT([no - flex $flex_version]) AM_CONDITIONAL([BISON_LOCATIONS], false) fi +else + AM_CONDITIONAL([BISON_LOCATIONS], false) fi AC_CONFIG_SUBDIRS(libbrux) diff --git a/jtag/src/Makefile.am b/jtag/src/Makefile.am index d40166f0..7e3691d0 100644 --- a/jtag/src/Makefile.am +++ b/jtag/src/Makefile.am @@ -65,15 +65,13 @@ jtag_LDADD = \ -L../libbrux -lbrux \ -Lbus -lbus \ -Lsvf -lsvf \ - -lrt \ -lm \ @LIBINTL@ -nodist_jtag_SOURCES = version.h -BUILT_SOURCES = version.h -CLEANFILES = version.h -version.h: ../ChangeLog version.awk - $(AWK) -f version.awk $< > $@ +# Removed -lrt (added in 704 for busy loop waiting; not +# available in Cygwin. not needed? If you re-add -lrt here +# please consider to add checks in configure.ac whether +# it is avaiable and really needed localedir = $(datadir)/locale INCLUDES = -DLOCALEDIR=\"$(localedir)\" diff --git a/jtag/src/jtag.c b/jtag/src/jtag.c index de4a104f..d9391505 100644 --- a/jtag/src/jtag.c +++ b/jtag/src/jtag.c @@ -24,7 +24,10 @@ */ #include "sysdep.h" -#include "version.h" + +#ifndef SVN_REVISION +#define SVN_REVISION "0" +#endif #include #include @@ -32,8 +35,12 @@ #include #include #include +#ifdef HAVE_READLINE #include +#ifdef HAVE_READLINE_HISTORY #include +#endif +#endif #include #ifdef ENABLE_NLS #include @@ -88,6 +95,8 @@ jtag_create_jtagdir( void ) free( jdir ); } + +#ifdef HAVE_READLINE_HISTORY static void jtag_load_history( void ) @@ -139,6 +148,8 @@ jtag_save_history( void ) free( file ); } +#endif /* HAVE_READLINE_HISTORY */ + static int jtag_parse_line( char *line ) { @@ -367,7 +378,7 @@ main( int argc, const char **argv ) if (help) { /* Print help info and exit. */ - printf (_("%s\n"), PACKAGE_STRING); + printf (_("%s #%s\n"), PACKAGE_STRING, SVN_REVISION); printf ("\n"); printf (_("Usage: %s [OPTION] [FILE]\n"), PACKAGE); @@ -390,7 +401,7 @@ main( int argc, const char **argv ) if (version) { - printf(_("%s\nCopyright (C) 2002, 2003 ETC s.r.o.\n"), PACKAGE_STRING); + printf(_("%s #%s\nCopyright (C) 2002, 2003 ETC s.r.o.\n"), PACKAGE_STRING, SVN_REVISION); printf(_("\n" "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" @@ -446,11 +457,11 @@ main( int argc, const char **argv ) /* interactive */ printf( - _("%s Build %s\n" + _("%s #%s\n" "Copyright (C) 2002, 2003 ETC s.r.o.\n" "%s is free software, covered by the GNU General Public License, and you are\n" "welcome to change it and/or distribute copies of it under certain conditions.\n" - "There is absolutely no warranty for %s.\n\n"), PACKAGE_STRING, URJTAG_BUILD_NUMBER, + "There is absolutely no warranty for %s.\n\n"), PACKAGE_STRING, SVN_REVISION, PACKAGE_NAME, PACKAGE_NAME ); diff --git a/jtag/src/version.awk b/jtag/src/version.awk deleted file mode 100644 index bfbf26b9..00000000 --- a/jtag/src/version.awk +++ /dev/null @@ -1,26 +0,0 @@ -BEGIN { -print "/*" -print " * version.h" -print " * control long build version number" -print " *" -print " * Created automatically with version.awk script" -print " *" -print " */" -print "" -print "#ifndef __VERSION_H__" -print "#define __VERSION_H__" -print "" - -FS="[ \t.]" -} - -/Revision/ { printf "#define URJTAG_BUILD_NUMBER\t\"%s\"\n", $2 } - -END { -print "" -print "#ifndef URJTAG_BUILD_NUMBER" -print "#define URJTAG_BUILD_NUMBER \"0\"" -print "#endif" -print "" -print "#endif" -}