source: neercs/trunk/bootstrap @ 3499

Last change on this file since 3499 was 1832, checked in by Sam Hocevar, 13 years ago
  • New version of the 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-2007 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 n in 10 9 8 7 6 5; do
37  for v in "-1.${n}" "1${n}"; do
38    if automake${v} --version >/dev/null 2>&1; then
39      amvers="${v}"
40      break
41    fi
42  done
43done
44
45if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
46  amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
47  if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
48    amvers="no"
49  else
50    amvers=""
51  fi
52fi
53
54if test "$amvers" = "no"; then
55  echo "$0: you need automake version 1.5 or later"
56  exit 1
57fi
58
59# Check for autoconf
60acvers="no"
61for v in "" "259" "253"; do
62  if autoconf${v} --version >/dev/null 2>&1; then
63    acvers="${v}"
64    break
65  fi
66done
67
68if test "$acvers" = "no"; then
69  echo "$0: you need autoconf"
70  exit 1
71fi
72
73# Check for libtool
74if test "$libtool" = "yes"; then
75  libtoolize="no"
76  if glibtoolize --version >/dev/null 2>&1; then
77    libtoolize="glibtoolize"
78  else
79    for v in "16" "15" "" "14"; do
80      if libtoolize${v} --version >/dev/null 2>&1; then
81        libtoolize="libtoolize${v}"
82        break
83      fi
84    done
85  fi
86
87  if test "$libtoolize" = "no"; then
88    echo "$0: you need libtool"
89    exit 1
90  fi
91fi
92
93# Remove old cruft
94for 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
95rm -Rf autom4te.cache
96if test -n "$auxdir"; then
97  if test ! -d "$auxdir"; then
98    mkdir "$auxdir"
99  fi
100  aclocalflags="${aclocalflags} -I $auxdir -I ."
101fi
102
103# Explain what we are doing from now
104set -x
105
106# Bootstrap package
107if test "$libtool" = "yes"; then
108  ${libtoolize} --copy --force
109  if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
110    echo "$0: working around a minor libtool issue"
111    mv ltmain.sh "$auxdir/"
112  fi
113fi
114
115aclocal${amvers} ${aclocalflags}
116autoconf${acvers}
117if test "$header" = "yes"; then
118  autoheader${acvers}
119fi
120#add --include-deps if you want to bootstrap with any other compiler than gcc
121#automake${amvers} --add-missing --copy --include-deps
122automake${amvers} --foreign --add-missing --copy
123
124# Remove cruft that we no longer want
125rm -Rf autom4te.cache
126
Note: See TracBrowser for help on using the repository browser.