source: releases/0.5.16/run_autotools @ 587

Last change on this file since 587 was 410, checked in by andreasw, 13 years ago

more fix with proper exit

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
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 410 2007-06-22 06:09:52Z andreasw $
9#
10# Author: Andreas Waechter     IBM      2006-04-14
11
12# Make sure we bail out if there is an error
13set -e
14
15ver_autoconf='2.59'
16ver_automake='1.9.6'
17ver_libtool='1.5.22'
18EGREP='grep -E'
19
20# Check if the correct version of the autotools is used
21if test x$AUTOTOOLS_DIR = x; then
22  AUTOTOOLS_DIR=$HOME
23fi
24
25grep_version=`echo  $ver_autoconf | sed -e 's/\\./\\\\\\./g'`
26autoconf --version > confauto.out 2>&1
27if $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
31fi
32rm -f confauto.out
33autoconf_dir=`which autoconf | sed -e 's=/autoconf=='`
34autoconf_dir=`cd $autoconf_dir; pwd`
35if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else
36  echo autoconf is not picked up from the correct location
37  exit -2
38fi
39
40grep_version=`echo  $ver_automake | sed -e 's/\\./\\\\\\./g'`
41automake --version > confauto.out 2>&1
42if $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
46fi
47rm -f confauto.out
48autoconf_dir=`which automake | sed -e 's=/automake=='`
49autoconf_dir=`cd $autoconf_dir; pwd`
50if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else
51  echo automake is not picked up from the correct location
52  exit -2
53fi
54
55grep_version=`echo  $ver_libtool | sed -e 's/\\./\\\\\\./g'`
56ltfile=$AUTOTOOLS_DIR/share/libtool/ltmain.sh
57if test -r $ltfile; then :; else
58  echo Cannot file $ltfile
59fi
60if $EGREP $grep_version $ltfile >/dev/null 2>&1; then :; else
61  echo You are not using the correct verion of libtool
62fi
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
67if test $# != 0; then
68  dirs="$*"
69else
70  pos_dirs=`find . -name configure.ac | sed -e s%/configure.ac%%g`
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
79fi
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
84pos_dirs=$dirs
85if 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
104fi
105
106echo Running autotools in $dirs
107
108currdir=`pwd`
109if test -r $currdir/BuildTools/coin.m4; then
110  toolsdir=$currdir/BuildTools
111else
112  echo Cannot find BuildTools directory.
113  exit
114fi
115
116echo Copying autotools scripts into this directory
117cp $toolsdir/config.guess $toolsdir/config.sub $toolsdir/depcomp $toolsdir/install-sh $toolsdir/ltmain.sh $toolsdir/missing .
118
119if test x$AUTOTOOLS_DIR = x; then
120  AUTOTOOLS_DIR=$HOME
121fi
122
123for 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
149done
Note: See TracBrowser for help on using the repository browser.