3 # bootstrap: the ultimate bootstrap/autogen.sh script for autotools projects
4 # Copyright (c) 2002, 2003, 2004, 2005, 2006 Sam Hocevar <sam@zoy.org>
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the Do What The Fuck You Want To
8 # Public License, Version 2, as published by Sam Hocevar. See
9 # http://sam.zoy.org/wtfpl/COPYING for more details.
11 # The latest version of this script can be found at the following place:
12 # http://sam.zoy.org/autotools/
14 # Die if an error occurs
17 # Guess whether we are using configure.ac or configure.in
18 if test -f configure.ac
; then
19 conffile
="configure.ac"
20 elif test -f configure.
in; then
21 conffile
="configure.in"
23 echo "$0: could not find configure.ac or configure.in"
27 # Check for needed features
28 auxdir
="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *( *\([^ )]*\).*/\1/p' $conffile`"
29 libtool
="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`"
30 header
="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`"
31 aclocalflags
="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`"
35 for v
in "-1.9" "19" "-1.8" "18" "-1.7" "17" "-1.6" "16" "-1.5" "15"; do
36 if automake
${v} --version >/dev
/null
2>&1; then
42 if test "${amvers}" = "no" && automake
--version > /dev
/null
2>&1; then
43 amvers
="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
44 if expr "$amvers" "<" "1.5" > /dev
/null
2>&1; then
51 if test "$amvers" = "no"; then
52 echo "$0: you need automake version 1.5 or later"
58 for v
in "" "259" "253"; do
59 if autoconf
${v} --version >/dev
/null
2>&1; then
65 if test "$acvers" = "no"; then
66 echo "$0: you need autoconf"
71 if test "$libtool" = "yes"; then
73 if glibtoolize
--version >/dev
/null
2>&1; then
74 libtoolize
="glibtoolize"
76 for v
in "16" "15" "" "14"; do
77 if libtoolize
${v} --version >/dev
/null
2>&1; then
78 libtoolize
="libtoolize${v}"
84 if test "$libtoolize" = "no"; then
85 echo "$0: you need libtool"
91 for x
in aclocal.
m4 configure config.guess config.log config.sub config.cache config.h.
in config.h compile libtool.
m4 ltoptions.
m4 ltsugar.
m4 ltversion.
m4 ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
; do rm -f $x autotools
/$x; if test -n "$auxdir"; then rm -f "$auxdir/$x"; fi; done
93 if test -n "$auxdir"; then
94 if test ! -d "$auxdir"; then
97 aclocalflags
="${aclocalflags} -I $auxdir"
100 # Explain what we are doing from now
104 if test "$libtool" = "yes"; then
105 ${libtoolize} --copy --force
106 if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
107 echo "$0: working around a minor libtool issue"
108 mv ltmain.sh
"$auxdir/"
112 aclocal
${amvers} ${aclocalflags}
114 if test "$header" = "yes"; then
117 #add --include-deps if you want to bootstrap with any other compiler than gcc
118 #automake${amvers} --add-missing --copy --include-deps
119 automake
${amvers} --foreign --add-missing --copy
121 # Remove cruft that we no longer want
122 rm -Rf autom4te.cache