File: run_autotools

package info (click to toggle)
clp 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 10,432 kB
  • ctags: 3,625
  • sloc: cpp: 93,375; sh: 9,500; xml: 3,681; makefile: 398; ansic: 121
file content (149 lines) | stat: -rwxr-xr-x 4,064 bytes parent folder | download | duplicates (2)
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/sh

# Copyright (C) 2006, 2007  International Business Machines.
# All Rights Reserved.
# This file is distributed under the Common Public License.
# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
#
## $Id: run_autotools 410 2007-06-22 06:09:52Z andreasw $
#
# Author: Andreas Waechter     IBM      2006-04-14

# Make sure we bail out if there is an error
set -e

ver_autoconf='2.59'
ver_automake='1.9.6'
ver_libtool='1.5.22'
EGREP='grep -E'

# Check if the correct version of the autotools is used
if test x$AUTOTOOLS_DIR = x; then
  AUTOTOOLS_DIR=$HOME
fi

grep_version=`echo  $ver_autoconf | sed -e 's/\\./\\\\\\./g'`
autoconf --version > confauto.out 2>&1
if $EGREP $grep_version confauto.out >/dev/null 2>&1; then :; else
  echo You are not using the correct version of autoconf
  rm -f confauto.out
  exit -2
fi
rm -f confauto.out
autoconf_dir=`which autoconf | sed -e 's=/autoconf=='`
autoconf_dir=`cd $autoconf_dir; pwd`
if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else
  echo autoconf is not picked up from the correct location
  exit -2
fi

grep_version=`echo  $ver_automake | sed -e 's/\\./\\\\\\./g'`
automake --version > confauto.out 2>&1
if $EGREP $grep_version confauto.out >/dev/null 2>&1; then :; else
  echo You are not using the correct version of automake
  rm -f confauto.out
  exit -2
fi
rm -f confauto.out
autoconf_dir=`which automake | sed -e 's=/automake=='`
autoconf_dir=`cd $autoconf_dir; pwd`
if test $autoconf_dir = `cd $AUTOTOOLS_DIR/bin; pwd`; then :; else
  echo automake is not picked up from the correct location
  exit -2
fi

grep_version=`echo  $ver_libtool | sed -e 's/\\./\\\\\\./g'`
ltfile=$AUTOTOOLS_DIR/share/libtool/ltmain.sh
if test -r $ltfile; then :; else
  echo Cannot file $ltfile
fi
if $EGREP $grep_version $ltfile >/dev/null 2>&1; then :; else
  echo You are not using the correct verion of libtool
fi

# Find directories which contain a file configure.ac. When all is said and
# done, each entry in dirs will be of the form `./path/to/directory'

if test $# != 0; then
  dirs="$*"
else
  pos_dirs=`find . -name configure.ac | sed -e s%/configure.ac%%g`
  dirs=
  for dir in $pos_dirs; do
    if test -r $dir/configure.ac; then
      dirs="$dirs $dir"
    else
      echo "$dir/configure.ac doesn't appear to be a regular file; skipping."
    fi
  done
fi

# Now compare against the skip entries in COIN_SKIP_PROJECTS. To match the
# entries we just collected, add `./' to the front of each skip entry.

pos_dirs=$dirs
if test x${COIN_SKIP_PROJECTS+set} = xset ; then
  dirs=
  for dir in $COIN_SKIP_PROJECTS ; do
    skip_dirs="$skip_dirs ./$dir"
  done
  for dir in $pos_dirs ; do
    skip=0
    for skipdir in $skip_dirs ; do
      if test $dir = $skipdir ; then
	skip=1
	break
      fi
    done
    if test $skip = 0 ; then
      dirs="$dirs $dir"
    else
      echo "$dir listed in COIN_SKIP_PROJECTS; skipping."
    fi
  done
fi

echo Running autotools in $dirs

currdir=`pwd`
if test -r $currdir/BuildTools/coin.m4; then
  toolsdir=$currdir/BuildTools
else
  echo Cannot find BuildTools directory.
  exit
fi

echo Copying autotools scripts into this directory
cp $toolsdir/config.guess $toolsdir/config.sub $toolsdir/depcomp $toolsdir/install-sh $toolsdir/ltmain.sh $toolsdir/missing .

if test x$AUTOTOOLS_DIR = x; then
  AUTOTOOLS_DIR=$HOME
fi

for dir in $dirs; do
  (if test -r $dir/configure.ac; then
     cd $dir
     echo creating acinclude.m4 in $dir
     cat $AUTOTOOLS_DIR/share/aclocal/libtool.m4 $toolsdir/coin.m4> acinclude.m4
     echo running aclocal in $dir
     if test -d m4; then
       aclocal -I m4 || exit -1
     else
       aclocal || exit -1
     fi
     if grep AC_CONFIG_HEADER configure.ac >/dev/null 2>&1; then
       echo running autoheader in $dir
       autoheader || exit -1
     fi
     echo running automake in $dir
     automake || exit -1
     echo running autoconf in $dir
     autoconf || exit -1
   else
     echo "*** No configure.ac file in $dir - SKIPPING! ***"
   fi
  )
  if test $? -ne 0; then
    exit -2;
  fi
done