dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl email address for reporting bugs.
-AC_INIT([[llvm]],[[2.1cvs]],[llvmbugs@cs.uiuc.edu])
+AC_INIT([[llvm]],[[2.2svn]],[llvmbugs@cs.uiuc.edu])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
llvm-poolalloc) AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
+ poolalloc) AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
*)
AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
alpha*-*) llvm_cv_target_arch="Alpha" ;;
ia64-*) llvm_cv_target_arch="IA64" ;;
arm-*) llvm_cv_target_arch="ARM" ;;
+ mips-*) llvm_cv_target_arch="Mips" ;;
*) llvm_cv_target_arch="Unknown" ;;
esac])
Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;;
IA64) AC_SUBST(TARGET_HAS_JIT,0) ;;
ARM) AC_SUBST(TARGET_HAS_JIT,0) ;;
+ Mips) AC_SUBST(TARGET_HAS_JIT,0) ;;
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
esac
fi
[Build specific host targets: all,host-only,{target-name} (default=all)]),,
enableval=all)
case "$enableval" in
- all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM" ;;
+ all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips" ;;
host-only)
case "$llvm_cv_target_arch" in
x86) TARGETS_TO_BUILD="X86" ;;
Alpha) TARGETS_TO_BUILD="Alpha" ;;
IA64) TARGETS_TO_BUILD="IA64" ;;
ARM) TARGETS_TO_BUILD="ARM" ;;
+ Mips) TARGETS_TO_BUILD="Mips" ;;
*) AC_MSG_ERROR([Can not set target to build]) ;;
esac
;;
alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
ia64) TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;;
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
+ mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
esac
done
esac
AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS)
+dnl Allow specific bindings to be specified for building (or not)
+AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings],
+ [Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),,
+ enableval=default)
+BINDINGS_TO_BUILD=""
+case "$enableval" in
+ yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
+ all ) BINDINGS_TO_BUILD="ocaml" ;;
+ none | no) BINDINGS_TO_BUILD="" ;;
+ *)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
+ case "$a_binding" in
+ ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;;
+ *) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;;
+ esac
+ done
+ ;;
+esac
+
+dnl Allow the ocaml libdir to be overridden. This could go in a configure
+dnl script for bindings/ocaml/configure, except that its auto value depends on
+dnl OCAMLC, which is found here to support tests.
+AC_ARG_WITH([ocaml-libdir],
+ [AS_HELP_STRING([--with-ocaml-libdir],
+ [Specify install location for ocaml bindings (default is stdlib)])],
+ [],
+ [withval=auto])
+case "$withval" in
+ auto) with_ocaml_libdir="$withval" ;;
+ /* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;;
+ *) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
+esac
+
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 4: Check for programs we need and that they are the right version
AC_PATH_PROG(RUNTEST,[runtest],[echo "Skipped: runtest not found"])
DJ_AC_PATH_TCLSH
AC_PATH_PROG(ZIP,[zip],[echo "Skipped: zip not found"])
+AC_PATH_PROG(OCAMLC,[ocamlc],[echo "Skipped: ocamlc not found"])
+AC_PATH_PROG(OCAMLOPT,[ocamlopt],[echo "Skipped: ocamlopt not found"])
+AC_PATH_PROG(OCAMLDEP,[ocamldep],[echo "Skipped: ocamldep not found"])
dnl Determine if the linker supports the -R option.
AC_LINK_USE_R
[Define if dlopen(0) will open the symbols of the program])
fi
-dnl Check if we know how to tell etags we are using C++:
-etags_version=`$ETAGS --version 2>&1`
-case "$etags_version" in
- *[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
- *GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
- *) ETAGSFLAGS="" ;;
-esac
-AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
-
if test "$WITH_LLVMGCCDIR" = "default" ; then
LLVMGCC="llvm-gcc${EXEEXT}"
LLVMGXX="llvm-g++${EXEEXT}"
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h unistd.h utime.h])
-AC_CHECK_HEADERS([windows.h sys/mman.h sys/param.h sys/resource.h sys/time.h])
+AC_CHECK_HEADERS([windows.h])
+AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h])
AC_CHECK_HEADERS([sys/types.h malloc/malloc.h mach/mach.h])
if test "$ENABLE_THREADS" -eq 1 ; then
- AC_CHECK_HEADER(pthread.h,
+ AC_CHECK_HEADERS(pthread.h,
AC_SUBST(HAVE_PTHREAD, 1),
AC_SUBST(HAVE_PTHREAD, 0))
else
dnl===-----------------------------------------------------------------------===
AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ])
-AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday])
+AC_CHECK_FUNCS([powf fmodf strtof round ])
+AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup strerror strerror_r ])
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
dnl===
dnl===-----------------------------------------------------------------------===
+dnl Check, whether __dso_handle is present
+AC_CHECK_FUNCS([__dso_handle])
+
dnl See if the llvm-gcc executable can compile to LLVM assembly
AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
[llvm_cv_llvmgcc_sanity="no"
[Installation directory for libraries])
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
[Installation directory for data files])
-AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR",
+AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR",
[Installation directory for documentation])
AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
[Installation directory for config files])
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
[Time at which LLVM was configured])
+# Determine which bindings to build.
+if test "$BINDINGS_TO_BUILD" = auto ; then
+ BINDINGS_TO_BUILD=""
+ if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
+ BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
+ fi
+fi
+AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD)
+
+# This isn't really configurey, but it avoids having to repeat the list in
+# other files.
+AC_SUBST(ALL_BINDINGS,ocaml)
+
+# Do any work necessary to ensure that bindings have what they need.
+binding_prereqs_failed=0
+for a_binding in $BINDINGS_TO_BUILD ; do
+ case "$a_binding" in
+ ocaml)
+ if test "x$OCAMLC" = x ; then
+ AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc])
+ binding_prereqs_failed=1
+ fi
+ if test "x$OCAMLDEP" = x ; then
+ AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep])
+ binding_prereqs_failed=1
+ fi
+ if test "x$OCAMLOPT" = x ; then
+ AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt])
+ dnl ocamlopt is optional!
+ fi
+ if test "x$with_ocaml_libdir" != xauto ; then
+ AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir)
+ else
+ ocaml_stdlib="`"$OCAMLC" -where`"
+ if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
+ then
+ # ocaml stdlib is beneath our prefix; use stdlib
+ AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib)
+ else
+ # ocaml stdlib is outside our prefix; use libdir/ocaml
+ AC_SUBST(OCAML_LIBDIR,$LLVM_LIBDIR/ocaml)
+ fi
+ fi
+ ;;
+ esac
+done
+if test "$binding_prereqs_failed" = 1 ; then
+ AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.])
+fi
+
+
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 10: Specify the output files and generate it
AC_CONFIG_MAKEFILE(tools/Makefile)
AC_CONFIG_MAKEFILE(utils/Makefile)
AC_CONFIG_MAKEFILE(projects/Makefile)
+AC_CONFIG_MAKEFILE(bindings/Makefile)
+AC_CONFIG_MAKEFILE(bindings/ocaml/Makefile.ocaml)
dnl Finally, crank out the output
AC_OUTPUT