llvm.org GIT mirror llvm / 47f88b5
[OCaml] [autoconf] Migrate to ocamlfind. This commit updates the OCaml bindings and tests to use ocamlfind. The bindings are migrated in order to use ctypes, which are now required for MCJIT-backed Llvm_executionengine. The tests are migrated in order to use OUnit and to verify that the distributed META.llvm allows to build working executables. Every OCaml toolchain invocation is now chained through ocamlfind, which (in theory) allows to cross-compile the OCaml bindings. The configure script now checks for ctypes (>= 0.2.3) and OUnit (>= 2). The code depending on these libraries will be added later. The configure script does not check the package versions in order to keep changes less invasive. Additionally, OCaml bindings will now be automatically enabled if ocamlfind is detected on the system, rather than ocamlc, as it was before. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220899 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Zotov 4 years ago
21 changed file(s) with 149 addition(s) and 297 deletion(s). Raw diff Collapse all Expand all
202202 GROFF := @GROFF@
203203 GZIPBIN := @GZIPBIN@
204204 GO := @GO@
205 OCAMLC := @OCAMLC@
206 OCAMLOPT := @OCAMLOPT@
207 OCAMLDEP := @OCAMLDEP@
208 OCAMLDOC := @OCAMLDOC@
205 OCAMLFIND := @OCAMLFIND@
209206 GAS := @GAS@
210207 POD2HTML := @POD2HTML@
211208 POD2MAN := @POD2MAN@
216213 HAVE_DLOPEN := @HAVE_DLOPEN@
217214 HAVE_PTHREAD := @HAVE_PTHREAD@
218215 HAVE_TERMINFO := @HAVE_TERMINFO@
216
217 HAVE_OCAMLOPT := @HAVE_OCAMLOPT@
218 HAVE_OCAML_OUNIT := @HAVE_OCAML_OUNIT@
219219
220220 LIBS := @LIBS@
221221
657657 enableval="yes")
658658 case "$enableval" in
659659 yes) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]) ;;
660 no)
660 no)
661661 if test ${clang_arcmt} != "no" ; then
662662 AC_MSG_ERROR([Cannot enable clang ARC Migration Tool while disabling static analyzer.])
663663 fi
664 AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[0])
664 AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[0])
665665 ;;
666666 default) AC_SUBST(ENABLE_CLANG_STATIC_ANALYZER,[1]);;
667667 *) AC_MSG_ERROR([Invalid setting for --enable-clang-static-analyzer. Use "yes" or "no"]) ;;
12871287 AC_PATH_PROG(PDFROFF, [pdfroff])
12881288 AC_PATH_PROG(ZIP, [zip])
12891289 AC_PATH_PROG(GO, [go])
1290 AC_PATH_PROGS(OCAMLC, [ocamlc])
1291 AC_PATH_PROGS(OCAMLOPT, [ocamlopt])
1292 AC_PATH_PROGS(OCAMLDEP, [ocamldep])
1293 AC_PATH_PROGS(OCAMLDOC, [ocamldoc])
1290 AC_PATH_PROGS(OCAMLFIND, [ocamlfind])
12941291 AC_PATH_PROGS(GAS, [gas as])
12951292
12961293 dnl Get the version of the linker in use.
15231520 fi ;;
15241521 *)
15251522 AC_MSG_ERROR([OProfile support is available on Linux only.]) ;;
1526 esac
1523 esac
15271524 ],
15281525 [
15291526 AC_SUBST(USE_OPROFILE, [0])
18681865 dnl Determine which bindings to build.
18691866 if test "$BINDINGS_TO_BUILD" = auto ; then
18701867 BINDINGS_TO_BUILD=""
1871 if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
1868 if test "x$OCAMLFIND" != x ; then
18721869 BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
18731870 fi
18741871 if test "x$GO" != x ; then
18841881 for a_binding in $BINDINGS_TO_BUILD ; do
18851882 case "$a_binding" in
18861883 ocaml)
1887 if test "x$OCAMLC" = x ; then
1888 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc])
1884 if test "x$OCAMLFIND" = x ; then
1885 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlfind not found. Try configure OCAMLFIND=/path/to/ocamlfind])
18891886 binding_prereqs_failed=1
18901887 fi
1891 if test "x$OCAMLDEP" = x ; then
1892 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep])
1888
1889 if $OCAMLFIND opt -version >/dev/null 2>/dev/null ; then
1890 HAVE_OCAMLOPT=1
1891 else
1892 HAVE_OCAMLOPT=0
1893 fi
1894 AC_SUBST(HAVE_OCAMLOPT)
1895
1896 if ! $OCAMLFIND query ctypes >/dev/null 2>/dev/null; then
1897 AC_MSG_WARN([--enable-bindings=ocaml specified, but ctypes is not installed])
18931898 binding_prereqs_failed=1
18941899 fi
1895 if test "x$OCAMLOPT" = x ; then
1896 AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt])
1897 dnl ocamlopt is optional!
1900
1901 if $OCAMLFIND query oUnit >/dev/null 2>/dev/null; then
1902 HAVE_OCAML_OUNIT=1
1903 else
1904 HAVE_OCAML_OUNIT=0
1905 AC_MSG_WARN([--enable-bindings=ocaml specified, but OUnit 2 is not installed. Tests will not run])
1906 dnl oUnit is optional!
18981907 fi
1908 AC_SUBST(HAVE_OCAML_OUNIT)
1909
18991910 if test "x$with_ocaml_libdir" != xauto ; then
19001911 AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir)
19011912 else
1902 ocaml_stdlib="`"$OCAMLC" -where`"
1913 ocaml_stdlib="`"$OCAMLFIND" ocamlc -where`"
19031914 if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
19041915 then
19051916 # ocaml stdlib is beneath our prefix; use stdlib
1919 include $(LEVEL)/Makefile.config
2020
2121 # CFLAGS needs to be set before Makefile.rules is included.
22 CXX.Flags += -I"$(shell $(OCAMLC) -where)"
23 C.Flags += -I"$(shell $(OCAMLC) -where)"
22 CXX.Flags += -I"$(shell $(OCAMLFIND) c -where)"
23 C.Flags += -I"$(shell $(OCAMLFIND) c -where)"
2424
2525 ifeq ($(ENABLE_SHARED),1)
2626 LINK_COMPONENTS := all
5454 endif
5555
5656 # Tools
57 OCAMLCFLAGS += -I $(ObjDir) -I $(OcamlDir)
57 OCAMLCFLAGS += -I $(OcamlDir)
5858 ifndef IS_CLEANING_TARGET
5959 ifneq ($(ObjectsO),)
6060 OCAMLAFLAGS += $(patsubst %,-cclib %, \
7272 OCAMLDEBUGFLAG := -g
7373 endif
7474
75 Compile.CMI := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
76 Compile.CMO := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
77 Compile.CMX := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
75 Compile.CMI := $(strip $(OCAMLFIND) c -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
76 Compile.CMO := $(strip $(OCAMLFIND) c -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
77 Compile.CMX := $(strip $(OCAMLFIND) opt -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
7878
7979 ifdef OCAMLSTUBS
8080 # Avoid the need for LD_LIBRARY_PATH
8686 endif
8787
8888 ifdef OCAMLSTUBS
89 Archive.CMA := $(strip $(OCAMLC) -a -dllib -l$(LIBRARYNAME) $(OCAMLDEBUGFLAG) \
90 -o)
89 Archive.CMA := $(strip $(OCAMLFIND) c -a -dllib -l$(LIBRARYNAME) $(OCAMLDEBUGFLAG) \
90 -o)
9191 else
92 Archive.CMA := $(strip $(OCAMLC) -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
93 -o)
92 Archive.CMA := $(strip $(OCAMLFIND) c -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
93 -o)
9494 endif
9595
9696 ifdef OCAMLSTUBS
97 Archive.CMXA := $(strip $(OCAMLOPT) -a $(patsubst %,-cclib %, \
97 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(patsubst %,-cclib %, \
9898 $(LLVMLibsOptions) -l$(LIBRARYNAME) \
9999 -L$(SharedLibDir) $(OCAMLRPATH)) \
100100 $(OCAMLDEBUGFLAG) -o)
101101 else
102 Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
103 endif
104
105 ifdef OCAMLOPT
106 Archive.EXE := $(strip $(OCAMLOPT) -cc $(CXX) $(OCAMLCFLAGS) $(UsedOcamlLibs:%=%.cmxa) $(OCAMLDEBUGFLAG) -o)
107 else
108 Archive.EXE := $(strip $(OCAMLC) -cc $(CXX) $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG:%=%.cma) -o)
102 Archive.CMXA := $(strip $(OCAMLFIND) opt -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
109103 endif
110104
111105 # Source files
189183 ifdef LIBRARYNAME
190184 $(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
191185 $(OcamlDir)/.dir $(ObjDir)/.dir
192 $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
186 $(Verb) $(OCAMLFIND) dep $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
193187
194188 -include $(ObjDir)/$(LIBRARYNAME).ocamldep
195189 endif
197191 ifdef TOOLNAME
198192 $(ObjDir)/$(TOOLNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
199193 $(OcamlDir)/.dir $(ObjDir)/.dir
200 $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
194 $(Verb) $(OCAMLFIND) dep $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeaders) > $@
201195
202196 -include $(ObjDir)/$(TOOLNAME).ocamldep
203197 endif
366360 ##===- Build optimized ocaml archive (.ml's -> .cmx's -> .cmxa, .a) -------===##
367361
368362 # The ocamlopt compiler is supported on a set of targets disjoint from LLVM's.
369 # If unavailable, 'configure' will not define OCAMLOPT in Makefile.config.
370 ifdef OCAMLOPT
363 # If unavailable, 'configure' will set HAVE_OCAMLOPT to 0 in Makefile.config.
364 ifeq ($(HAVE_OCAMLOPT),1)
371365
372366 $(OcamlDir)/%.cmx: $(ObjDir)/%.cmx
373367 $(Verb) $(CP) -f $< $@
417411 endif
418412 endif
419413
420 ##===- Build executables --------------------------------------------------===##
421
422 ifdef TOOLNAME
423 all-local:: $(OutputEXE)
424 clean-local:: clean-exe
425
426 $(OutputEXE): $(ToolEXE) $(OcamlDir)/.dir
427 $(Verb) $(CP) -f $< $@
428
429 ifndef OCAMLOPT
430 $(ToolEXE): $(ObjectsCMO) $(OcamlDir)/.dir
431 $(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
432 $(Verb) $(Archive.EXE) $@ $(ObjectsCMO)
433 else
434 $(ToolEXE): $(ObjectsCMX) $(OcamlDir)/.dir
435 $(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
436 $(Verb) $(Archive.EXE) $@ $(ObjectsCMX)
437 endif
438 endif
439
440414 ##===- Generate documentation ---------------------------------------------===##
441415
442416 $(ObjDir)/$(LIBRARYNAME).odoc: $(ObjectsCMI)
443417 $(Echo) "Documenting $(notdir $@)"
444 $(Verb) $(OCAMLDOC) -I $(ObjDir) -I $(OcamlDir) -dump $@ $(OcamlHeaders)
418 $(Verb) $(OCAMLFIND) doc -I $(ObjDir) -I $(OcamlDir) -dump $@ $(OcamlHeaders)
445419
446420 ocamldoc: $(ObjDir)/$(LIBRARYNAME).odoc
447421
452426 $(Echo) "LLVM_CONFIG : " '$(LLVM_CONFIG)'
453427 $(Echo) "OCAMLCFLAGS : " '$(OCAMLCFLAGS)'
454428 $(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)'
455 $(Echo) "OCAMLC : " '$(OCAMLC)'
456 $(Echo) "OCAMLOPT : " '$(OCAMLOPT)'
457 $(Echo) "OCAMLDEP : " '$(OCAMLDEP)'
429 $(Echo) "OCAMLFIND : " '$(OCAMLFIND)'
458430 $(Echo) "Compile.CMI : " '$(Compile.CMI)'
459431 $(Echo) "Compile.CMO : " '$(Compile.CMO)'
460432 $(Echo) "Archive.CMA : " '$(Archive.CMA)'
752752 PDFROFF
753753 ZIP
754754 GO
755 OCAMLC
756 OCAMLOPT
757 OCAMLDEP
758 OCAMLDOC
755 OCAMLFIND
759756 GAS
760757 HAVE_LINK_VERSION_SCRIPT
761758 EGREP
787784 LLVM_MANDIR
788785 LLVM_CONFIGTIME
789786 BINDINGS_TO_BUILD
787 HAVE_OCAMLOPT
788 HAVE_OCAML_OUNIT
790789 OCAML_LIBDIR
791790 ENABLE_VISIBILITY_INLINES_HIDDEN
792791 RPATH
69086907 fi
69096908
69106909
6911 for ac_prog in ocamlc
6910 for ac_prog in ocamlfind
69126911 do
69136912 # Extract the first word of "$ac_prog", so it can be a program name with args.
69146913 set dummy $ac_prog; ac_word=$2
69156914 { echo "$as_me:$LINENO: checking for $ac_word" >&5
69166915 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6917 if test "${ac_cv_path_OCAMLC+set}" = set; then
6916 if test "${ac_cv_path_OCAMLFIND+set}" = set; then
69186917 echo $ECHO_N "(cached) $ECHO_C" >&6
69196918 else
6920 case $OCAMLC in
6919 case $OCAMLFIND in
69216920 [\\/]* | ?:[\\/]*)
6922 ac_cv_path_OCAMLC="$OCAMLC" # Let the user override the test with a path.
6921 ac_cv_path_OCAMLFIND="$OCAMLFIND" # Let the user override the test with a path.
69236922 ;;
69246923 *)
69256924 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
69296928 test -z "$as_dir" && as_dir=.
69306929 for ac_exec_ext in '' $ac_executable_extensions; do
69316930 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
6932 ac_cv_path_OCAMLC="$as_dir/$ac_word$ac_exec_ext"
6931 ac_cv_path_OCAMLFIND="$as_dir/$ac_word$ac_exec_ext"
69336932 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
69346933 break 2
69356934 fi
69406939 ;;
69416940 esac
69426941 fi
6943 OCAMLC=$ac_cv_path_OCAMLC
6944 if test -n "$OCAMLC"; then
6945 { echo "$as_me:$LINENO: result: $OCAMLC" >&5
6946 echo "${ECHO_T}$OCAMLC" >&6; }
6942 OCAMLFIND=$ac_cv_path_OCAMLFIND
6943 if test -n "$OCAMLFIND"; then
6944 { echo "$as_me:$LINENO: result: $OCAMLFIND" >&5
6945 echo "${ECHO_T}$OCAMLFIND" >&6; }
69476946 else
69486947 { echo "$as_me:$LINENO: result: no" >&5
69496948 echo "${ECHO_T}no" >&6; }
69506949 fi
69516950
69526951
6953 test -n "$OCAMLC" && break
6954 done
6955
6956 for ac_prog in ocamlopt
6957 do
6958 # Extract the first word of "$ac_prog", so it can be a program name with args.
6959 set dummy $ac_prog; ac_word=$2
6960 { echo "$as_me:$LINENO: checking for $ac_word" >&5
6961 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
6962 if test "${ac_cv_path_OCAMLOPT+set}" = set; then
6963 echo $ECHO_N "(cached) $ECHO_C" >&6
6964 else
6965 case $OCAMLOPT in
6966 [\\/]* | ?:[\\/]*)
6967 ac_cv_path_OCAMLOPT="$OCAMLOPT" # Let the user override the test with a path.
6968 ;;
6969 *)
6970 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6971 for as_dir in $PATH
6972 do
6973 IFS=$as_save_IFS
6974 test -z "$as_dir" && as_dir=.
6975 for ac_exec_ext in '' $ac_executable_extensions; do
6976 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
6977 ac_cv_path_OCAMLOPT="$as_dir/$ac_word$ac_exec_ext"
6978 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
6979 break 2
6980 fi
6981 done
6982 done
6983 IFS=$as_save_IFS
6984
6985 ;;
6986 esac
6987 fi
6988 OCAMLOPT=$ac_cv_path_OCAMLOPT
6989 if test -n "$OCAMLOPT"; then
6990 { echo "$as_me:$LINENO: result: $OCAMLOPT" >&5
6991 echo "${ECHO_T}$OCAMLOPT" >&6; }
6992 else
6993 { echo "$as_me:$LINENO: result: no" >&5
6994 echo "${ECHO_T}no" >&6; }
6995 fi
6996
6997
6998 test -n "$OCAMLOPT" && break
6999 done
7000
7001 for ac_prog in ocamldep
7002 do
7003 # Extract the first word of "$ac_prog", so it can be a program name with args.
7004 set dummy $ac_prog; ac_word=$2
7005 { echo "$as_me:$LINENO: checking for $ac_word" >&5
7006 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
7007 if test "${ac_cv_path_OCAMLDEP+set}" = set; then
7008 echo $ECHO_N "(cached) $ECHO_C" >&6
7009 else
7010 case $OCAMLDEP in
7011 [\\/]* | ?:[\\/]*)
7012 ac_cv_path_OCAMLDEP="$OCAMLDEP" # Let the user override the test with a path.
7013 ;;
7014 *)
7015 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7016 for as_dir in $PATH
7017 do
7018 IFS=$as_save_IFS
7019 test -z "$as_dir" && as_dir=.
7020 for ac_exec_ext in '' $ac_executable_extensions; do
7021 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
7022 ac_cv_path_OCAMLDEP="$as_dir/$ac_word$ac_exec_ext"
7023 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
7024 break 2
7025 fi
7026 done
7027 done
7028 IFS=$as_save_IFS
7029
7030 ;;
7031 esac
7032 fi
7033 OCAMLDEP=$ac_cv_path_OCAMLDEP
7034 if test -n "$OCAMLDEP"; then
7035 { echo "$as_me:$LINENO: result: $OCAMLDEP" >&5
7036 echo "${ECHO_T}$OCAMLDEP" >&6; }
7037 else
7038 { echo "$as_me:$LINENO: result: no" >&5
7039 echo "${ECHO_T}no" >&6; }
7040 fi
7041
7042
7043 test -n "$OCAMLDEP" && break
7044 done
7045
7046 for ac_prog in ocamldoc
7047 do
7048 # Extract the first word of "$ac_prog", so it can be a program name with args.
7049 set dummy $ac_prog; ac_word=$2
7050 { echo "$as_me:$LINENO: checking for $ac_word" >&5
7051 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
7052 if test "${ac_cv_path_OCAMLDOC+set}" = set; then
7053 echo $ECHO_N "(cached) $ECHO_C" >&6
7054 else
7055 case $OCAMLDOC in
7056 [\\/]* | ?:[\\/]*)
7057 ac_cv_path_OCAMLDOC="$OCAMLDOC" # Let the user override the test with a path.
7058 ;;
7059 *)
7060 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
7061 for as_dir in $PATH
7062 do
7063 IFS=$as_save_IFS
7064 test -z "$as_dir" && as_dir=.
7065 for ac_exec_ext in '' $ac_executable_extensions; do
7066 if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
7067 ac_cv_path_OCAMLDOC="$as_dir/$ac_word$ac_exec_ext"
7068 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
7069 break 2
7070 fi
7071 done
7072 done
7073 IFS=$as_save_IFS
7074
7075 ;;
7076 esac
7077 fi
7078 OCAMLDOC=$ac_cv_path_OCAMLDOC
7079 if test -n "$OCAMLDOC"; then
7080 { echo "$as_me:$LINENO: result: $OCAMLDOC" >&5
7081 echo "${ECHO_T}$OCAMLDOC" >&6; }
7082 else
7083 { echo "$as_me:$LINENO: result: no" >&5
7084 echo "${ECHO_T}no" >&6; }
7085 fi
7086
7087
7088 test -n "$OCAMLDOC" && break
6952 test -n "$OCAMLFIND" && break
70896953 done
70906954
70916955 for ac_prog in gas as
1830018164
1830118165 if test "$BINDINGS_TO_BUILD" = auto ; then
1830218166 BINDINGS_TO_BUILD=""
18303 if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
18167 if test "x$OCAMLFIND" != x ; then
1830418168 BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
1830518169 fi
1830618170 if test "x$GO" != x ; then
1831618180 for a_binding in $BINDINGS_TO_BUILD ; do
1831718181 case "$a_binding" in
1831818182 ocaml)
18319 if test "x$OCAMLC" = x ; then
18320 { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc" >&5
18321 echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc" >&2;}
18183 if test "x$OCAMLFIND" = x ; then
18184 { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlfind not found. Try configure OCAMLFIND=/path/to/ocamlfind" >&5
18185 echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlfind not found. Try configure OCAMLFIND=/path/to/ocamlfind" >&2;}
1832218186 binding_prereqs_failed=1
1832318187 fi
18324 if test "x$OCAMLDEP" = x ; then
18325 { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep" >&5
18326 echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep" >&2;}
18188
18189 if $OCAMLFIND opt -version >/dev/null 2>/dev/null ; then
18190 HAVE_OCAMLOPT=1
18191 else
18192 HAVE_OCAMLOPT=0
18193 fi
18194
18195
18196 if ! $OCAMLFIND query ctypes >/dev/null 2>/dev/null; then
18197 { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ctypes is not installed" >&5
18198 echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ctypes is not installed" >&2;}
1832718199 binding_prereqs_failed=1
1832818200 fi
18329 if test "x$OCAMLOPT" = x ; then
18330 { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt" >&5
18331 echo "$as_me: WARNING: --enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt" >&2;}
18201
18202 if $OCAMLFIND query oUnit >/dev/null 2>/dev/null; then
18203 HAVE_OCAML_OUNIT=1
18204 else
18205 HAVE_OCAML_OUNIT=0
18206 { echo "$as_me:$LINENO: WARNING: --enable-bindings=ocaml specified, but OUnit 2 is not installed. Tests will not run" >&5
18207 echo "$as_me: WARNING: --enable-bindings=ocaml specified, but OUnit 2 is not installed. Tests will not run" >&2;}
1833218208 fi
18209
18210
1833318211 if test "x$with_ocaml_libdir" != xauto ; then
1833418212 OCAML_LIBDIR=$with_ocaml_libdir
1833518213
1833618214 else
18337 ocaml_stdlib="`"$OCAMLC" -where`"
18215 ocaml_stdlib="`"$OCAMLFIND" ocamlc -where`"
1833818216 if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
1833918217 then
1834018218 # ocaml stdlib is beneath our prefix; use stdlib
1939019268 PDFROFF!$PDFROFF$ac_delim
1939119269 ZIP!$ZIP$ac_delim
1939219270 GO!$GO$ac_delim
19393 OCAMLC!$OCAMLC$ac_delim
19394 OCAMLOPT!$OCAMLOPT$ac_delim
19395 OCAMLDEP!$OCAMLDEP$ac_delim
19396 OCAMLDOC!$OCAMLDOC$ac_delim
19271 OCAMLFIND!$OCAMLFIND$ac_delim
1939719272 GAS!$GAS$ac_delim
1939819273 HAVE_LINK_VERSION_SCRIPT!$HAVE_LINK_VERSION_SCRIPT$ac_delim
1939919274 EGREP!$EGREP$ac_delim
1942519300 LLVM_MANDIR!$LLVM_MANDIR$ac_delim
1942619301 LLVM_CONFIGTIME!$LLVM_CONFIGTIME$ac_delim
1942719302 BINDINGS_TO_BUILD!$BINDINGS_TO_BUILD$ac_delim
19303 HAVE_OCAMLOPT!$HAVE_OCAMLOPT$ac_delim
19304 HAVE_OCAML_OUNIT!$HAVE_OCAML_OUNIT$ac_delim
1942819305 OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
1942919306 ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim
1943019307 RPATH!$RPATH$ac_delim
1943419311 LTLIBOBJS!$LTLIBOBJS$ac_delim
1943519312 _ACEOF
1943619313
19437 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 96; then
19314 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
1943819315 break
1943919316 elif $ac_last_try; then
1944019317 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
1945319330
1945419331 cat >>$CONFIG_STATUS <<_ACEOF
1945519332 cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
19456 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
19333 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
1945719334 _ACEOF
1945819335 sed '
1945919336 s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
1946619343 ' >>$CONFIG_STATUS
1946719344 rm -f conf$$subs.sed
1946819345 cat >>$CONFIG_STATUS <<_ACEOF
19346 :end
19347 s/|#_!!_#|//g
1946919348 CEOF$ac_eof
1947019349 _ACEOF
1947119350
1971319592 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
1971419593 s&@INSTALL@&$ac_INSTALL&;t t
1971519594 $ac_datarootdir_hack
19716 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" | sed 's/|#_!!_#|//g' >$tmp/out
19595 " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
1971719596
1971819597 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
1971919598 { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_analysis.%cma %t.builddir/analysis.ml -o %t
0 (* RUN: cp %s %T/analysis.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.analysis -linkpkg %T/analysis.ml -o %t
42 * RUN: %t
53 * XFAIL: vg_leak
64 *)
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_bitreader.%cma llvm_bitwriter.%cma %t.builddir/bitreader.ml -o %t
0 (* RUN: cp %s %T/bitreader.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitreader.ml -o %t
42 * RUN: %t %t.bc
53 * RUN: llvm-dis < %t.bc
64 * XFAIL: vg_leak
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A-3 unix.%cma llvm.%cma llvm_bitwriter.%cma %t.builddir/bitwriter.ml -o %t
0 (* RUN: cp %s %T/bitwriter.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.bitreader -package llvm.bitwriter -linkpkg %T/bitwriter.ml -o %t
42 * RUN: %t %t.bc
53 * RUN: llvm-dis < %t.bc
64 * XFAIL: vg_leak
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_target.%cma llvm_executionengine.%cma %t.builddir/executionengine.ml -o %t
0 (* RUN: cp %s %T/executionengine.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.executionengine -linkpkg %T/executionengine.ml -o %t
42 * RUN: %t
5 * XFAIL: vg_leak hexagon
3 * REQUIRES: native, object-emission
4 * XFAIL: vg_leak
65 *)
76
87 open Llvm
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_bitreader.%cma llvm_executionengine.%cma %t.builddir/ext_exc.ml -o %t
4 * RUN: %t l
0 (* RUN: cp %s %T/ext_exc.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.bitreader -linkpkg %T/ext_exc.ml -o %t
2 * RUN: %t
53 * XFAIL: vg_leak
64 *)
5
76 let context = Llvm.global_context ()
7
88 (* this used to crash, we must not use 'external' in .mli files, but 'val' if we
99 * want the let _ bindings executed, see http://caml.inria.fr/mantis/view.php?id=4166 *)
1010 let _ =
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_ipo.%cma llvm_target.%cma %t.builddir/ipo_opts.ml -o %t
0 (* RUN: cp %s %T/ipo_opts.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.ipo -linkpkg %T/ipo_opts.ml -o %t
42 * RUN: %t %t.bc
53 * XFAIL: vg_leak
64 *)
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -g -warn-error A llvm.%cma llvm_irreader.%cma %t.builddir/irreader.ml -o %t
0 (* RUN: cp %s %T/irreader.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.irreader -linkpkg %T/irreader.ml -o %t
42 * RUN: %t
53 * XFAIL: vg_leak
64 *)
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_linker.%cma %t.builddir/linker.ml -o %t
0 (* RUN: cp %s %T/linker.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.linker -linkpkg %T/linker.ml -o %t
42 * RUN: %t
53 * XFAIL: vg_leak
64 *)
11
22 if not 'ocaml' in config.root.llvm_bindings:
33 config.unsupported = True
4
5 if config.root.have_ocaml_ounit != '1':
6 config.unsupported = True
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_passmgr_builder.%cma %t.builddir/passmgr_builder.ml -o %t
0 (* RUN: cp %s %T/passmgr_builder.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.passmgr_builder -linkpkg %T/passmgr_builder.ml -o %t
42 * RUN: %t %t.bc
53 * XFAIL: vg_leak
64 *)
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_scalar_opts.%cma llvm_target.%cma %t.builddir/scalar_opts.ml -o %t
0 (* RUN: cp %s %T/scalar_opts.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.scalar_opts -linkpkg %T/scalar_opts.ml -o %t
42 * RUN: %t %t.bc
53 * XFAIL: vg_leak
64 *)
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -g -warn-error A llvm.%cma llvm_target.%cma llvm_executionengine.%cma %t.builddir/target.ml -o %t
0 (* RUN: cp %s %T/target.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.target -package llvm.executionengine -linkpkg %T/target.ml -o %t
42 * RUN: %t %t.bc
53 * REQUIRES: native, object-emission
64 * XFAIL: vg_leak
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_vectorize.%cma llvm_target.%cma %t.builddir/vectorize_opts.ml -o %t
0 (* RUN: cp %s %T/vectorize_opts.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.vectorize -linkpkg %T/vectorize_opts.ml -o %t
42 * RUN: %t %t.bc
53 * XFAIL: vg_leak
64 *)
None (* RUN: rm -rf %t.builddir
1 * RUN: mkdir -p %t.builddir
2 * RUN: cp %s %t.builddir
3 * RUN: %ocamlcomp -warn-error A llvm.%cma llvm_analysis.%cma llvm_bitwriter.%cma %t.builddir/vmcore.ml -o %t
0 (* RUN: cp %s %T/vmcore.ml
1 * RUN: %ocamlcomp -warn-error A -package llvm.analysis -package llvm.bitwriter -linkpkg %T/vmcore.ml -o %t
42 * RUN: %t %t.bc
53 * RUN: llvm-dis < %t.bc > %t.ll
64 * RUN: FileCheck %s < %t.ll
122122 @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g >> lit.tmp
123123 @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
124124 @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
125 @$(ECHOPATH) s=@LIBDIR@=$(LibDir)=g >> lit.tmp
125126 @$(ECHOPATH) s=@SHLIBDIR@=$(SharedLibDir)=g >> lit.tmp
126127 @$(ECHOPATH) s=@SHLIBEXT@=$(SHLIBEXT)=g >> lit.tmp
127128 @$(ECHOPATH) s=@EXEEXT@=$(EXEEXT)=g >> lit.tmp
128129 @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
129 @$(ECHOPATH) s=@OCAMLC@=$(OCAMLC)=g >> lit.tmp
130 @$(ECHOPATH) s=@OCAMLOPT@=$(OCAMLOPT)=g >> lit.tmp
131 @$(ECHOPATH) s=@OCAMLFLAGS@=-cclib -L$(LibDir) -I $(LibDir)/ocaml $(addprefix -cclib ,$(LDFLAGS))=g >> lit.tmp
130 @$(ECHOPATH) s=@OCAMLFIND@=$(OCAMLFIND)=g >> lit.tmp
131 @$(ECHOPATH) s=@OCAMLFLAGS@=$(addprefix -cclib ,$(LDFLAGS))=g >> lit.tmp
132 @$(ECHOPATH) s=@HAVE_OCAMLOPT@=$(HAVE_OCAMLOPT)=g >> lit.tmp
133 @$(ECHOPATH) s=@HAVE_OCAML_OUNIT@=$(HAVE_OCAML_OUNIT)=g >> lit.tmp
132134 @$(ECHOPATH) s=@GO_EXECUTABLE@=$(GO)=g >> lit.tmp
133135 @$(ECHOPATH) s!@HOST_CC@!$(CC)!g >> lit.tmp
134136 @$(ECHOPATH) s!@HOST_CXX@!$(CXX)!g >> lit.tmp
9999 if options in os.environ:
100100 config.environment[options] = os.environ[options]
101101
102 # Set up OCAMLPATH to include newly built OCaml libraries.
103 llvm_ocaml_lib = os.path.join(getattr(config, 'llvm_lib_dir', None), 'ocaml')
104 if 'OCAMLPATH' in os.environ:
105 ocamlpath = os.path.pathsep.join((llvm_ocaml_lib, os.environ['OCAMLPATH']))
106 config.environment['OCAMLPATH'] = ocamlpath
107 else:
108 config.environment['OCAMLPATH'] = llvm_ocaml_lib
109
102110 ###
103111
104112 import os
174182
175183 # OCaml substitutions.
176184 # Support tests for both native and bytecode builds.
177 if config.ocamlopt_executable != "":
185 if config.have_ocamlopt == '1':
178186 config.substitutions.append( ('%ocamlcomp',
179 "%s %s" % (config.ocamlopt_executable, config.ocaml_flags)) )
180 config.substitutions.append( ('%cma', 'cmxa') )
187 "%s ocamlopt %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
181188 else:
182189 config.substitutions.append( ('%ocamlcomp',
183 "%s %s" % (config.ocamlc_executable, config.ocaml_flags)) )
184 config.substitutions.append( ('%cma', 'cma') )
190 "%s ocamlc %s" % (config.ocamlfind_executable, config.ocaml_flags)) )
185191
186192 # For each occurrence of an llvm tool name as its own word, replace it
187193 # with the full path to the build directory holding that tool. This
66 config.llvm_src_root = "@LLVM_SOURCE_DIR@"
77 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
88 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
9 config.llvm_lib_dir = "@LIBDIR@"
910 config.llvm_shlib_dir = "@SHLIBDIR@"
1011 config.llvm_shlib_ext = "@SHLIBEXT@"
1112 config.llvm_exe_ext = "@EXEEXT@"
1213 config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
1314 config.python_executable = "@PYTHON_EXECUTABLE@"
14 config.ocamlc_executable = "@OCAMLC@"
15 config.ocamlopt_executable = "@OCAMLOPT@"
15 config.ocamlfind_executable = "@OCAMLFIND@"
16 config.have_ocamlopt = "@HAVE_OCAMLOPT@"
17 config.have_ocaml_ounit = "@HAVE_OCAML_OUNIT@"
1618 config.ocaml_flags = "@OCAMLFLAGS@"
1719 config.go_executable = "@GO_EXECUTABLE@"
1820 config.enable_shared = @ENABLE_SHARED@