Logo AND Algorithmique Numérique Distribuée

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