2002-07-11 Rodrigo Moya <rodrigo@ximian.com>
[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
82 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
83   if test -z "$NO_LIBTOOLIZE" ; then 
84     echo "Running libtoolize..."
85     libtoolize --force --copy
86   fi
87 fi
88
89 echo "Running aclocal $ACLOCAL_FLAGS ..."
90 aclocal $ACLOCAL_FLAGS || {
91   echo
92   echo "**Error**: aclocal failed. This may mean that you have not"
93   echo "installed all of the packages you need, or you may need to"
94   echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
95   echo "for the prefix where you installed the packages whose"
96   echo "macros were not found"
97   exit 1
98 }
99
100 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
101   echo "Running autoheader..."
102   autoheader || { echo "**Error**: autoheader failed."; exit 1; }
103 fi
104
105 echo "Running automake --gnu $am_opt ..."
106 automake --add-missing --gnu $am_opt ||
107   { echo "**Error**: automake failed."; exit 1; }
108 echo "Running autoconf ..."
109 autoconf || { echo "**Error**: autoconf failed."; exit 1; }
110
111
112 conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
113
114 if test x$NOCONFIGURE = x; then
115   echo Running $srcdir/configure $conf_flags "$@" ...
116   $srcdir/configure $conf_flags "$@" \
117   && echo Now type \`make\' to compile $PKG_NAME || exit 1
118 else
119   echo Skipping configure process.
120 fi