blob: 65c4e2c5bd4f87a42ff40c34ceaa2810d760af76 [file] [log] [blame]
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00001#!/bin/sh
Linus Walleija094e132006-02-15 14:22:08 +00002#set -e
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00003
Linus Walleija094e132006-02-15 14:22:08 +00004srcdir=`dirname $0`
5
6ACLOCAL_FLAGS="-I ${srcdir}/m4 ${ACLOCAL_FLAGS}"
7
8fail() {
9 status=$?
10 echo "Last command failed with status $status in directory $(pwd)."
11 echo "Aborting"
12 exit $status
13}
14
15# Refresh GNU autotools toolchain: libtool
16echo "Removing libtool cruft"
17rm -f ltmain.sh config.guess config.sub
18echo "Running libtoolize"
Jerry Zhangc58b2462017-06-13 15:27:28 -070019(glibtoolize --version) < /dev/null > /dev/null 2>&1 && LIBTOOLIZE=glibtoolize || LIBTOOLIZE=libtoolize
20$LIBTOOLIZE --copy --force || fail
Linus Walleija094e132006-02-15 14:22:08 +000021
22# Refresh GNU autotools toolchain: aclocal autoheader
23echo "Removing aclocal cruft"
24rm -f aclocal.m4
25echo "Running aclocal $ACLOCAL_FLAGS"
26aclocal $ACLOCAL_FLAGS || fail
27echo "Removing autoheader cruft"
28rm -f config.h.in src/config.h.in
29echo "Running autoheader"
30autoheader || fail
31
32# Refresh GNU autotools toolchain: automake
33echo "Removing automake cruft"
34rm -f depcomp install-sh missing mkinstalldirs
35rm -f stamp-h*
36echo "Running automake"
Linus Walleij6f050022009-05-06 21:14:41 +000037touch config.rpath
Linus Walleija094e132006-02-15 14:22:08 +000038automake --add-missing --gnu || fail
39
40# Refresh GNU autotools toolchain: autoconf
41echo "Removing autoconf cruft"
42rm -f configure
43rm -rf autom4te*.cache/
44echo "Running autoconf"
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000045autoconf
46
47# Autoupdate config.sub and config.guess
48# from GNU CVS
49WGET=`which wget`
50if [ "x$WGET" != "x" ]; then
51 echo "Autoupdate config.sub and config.guess (y/n)?"
52 read IN
53 if [ "$IN" = "y" ] || [ "$IN" = "Y" ]; then
54 wget -O tmpfile http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
55 mv tmpfile config.guess
56 wget -O tmpfile http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
57 mv tmpfile config.sub
58 fi
59else
60 echo "Could not autoupdate config.sub and config.guess"
61fi
Linus Walleija094e132006-02-15 14:22:08 +000062
Andrés G. Aragonesesf6aa64b2015-06-20 13:16:28 +020063if [ ! -z "$NOCONFIGURE" ]; then
64 echo "autogen.sh finished! ./configure skipped."
65 exit $?
66fi
Linus Walleija094e132006-02-15 14:22:08 +000067
Andrés G. Aragonesesf6aa64b2015-06-20 13:16:28 +020068echo "autogen.sh finished! Now going to run ./configure $@"
69./configure $@ || {
70 echo "./configure failed";
71 exit 1;
72}