~drizzle-trunk/drizzle/development

40 by Brian Aker
Updating to modern autorun
1
#!/usr/bin/env bash
2
# Taken from lighthttpd server (BSD). Thanks Jan!
3
# Run this to generate all the initial makefiles, etc.
14 by brian
Adding autorun statement
4
5
die() { echo "$@"; exit 1; }
6
527 by Monty Taylor
Fixed the libtool crap. (maybe?)
7
# LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
520.1.4 by Brian Aker
Merging Monty's work
8
LIBTOOLIZE_FLAGS=" --automake --copy --force"
40 by Brian Aker
Updating to modern autorun
9
# ACLOCAL=${ACLOCAL:-aclocal}
755.1.5 by Monty Taylor
Reverted stupid change.
10
ACLOCAL_FLAGS="-I m4"
40 by Brian Aker
Updating to modern autorun
11
# AUTOHEADER=${AUTOHEADER:-autoheader}
12
# AUTOMAKE=${AUTOMAKE:-automake}
524 by Monty
Removed --force from automake to prevent older automakes from copying in older versions of config.guess and config.sub.
13
# --add-missing instructs automake to install missing auxiliary files
14
# --copy tells it to make copies and not symlinks
520.1.4 by Brian Aker
Merging Monty's work
15
AUTOMAKE_FLAGS="--add-missing --copy --force"
40 by Brian Aker
Updating to modern autorun
16
# AUTOCONF=${AUTOCONF:-autoconf}
17
18
ARGV0=$0
19
ARGS="$@"
20
21
22
run() {
23
	echo "$ARGV0: running \`$@' $ARGS"
24
	$@ $ARGS
25
}
26
27
## jump out if one of the programs returns 'false'
28
set -e
29
1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
30
RELEASE_DATE=`date +%Y.%m`
31
RELEASE_DATE_NODOTS=`date +%Y%m`
177.2.1 by Monty Taylor
Two fixes to autorun, based on guiseppe's build.
32
if test -d ".bzr" ; then
1022.2.42 by Monty Taylor
Be a little bit more verbose. Also, prefer newer autoconf/automake/libtoolize if they are there.
33
  echo "Grabbing changelog and version information from bzr"
177.2.1 by Monty Taylor
Two fixes to autorun, based on guiseppe's build.
34
  bzr log --short > ChangeLog || touch ChangeLog
908.1.3 by Monty Taylor
Updated build system to use new version numbering. Just remember to run ./config/autorun.sh before running make distcheck for release and all should be peachy.
35
  BZR_REVNO=`bzr revno`
36
  BZR_REVID=`bzr log -r-1 --show-ids | grep revision-id | awk '{print $2}' | head -1`
37
  BZR_BRANCH=`bzr nick`
236.1.20 by Monty Taylor
If we aren't in a bzr checkout, touch ChangeLog so that automake will run. (Thanks ebergen)
38
else
1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
39
  touch ChangeLog
950.1.4 by Monty Taylor
Fixed for gmaxia's export problem.
40
  BZR_REVNO="0"
41
  BZR_REVID="unknown"
42
  BZR_BRANCH="bzr-export"
1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
43
fi
44
RELEASE_VERSION="${RELEASE_DATE}.${BZR_REVNO}"
45
RELEASE_ID="${RELEASE_DATE_NODOTS}${BZR_REVNO}"
46
if test "x${BZR_BRANCH}" != "xdrizzle" ; then
47
  RELEASE_COMMENT="${BZR_BRANCH}"
48
else
49
  RELEASE_COMMENT="trunk"
177.2.1 by Monty Taylor
Two fixes to autorun, based on guiseppe's build.
50
fi
950.1.4 by Monty Taylor
Fixed for gmaxia's export problem.
51
1003.2.2 by Monty Taylor
Fixed autorun.sh to actually work from a tarball.
52
if test -f m4/bzr_version.m4.in
53
then
54
  sed -e "s/@BZR_REVNO@/${BZR_REVNO}/" \
55
      -e "s/@BZR_REVID@/${BZR_REVID}/" \
56
      -e "s/@BZR_BRANCH@/${BZR_BRANCH}/" \
57
      -e "s/@RELEASE_DATE@/${RELEASE_DATE}/" \
1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
58
      -e "s/@RELEASE_ID@/${RELEASE_ID}/" \
1003.2.2 by Monty Taylor
Fixed autorun.sh to actually work from a tarball.
59
      -e "s/@RELEASE_VERSION@/${RELEASE_VERSION}/" \
1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
60
      -e "s/@RELEASE_COMMENT@/${RELEASE_COMMENT}/" \
1003.2.2 by Monty Taylor
Fixed autorun.sh to actually work from a tarball.
61
    m4/bzr_version.m4.in > m4/bzr_version.m4.new
62
  
63
  if ! diff m4/bzr_version.m4.new m4/bzr_version.m4 >/dev/null 2>&1 ; then
64
    mv m4/bzr_version.m4.new m4/bzr_version.m4
65
  else
66
    rm m4/bzr_version.m4.new
67
  fi
950.1.4 by Monty Taylor
Fixed for gmaxia's export problem.
68
fi
28.2.1 by Monty Taylor
Made system non-foreign.
69
1081.1.1 by Monty Taylor
Whole boat-load of build fixes.
70
EGREP=`which egrep`
71
if test "x$EGREP" != "x" -a -d po
72
then
73
  echo "# This file is auto-generated from configure. Do not edit directly" > po/POTFILES.in.in
74
  # The grep -v 'drizzle-' is to exclude any distcheck leftovers
75
  for f in `find . | grep -v 'drizzle-' | ${EGREP} '\.(cc|c|h|yy)$' | cut -c3- | sort`
76
  do
77
    if grep gettext.h "$f" | grep include >/dev/null 2>&1
78
    then
79
      echo "$f" >> po/POTFILES.in.in
80
    fi
81
  done
82
  if ! diff po/POTFILES.in.in po/POTFILES.in >/dev/null 2>&1
83
  then
84
    mv po/POTFILES.in.in po/POTFILES.in
85
  else
86
    rm po/POTFILES.in.in
87
  fi
88
else
89
  touch po/POTFILES.in
90
fi
992.1.21 by Monty Taylor
First pass at replacing plugin.m4.
91
527 by Monty Taylor
Fixed the libtool crap. (maybe?)
92
if test x$LIBTOOLIZE = x; then
93
  if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
94
    LIBTOOLIZE=glibtoolize
1022.2.42 by Monty Taylor
Be a little bit more verbose. Also, prefer newer autoconf/automake/libtoolize if they are there.
95
  elif test \! "x`which libtoolize-2.2 2> /dev/null | grep -v '^no'`" = x; then
96
    LIBTOOLIZE=libtoolize-2.2
527 by Monty Taylor
Fixed the libtool crap. (maybe?)
97
  elif test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
98
    LIBTOOLIZE=libtoolize-1.5
99
  elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
100
    LIBTOOLIZE=libtoolize
101
  elif test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
102
    LIBTOOLIZE=glibtoolize
103
  else
1022.2.42 by Monty Taylor
Be a little bit more verbose. Also, prefer newer autoconf/automake/libtoolize if they are there.
104
    echo "libtoolize wasn't found, exiting"; exit 1
527 by Monty Taylor
Fixed the libtool crap. (maybe?)
105
  fi
106
fi
107
40 by Brian Aker
Updating to modern autorun
108
if test x$ACLOCAL = x; then
28.1.29 by Monty Taylor
Updated versions of autotools used by default.
109
  if test \! "x`which aclocal-1.10 2> /dev/null | grep -v '^no'`" = x; then
110
    ACLOCAL=aclocal-1.10
111
  elif test \! "x`which aclocal110 2> /dev/null | grep -v '^no'`" = x; then
112
    ACLOCAL=aclocal110
40 by Brian Aker
Updating to modern autorun
113
  elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
114
    ACLOCAL=aclocal
115
  else 
236.1.11 by Monty Taylor
Changed failure results in autorun.sh to exit 1
116
    echo "automake 1.10.x (aclocal) wasn't found, exiting"; exit 1
40 by Brian Aker
Updating to modern autorun
117
  fi
118
fi
119
120
if test x$AUTOMAKE = x; then
28.1.29 by Monty Taylor
Updated versions of autotools used by default.
121
  if test \! "x`which automake-1.10 2> /dev/null | grep -v '^no'`" = x; then
122
    AUTOMAKE=automake-1.10
123
  elif test \! "x`which automake110 2> /dev/null | grep -v '^no'`" = x; then
124
    AUTOMAKE=automake110
40 by Brian Aker
Updating to modern autorun
125
  elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
126
    AUTOMAKE=automake
127
  else 
236.1.11 by Monty Taylor
Changed failure results in autorun.sh to exit 1
128
    echo "automake 1.10.x wasn't found, exiting"; exit 1
40 by Brian Aker
Updating to modern autorun
129
  fi
130
fi
131
132
133
## macosx has autoconf-2.59 and autoconf-2.60
134
if test x$AUTOCONF = x; then
1022.2.42 by Monty Taylor
Be a little bit more verbose. Also, prefer newer autoconf/automake/libtoolize if they are there.
135
  if test \! "x`which autoconf-2.63 2> /dev/null | grep -v '^no'`" = x; then
136
    AUTOCONF=autoconf-2.63
137
  elif test \! "x`which autoconf263 2> /dev/null | grep -v '^no'`" = x; then
138
    AUTOCONF=autoconf263
139
  elif test \! "x`which autoconf-2.60 2> /dev/null | grep -v '^no'`" = x; then
140
    AUTOCONF=autoconf-2.60
141
  elif test \! "x`which autoconf260 2> /dev/null | grep -v '^no'`" = x; then
142
    AUTOCONF=autoconf260
143
  elif test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
40 by Brian Aker
Updating to modern autorun
144
    AUTOCONF=autoconf-2.59
145
  elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
146
    AUTOCONF=autoconf259
147
  elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
148
    AUTOCONF=autoconf
149
  else 
236.1.11 by Monty Taylor
Changed failure results in autorun.sh to exit 1
150
    echo "autoconf 2.59+ wasn't found, exiting"; exit 1
40 by Brian Aker
Updating to modern autorun
151
  fi
152
fi
153
154
if test x$AUTOHEADER = x; then
1022.2.42 by Monty Taylor
Be a little bit more verbose. Also, prefer newer autoconf/automake/libtoolize if they are there.
155
  if test \! "x`which autoheader-2.63 2> /dev/null | grep -v '^no'`" = x; then
156
    AUTOHEADER=autoheader-2.63
157
  elif test \! "x`which autoheader263 2> /dev/null | grep -v '^no'`" = x; then
158
    AUTOHEADER=autoheader263
159
  elif test \! "x`which autoheader-2.60 2> /dev/null | grep -v '^no'`" = x; then
160
    AUTOHEADER=autoheader-2.60
161
  elif test \! "x`which autoheader260 2> /dev/null | grep -v '^no'`" = x; then
162
    AUTOHEADER=autoheader260
163
  elif test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
40 by Brian Aker
Updating to modern autorun
164
    AUTOHEADER=autoheader-2.59
165
  elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
166
    AUTOHEADER=autoheader259
167
  elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
168
    AUTOHEADER=autoheader
169
  else 
236.1.11 by Monty Taylor
Changed failure results in autorun.sh to exit 1
170
    echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 1
40 by Brian Aker
Updating to modern autorun
171
  fi
172
fi
173
174
527 by Monty Taylor
Fixed the libtool crap. (maybe?)
175
# --force means overwrite ltmain.sh script if it already exists 
1022.2.42 by Monty Taylor
Be a little bit more verbose. Also, prefer newer autoconf/automake/libtoolize if they are there.
176
run python config/register_plugins.py || die  "Can't execute register_plugins"
527 by Monty Taylor
Fixed the libtool crap. (maybe?)
177
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
178
40 by Brian Aker
Updating to modern autorun
179
run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
180
run $AUTOHEADER || die "Can't execute autoheader"
181
run $AUTOMAKE $AUTOMAKE_FLAGS  || die "Can't execute automake"
182
run $AUTOCONF || die "Can't execute autoconf"
236.1.34 by Monty Taylor
Output automake version too.
183
echo -n "Automade with: "
184
$AUTOMAKE --version | head -1
236.1.33 by Monty Taylor
Added output of autoconf version to autorun.sh.
185
echo -n "Configured with: "
186
$AUTOCONF --version | head -1