source: trunk/bootstrap @ 2882

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

build: various compilation fixes.

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