dnl * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * dnl * This source file is part of SableVM. * dnl * * dnl * See the file "LICENSE" for the copyright information and for * dnl * the terms and conditions for copying, distribution and * dnl * modification of this source file. * dnl * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * AC_INIT([sablevm], [staging+]esyscmd([svn info | grep ^Revision: | awk '{print $2}' | head -n 1 | xargs echo -n]), [http://www.sablevm.org/]) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(src/include/config.h) AC_CONFIG_SRCDIR([src/sablevm/sablevm.c]) AC_SUBST(LIBRELEASE, ["]AC_PACKAGE_VERSION["]) AC_SUBST(RELEASE, AC_PACKAGE_VERSION) AC_DEFINE_UNQUOTED(_SABLEVM_PACKAGE_NAME, "AC_PACKAGE_TARNAME", package name) AC_DEFINE_UNQUOTED(_SABLEVM_PACKAGE_VERSION, "AC_PACKAGE_VERSION", package version) AC_DEFINE(_REENTRANT,1,link with reentrant library functions) AC_DEFINE(_POSIX_C_SOURCE,199506L,link with POSIX library functions) dnl should be defined on a finer grain. AC_DEFINE(_XOPEN_SOURCE,500,link with XOpen library functions) dnl *** uncomment if you want to insert a magic value in every object instance for debugging *** dnl AC_DEFINE(MAGIC,1,put "SableVM" in every instance) dnl *** uncomment to print some statistics on VM exit *** dnl AC_DEFINE(STATISTICS,1,print statistics on VM exit) dnl *** uncomment to get verbose instructions with inlined engine *** dnl AC_DEFINE(_SABLEVM_VERBOSE_INSTRUCTIONS_INLINED,1,Verbose instructions with inlined engine) AC_DISABLE_STATIC AC_CANONICAL_HOST case $host in sparc-sun-solaris*) AC_DEFINE(_XPG4_2,1,add common BSD extensions) ;; *) ;; esac dnl "real life" brokenness options AC_ARG_ENABLE(real-life-brokenness, [ --enable-real-life-brokenness enable things we don't support well and/or we don't want to support (because of their broken nature)], [real_life_brokenness=$enableval], [real_life_brokenness=yes]) case "$real_life_brokenness" in yes) AC_DEFINE(_SABLEVM_REAL_LIFE_BROKENNESS,1,Enable things we don't support well or don't want to support) ;; no) ;; *) AC_MSG_ERROR("bad value \"${real_life_brokenness}\"for --enable-real-life-brokenness") ;; esac dnl inlinability testing (special mode - not for normal usage) AC_ARG_ENABLE(inlinability-testing, [ --enable-inlinability-testing special mode to catch non-inlinable instructions], [enable_inlinability_testing=$enableval], [enable_inlinability_testing=no]) case "$enable_inlinability_testing" in yes) AC_SUBST(inlinability_testing,"-Dm4svm_inlinability_testing_mode=1") AC_DEFINE(_SABLEVM_INLINABILITY_TESTING,1,turn on inlinability testing mode machinery) ;; no) AC_SUBST(inlinability_testing,"") ;; *) AC_MSG_ERROR("bad value \"${enable_inlinability_testing}\"for --enable-inlinability-testing") ;; esac dnl debugging features AC_ARG_ENABLE(debugging-features, [ --enable-debugging-features add compiler and runtime checks],, [enable_debugging_features=no]) case "$enable_debugging_features" in no) AC_DEFINE(NDEBUG,1,turn off runtime assertions) ;; yes) ;; *) AC_MSG_ERROR("bad value \"${enable_debugging_features}\" for --enable-debugging-features") ;; esac dnl signals for exceptions AC_ARG_ENABLE(signals-for-exceptions, [ --disable-signals-for-exceptions do not use signals to detect some exceptions (NullPointerException, ArithmeticException, etc.)],, [if test "$enable_debugging_features" = no; then case $host in alpha*-gnu) enable_signals_for_exceptions=yes ;; arm*-gnu) enable_signals_for_exceptions=yes ;; hppa*-gnu) enable_signals_for_exceptions=no ;; i*86-*-gnu) enable_signals_for_exceptions=yes ;; i386-*-freebsd*)enable_signals_for_exceptions=yes ;; ia64*) enable_signals_for_exceptions=yes ;; m68k*-gnu) enable_signals_for_exceptions=yes ;; powerpc-*-gnu) enable_signals_for_exceptions=yes ;; powerpc-apple-darwin*) enable_signals_for_exceptions=no ;; sparc*-gnu) enable_signals_for_exceptions=yes ;; s390*-gnu) enable_signals_for_exceptions=yes ;; *) enable_signals_for_exceptions=no ;; esac else enable_signals_for_exceptions=no fi]) dnl garbage collection AC_ARG_WITH(gc, [ --with-gc=TYPE use given garbage collector (none,copying,gencopy)],, [with_gc=copying]) case "$with_gc" in none) AC_DEFINE(_SABLEVM_NO_GC,1,no collector) ;; copying) AC_DEFINE(_SABLEVM_COPY_GC,1,copying collector) ;; gencopy) AC_DEFINE(_SABLEVM_GENCOPY_GC,1,generational copying collector) ;; *) AC_MSG_ERROR(bad value \"${with_gc}\" for --with-gc) ;; esac dnl object layout AC_ARG_WITH(obj-layout, [ --with-obj-layout=TYPE use given object layout (bidirectional,traditional)],, [with_obj_layout=bidirectional]) case "$with_obj_layout" in traditional) AC_DEFINE(_SABLEVM_TRADITIONAL_OBJECT_LAYOUT,1,traditional object layout) ;; bidirectional) AC_DEFINE(_SABLEVM_BIDIRECTIONAL_OBJECT_LAYOUT,1,bidirectional object layout) ;; *) AC_MSG_ERROR(bad value \"${with_obj_layout}\" for --with-obj-layout) ;; esac dnl threading flavor AC_ARG_WITH(threading, [ --with-threading=TYPE use given interpreter threading flavor (inlined,direct,switch)],, [if test "$enable_debugging_features" = no; then case $host in alpha*-gnu) with_threading=inlined ;; arm*-gnu) with_threading=direct ;; hppa*-gnu) with_threading=direct ;; i*86-*-gnu) with_threading=inlined ;; ia64*) with_threading=inlined ;; m68k*-gnu) with_threading=inlined ;; powerpc-*) with_threading=inlined ;; sparc*-gnu) with_threading=inlined ;; s390*-gnu) with_threading=direct ;; x86_64*-gnu) with_threading=direct ;; *) with_threading=direct ;; esac else with_threading=switch fi if test "$enable_inlinability_testing" = yes; then with_threading=inlined fi]) case "$with_threading" in switch) AC_DEFINE(_SABLEVM_SWITCH_THREADED_INTERPRETER,1,switch threaded interpreter) ;; direct) AC_DEFINE(_SABLEVM_DIRECT_THREADED_INTERPRETER,1,direct threaded interpreter) ;; inlined) AC_DEFINE(_SABLEVM_INLINED_THREADED_INTERPRETER,1,inlined threaded interpreter) ;; *) AC_MSG_ERROR(bad value \"${with_threading}\" for --with-threading) ;; esac dnl NO block reordering - disable (manually!) w/ gcc < 3.0, auto enable if inlined AC_ARG_ENABLE(no-reorder-blocks, [ --disable-no-reorder-blocks do not use -fno-reorder-blocks (useful with gcc 2.95)], [enable_no_reorder_blocks=$enableval], [if test "$with_threading" = inlined; then enable_no_reorder_blocks=yes fi]) dnl errors on warnings AC_ARG_ENABLE(errors-on-warnings, [ --disable-errors-on-warnings do not issue an error on warnings],, [enable_errors_on_warnings=yes]) dnl profiling settings AC_ARG_WITH(profiling, [ --with-profiling=TYPE enable profiling (nostatic,gprof)],, [ with_profiling=no]) case "$with_profiling" in no) AC_DEFINE(svm_static,static,[(do not) make internal functions static]) ;; yes|nostatic) AC_DEFINE(svm_static,,[(do not) make internal functions static]) ;; gprof) AC_DEFINE(svm_static,,[(do not) make internal functions static]) CFLAGS="$CFLAGS -pg" ;; *) AC_MSG_ERROR(bad value \"${with_profiling}\" for --with-profiling) ;; esac dnl Checks for programs. AC_PROG_AWK AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL dnl Checks for libraries. LIBSVMINCLUDE="-lm -lffi -lltdl -lz" AC_CHECK_LIB(ffi,ffi_prep_cif,echo -n,echo ***ERROR: libffi is missing; exit 1) AC_CHECK_LIB(ltdl,lt_dlinit,echo -n,echo ***ERROR: libltdl is missing; exit 1) AC_CHECK_LIB(m,fmod,echo -n,echo ***ERROR: libm is missing; exit 1) AC_CHECK_LIB(popt,poptGetContext,echo -n,echo ***ERROR: libpopt is missing; exit 1) AC_CHECK_LIB(z,inflate,echo -n,echo ***ERROR: zlib/libz is missing; exit 1) dnl Check if -lrt is needed case $host in *-sun-solaris*) dnl we should call AC_CHECK_LIB here, but what symbol should we look up? LIBSVMINCLUDE="$LIBSVMINCLUDE -lrt" ;; *) ;; esac dnl Check what is the right library for threads case $host in *-freebsd*) dnl No thread library to link ;; *) AC_CHECK_LIB(pthread,pthread_self,echo -n,echo ***ERROR: libpthread is missing; exit 1) LIBSVMINCLUDE="$LIBSVMINCLUDE -lpthread" ;; esac AC_SUBST(LIBSVMINCLUDE, $LIBSVMINCLUDE) dnl Check whether -no-undefined is required case "$host" in *-*-mingw*|*-*-cygwin*) AC_SUBST(NO_UNDEFINED, -no-undefined) ;; *) ;; esac dnl Check which m4 we should use if test "x$M4" = "x"; then AC_PATH_PROG(M4, "gm4") if test "x$M4" = "x"; then AC_PATH_PROG(M4, "m4") fi fi if test "x$M4" = "x"; then AC_MSG_WARN('Unable to find operational m4 preprocessor. You might be unable to regenerate some source files.') M4=m4 else echo -n | $M4 -P || \ (AC_MSG_WARN('Unable to find operational GNU-compatible m4 preprocessor. You might be unable to regenerate some source files.') ) fi AC_SUBST(M4) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([errno.h fcntl.h stdlib.h string.h sys/time.h unistd.h ctype.h], echo -n,echo ***ERROR: missing header file; exit 1) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T AC_HEADER_TIME AC_CHECK_TYPE(siginfo_t, has_siginfo=yes; AC_DEFINE(_SABLEVM_HAS_SIGINFO, 1, siginfo_t is supported), has_siginfo=no, [ #include ]) dnl Handle signals for exceptions based on the availability of siginfo_t. if test "$has_siginfo" = no; then enable_signals_for_exceptions=no AC_MSG_WARN([siginfo is not available; use of signals has been disabled]) fi case "$enable_signals_for_exceptions" in no) ;; yes) AC_DEFINE(_SABLEVM_SIGNALS_FOR_EXCEPTIONS,1,use signals to detect exceptions) ;; *) AC_MSG_ERROR(bad value \"${enable_signals_for_exceptions}\" for --enable-signals-for-exceptions) ;; esac dnl Checks for library functions. if test x$cross_compiling = xno ; then AC_FUNC_MALLOC fi AC_FUNC_MMAP AC_CHECK_FUNCS([getcwd gettimeofday memmove memset munmap strchr], echo -n,echo ***ERROR: missing library function; exit 1) dnl GCC specific options if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall -fno-gcse -fno-strict-aliasing" if test "$enable_no_reorder_blocks" = "yes"; then CFLAGS="$CFLAGS -fno-reorder-blocks -finline-limit=60000" fi dnl -fverbose-asm -save-temps -fstack-check -funroll-loops dnl CFLAGS="$CFLAGS -fverbose-asm -save-temps" if test "$with_threading" = "switch"; then CFLAGS="$CFLAGS -std=iso9899:1990 -pedantic" fi if test "$enable_debugging_features" = "yes"; then if test "$enable_errors_on_warnings" = "yes"; then CFLAGS="$CFLAGS -Werror" fi CFLAGS="$CFLAGS -O0 -W \ -fno-builtin -Wshadow \ -Wpointer-arith -Wbad-function-cast \ -Wundef -Wcast-align -Wwrite-strings \ -Wsign-compare -Wstrict-prototypes \ -Wmissing-prototypes \ -Wmissing-declarations \ -Wnested-externs -Wlong-long" elif test "$enable_errors_on_warnings" = "yes"; then enforce_errors_on_warnings=no case $PACKAGE_VERSION in staging*) case $host in i*86*-*-gnu) enforce_errors_on_warnings=yes ;; powerpc-*-gnu) enforce_errors_on_warnings=yes ;; esac ;; esac if test "$enforce_errors_on_warnings" = "yes"; then CFLAGS="$CFLAGS -Werror" fi fi case $host in powerpc-apple-darwin*) CFLAGS="$CFLAGS -no-cpp-precomp" CPPFLAGS="$CPPFLAGS -D__powerpc__" ;; esac case $host in *-freebsd*) dnl SableVM in FreeBSD ports has all three: dnl -D__XSI_VISIBLE -D__BSD_VISIBLE -D_P1003_1B_VISIBLE dnl however -D__BSD_VISIBLE seems sufficient CFLAGS="$CFLAGS -pthread -D__BSD_VISIBLE" ;; esac fi dnl Try to detect __clear_cache availability dnl TODO: There are auto*tools M4 macros to do it nicely. No need for such mess like below. echo "$as_me:$LINENO: checking for __clear_cache" >&5 echo $ECHO_N "checking for __clear_cache... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF #include extern void __clear_cache (char *beg, char *end); int main(void) { int i; __clear_cache(&i, (&i)+sizeof(i)); return 0; } _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then system_clear_cache=no echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 else system_clear_cache=yes echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 fi else system_clear_cache=no echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi dnl TODO: we should allow user to force if the __clear_cache was used or not case "$system_clear_cache" in yes)AC_DEFINE(HAS_SYSTEM_CLEAR_CACHE,1,use __clear_cache) ;; *) ;; esac dnl -Wid-clash-LEN -Wlarger-than-LEN -Wredundant-decls -Wconversion -Wcast-qual dnl -Wmissing-noreturn -Wtraditional -Waggregate-return -ansi -pedantic -Wunreachable-code AC_CONFIG_FILES([ Makefile doc/Makefile doc/java-sablevm.1 doc/sablevm.1 src/Makefile src/include/Makefile src/libsablevm/Makefile src/libsablevm/include/Makefile src/libsablevm/inlinability/Makefile src/sablevm/Makefile ]) AC_OUTPUT