1 | #!/bin/sh |
---|
2 | |
---|
3 | # Copyright (C) 2006, 2007 International Business Machines. |
---|
4 | # All Rights Reserved. |
---|
5 | # This file is distributed under the Common Public License. |
---|
6 | # It is part of the BuildTools project in COIN-OR (www.coin-or.org) |
---|
7 | # |
---|
8 | ## $Id: run_autotools 1191 2008-09-17 18:22:06Z tkr $ |
---|
9 | # |
---|
10 | # Author: Andreas Waechter IBM 2006-04-14 |
---|
11 | |
---|
12 | # Make sure we bail out if there is an error |
---|
13 | set -e |
---|
14 | |
---|
15 | ver_autoconf='2.59' |
---|
16 | ver_automake='1.9.6' |
---|
17 | ver_libtool='1.5.22' |
---|
18 | EGREP='grep -E' |
---|
19 | |
---|
20 | # Check if the correct version of the autotools is used |
---|
21 | if test x$AUTOTOOLS_DIR = x; then |
---|
22 | AUTOTOOLS_DIR=$HOME |
---|
23 | fi |
---|
24 | |
---|
25 | grep_version=`echo $ver_autoconf | sed -e 's/\\./\\\\\\./g'` |
---|
26 | autoconf --version > confauto.out 2>&1 |
---|
27 | if $EGREP $grep_version confauto.out >/dev/null 2>&1; then :; else |
---|
28 | echo You are not using the correct version of autoconf |
---|
29 | rm -f confauto.out |
---|
30 | exit -2 |
---|
31 | fi |
---|
32 | rm -f confauto.out |
---|
33 | autoconf_dir=`which autoconf | sed -e 's=/autoconf=='` |
---|
34 | autoconf_dir=`cd $autoconf_dir; pwd` |
---|
35 | if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else |
---|
36 | echo autoconf is not picked up from the correct location |
---|
37 | exit -2 |
---|
38 | fi |
---|
39 | |
---|
40 | grep_version=`echo $ver_automake | sed -e 's/\\./\\\\\\./g'` |
---|
41 | automake --version > confauto.out 2>&1 |
---|
42 | if $EGREP $grep_version confauto.out >/dev/null 2>&1; then :; else |
---|
43 | echo You are not using the correct version of automake |
---|
44 | rm -f confauto.out |
---|
45 | exit -2 |
---|
46 | fi |
---|
47 | rm -f confauto.out |
---|
48 | autoconf_dir=`which automake | sed -e 's=/automake=='` |
---|
49 | autoconf_dir=`cd $autoconf_dir; pwd` |
---|
50 | if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else |
---|
51 | echo automake is not picked up from the correct location |
---|
52 | exit -2 |
---|
53 | fi |
---|
54 | |
---|
55 | grep_version=`echo $ver_libtool | sed -e 's/\\./\\\\\\./g'` |
---|
56 | ltfile=$AUTOTOOLS_DIR/share/libtool/ltmain.sh |
---|
57 | if test -r $ltfile; then :; else |
---|
58 | echo Cannot file $ltfile |
---|
59 | fi |
---|
60 | if $EGREP $grep_version $ltfile >/dev/null 2>&1; then :; else |
---|
61 | echo You are not using the correct verion of libtool |
---|
62 | fi |
---|
63 | |
---|
64 | # Find directories which contain a file configure.ac. When all is said and |
---|
65 | # done, each entry in dirs will be of the form `./path/to/directory' |
---|
66 | |
---|
67 | if test $# != 0; then |
---|
68 | dirs="$*" |
---|
69 | else |
---|
70 | pos_dirs=`find . -name configure.ac | sed -e s%/configure.ac%%g | grep -v 'ThirdParty/[^/]*/[^/]*'` |
---|
71 | dirs= |
---|
72 | for dir in $pos_dirs; do |
---|
73 | if test -r $dir/configure.ac; then |
---|
74 | dirs="$dirs $dir" |
---|
75 | else |
---|
76 | echo "$dir/configure.ac doesn't appear to be a regular file; skipping." |
---|
77 | fi |
---|
78 | done |
---|
79 | fi |
---|
80 | |
---|
81 | # Now compare against the skip entries in COIN_SKIP_PROJECTS. To match the |
---|
82 | # entries we just collected, add `./' to the front of each skip entry. |
---|
83 | |
---|
84 | pos_dirs=$dirs |
---|
85 | if test x${COIN_SKIP_PROJECTS+set} = xset ; then |
---|
86 | dirs= |
---|
87 | for dir in $COIN_SKIP_PROJECTS ; do |
---|
88 | skip_dirs="$skip_dirs ./$dir" |
---|
89 | done |
---|
90 | for dir in $pos_dirs ; do |
---|
91 | skip=0 |
---|
92 | for skipdir in $skip_dirs ; do |
---|
93 | if test $dir = $skipdir ; then |
---|
94 | skip=1 |
---|
95 | break |
---|
96 | fi |
---|
97 | done |
---|
98 | if test $skip = 0 ; then |
---|
99 | dirs="$dirs $dir" |
---|
100 | else |
---|
101 | echo "$dir listed in COIN_SKIP_PROJECTS; skipping." |
---|
102 | fi |
---|
103 | done |
---|
104 | fi |
---|
105 | |
---|
106 | echo Running autotools in $dirs |
---|
107 | |
---|
108 | currdir=`pwd` |
---|
109 | if test -r $currdir/BuildTools/coin.m4; then |
---|
110 | toolsdir=$currdir/BuildTools |
---|
111 | else |
---|
112 | echo Cannot find BuildTools directory. |
---|
113 | exit |
---|
114 | fi |
---|
115 | |
---|
116 | echo Copying autotools scripts into this directory |
---|
117 | cp $toolsdir/config.guess $toolsdir/config.sub $toolsdir/depcomp $toolsdir/install-sh $toolsdir/ltmain.sh $toolsdir/missing . |
---|
118 | |
---|
119 | if test x$AUTOTOOLS_DIR = x; then |
---|
120 | AUTOTOOLS_DIR=$HOME |
---|
121 | fi |
---|
122 | |
---|
123 | for dir in $dirs; do |
---|
124 | (if test -r $dir/configure.ac; then |
---|
125 | cd $dir |
---|
126 | echo creating acinclude.m4 in $dir |
---|
127 | cat $AUTOTOOLS_DIR/share/aclocal/libtool.m4 $toolsdir/coin.m4> acinclude.m4 |
---|
128 | echo running aclocal in $dir |
---|
129 | if test -d m4; then |
---|
130 | aclocal -I m4 || exit -1 |
---|
131 | else |
---|
132 | aclocal || exit -1 |
---|
133 | fi |
---|
134 | if grep AC_CONFIG_HEADER configure.ac >/dev/null 2>&1; then |
---|
135 | echo running autoheader in $dir |
---|
136 | autoheader || exit -1 |
---|
137 | fi |
---|
138 | echo running automake in $dir |
---|
139 | automake || exit -1 |
---|
140 | echo running autoconf in $dir |
---|
141 | autoconf || exit -1 |
---|
142 | else |
---|
143 | echo "*** No configure.ac file in $dir - SKIPPING! ***" |
---|
144 | fi |
---|
145 | ) |
---|
146 | if test $? -ne 0; then |
---|
147 | exit -2; |
---|
148 | fi |
---|
149 | done |
---|