]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Implemented --enable-build-info configure option.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 8 Sep 2010 14:46:42 +0000 (16:46 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Wed, 8 Sep 2010 14:46:42 +0000 (16:46 +0200)
acinclude/squid-util.m4
configure.in
src/main.cc
test-suite/buildtest.sh
test-suite/buildtests/layer-00-default.opts
test-suite/buildtests/layer-01-minimal.opts
test-suite/buildtests/layer-02-maximus.opts
test-suite/buildtests/layer-05-nodeps-esi.opts
test-suite/buildtests/os-debian.opts
test-suite/buildtests/os-mingw.opts
test-suite/buildtests/os-ubuntu.opts

index de936cd8e8246a3f2c39151c355eea1b59117edb..260d20b8bec5c0b8dd47091f929c719cd49c798a 100644 (file)
@@ -179,3 +179,42 @@ if test "$1" != "yes" -a "$1" != "no" ; then
   AC_MSG_ERROR([$2])
 fi
 ])
+
+AC_DEFUN([SQUID_EMBED_BUILD_INFO],[
+  AC_ARG_ENABLE([build-info],
+    AS_HELP_STRING([--enable-build-info="build info string"],
+      [Add an additional string in the output of "string -v".
+       Default is not to add anything. If the string is not specified,
+       tries to determine nick and revision number of the current 
+       bazaar branch]),[
+  case "$enableval" in
+    no) ${TRUE}
+        ;;
+    yes)
+      if test -d "${srcdir}/.bzr"; then
+        AC_PATH_PROG(BZR,bzr,$FALSE)
+        squid_bzr_branch_nick=`${BZR} nick 2>/dev/null`
+        if test $? -eq 0 -a "x$squid_bzr_branch_nick" != "x"; then
+          squid_bzr_branch_revno=`${BZR} revno 2>/dev/null | sed 's/\"//g'`
+        fi
+        if test $? -eq 0 -a "x$squid_bzr_branch_revno" != "x"; then
+          ${BZR} diff 2>&1 >/dev/null
+          if test $? -eq 1; then
+              squid_bzr_branch_revno="$squid_bzr_branch_revno+changes"
+          fi
+        fi
+        if test "x$squid_bzr_branch_revno" != "x"; then
+          squid_build_info="Built branch: ${squid_bzr_branch_nick}-r${squid_bzr_branch_revno}"
+        fi
+      fi
+      ;;
+    *)
+      squid_build_info=$enableval
+      ;;
+  esac
+  ])
+  if test "x${squid_build_info:=no}" != "xno"; then
+    AC_DEFINE_UNQUOTED([SQUID_BUILD_INFO],["$squid_build_info"],
+       [Squid extended build info field for "squid -v" output])
+  fi
+])
index fdacf0bc24aa856cc106527db6a2cbf92eb60cfb..458d4df7f6b804d921b67ff0d0a00e97c50e6ea1 100644 (file)
@@ -310,6 +310,9 @@ fi
 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
 
+# possibly include some build info tag into squid -v
+SQUID_EMBED_BUILD_INFO
+
 AC_ARG_ENABLE(optimizations,
   AS_HELP_STRING([--disable-optimizations],
                  [Do not compile Squid with compiler optimizations enabled.
index 239621b000ddb904bf08c744c73f47448a06f5ec..476752fe90dfaba36e91b7da4ba1445c8783704a 100644 (file)
@@ -113,6 +113,10 @@ void WINAPI WIN32_svcHandler(DWORD);
 
 #endif
 
+#ifndef SQUID_BUILD_INFO
+#define SQUID_BUILD_INFO ""
+#endif
+
 /** for error reporting from xmalloc and friends */
 SQUIDCEXTERN void (*failure_notify) (const char *);
 
@@ -531,7 +535,10 @@ mainParseOptions(int argc, char *argv[])
         case 'v':
             /** \par v
              * Display squid version and build information. Then exit. */
-            printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS);
+            printf("Squid Cache: Version %s\n" ,version_string);
+            if (strlen(SQUID_BUILD_INFO))
+                printf("%s\n",SQUID_BUILD_INFO);
+            printf( "configure options: %s\n", SQUID_CONFIGURE_OPTIONS);
 
 #if USE_WIN32_SERVICE
 
index 364ef5254fdf35e133286549f1d2c8d778826437..5f16136198d5d6f2b340cc29542e07bb4d1ea9b3 100755 (executable)
@@ -51,7 +51,10 @@ fi
 # above command currently encounters dependancy problems on cleanup.
 #
 # do not build any of the install's ...
-       $base/../configure ${OPTS} ${configcache} 2>&1 &&
+#
+# eval is need to correctly handle quoted arguments
+       eval "$base/../configure ${SQUID_CONFIGURE_FLAGS} ${configcache}" \
+               2>&1 && \
        make ${pjobs} ${MAKETEST} 2>&1
 
 # Remember and then explicitly return the result of the last command
index b0252de87d738522308201d5a53025d85c8588da..50057fcbdff508444f78b3b59de24421253877f4 100644 (file)
@@ -6,7 +6,7 @@ MAKETEST="distcheck"
 # Default configuration options.
 #  - Nothing special configured. Just whatever is found by "./configure"
 #
-OPTS=""
+SQUID_CONFIGURE_FLAGS=""
 
 # Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export SQUID_CONFIGURE_FLAGS
index 2b2110cfed3936e4fc074ada8cc2a7d054dfdc9e..047f3b149378dc5d310d10459597eb170c30c47e 100644 (file)
@@ -26,7 +26,8 @@ MAKETEST="distcheck"
 #   --without-build-environment \
 #
 #
-OPTS=" \
+SQUID_CONFIGURE_FLAGS=" \
+       --disable-build-info \
        --disable-loadable-modules \
        --disable-gnuregex \
        --disable-optimizations \
@@ -99,4 +100,4 @@ OPTS=" \
        "
 
 # Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export SQUID_CONFIGURE_FLAGS
index 73d3992330ba664603740d876f05aa9bf0f1d9ce..27637f4304489c9f46b9d6abe126f6507948adf4 100644 (file)
@@ -40,7 +40,7 @@ MAKETEST="distcheck"
 #   --with-valgrind-debug \
 #
 #
-OPTS=" \
+SQUID_CONFIGURE_FLAGS=" \
        --enable-loadable-modules \
        --enable-gnuregex \
        --enable-optimizations \
@@ -94,7 +94,6 @@ OPTS=" \
        --enable-translation \
        --enable-zph-qos \
        --enable-esi \
- \
        --with-aio \
        --with-build-environment=default \
        --with-dl \
@@ -104,7 +103,8 @@ OPTS=" \
        --with-large-files \
        --with-pic \
        --with-pthreads \
+       --enable-build-info=squid\ test\ build \
        "
 
 # Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export SQUID_CONFIGURE_FLAGS
index eb52308c6c2f0aff29d9f53ca93dc8d6ff02e1e2..578cf6862970e6a86a86c8b0cb5b5816155dd90f 100644 (file)
@@ -10,7 +10,11 @@ MAKETEST="distcheck"
 # NP: there must be no overlap in code for plugging the libraries in/out.
 #     this means we can test the absence of all in one run and save time.
 #
-OPTS="--enable-esi --without-expat --without-libxml2"
+SQUID_CONFIGURE_FLAGS="\
+       --enable-esi \
+       --without-expat \
+       --without-libxml2 \
+       --enable-build-info"
 
 # Fix the distclean testing.
-export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"
+export SQUID_CONFIGURE_FLAGS
index 46468ebc6b297efe814dde175f06ed9aaecacd09..dbf46c337d722d59e05ed71f652ef45f1a4661fa 100644 (file)
@@ -7,7 +7,7 @@ MAKETEST="check installcheck uninstallcheck"
 #
 # This is to test any release build against what the package maintainers are seing
 #
-OPTS=" \
+SQUID_CONFIGURE_FLAGS=" \
        --build=i486-linux-gnu \
        --prefix=/usr \
        --includedir="\${prefix}/include" \
index 670d6d42ba9eddbcf9d2e9b0d5141c19465eff2c..a125d4ae57586721e0b6d7b2682e8d283b7fd98f 100644 (file)
@@ -5,7 +5,7 @@ MAKETEST="check installcheck uninstallcheck"
 #
 # Configure options currently supported by MinGW environment
 #
-OPTS=" \
+SQUID_CONFIGURE_FLAGS=" \
        --prefix=c:/squid \
        --enable-storeio="ufs,aufs" \
        --enable-removal-policies="lru,heap" \
index 5d9c761f5804dc2f265c0145a934bcca092e06a3..0c9db9ddbf0948d9902bfac66ebb59fe3784be86 100644 (file)
@@ -6,7 +6,7 @@ MAKETEST="check installcheck uninstallcheck"
 #
 # This is to test any release build against what the package maintainers are seeing
 #
-OPTS=" \
+SQUID_CONFIGURE_FLAGS=" \
        --build=i486-linux-gnu \
        --prefix=/usr \
        --includedir="\${prefix}/include" \