source: zzuf/trunk/bootstrap @ 2531

Last change on this file since 2531 was 1617, checked in by Sam Hocevar, 13 years ago
  • Updated bootstrap script.
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#! /bin/sh
2
3# bootstrap: the ultimate bootstrap/autogen.sh script for autotools projects
4# Copyright (c) 2002, 2003, 2004, 2005, 2006 Sam Hocevar <sam@zoy.org>
5#
6#    This program is free software. It comes without any warranty, to
7#    the extent permitted by applicable law. You can redistribute it
8#    and/or modify it under the terms of the Do What The Fuck You Want
9#    To Public License, Version 2, as published by Sam Hocevar. See
10#    http://sam.zoy.org/wtfpl/COPYING for more details.
11#
12# The latest version of this script can be found at the following place:
13#   http://sam.zoy.org/autotools/
14
15# Die if an error occurs
16set -e
17
18# Guess whether we are using configure.ac or configure.in
19if test -f configure.ac; then
20  conffile="configure.ac"
21elif test -f configure.in; then
22  conffile="configure.in"
23else
24  echo "$0: could not find configure.ac or configure.in"
25  exit 1
26fi
27
28# Check for needed features
29auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *( *\([^ )]*\).*/\1/p' $conffile`"
30libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`"
31header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`"
32aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`"
33
34# Check for automake
35amvers="no"
36for v in "-1.10" "110" "-1.9" "19" "-1.8" "18" "-1.7" "17" "-1.6" "16" "-1.5" "15"; do
37  if automake${v} --version >/dev/null 2>&1; then
38    amvers="${v}"
39    break
40  fi
41done
42
43if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
44  amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
45  if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
46    amvers="no"
47  else
48    amvers=""
49  fi
50fi
51
52if test "$amvers" = "no"; then
53  echo "$0: you need automake version 1.5 or later"
54  exit 1
55fi
56
57# Check for autoconf
58acvers="no"
59for v in "" "259" "253"; do
60  if autoconf${v} --version >/dev/null 2>&1; then
61    acvers="${v}"
62    break
63  fi
64done
65
66if test "$acvers" = "no"; then
67  echo "$0: you need autoconf"
68  exit 1
69fi
70
71# Check for libtool
72if test "$libtool" = "yes"; then
73  libtoolize="no"
74  if glibtoolize --version >/dev/null 2>&1; then
75    libtoolize="glibtoolize"
76  else
77    for v in "16" "15" "" "14"; do
78      if libtoolize${v} --version >/dev/null 2>&1; then
79        libtoolize="libtoolize${v}"
80        break
81      fi
82    done
83  fi
84
85  if test "$libtoolize" = "no"; then
86    echo "$0: you need libtool"
87    exit 1
88  fi
89fi
90
91# Remove old cruft
92for 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
93rm -Rf autom4te.cache
94if test -n "$auxdir"; then
95  if test ! -d "$auxdir"; then
96    mkdir "$auxdir"
97  fi
98  aclocalflags="${aclocalflags} -I $auxdir -I ."
99fi
100
101# Explain what we are doing from now
102set -x
103
104# Bootstrap package
105if test "$libtool" = "yes"; then
106  ${libtoolize} --copy --force
107  if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
108    echo "$0: working around a minor libtool issue"
109    mv ltmain.sh "$auxdir/"
110  fi
111fi
112
113aclocal${amvers} ${aclocalflags}
114autoconf${acvers}
115if test "$header" = "yes"; then
116  autoheader${acvers}
117fi
118#add --include-deps if you want to bootstrap with any other compiler than gcc
119#automake${amvers} --add-missing --copy --include-deps
120automake${amvers} --foreign --add-missing --copy
121
122# Remove cruft that we no longer want
123rm -Rf autom4te.cache
124
Note: See TracBrowser for help on using the repository browser.