source: toilet/trunk/bootstrap @ 4067

Last change on this file since 4067 was 4067, checked in by sam, 5 years ago

Update bootstrap script.

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