bfd7bef3037acc3a35cfd543ec3c893489fe960b
[mono.git] / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3 # Ripped off from GNOME macros version
4
5 DIE=0
6
7 srcdir=`dirname $0`
8 test -z "$srcdir" && srcdir=.
9
10 if [ -n "$MONO_PATH" ]; then
11         ACLOCAL_FLAGS="-I $MONO_PATH/share/aclocal $ACLOCAL_FLAGS"
12         PATH="$MONO_PATH/bin:$PATH"
13         export PATH
14 fi
15
16 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
17   echo
18   echo "**Error**: You must have \`autoconf' installed to compile Mono."
19   echo "Download the appropriate package for your distribution,"
20   echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
21   DIE=1
22 }
23
24 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
25   (libtool --version) < /dev/null > /dev/null 2>&1 || {
26     echo
27     echo "**Error**: You must have \`libtool' installed to compile Mono."
28     echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
29     echo "(or a newer version if it is available)"
30     DIE=1
31   }
32 }
33
34 grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
35   grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
36   (gettext --version) < /dev/null > /dev/null 2>&1 || {
37     echo
38     echo "**Error**: You must have \`gettext' installed to compile Mono."
39     echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
40     echo "(or a newer version if it is available)"
41     DIE=1
42   }
43 }
44
45 (automake --version) < /dev/null > /dev/null 2>&1 || {
46   echo
47   echo "**Error**: You must have \`automake' installed to compile Mono."
48   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
49   echo "(or a newer version if it is available)"
50   DIE=1
51   NO_AUTOMAKE=yes
52 }
53
54
55 # if no automake, don't bother testing for aclocal
56 test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
57   echo
58   echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
59   echo "installed doesn't appear recent enough."
60   echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
61   echo "(or a newer version if it is available)"
62   DIE=1
63 }
64
65 if test "$DIE" -eq 1; then
66   exit 1
67 fi
68
69 if test -z "$*"; then
70   echo "**Warning**: I am going to run \`configure' with no arguments."
71   echo "If you wish to pass any to it, please specify them on the"
72   echo \`$0\'" command line."
73   echo
74 fi
75
76 case $CC in
77 xlc )
78   am_opt=--include-deps;;
79 esac
80
81 for coin in `find $srcdir -name configure.in -print`
82 do 
83   dr=`dirname $coin`
84   if test -f $dr/NO-AUTO-GEN; then
85     echo skipping $dr -- flagged as no auto-gen
86   else
87     echo processing $dr
88     macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
89     ( cd $dr
90       macrosdir=`find . -name macros -print`
91       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
92         if grep "sed.*POTFILES" configure.in >/dev/null; then
93           : do nothing -- we still have an old unmodified configure.in
94         else
95           echo "Creating $dr/aclocal.m4 ..."
96           test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
97           echo "Running gettextize...  Ignore non-fatal messages."
98           echo "no" | gettextize --force --copy
99           echo "Making $dr/aclocal.m4 writable ..."
100           test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
101         fi
102       fi
103       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
104         if test -z "$NO_LIBTOOLIZE" ; then 
105           echo "Running libtoolize..."
106           libtoolize --force --copy
107         fi
108       fi
109       echo "Running aclocal $aclocalinclude ..."
110       aclocal $aclocalinclude || {
111         echo
112         echo "**Error**: aclocal failed. This may mean that you have not"
113         echo "installed all of the packages you need, or you may need to"
114         echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
115         echo "for the prefix where you installed the packages whose"
116         echo "macros were not found"
117         exit 1
118       }
119
120       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
121         echo "Running autoheader..."
122         autoheader || { echo "**Error**: autoheader failed."; exit 1; }
123       fi
124       echo "Running automake --gnu $am_opt ..."
125       automake --add-missing --gnu $am_opt ||
126         { echo "**Error**: automake failed."; exit 1; }
127       echo "Running autoconf ..."
128       autoconf || { echo "**Error**: autoconf failed."; exit 1; }
129     ) || exit 1
130   fi
131 done
132
133 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
134
135 if test x$NOCONFIGURE = x; then
136   echo Running $srcdir/configure $conf_flags "$@" ...
137   $srcdir/configure $conf_flags "$@" \
138   && echo Now type \`make\' to compile $PKG_NAME || exit 1
139 else
140   echo Skipping configure process.
141 fi