source: neercs/trunk/bootstrap @ 4882

Last change on this file since 4882 was 4882, checked in by Sam Hocevar, 5 years ago

build: update bootstrap script and configure.ac.

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