[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] fix issue #886

From: Matt Kraai <kraai_at_ftbfs.org>
Date: 2002-11-19 20:26:57 CET

Howdy,

The following patch incorporates Greg Stein's comments into Art Haas's
patch to update configure.in for autoconf-2.5X.

It fixes issue #886, and was tested on an i386 box.

build/get-version.sh is a modified version of Expat's.

Matt

* build/get-version.sh: New.

* configure.in:
  Replaced old style AC_INIT and AC_OUTPUT macros with
  autoconf-2.5X style calls, and added AC_CONFIG_SRCDIR,
  AC_CONFIG_FILES, and AC_CONFIG_COMMANDS macros in
  concert with the above changes.

Index: build/get-version.sh
===================================================================
--- build/get-version.sh (working copy)
+++ build/get-version.sh (working copy)
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# USAGE: get-version.sh path/to/svn_version.h
+#
+# This script will print Subversion's version number on stdout. For example:
+#
+# $ ./build/get-version.sh ./subversion/include/svn_version.h
+# 0.15.0
+# $
+#
+
+if test $# = 0; then
+ echo "ERROR: pathname for svn_version.h was not provided."
+ echo ""
+ echo "USAGE: $0 path/to/svn_version.h"
+ exit 1
+fi
+if test $# != 1; then
+ echo "ERROR: too many arguments were provided."
+ echo ""
+ echo "USAGE: $0 path/to/svn_version.h"
+ exit 1
+fi
+
+hdr="$1"
+if test ! -r "$hdr"; then
+ echo "ERROR: '$hdr' does not exist, or is not readable."
+ exit 1
+fi
+
+MAJOR_VERSION="`sed -n -e '/SVN_VER_MAJOR/s/[^0-9]*//gp' $hdr`"
+MINOR_VERSION="`sed -n -e '/SVN_VER_MINOR/s/[^0-9]*//gp' $hdr`"
+MICRO_VERSION="`sed -n -e '/SVN_VER_MICRO/s/[^0-9]*//gp' $hdr`"
+
+# Determine how to tell echo not to print the trailing \n. This is
+# similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't
+# generate this file via autoconf (in fact, get-version.sh is used
+# to *create* ./configure), so we just do something similar inline.
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ;;
+ *) ECHO_N= ECHO_C='\c' ;;
+esac
+
+echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C"

Property changes on: build/get-version.sh
___________________________________________________________________
Name: svn:executable
   +

Index: configure.in
===================================================================
--- configure.in (revision 3829)
+++ configure.in (working copy)
@@ -8,8 +8,25 @@
 dnl Don't even think about removing this check!
 AC_PREREQ(2.50)
 
-dnl First line is *required*; sanity-checks that the our src dir exists.
-AC_INIT(subversion/include/svn_types.h)
+dnl Get the version number of Subversion, using m4's esyscmd() command to run
+dnl the command at m4-generation time. This allows us to create an m4
+dnl symbol holding the correct version number. AC_INIT() requires the
+dnl version number at m4-time, rather than when ./configure is run, so
+dnl all this must happen as part of m4, not as part of the shell code
+dnl contained in ./configure.
+dnl
+dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an apprpriate
+dnl test. I believe this test will work, but I don't have a place with non-
+dnl GNU M4 to test it right now.
+define([subversion_version],
+ ifdef([__gnu__],
+ [esyscmd(build/get-version.sh subversion/include/svn_version.h)],
+ [0.x]))
+AC_INIT(subversion, subversion_version, [http://subversion.tigris.org])
+undefine([subversion_version])
+
+dnl AC_CONFIG_SRCDIR is *required*; sanity-checks that our src dir exists.
+AC_CONFIG_SRCDIR(subversion/include/svn_types.h)
 AC_CONFIG_AUX_DIR(ac-helpers)
 
 abs_srcdir="`cd $srcdir && pwd`"
@@ -470,7 +487,9 @@
 
 dnl Final step: create the Makefile ----------------------------
 
-AC_OUTPUT([Makefile svn-config], [chmod +x svn-config])
+AC_CONFIG_FILES([Makefile svn-config])
+AC_CONFIG_COMMANDS([default], [chmod +x svn-config])
+AC_OUTPUT
 
 
 dnl Create all of the build directories

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 19 20:23:51 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.