source: libcaca/trunk/bootstrap @ 640

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