Initial revision
[gcc.git] / libjava / classpath / autogen.sh
1 #!/bin/sh
2 # Run this to generate all the initial makefiles, etc.
3
4 srcdir=`dirname $0`
5 test -z "$srcdir" && srcdir=.
6
7 ORIGDIR=`pwd`
8 cd $srcdir
9 PROJECT=classpath
10 TEST_TYPE=-f
11 FILE=java/lang/Object.java
12
13 DIE=0
14
15 case `uname -s` in
16 Darwin)
17 LIBTOOLIZE=glibtoolize
18 ;;
19 *)
20 LIBTOOLIZE=libtoolize
21 ;;
22 esac
23
24 have_libtool=true
25 if ${LIBTOOLIZE} --version < /dev/null > /dev/null 2>&1 ; then
26 libtool_version=`${LIBTOOLIZE} --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
27 case $libtool_version in
28 1.5*)
29 have_libtool=true
30 ;;
31 esac
32 fi
33 if $have_libtool ; then : ; else
34 echo
35 echo "You must have libtool 1.5 installed to compile $PROJECT."
36 echo "Install the appropriate package for your distribution,"
37 echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
38 DIE=1
39 fi
40
41 have_autoconf=false
42 if autoconf --version < /dev/null > /dev/null 2>&1 ; then
43 autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
44 case $autoconf_version in
45 2.59*)
46 have_autoconf=true
47 ;;
48 esac
49 fi
50 if $have_autoconf ; then : ; else
51 echo
52 echo "You must have autoconf 2.59 installed to compile $PROJECT."
53 echo "Install the appropriate package for your distribution,"
54 echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
55 DIE=1
56 fi
57
58 have_automake=false
59 # We know each 1.9.x version works
60 if automake-1.9 --version < /dev/null > /dev/null 2>&1 ; then
61 AUTOMAKE=automake-1.9
62 ACLOCAL=aclocal-1.9
63 have_automake=true
64 elif automake --version < /dev/null > /dev/null 2>&1 ; then
65 AUTOMAKE=automake
66 ACLOCAL=aclocal
67 automake_version=`automake --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
68 case $automake_version in
69 1.9*)
70 have_automake=true
71 ;;
72 esac
73 fi
74 if $have_automake ; then : ; else
75 echo
76 echo "You must have automake 1.9 installed to compile $PROJECT."
77 echo "Install the appropriate package for your distribution,"
78 echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
79 DIE=1
80 fi
81
82 if test "$DIE" -eq 1; then
83 exit 1
84 fi
85
86 test $TEST_TYPE $FILE || {
87 echo "You must run this script in the top-level $PROJECT directory"
88 exit 1
89 }
90
91 if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then
92 if test -z "$*"; then
93 echo "I am going to run ./configure with no arguments - if you wish "
94 echo "to pass any to it, please specify them on the $0 command line."
95 fi
96 fi
97
98 if test -z "$ACLOCAL_FLAGS"; then
99
100 acdir=`$ACLOCAL --print-ac-dir`
101 m4list="glib-2.0.m4 glib-gettext.m4"
102
103 for file in $m4list
104 do
105 if [ ! -f "$acdir/$file" ]; then
106 echo "WARNING: aclocal's directory is $acdir, but..."
107 echo " no file $acdir/$file"
108 echo " You may see fatal macro warnings below."
109 echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
110 echo " environment variable to \"-I /some/dir\", or install"
111 echo " $acdir/$file."
112 echo ""
113 fi
114 done
115 fi
116
117 # Use the "-I m4 flag in order to include pkg.m4 and other .m4 files.
118 $ACLOCAL -I m4 $ACLOCAL_FLAGS || exit $?
119
120 ${LIBTOOLIZE} --force || exit $?
121
122 autoheader || exit $?
123
124 $AUTOMAKE --add-missing || exit $?
125 autoconf || exit $?
126 cd $ORIGDIR || exit $?
127
128 if test "x$AUTOGEN_SUBDIR_MODE" = "xyes"; then
129 $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
130
131 echo
132 echo "Now type 'make' to compile $PROJECT."
133 fi