SF.net SVN: geany:[6001] trunk
colombanw at users.sourceforge.net
colombanw at xxxxx
Thu Oct 6 00:43:09 UTC 2011
Revision: 6001
http://geany.svn.sourceforge.net/geany/?rev=6001&view=rev
Author: colombanw
Date: 2011-10-06 00:43:09 +0000 (Thu, 06 Oct 2011)
Log Message:
-----------
Move configure logic that checks for SVN revision to its own file
Modified Paths:
--------------
trunk/ChangeLog
trunk/autogen.sh
trunk/configure.ac
Added Paths:
-----------
trunk/m4/geany-revision.m4
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-10-06 00:42:48 UTC (rev 6000)
+++ trunk/ChangeLog 2011-10-06 00:43:09 UTC (rev 6001)
@@ -2,6 +2,9 @@
* autogen.sh, configure.ac:
Modernize configure.ac a bit.
+ * configure.ac, m4/geany-revision.m4:
+ Extract some configure logic to a separate file for better
+ readability.
2011-10-05 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/autogen.sh
===================================================================
--- trunk/autogen.sh 2011-10-06 00:42:48 UTC (rev 6000)
+++ trunk/autogen.sh 2011-10-06 00:43:09 UTC (rev 6001)
@@ -87,7 +87,7 @@
echo "no" | glib-gettextize --force --copy
intltoolize --copy --force --automake
libtoolize --copy --force || glibtoolize --copy --force
-aclocal
+aclocal -I m4
autoheader
automake --add-missing --copy --gnu
autoconf
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2011-10-06 00:42:48 UTC (rev 6000)
+++ trunk/configure.ac 2011-10-06 00:43:09 UTC (rev 6001)
@@ -50,44 +50,10 @@
# check for SVN revision
-REVISION="r0"
+GEANY_CHECK_REVISION([dnl force debug mode for a SVN working copy
+ CFLAGS="-g -DGEANY_DEBUG $CFLAGS"])
-AC_MSG_CHECKING([for SVN revision])
-# try Git first
-GIT=`which git 2>/dev/null`
-if test -d ".git" -a "x${GIT}" != "x" -a -x "${GIT}"
-then
- # check for git-svn repo first - find-rev (v1.5.4.1) doesn't always fail with git-only repo
- git svn info &>/dev/null
- if test "x$?" == "x0"; then
- REVISION=r`git svn find-rev origin/trunk 2>/dev/null ||
- git svn find-rev trunk 2>/dev/null ||
- git svn find-rev HEAD 2>/dev/null ||
- git svn find-rev master 2>/dev/null ||
- echo 0`
- fi
-fi
-# then check for SVN
-if test "x${REVISION}" = "xr0"
-then
- SVN=`which svn 2>/dev/null`
- if test -d ".svn" -a "x${SVN}" != "x" -a -x "${SVN}"
- then
- REVISION=r`$SVN info|grep 'Last Changed Rev'|cut -d' ' -f4`
- fi
-fi
-if test "x${REVISION}" != "xr0"
-then
- # force debug mode for a SVN working copy
- CFLAGS="-g -DGEANY_DEBUG $CFLAGS"
- AC_MSG_RESULT([$REVISION])
-else
- REVISION="-1"
- AC_MSG_RESULT([none])
-fi
-AC_DEFINE_UNQUOTED([REVISION], "$REVISION", [subversion revision number])
-
# Check for binary relocation support
# taken from Inkscape (Hongli Lai <h.lai at chello.nl>)
AC_ARG_ENABLE([binreloc],
Added: trunk/m4/geany-revision.m4
===================================================================
--- trunk/m4/geany-revision.m4 (rev 0)
+++ trunk/m4/geany-revision.m4 2011-10-06 00:43:09 UTC (rev 6001)
@@ -0,0 +1,45 @@
+dnl GEANY_CHECK_REVISION([action-if-found], [action-if-not-found])
+dnl Check for the Git-SVN or SVN revision and set REVISION to
+dnl "r<revnum>" or to "-1" if the revision can't be found
+dnl Also AC_DEFINEs REVISION
+AC_DEFUN([GEANY_CHECK_REVISION],
+[
+ REVISION="r0"
+
+ AC_MSG_CHECKING([for SVN revision])
+ # try Git first
+ GIT=`which git 2>/dev/null`
+ if test -d ".git" -a "x${GIT}" != "x" -a -x "${GIT}"; then
+ # check for git-svn repo first - find-rev (v1.5.4.1) doesn't always fail with git-only repo
+ git svn info &>/dev/null
+ if test "x$?" == "x0"; then
+ REVISION=r`git svn find-rev origin/trunk 2>/dev/null ||
+ git svn find-rev trunk 2>/dev/null ||
+ git svn find-rev HEAD 2>/dev/null ||
+ git svn find-rev master 2>/dev/null ||
+ echo 0`
+ fi
+ fi
+ # then check for SVN
+ if test "x${REVISION}" = "xr0"; then
+ SVN=`which svn 2>/dev/null`
+ if test -d ".svn" -a "x${SVN}" != "x" -a -x "${SVN}"; then
+ REVISION=r`$SVN info|grep 'Last Changed Rev'|cut -d' ' -f4`
+ fi
+ fi
+
+ if test "x${REVISION}" != "xr0"; then
+ AC_MSG_RESULT([$REVISION])
+
+ # call action-if-found
+ $1
+ else
+ REVISION="-1"
+ AC_MSG_RESULT([none])
+
+ # call action-if-not-found
+ $2
+ fi
+
+ AC_DEFINE_UNQUOTED([REVISION], "$REVISION", [subversion revision number])
+])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list