diff options
author | David Allsopp <david.allsopp@metastack.com> | 2021-01-04 17:28:27 +0000 |
---|---|---|
committer | David Allsopp <david.allsopp@metastack.com> | 2021-05-11 13:54:02 +0100 |
commit | 474255bb0e1265067bdd81bbf107f0027295be04 (patch) | |
tree | 6463eb35572d48567fc5b4a175b5e9a01138a93f | |
parent | c555a5bd6e72b0d4c15a74b6f1b93ac445ed22bd (diff) | |
download | ocaml-474255bb0e1265067bdd81bbf107f0027295be04.tar.gz |
Control the flexdll bootstrap with configure
On Windows and Cygwin, if the submodule is initialised, configure will
pick it up (this can be disabled by passing --without-flexdll to
configure). --with-flexdll can also be used to specify a different
location for the FlexDLL sources (e.g. when building using opam) and
sources specified this way are first copied to flexdll-sources/
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Changes | 13 | ||||
-rw-r--r-- | Makefile | 74 | ||||
-rw-r--r-- | Makefile.build_config.in | 5 | ||||
-rw-r--r-- | Makefile.common | 4 | ||||
-rw-r--r-- | Makefile.config.in | 1 | ||||
-rw-r--r-- | README.win32.adoc | 4 | ||||
-rw-r--r-- | aclocal.m4 | 66 | ||||
-rwxr-xr-x | configure | 462 | ||||
-rw-r--r-- | configure.ac | 192 | ||||
-rw-r--r-- | runtime/Makefile | 4 | ||||
-rw-r--r-- | testsuite/Makefile | 6 | ||||
-rw-r--r-- | tools/ci/appveyor/appveyor_build.sh | 6 | ||||
-rw-r--r-- | utils/Makefile | 8 |
15 files changed, 636 insertions, 212 deletions
diff --git a/.gitattributes b/.gitattributes index 1b193afe2b..699b865923 100644 --- a/.gitattributes +++ b/.gitattributes @@ -151,6 +151,7 @@ menhir-bench.bash typo.missing-header typo.utf8 /tools/ci/appveyor/appveyor_build.cmd text eol=crlf +aclocal.m4 typo.tab configure.ac text eol=lf build-aux/compile text eol=lf build-aux/config.guess text eol=lf diff --git a/.gitignore b/.gitignore index 18700ef89b..52107195f3 100644 --- a/.gitignore +++ b/.gitignore @@ -84,6 +84,8 @@ _build /emacs/ocamltags /emacs/*.elc +/flexdll-sources + /lambda/runtimedef.ml /lex/parser.ml @@ -358,12 +358,13 @@ Working version (Gabriel Scherer, review by Sébastien Hinderer and David Allsopp, report by Ralph Seichter) -- #10135: Overhaul the FlexDLL bootstrap process. A separate non-shared version - of the runtime is built, and shared artefacts are no longer built twice. The - flexdll target no longer has to be separately built, but is folded into the - default make target. flexlink.opt is now built automatically with opt.opt. If - the flexdll code is present, any flexlink in PATH is ignored. The Cygwin port - now also supports bootstrapping FlexDLL. +- #10135: Overhaul the FlexDLL bootstrap process. It's now fully integrated + with the default build target and controlled by --with-flexdll which allows + externally downloaded sources for FlexDLL to be specified. A separate + non-shared version of the runtime is built, and shared artefacts are no longer + built twice. When bootstrapping, any flexlink in PATH is now ignored and the + Cygwin port also supports bootstrapping FlexDLL. flexlink.opt is automatically + built and installed as part of opt.opt/world.opt. (David Allsopp, review by Sébastien Hinderer) - #10156: configure script: fix sockets feature detection. @@ -88,10 +88,12 @@ else EXTRAPATH = PATH="otherlibs/win32unix:$(PATH)" endif -BOOT_FLEXLINK_CMD= -FLEXDLL_SUBMODULE_PRESENT := $(wildcard flexdll/Makefile) -ifneq "$(FLEXDLL_SUBMODULE_PRESENT)" "" +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" + COLDSTART_DEPS = + BOOT_FLEXLINK_CMD = +else + COLDSTART_DEPS = boot/ocamlruns$(EXE) BOOT_FLEXLINK_CMD = \ FLEXLINK_CMD="../boot/ocamlruns$(EXE) ../boot/flexlink.byte$(EXE)" endif @@ -154,25 +156,24 @@ boot/ocamlruns$(EXE): # runtime/ocamlrun is then installed to boot/ocamlrun and the stdlib artefacts # are copied to boot/ .PHONY: coldstart -ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" "" -coldstart: +coldstart: $(COLDSTART_DEPS) +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" $(MAKE) -C runtime all $(MAKE) -C stdlib \ OCAMLRUN='$$(ROOTDIR)/runtime/ocamlrun$(EXE)' \ CAMLC='$$(BOOT_OCAMLC) $(USE_RUNTIME_PRIMS)' all else -coldstart: boot/ocamlruns$(EXE) $(MAKE) -C stdlib OCAMLRUN='$$(ROOTDIR)/boot/ocamlruns$(EXE)' \ CAMLC='$$(BOOT_OCAMLC)' all - $(MAKE) -C flexdll $(FLEXLINK_BUILD_ENV) \ + $(MAKE) -C $(FLEXDLL_SOURCES) $(FLEXLINK_BUILD_ENV) \ OCAMLRUN='$$(ROOTDIR)/boot/ocamlruns$(EXE)' NATDYNLINK=false \ OCAMLOPT='$(value BOOT_OCAMLC) $(USE_RUNTIME_PRIMS) $(USE_STDLIB)' \ flexlink.exe - mv flexdll/flexlink.exe boot/flexlink.byte$(EXE) - $(MAKE) -C flexdll $(FLEXLINK_BUILD_ENV) support - mv flexdll/flexdll_*.$(O) boot/ + mv $(FLEXDLL_SOURCES)/flexlink.exe boot/flexlink.byte$(EXE) + $(MAKE) -C $(FLEXDLL_SOURCES) $(FLEXLINK_BUILD_ENV) support + mv $(FLEXDLL_SOURCES)/flexdll_*.$(O) boot/ $(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) all -endif # ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" "" +endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE) cd boot; rm -f $(LIBFILES) cd stdlib; cp $(LIBFILES) ../boot @@ -252,7 +253,7 @@ opt.opt: checknative $(MAKE) otherlibrariesopt $(MAKE) ocamllex.opt ocamltoolsopt ocamltoolsopt.opt $(OCAMLDOC_OPT) \ $(OCAMLTEST_OPT) -ifneq "$(FLEXDLL_SUBMODULE_PRESENT)" "" +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" $(MAKE) flexlink.opt$(EXE) endif ifeq "$(WITH_OCAMLDOC)-$(STDLIB_MANPAGES)" "ocamldoc-true" @@ -313,11 +314,15 @@ world.opt: checknative # Different git mechanism displayed depending on whether this source tree came # from a git clone or a source tarball. -flexdll/Makefile: - @echo In order to bootstrap FlexDLL, you need to place the sources in - @echo flexdll. +.PHONY: flexdll flexlink flexlink.opt + +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" +flexdll flexlink flexlink.opt: + @echo It is no longer necessary to bootstrap FlexDLL with a separate + @echo make invocation. Simply place the sources for FlexDLL in a + @echo sub-directory. @echo This can either be done by downloading a source tarball from - @echo \ http://alain.frisch.fr/flexdll.html + @echo \ https://github.com/alainfrisch/flexdll/releases @if [ -d .git ]; then \ echo or by checking out the flexdll submodule with; \ echo \ git submodule update --init; \ @@ -325,29 +330,36 @@ flexdll/Makefile: echo or by cloning the git repository; \ echo \ git clone https://github.com/alainfrisch/flexdll.git; \ fi + @echo "Then pass --with-flexdll=<dir> to configure and build as normal." @false +else + .PHONY: flexdll flexdll: flexdll/Makefile @echo WARNING! make flexdll is no longer required @echo This target will be removed in a future release. .PHONY: flexlink -flexlink: flexdll/Makefile - @echo WARNING! make flexlink is no longer required - @echo This target will be removed in a future release. +flexlink: + @echo Bootstrapping just flexlink.exe is no longer supported + @echo Bootstrapping FlexDLL is now enabled with + @echo ./configure --with-flexdll + @false -flexlink.opt$(EXE): flexdll/Makefile - $(MAKE) -C flexdll $(FLEXLINK_BUILD_ENV) \ +flexlink.opt$(EXE): + $(MAKE) -C $(FLEXDLL_SOURCES) $(FLEXLINK_BUILD_ENV) \ OCAML_FLEXLINK='$(value OCAMLRUN) $$(ROOTDIR)/boot/flexlink.byte$(EXE)' \ OCAMLOPT="../ocamlopt.opt$(EXE) -nostdlib -I ../stdlib" flexlink.exe - mv flexdll/flexlink.exe $@ + mv $(FLEXDLL_SOURCES)/flexlink.exe $@ partialclean:: rm -f flexlink.opt$(EXE) +endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" -INSTALL_COMPLIBDIR=$(DESTDIR)$(COMPLIBDIR) -INSTALL_FLEXDLLDIR=$(INSTALL_LIBDIR)/flexdll +INSTALL_COMPLIBDIR = $(DESTDIR)$(COMPLIBDIR) +INSTALL_FLEXDLLDIR = $(INSTALL_LIBDIR)/flexdll +FLEXDLL_MANIFEST = default$(filter-out _i386,_$(ARCH)).manifest # Installation .PHONY: install @@ -428,18 +440,18 @@ endif if test -n "$(WITH_DEBUGGER)"; then \ $(MAKE) -C debugger install; \ fi -ifneq "$(FLEXDLL_SUBMODULE_PRESENT)" "" +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" ifeq "$(TOOLCHAIN)" "msvc" - $(INSTALL_DATA) flexdll/default$(filter-out _i386,_$(ARCH)).manifest \ + $(INSTALL_DATA) $(FLEXDLL_SOURCES)/$(FLEXDLL_MANIFEST) \ "$(INSTALL_BINDIR)/" endif - $(MKDIR) "$(INSTALL_FLEXDLLDIR)" - $(INSTALL_DATA) boot/flexdll_*.$(O) "$(INSTALL_FLEXDLLDIR)" ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" $(INSTALL_PROG) \ boot/flexlink.byte$(EXE) "$(INSTALL_BINDIR)/flexlink.byte$(EXE)" endif # ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" -endif # ifneq "$(FLEXDLL_SUBMODULE_PRESENT)" "" + $(MKDIR) "$(INSTALL_FLEXDLLDIR)" + $(INSTALL_DATA) boot/flexdll_*.$(O) "$(INSTALL_FLEXDLLDIR)" +endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" $(INSTALL_DATA) Makefile.config "$(INSTALL_LIBDIR)" ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" if test -f ocamlopt$(EXE); then $(MAKE) installopt; else \ @@ -531,7 +543,7 @@ installoptopt: $(LN) ocamlc.opt$(EXE) ocamlc$(EXE); \ $(LN) ocamlopt.opt$(EXE) ocamlopt$(EXE); \ $(LN) ocamllex.opt$(EXE) ocamllex$(EXE) -ifneq "$(FLEXDLL_SUBMODULE_PRESENT)" "" +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" $(INSTALL_PROG) flexlink.opt$(EXE) "$(INSTALL_BINDIR)" cd "$(INSTALL_BINDIR)"; \ $(LN) flexlink.opt$(EXE) flexlink$(EXE) @@ -1112,7 +1124,7 @@ distclean: clean boot/*.cm* boot/libcamlrun.a boot/libcamlrun.lib boot/ocamlc.opt rm -f Makefile.config Makefile.build_config rm -f runtime/caml/m.h runtime/caml/s.h - rm -rf autom4te.cache + rm -rf autom4te.cache flexdll-sources rm -f config.log config.status libtool rm -f tools/eventlog_metadata rm -f tools/*.bak diff --git a/Makefile.build_config.in b/Makefile.build_config.in index f5349abc39..eb96306e21 100644 --- a/Makefile.build_config.in +++ b/Makefile.build_config.in @@ -38,3 +38,8 @@ RLWRAP=@rlwrap@ # Which document generator: odoc or ocamldoc? DOCUMENTATION_TOOL=@documentation_tool@ DOCUMENTATION_TOOL_CMD=@documentation_tool_cmd@ + +# The location of the FlexDLL sources to use (usually provided as the flexdll +# Git submodule) +FLEXDLL_SOURCES=@flexdir@ +BOOTSTRAPPING_FLEXDLL=@bootstrapping_flexdll@ diff --git a/Makefile.common b/Makefile.common index 4836437931..f19ccac34f 100644 --- a/Makefile.common +++ b/Makefile.common @@ -57,7 +57,7 @@ else BOOT_OCAMLC = $(OCAMLRUN) $(ROOTDIR)/boot/ocamlc endif -ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" "" +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" FLEXLINK_ENV = CAMLOPT_CMD = $(CAMLOPT) OCAMLOPT_CMD = $(OCAMLOPT) @@ -73,7 +73,7 @@ else MKLIB_CMD = $(FLEXLINK_ENV) $(MKLIB) ocamlc_cmd = $(FLEXLINK_ENV) $(ocamlc) ocamlopt_cmd = $(FLEXLINK_ENV) $(ocamlopt) -endif +endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" OPTCOMPFLAGS= ifeq "$(FUNCTION_SECTIONS)" "true" diff --git a/Makefile.config.in b/Makefile.config.in index c7bcf0c2a9..08ac80ffd0 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -203,7 +203,6 @@ OCAMLOPT_CPPFLAGS=@ocamlc_cppflags@ NATIVECCLIBS=@nativecclibs@ SYSTHREAD_SUPPORT=@systhread_support@ PACKLD=@PACKLD@ -IFLEXDIR=@iflexdir@ FLEXDLL_CHAIN=@flexdll_chain@ EXTRALIBS=@extralibs@ CCOMPTYPE=@ccomptype@ diff --git a/README.win32.adoc b/README.win32.adoc index 98552dce4e..8dea01d620 100644 --- a/README.win32.adoc +++ b/README.win32.adoc @@ -76,7 +76,7 @@ bootstrap FlexDLL, you will need to ensure that the directory to which you install FlexDLL is included in your `PATH` environment variable. Note: binary distributions of FlexDLL are compatible only with Visual Studio 2013 and earlier; for Visual Studio 2015 and later, you will need to compile the C -objects from source, or bootstrap FlexDLL (see below). +objects from source, or configure ocaml with the `--with-flexdll` option. The base bytecode system (ocamlc, ocaml, ocamllex, ocamlyacc, ...) of all three ports runs without any additional tools. @@ -246,7 +246,7 @@ C code (`ocamlc -custom`) require the appropriate Mingw-w64 gcc and the `mingw64-i686-gcc-core` package for 32-bit and the `mingw64-x86_64-gcc-core` package for 64-bit. - - Do not try to use the Cygwin version of flexdll for this port. + - The Cygwin version of flexdll does not work with this port. - The standalone mingw toolchain from the Mingw-w64 project (http://mingw-w64.org/) is not supported. Please use the version packaged in diff --git a/aclocal.m4 b/aclocal.m4 index 33873178ad..8401c4775c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -130,6 +130,7 @@ AC_DEFUN([OCAML_CC_SAVE_VARIABLES], [ saved_CC="$CC" saved_CFLAGS="$CFLAGS" saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" saved_ac_ext="$ac_ext" saved_ac_compile="$ac_compile" # Move the content of confdefs.h to another file so it does not @@ -147,6 +148,7 @@ AC_DEFUN([OCAML_CC_RESTORE_VARIABLES], [ CPPFLAGS="$saved_CPPFLAGS" CFLAGS="$saved_CFLAGS" CC="$saved_CC" + LIBS="$saved_LIBS" ]) AC_DEFUN([OCAML_AS_HAS_DEBUG_PREFIX_MAP], [ @@ -290,3 +292,67 @@ AC_DEFUN([OCAML_CHECK_LIBUNWIND], [ LDFLAGS="$SAVED_LDFLAGS" CFLAGS="$SAVED_CFLAGS" ]) + +AC_DEFUN([OCAML_TEST_FLEXLINK], [ + OCAML_CC_SAVE_VARIABLES + + AC_MSG_CHECKING([whether $1 works]) + + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([int answer = 42;])], + [# Create conftest1.$ac_objext as a symlink on Cygwin to ensure that native + # flexlink can cope. The reverse test is unnecessary (a Cygwin-compiled + # flexlink can read anything). + mv conftest.$ac_objext conftest1.$ac_objext + AS_CASE([$4],[*-pc-cygwin], + [ln -s conftest1.$ac_objext conftest2.$ac_objext], + [cp conftest1.$ac_objext conftest2.$ac_objext]) + + CC="$1 -chain $2 -exe" + LIBS="conftest2.$ac_objext" + CPPFLAGS="$3 $CPPFLAGS" + AC_LINK_IFELSE( + [AC_LANG_SOURCE([int main() { return 0; }])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([$1 does not work])])], + [AC_MSG_RESULT([unexpected compile error]) + AC_MSG_ERROR([error calling the C compiler])]) + + OCAML_CC_RESTORE_VARIABLES +]) + +AC_DEFUN([OCAML_TEST_FLEXDLL_H], [ + OCAML_CC_SAVE_VARIABLES + + AS_IF([test -n "$1"],[CPPFLAGS="-I $1 $CPPFLAGS"]) + have_flexdll_h=no + AC_CHECK_HEADER([flexdll.h],[have_flexdll_h=yes],[have_flexdll_h=no]) + AS_IF([test x"$have_flexdll_h" = 'xno'], + [AS_IF([test -n "$1"], + [AC_MSG_ERROR([$1/flexdll.h appears unusable])])]) + + OCAML_CC_RESTORE_VARIABLES +]) + +AC_DEFUN([OCAML_TEST_FLEXLINK_WHERE], [ + OCAML_CC_SAVE_VARIABLES + + AC_MSG_CHECKING([if "$1 -where" includes flexdll.h]) + flexlink_where="$($1 -where | tr -d '\r')" + CPPFLAGS="$CPPFLAGS -I \"$flexlink_where\"" + cat > conftest.c <<"EOF" +#include <flexdll.h> +int main (void) {return 0;} +EOF + cat > conftest.Makefile <<EOF +all: + $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS +EOF + AS_IF([make -f conftest.Makefile >/dev/null 2>/dev/null], + [have_flexdll_h=yes + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + + OCAML_CC_RESTORE_VARIABLES +]) @@ -699,6 +699,7 @@ DIRECT_LD INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +flexlink ac_ct_DEP_CC DEP_CC CPP @@ -799,7 +800,8 @@ RANLIB AR shebangscripts long_shebang -iflexdir +bootstrapping_flexdll +flexdir ocamlc_cppflags ocamlc_cflags nativecclibs @@ -910,6 +912,7 @@ enable_force_safe_string enable_flat_float_array enable_function_sections with_afl +with_flexdll enable_shared enable_static with_pic @@ -1602,6 +1605,7 @@ Optional Packages: --with-odoc build documentation with odoc --with-target-bindir location of binary programs on target system --with-afl use the AFL fuzzer + --with-flexdll bootstrap FlexDLL from the given sources --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both @@ -2793,7 +2797,6 @@ oc_ldflags="" oc_dll_ldflags="" with_sharedlibs=true ostype="Unix" -iflexdir="" SO="so" toolchain="cc" profinfo=false @@ -2801,6 +2804,7 @@ profinfo_width=0 extralibs= instrumented_runtime=false instrumented_runtime_libs="" +bootstrapping_flexdll=false # Information about the package @@ -2899,6 +2903,7 @@ VERSION=4.13.0+dev0-2020-10-19 + # TODO: rename this variable @@ -3338,6 +3343,15 @@ if test "${with_afl+set}" = set; then : fi + +# Check whether --with-flexdll was given. +if test "${with_flexdll+set}" = set; then : + withval=$with_flexdll; if test x"$withval" = 'xyes'; then : + with_flexdll=flexdll +fi +fi + + if test x"$enable_unix_lib" = "xno"; then : if test x"$enable_debugger" = "xyes"; then : as_fn_error $? "replay debugger requires the unix library" "$LINENO" 5 @@ -12787,46 +12801,365 @@ esac if test x"$enable_shared" = "xno"; then : with_sharedlibs=false + case $host in #( + *-pc-windows|*-w64-mingw32) : + as_fn_error $? "Cannot build native Win32 with --disable-shared" "$LINENO" 5 ;; #( + *) : + ;; +esac fi -case $CC,$host in #( - *,*-*-darwin*) : - mkexe="$mkexe -Wl,-no_compact_unwind"; - $as_echo "#define HAS_ARCH_CODE32 1" >>confdefs.h - ;; #( - *,*-*-haiku*) : - mathlib="" ;; #( - *,*-*-cygwin*) : +# Define flexlink chain and flags correctly for the different Windows ports +case $host in #( + i686-*-cygwin) : + flexdll_chain='cygwin' + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216" ;; #( + x86_64-*-cygwin) : + flexdll_chain='cygwin64' + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216" ;; #( + *-*-cygwin*) : + as_fn_error $? "unknown cygwin variant" "$LINENO" 5 ;; #( + i686-w64-mingw32) : + flexdll_chain='mingw' + flexlink_flags="-chain $flexdll_chain -stack 16777216" ;; #( + x86_64-w64-mingw32) : + flexdll_chain='mingw64' + flexlink_flags="-chain $flexdll_chain -stack 33554432" ;; #( + i686-pc-windows) : + flexdll_chain='msvc' + flexlink_flags="-merge-manifest -stack 16777216" ;; #( + x86_64-pc-windows) : + flexdll_chain='msvc64' + flexlink_flags="-x64 -merge-manifest -stack 33554432" ;; #( + *) : + ;; +esac + +if test x"$enable_shared" != 'xno'; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexdll sources" >&5 +$as_echo_n "checking for flexdll sources... " >&6; } + if test x"$with_flexdll" = "xno"; then : + flexdir='' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 +$as_echo "disabled" >&6; } +else + flexmsg='' case $target in #( - i686-*) : - flexdll_chain=cygwin ;; #( - x86_64-*) : - flexdll_chain=cygwin64 ;; #( + *-*-cygwin*|*-w64-mingw32|*-pc-windows) : + if test x"$with_flexdll" = 'x' -o x"$with_flexdll" = 'xflexdll'; then : + if test -f 'flexdll/flexdll.h'; then : + flexdir=flexdll + iflexdir='$(ROOTDIR)/flexdll' + with_flexdll="$iflexdir" +else + if test x"$with_flexdll" != 'x'; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: requested but not available" >&5 +$as_echo "requested but not available" >&6; } + as_fn_error $? "exiting" "$LINENO" 5 +fi +fi +else + rm -rf flexdll-sources + if test -f "$with_flexdll/flexdll.h"; then : + mkdir -p flexdll-sources + cp -r "$with_flexdll"/* flexdll-sources/ + flexdir='flexdll-sources' + iflexdir='$(ROOTDIR)/flexdll-sources' + flexmsg=" (from $with_flexdll)" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: requested but not available" >&5 +$as_echo "requested but not available" >&6; } + as_fn_error $? "exiting" "$LINENO" 5 +fi +fi + if test x"$flexdir" = 'x'; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $iflexdir$flexmsg" >&5 +$as_echo "$iflexdir$flexmsg" >&6; } + bootstrapping_flexdll=true + # The submodule should be searched *before* any other -I paths + internal_cppflags="-I $iflexdir $internal_cppflags" +fi ;; #( *) : - as_fn_error $? "unknown cygwin variant" "$LINENO" 5 ;; + if test x"$with_flexdll" != 'x'; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: requested but not supported" >&5 +$as_echo "requested but not supported" >&6; } + as_fn_error $? "exiting" "$LINENO" 5 +fi ;; esac - common_cppflags="$common_cppflags -U_WIN32" - if $with_sharedlibs; then : - if test -e 'flexdll/Makefile'; then : - flexdir='$(ROOTDIR)/flexdll' +fi + + # Extract the first word of "flexlink", so it can be a program name with args. +set dummy flexlink; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_flexlink+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$flexlink"; then + ac_cv_prog_flexlink="$flexlink" # Let the user override the test. +else +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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_flexlink="flexlink" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +flexlink=$ac_cv_prog_flexlink +if test -n "$flexlink"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flexlink" >&5 +$as_echo "$flexlink" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + if test -n "$flexlink" -a -z "$flexdir"; then : + + + + saved_CC="$CC" + saved_CFLAGS="$CFLAGS" + saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" + saved_ac_ext="$ac_ext" + saved_ac_compile="$ac_compile" + # Move the content of confdefs.h to another file so it does not + # get included + mv confdefs.h confdefs.h.bak + touch confdefs.h + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $flexlink works" >&5 +$as_echo_n "checking whether $flexlink works... " >&6; } + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int answer = 42; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # Create conftest1.$ac_objext as a symlink on Cygwin to ensure that native + # flexlink can cope. The reverse test is unnecessary (a Cygwin-compiled + # flexlink can read anything). + mv conftest.$ac_objext conftest1.$ac_objext + case $host in #( + *-pc-cygwin) : + ln -s conftest1.$ac_objext conftest2.$ac_objext ;; #( + *) : + cp conftest1.$ac_objext conftest2.$ac_objext ;; +esac + + CC="$flexlink -chain $flexdll_chain -exe" + LIBS="conftest2.$ac_objext" + CPPFLAGS="$internal_cppflags $CPPFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main() { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "$flexlink does not work" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unexpected compile error" >&5 +$as_echo "unexpected compile error" >&6; } + as_fn_error $? "error calling the C compiler" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + + # Restore the content of confdefs.h + mv confdefs.h.bak confdefs.h + ac_compile="$saved_ac_compile" + ac_ext="$saved_ac_ext" + CPPFLAGS="$saved_CPPFLAGS" + CFLAGS="$saved_CFLAGS" + CC="$saved_CC" + LIBS="$saved_LIBS" + + + + case $host in #( + *-w64-mingw32|*-pc-windows) : + flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" + if test -z "$flexlink_where"; then : + as_fn_error $? "$flexlink is not executable from a native Win32 process" "$LINENO" 5 + +fi ;; #( + *) : + ;; +esac + +fi + + + + saved_CC="$CC" + saved_CFLAGS="$CFLAGS" + saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" + saved_ac_ext="$ac_ext" + saved_ac_compile="$ac_compile" + # Move the content of confdefs.h to another file so it does not + # get included + mv confdefs.h confdefs.h.bak + touch confdefs.h + + + if test -n "$flexdir"; then : + CPPFLAGS="-I $flexdir $CPPFLAGS" +fi + have_flexdll_h=no + ac_fn_c_check_header_mongrel "$LINENO" "flexdll.h" "ac_cv_header_flexdll_h" "$ac_includes_default" +if test "x$ac_cv_header_flexdll_h" = xyes; then : + have_flexdll_h=yes +else + have_flexdll_h=no +fi + + + if test x"$have_flexdll_h" = 'xno'; then : + if test -n "$flexdir"; then : + as_fn_error $? "$flexdir/flexdll.h appears unusable" "$LINENO" 5 +fi +fi + + + # Restore the content of confdefs.h + mv confdefs.h.bak confdefs.h + ac_compile="$saved_ac_compile" + ac_ext="$saved_ac_ext" + CPPFLAGS="$saved_CPPFLAGS" + CFLAGS="$saved_CFLAGS" + CC="$saved_CC" + LIBS="$saved_LIBS" + + + + if test -n "$flexlink" -a x"$have_flexdll_h" = 'xno'; then : + + + saved_CC="$CC" + saved_CFLAGS="$CFLAGS" + saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" + saved_ac_ext="$ac_ext" + saved_ac_compile="$ac_compile" + # Move the content of confdefs.h to another file so it does not + # get included + mv confdefs.h confdefs.h.bak + touch confdefs.h + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"$flexlink -where\" includes flexdll.h" >&5 +$as_echo_n "checking if \"$flexlink -where\" includes flexdll.h... " >&6; } + flexlink_where="$($flexlink -where | tr -d '\r')" + CPPFLAGS="$CPPFLAGS -I \"$flexlink_where\"" + cat > conftest.c <<"EOF" +#include <flexdll.h> +int main (void) {return 0;} +EOF + cat > conftest.Makefile <<EOF +all: + $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS +EOF + if make -f conftest.Makefile >/dev/null 2>/dev/null; then : + have_flexdll_h=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } else - flexlink="flexlink -chain $flexdll_chain -merge-manifest \ --stack 16777216" - flexdir="$($flexlink -where | tr -d '\r')" - if test -z "$flexdir"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: flexlink not found: native shared libraries won't be available. - " >&5 -$as_echo "$as_me: WARNING: flexlink not found: native shared libraries won't be available. - " >&2;} - with_sharedlibs=false + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + # Restore the content of confdefs.h + mv confdefs.h.bak confdefs.h + ac_compile="$saved_ac_compile" + ac_ext="$saved_ac_ext" + CPPFLAGS="$saved_CPPFLAGS" + CFLAGS="$saved_CFLAGS" + CC="$saved_CC" + LIBS="$saved_LIBS" + + + if test "x$have_flexdll_h" = 'xyes'; then : + internal_cppflags="$internal_cppflags -I \"$flexlink_where\"" +fi + +fi + +fi +if test x"$have_flexdll_h" = 'xno'; then : + case $host in #( + *-*-cygwin*) : + if $with_sharedlibs; then : + with_sharedlibs=false + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: flexdll.h not found: shared library support disabled." >&5 +$as_echo "$as_me: WARNING: flexdll.h not found: shared library support disabled." >&2;} + +fi ;; #( + *-w64-mingw32|*-pc-windows) : + as_fn_error $? "flexdll.h is required for native Win32" "$LINENO" 5 ;; #( + *) : + ;; +esac fi +if test -z "$flexdir" -o x"$have_flexdll_h" = 'xno'; then : + case $host in #( + *-*-cygwin*) : + if $with_sharedlibs; then : + if test -z "$flexlink"; then : + with_sharedlibs=false + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: flexlink/flexdll.h not found: shared library support disabled." >&5 +$as_echo "$as_me: WARNING: flexlink/flexdll.h not found: shared library support disabled." >&2;} + fi +fi ;; #( + *-w64-mingw32|*-pc-windows) : + if test -z "$flexlink"; then : + as_fn_error $? "flexlink is required for native Win32" "$LINENO" 5 +fi ;; #( + *) : + ;; +esac fi + +case $CC,$host in #( + *,*-*-darwin*) : + mkexe="$mkexe -Wl,-no_compact_unwind"; + $as_echo "#define HAS_ARCH_CODE32 1" >>confdefs.h + ;; #( + *,*-*-haiku*) : + mathlib="" ;; #( + *,*-*-cygwin*) : + common_cppflags="$common_cppflags -U_WIN32" if $with_sharedlibs; then : - iflexdir="-I\"$flexdir\"" - mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' + mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' mkexedebugflag="-link -g" else mkexe="$mkexe -Wl,--stack,16777216" @@ -12835,25 +13168,13 @@ else fi ostype="Cygwin" ;; #( *,*-*-mingw32) : - if $with_sharedlibs; then : - case $host in #( + case $host in #( i686-*-*) : - flexdll_chain="mingw"; oc_dll_ldflags="-static-libgcc" ;; #( - x86_64-*-*) : - flexdll_chain="mingw64" ;; #( + oc_dll_ldflags="-static-libgcc" ;; #( *) : ;; esac - if test -e 'flexdll/Makefile'; then : - flexdir='$(ROOTDIR)/flexdll' -else - flexlink="flexlink -chain $flexdll_chain -merge-manifest \ --stack 16777216" - flexdir="$($flexlink -where | tr -d '\r')" -fi - iflexdir="-I\"$flexdir\"" - mkexedebugflag="-link -g" -fi + mkexedebugflag="-link -g" ostype="Win32" toolchain="mingw" mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' @@ -12864,25 +13185,7 @@ fi ostype="Win32" mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' oc_ldflags='/ENTRY:wmainCRTStartup' - case $host in #( - i686-pc-windows) : - flexdll_chain=msvc ;; #( - x86_64-pc-windows) : - flexdll_chain=msvc64 ;; #( - *) : - ;; -esac - if $with_sharedlibs; then : - if test -e 'flexdll/Makefile'; then : - flexdir='$(ROOTDIR)/flexdll' -else - flexlink="flexlink -chain $flexdll_chain -merge-manifest \ --stack 16777216" - flexdir="$($flexlink -where | tr -d '\r')" -fi - iflexdir="-I\"$flexdir\"" - mkexedebugflag='' -fi ;; #( + mkexedebugflag='' ;; #( *,x86_64-*-linux*) : $as_echo "#define HAS_ARCH_CODE32 1" >>confdefs.h ;; #( @@ -16793,6 +17096,7 @@ $as_echo_n "checking whether the assembler supports --debug-prefix-map... " >&6; saved_CC="$CC" saved_CFLAGS="$CFLAGS" saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" saved_ac_ext="$ac_ext" saved_ac_compile="$ac_compile" # Move the content of confdefs.h to another file so it does not @@ -16835,6 +17139,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$saved_CPPFLAGS" CFLAGS="$saved_CFLAGS" CC="$saved_CC" + LIBS="$saved_LIBS" @@ -16849,6 +17154,7 @@ else saved_CC="$CC" saved_CFLAGS="$CFLAGS" saved_CPPFLAGS="$CPPFLAGS" + saved_LIBS="$LIBS" saved_ac_ext="$ac_ext" saved_ac_compile="$ac_compile" # Move the content of confdefs.h to another file so it does not @@ -16914,6 +17220,7 @@ fi CPPFLAGS="$saved_CPPFLAGS" CFLAGS="$saved_CFLAGS" CC="$saved_CC" + LIBS="$saved_LIBS" if $aspp_ok && $as_ok; then : @@ -17258,30 +17565,6 @@ esac ;; #( windows_unicode=0 ;; esac -# Define flexlink chain and flags correctly for the different Windows ports -case $host in #( - i686-*-cygwin) : - flexdll_chain='cygwin' - flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216" ;; #( - x86_64-*-cygwin) : - flexdll_chain='cygwin64' - flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216" ;; #( - i686-w64-mingw32) : - flexdll_chain='mingw' - flexlink_flags="-chain $flexdll_chain -stack 16777216" ;; #( - x86_64-w64-mingw32) : - flexdll_chain='mingw64' - flexlink_flags="-chain $flexdll_chain -stack 33554432" ;; #( - i686-pc-windows) : - flexdll_chain='msvc' - flexlink_flags="-merge-manifest -stack 16777216" ;; #( - x86_64-pc-windows) : - flexdll_chain='msvc64' - flexlink_flags="-x64 -merge-manifest -stack 33554432" ;; #( - *) : - ;; -esac - # Define default prefix correctly for the different Windows ports if test x"$prefix" = "xNONE"; then : case $host in #( @@ -17343,6 +17626,9 @@ else stdlib_manpages=false fi +# Do not permanently cache the result of flexdll.h +unset ac_cv_header_flexdll_h + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure diff --git a/configure.ac b/configure.ac index cfd6719266..9a63ecfc6b 100644 --- a/configure.ac +++ b/configure.ac @@ -57,7 +57,6 @@ oc_ldflags="" oc_dll_ldflags="" with_sharedlibs=true ostype="Unix" -iflexdir="" SO="so" toolchain="cc" profinfo=false @@ -65,6 +64,7 @@ profinfo_width=0 extralibs= instrumented_runtime=false instrumented_runtime_libs="" +bootstrapping_flexdll=false # Information about the package @@ -116,7 +116,8 @@ AC_SUBST([bytecclibs]) AC_SUBST([nativecclibs]) AC_SUBST([ocamlc_cflags]) AC_SUBST([ocamlc_cppflags]) -AC_SUBST([iflexdir]) +AC_SUBST([flexdir]) +AC_SUBST([bootstrapping_flexdll]) AC_SUBST([long_shebang]) AC_SUBST([shebangscripts]) AC_SUBST([AR]) @@ -394,6 +395,11 @@ AC_ARG_WITH([afl], [AS_HELP_STRING([--with-afl], [use the AFL fuzzer])]) +AC_ARG_WITH([flexdll], + [AS_HELP_STRING([--with-flexdll], + [bootstrap FlexDLL from the given sources])], + [AS_IF([test x"$withval" = 'xyes'],[with_flexdll=flexdll])]) + AS_IF([test x"$enable_unix_lib" = "xno"], [AS_IF([test x"$enable_debugger" = "xyes"], [AC_MSG_ERROR([replay debugger requires the unix library])], @@ -676,7 +682,115 @@ AS_CASE([$host], # [*-pc-windows], # [enable_shared=yes]) -AS_IF([test x"$enable_shared" = "xno"],[with_sharedlibs=false]) +AS_IF([test x"$enable_shared" = "xno"], + [with_sharedlibs=false + AS_CASE([$host], + [*-pc-windows|*-w64-mingw32], + [AC_MSG_ERROR([Cannot build native Win32 with --disable-shared])])]) + +# Define flexlink chain and flags correctly for the different Windows ports +AS_CASE([$host], + [i686-*-cygwin], + [flexdll_chain='cygwin' + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"], + [x86_64-*-cygwin], + [flexdll_chain='cygwin64' + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"], + [*-*-cygwin*], + [AC_MSG_ERROR([unknown cygwin variant])], + [i686-w64-mingw32], + [flexdll_chain='mingw' + flexlink_flags="-chain $flexdll_chain -stack 16777216"], + [x86_64-w64-mingw32], + [flexdll_chain='mingw64' + flexlink_flags="-chain $flexdll_chain -stack 33554432"], + [i686-pc-windows], + [flexdll_chain='msvc' + flexlink_flags="-merge-manifest -stack 16777216"], + [x86_64-pc-windows], + [flexdll_chain='msvc64' + flexlink_flags="-x64 -merge-manifest -stack 33554432"]) + +AS_IF([test x"$enable_shared" != 'xno'], [ + AC_MSG_CHECKING([for flexdll sources]) + AS_IF([test x"$with_flexdll" = "xno"], + [flexdir='' + AC_MSG_RESULT([disabled])], + [flexmsg='' + AS_CASE([$target], + [*-*-cygwin*|*-w64-mingw32|*-pc-windows], + [AS_IF([test x"$with_flexdll" = 'x' -o x"$with_flexdll" = 'xflexdll'], + [AS_IF([test -f 'flexdll/flexdll.h'], + [flexdir=flexdll + iflexdir='$(ROOTDIR)/flexdll' + with_flexdll="$iflexdir"], + [AS_IF([test x"$with_flexdll" != 'x'], + [AC_MSG_RESULT([requested but not available]) + AC_MSG_ERROR([exiting])])])], + [rm -rf flexdll-sources + AS_IF([test -f "$with_flexdll/flexdll.h"], + [mkdir -p flexdll-sources + cp -r "$with_flexdll"/* flexdll-sources/ + flexdir='flexdll-sources' + iflexdir='$(ROOTDIR)/flexdll-sources' + flexmsg=" (from $with_flexdll)"], + [AC_MSG_RESULT([requested but not available]) + AC_MSG_ERROR([exiting])])]) + AS_IF([test x"$flexdir" = 'x'], + [AC_MSG_RESULT([no])], + [AC_MSG_RESULT([$iflexdir$flexmsg]) + bootstrapping_flexdll=true + # The submodule should be searched *before* any other -I paths + internal_cppflags="-I $iflexdir $internal_cppflags"])], + [AS_IF([test x"$with_flexdll" != 'x'], + [AC_MSG_RESULT([requested but not supported]) + AC_MSG_ERROR([exiting])])])]) + + AC_CHECK_PROG([flexlink],[flexlink],[flexlink]) + + AS_IF([test -n "$flexlink" -a -z "$flexdir"],[ + OCAML_TEST_FLEXLINK([$flexlink], [$flexdll_chain], + [$internal_cppflags], [$host]) + + AS_CASE([$host], + [*-w64-mingw32|*-pc-windows], + [flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" + AS_IF([test -z "$flexlink_where"], + [AC_MSG_ERROR([$flexlink is not executable from a native Win32 process]) + ])]) + ]) + + OCAML_TEST_FLEXDLL_H([$flexdir]) + + AS_IF([test -n "$flexlink" -a x"$have_flexdll_h" = 'xno'], + [OCAML_TEST_FLEXLINK_WHERE([$flexlink]) + AS_IF([test "x$have_flexdll_h" = 'xyes'], + [internal_cppflags="$internal_cppflags -I \"$flexlink_where\""]) + ]) +]) + +AS_IF([test x"$have_flexdll_h" = 'xno'], + [AS_CASE([$host], + [*-*-cygwin*], + [AS_IF([$with_sharedlibs], + [with_sharedlibs=false + AC_MSG_WARN([flexdll.h not found: shared library support disabled.]) + ])], + [*-w64-mingw32|*-pc-windows], + [AC_MSG_ERROR([flexdll.h is required for native Win32])])]) + +AS_IF([test -z "$flexdir" -o x"$have_flexdll_h" = 'xno'], + [AS_CASE([$host], + [*-*-cygwin*], + [AS_IF([$with_sharedlibs], + [AS_IF([test -z "$flexlink"], + [with_sharedlibs=false + AC_MSG_WARN( + [flexlink/flexdll.h not found: shared library support disabled.]) + ])])], + [*-w64-mingw32|*-pc-windows], + [AS_IF([test -z "$flexlink"], + [AC_MSG_ERROR([flexlink is required for native Win32])])])]) AS_CASE([$CC,$host], [*,*-*-darwin*], @@ -684,44 +798,18 @@ AS_CASE([$CC,$host], AC_DEFINE([HAS_ARCH_CODE32], [1])], [*,*-*-haiku*], [mathlib=""], [*,*-*-cygwin*], - [AS_CASE([$target], - [i686-*], [flexdll_chain=cygwin], - [x86_64-*], [flexdll_chain=cygwin64], - [AC_MSG_ERROR([unknown cygwin variant])]) - common_cppflags="$common_cppflags -U_WIN32" + [common_cppflags="$common_cppflags -U_WIN32" AS_IF([$with_sharedlibs], - [AS_IF([test -e 'flexdll/Makefile'], - [flexdir='$(ROOTDIR)/flexdll'], - [flexlink="flexlink -chain $flexdll_chain -merge-manifest \ --stack 16777216" - flexdir="$($flexlink -where | tr -d '\r')" - AS_IF([test -z "$flexdir"], - [AC_MSG_WARN( - [flexlink not found: native shared libraries won't be available.] - ) - with_sharedlibs=false] - )] - )]) - AS_IF([$with_sharedlibs], - [iflexdir="-I\"$flexdir\"" - mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' + [mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' mkexedebugflag="-link -g"], [mkexe="$mkexe -Wl,--stack,16777216" oc_ldflags="-Wl,--stack,16777216"] ) ostype="Cygwin"], [*,*-*-mingw32], - [AS_IF([$with_sharedlibs], - [AS_CASE([$host], - [i686-*-*], [flexdll_chain="mingw"; oc_dll_ldflags="-static-libgcc"], - [x86_64-*-*], [flexdll_chain="mingw64"]) - AS_IF([test -e 'flexdll/Makefile'], - [flexdir='$(ROOTDIR)/flexdll'], - [flexlink="flexlink -chain $flexdll_chain -merge-manifest \ --stack 16777216" - flexdir="$($flexlink -where | tr -d '\r')"]) - iflexdir="-I\"$flexdir\"" - mkexedebugflag="-link -g"]) + [AS_CASE([$host], + [i686-*-*], [oc_dll_ldflags="-static-libgcc"]) + mkexedebugflag="-link -g" ostype="Win32" toolchain="mingw" mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' @@ -732,17 +820,7 @@ AS_CASE([$CC,$host], ostype="Win32" mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' oc_ldflags='/ENTRY:wmainCRTStartup' - AS_CASE([$host], - [i686-pc-windows], [flexdll_chain=msvc], - [x86_64-pc-windows], [flexdll_chain=msvc64]) - AS_IF([$with_sharedlibs], - [AS_IF([test -e 'flexdll/Makefile'], - [flexdir='$(ROOTDIR)/flexdll'], - [flexlink="flexlink -chain $flexdll_chain -merge-manifest \ --stack 16777216" - flexdir="$($flexlink -where | tr -d '\r')"]) - iflexdir="-I\"$flexdir\"" - mkexedebugflag=''])], + mkexedebugflag=''], [*,x86_64-*-linux*], AC_DEFINE([HAS_ARCH_CODE32], [1]), [xlc*,powerpc-ibm-aix*], @@ -1874,27 +1952,6 @@ AS_CASE([$host], [AC_MSG_ERROR([unexpected windows unicode mode])])], [windows_unicode=0]) -# Define flexlink chain and flags correctly for the different Windows ports -AS_CASE([$host], - [i686-*-cygwin], - [flexdll_chain='cygwin' - flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"], - [x86_64-*-cygwin], - [flexdll_chain='cygwin64' - flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"], - [i686-w64-mingw32], - [flexdll_chain='mingw' - flexlink_flags="-chain $flexdll_chain -stack 16777216"], - [x86_64-w64-mingw32], - [flexdll_chain='mingw64' - flexlink_flags="-chain $flexdll_chain -stack 33554432"], - [i686-pc-windows], - [flexdll_chain='msvc' - flexlink_flags="-merge-manifest -stack 16777216"], - [x86_64-pc-windows], - [flexdll_chain='msvc64' - flexlink_flags="-x64 -merge-manifest -stack 33554432"]) - # Define default prefix correctly for the different Windows ports AS_IF([test x"$prefix" = "xNONE"], [AS_CASE([$host], @@ -1928,4 +1985,7 @@ AS_CASE([$host], AS_IF([test x"$enable_stdlib_manpages" != "xno"], [stdlib_manpages=true],[stdlib_manpages=false]) +# Do not permanently cache the result of flexdll.h +unset ac_cv_header_flexdll_h + AC_OUTPUT diff --git a/runtime/Makefile b/runtime/Makefile index 71eb3dbc19..d099f813d0 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -124,8 +124,6 @@ OCAML_STDLIB_DIR = $(LIBDIR) STDLIB_CPP_FLAG = -DOCAML_STDLIB_DIR='"$(OCAML_STDLIB_DIR)"' endif -OC_CPPFLAGS += $(IFLEXDIR) - ifneq "$(CCOMPTYPE)" "msvc" OC_CFLAGS += -g endif @@ -138,7 +136,7 @@ ifeq "$(UNIX_OR_WIN32)" "unix" OC_NATIVE_CPPFLAGS += -DMODEL_$(MODEL) endif -OC_NATIVE_CPPFLAGS += -DSYS_$(SYSTEM) $(IFLEXDIR) +OC_NATIVE_CPPFLAGS += -DSYS_$(SYSTEM) OC_DEBUG_CPPFLAGS=-DDEBUG OC_INSTR_CPPFLAGS=-DCAML_INSTR diff --git a/testsuite/Makefile b/testsuite/Makefile index e33bd58ecd..9d613da10c 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -46,14 +46,14 @@ else # Windows find := /usr/bin/find endif -ifneq "$(FLEXDLL_SUBMODULE_PRESENT)" "" +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" + FLEXLINK_ENV = +else # The testsuite needs an absolute path to the runtime, so override the # definition in Makefile.common FLEXLINK_ENV = \ OCAML_FLEXLINK="$(ROOTDIR_HOST)/boot/ocamlrun$(EXE) \ $(ROOTDIR_HOST)/boot/flexlink.byte$(EXE)" -else - FLEXLINK_ENV = endif ifeq "$(ocamltest_program)" "" diff --git a/tools/ci/appveyor/appveyor_build.sh b/tools/ci/appveyor/appveyor_build.sh index 302e90b575..f5165863d2 100644 --- a/tools/ci/appveyor/appveyor_build.sh +++ b/tools/ci/appveyor/appveyor_build.sh @@ -89,7 +89,7 @@ function set_configuration { } APPVEYOR_BUILD_FOLDER=$(echo "$APPVEYOR_BUILD_FOLDER" | cygpath -f -) -FLEXDLLROOT="$(echo "$OCAMLROOT" | cygpath -f -)/bin/flexdll" +FLEXDLLROOT="$PROGRAMFILES/flexdll" OCAMLROOT=$(echo "$OCAMLROOT" | cygpath -f - -m) if [[ $BOOTSTRAP_FLEXDLL = 'false' ]] ; then @@ -178,9 +178,7 @@ case "$1" in # For an explanation of the sed command, see # https://github.com/appveyor/ci/issues/1824 script --quiet --return --command \ - "( test "$BOOTSTRAP_FLEXDLL" = 'false' || "\ -"$MAKE -C ../$BUILD_PREFIX-$PORT flexdll ) && "\ -"$MAKE -C ../$BUILD_PREFIX-$PORT world.opt" \ + "$MAKE -C ../$BUILD_PREFIX-$PORT world.opt" \ "../$BUILD_PREFIX-$PORT/build.log" | sed -e 's/\d027\[K//g' \ -e 's/\d027\[m/\d027[0m/g' \ diff --git a/utils/Makefile b/utils/Makefile index e573812844..5ff17f64a3 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -19,14 +19,10 @@ ROOTDIR = .. include $(ROOTDIR)/Makefile.common -ifeq "$(UNIX_OR_WIN32)" "win32" -ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" "" +ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" FLEXDLL_DIR = else - FLEXDLL_DIR = $(if $(wildcard $(ROOTDIR)/flexdll/flexdll_*.$(O)),+flexdll) -endif -else - FLEXDLL_DIR = + FLEXDLL_DIR = +flexdll endif FLEXLINK_FLAGS ?= |