diff --git a/Makefile.config.in b/Makefile.config.in index 6d85a4e3062..4df270b379f 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -203,10 +203,7 @@ DOXYGEN := @DOXYGEN@ GROFF := @GROFF@ GZIPBIN := @GZIPBIN@ GO := @GO@ -OCAMLC := @OCAMLC@ -OCAMLOPT := @OCAMLOPT@ -OCAMLDEP := @OCAMLDEP@ -OCAMLDOC := @OCAMLDOC@ +OCAMLFIND := @OCAMLFIND@ GAS := @GAS@ POD2HTML := @POD2HTML@ POD2MAN := @POD2MAN@ @@ -218,6 +215,9 @@ HAVE_DLOPEN := @HAVE_DLOPEN@ HAVE_PTHREAD := @HAVE_PTHREAD@ HAVE_TERMINFO := @HAVE_TERMINFO@ +HAVE_OCAMLOPT := @HAVE_OCAMLOPT@ +HAVE_OCAML_OUNIT := @HAVE_OCAML_OUNIT@ + LIBS := @LIBS@ # Targets that are possible to build diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 618cf8b4db6..76d2f90269d 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -658,11 +658,11 @@ AC_ARG_ENABLE(clang-static-analyzer, enableval="yes") case "$enableval" in yes) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]) ;; - no) + no) if test ${clang_arcmt} != "no" ; then AC_MSG_ERROR([Cannot enable clang ARC Migration Tool while disabling static analyzer.]) fi - AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[0]) + AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[0]) ;; default) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]);; *) AC_MSG_ERROR([Invalid setting for --enable-clang-static-analyzer. Use "yes" or "no"]) ;; @@ -1288,10 +1288,7 @@ AC_PATH_PROG(GZIPBIN, [gzip]) AC_PATH_PROG(PDFROFF, [pdfroff]) AC_PATH_PROG(ZIP, [zip]) AC_PATH_PROG(GO, [go]) -AC_PATH_PROGS(OCAMLC, [ocamlc]) -AC_PATH_PROGS(OCAMLOPT, [ocamlopt]) -AC_PATH_PROGS(OCAMLDEP, [ocamldep]) -AC_PATH_PROGS(OCAMLDOC, [ocamldoc]) +AC_PATH_PROGS(OCAMLFIND, [ocamlfind]) AC_PATH_PROGS(GAS, [gas as]) dnl Get the version of the linker in use. @@ -1524,7 +1521,7 @@ AC_ARG_WITH(oprofile, fi ;; *) AC_MSG_ERROR([OProfile support is available on Linux only.]) ;; - esac + esac ], [ AC_SUBST(USE_OPROFILE, [0]) @@ -1869,7 +1866,7 @@ AC_DEFINE_UNQUOTED(LLVM_DEFAULT_TARGET_TRIPLE, "$target", dnl 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 + if test "x$OCAMLFIND" != x ; then BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" fi if test "x$GO" != x ; then @@ -1885,22 +1882,36 @@ 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]) + if test "x$OCAMLFIND" = x ; then + AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlfind not found. Try configure OCAMLFIND=/path/to/ocamlfind]) 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]) + + if $OCAMLFIND opt -version >/dev/null 2>/dev/null ; then + HAVE_OCAMLOPT=1 + else + HAVE_OCAMLOPT=0 + fi + AC_SUBST(HAVE_OCAMLOPT) + + if ! $OCAMLFIND query ctypes >/dev/null 2>/dev/null; then + AC_MSG_WARN([--enable-bindings=ocaml specified, but ctypes is not installed]) 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! + + if $OCAMLFIND query oUnit >/dev/null 2>/dev/null; then + HAVE_OCAML_OUNIT=1 + else + HAVE_OCAML_OUNIT=0 + AC_MSG_WARN([--enable-bindings=ocaml specified, but OUnit 2 is not installed. Tests will not run]) + dnl oUnit is optional! fi + AC_SUBST(HAVE_OCAML_OUNIT) + if test "x$with_ocaml_libdir" != xauto ; then AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir) else - ocaml_stdlib="`"$OCAMLC" -where`" + ocaml_stdlib="`"$OCAMLFIND" ocamlc -where`" if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~" then # ocaml stdlib is beneath our prefix; use stdlib diff --git a/bindings/ocaml/Makefile.ocaml b/bindings/ocaml/Makefile.ocaml index d069c454cd0..e466b2b2a90 100644 --- a/bindings/ocaml/Makefile.ocaml +++ b/bindings/ocaml/Makefile.ocaml @@ -20,8 +20,8 @@ include $(LEVEL)/Makefile.config # CFLAGS needs to be set before Makefile.rules is included. -CXX.Flags += -I"$(shell $(OCAMLC) -where)" -C.Flags += -I"$(shell $(OCAMLC) -where)" +CXX.Flags += -I"$(shell $(OCAMLFIND) c -where)" +C.Flags += -I"$(shell $(OCAMLFIND) c -where)" ifeq ($(ENABLE_SHARED),1) LINK_COMPONENTS := all @@ -55,7 +55,7 @@ endif endif # Tools -OCAMLCFLAGS += -I $(ObjDir) -I $(OcamlDir) +OCAMLCFLAGS += -I $(OcamlDir) ifndef IS_CLEANING_TARGET ifneq ($(ObjectsO),) OCAMLAFLAGS += $(patsubst %,-cclib %, \ @@ -73,9 +73,9 @@ ifneq ($(ENABLE_OPTIMIZED),1) OCAMLDEBUGFLAG := -g endif -Compile.CMI := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o) -Compile.CMO := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o) -Compile.CMX := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o) +Compile.CMI := $(strip $(OCAMLFIND) c -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o) +Compile.CMO := $(strip $(OCAMLFIND) c -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o) +Compile.CMX := $(strip $(OCAMLFIND) opt -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o) ifdef OCAMLSTUBS # Avoid the need for LD_LIBRARY_PATH @@ -87,26 +87,20 @@ endif endif ifdef OCAMLSTUBS -Archive.CMA := $(strip $(OCAMLC) -a -dllib -l$(LIBRARYNAME) $(OCAMLDEBUGFLAG) \ - -o) +Archive.CMA := $(strip $(OCAMLFIND) c -a -dllib -l$(LIBRARYNAME) $(OCAMLDEBUGFLAG) \ + -o) else -Archive.CMA := $(strip $(OCAMLC) -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \ - -o) +Archive.CMA := $(strip $(OCAMLFIND) c -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \ + -o) endif ifdef OCAMLSTUBS -Archive.CMXA := $(strip $(OCAMLOPT) -a $(patsubst %,-cclib %, \ +Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(patsubst %,-cclib %, \ $(LLVMLibsOptions) -l$(LIBRARYNAME) \ -L$(SharedLibDir) $(OCAMLRPATH)) \ $(OCAMLDEBUGFLAG) -o) else -Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o) -endif - -ifdef OCAMLOPT -Archive.EXE := $(strip $(OCAMLOPT) -cc $(CXX) $(OCAMLCFLAGS) $(UsedOcamlLibs:%=%.cmxa) $(OCAMLDEBUGFLAG) -o) -else -Archive.EXE := $(strip $(OCAMLC) -cc $(CXX) $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG:%=%.cma) -o) +Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o) endif # Source files @@ -190,7 +184,7 @@ $(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi) ifdef LIBRARYNAME $(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \ $(OcamlDir)/.dir $(ObjDir)/.dir - $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@ + $(Verb) $(OCAMLFIND) dep $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@ -include $(ObjDir)/$(LIBRARYNAME).ocamldep endif @@ -198,7 +192,7 @@ endif ifdef TOOLNAME $(ObjDir)/$(TOOLNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \ $(OcamlDir)/.dir $(ObjDir)/.dir - $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@ + $(Verb) $(OCAMLFIND) dep $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@ -include $(ObjDir)/$(TOOLNAME).ocamldep endif @@ -367,8 +361,8 @@ endif ##===- Build optimized ocaml archive (.ml's -> .cmx's -> .cmxa, .a) -------===## # The ocamlopt compiler is supported on a set of targets disjoint from LLVM's. -# If unavailable, 'configure' will not define OCAMLOPT in Makefile.config. -ifdef OCAMLOPT +# If unavailable, 'configure' will set HAVE_OCAMLOPT to 0 in Makefile.config. +ifeq ($(HAVE_OCAMLOPT),1) $(OcamlDir)/%.cmx: $(ObjDir)/%.cmx $(Verb) $(CP) -f $< $@ @@ -418,31 +412,11 @@ uninstall-cmxa:: endif endif -##===- Build executables --------------------------------------------------===## - -ifdef TOOLNAME -all-local:: $(OutputEXE) -clean-local:: clean-exe - -$(OutputEXE): $(ToolEXE) $(OcamlDir)/.dir - $(Verb) $(CP) -f $< $@ - -ifndef OCAMLOPT -$(ToolEXE): $(ObjectsCMO) $(OcamlDir)/.dir - $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" - $(Verb) $(Archive.EXE) $@ $(ObjectsCMO) -else -$(ToolEXE): $(ObjectsCMX) $(OcamlDir)/.dir - $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" - $(Verb) $(Archive.EXE) $@ $(ObjectsCMX) -endif -endif - ##===- Generate documentation ---------------------------------------------===## $(ObjDir)/$(LIBRARYNAME).odoc: $(ObjectsCMI) $(Echo) "Documenting $(notdir $@)" - $(Verb) $(OCAMLDOC) -I $(ObjDir) -I $(OcamlDir) -dump $@ $(OcamlHeaders) + $(Verb) $(OCAMLFIND) doc -I $(ObjDir) -I $(OcamlDir) -dump $@ $(OcamlHeaders) ocamldoc: $(ObjDir)/$(LIBRARYNAME).odoc @@ -453,9 +427,7 @@ printcamlvars:: $(Echo) "LLVM_CONFIG : " '$(LLVM_CONFIG)' $(Echo) "OCAMLCFLAGS : " '$(OCAMLCFLAGS)' $(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)' - $(Echo) "OCAMLC : " '$(OCAMLC)' - $(Echo) "OCAMLOPT : " '$(OCAMLOPT)' - $(Echo) "OCAMLDEP : " '$(OCAMLDEP)' + $(Echo) "OCAMLFIND : " '$(OCAMLFIND)' $(Echo) "Compile.CMI : " '$(Compile.CMI)' $(Echo) "Compile.CMO : " '$(Compile.CMO)' $(Echo) "Archive.CMA : " '$(Archive.CMA)' diff --git a/configure b/configure index c9373b55aea..79315117e54 100755 --- a/configure +++ b/configure @@ -753,10 +753,7 @@ GZIPBIN PDFROFF ZIP GO -OCAMLC -OCAMLOPT -OCAMLDEP -OCAMLDOC +OCAMLFIND GAS HAVE_LINK_VERSION_SCRIPT EGREP @@ -788,6 +785,8 @@ LLVM_INFODIR LLVM_MANDIR LLVM_CONFIGTIME BINDINGS_TO_BUILD +HAVE_OCAMLOPT +HAVE_OCAML_OUNIT OCAML_LIBDIR ENABLE_VISIBILITY_INLINES_HIDDEN RPATH @@ -6909,18 +6908,18 @@ echo "${ECHO_T}no" >&6; } fi -for ac_prog in ocamlc +for ac_prog in ocamlfind do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_OCAMLC+set}" = set; then +if test "${ac_cv_path_OCAMLFIND+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - case $OCAMLC in + case $OCAMLFIND in [\\/]* | ?:[\\/]*) - ac_cv_path_OCAMLC="$OCAMLC" # Let the user override the test with a path. + ac_cv_path_OCAMLFIND="$OCAMLFIND" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -6930,7 +6929,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_OCAMLC="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_OCAMLFIND="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -6941,152 +6940,17 @@ IFS=$as_save_IFS ;; esac fi -OCAMLC=$ac_cv_path_OCAMLC -if test -n "$OCAMLC"; then - { echo "$as_me:$LINENO: result: $OCAMLC" >&5 -echo "${ECHO_T}$OCAMLC" >&6; } +OCAMLFIND=$ac_cv_path_OCAMLFIND +if test -n "$OCAMLFIND"; then + { echo "$as_me:$LINENO: result: $OCAMLFIND" >&5 +echo "${ECHO_T}$OCAMLFIND" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi - test -n "$OCAMLC" && break -done - -for ac_prog in ocamlopt -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_OCAMLOPT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $OCAMLOPT in - [\\/]* | ?:[\\/]*) - ac_cv_path_OCAMLOPT="$OCAMLOPT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_OCAMLOPT="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - ;; -esac -fi -OCAMLOPT=$ac_cv_path_OCAMLOPT -if test -n "$OCAMLOPT"; then - { echo "$as_me:$LINENO: result: $OCAMLOPT" >&5 -echo "${ECHO_T}$OCAMLOPT" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$OCAMLOPT" && break -done - -for ac_prog in ocamldep -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_OCAMLDEP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $OCAMLDEP in - [\\/]* | ?:[\\/]*) - ac_cv_path_OCAMLDEP="$OCAMLDEP" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_OCAMLDEP="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - ;; -esac -fi -OCAMLDEP=$ac_cv_path_OCAMLDEP -if test -n "$OCAMLDEP"; then - { echo "$as_me:$LINENO: result: $OCAMLDEP" >&5 -echo "${ECHO_T}$OCAMLDEP" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$OCAMLDEP" && break -done - -for ac_prog in ocamldoc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_path_OCAMLDOC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $OCAMLDOC in - [\\/]* | ?:[\\/]*) - ac_cv_path_OCAMLDOC="$OCAMLDOC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_OCAMLDOC="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done -IFS=$as_save_IFS - - ;; -esac -fi -OCAMLDOC=$ac_cv_path_OCAMLDOC -if test -n "$OCAMLDOC"; then - { echo "$as_me:$LINENO: result: $OCAMLDOC" >&5 -echo "${ECHO_T}$OCAMLDOC" >&6; } -else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } -fi - - - test -n "$OCAMLDOC" && break + test -n "$OCAMLFIND" && break done for ac_prog in gas as @@ -18301,7 +18165,7 @@ _ACEOF if test "$BINDINGS_TO_BUILD" = auto ; then BINDINGS_TO_BUILD="" - if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then + if test "x$OCAMLFIND" != x ; then BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" fi if test "x$GO" != x ; then @@ -18317,25 +18181,39 @@ binding_prereqs_failed=0 for a_binding in $BINDINGS_TO_BUILD ; do case "$a_binding" in ocaml) - if test "x$OCAMLC" = x ; then - { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc" >&5 -echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc" >&2;} + if test "x$OCAMLFIND" = x ; then + { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlfind not found. Try configure OCAMLFIND=/path/to/ocamlfind" >&5 +echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlfind not found. Try configure OCAMLFIND=/path/to/ocamlfind" >&2;} binding_prereqs_failed=1 fi - if test "x$OCAMLDEP" = x ; then - { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep" >&5 -echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep" >&2;} + + if $OCAMLFIND opt -version >/dev/null 2>/dev/null ; then + HAVE_OCAMLOPT=1 + else + HAVE_OCAMLOPT=0 + fi + + + if ! $OCAMLFIND query ctypes >/dev/null 2>/dev/null; then + { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ctypes is not installed" >&5 +echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ctypes is not installed" >&2;} binding_prereqs_failed=1 fi - if test "x$OCAMLOPT" = x ; then - { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt" >&5 -echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt" >&2;} + + if $OCAMLFIND query oUnit >/dev/null 2>/dev/null; then + HAVE_OCAML_OUNIT=1 + else + HAVE_OCAML_OUNIT=0 + { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but OUnit 2 is not installed. Tests will not run" >&5 +echo "$as_me: WARNING: --enable-bindings=ocaml specified, but OUnit 2 is not installed. Tests will not run" >&2;} fi + + if test "x$with_ocaml_libdir" != xauto ; then OCAML_LIBDIR=$with_ocaml_libdir else - ocaml_stdlib="`"$OCAMLC" -where`" + ocaml_stdlib="`"$OCAMLFIND" ocamlc -where`" if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~" then # ocaml stdlib is beneath our prefix; use stdlib @@ -19391,10 +19269,7 @@ GZIPBIN!$GZIPBIN$ac_delim PDFROFF!$PDFROFF$ac_delim ZIP!$ZIP$ac_delim GO!$GO$ac_delim -OCAMLC!$OCAMLC$ac_delim -OCAMLOPT!$OCAMLOPT$ac_delim -OCAMLDEP!$OCAMLDEP$ac_delim -OCAMLDOC!$OCAMLDOC$ac_delim +OCAMLFIND!$OCAMLFIND$ac_delim GAS!$GAS$ac_delim HAVE_LINK_VERSION_SCRIPT!$HAVE_LINK_VERSION_SCRIPT$ac_delim EGREP!$EGREP$ac_delim @@ -19426,6 +19301,8 @@ LLVM_INFODIR!$LLVM_INFODIR$ac_delim LLVM_MANDIR!$LLVM_MANDIR$ac_delim LLVM_CONFIGTIME!$LLVM_CONFIGTIME$ac_delim BINDINGS_TO_BUILD!$BINDINGS_TO_BUILD$ac_delim +HAVE_OCAMLOPT!$HAVE_OCAMLOPT$ac_delim +HAVE_OCAML_OUNIT!$HAVE_OCAML_OUNIT$ac_delim OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim RPATH!$RPATH$ac_delim @@ -19435,7 +19312,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -19454,7 +19331,7 @@ fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g @@ -19467,6 +19344,8 @@ N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g CEOF$ac_eof _ACEOF @@ -19714,7 +19593,7 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed 's/|#_!!_#|//g' >$tmp/out +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && diff --git a/test/Bindings/Ocaml/analysis.ml b/test/Bindings/Ocaml/analysis.ml index 0694ed1774f..84e1429279a 100644 --- a/test/Bindings/Ocaml/analysis.ml +++ b/test/Bindings/Ocaml/analysis.ml @@ -1,7 +1,5 @@ -(* RUN: rm -rf %t.builddir - * RUN: mkdir -p %t.builddir - * RUN: cp %s %t.builddir - * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_analysis.%cma %t.builddir/analysis.ml -o %t +(* RUN: cp %s %T/analysis.ml + * RUN: %ocamlcomp -warn-error A -package llvm.analysis -linkpkg %T/analysis.ml -o %t * RUN: %t * XFAIL: vg_leak *) diff --git a/test/Bindings/Ocaml/bitreader.ml b/test/Bindings/Ocaml/bitreader.ml index 973c8a77bcb..28c04a6abc0 100644 --- a/test/Bindings/Ocaml/bitreader.ml +++ b/test/Bindings/Ocaml/bitreader.ml @@ -1,7 +1,5 @@ -(* RUN: rm -rf %t.builddir - * RUN: mkdir -p %t.builddir - * RUN: cp %s %t.builddir - * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_bitreader.%cma llvm_bitwriter.%cma %t.builddir/bitreader.ml -o %t +(* RUN: cp %s %T/bitreader.ml + * RUN: %ocamlcomp -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitreader.ml -o %t * RUN: %t %t.bc * RUN: llvm-dis < %t.bc * XFAIL: vg_leak diff --git a/test/Bindings/Ocaml/bitwriter.ml b/test/Bindings/Ocaml/bitwriter.ml index 98c04172a26..746836508eb 100644 --- a/test/Bindings/Ocaml/bitwriter.ml +++ b/test/Bindings/Ocaml/bitwriter.ml @@ -1,7 +1,5 @@ -(* RUN: rm -rf %t.builddir - * RUN: mkdir -p %t.builddir - * RUN: cp %s %t.builddir - * RUN: %ocamlcomp -warn-error A-3 unix.%cma llvm.%cma llvm_bitwriter.%cma %t.builddir/bitwriter.ml -o %t +(* RUN: cp %s %T/bitwriter.ml + * RUN: %ocamlcomp -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t * RUN: %t %t.bc * RUN: llvm-dis < %t.bc * XFAIL: vg_leak diff --git a/test/Bindings/Ocaml/executionengine.ml b/test/Bindings/Ocaml/executionengine.ml index fa325ebc1df..7d64f9f7f76 100644 --- a/test/Bindings/Ocaml/executionengine.ml +++ b/test/Bindings/Ocaml/executionengine.ml @@ -1,9 +1,8 @@ -(* RUN: rm -rf %t.builddir - * RUN: mkdir -p %t.builddir - * RUN: cp %s %t.builddir - * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_target.%cma llvm_executionengine.%cma %t.builddir/executionengine.ml -o %t +(* RUN: cp %s %T/executionengine.ml + * RUN: %ocamlcomp -warn-error A -package llvm.executionengine -linkpkg %T/executionengine.ml -o %t * RUN: %t - * XFAIL: vg_leak hexagon + * REQUIRES: native, object-emission + * XFAIL: vg_leak *) open Llvm diff --git a/test/Bindings/Ocaml/ext_exc.ml b/test/Bindings/Ocaml/ext_exc.ml index 80924387110..c99bc04333f 100644 --- a/test/Bindings/Ocaml/ext_exc.ml +++ b/test/Bindings/Ocaml/ext_exc.ml @@ -1,11 +1,11 @@ -(* RUN: rm -rf %t.builddir - * RUN: mkdir -p %t.builddir - * RUN: cp %s %t.builddir - * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_bitreader.%cma llvm_executionengine.%cma %t.builddir/ext_exc.ml -o %t - * RUN: %t %t.ll * RUN: FileCheck %s < %t.ll diff --git a/test/Makefile b/test/Makefile index 40fcd616ab2..126f128a950 100644 --- a/test/Makefile +++ b/test/Makefile @@ -123,13 +123,15 @@ lit.site.cfg: FORCE @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp + @$(ECHOPATH) s=@LIBDIR@=$(LibDir)=g >> lit.tmp @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> lit.tmp @$(ECHOPATH) s=@SHLIBEXT@=$(SHLIBEXT)=g >> lit.tmp @$(ECHOPATH) s=@EXEEXT@=$(EXEEXT)=g >> lit.tmp @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp - @$(ECHOPATH) s=@OCAMLC@=$(OCAMLC)=g >> lit.tmp - @$(ECHOPATH) s=@OCAMLOPT@=$(OCAMLOPT)=g >> lit.tmp - @$(ECHOPATH) s=@OCAMLFLAGS@=-cclib -L$(LibDir) -I $(LibDir)/ocaml $(addprefix -cclib ,$(LDFLAGS))=g >> lit.tmp + @$(ECHOPATH) s=@OCAMLFIND@=$(OCAMLFIND)=g >> lit.tmp + @$(ECHOPATH) s=@OCAMLFLAGS@=$(addprefix -cclib ,$(LDFLAGS))=g >> lit.tmp + @$(ECHOPATH) s=@HAVE_OCAMLOPT@=$(HAVE_OCAMLOPT)=g >> lit.tmp + @$(ECHOPATH) s=@HAVE_OCAML_OUNIT@=$(HAVE_OCAML_OUNIT)=g >> lit.tmp @$(ECHOPATH) s=@GO_EXECUTABLE@=$(GO)=g >> lit.tmp @$(ECHOPATH) s!@HOST_CC@!$(CC)!g >> lit.tmp @$(ECHOPATH) s!@HOST_CXX@!$(CXX)!g >> lit.tmp diff --git a/test/lit.cfg b/test/lit.cfg index 63880d0dac7..4e9a5ad6efa 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -100,6 +100,14 @@ for options in ['ASAN_OPTIONS', 'UBSAN_OPTIONS']: if options in os.environ: config.environment[options] = os.environ[options] +# Set up OCAMLPATH to include newly built OCaml libraries. +llvm_ocaml_lib = os.path.join(getattr(config, 'llvm_lib_dir', None), 'ocaml') +if 'OCAMLPATH' in os.environ: + ocamlpath = os.path.pathsep.join((llvm_ocaml_lib, os.environ['OCAMLPATH'])) + config.environment['OCAMLPATH'] = ocamlpath +else: + config.environment['OCAMLPATH'] = llvm_ocaml_lib + ### import os @@ -175,14 +183,12 @@ config.substitutions.append( ('%python', config.python_executable) ) # OCaml substitutions. # Support tests for both native and bytecode builds. -if config.ocamlopt_executable != "": +if config.have_ocamlopt == '1': config.substitutions.append( ('%ocamlcomp', - "%s %s" % (config.ocamlopt_executable, config.ocaml_flags)) ) - config.substitutions.append( ('%cma', 'cmxa') ) + "%s ocamlopt %s" % (config.ocamlfind_executable, config.ocaml_flags)) ) else: config.substitutions.append( ('%ocamlcomp', - "%s %s" % (config.ocamlc_executable, config.ocaml_flags)) ) - config.substitutions.append( ('%cma', 'cma') ) + "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) ) # For each occurrence of an llvm tool name as its own word, replace it # with the full path to the build directory holding that tool. This diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 2a058e9fa3b..7d2c8330531 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -7,13 +7,15 @@ config.target_triple = "@TARGET_TRIPLE@" config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" +config.llvm_lib_dir = "@LIBDIR@" config.llvm_shlib_dir = "@SHLIBDIR@" config.llvm_shlib_ext = "@SHLIBEXT@" config.llvm_exe_ext = "@EXEEXT@" config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@" config.python_executable = "@PYTHON_EXECUTABLE@" -config.ocamlc_executable = "@OCAMLC@" -config.ocamlopt_executable = "@OCAMLOPT@" +config.ocamlfind_executable = "@OCAMLFIND@" +config.have_ocamlopt = "@HAVE_OCAMLOPT@" +config.have_ocaml_ounit = "@HAVE_OCAML_OUNIT@" config.ocaml_flags = "@OCAMLFLAGS@" config.go_executable = "@GO_EXECUTABLE@" config.enable_shared = @ENABLE_SHARED@