00boot 3.8 KB
Newer Older
Adam Mercer's avatar
Adam Mercer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/sh

# function to report failure
fail () {
  echo "!!! 00boot: $1 failed" >&2
  exit 1
}

# help message
helpmsg="Usage $0 [options]
Options: [defaults in brackets after description]"
helpmsg="$helpmsg
  --help                        print this message"
helpmsg="$helpmsg
  --with-autoreconf=AUTORECONF  use autoreconf program AUTORECONF [autoreconf]"
helpmsg="$helpmsg
  --with-aclocal=ACLOCAL        use aclocal program ACLOCAL [aclocal]"
helpmsg="$helpmsg
  --with-autoheader=AUTOHEADER  use autoheader program AUTOHEADER [autoheader]"
helpmsg="$helpmsg
  --with-automake=AUTOMAKE      use automake program AUTOMAKE [automake]"
helpmsg="$helpmsg
  --with-autoconf=AUTOCONF      use autoconf program AUTOCONF [autoconf]"

# default options
only_build_sources="false"

# process args
while test $# -gt 0 ; do
  option=$1
  case "$option" in
    -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
    *) optarg= ;;
  esac
  case $option in
    -h | -help | --help ) echo "$helpmsg"; exit 0;;
    -with-autoreconf=* | --with-autoreconf=* ) AUTORECONF="$optarg";;
    -with-aclocal=* | --with-aclocal=* ) ACLOCAL="$optarg";;
    -with-autoheader=* | --with-autoheader=* ) AUTOHEADER="$optarg";;
    -with-automake=* | --with-automake=* ) AUTOMAKE="$optarg";;
    -with-autoconf=* | --with-autoconf=* ) AUTOCONF="$optarg";;
    *) echo "unrecognized option $option"; exit 1;;
  esac
  shift
done

# check autotools versions
echo "00boot: checking versions of autotools"
AUTORECONF=${AUTORECONF:-"autoreconf"}
ACLOCAL=${ACLOCAL:-"aclocal"}
AUTOHEADER=${AUTOHEADER:-"autoheader"}
AUTOMAKE=${AUTOMAKE:-"automake"}
AUTOCONF=${AUTOCONF:-"autoconf"}
autoreconf_version="`$AUTORECONF --version 2>/dev/null | sed -n '1s/^.* \([0-9.]*\)/\1/p'`"
aclocal_version="`$ACLOCAL --version 2>/dev/null | sed -n '1s/^.* \([0-9.]*\)/\1/p'`"
autoheader_version="`$AUTOHEADER --version 2>/dev/null | sed -n '1s/^.* \([0-9.]*\)/\1/p'`"
automake_version="`$AUTOMAKE --version 2>/dev/null | sed -n '1s/^.* \([0-9.]*\)/\1/p'`"
autoconf_version="`$AUTOCONF --version 2>/dev/null | sed -n '1s/^.* \([0-9.]*\)/\1/p'`"
if test -z "$autoreconf_version"; then
  fail "finding program autoreconf"
fi
if test -z "$aclocal_version"; then
  fail "finding program aclocal"
fi
if test -z "$autoheader_version"; then
  fail "finding program autoheader"
fi
if test -z "$automake_version"; then
  fail "finding program automake"
fi
if test -z "$autoconf_version"; then
  fail "finding program autoconf"
fi

# report autotools versions
echo "00boot: using:"
printf "00boot:\t%-16s %s\n" "autoreconf-$autoreconf_version:" "`which $AUTORECONF`"
printf "00boot:\t%-16s %s\n" "aclocal-$aclocal_version:" "`which $ACLOCAL`"
printf "00boot:\t%-16s %s\n" "autoheader-$autoheader_version:" "`which $AUTOHEADER`"
printf "00boot:\t%-16s %s\n" "automake-$automake_version:" "`which $AUTOMAKE`"
printf "00boot:\t%-16s %s\n" "autoconf-$autoconf_version:" "`which $AUTOCONF`"

# FIXME: autoreconf from Ubuntu 9.10 (and probably also from recent
# Debian versions) automatically run libtoolize with the --copy option
# therefore over writing the supplied libtool scripts with system
# version. This can lead to unexpected build failures therefore to work
# round this "feature" we set the LIBTOOLIZE enviroment variable to
# point to the the true executable which bypasses the running of
# libtoolize, this will not effect the vast majority of users and those
# it will effect will know how to run libtoolize, if required.

# generate build system
echo "00boot: running autoreconf"
LIBTOOLIZE=true $AUTORECONF || fail "autoreconf"

# report success
echo "00boot: success"
echo "
=================================================================

        00boot has been run.

        Now run './configure' with appropriate options
        to configure LAL Simulation.

================================================================="