autogen.sh 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. #!/usr/bin/env bash
  2. # Run this to generate all the initial makefiles, etc.
  3. # Ripped off from GNOME macros version
  4. DIE=0
  5. srcdir=`dirname $0`
  6. test -z "$srcdir" && srcdir=.
  7. if [ -n "$MONO_PATH" ]; then
  8. # from -> /mono/lib:/another/mono/lib
  9. # to -> /mono /another/mono
  10. for i in `echo ${MONO_PATH} | tr ":" " "`; do
  11. i=`dirname ${i}`
  12. if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
  13. ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
  14. fi
  15. if [ -n "{i}" -a -d "${i}/bin" ]; then
  16. PATH="${i}/bin:$PATH"
  17. fi
  18. done
  19. export PATH
  20. fi
  21. (autoconf --version) < /dev/null > /dev/null 2>&1 || {
  22. echo
  23. echo "**Error**: You must have \`autoconf' installed to compile Mono."
  24. echo "Download the appropriate package for your distribution,"
  25. echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
  26. DIE=1
  27. }
  28. if [ -z "$LIBTOOLIZE" ]; then
  29. LIBTOOLIZE=`which glibtoolize 2>/dev/null`
  30. if [ ! -x "$LIBTOOLIZE" ]; then
  31. LIBTOOLIZE=`which libtoolize`
  32. fi
  33. fi
  34. (grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
  35. ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
  36. echo
  37. echo "**Error**: You must have \`libtoolize' installed to compile Mono."
  38. echo "Get ftp://ftp.gnu.org/gnu/libtool/libtool-1.2.tar.gz"
  39. echo "(or a newer version if it is available)"
  40. DIE=1
  41. }
  42. }
  43. grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
  44. grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
  45. (gettext --version) < /dev/null > /dev/null 2>&1 || {
  46. echo
  47. echo "**Error**: You must have \`gettext' installed to compile Mono."
  48. echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
  49. echo "(or a newer version if it is available)"
  50. DIE=1
  51. }
  52. }
  53. (automake --version) < /dev/null > /dev/null 2>&1 || {
  54. echo
  55. echo "**Error**: You must have \`automake' installed to compile Mono."
  56. echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
  57. echo "(or a newer version if it is available)"
  58. DIE=1
  59. NO_AUTOMAKE=yes
  60. }
  61. # if no automake, don't bother testing for aclocal
  62. test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
  63. echo
  64. echo "**Error**: Missing \`aclocal'. The version of \`automake'"
  65. echo "installed doesn't appear recent enough."
  66. echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
  67. echo "(or a newer version if it is available)"
  68. DIE=1
  69. }
  70. if test "$DIE" -eq 1; then
  71. exit 1
  72. fi
  73. if test x$NOCONFIGURE = x && test -z "$*"; then
  74. echo "**Warning**: I am going to run \`configure' with no arguments."
  75. echo "If you wish to pass any to it, please specify them on the"
  76. echo \`$0\'" command line."
  77. echo
  78. fi
  79. am_opt="--add-missing --copy --gnu -Wno-portability -Wno-obsolete"
  80. case $CC in
  81. xlc )
  82. am_opt="$am_opt --include-deps";;
  83. esac
  84. if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
  85. if test -z "$NO_LIBTOOLIZE" ; then
  86. echo "Running libtoolize..."
  87. $LIBTOOLIZE --force --copy
  88. fi
  89. fi
  90. # Parse parameters
  91. has_ext_mod=false
  92. ext_mod_args=''
  93. has_disable_boehm=false
  94. for PARAM; do
  95. if [[ $PARAM =~ "--enable-extension-module" ]] ; then
  96. has_ext_mod=true
  97. if [[ $PARAM =~ "=" ]] ; then
  98. ext_mod_args=`echo $PARAM | cut -d= -f2`
  99. fi
  100. fi
  101. if [[ $PARAM =~ "--disable-boehm" ]] ; then
  102. has_disable_boehm=true
  103. fi
  104. done
  105. #
  106. # Plug in the extension module
  107. #
  108. if test x$has_ext_mod = xtrue; then
  109. pushd $top_srcdir../mono-extensions/scripts
  110. sh ./prepare-repo.sh $ext_mod_args || exit 1
  111. popd
  112. else
  113. cat mono/mini/Makefile.am.in > mono/mini/Makefile.am
  114. fi
  115. echo "Running aclocal -I m4 -I . $ACLOCAL_FLAGS ..."
  116. aclocal -Wnone -I m4 -I . $ACLOCAL_FLAGS || {
  117. echo
  118. echo "**Error**: aclocal failed. This may mean that you have not"
  119. echo "installed all of the packages you need, or you may need to"
  120. echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
  121. echo "for the prefix where you installed the packages whose"
  122. echo "macros were not found"
  123. exit 1
  124. }
  125. if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
  126. echo "Running autoheader..."
  127. autoheader || { echo "**Error**: autoheader failed."; exit 1; }
  128. fi
  129. echo "Running automake $am_opt ..."
  130. automake $am_opt ||
  131. { echo "**Error**: automake failed."; exit 1; }
  132. echo "Running autoconf ..."
  133. autoconf || { echo "**Error**: autoconf failed."; exit 1; }
  134. # Update all submodules recursively to ensure everything is checked out
  135. if test -e $srcdir/scripts/update_submodules.sh; then
  136. (cd $srcdir && scripts/update_submodules.sh)
  137. fi
  138. if test x$has_disable_boehm = xfalse -a -d $srcdir/external/bdwgc; then
  139. echo Running external/bdwgc/autogen.sh ...
  140. (cd $srcdir/external/bdwgc ; NOCONFIGURE=1 ./autogen.sh "$@")
  141. echo Done running external/bdwgc/autogen.sh ...
  142. fi
  143. if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
  144. echo "MONO_EXTRA_CONFIGURE_FLAGS is $MONO_EXTRA_CONFIGURE_FLAGS"
  145. fi
  146. host_conf_flag=
  147. build_uname_all=`(uname -a) 2>/dev/null`
  148. case "$build_uname_all" in
  149. CYGWIN*)
  150. if [[ "$@" != *"--host="* ]]; then
  151. echo "Missing --host parameter, configure using ./configure --host=i686-w64-mingw32 or --host=x86_64-w64-mingw32"
  152. echo "Falling back using --host=x86_64-w64-mingw32 as default."
  153. host_conf_flag="--host=x86_64-w64-mingw32"
  154. fi
  155. ;;
  156. esac
  157. conf_flags="$MONO_EXTRA_CONFIGURE_FLAGS --enable-maintainer-mode --enable-compile-warnings $host_conf_flag" #--enable-iso-c
  158. if test x$NOCONFIGURE = x; then
  159. echo Running $srcdir/configure $conf_flags "$@" ...
  160. $srcdir/configure $conf_flags "$@" \
  161. && echo Now type \`make\' to compile $PKG_NAME || exit 1
  162. else
  163. echo Skipping configure process.
  164. fi