home *** CD-ROM | disk | FTP | other *** search
- # $Id: configure.in,v 1.23 2000/01/07 22:19:46 lord Exp $
- dnl This file is an input file used by the GNU "autoconf" program to
- dnl generate the file "configure", which is run to configure the
- dnl Makefile in this directory.
- AC_INIT(jikes.cpp)
- AC_PREREQ(2.13)
-
- # Convert srcdir into full path name
- srcdir=`cd $srcdir ; pwd`
- echo "srcdir is $srcdir"
-
- # Let configure look for a c and c++ compiler and find the system
- # defined object and executable extensions. Also do some extra
- # checks to find out if we are running in a cygwin environment
-
- AC_LANG_CPLUSPLUS
- AC_PROG_CXX
- AC_CYGWIN
- AC_OBJEXT
- AC_EXEEXT
-
- # FIXME : bug in autoconf 2.13 in the AC_EXEEXT macro. If the lang
- # is set to C++ the extension will be .C, which confuses the macro
- # and makes it think the executable extension is ".C". We currently
- # work around this by just setting EXEEXT to .exe on windows.
- EXEEXT=""
-
- #--------------------------------------------------------------------
- # see if --with-jikespg location is given on the command line
- #--------------------------------------------------------------------
-
- AC_ARG_WITH(jikespg, [ --with-jikespg=PROG location of jikes parser generator (optional)],
- JIKESPG=$withval, JIKESPG=NONE)
-
- if test "$JIKESPG" != "NONE"; then
- if test ! -f "$JIKESPG" || test ! -x "$JIKESPG"; then
- AC_MSG_ERROR([jikespg argument '$JIKESPG' is not a file or is not executable])
- fi
- else
- JIKESPG=jikespg
- fi
-
- #--------------------------------------------------------------------
- # see if --with-icc is given on the command line
- #--------------------------------------------------------------------
-
- AC_ARG_WITH(icc, [ --with-icc=PROG use the IBM Cset++ compiler, optional PROG can be given instead of searching on the PATH],
- DESIRED_CXX=$withval, DESIRED_CXX=NONE)
-
- if test "$DESIRED_CXX" != "NONE"; then
- if test "$DESIRED_CXX" = yes; then
- AC_PATH_PROG(CXX, icc)
-
- if test "$CXX" = ""; then
- AC_PATH_PROG(CXX, xlC)
-
- if test "$CXX" = ""; then
- AC_MSG_ERROR([could not find icc or xlC on your PATH.])
- fi
- fi
- fi
-
- if test ! -f "$CXX" || test ! -x "$CXX"; then
- AC_MSG_ERROR([argument '$CXX' is not a file or is not executable])
- fi
-
- CXX_NAME=icc
- CXXREQUIREDFLAGS="-c -DICC"
- CXXOPTFLAGS="-O2"
- CXXDEBUGFLAGS="-DTEST"
- LD=$CXX
- LDDEBUGFLAGS="-g"
- LDFLAGS='-L. -o $(EXECUTABLE)'
- fi
-
- #--------------------------------------------------------------------
- # see if --with-CC is given on the command line
- #--------------------------------------------------------------------
-
- AC_ARG_WITH(CC, [ --with-CC=PROG use the AT&T CC compiler, optional PROG can be given instead of searching on the PATH],
- DESIRED_CXX=$withval, DESIRED_CXX=NONE)
-
- if test "$DESIRED_CXX" != "NONE"; then
- if test "$DESIRED_CXX" = yes; then
- AC_PATH_PROG(CXX, CC)
- if test "$CXX" = ""; then
- AC_MSG_ERROR([could not find CC on your PATH.])
- fi
- fi
-
- if test ! -f "$CXX" || test ! -x "$CXX"; then
- AC_MSG_ERROR([argument '$CXX' is not a file or is not executable])
- fi
-
- CXX_NAME=CC
-
- CXXREQUIREDFLAGS="-c -ansi"
- CXXOPTFLAGS="-fast"
- CXXDEBUGFLAGS="-DTEST -g -xs"
- LD=$CXX
- LDDEBUGFLAGS="-g"
- LDFLAGS='-L. -o $(EXECUTABLE)'
- fi
-
- #--------------------------------------------------------------------
- # see if --with-mingwin is given on the command line
- #--------------------------------------------------------------------
-
- AC_ARG_WITH(mingwin, [ --with-mingwin use the mingwin32 compiler environment],
- WITH_MINGWIN=$withval, WITH_MINGWIN=0)
-
- #--------------------------------------------------------------------
- # If no other compiler was given as a --with option then we use default
- #--------------------------------------------------------------------
-
- if test "$CXX_NAME" = ""; then
- CXX_NAME="$CXX"
-
- CXXREQUIREDFLAGS="-c"
- if test "$WITH_MINGWIN" = "0"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -ansi"
- fi
- CXXOPTFLAGS="-O2"
- CXXDEBUGFLAGS="-DTEST -g"
- LD="$CXX"
- LDDEBUGFLAGS="-g"
- LDFLAGS='-L. -o $(EXECUTABLE)'
-
- if test "$GXX" != "yes"; then
- LIBS="$LIBS -lm"
- fi
- fi
-
- #--------------------------------------------------------------------
- # Do some extra work to find the mingwin include files in case
- # that mingwin can not find them on its own.
- #--------------------------------------------------------------------
-
- if test "$WITH_MINGWIN" != "0"; then
- AC_PATH_PROG(TMP_PROG, c++)
- if test "$TMP_PROG" = ""; then
- AC_MSG_ERROR([Could not find c++ on the PATH])
- fi
-
- CYGROOT=`dirname $TMP_PROG`
- CYGROOT=`dirname $CYGROOT`
- if test "${CYGROOT}" = "/"; then
- CYGROOT=
- fi
-
- MING_INCLUDE=`ls ${CYGROOT}/*/include/*/direct.h`
-
- if test "$MING_INCLUDE" != ""; then
- MING_INCLUDE=`dirname $MING_INCLUDE`
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -I$MING_INCLUDE"
- CXXFLAGS="$CXXFLAGS -I$MING_INCLUDE"
- fi
- fi
-
-
- # echo the compiler we are using
-
- AC_MSG_CHECKING([for the compiler to use])
- AC_MSG_RESULT([$CXX.])
-
-
- # Figure out what platform we are running on so that we know
- # what flags to give to the compiler
-
-
- # Keep case statements in alphabetical order.
- case "`uname -s`" in
- AIX)
- if test $CXX_NAME = "icc"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -langlvl=ansi -qnotempinc -+ -qinlglue"
- CXXDEBUGFLAGS="$CXXDEBUGFLAGS -g"
- fi
-
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX"
- LDFLAGS="$LDFLAGS $LDDEBUGFLAGS"
- ;;
- FreeBSD)
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX -DIEEE_DIV_0 -DGNU_LIBC5"
-
- if test $GXX = "yes"; then
- CXXREQUIREDFLAGS="-funsigned-char $CXXREQUIREDFLAGS"
- fi
-
- # Check byte-order
- case "`uname -m`" in
- alpha)
- ;;
- i?86)
- ;;
- *)
- AC_MSG_ERROR([FreeBSD arch '`uname -m`' not supported.])
- ;;
- esac
- ;;
- HP-UX)
- if test $GXX = "yes"; then
- CXXREQUIREDFLAGS="-funsigned-char $CXXREQUIREDFLAGS"
- fi
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX -D_INCLUDE_POSIX_SOURCE"
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DSTAT_POSIX_1"
- LDFLAGS="$LDDEBUGFLAGS $LDFLAGS -lstdc++"
- ;;
- IRIX)
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX "
- if test $GAS != "yes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -mmips-as"
- fi
- ;;
- GNU)
- # Basically the same as for Linux but we are sure to use GNU libc6
- # and the HURD only runs on i386
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX"
-
- if test $GXX = "yes"; then
- CXXREQUIREDFLAGS="-funsigned-char $CXXREQUIREDFLAGS"
- fi
-
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DSTAT_POSIX"
- ;;
- Linux)
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX"
-
- if test $GXX = "yes"; then
- CXXREQUIREDFLAGS="-funsigned-char $CXXREQUIREDFLAGS"
- fi
-
- # test to see if we are using libc5 or gnulib5 (libc6)
- if test -f /lib/libc.so.5 && test ! -f /lib/libc.so.6; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DGNU_LIBC5"
- else
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DSTAT_POSIX"
- fi
- ;;
- OS2)
- if test $CXX_NAME = icc; then
- O=obj
- CXXREQUIREDFLAGS="-Tdp -G5 $CXXREQUIREDFLAGS -DUNIX_FILE_SYSTEM -Dcerr=cout"
- CXXOPTFLAGS="$CXXOPTFLAGS -Tdp -O -DNDEBUG"
- CXXDEBUGFLAGS="$CXXDEBUGFLAGS -Ti"
- LDDEBUGFLAGS="/Ti+"
- LDFLAGS="$LDFLAGS /O:\$(EXECUTABLE) /PM:VIO /STACK:400000 /NOE"
-
- # link to an obj file in the icc directory
- TMP=$CXX
- TMP=`dirname $TMP`
- TMP=`dirname $TMP`
- SYSOBJECTS="$TMP\\lib\\setargv.obj"
- fi
- ;;
- OSF1)
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX"
- ;;
- SunOS)
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX"
-
- if test $CXX_NAME = "icc"; then
- CXXREQUIREDFLAGS="-langlvl=ansi -+ -qnotempinc $CXXREQUIREDFLAGS"
- CXXOPTFLAGS="$CXXOPTFLAGS -O3 -qstrict"
- CXXDEBUGFLAGS="$CXXDEBUGFLAGS -g"
- LDFLAGS="$LDFLAGS -Bstatic"
- else
- if test $GXX = "yes"; then
- CXXREQUIREDFLAGS="-funsigned-char $CXXREQUIREDFLAGS"
- fi
- fi
- ;;
- *CYGWIN*)
- if test $WITH_MINGWIN = "0"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DUNIX -DCYGWIN"
- else
- # FIXME: buggy mingwin will not link to msvcrtd.dll
- LIBS="$LIBS -lmsvcrt"
- #if test "$DEBUG_SYMBOLS" = "yes"; then
- # LIBS="$LIBS -lmsvcrtd"
- #else
- # LIBS="$LIBS -lmsvcrt"
- #fi
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -mno-cygwin -DMINGWIN -DWIN32_FILE_SYSTEM"
- LDFLAGS="$LDFLAGS -mno-cygwin"
-
- # We also need to set CXXFLAGS so that tests below use these flags
- CXXFLAGS="$CXXFLAGS -mno-cygwin"
- fi
-
- if test $GXX = "yes"; then
- CXXREQUIREDFLAGS="-funsigned-char $CXXREQUIREDFLAGS"
- fi
-
- # FIXME : workaround for bug in AC_EXEEXT macro
- EXEEXT=.exe
-
- ;;
- AmigaOS)
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DBIGENDIAN -Dstat=mystat -Dfopen=myfopen -Dopendir=myopendir -Dmkdir=mymkdir"
- SYSOBJECTS="GG:lib/libnix/swapstack.o -noixemul"
- case "$CC_NAME" in
- ?++)
- CXXREQUIREDFLAGS="-funsigned-char $CXXREQUIREDFLAGS"
- ;;
- esac
- ;;
- *)
- AC_MSG_ERROR([platform '`uname -s`' is not supported.])
- ;;
- esac
-
-
- #--------------------------------------------------------------------
- # Check for endianness
- #--------------------------------------------------------------------
- AC_C_BIGENDIAN
-
- #--------------------------------------------------------------------
- # see if "bool" is a builtin type
- #--------------------------------------------------------------------
-
- AC_CACHE_CHECK(builtin bool type, jikes_cv_has_bool,
- AC_TRY_COMPILE([],[bool some_boolean_value = true;],
- jikes_cv_has_bool=yes, jikes_cv_has_bool=no))
- if test "x$jikes_cv_has_bool" = "xyes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_BOOL"
- fi
-
- #--------------------------------------------------------------------------
- # Check for broken USHRT_MAX (under Mingwin and maybe some other systems
- #--------------------------------------------------------------------------
-
- AC_CACHE_CHECK(for broken ushrt_max, jikes_cv_ushrt_max_is_broken,
- AC_TRY_COMPILE([
- #include <limits.h>
- #if ! (USHRT_MAX == 0xFFFF)
- int hi=0;
- #endif
- ],[return 0;],
- jikes_cv_ushrt_max_is_broken=no, jikes_cv_ushrt_max_is_broken=yes))
- if test "$jikes_cv_ushrt_max_is_broken" = "yes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DBROKEN_USHRT_MAX"
- fi
-
- #----------------------------------------------------------------------------------
- # Check for some headers which are not present on all supported platforms
- #----------------------------------------------------------------------------------
- AC_CHECK_HEADERS(wchar.h)
-
- #--------------------------------------------------------------------
- # Check for wint_t in wchar.h (broken on linux libc5, cygwin, maybe others?)
- #--------------------------------------------------------------------
- AC_CACHE_CHECK(for wint_t in wchar.h, jikes_cv_has_wint_t,
- AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- ],[wint_t foo;],
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_WINT_T"
- jikes_cv_has_wint_t=yes,
- jikes_cv_has_wint_t=no))
-
- if test $jikes_cv_has_wint_t = "no"; then
- AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- typedef unsigned int wint_t;
- ],[wint_t foo;],
- ,
- AC_MSG_ERROR([Can't fix broken wchar.h]))
- fi
-
- #--------------------------------------------------------------------
- # Check for wcs functions in wchar.h or string.h
- # We want to treat "implicit declaration of function" types of
- # warnings as errors here because g++ does not do that by itself.
- #--------------------------------------------------------------------
-
- ac_saved_cxx_flags=$CXXFLAGS
- if test $GXX = "yes"; then
- CXXFLAGS="$CXXFLAGS -Werror"
- fi
-
- AC_CACHE_CHECK([for declaration of wcslen],
- ac_cv_declared_wcslen,
- [AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #include <string.h>
- ], [ wcslen(NULL) ],
- ac_cv_declared_wcslen=yes, ac_cv_declared_wcslen=no)
- ])
- if test "x$ac_cv_declared_wcslen" = "xyes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_WCSLEN"
- fi
-
- AC_CACHE_CHECK([for declaration of wcscpy],
- ac_cv_declared_wcscpy,
- [AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #include <string.h>
- ], [ wcscpy(NULL, NULL) ],
- ac_cv_declared_wcscpy=yes, ac_cv_declared_wcscpy=no)
- ])
- if test "x$ac_cv_declared_wcscpy" = "xyes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_WCSCPY"
- fi
-
- AC_CACHE_CHECK([for declaration of wcsncpy],
- ac_cv_declared_wcsncpy,
- [AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #include <string.h>
- ], [ wcsncpy(NULL, NULL, 0) ],
- ac_cv_declared_wcsncpy=yes, ac_cv_declared_wcsncpy=no)
- ])
- if test "x$ac_cv_declared_wcsncpy" = "xyes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_WCSNCPY"
- fi
-
- AC_CACHE_CHECK([for declaration of wcscat],
- ac_cv_declared_wcscat,
- [AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #include <string.h>
- ], [ wcscat(NULL, NULL) ],
- ac_cv_declared_wcscat=yes, ac_cv_declared_wcscat=no)
- ])
- if test "x$ac_cv_declared_wcscat" = "xyes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_WCSCAT"
- fi
-
- AC_CACHE_CHECK([for declaration of wcscmp],
- ac_cv_declared_wcscmp,
- [AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #include <string.h>
- ], [ wcscmp(NULL, NULL) ],
- ac_cv_declared_wcscmp=yes, ac_cv_declared_wcscmp=no)
- ])
- if test "x$ac_cv_declared_wcscmp" = "xyes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_WCSCMP"
- fi
-
- AC_CACHE_CHECK([for declaration of wcsncmp],
- ac_cv_declared_wcsncmp,
- [AC_TRY_COMPILE([
- #ifdef HAVE_WCHAR_H
- # include <wchar.h>
- #endif
- #include <string.h>
- ], [ wcsncmp(NULL, NULL, 0) ],
- ac_cv_declared_wcsncmp=yes, ac_cv_declared_wcsncmp=no)
- ])
- if test "x$ac_cv_declared_wcsncmp" = "xyes"; then
- CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_WCSNCMP"
- fi
-
- CXXFLAGS=$ac_saved_cxx_flags
-
- #--------------------------------------------------------------------
- # Check if "IBM Classes for UNICODE library is present
- #--------------------------------------------------------------------
- ac_saved_ld_flags=$LDFLAGS
- LDFLAGS=
- AC_CHECK_LIB(icu-uc,ucnv_getDefaultName, CXXREQUIREDFLAGS="$CXXREQUIREDFLAGS -DHAVE_LIB_ICU_UC"; LIBS="$LIBS -licu-uc")
- LDFLAGS=$ac_saved_ld_flags
-
- #--------------------------------------------------------------------
- # Check for java runtime and compiler
- #--------------------------------------------------------------------
-
- # First check for SUN javac
- AC_CHECK_PROG(JAVAC, javac , javac, NONE)
- if test "$JAVAC" != "NONE"; then
- DO=NOTHING
- else
- # if SUN javac not found, check for jikes
- AC_CHECK_PROG(JAVAC, jikes , jikes, NONE)
- # no specific flags for jikes
- if test "$JAVAC" != "NONE"; then
- DO=NOTHING
- else
- AC_MSG_WARN([Could not find javac or jikes on the path, you may want to
- compile gencode.java and run it on your own.])
- fi
- fi
-
- AC_CHECK_PROG(JAVA, java , java, NONE)
- if test "$JAVA" != "NONE"; then
- # We need to create code.h and code.cpp in srcdir not the
- # build dir because the Makefile looks for them in srcdir
- here=`pwd`
- cd ${srcdir}
- $JAVAC gencode.java
- CLASSPATH=. ; export CLASSPATH
- $JAVA gencode
- cd ${here}
- fi
-
-
- # The OBJEXT and EXEEXT variables are set in the AC_OBJEXT
- # and AC_EXEEXT macros.
-
- ERASE="rm -f"
- O=${OBJEXT}
- EXECUTABLE=jikes${EXEEXT}
-
- #--------------------------------------------------------------------
- # see if --enable-debug was given, if so use debug symbols
- #--------------------------------------------------------------------
-
- AC_ARG_ENABLE(debug, [ --enable-debug build with debugging symbols],
- [DEBUG_SYMBOLS=$enableval], [DEBUG_SYMBOLS=no])
-
- if test "x$DEBUG_SYMBOLS" = "xyes"; then
- CXXFLAGS='$(CXXREQUIREDFLAGS) $(CXXDEBUGFLAGS)'
- else
- CXXFLAGS='$(CXXREQUIREDFLAGS) $(CXXOPTFLAGS)'
- LDFLAGS="-s $LDFLAGS"
- fi
-
- # Subst variables into Makefile.in to produce the Makefile
-
- BUILD_DIR=`pwd`
- AC_SUBST(BUILD_DIR)
-
- AC_SUBST(CXX)
- AC_SUBST(CXXREQUIREDFLAGS)
- AC_SUBST(CXXDEBUGFLAGS)
- AC_SUBST(CXXOPTFLAGS)
- AC_SUBST(CXXFLAGS)
- AC_SUBST(ERASE)
- AC_SUBST(EXECUTABLE)
- AC_SUBST(LD)
- AC_SUBST(LDFLAGS)
- AC_SUBST(O)
- AC_SUBST(SYSOBJECTS)
- AC_SUBST(LIBS)
-
- AC_OUTPUT([Makefile])
-