~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to config/autorun.sh

  • Committer: Brian Aker
  • Date: 2009-07-16 19:30:03 UTC
  • mfrom: (1093.1.17 captain)
  • Revision ID: brian@gaz-20090716193003-gwt4i1le2g02ay0j
Merge Jay

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env bash
 
1
#!/bin/sh
2
2
# Taken from lighthttpd server (BSD). Thanks Jan!
3
3
# Run this to generate all the initial makefiles, etc.
4
4
 
5
5
die() { echo "$@"; exit 1; }
6
6
 
7
 
# LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
 
7
# --force means overwrite ltmain.sh script if it already exists 
8
8
LIBTOOLIZE_FLAGS=" --automake --copy --force"
9
 
# ACLOCAL=${ACLOCAL:-aclocal}
10
 
ACLOCAL_FLAGS="-I m4"
11
 
# AUTOHEADER=${AUTOHEADER:-autoheader}
12
 
# AUTOMAKE=${AUTOMAKE:-automake}
13
9
# --add-missing instructs automake to install missing auxiliary files
14
 
# --copy tells it to make copies and not symlinks
 
10
# and --force to overwrite them if they already exist
15
11
AUTOMAKE_FLAGS="--add-missing --copy --force"
16
 
# AUTOCONF=${AUTOCONF:-autoconf}
 
12
ACLOCAL_FLAGS="-I m4"
17
13
 
18
14
ARGV0=$0
19
15
ARGS="$@"
20
16
 
21
 
 
22
17
run() {
23
18
        echo "$ARGV0: running \`$@' $ARGS"
24
19
        $@ $ARGS
25
20
}
26
21
 
27
 
## jump out if one of the programs returns 'false'
28
 
set -e
29
 
 
30
 
RELEASE_DATE=`date +%Y.%m`
31
 
RELEASE_DATE_NODOTS=`date +%Y%m`
32
 
if test -d ".bzr" ; then
33
 
  echo "Grabbing changelog and version information from bzr"
34
 
  bzr log --short > ChangeLog || touch ChangeLog
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`
38
 
else
39
 
  touch ChangeLog
40
 
  BZR_REVNO="0"
41
 
  BZR_REVID="unknown"
42
 
  BZR_BRANCH="bzr-export"
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"
50
 
fi
51
 
 
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}/" \
58
 
      -e "s/@RELEASE_ID@/${RELEASE_ID}/" \
59
 
      -e "s/@RELEASE_VERSION@/${RELEASE_VERSION}/" \
60
 
      -e "s/@RELEASE_COMMENT@/${RELEASE_COMMENT}/" \
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
68
 
fi
69
 
 
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`
 
22
# Try to locate a program by using which, and verify that the file is an
 
23
# executable
 
24
locate_binary() {
 
25
  for f in $@
76
26
  do
77
 
    if grep gettext.h "$f" | grep include >/dev/null 2>&1
78
 
    then
79
 
      echo "$f" >> po/POTFILES.in.in
 
27
    file=`which $f 2>/dev/null | grep -v '^no '`
 
28
    if test -n "$file" -a -x "$file"; then
 
29
      echo $file
 
30
      return 0
80
31
    fi
81
32
  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
 
33
 
 
34
  echo "" 
 
35
  return 1
 
36
}
 
37
 
 
38
 
 
39
if test -f config/pre_hook.sh
 
40
then
 
41
  . config/pre_hook.sh
90
42
fi
91
43
 
 
44
# Try to detect the supported binaries if the user didn't
 
45
# override that by pushing the environment variable
92
46
if test x$LIBTOOLIZE = x; then
93
 
  if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
94
 
    LIBTOOLIZE=glibtoolize
95
 
  elif test \! "x`which libtoolize-2.2 2> /dev/null | grep -v '^no'`" = x; then
96
 
    LIBTOOLIZE=libtoolize-2.2
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
104
 
    echo "libtoolize wasn't found, exiting"; exit 1
 
47
  LIBTOOLIZE=`locate_binary glibtoolize libtoolize-1.5 libtoolize`
 
48
  if test x$LIBTOOLIZE = x; then
 
49
    die "Did not find a supported libtoolize"
105
50
  fi
106
51
fi
107
52
 
108
53
if test x$ACLOCAL = x; then
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
113
 
  elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
114
 
    ACLOCAL=aclocal
115
 
  else 
116
 
    echo "automake 1.10.x (aclocal) wasn't found, exiting"; exit 1
 
54
  ACLOCAL=`locate_binary aclocal-1.10 aclocal-1.9 aclocal19 aclocal`
 
55
  if test x$ACLOCAL = x; then
 
56
    die "Did not find a supported aclocal"
117
57
  fi
118
58
fi
119
59
 
120
60
if test x$AUTOMAKE = x; then
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
125
 
  elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
126
 
    AUTOMAKE=automake
127
 
  else 
128
 
    echo "automake 1.10.x wasn't found, exiting"; exit 1
 
61
  AUTOMAKE=`locate_binary automake-1.10 automake-1.9 automake19 automake`
 
62
  if test x$AUTOMAKE = x; then
 
63
    die "Did not find a supported automake"
129
64
  fi
130
65
fi
131
66
 
132
 
 
133
 
## macosx has autoconf-2.59 and autoconf-2.60
134
67
if test x$AUTOCONF = x; then
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
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 
150
 
    echo "autoconf 2.59+ wasn't found, exiting"; exit 1
 
68
  AUTOCONF=`locate_binary autoconf-2.59 autoconf259 autoconf`
 
69
  if test x$AUTOCONF = x; then
 
70
    die "Did not find a supported autoconf"
151
71
  fi
152
72
fi
153
73
 
154
74
if test x$AUTOHEADER = x; then
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
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 
170
 
    echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 1
 
75
  AUTOHEADER=`locate_binary autoheader-2.59 autoheader259 autoheader`
 
76
  if test x$AUTOHEADER = x; then
 
77
    die "Did not find a supported autoheader"
171
78
  fi
172
79
fi
173
80
 
174
 
 
175
 
# --force means overwrite ltmain.sh script if it already exists 
176
 
run python config/register_plugins.py || die  "Can't execute register_plugins"
177
81
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
178
 
 
179
82
run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
180
83
run $AUTOHEADER || die "Can't execute autoheader"
181
84
run $AUTOMAKE $AUTOMAKE_FLAGS  || die "Can't execute automake"
182
85
run $AUTOCONF || die "Can't execute autoconf"
183
 
echo -n "Automade with: "
184
 
$AUTOMAKE --version | head -1
185
 
echo -n "Configured with: "
186
 
$AUTOCONF --version | head -1
 
86
 
 
87
if test -f config/post_hook.sh
 
88
then
 
89
  . config/post_hook.sh
 
90
fi
 
91
 
 
92
echo "---"
 
93
echo "Configured with the following tools:"
 
94
echo "  * `$LIBTOOLIZE --version | head -1`"
 
95
echo "  * `$ACLOCAL --version | head -1`"
 
96
echo "  * `$AUTOHEADER --version | head -1`"
 
97
echo "  * `$AUTOMAKE --version | head -1`"
 
98
echo "  * `$AUTOCONF --version | head -1`"
 
99
echo "---"