source: trunk/bootstrap @ 2879

Last change on this file since 2879 was 2850, checked in by sam, 6 years ago

build: make the bootstrap script create all missing files.

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