Updated pandora-build files to version 0.131
[m6w6/libmemcached] / m4 / pandora_vc_build.m4
index 9bff083511ab34fa50f1327b392094bc7f374e7e..c1a8fba597ca003aeb23e289ff52bd11e0e56067 100644 (file)
@@ -3,57 +3,79 @@ dnl This file is free software; Sun Microsystems
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
-AC_DEFUN([PANDORA_BUILDING_FROM_VC],[
+AC_DEFUN([PANDORA_TEST_VC_DIR],[
+  pandora_building_from_vc=no
 
-  ac_cv_building_from_vc=no
+  if test -d ".bzr" ; then
+    pandora_building_from_bzr=yes
+    pandora_building_from_vc=yes
+  else
+    pandora_building_from_bzr=no
+  fi
 
-  AS_IF([test -d "${srcdir}/.bzr"],[
-    ac_cv_building_from_bzr=yes
-    ac_cv_building_from_vc=yes
-    ],[
-    ac_cv_building_from_bzr=no
-  ])
+  if test -d ".svn" ; then
+    pandora_building_from_svn=yes
+    pandora_building_from_vc=yes
+  else
+    pandora_building_from_svn=no
+  fi
 
-  AS_IF([test -d "${srcdir}/.svn"],[
-    ac_cv_building_from_svn=yes
-    ac_cv_building_from_vc=yes
-    ],[
-    ac_cv_building_from_svn=no
-  ])
+  if test -d ".hg" ; then
+    pandora_building_from_hg=yes
+    pandora_building_from_vc=yes
+  else
+    pandora_building_from_hg=no
+  fi
 
-  AS_IF([test -d "${srcdir}/.hg"],[
-    ac_cv_building_from_hg=yes
-    ac_cv_building_from_vc=yes
-    ],[
-    ac_cv_building_from_hg=no
-  ])
+  if test -d ".git" ; then
+    pandora_building_from_git=yes
+    pandora_building_from_vc=yes
+  else
+    pandora_building_from_git=no
+  fi
+])
 
-  AS_IF([test -d "${srcdir}/.git"],[
-    ac_cv_building_from_git=yes
-    ac_cv_building_from_vc=yes
-    ],[
-    ac_cv_building_from_git=no
-  ])
+AC_DEFUN([PANDORA_BUILDING_FROM_VC],[
+  m4_syscmd(PANDORA_TEST_VC_DIR [
 
+    PANDORA_RELEASE_DATE=`date +%Y.%m`
+    PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m`
 
-])
-  
-dnl Takes one argument which is the prefix to append
-AC_DEFUN([PANDORA_EXPORT_BZR_INFO],[
-  m4_ifval(m4_normalize([$1]),[
-    m4_define([PEBI_PREFIX],[])
-  ],[
-    m4_define([PEBI_PREFIX],m4_toupper(m4_normalize($1))[_])
-  ])
+    # Set some defaults
+    PANDORA_VC_REVNO="0"
+    PANDORA_VC_REVID="unknown"
+    PANDORA_VC_BRANCH="bzr-export"
 
-  AC_DEFINE(PEBI_PREFIX[BZR_REVID], ["BZR_REVID"], [bzr revision ID])
-  AC_DEFINE(PEBI_PREFIX[BZR_BRANCH], ["BZR_BRANCH"], [bzr branch name])
-  AC_DEFINE(PEBI_PREFIX[RELEASE_DATE], ["RELEASE_DATE"], [Release date based on the date of the repo checkout])
-  AC_DEFINE(PEBI_PREFIX[RELEASE_VERSION], ["RELEASE_VERSION"], [$1 version number formatted for display])
-  AC_DEFINE(PEBI_PREFIX[RELEASE_COMMENT], ["RELEASE_COMMENT"], [Set to trunk if the branch is the main $1 branch])
-  AC_DEFINE(PEBI_PREFIX[RELEASE_ID], [RELEASE_ID], [$1 version number formatted for numerical comparison])
-])
+    if test "${pandora_building_from_bzr}" = "yes"; then
+      echo "# Grabbing changelog and version information from bzr"
+      PANDORA_BZR_REVNO=`bzr revno`
+      if test "x$PANDORA_BZR_REVNO" != "x${PANDORA_VC_REVNO}" ; then
+        PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}"
+        PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | cut -f2 -d' ' | head -1`
+        PANDORA_VC_BRANCH=`bzr nick`
+      fi
+    fi
+
+    if ! test -d config ; then
+      mkdir -p config
+    fi
 
+    if test "${pandora_building_from_bzr}" = "yes" -o ! -f config/pandora_vc_revinfo ; then 
+      cat > config/pandora_vc_revinfo.tmp <<EOF
+PANDORA_VC_REVNO=${PANDORA_VC_REVNO}
+PANDORA_VC_REVID=${PANDORA_VC_REVID}
+PANDORA_VC_BRANCH=${PANDORA_VC_BRANCH}
+PANDORA_RELEASE_DATE=${PANDORA_RELEASE_DATE}
+PANDORA_RELEASE_NODOTS_DATE=${PANDORA_RELEASE_NODOTS_DATE}
+EOF
+      if ! diff config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo >/dev/null 2>&1 ; then
+        mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo
+      fi
+      rm -f config/pandora_vc_revinfo.tmp
+    fi
+  ])
+])
+  
 AC_DEFUN([_PANDORA_READ_FROM_FILE],[
   $1=`grep $1 $2 | cut -f2 -d=`
 ])
@@ -61,50 +83,23 @@ AC_DEFUN([_PANDORA_READ_FROM_FILE],[
 AC_DEFUN([PANDORA_VC_VERSION],[
   AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
 
-  PANDORA_RELEASE_DATE=`date +%Y.%m`
-  PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m`
-
-  dnl Set some defaults
-  PANDORA_VC_REVNO="0"
-  PANDORA_VC_REVID="unknown"
-  PANDORA_VC_BRANCH="bzr-export"
+  PANDORA_TEST_VC_DIR
 
-  AS_IF([test -f ${srcdir}/config/bzr_revinfo],[
-    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/bzr_revinfo)
-    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/bzr_revinfo)
+  AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[
+    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/pandora_vc_revinfo)
+    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/pandora_vc_revinfo)
     _PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH],
-                            ${srcdir}/config/bzr_revinfo)
+                            ${srcdir}/config/pandora_vc_revinfo)
     _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE],
-                            ${srcdir}/config/bzr_revinfo)
+                            ${srcdir}/config/pandora_vc_revinfo)
     _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE],
-                            ${srcdir}/config/bzr_revinfo)
-    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_COMMENT],
-                            ${srcdir}/config/bzr_revinfo)
+                            ${srcdir}/config/pandora_vc_revinfo)
   ])
-  AS_IF([test "${ac_cv_building_from_bzr}" = "yes"],[
-dnl  echo "Grabbing changelog and version information from bzr"
-dnl  bzr log --short > ChangeLog || touch ChangeLog
-    PANDORA_BZR_REVNO=`bzr revno`
-    AS_IF([test "x$PANDORA_BZR_REVNO" != "${PANDORA_VC_REVNO}"],[
-      PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}"
-      PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | awk '{print $[]2}' | head -1`
-      PANDORA_VC_BRANCH=`bzr nick`
-      AS_IF([test "x${PANDORA_VC_BRANCH}" != "${PACKAGE}"],[
-        PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}"
-      ],[
-        PANDORA_RELEASE_COMMENT="trunk"
-      ])
-    ])
+  AS_IF([test "x${PANDORA_VC_BRANCH}" != x"${PACKAGE}"],[
+    PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}"
+  ],[
+    PANDORA_RELEASE_COMMENT="trunk"
   ])
-  AS_IF([! test -d config],[mkdir -p config])
-  cat > "config/bzr_revinfo" <<EOF
-PANDORA_VC_REVNO=${PANDORA_VC_REVNO}
-PANDORA_VC_REVID=${PANDORA_VC_REVID}
-PANDORA_VC_BRANCH=${PANDORA_VC_BRANCH}
-PANDORA_RELEASE_DATE=${PANDORA_RELEASE_DATE}
-PANDORA_RELEASE_NODOTS_DATE=${PANDORA_RELEASE_NODOTS_DATE}
-PANDORA_RELEASE_COMMENT=${PANDORA_RELEASE_COMMENT}
-EOF
     
   PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}"
   PANDORA_RELEASE_ID="${PANDORA_RELEASE_NODOTS_DATE}${PANDORA_VC_REVNO}"
@@ -121,3 +116,17 @@ EOF
   AC_SUBST(PANDORA_RELEASE_VERSION)
   AC_SUBST(PANDORA_RELEASE_ID)
 ])
+
+AC_DEFUN([PANDORA_VC_INFO_HEADER],[
+  AC_REQUIRE([PANDORA_VC_VERSION])
+  m4_define([PANDORA_VC_PREFIX],m4_toupper(m4_normalize(AC_PACKAGE_NAME))[_])
+
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVNO], [$PANDORA_VC_REVNO], [Version control revision number])
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVID], ["$PANDORA_VC_REVID"], [Version control revision ID])
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_BRANCH], ["$PANDORA_VC_BRANCH"], [Version control branch name])
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_DATE], ["$PANDORA_RELEASE_DATE"], [Release date of version control checkout])
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_NODOTS_DATE], [$PANDORA_RELEASE_NODOTS_DATE], [Numeric formatted release date of checkout])
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_COMMENT], ["$PANDORA_RELEASE_COMMENT"], [Set to trunk if the branch is the main $PACKAGE branch])
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_VERSION], ["$PANDORA_RELEASE_VERSION"], [Release date and revision number of checkout])
+  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_ID], [$PANDORA_RELEASE_ID], [Numeric formatted release date and revision number of checkout])
+])