Changeset 523


Ignore:
Timestamp:
Mar 4, 2006, 7:08:47 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • New updated bootstrap script.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/bootstrap

    r475 r523  
    11#! /bin/sh
    22
    3 ##  bootstrap file for libcaca -- Sam Hocevar <sam@zoy.org>
    4 ##  $Id$
     3# bootstrap: the ultimate bootstrap/autogen.sh script for autotools projects
     4# Copyright (c) 2002, 2003, 2004, 2005, 2006 Sam Hocevar <sam@zoy.org>
     5#
     6#    This program is free software; you can redistribute it and/or
     7#    modify it under the terms of the Do What The Fuck You Want To
     8#    Public License, Version 2, as published by Sam Hocevar. See
     9#    http://sam.zoy.org/wtfpl/COPYING for more details.
     10#
     11# The latest version of this script can be found at the following place:
     12#   http://sam.zoy.org/autotools/
    513
    6 set -x
     14# Die if an error occurs
    715set -e
    816
    9 # Get a sane environment, just in case
    10 LANG=C
    11 export LANG
    12 CYGWIN=binmode
    13 export CYGWIN
     17# Guess whether we are using configure.ac or configure.in
     18if test -f configure.ac; then
     19  conffile="configure.ac"
     20elif test -f configure.in; then
     21  conffile="configure.in"
     22else
     23  echo "$0: could not find configure.ac or configure.in"
     24  exit 1
     25fi
     26
     27# Check for needed features
     28auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *( *\([^ )]*\).*/\1/p' $conffile`"
     29libtool="`grep -q '^[ \t]*A._PROG_LIBTOOL' $conffile && echo yes || echo no`"
     30header="`grep -q '^[ \t]*A._CONFIG_HEADER' $conffile && echo yes || echo no`"
    1431
    1532# Check for automake
    1633amvers="no"
    17 if automake-1.8 --version >/dev/null 2>&1; then
    18   amvers="-1.8"
    19 elif automake-1.7 --version >/dev/null 2>&1; then
    20   amvers="-1.7"
    21 elif automake-1.6 --version >/dev/null 2>&1; then
    22   amvers="-1.6"
    23 elif automake-1.5 --version >/dev/null 2>&1; then
    24   amvers="-1.5"
    25 elif automake --version > /dev/null 2>&1; then
     34for v in "-1.9" "19" "-1.8" "18" "-1.7" "17" "-1.6" "16" "-1.5" "15"; do
     35  if automake${v} --version >/dev/null 2>&1; then
     36    amvers="${v}"
     37    break
     38  fi
     39done
     40
     41if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
    2642  amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
    2743  if expr "$amvers" "<" "1.5" > /dev/null 2>&1; then
     
    3349
    3450if test "$amvers" = "no"; then
    35   set +x
    3651  echo "$0: you need automake version 1.5 or later"
    3752  exit 1
    3853fi
    3954
    40 libtoolize="no"
    41 if glibtoolize --version >/dev/null 2>&1; then
    42   libtoolize="glibtoolize"
    43 elif libtoolize --version >/dev/null 2>&1; then
    44   libtoolize="libtoolize"
    45 fi
     55# Check for autoconf
     56acvers="no"
     57for v in "" "259" "253"; do
     58  if autoconf${v} --version >/dev/null 2>&1; then
     59    acvers="${v}"
     60    break
     61  fi
     62done
    4663
    47 if test "$libtoolize" = "no"; then
    48   set +x
    49   echo "$0: you need libtool"
     64if test "$acvers" = "no"; then
     65  echo "$0: you need autoconf"
    5066  exit 1
    5167fi
    5268
    53 # Remove old cruft
    54 rm -f aclocal.m4 configure config.guess config.log config.sub config.cache config.h.in config.h compile ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh INSTALL
    55 rm -Rf autom4te.cache
    56 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile ltmain.sh depcomp install-sh)
     69# Check for libtool
     70if test "$libtool" = "yes"; then
     71  libtoolize="no"
     72  if glibtoolize --version >/dev/null 2>&1; then
     73    libtoolize="glibtoolize"
     74  else
     75    for v in "16" "15" "" "14"; do
     76      if libtoolize${v} --version >/dev/null 2>&1; then
     77        libtoolize="libtoolize${v}"
     78        break
     79      fi
     80    done
     81  fi
    5782
    58 ${libtoolize} --copy --force
    59 if test -f "ltmain.sh"; then
    60   echo "$0: working around a minor libtool issue"
    61   mv ltmain.sh autotools/
     83  if test "$libtoolize" = "no"; then
     84    echo "$0: you need libtool"
     85    exit 1
     86  fi
    6287fi
    6388
    64 aclocal${amvers}
    65 autoconf
    66 autoheader
    67 automake${amvers} --add-missing --copy
     89# Remove old cruft
     90for 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
     91rm -Rf autom4te.cache
     92if test -n "$auxdir" -a ! -d "$auxdir"; then mkdir "$auxdir"; fi
    6893
     94# Explain what we are doing from now
     95set -x
     96
     97# Bootstrap package
     98if test "$libtool" = "yes"; then
     99  ${libtoolize} --copy --force
     100  if test -n "$auxdir" -a -f "ltmain.sh"; then
     101    echo "$0: working around a minor libtool issue"
     102    mv ltmain.sh "$auxdir/"
     103  fi
     104fi
     105
     106if test -n "$auxdir"; then
     107  aclocal${amvers} -I autotools
     108else
     109  aclocal${amvers}
     110fi
     111autoconf${acvers}
     112if test "$header" = "yes"; then
     113  autoheader${acvers}
     114fi
     115#add --include-deps if you want to bootstrap with any other compiler than gcc
     116#automake${amvers} --add-missing --copy --include-deps
     117automake${amvers} --foreign --add-missing --copy
     118
     119# Remove cruft that we no longer want
     120rm -Rf autom4te.cache
     121
Note: See TracChangeset for help on using the changeset viewer.