source: trunk/bootstrap @ 2071

Last change on this file since 2071 was 1982, checked in by sam, 11 years ago

build: put the OpenGL detection code in a separate .m4 file and assume
that the OpenGL framework on OS X provides GL version 2 at least.

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