~ubuntu-branches/ubuntu/trusty/heroes/trusty

« back to all changes in this revision

Viewing changes to tools/autogen.sh

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Burrows
  • Date: 2002-03-31 20:42:30 UTC
  • Revision ID: james.westby@ubuntu.com-20020331204230-v7i07q3km2dzu0et
Tags: upstream-0.21
ImportĀ upstreamĀ versionĀ 0.21

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
# Copyright 2000, 2001  Alexandre Duret-Lutz <duret_g@epita.fr>
 
3
#
 
4
# This file is free software; you can redistribute it and/or modify it under
 
5
# the terms of the GNU General Public License as published by the Free
 
6
# Software Foundation; either version 2 of the License, or (at your
 
7
# option) any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful, but WITHOUT
 
10
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
11
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
12
# for more details.
 
13
#
 
14
# You should have received a copy of the GNU General Public License along
 
15
# with this program; if not, write to the Free Software Foundation, Inc.,
 
16
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
17
 
 
18
verb=':'
 
19
moreverb=''
 
20
 
 
21
usage ()
 
22
{
 
23
  echo "Usage: autogen.sh [-h] [-v] [-V]"
 
24
}
 
25
 
 
26
die ()
 
27
{
 
28
  echo ${1+"$@"}
 
29
  exit 1
 
30
}
 
31
 
 
32
saferun ()
 
33
{
 
34
  $verb $@
 
35
  $@ || die "*** Error '${1+\"$@\"}' exited with bad status."
 
36
}
 
37
 
 
38
generate ()
 
39
{
 
40
  test -f configure.ac || test -f configure.in ||
 
41
    die "Cannot find configure.in in current directory (`pwd`)."
 
42
 
 
43
  if test -f Makefile.am; then
 
44
    # use the same aclocal flags as in Makefile.am, if specified
 
45
    aclocalflags=`sed -n -e '/ACLOCAL_AMFLAGS/{s/.*=\(.*\)$/\1/
 
46
p
 
47
}' Makefile.am`
 
48
  fi
 
49
 
 
50
  # generate aclocal.m4
 
51
  saferun aclocal $aclocalflags ${moreverb}
 
52
 
 
53
  # generate configure
 
54
  saferun autoconf ${moreverb}
 
55
 
 
56
  if grep AC_CONFIG_HEADER configure.* >/dev/null 2>/dev/null; then
 
57
    # generate src/config.h.in
 
58
    saferun autoheader ${moreverb}
 
59
  fi
 
60
 
 
61
  # generate **/Makefile.in and add mssing files
 
62
  # Use --force-missing, or it's possible that we'll use
 
63
  # some obsolete files (for instance if the Automake location
 
64
  # changer and the symlink still point to the old).
 
65
  saferun automake --force-missing --add-missing ${moreverb}
 
66
}
 
67
 
 
68
while test $# -gt 0 ; do
 
69
  case "${1}" in
 
70
    -h | --h*)
 
71
      usage
 
72
      exit 0 ;;
 
73
    -v | --v*)
 
74
      verb='echo'
 
75
      shift ;;
 
76
    -V | --V*)
 
77
      verb='echo'
 
78
      moreverb='--verbose'
 
79
      shift ;;
 
80
    *)
 
81
      usage
 
82
      exit 1;;
 
83
  esac
 
84
done
 
85
 
 
86
targets=`find . \( -name 'configure.ac' -o -name 'configure.in' \) -print`
 
87
test -n "$targets" || die "Cannot find any configure.in or configure.ac."
 
88
set $targets
 
89
for i; do
 
90
  dir=`expr "x$i" : 'x\(.*\)/[^/]*' \| '.' : '.'`
 
91
  test $# -gt 1 && echo "=== configuring '$dir' ==="
 
92
  (cd $dir && generate)
 
93
done