| [8] | 1 | #! /bin/sh | 
|---|
| [44] | 2 | # $Id: bootstrap 2005 2008-07-16 20:51:50Z sam $ | 
|---|
| [8] | 3 |  | 
|---|
|  | 4 | # bootstrap: generic bootstrap/autogen.sh script for autotools projects | 
|---|
|  | 5 | # | 
|---|
|  | 6 | # Copyright (c) 2002-2008 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 | 
|---|
|  | 18 | set -e | 
|---|
|  | 19 |  | 
|---|
|  | 20 | # Guess whether we are using configure.ac or configure.in | 
|---|
|  | 21 | if test -f configure.ac; then | 
|---|
|  | 22 | conffile="configure.ac" | 
|---|
|  | 23 | elif test -f configure.in; then | 
|---|
|  | 24 | conffile="configure.in" | 
|---|
|  | 25 | else | 
|---|
|  | 26 | echo "$0: could not find configure.ac or configure.in" | 
|---|
|  | 27 | exit 1 | 
|---|
|  | 28 | fi | 
|---|
|  | 29 |  | 
|---|
|  | 30 | # Check for needed features | 
|---|
|  | 31 | auxdir="`sed -ne 's/^[ \t]*A._CONFIG_AUX_DIR *([[ ]*\([^] )]*\).*/\1/p' $conffile`" | 
|---|
| [44] | 32 | libtool="`grep '^[ \t]*A._PROG_LIBTOOL' $conffile >/dev/null 2>&1 && echo yes || echo no`" | 
|---|
|  | 33 | header="`grep '^[ \t]*A._CONFIG_HEADER' $conffile >/dev/null 2>&1 && echo yes || echo no`" | 
|---|
| [8] | 34 | makefile="`[ -f Makefile.am ] && echo yes || echo no`" | 
|---|
|  | 35 | aclocalflags="`sed -ne 's/^[ \t]*ACLOCAL_AMFLAGS[ \t]*=//p' Makefile.am 2>/dev/null || :`" | 
|---|
|  | 36 |  | 
|---|
|  | 37 | # Check for automake | 
|---|
|  | 38 | amvers="no" | 
|---|
|  | 39 | for v in 11 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 | 
|---|
|  | 47 | done | 
|---|
|  | 48 |  | 
|---|
|  | 49 | if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then | 
|---|
|  | 50 | amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`" | 
|---|
| [53] | 51 | amvers="`echo $amvers | sed -e ':p' -e 's/^\([0-9][0-9]*\.\)\{1\}[0-9][0-9]*$/&.0/' -e 't p'`" | 
|---|
|  | 52 | amvers="$((`echo $amvers | sed -e ':a' -e 's/^\(.*\)\([0-9][0-9]*\)\./(\1\2)*100+/' -e 'ta'`))" | 
|---|
|  | 53 | if expr "$amvers" -lt 10500 > /dev/null 2>&1; then | 
|---|
| [8] | 54 | amvers="no" | 
|---|
|  | 55 | else | 
|---|
|  | 56 | amvers="" | 
|---|
|  | 57 | fi | 
|---|
|  | 58 | fi | 
|---|
|  | 59 |  | 
|---|
|  | 60 | if test "$amvers" = "no"; then | 
|---|
|  | 61 | echo "$0: you need automake version 1.5 or later" | 
|---|
|  | 62 | exit 1 | 
|---|
|  | 63 | fi | 
|---|
|  | 64 |  | 
|---|
|  | 65 | # Check for autoconf | 
|---|
|  | 66 | acvers="no" | 
|---|
|  | 67 | for v in "" "259" "253"; do | 
|---|
|  | 68 | if autoconf${v} --version >/dev/null 2>&1; then | 
|---|
|  | 69 | acvers="${v}" | 
|---|
|  | 70 | break | 
|---|
|  | 71 | fi | 
|---|
|  | 72 | done | 
|---|
|  | 73 |  | 
|---|
|  | 74 | if test "$acvers" = "no"; then | 
|---|
|  | 75 | echo "$0: you need autoconf" | 
|---|
|  | 76 | exit 1 | 
|---|
|  | 77 | fi | 
|---|
|  | 78 |  | 
|---|
|  | 79 | # Check for libtool | 
|---|
|  | 80 | if test "$libtool" = "yes"; then | 
|---|
|  | 81 | libtoolize="no" | 
|---|
|  | 82 | if glibtoolize --version >/dev/null 2>&1; then | 
|---|
|  | 83 | libtoolize="glibtoolize" | 
|---|
|  | 84 | else | 
|---|
|  | 85 | for v in "16" "15" "" "14"; do | 
|---|
|  | 86 | if libtoolize${v} --version >/dev/null 2>&1; then | 
|---|
|  | 87 | libtoolize="libtoolize${v}" | 
|---|
|  | 88 | break | 
|---|
|  | 89 | fi | 
|---|
|  | 90 | done | 
|---|
|  | 91 | fi | 
|---|
|  | 92 |  | 
|---|
|  | 93 | if test "$libtoolize" = "no"; then | 
|---|
|  | 94 | echo "$0: you need libtool" | 
|---|
|  | 95 | exit 1 | 
|---|
|  | 96 | fi | 
|---|
|  | 97 | fi | 
|---|
|  | 98 |  | 
|---|
|  | 99 | # Remove old cruft | 
|---|
|  | 100 | for 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 | 
|---|
|  | 101 | rm -Rf autom4te.cache | 
|---|
|  | 102 | if test -n "$auxdir"; then | 
|---|
|  | 103 | if test ! -d "$auxdir"; then | 
|---|
|  | 104 | mkdir "$auxdir" | 
|---|
|  | 105 | fi | 
|---|
|  | 106 | aclocalflags="${aclocalflags} -I $auxdir -I ." | 
|---|
|  | 107 | fi | 
|---|
|  | 108 |  | 
|---|
|  | 109 | # Explain what we are doing from now | 
|---|
|  | 110 | set -x | 
|---|
|  | 111 |  | 
|---|
|  | 112 | # Bootstrap package | 
|---|
|  | 113 | if test "$libtool" = "yes"; then | 
|---|
|  | 114 | ${libtoolize} --copy --force | 
|---|
|  | 115 | if test -n "$auxdir" -a ! "$auxdir" = "." -a -f "ltmain.sh"; then | 
|---|
|  | 116 | echo "$0: working around a minor libtool issue" | 
|---|
|  | 117 | mv ltmain.sh "$auxdir/" | 
|---|
|  | 118 | fi | 
|---|
|  | 119 | fi | 
|---|
|  | 120 |  | 
|---|
|  | 121 | aclocal${amvers} ${aclocalflags} | 
|---|
|  | 122 | autoconf${acvers} | 
|---|
|  | 123 | if test "$header" = "yes"; then | 
|---|
|  | 124 | autoheader${acvers} | 
|---|
|  | 125 | fi | 
|---|
|  | 126 | if test "$makefile" = "yes"; then | 
|---|
|  | 127 | #add --include-deps if you want to bootstrap with any other compiler than gcc | 
|---|
|  | 128 | #automake${amvers} --add-missing --copy --include-deps | 
|---|
|  | 129 | automake${amvers} --foreign --add-missing --copy | 
|---|
|  | 130 | fi | 
|---|
|  | 131 |  | 
|---|
|  | 132 | # Remove cruft that we no longer want | 
|---|
|  | 133 | rm -Rf autom4te.cache | 
|---|
|  | 134 |  | 
|---|