Code

Fix SVN revision reporting so that it doesn't relink on every make
authortweenk <tweenk@users.sourceforge.net>
Thu, 19 Feb 2009 22:49:38 +0000 (22:49 +0000)
committertweenk <tweenk@users.sourceforge.net>
Thu, 19 Feb 2009 22:49:38 +0000 (22:49 +0000)
invocation.

acinclude.m4
configure.ac
m4/ink_svn_snapshot_build.m4 [new file with mode: 0644]
src/Makefile_insert

index 13d49c51ffa0f1260a2e0cf143564c30e80d8501..61148f6b4b34b8f08e5316829f6229fe5631c5ca 100644 (file)
@@ -1,3 +1,4 @@
 m4_include([m4/ac_define_dir.m4])
 m4_include([m4/ax_openmp.m4])
 m4_include([m4/relaytool.m4])
+m4_include([m4/ink_svn_snapshot_build.m4])
index 869c4d265b2bb56994728147e75cf86b9b09ee7d..ab12503ea712ea996a2045c242fa46c61828b383 100644 (file)
@@ -8,7 +8,7 @@ dnl `dpkg --compare-versions'.  (ii) We don't always know what the next
 dnl version is going to be called until about the time we release it
 dnl (whereas we always know what the previous version was called).
 AC_CANONICAL_HOST
-AC_CONFIG_SRCDIR(src/main.cpp)
+AC_CONFIG_SRCDIR([src/main.cpp])
 AM_INIT_AUTOMAKE([dist-zip dist-bzip2 tar-pax])
 
 AC_ARG_ENABLE([lsb], AS_HELP_STRING([--enable-lsb], [LSB-compatible build configuration]), [
@@ -28,7 +28,9 @@ AC_ISC_POSIX
 AC_PROG_CXX
 AM_PROG_CC_STDC
 AM_PROG_AS
+AC_PROG_RANLIB
 AC_HEADER_STDC
+INK_SVN_SNAPSHOT_BUILD
 
 dnl These next few lines are needed only while libcroco is in our source tree.
 AC_PROG_CC
@@ -94,8 +96,6 @@ fi
 dnl Honor aclocal flags
 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
 
-AC_PROG_RANLIB
-
 dnl Verify our GCC version
 if test "x$GXX" = "xyes"; then
        AC_MSG_CHECKING([GNU compiler version])
@@ -142,19 +142,15 @@ AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
 
 dnl ******************************
 dnl Check for OpenMP 
+dnl Replace this with AC_OPENMP once it's possible to use Autoconf 2.62
 dnl ******************************
-
 AX_OPENMP([openmp_ok=yes],[openmp_ok=no])
-AC_MSG_CHECKING([for OpenMP support])
-dnl a bit odd, but AX_OPENMP does its own check message, so we're not wrapping it at the moment
-AC_MSG_RESULT([$openmp_ok])
 if test "x$openmp_ok" = "xyes"; then
        dnl We have it, now set up the flags
        CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
        AC_CHECK_HEADER(omp.h)
 fi
 
-
 dnl ******************************
 dnl Check for libpng 
 dnl ******************************
diff --git a/m4/ink_svn_snapshot_build.m4 b/m4/ink_svn_snapshot_build.m4
new file mode 100644 (file)
index 0000000..2c013eb
--- /dev/null
@@ -0,0 +1,14 @@
+# Check for SVN snapshot build
+# (c) 2009 Krzysztof KosiƄski
+# Released under GNU GPL; see the file COPYING for more information
+
+AC_DEFUN([INK_SVN_SNAPSHOT_BUILD],
+[
+  AC_CACHE_CHECK([for SVN snapshot build], ink_cv_svn_snapshot_build,
+                 [ink_cv_svn_snapshot_build=no
+                  if which svn > /dev/null && test -e $srcdir/.svn/entries; then
+                    ink_cv_svn_snapshot_build=yes
+                  fi
+  ])
+  AM_CONDITIONAL([USE_SVN_VERSION], [test "x$ink_cv_svn_snapshot_build" = "xyes"])
+])
index 7a43a59c5c4ee92c95b412a6cd7a10c88f182c9a..e654ca13661bdda28121e0e85b09d2f3fef08cb2 100644 (file)
@@ -72,7 +72,6 @@ libinkpre_a_SOURCES = \
        icon-size.h \
        id-clash.cpp id-clash.h \
        ige-mac-menu.h ige-mac-menu.c \
-       inkscape-stock.cpp inkscape-stock.h\
        inkscape.cpp inkscape.h inkscape-private.h      \
        interface.cpp interface.h       \
        isinf.h \
@@ -313,10 +312,13 @@ inkview_LDADD = $(all_libs)
 
 libinkversion_a_SOURCES = inkscape-version.cpp inkscape-version.h
 
-# Hack: make inkscape-version.cpp a phony target.
-# Create the version file every time "make" is invoked. Overwrite it only
-# if it changes. Watch the backslashes!
-inkscape-version.cpp:
+if USE_SVN_VERSION
+inkscape_version_deps = $(top_srcdir)/.svn/entries
+endif
+
+# If this is an SVN snapshot build, regenerate this file every time
+# someone updates the SVN working directory.
+inkscape-version.cpp: $(inkscape_version_deps)
        VER_PREFIX="$(VERSION)"; \
        if test -x "$(srcdir)/.svn" -a ! -z `which svn`; then \
            VER_SVNREV=" r`svn info $(srcdir) | sed -n -e '/^Revision:/s/Revision: \(.*\)/\1/p'`"; \
@@ -334,7 +336,6 @@ inkscape-version.cpp:
             mv inkscape-version.new.cpp inkscape-version.cpp; \
        fi; \
        echo $$VERSION
-.PHONY: inkscape-version.cpp
 
 # ######################
 # ### CxxTest stuff ####