source: libcaca/trunk/bootstrap @ 3505

Last change on this file since 3505 was 2176, checked in by Sam Hocevar, 12 years ago
  • Check for pkg-config before bootstrapping, because autoconf gives a totally meaningless message when it's not present.
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 3.7 KB
Line 
1#! /bin/sh
2# $Id: bootstrap 2176 2007-12-30 13:49:57Z sam $
3
4# bootstrap: generic bootstrap/autogen.sh script for autotools projects
5#
6# Copyright (c) 2002-2007 Sam Hocevar <sam@zoy.org>
7#
8#    This program is free software. It comes without any warranty, to
9#    the extent permitted by applicable law. You can redistribute it
10#    and/or modify it under the terms of the Do What The Fuck You Want
11#    To Public License, Version 2, as published by Sam Hocevar. See
12#    http://sam.zoy.org/wtfpl/COPYING for more details.
13#
14# The latest version of this script can be found at the following place:
15#   http://sam.zoy.org/autotools/
16
17# Die if an error occurs
18set -e
19
20# Guess whether we are using configure.ac or configure.in
21if test -f configure.ac; then
22  conffile="configure.ac"
23elif test -f configure.in; then
24  conffile="configure.in"
25else
26  echo "$0: could not find configure.ac or configure.in"
27  exit 1
28fi
29
30# Check for needed features
31auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`"
32libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`"
33pkgconfig="`grep -q '^[ \t]*PKG_PROG_PKG_CONFIG' $conffile && echo yes || echo no`"
34header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`"
35aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am`"
36
37# Check for automake
38amvers="no"
39for v in 10 9 8 7 6 5; do
40  if automake-1.${v} --version >/dev/null 2>&1; then
41    amvers="-1.${v}"
42    break
43  elif automake1.${v} --version >/dev/null 2>&1; then
44    amvers="1.${v}"
45    break
46  fi
47done
48
49if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
50  amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
51  if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
52    amvers="no"
53  else
54    amvers=""
55  fi
56fi
57
58if test "$amvers" = "no"; then
59  echo "$0: you need automake version 1.5 or later"
60  exit 1
61fi
62
63# Check for autoconf
64acvers="no"
65for v in "" "259" "253"; do
66  if autoconf${v} --version >/dev/null 2>&1; then
67    acvers="${v}"
68    break
69  fi
70done
71
72if test "$acvers" = "no"; then
73  echo "$0: you need autoconf"
74  exit 1
75fi
76
77# Check for libtool
78if test "$libtool" = "yes"; then
79  libtoolize="no"
80  if glibtoolize --version >/dev/null 2>&1; then
81    libtoolize="glibtoolize"
82  else
83    for v in "16" "15" "" "14"; do
84      if libtoolize${v} --version >/dev/null 2>&1; then
85        libtoolize="libtoolize${v}"
86        break
87      fi
88    done
89  fi
90
91  if test "$libtoolize" = "no"; then
92    echo "$0: you need libtool"
93    exit 1
94  fi
95fi
96
97# Check for pkg-config
98if test "$pkgconfig" = "yes"; then
99  if ! pkg-config --version >/dev/null 2>&1; then
100    echo "$0: you need pkg-config"
101    exit 1
102  fi
103fi
104
105# Remove old cruft
106for 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
107rm -Rf autom4te.cache
108if test -n "$auxdir"; then
109  if test ! -d "$auxdir"; then
110    mkdir "$auxdir"
111  fi
112  aclocalflags="${aclocalflags} -I $auxdir -I ."
113fi
114
115# Explain what we are doing from now
116set -x
117
118# Bootstrap package
119if test "$libtool" = "yes"; then
120  ${libtoolize} --copy --force
121  if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then
122    echo "$0: working around a minor libtool issue"
123    mv ltmain.sh "$auxdir/"
124  fi
125fi
126
127aclocal${amvers} ${aclocalflags}
128autoconf${acvers}
129if test "$header" = "yes"; then
130  autoheader${acvers}
131fi
132#add --include-deps if you want to bootstrap with any other compiler than gcc
133#automake${amvers} --add-missing --copy --include-deps
134automake${amvers} --foreign --add-missing --copy
135
136# Remove cruft that we no longer want
137rm -Rf autom4te.cache
138
Note: See TracBrowser for help on using the repository browser.