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