3
# Copyright (C) 2006 Jan Kneschke
4
# Copyright (C) 2009 Sun Microsystems, Inc.
7
# Redistribution and use in source and binary forms, with or without
8
# modification, are permitted provided that the following conditions are met:
10
# 1. Redistributions of source code must retain the above copyright
11
# notice, this list of conditions and the following disclaimer.
12
# 2. Redistributions in binary form must reproduce the above copyright
13
# notice, this list of conditions and the following disclaimer in the
14
# documentation and/or other materials provided with the distribution.
15
# 3. The name of the author may not be used to endorse or promote products
16
# derived from this software without specific prior written permission.
18
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2
# Taken from lighthttpd server (BSD). Thanks Jan!
30
3
# Run this to generate all the initial makefiles, etc.
32
5
die() { echo "$@"; exit 1; }
34
# --force means overwrite ltmain.sh script if it already exists
7
# LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
35
8
LIBTOOLIZE_FLAGS=" --automake --copy --force"
9
# ACLOCAL=${ACLOCAL:-aclocal}
11
# AUTOHEADER=${AUTOHEADER:-autoheader}
12
# AUTOMAKE=${AUTOMAKE:-automake}
36
13
# --add-missing instructs automake to install missing auxiliary files
37
# and --force to overwrite them if they already exist
38
AUTOMAKE_FLAGS="--add-missing --copy --force --foreign"
14
# --copy tells it to make copies and not symlinks
15
AUTOMAKE_FLAGS="--add-missing --copy --force"
16
# AUTOCONF=${AUTOCONF:-autoconf}
45
23
echo "$ARGV0: running \`$@' $ARGS"
49
# Try to locate a program by using which, and verify that the file is an
54
file=`which $f 2>/dev/null | grep -v '^no '`
55
if test -n "$file" -a -x "$file"; then
66
if test -f config/pre_hook.sh
27
## jump out if one of the programs returns 'false'
30
if test -d ".bzr" ; then
31
bzr log --short > ChangeLog || touch ChangeLog
71
# Try to detect the supported binaries if the user didn't
72
# override that by pushing the environment variable
73
36
if test x$LIBTOOLIZE = x; then
74
LIBTOOLIZE=`locate_binary glibtoolize libtoolize-1.5 libtoolize`
75
if test x$LIBTOOLIZE = x; then
76
die "Did not find a supported libtoolize"
37
if test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
38
LIBTOOLIZE=glibtoolize
39
elif test \! "x`which libtoolize-1.5 2> /dev/null | grep -v '^no'`" = x; then
40
LIBTOOLIZE=libtoolize-1.5
41
elif test \! "x`which libtoolize 2> /dev/null | grep -v '^no'`" = x; then
43
elif test \! "x`which glibtoolize 2> /dev/null | grep -v '^no'`" = x; then
44
LIBTOOLIZE=glibtoolize
46
echo "libtoolize 1.5.x wasn't found, exiting"; exit 1
80
50
if test x$ACLOCAL = x; then
81
ACLOCAL=`locate_binary aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal19 aclocal`
82
if test x$ACLOCAL = x; then
83
die "Did not find a supported aclocal"
51
if test \! "x`which aclocal-1.10 2> /dev/null | grep -v '^no'`" = x; then
53
elif test \! "x`which aclocal110 2> /dev/null | grep -v '^no'`" = x; then
55
elif test \! "x`which aclocal 2> /dev/null | grep -v '^no'`" = x; then
58
echo "automake 1.10.x (aclocal) wasn't found, exiting"; exit 1
87
62
if test x$AUTOMAKE = x; then
88
AUTOMAKE=`locate_binary automake-1.11 automake-1.10 automake-1.9 automake19 automake`
89
if test x$AUTOMAKE = x; then
90
die "Did not find a supported automake"
63
if test \! "x`which automake-1.10 2> /dev/null | grep -v '^no'`" = x; then
64
AUTOMAKE=automake-1.10
65
elif test \! "x`which automake110 2> /dev/null | grep -v '^no'`" = x; then
67
elif test \! "x`which automake 2> /dev/null | grep -v '^no'`" = x; then
70
echo "automake 1.10.x wasn't found, exiting"; exit 1
75
## macosx has autoconf-2.59 and autoconf-2.60
94
76
if test x$AUTOCONF = x; then
95
AUTOCONF=`locate_binary autoconf-2.59 autoconf259 autoconf`
96
if test x$AUTOCONF = x; then
97
die "Did not find a supported autoconf"
77
if test \! "x`which autoconf-2.59 2> /dev/null | grep -v '^no'`" = x; then
78
AUTOCONF=autoconf-2.59
79
elif test \! "x`which autoconf259 2> /dev/null | grep -v '^no'`" = x; then
81
elif test \! "x`which autoconf 2> /dev/null | grep -v '^no'`" = x; then
84
echo "autoconf 2.59+ wasn't found, exiting"; exit 1
101
88
if test x$AUTOHEADER = x; then
102
AUTOHEADER=`locate_binary autoheader-2.59 autoheader259 autoheader`
103
if test x$AUTOHEADER = x; then
104
die "Did not find a supported autoheader"
89
if test \! "x`which autoheader-2.59 2> /dev/null | grep -v '^no'`" = x; then
90
AUTOHEADER=autoheader-2.59
91
elif test \! "x`which autoheader259 2> /dev/null | grep -v '^no'`" = x; then
92
AUTOHEADER=autoheader259
93
elif test \! "x`which autoheader 2> /dev/null | grep -v '^no'`" = x; then
96
echo "autoconf 2.59+ (autoheader) wasn't found, exiting"; exit 1
101
# --force means overwrite ltmain.sh script if it already exists
108
102
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
109
104
run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
110
105
run $AUTOHEADER || die "Can't execute autoheader"
111
106
run $AUTOMAKE $AUTOMAKE_FLAGS || die "Can't execute automake"
112
107
run $AUTOCONF || die "Can't execute autoconf"
114
if test -f config/post_hook.sh
116
. config/post_hook.sh
120
echo "Configured with the following tools:"
121
echo " * `$LIBTOOLIZE --version | head -1`"
122
echo " * `$ACLOCAL --version | head -1`"
123
echo " * `$AUTOHEADER --version | head -1`"
124
echo " * `$AUTOMAKE --version | head -1`"
125
echo " * `$AUTOCONF --version | head -1`"
108
echo -n "Automade with: "
109
$AUTOMAKE --version | head -1
110
echo -n "Configured with: "
111
$AUTOCONF --version | head -1