[interp] Remove some unused paths in newobj and cleanup a little. (#18998)
[mono-project.git] / autogen.sh
blob3f0fcd49ee23805b225de9a5186c4a240abc6108
1 #!/usr/bin/env bash
2 # Run this to generate all the initial makefiles, etc.
3 # Ripped off from GNOME macros version
5 DIE=0
7 srcdir=`dirname $0`
8 test -z "$srcdir" && srcdir=.
10 if [ -n "$MONO_PATH" ]; then
11 # from -> /mono/lib:/another/mono/lib
12 # to -> /mono /another/mono
13 for i in `echo ${MONO_PATH} | tr ":" " "`; do
14 i=`dirname ${i}`
15 if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
16 ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
18 if [ -n "{i}" -a -d "${i}/bin" ]; then
19 PATH="${i}/bin:$PATH"
21 done
22 export PATH
25 (autoconf --version) < /dev/null > /dev/null 2>&1 || {
26 echo
27 echo "**Error**: You must have \`autoconf' installed to compile Mono."
28 echo "Download the appropriate package for your distribution,"
29 echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
30 DIE=1
33 if [ -z "$LIBTOOLIZE" ]; then
34 LIBTOOLIZE=`which glibtoolize 2>/dev/null`
35 if [ ! -x "$LIBTOOLIZE" ]; then
36 LIBTOOLIZE=`which libtoolize`
40 (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
41 ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
42 echo
43 echo "**Error**: You must have \`libtoolize' installed to compile Mono."
44 echo "Get ftp://ftp.gnu.org/gnu/libtool/libtool-1.2.tar.gz"
45 echo "(or a newer version if it is available)"
46 DIE=1
50 grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
51 grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
52 (gettext --version) < /dev/null > /dev/null 2>&1 || {
53 echo
54 echo "**Error**: You must have \`gettext' installed to compile Mono."
55 echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
56 echo "(or a newer version if it is available)"
57 DIE=1
61 (automake --version) < /dev/null > /dev/null 2>&1 || {
62 echo
63 echo "**Error**: You must have \`automake' installed to compile Mono."
64 echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
65 echo "(or a newer version if it is available)"
66 DIE=1
67 NO_AUTOMAKE=yes
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
81 if test "$DIE" -eq 1; then
82 exit 1
85 if test x$NOCONFIGURE = x && test -z "$*"; then
86 echo "**Warning**: I am going to run \`configure' with no arguments."
87 echo "If you wish to pass any to it, please specify them on the"
88 echo \`$0\'" command line."
89 echo
92 am_opt="--add-missing --copy --gnu -Wno-portability -Wno-obsolete"
94 case $CC in
95 xlc )
96 am_opt="$am_opt --include-deps";;
97 esac
100 if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
101 if test -z "$NO_LIBTOOLIZE" ; then
102 echo "Running libtoolize..."
103 $LIBTOOLIZE --force --copy
107 # Parse parameters
108 has_ext_mod=false
109 ext_mod_args=''
110 has_disable_boehm=false
111 for PARAM; do
112 if [[ $PARAM =~ "--enable-extension-module" ]] ; then
113 has_ext_mod=true
114 if [[ $PARAM =~ "=" ]] ; then
115 ext_mod_args=`echo $PARAM | cut -d= -f2`
118 if [[ $PARAM =~ "--disable-boehm" ]] ; then
119 has_disable_boehm=true
121 done
124 # Plug in the extension module
126 if test x$has_ext_mod = xtrue; then
127 pushd $top_srcdir../mono-extensions/scripts
128 sh ./prepare-repo.sh $ext_mod_args || exit 1
129 popd
130 else
131 cat mono/mini/Makefile.am.in > mono/mini/Makefile.am
135 echo "Running aclocal -I m4 -I . $ACLOCAL_FLAGS ..."
136 aclocal -Wnone -I m4 -I . $ACLOCAL_FLAGS || {
137 echo
138 echo "**Error**: aclocal failed. This may mean that you have not"
139 echo "installed all of the packages you need, or you may need to"
140 echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
141 echo "for the prefix where you installed the packages whose"
142 echo "macros were not found"
143 exit 1
146 if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
147 echo "Running autoheader..."
148 autoheader || { echo "**Error**: autoheader failed."; exit 1; }
151 echo "Running automake $am_opt ..."
152 automake $am_opt ||
153 { echo "**Error**: automake failed."; exit 1; }
154 echo "Running autoconf ..."
155 autoconf || { echo "**Error**: autoconf failed."; exit 1; }
157 # Update all submodules recursively to ensure everything is checked out
158 if test -e $srcdir/scripts/update_submodules.sh; then
159 (cd $srcdir && scripts/update_submodules.sh)
162 if test x$has_disable_boehm = xfalse -a -d $srcdir/external/bdwgc; then
163 echo Running external/bdwgc/autogen.sh ...
164 (cd $srcdir/external/bdwgc ; NOCONFIGURE=1 ./autogen.sh "$@")
165 echo Done running external/bdwgc/autogen.sh ...
168 if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
169 echo "MONO_EXTRA_CONFIGURE_FLAGS is $MONO_EXTRA_CONFIGURE_FLAGS"
172 host_conf_flag=
173 build_uname_all=`(uname -a) 2>/dev/null`
174 case "$build_uname_all" in
175 CYGWIN*)
176 if [[ "$@" != *"--host="* ]]; then
177 echo "Missing --host parameter, configure using ./configure --host=i686-w64-mingw32 or --host=x86_64-w64-mingw32"
178 echo "Falling back using --host=x86_64-w64-mingw32 as default."
179 host_conf_flag="--host=x86_64-w64-mingw32"
182 esac
184 conf_flags="$MONO_EXTRA_CONFIGURE_FLAGS --enable-maintainer-mode --enable-compile-warnings $host_conf_flag" #--enable-iso-c
186 if test x$NOCONFIGURE = x; then
187 echo Running $srcdir/configure $conf_flags "$@" ...
188 $srcdir/configure $conf_flags "$@" \
189 && echo Now type \`make\' to compile $PKG_NAME || exit 1
190 else
191 echo Skipping configure process.