dnl * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * dnl * This file is part of SableVM. * dnl * See the file "LICENSE" for Copyright information and the * dnl * terms and conditions for copying, distribution and * dnl * modification of SableVM. * 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(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION) AM_CONFIG_HEADER(src/include/config.h) AC_CONFIG_SRCDIR([src/sablevm/sablevm.c]) AC_SUBST(LIBRELEASE, ["staging+]esyscmd([svn info | grep ^Revision: | awk '{print $2}' | head -n 1 | xargs echo -n])["]) 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 *** 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=no]) 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 *) enable_signals_for_exceptions=yes ;; esac else enable_signals_for_exceptions=no 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 garbage collection AC_ARG_WITH(gc, [ --with-gc=TYPE use given garbage collector (none,copying)],, [if test "$enable_debugging_features" = no; then with_gc=copying else with_gc=copying fi]) case "$with_gc" in none) AC_DEFINE(_SABLEVM_NO_GC,1,no collector) ;; copying) AC_DEFINE(_SABLEVM_COPY_GC,1,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)],, [if test "$enable_debugging_features" = no; then with_obj_layout=bidirectional else with_obj_layout=bidirectional fi]) 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 ;; *) 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 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 AM_PROG_LIBTOOL dnl Checks for libraries. 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(pthread,pthread_self,echo -n,echo ***ERROR: libpthread is missing; exit 1) 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 dnl Checks for library functions. AC_FUNC_MALLOC 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 -Wno-unused -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" fi case $host in powerpc-apple-darwin*) CFLAGS="$CFLAGS -no-cpp-precomp" CPPFLAGS="$CPPFLAGS -D__powerpc__" ;; esac fi dnl Try to detect __clear_cache availability 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 src/Makefile src/include/Makefile src/libsablevm/Makefile src/libsablevm/include/Makefile src/libsablevm/inlinability/Makefile src/sablevm/Makefile]) AC_OUTPUT