~drizzle-trunk/drizzle/development

1085.1.4 by Monty Taylor
pandora-build v1
1
dnl  Copyright (C) 2009 Sun Microsystems
2
dnl This file is free software; Sun Microsystems
3
dnl gives unlimited permission to copy and/or distribute it,
4
dnl with or without modifications, as long as this notice is preserved.
5
1273.23.5 by Monty Taylor
Merged in changes fixing VC detection.
6
AC_DEFUN([PANDORA_TEST_VC_DIR],[
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
7
  pandora_building_from_vc=no
8
9
  if test -d ".bzr" ; then
10
    pandora_building_from_bzr=yes
11
    pandora_building_from_vc=yes
12
  else
13
    pandora_building_from_bzr=no
14
  fi
15
16
  if test -d ".svn" ; then
17
    pandora_building_from_svn=yes
18
    pandora_building_from_vc=yes
19
  else
20
    pandora_building_from_svn=no
21
  fi
22
23
  if test -d ".hg" ; then
24
    pandora_building_from_hg=yes
25
    pandora_building_from_vc=yes
26
  else
27
    pandora_building_from_hg=no
28
  fi
29
30
  if test -d ".git" ; then
31
    pandora_building_from_git=yes
32
    pandora_building_from_vc=yes
33
  else
34
    pandora_building_from_git=no
35
  fi
36
])
37
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
38
AC_DEFUN([PANDORA_BUILDING_FROM_VC],[
1273.23.5 by Monty Taylor
Merged in changes fixing VC detection.
39
  m4_syscmd(PANDORA_TEST_VC_DIR [
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
40
41
    PANDORA_RELEASE_DATE=`date +%Y.%m`
42
    PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m`
43
44
    # Set some defaults
45
    PANDORA_VC_REVNO="0"
46
    PANDORA_VC_REVID="unknown"
47
    PANDORA_VC_BRANCH="bzr-export"
48
49
    if test "${pandora_building_from_bzr}" = "yes"; then
50
      echo "# Grabbing changelog and version information from bzr"
51
      PANDORA_BZR_REVNO=`bzr revno`
52
      if test "x$PANDORA_BZR_REVNO" != "x${PANDORA_VC_REVNO}" ; then
53
        PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}"
54
        PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | cut -f2 -d' ' | head -1`
55
        PANDORA_VC_BRANCH=`bzr nick`
1897.4.20 by Monty Taylor
Build the ChangeLog during autorun - same time as we do all the rest of the
56
	bzr log --gnu > ChangeLog
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
57
      fi
58
    fi
59
60
    if ! test -d config ; then
61
      mkdir -p config
62
    fi
63
1502.4.1 by Monty Taylor
Don't overwrite the pandora_vc_revinfo file if we don't have new
64
    if test "${pandora_building_from_bzr}" = "yes" -o ! -f config/pandora_vc_revinfo ; then 
65
      cat > config/pandora_vc_revinfo.tmp <<EOF
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
66
PANDORA_VC_REVNO=${PANDORA_VC_REVNO}
67
PANDORA_VC_REVID=${PANDORA_VC_REVID}
68
PANDORA_VC_BRANCH=${PANDORA_VC_BRANCH}
69
PANDORA_RELEASE_DATE=${PANDORA_RELEASE_DATE}
70
PANDORA_RELEASE_NODOTS_DATE=${PANDORA_RELEASE_NODOTS_DATE}
71
EOF
1502.4.1 by Monty Taylor
Don't overwrite the pandora_vc_revinfo file if we don't have new
72
      if ! diff config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo >/dev/null 2>&1 ; then
73
        mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo
74
      fi
75
      rm -f config/pandora_vc_revinfo.tmp
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
76
    fi
77
  ])
1085.1.3 by Monty Taylor
Split out warnings - start using the pandora build system.
78
])
1085.1.4 by Monty Taylor
pandora-build v1
79
  
1192.3.6 by Monty Taylor
pandora-build v0.67 - Support configure-time bzr version checking.
80
AC_DEFUN([_PANDORA_READ_FROM_FILE],[
81
  $1=`grep $1 $2 | cut -f2 -d=`
82
])
83
84
AC_DEFUN([PANDORA_VC_VERSION],[
85
  AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
86
1273.23.5 by Monty Taylor
Merged in changes fixing VC detection.
87
  PANDORA_TEST_VC_DIR
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
88
89
  AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[
90
    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/pandora_vc_revinfo)
91
    _PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/pandora_vc_revinfo)
1192.3.6 by Monty Taylor
pandora-build v0.67 - Support configure-time bzr version checking.
92
    _PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH],
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
93
                            ${srcdir}/config/pandora_vc_revinfo)
1192.3.6 by Monty Taylor
pandora-build v0.67 - Support configure-time bzr version checking.
94
    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE],
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
95
                            ${srcdir}/config/pandora_vc_revinfo)
1192.3.6 by Monty Taylor
pandora-build v0.67 - Support configure-time bzr version checking.
96
    _PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE],
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
97
                            ${srcdir}/config/pandora_vc_revinfo)
98
  ])
99
  AS_IF([test "x${PANDORA_VC_BRANCH}" != x"${PACKAGE}"],[
100
    PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}"
101
  ],[
102
    PANDORA_RELEASE_COMMENT="trunk"
103
  ])
1192.3.6 by Monty Taylor
pandora-build v0.67 - Support configure-time bzr version checking.
104
    
105
  PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}"
106
  PANDORA_RELEASE_ID="${PANDORA_RELEASE_NODOTS_DATE}${PANDORA_VC_REVNO}"
107
108
  VERSION="${PANDORA_RELEASE_VERSION}"
1192.3.7 by Monty Taylor
Added code necessary for building plugins dynamically.
109
  AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["${PANDORA_RELEASE_VERSION}"],
110
                     [The real version of the software])
1192.3.6 by Monty Taylor
pandora-build v0.67 - Support configure-time bzr version checking.
111
  AC_SUBST(PANDORA_VC_REVNO)
112
  AC_SUBST(PANDORA_VC_REVID)
113
  AC_SUBST(PANDORA_VC_BRANCH)
114
  AC_SUBST(PANDORA_RELEASE_DATE)
115
  AC_SUBST(PANDORA_RELEASE_NODOTS_DATE)
116
  AC_SUBST(PANDORA_RELEASE_COMMENT)
117
  AC_SUBST(PANDORA_RELEASE_VERSION)
118
  AC_SUBST(PANDORA_RELEASE_ID)
119
])
1273.12.1 by Monty Taylor
pandora-build v0.100 - Fixes several bugs found by cb1kenobi. Add several thoughts from folks at LCA.
120
121
AC_DEFUN([PANDORA_VC_INFO_HEADER],[
122
  AC_REQUIRE([PANDORA_VC_VERSION])
123
  m4_define([PANDORA_VC_PREFIX],m4_toupper(m4_normalize(AC_PACKAGE_NAME))[_])
124
125
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVNO], [$PANDORA_VC_REVNO], [Version control revision number])
126
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVID], ["$PANDORA_VC_REVID"], [Version control revision ID])
127
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_BRANCH], ["$PANDORA_VC_BRANCH"], [Version control branch name])
128
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_DATE], ["$PANDORA_RELEASE_DATE"], [Release date of version control checkout])
129
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_NODOTS_DATE], [$PANDORA_RELEASE_NODOTS_DATE], [Numeric formatted release date of checkout])
130
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_COMMENT], ["$PANDORA_RELEASE_COMMENT"], [Set to trunk if the branch is the main $PACKAGE branch])
131
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_VERSION], ["$PANDORA_RELEASE_VERSION"], [Release date and revision number of checkout])
132
  AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_ID], [$PANDORA_RELEASE_ID], [Numeric formatted release date and revision number of checkout])
133
])