source: trunk/bootstrap @ 3510

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

build: include common.am in Makefile.am stubs we create.

  • Property svn:executable set to *
File size: 4.7 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        echo 'include $(top_srcdir)/build/autotools/common.am' >> "${required}"
39    fi
40done
41
42# Guess whether we are using configure.ac or configure.in
43if test -f configure.ac; then
44  conffile="configure.ac"
45elif test -f configure.in; then
46  conffile="configure.in"
47else
48  echo "$0: could not find configure.ac or configure.in"
49  exit 1
50fi
51
52# Check for needed features
53auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`"
54pkgconfig="`grep '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile >/dev/null 2>&1 && echo yes || echo no`"
55libtool="`grep '^[ \t]*A._PROG_LIBTOOL' $conffile >/dev/null 2>&1 && echo yes || echo no`"
56header="`grep '^[ \t]*A._CONFIG_HEADER' $conffile >/dev/null 2>&1 && echo yes || echo no`"
57makefile="`[ -f Makefile.am ] && echo yes || echo no`"
58aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am 2>/dev/null || :`"
59
60# Check for automake
61amvers="no"
62v=20; vend=5
63while [ "$v" -gt "$vend" ]; do
64  if automake-1.${v} --version >/dev/null 2>&1; then
65    amvers="-1.${v}"
66    break
67  elif automake1.${v} --version >/dev/null 2>&1; then
68    amvers="1.${v}"
69    break
70  fi
71  v="`expr "$v" - 1`"
72done
73
74if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
75  amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
76  if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
77    amvers="no"
78  else
79    amvers=""
80  fi
81fi
82
83if test "$amvers" = "no"; then
84  echo "$0: you need automake version 1.5 or later"
85  exit 1
86fi
87
88# Check for autoconf
89acvers="no"
90for v in "" "259" "253"; do
91  if autoconf${v} --version >/dev/null 2>&1; then
92    acvers="${v}"
93    break
94  fi
95done
96
97if test "$acvers" = "no"; then
98  echo "$0: you need autoconf"
99  exit 1
100fi
101
102# Check for libtool
103if test "$libtool" = "yes"; then
104  libtoolize="no"
105  if glibtoolize --version >/dev/null 2>&1; then
106    libtoolize="glibtoolize"
107  else
108    for v in "16" "15" "" "14"; do
109      if libtoolize${v} --version >/dev/null 2>&1; then
110        libtoolize="libtoolize${v}"
111        break
112      fi
113    done
114  fi
115
116  if test "$libtoolize" = "no"; then
117    echo "$0: you need libtool"
118    exit 1
119  fi
120fi
121
122# Check for pkg-config
123if test "$pkgconfig" = "yes"; then
124  if ! pkg-config --version >/dev/null 2>&1; then
125    echo "$0: you need pkg-config"
126    exit 1
127  fi
128fi
129
130# Remove old cruft
131for 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
132rm -Rf autom4te.cache
133if test -n "$auxdir"; then
134  if test ! -d "$auxdir"; then
135    mkdir "$auxdir"
136  fi
137  aclocalflags="-I $auxdir -I . ${aclocalflags}"
138fi
139
140# Honour M4PATH because sometimes M4 doesn't
141save_IFS=$IFS
142IFS=:
143tmp="$M4PATH"
144for x in $tmp; do
145  if test -n "$x"; then
146    aclocalflags="-I $x ${aclocalflags}"
147  fi
148done
149IFS=$save_IFS
150
151# Explain what we are doing from now
152set -x
153
154# Bootstrap package
155if test "$libtool" = "yes"; then
156  ${libtoolize} --copy --force
157  if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
158    echo "$0: working around a minor libtool issue"
159    mv ltmain.sh "$auxdir/"
160  fi
161fi
162
163aclocal${amvers} ${aclocalflags}
164autoconf${acvers}
165if test "$header" = "yes"; then
166  autoheader${acvers}
167fi
168if test "$makefile" = "yes"; then
169  #add --include-deps if you want to bootstrap with any other compiler than gcc
170  #automake${amvers} --add-missing --copy --include-deps
171  automake${amvers} --foreign --add-missing --copy
172fi
173
174# Remove cruft that we no longer want
175rm -Rf autom4te.cache
176
Note: See TracBrowser for help on using the repository browser.