-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautogen.sh
executable file
·131 lines (115 loc) · 3.74 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
#!/bin/sh
#
# Autotools bootstrap script for top source directory
#
# Copyright (C) 2015 Stephan Linz <linz@li-pro.net>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
# usage:
#
# banner <target name>
#
banner() {
echo
TG=`echo "autogen.sh: $1" | sed -e "s,/.*/,,g"`
LINE=`echo $TG |sed -e "s/./-/g"`
echo $LINE
echo $TG
echo $LINE
echo
}
set -e
chmod +x $0
chmod +x ./acx/get-version
[ ! -f .gitmodules ] || {
banner "updating git submodules"
git submodule init
git submodule update
}
case "$(uname)" in
Darwin)
LIBTOOLIZE=${LIBTOOLIZE:-glibtoolize}
;;
*)
LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
;;
esac
AUTORECONF=${AUTORECONF:-autoreconf}
ACLOCAL=${ACLOCAL:-aclocal}
AUTOCONF=${AUTOCONF:-autoconf}
AUTOHEADER=${AUTOHEADER:-autoheader}
AUTOMAKE=${AUTOMAKE:-automake}
AUTOPOINT=${AUTOPOINT:-autopoint}
AUTOM4TE=${AUTOM4TE:-autom4te}
MAKE=${MAKE:-make}
M4=${M4:-m4}
# Check we have all tools installed
check_command() {
command -v "${1}" > /dev/null 2>&1 || {
>&2 banner "could not find \`$1'. \`$1' is required to run autogen.sh."
exit 1
}
}
check_command "$LIBTOOLIZE"
check_command "$AUTORECONF"
check_command "$ACLOCAL"
check_command "$AUTOCONF"
check_command "$AUTOHEADER"
check_command "$AUTOMAKE"
# Absence of pkg-config or misconfiguration can make some odd error
# messages, we check if it is installed correctly. See:
# https://blogs.oracle.com/mandy/entry/autoconf_weirdness
#
# We cannot just check for pkg-config command, we need to check for
# PKG_* macros. The pkg-config command can be defined in ./configure,
# we cannot tell anything when not present.
check_pkg_config() {
grep -q '^AC_DEFUN.*PKG_CHECK_MODULES' aclocal.m4 || {
cat <<EOF >&2
autogen.sh: could not find PKG_CHECK_MODULES macro.
Either pkg-config is not installed on your system or
\`pkg.m4' is missing or not found by aclocal.
If \`pkg.m4' is installed at an unusual location, re-run
\`autogen.sh' by setting \`ACLOCAL_FLAGS':
ACLOCAL_FLAGS="-I <prefix>/share/aclocal" ./autogen.sh
EOF
exit 1
}
}
banner "start libtoolize to get ltmain.sh"
${LIBTOOLIZE} --copy --install --force
banner "start aclocal to get all m4 macros locally in m4/"
${ACLOCAL} -I m4 --install --force --warnings=all ${ACLOCAL_FLAGS}
banner "reconfigure with autoreconf"
${AUTORECONF} -I m4 --install --force --warnings=all || {
banner "autoreconf has failed ($?), let's do it manually"
for dir in $PWD *; do
[ -d "$dir" ] || continue
[ -f "$dir"/configure.ac ] || [ -f "$dir"/configure.in ] || continue
banner "configure `basename $dir`"
(cd "$dir" && ${ACLOCAL} -I m4 --install --force --warnings=all ${ACLOCAL_FLAGS})
(cd "$dir" && check_pkg_config)
(cd "$dir" && ${LIBTOOLIZE} --automake --copy --install --force)
(cd "$dir" && ${ACLOCAL} -I m4 --install --force --warnings=all ${ACLOCAL_FLAGS})
(cd "$dir" && ${AUTOCONF} --force --warnings=all)
(cd "$dir" && ${AUTOHEADER} --force --warnings=all)
(cd "$dir" && ${AUTOMAKE} --add-missing --copy --force-missing)
done
}
banner "finished - for the next step, run ./configure"
exit 0