autogen.sh 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. #
  91. # Plug in the extension module
  92. #
  93. has_ext_mod=false
  94. ext_mod_args=''
  95. for PARAM; do
  96. if [[ $PARAM =~ "--enable-extension-module" ]] ; then
  97. has_ext_mod=true
  98. if [[ $PARAM =~ "=" ]] ; then
  99. ext_mod_args=`echo $PARAM | cut -d= -f2`
  100. fi
  101. fi
  102. done
  103. if test x$has_ext_mod = xtrue; then
  104. pushd $top_srcdir../mono-extensions/scripts
  105. sh ./prepare-repo.sh $ext_mod_args || exit 1
  106. popd
  107. else
  108. cat mono/mini/Makefile.am.in > mono/mini/Makefile.am
  109. fi
  110. echo "Running aclocal -I m4 -I . $ACLOCAL_FLAGS ..."
  111. aclocal -Wnone -I m4 -I . $ACLOCAL_FLAGS || {
  112. echo
  113. echo "**Error**: aclocal failed. This may mean that you have not"
  114. echo "installed all of the packages you need, or you may need to"
  115. echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
  116. echo "for the prefix where you installed the packages whose"
  117. echo "macros were not found"
  118. exit 1
  119. }
  120. if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
  121. echo "Running autoheader..."
  122. autoheader || { echo "**Error**: autoheader failed."; exit 1; }
  123. fi
  124. echo "Running automake $am_opt ..."
  125. automake $am_opt ||
  126. { echo "**Error**: automake failed."; exit 1; }
  127. echo "Running autoconf ..."
  128. autoconf || { echo "**Error**: autoconf failed."; exit 1; }
  129. if test -d $srcdir/libgc; then
  130. echo Running libgc/autogen.sh ...
  131. (cd $srcdir/libgc ; NOCONFIGURE=1 ./autogen.sh "$@")
  132. echo Done running libgc/autogen.sh ...
  133. fi
  134. if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
  135. echo "MONO_EXTRA_CONFIGURE_FLAGS is $MONO_EXTRA_CONFIGURE_FLAGS"
  136. fi
  137. conf_flags="$MONO_EXTRA_CONFIGURE_FLAGS --enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
  138. if test x$NOCONFIGURE = x; then
  139. echo Running $srcdir/configure $conf_flags "$@" ...
  140. $srcdir/configure $conf_flags "$@" \
  141. && echo Now type \`make\' to compile $PKG_NAME || exit 1
  142. else
  143. echo Skipping configure process.
  144. fi