Author: gordon Date: Tue Oct 2 11:42:10 2007 New Revision: 42532 URL: http://llvm.org/viewvc/llvm-project?rev=42532&view=rev Log: Providing --with-ocaml-libdir for ./configure. The default is the stdlib if it's beneath --prefix, and is libdir/ocaml otherwise.
If someone has a better way than this to test whether $B is a path within $A, I'd love to hear it: if test "$A" \< "$B" -a "$B" \< "${A}~" Modified: llvm/trunk/Makefile.config.in llvm/trunk/autoconf/configure.ac llvm/trunk/bindings/ocaml/Makefile.ocaml llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli Modified: llvm/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=42532&r1=42531&r2=42532&view=diff ============================================================================== --- llvm/trunk/Makefile.config.in (original) +++ llvm/trunk/Makefile.config.in Tue Oct 2 11:42:10 2007 @@ -261,6 +261,7 @@ HUGE_VAL_SANITY = @HUGE_VAL_SANITY@ # Bindings that we should build -BINDINGS_TO_BUILD = @BINDINGS_TO_BUILD@ -ALL_BINDINGS = @ALL_BINDINGS@ +BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@ +ALL_BINDINGS := @ALL_BINDINGS@ +OCAML_LIBDIR := @OCAML_LIBDIR@ Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42532&r1=42531&r2=42532&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Tue Oct 2 11:42:10 2007 @@ -450,6 +450,20 @@ ;; 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 @@ -886,6 +900,44 @@ # 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 Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=42532&r1=42531&r2=42532&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/Makefile.ocaml (original) +++ llvm/trunk/bindings/ocaml/Makefile.ocaml Tue Oct 2 11:42:10 2007 @@ -14,12 +14,6 @@ include $(LEVEL)/Makefile.config -# Find the ocaml stdlib root. /usr/local/lib/ocaml is the default when built -# from source; distros use something like /usr/lib/ocaml/3.10.0. -ifndef OCAML_LIBDIR -OCAML_LIBDIR := $(shell $(OCAMLC) -where) -endif - # CFLAGS needs to be set before Makefile.rules is included. Yes, ocaml puts its # includes under its libdir. CFLAGS += -I$(OCAML_LIBDIR) @@ -27,7 +21,7 @@ include $(LEVEL)/Makefile.common # Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. However, the -# user can override this with OCAML_LIBDIR. +# user can override this with OCAML_LIBDIR or configure --with-ocaml-libdir=. PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR) OcamlDir := $(LibDir)/ocaml Modified: llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli?rev=42532&r1=42531&r2=42532&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli (original) +++ llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli Tue Oct 2 11:42:10 2007 @@ -8,7 +8,7 @@ *===----------------------------------------------------------------------=== * * This interface provides an ocaml API for the LLVM bitcode writer, the - * classes in the classes in the Bitwriter library. + * classes in the Bitwriter library. * *===----------------------------------------------------------------------===*) _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits