This repository has been archived by the owner on Jan 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathautogen.sh
159 lines (130 loc) · 4.72 KB
/
autogen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/bin/sh
#
# $Id: bootstrap,v 1.3 2008/07/20 19:01:16 i_a Exp $
#
# bootstrap - script to bootstrap the distribution rolling engine
#
# usage:
# sh ./bootstrap && ./configure && make distcheck
#
# this yields a tarball which one can install doing
#
# $ tar zxf PACKAGENAME-*.tar.gz
# $ cd PACKAGENAME-*
# $ ./configure
# $ make
# # make install
#
# requirements:
# GNU autoconf, from e.g. ftp.gnu.org:/pub/gnu/autoconf/
# GNU automake, from e.g. ftp.cygnus.com:/pub/tromey/
# Based upon gnupg-1.2.3/scripts/autogen.sh, which is
#
# Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# modified for CRM114 by Joost van Baal
# augmented by Ger Hobbelt (2008) for CRM114
# ripped by Ger Hobbelt (2008) for uncrustify
#
PGM=uncrustify
configure_ac="./configure.ac"
cvtver()
{
awk 'NR==1 { split($NF,A,"."); X=1000000*A[1]+1000*A[2]+A[3]; print X; exit 0; }'
}
check_version()
{
if `("$1" --version) < /dev/null > /dev/null 2>&1` ; then
if [ `("$1" --version || echo "0") | cvtver` -ge "$2" ]; then
return 0
fi
echo >&2
echo '**Error**: '\'$1\'' not installed or too old.' >&2
echo ' Version '$3' or newer is required.' >&2
[ -n "$4" ] && echo ' Note that this is part of '\'$4\''.' >&2
else
echo >&2
echo '**Error**: You must have '\'$1\'' installed to compile '$PGM'.' >&2
echo ' Version '$3' or newer is required.' >&2
[ -n "$4" ] && echo ' Note that this is part of '\'$4\''.' >&2
fi
DIE="yes"
return 1
}
# Allow to override the default tool names
AUTOCONF=${AUTOCONF_PREFIX}${AUTOCONF:-autoconf}${AUTOCONF_SUFFIX}
AUTOHEADER=${AUTOCONF_PREFIX}${AUTOHEADER:-autoheader}${AUTOCONF_SUFFIX}
AUTOMAKE=${AUTOMAKE_PREFIX}${AUTOMAKE:-automake}${AUTOMAKE_SUFFIX}
ACLOCAL=${AUTOMAKE_PREFIX}${ACLOCAL:-aclocal}${AUTOMAKE_SUFFIX}
DIE=no
FORCE=
if test x"$1" = x"--force"; then
FORCE=" --force"
shift
fi
VERBOSE=
if test x"$1" = x"--verbose"; then
VERBOSE=" --verbose"
shift
fi
# Grep the required versions from configure.ac
autoconf_vers=`sed -n '/^AC_PREREQ(/ {
s/^.*(\(.*\))/\1/p
q
}' ${configure_ac}`
autoconf_vers_num=`echo "$autoconf_vers" | cvtver`
# echo "detected autoconf version: " $autoconf_vers
automake_vers=`sed -n '/^AM_INIT_AUTOMAKE(/ {
s/^.*(.*\([0-9]\+\.[0-9]\+\).*)/\1/p
q
}' ${configure_ac}`
automake_vers_num=`echo "$automake_vers" | cvtver`
# echo "detected automake version: " $automake_vers
if [ -z "$autoconf_vers" -o -z "$automake_vers" ]
then
echo "**Error**: autoconf OR automake version information not found in "\`${configure_ac}\'"." >&2
echo "**Error**: detected version for autoconf: '"${autoconf_vers}"'" >&2
echo "**Error**: detected version for automake: '"${automake_vers}"'" >&2
exit 1
fi
if check_version $AUTOCONF $autoconf_vers_num $autoconf_vers ; then
check_version $AUTOHEADER $autoconf_vers_num $autoconf_vers autoconf
fi
if check_version $AUTOMAKE $automake_vers_num $automake_vers; then
check_version $ACLOCAL $automake_vers_num $autoconf_vers automake
fi
if test "$DIE" = "yes"; then
cat <<EOF
Note that you may use alternative versions of the tools by setting
the corresponding environment variables; see README.maintainer for details.
EOF
exit 1
fi
# echo "Running autoreconf -vi ${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
# autoreconf -vi ${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }
# # problem with autoreconf: it's NOT running aclocal with a '-I m4' argument, so we're toast!
# # alternatively, explicitly call
# # aclocal && autoheader && \
# # && automake --add-missing [--verbose] \
# # && autoconf
# If your autoconf version changes, the autom4te.cache stuff will mess you up.
# Get rid of it.
echo "Removing autoheader cache files first ..."
rm -rf autom4te*.cache
echo "Running ${ACLOCAL}${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
${ACLOCAL}${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }
echo "Running ${AUTOCONF}${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
${AUTOCONF}${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }
echo "Running ${AUTOHEADER}${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }..."
${AUTOHEADER}${FORCE} -I m4 ${ACLOCAL_FLAGS:+$ACLOCAL_FLAGS }
echo "Running ${AUTOMAKE}${FORCE} --add-missing --copy..."
${AUTOMAKE}${FORCE} --add-missing --copy -Woverride -Wall
echo "You can now run \"./configure && make distcheck\"."