From 8c8fdaee432a91b906cb33e928f2afe864945123 Mon Sep 17 00:00:00 2001 From: Pierre Boutillier Date: Wed, 8 Jul 2020 15:50:10 +0200 Subject: [PATCH 1/3] Configure: Use dicovered binaries instead of one in the path --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index d4d0389..09adfe1 100755 --- a/configure +++ b/configure @@ -208,7 +208,7 @@ else ccopt="-O3 -Wall -Wextra $CFLAGS" fi -case "$("$ocamlc" -config | tr -d '\r' | sed -ne '/^system:/s/.*: //p')" in +case "$($ocamlc -config | tr -d '\r' | sed -ne '/^system:/s/.*: //p')" in win32|win64) # MSVC objsuffix='obj' @@ -254,7 +254,7 @@ fi # directories if test "$ocamllibdir" = "auto" -then ocamllibdir="$(ocamlc -where | tr -d '\r')" +then ocamllibdir="$($ocamlc -where | tr -d '\r')" fi if test ! -f "$ocamllibdir/caml/mlvalues.h" @@ -293,7 +293,7 @@ fi # detect OCaml's word-size echo "print_int (Sys.word_size);;" > tmp.ml -wordsize="$(ocaml tmp.ml)" +wordsize="$($ocaml tmp.ml)" echo "OCaml's word size is $wordsize" rm -f tmp.ml @@ -335,7 +335,7 @@ if test "$gmp" != 'OK'; then echo "cannot find GMP nor MPIR"; exit 2; fi # OCaml version -ocamlver="$(ocamlc -version)" +ocamlver="$($ocamlc -version)" # OCaml version 4.07 or later is required From 29b19b4aa59a0eb77f02b3e546854a8923559dd4 Mon Sep 17 00:00:00 2001 From: Pierre Boutillier Date: Tue, 25 Mar 2025 17:02:43 +0100 Subject: [PATCH 2/3] Configure: reintroduce a usage to -prefixnonocaml (for pkg-config) --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 09adfe1..10eb09e 100755 --- a/configure +++ b/configure @@ -301,11 +301,11 @@ rm -f tmp.ml # check GMP, MPIR if test "$gmp" = 'gmp' || test "$gmp" = 'auto'; then - if pkg-config gmp 2>/dev/null; then + if ${prefixnonocaml}pkg-config gmp 2>/dev/null; then echo 'package gmp: found' gmp='OK' - cclib="$cclib $(pkg-config --libs gmp)" - ccinc="$ccinc $(pkg-config --cflags gmp)" + cclib="$cclib $(${prefixnonocaml}pkg-config --libs gmp)" + ccinc="$ccinc $(${prefixnonocaml}pkg-config --cflags gmp)" ccdef="-DHAS_GMP $ccdef" else checkinc gmp.h From b896187e1f9c7f0d04e730bdea8ee83c252b8585 Mon Sep 17 00:00:00 2001 From: Pierre Boutillier Date: Tue, 25 Mar 2025 16:58:01 +0100 Subject: [PATCH 3/3] Build: when ocamlfind is there, use it to call the compilers Useful for cross-compilation. Harmless for others. --- configure | 57 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/configure b/configure index 10eb09e..3c7172d 100755 --- a/configure +++ b/configure @@ -190,15 +190,40 @@ checkcmxalib() return $r } - -# check required programs +# check required program searchbinreq $ocaml -searchbinreq $ocamlc -searchbinreq $ocamldep -searchbinreq $ocamlmklib -if searchbin $ocamldoc; then - ocamldoc='' + +# rely on ocamlfind or not + +searchbin ocamlfind +if test $? -eq 1 && test $ocamlfind != "no"; then + # set installation method + instmeth='findlib' + if test "$installdir" = "auto" + then installdir="$(ocamlfind printconf destdir | tr -d '\r')"; fi + + # use wrapper to call compilers + ocamlc='ocamlfind ocamlc' + ocamlopt='ocamlfind opt' + ocamlmklib='ocamlfind ocamlmklib' + ocamldep='ocamlfind ocamldep' + ocamldoc='ocamlfind ocamldoc' +else + # set installation method + searchbin install + if test $? -eq 1; then instmeth='install' + else echo "no installation method found"; exit 2; fi + if test "$installdir" = "auto"; then installdir="$ocamllibdir"; fi + + # check required tools + searchbinreq $ocamlc + searchbinreq $ocamldep + searchbinreq $ocamlmklib +fi + +if $ocamldoc -version >/dev/null 2>/dev/null; then + ocamldoc='' fi if test -n "$CC"; then @@ -236,8 +261,7 @@ esac hasocamlopt='no' -searchbin $ocamlopt -if test $? -eq 1; then hasocamlopt='yes'; fi +if $ocamlopt -version >/dev/null 2>/dev/null; then hasocamlopt='yes'; fi # check C compiler @@ -275,21 +299,6 @@ then fi -# installation method - -searchbin ocamlfind -if test $? -eq 1 && test $ocamlfind != "no"; then - instmeth='findlib' - if test "$installdir" = "auto" - then installdir="$(ocamlfind printconf destdir | tr -d '\r')"; fi -else - searchbin install - if test $? -eq 1; then instmeth='install' - else echo "no installation method found"; exit 2; fi - if test "$installdir" = "auto"; then installdir="$ocamllibdir"; fi -fi - - # detect OCaml's word-size echo "print_int (Sys.word_size);;" > tmp.ml