Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Check the GRAS_ARCH; cosmetics
[simgrid.git] / bootstrap
1 #!/bin/sh -e
2 # Run this to generate all the initial makefiles, etc.
3
4 ######
5 ###### Some defs
6 ######
7
8 PKG_NAME="GRAS"
9 # a list of all dirs containing possibly some macros
10 acmacrodirs="${HOME}/share/aclocal ${PWD}/acmacro /usr/share/aclocal/gnome2-macros"
11  
12 ######
13 ###### End of conf part
14 ######
15 for dir in $acmacrodirs ; do
16    if test -d $dir ; then
17        aclocalinclude="$aclocalinclude -I $dir";
18    fi
19 done
20
21 srcdir=`dirname $0`
22 test -z "$srcdir" && srcdir=.
23
24 echo "Autoregenerate package \`$PKG_NAME' in directory \`$srcdir'";
25
26 (test -f $srcdir/configure.ac \
27   && test -f $srcdir/src/include/gras.h) || {
28     echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
29     echo " top-level $PKG_NAME directory"
30     exit 1
31 }
32
33 ######
34 ###### Some tests (borrowed from macros/autogen.sh from achtung)
35 ######
36 # Changlog : 
37 # 27/5/00: Changed "to compile gnome" to "to compile $PKG_NAME"
38 # 27/5/00: removed gettext
39
40 DIE=0
41
42 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
43   echo
44   echo "**Error**: You must have \`autoconf' installed to compile $PKG_NAME."
45   echo "Download the appropriate package for your distribution,"
46   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
47   DIE=1
48 }
49
50 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
51   (libtool --version) < /dev/null > /dev/null 2>&1 || {
52     echo
53     echo "**Error**: You must have \`libtool' installed to compile $PKG_NAME."
54     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.4.tar.gz"
55     echo "(or a newer version if it is available)"
56     DIE=1
57   }
58 }
59
60 (automake-1.7 --version) < /dev/null > /dev/null 2>&1 || {
61   echo
62   echo "**Error**: You must have \`automake' 1.7 installed to compile $PKG_NAME."
63   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.7.tar.gz"
64   echo "(or a newer version if it is available)"
65   DIE=1
66   NO_AUTOMAKE=yes
67 }
68
69 # if no automake, don't bother testing for aclocal
70 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
71   echo
72   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
73   echo "installed doesn't appear recent enough."
74   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
75   echo "(or a newer version if it is available)"
76   DIE=1
77 }
78
79 if test "$DIE" -eq 1; then
80   exit 1
81 fi
82
83 ###### END of test part
84
85
86 ######
87 ###### Action part
88 ######
89
90
91 if test -z "$*"; then
92   if test -e aci.conf ; then
93     source aci.conf
94     echo "**Warning**: I am going to run \`configure' with arguments resulting from aci_configurator execution."
95     echo "ie, $configure_args."
96     echo "If you wish to pass other ones, please specify them on the"
97     echo \`$0\'" command line, or rerun aci_configurator and save the new ones."
98     echo
99   else
100     configure_args="--enable-maintainer-mode"
101     echo "**Warning**: I am going to run \`configure' with no arguments."
102     echo "If you wish to pass any to it, please specify them on the"
103     echo \`$0\'" command line."
104     echo
105   fi
106 else
107   configure_args="$@"
108 fi
109
110 case $CC in
111 xlc )
112   am_opt=--include-deps;;
113 esac
114
115 for coin in  `find $srcdir -name configure.ac -print `\
116              `find $srcdir -name configure.in -print`
117 do 
118   dr=`dirname $coin`
119   if test -f $dr/NO-AUTO-GEN; then
120     echo skipping $dr -- flagged as no auto-gen
121   else
122     echo "************"
123     echo "* Processing directory $dr"
124     echo "************"
125
126     if [ -e $dr/configure.in ] ; then
127        configfile="configure.in"
128     else 
129        configfile="configure.ac"
130     fi
131     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
132     here=`pwd`
133     cd $dr
134     if grep "^AM_PROG_LIBTOOL" $configfile >/dev/null; then
135       if test -z "$NO_LIBTOOLIZE" ; then 
136         echo "Running libtoolize --force --copy in "`pwd`"..."
137         libtoolize --force --copy || exit 1
138       fi
139     fi
140     echo "Running aclocal-1.7 $aclocalinclude..."
141     aclocal-1.7 $aclocalinclude 
142     if grep "^AM_CONFIG_HEADER" $configfile >/dev/null; then
143       echo "Running autoheader in "`pwd`"..."
144       autoheader || exit 1
145     fi
146     if grep "^AM_INIT_AUTOMAKE" $configfile >/dev/null; then
147       echo "Running automake-1.7 --gnu --add-missing $am_opt ..."
148       automake-1.7 --gnu --add-missing $am_opt || exit 1
149     fi
150     echo "Running autoconf..."
151     autoconf || exit 1
152     cd $here
153   fi
154 done
155
156 #conf_flags="--enable-compile-warnings"
157 #  \
158 #--enable-compile-warnings=minimum"
159 #--enable-iso-c
160
161 #echo "rebuilding the api documentation... "
162 #cd docs && ./refresh-api "  "&& echo "Done with the rebuilding of the api documentation." && cd .. || exit 1
163
164
165 if test x$NOCONFIGURE = x; then
166   echo "************"
167   echo "* Running ./configure $configure_args..."
168   echo "************"
169   
170   ./configure $configure_args || exit 1
171
172 else
173   echo Skipping configure process.
174 fi
175
176 echo Now type \`make\' to compile $PKG_NAME
177
178