The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #10135 from dra27/faster-flexdll

Overhaul the FlexDLL bootstrap

authored by

David Allsopp and committed by
GitHub
3ecc6cda 79f6c222

+830 -315
+1
.gitattributes
··· 151 151 152 152 /tools/ci/appveyor/appveyor_build.cmd text eol=crlf 153 153 154 + aclocal.m4 typo.tab 154 155 configure.ac text eol=lf 155 156 build-aux/compile text eol=lf 156 157 build-aux/config.guess text eol=lf
+5
.gitignore
··· 48 48 /ocaml-*.cache 49 49 /config.log 50 50 /config.status 51 + /flexlink.opt 51 52 /libtool 52 53 /ocamlc.opt 53 54 /expunge ··· 67 68 /asmcomp/CSE.ml 68 69 69 70 /boot/ocamlrun 71 + /boot/ocamlruns 70 72 /boot/camlheader 71 73 /boot/ocamlc.opt 74 + /boot/flexlink.byte 72 75 73 76 /bytecomp/opcodes.ml 74 77 /bytecomp/opcodes.mli ··· 80 83 81 84 /emacs/ocamltags 82 85 /emacs/*.elc 86 + 87 + /flexdll-sources 83 88 84 89 /lambda/runtimedef.ml 85 90
+9
Changes
··· 361 361 (Gabriel Scherer, review by Sébastien Hinderer and David Allsopp, 362 362 report by Ralph Seichter) 363 363 364 + - #10135: Overhaul the FlexDLL bootstrap process. It's now fully integrated 365 + with the default build target and controlled by --with-flexdll which allows 366 + externally downloaded sources for FlexDLL to be specified. A separate 367 + non-shared version of the runtime is built, and shared artefacts are no longer 368 + built twice. When bootstrapping, any flexlink in PATH is now ignored and the 369 + Cygwin port also supports bootstrapping FlexDLL. flexlink.opt is automatically 370 + built and installed as part of opt.opt/world.opt. 371 + (David Allsopp, review by Sébastien Hinderer) 372 + 364 373 - #10156: configure script: fix sockets feature detection. 365 374 (Lucas Pluvinage, review by David Allsopp and Damien Doligez) 366 375
+121 -75
Makefile
··· 88 88 EXTRAPATH = PATH="otherlibs/win32unix:$(PATH)" 89 89 endif 90 90 91 - BOOT_FLEXLINK_CMD= 92 91 93 - ifeq "$(UNIX_OR_WIN32)" "win32" 94 - FLEXDLL_SUBMODULE_PRESENT := $(wildcard flexdll/Makefile) 95 - ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" "" 92 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 93 + COLDSTART_DEPS = 96 94 BOOT_FLEXLINK_CMD = 97 95 else 96 + COLDSTART_DEPS = boot/ocamlruns$(EXE) 98 97 BOOT_FLEXLINK_CMD = \ 99 - FLEXLINK_CMD="../boot/ocamlrun$(EXE) ../flexdll/flexlink.exe" 100 - endif 101 - else 98 + FLEXLINK_CMD="../boot/ocamlruns$(EXE) ../boot/flexlink.byte$(EXE)" 102 99 endif 103 100 104 101 expunge := expunge$(EXE) ··· 135 132 136 133 $(foreach program, $(programs), $(eval $(call PROGRAM_SYNONYM,$(program)))) 137 134 135 + USE_RUNTIME_PRIMS = -use-prims ../runtime/primitives 136 + USE_STDLIB = -nostdlib -I ../stdlib 137 + 138 + FLEXDLL_OBJECTS = \ 139 + flexdll_$(FLEXDLL_CHAIN).$(O) flexdll_initer_$(FLEXDLL_CHAIN).$(O) 140 + FLEXLINK_BUILD_ENV = \ 141 + MSVC_DETECT=0 OCAML_CONFIG_FILE=../Makefile.config \ 142 + CHAINS=$(FLEXDLL_CHAIN) ROOTDIR=.. 143 + 144 + boot/ocamlruns$(EXE): 145 + $(MAKE) -C runtime ocamlruns$(EXE) 146 + cp runtime/ocamlruns$(EXE) boot/ocamlruns$(EXE) 147 + 138 148 # Start up the system from the distribution compiler 149 + # The process depends on whether FlexDLL is also being bootstrapped. 150 + # Normal procedure: 151 + # - Build the runtime 152 + # - Build the standard library using runtime/ocamlrun 153 + # FlexDLL procedure: 154 + # - Build ocamlruns 155 + # - Build the standard library using boot/ocamlruns 156 + # - Build flexlink and FlexDLL support objects 157 + # - Build the runtime 158 + # runtime/ocamlrun is then installed to boot/ocamlrun and the stdlib artefacts 159 + # are copied to boot/ 139 160 .PHONY: coldstart 140 - coldstart: 161 + coldstart: $(COLDSTART_DEPS) 162 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 163 + $(MAKE) -C runtime all 164 + $(MAKE) -C stdlib \ 165 + OCAMLRUN='$$(ROOTDIR)/runtime/ocamlrun$(EXE)' \ 166 + CAMLC='$$(BOOT_OCAMLC) $(USE_RUNTIME_PRIMS)' all 167 + else 168 + $(MAKE) -C stdlib OCAMLRUN='$$(ROOTDIR)/boot/ocamlruns$(EXE)' \ 169 + CAMLC='$$(BOOT_OCAMLC)' all 170 + $(MAKE) -C $(FLEXDLL_SOURCES) $(FLEXLINK_BUILD_ENV) \ 171 + OCAMLRUN='$$(ROOTDIR)/boot/ocamlruns$(EXE)' NATDYNLINK=false \ 172 + OCAMLOPT='$(value BOOT_OCAMLC) $(USE_RUNTIME_PRIMS) $(USE_STDLIB)' \ 173 + flexlink.exe support 174 + mv $(FLEXDLL_SOURCES)/flexlink.exe boot/flexlink.byte$(EXE) 175 + cp $(addprefix $(FLEXDLL_SOURCES)/, $(FLEXDLL_OBJECTS)) boot/ 141 176 $(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) all 177 + endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 142 178 cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE) 143 - $(MAKE) -C stdlib $(BOOT_FLEXLINK_CMD) \ 144 - CAMLC='$$(BOOT_OCAMLC) -use-prims ../runtime/primitives' all 145 179 cd boot; rm -f $(LIBFILES) 146 180 cd stdlib; cp $(LIBFILES) ../boot 147 181 cd boot; $(LN) ../runtime/libcamlrun.$(A) . ··· 213 247 $(MAKE) coreall 214 248 $(MAKE) ocaml 215 249 $(MAKE) opt-core 250 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" 251 + $(MAKE) flexlink.opt$(EXE) 252 + endif 216 253 $(MAKE) ocamlc.opt 217 254 $(MAKE) otherlibraries $(WITH_DEBUGGER) $(WITH_OCAMLDOC) \ 218 255 $(WITH_OCAMLTEST) ··· 278 315 # Different git mechanism displayed depending on whether this source tree came 279 316 # from a git clone or a source tarball. 280 317 281 - flexdll/Makefile: 282 - @echo In order to bootstrap FlexDLL, you need to place the sources in 283 - @echo flexdll. 318 + .PHONY: flexdll flexlink flexlink.opt 319 + 320 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 321 + flexdll flexlink flexlink.opt: 322 + @echo It is no longer necessary to bootstrap FlexDLL with a separate 323 + @echo make invocation. Simply place the sources for FlexDLL in a 324 + @echo sub-directory. 284 325 @echo This can either be done by downloading a source tarball from 285 - @echo \ http://alain.frisch.fr/flexdll.html 326 + @echo \ https://github.com/alainfrisch/flexdll/releases 286 327 @if [ -d .git ]; then \ 287 328 echo or by checking out the flexdll submodule with; \ 288 329 echo \ git submodule update --init; \ ··· 290 331 echo or by cloning the git repository; \ 291 332 echo \ git clone https://github.com/alainfrisch/flexdll.git; \ 292 333 fi 334 + @echo "Then pass --with-flexdll=<dir> to configure and build as normal." 293 335 @false 294 336 337 + else 338 + 295 339 .PHONY: flexdll 296 - flexdll: flexdll/Makefile flexlink 297 - $(MAKE) -C flexdll \ 298 - OCAML_CONFIG_FILE=../Makefile.config \ 299 - MSVC_DETECT=0 CHAINS=$(FLEXDLL_CHAIN) NATDYNLINK=false support 300 - 301 - # Bootstrapping flexlink - leaves a bytecode image of flexlink.exe in flexdll/ 302 - FLEXLINK_OCAMLOPT = \ 303 - ../boot/ocamlrun$(EXE) ../boot/ocamlc \ 304 - -use-prims ../runtime/primitives -nostdlib -I ../boot 340 + flexdll: flexdll/Makefile 341 + @echo WARNING! make flexdll is no longer required 342 + @echo This target will be removed in a future release. 305 343 306 344 .PHONY: flexlink 307 - flexlink: flexdll/Makefile 308 - $(MAKE) -C runtime BOOTSTRAPPING_FLEXLINK=yes ocamlrun$(EXE) 309 - cp runtime/ocamlrun$(EXE) boot/ocamlrun$(EXE) 310 - $(MAKE) -C stdlib \ 311 - COMPILER="../boot/ocamlc -use-prims ../runtime/primitives" \ 312 - $(filter-out *.cmi,$(LIBFILES)) 313 - cd stdlib && cp $(LIBFILES) ../boot/ 314 - $(MAKE) -C flexdll MSVC_DETECT=0 OCAML_CONFIG_FILE=../Makefile.config \ 315 - CHAINS=$(FLEXDLL_CHAIN) NATDYNLINK=false \ 316 - OCAMLOPT="$(FLEXLINK_OCAMLOPT)" \ 317 - flexlink.exe 318 - $(MAKE) -C runtime clean 319 - $(MAKE) partialclean 345 + flexlink: 346 + @echo Bootstrapping just flexlink.exe is no longer supported 347 + @echo Bootstrapping FlexDLL is now enabled with 348 + @echo ./configure --with-flexdll 349 + @false 320 350 321 - .PHONY: flexlink.opt 322 - flexlink.opt: 323 - cd flexdll && \ 324 - mv flexlink.exe flexlink && \ 325 - ($(MAKE) OCAML_FLEXLINK="../boot/ocamlrun$(EXE) ./flexlink" \ 326 - MSVC_DETECT=0 OCAML_CONFIG_FILE=../Makefile.config \ 327 - OCAMLOPT="../ocamlopt.opt$(EXE) -nostdlib -I ../stdlib" \ 328 - flexlink.exe || \ 329 - (mv flexlink flexlink.exe && false)) && \ 330 - mv flexlink.exe flexlink.opt && \ 331 - mv flexlink flexlink.exe 351 + ifeq "$(wildcard ocamlopt.opt$(EXE))" "" 352 + FLEXLINK_OCAMLOPT=../runtime/ocamlrun$(EXE) ../ocamlopt$(EXE) 353 + else 354 + FLEXLINK_OCAMLOPT=../ocamlopt.opt$(EXE) 355 + endif 356 + 357 + flexlink.opt$(EXE): 358 + $(MAKE) -C $(FLEXDLL_SOURCES) $(FLEXLINK_BUILD_ENV) \ 359 + OCAML_FLEXLINK='$(value OCAMLRUN) $$(ROOTDIR)/boot/flexlink.byte$(EXE)' \ 360 + OCAMLOPT="$(FLEXLINK_OCAMLOPT) -nostdlib -I ../stdlib" flexlink.exe 361 + mv $(FLEXDLL_SOURCES)/flexlink.exe $@ 332 362 333 - INSTALL_COMPLIBDIR=$(DESTDIR)$(COMPLIBDIR) 334 - INSTALL_FLEXDLLDIR=$(INSTALL_LIBDIR)/flexdll 363 + partialclean:: 364 + rm -f flexlink.opt$(EXE) 365 + endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 335 366 336 - .PHONY: install-flexdll 337 - install-flexdll: 338 - $(INSTALL_PROG) flexdll/flexlink.exe "$(INSTALL_BINDIR)/flexlink$(EXE)" 339 - ifneq "$(filter-out mingw,$(TOOLCHAIN))" "" 340 - $(INSTALL_DATA) flexdll/default$(filter-out _i386,_$(ARCH)).manifest \ 341 - "$(INSTALL_BINDIR)/" 342 - endif 343 - if test -n "$(wildcard flexdll/flexdll_*.$(O))" ; then \ 344 - $(MKDIR) "$(INSTALL_FLEXDLLDIR)" ; \ 345 - $(INSTALL_DATA) flexdll/flexdll_*.$(O) "$(INSTALL_FLEXDLLDIR)" ; \ 346 - fi 367 + INSTALL_COMPLIBDIR = $(DESTDIR)$(COMPLIBDIR) 368 + INSTALL_FLEXDLLDIR = $(INSTALL_LIBDIR)/flexdll 369 + FLEXDLL_MANIFEST = default$(filter-out _i386,_$(ARCH)).manifest 347 370 348 371 # Installation 349 372 .PHONY: install ··· 424 447 if test -n "$(WITH_DEBUGGER)"; then \ 425 448 $(MAKE) -C debugger install; \ 426 449 fi 427 - ifeq "$(UNIX_OR_WIN32)" "win32" 428 - if test -n "$(FLEXDLL_SUBMODULE_PRESENT)"; then \ 429 - $(MAKE) install-flexdll; \ 430 - fi 450 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" 451 + ifeq "$(TOOLCHAIN)" "msvc" 452 + $(INSTALL_DATA) $(FLEXDLL_SOURCES)/$(FLEXDLL_MANIFEST) \ 453 + "$(INSTALL_BINDIR)/" 431 454 endif 455 + ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" 456 + $(INSTALL_PROG) \ 457 + boot/flexlink.byte$(EXE) "$(INSTALL_BINDIR)/flexlink.byte$(EXE)" 458 + endif # ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" 459 + $(MKDIR) "$(INSTALL_FLEXDLLDIR)" 460 + $(INSTALL_DATA) $(addprefix stdlib/flexdll/, $(FLEXDLL_OBJECTS)) \ 461 + "$(INSTALL_FLEXDLLDIR)" 462 + endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" 432 463 $(INSTALL_DATA) Makefile.config "$(INSTALL_LIBDIR)" 433 464 ifeq "$(INSTALL_BYTECODE_PROGRAMS)" "true" 434 465 if test -f ocamlopt$(EXE); then $(MAKE) installopt; else \ 435 466 cd "$(INSTALL_BINDIR)"; \ 436 467 $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \ 437 468 $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \ 469 + (test -f flexlink.byte$(EXE) && \ 470 + $(LN) flexlink.byte$(EXE) flexlink$(EXE)) || true; \ 438 471 fi 439 472 else 440 473 if test -f ocamlopt$(EXE); then $(MAKE) installopt; fi ··· 501 534 $(LN) ocamlc.byte$(EXE) ocamlc$(EXE); \ 502 535 $(LN) ocamlopt.byte$(EXE) ocamlopt$(EXE); \ 503 536 $(LN) ocamllex.byte$(EXE) ocamllex$(EXE); \ 537 + (test -f flexlink.byte$(EXE) && \ 538 + $(LN) flexlink.byte$(EXE) flexlink$(EXE)) || true; \ 504 539 fi 505 540 else 506 541 if test -f ocamlopt.opt$(EXE); then $(MAKE) installoptopt; fi 507 542 endif 508 543 $(MAKE) -C tools installopt 509 - if test -f ocamlopt.opt$(EXE) -a -f flexdll/flexlink.opt ; then \ 510 - $(INSTALL_PROG) \ 511 - flexdll/flexlink.opt "$(INSTALL_BINDIR)/flexlink$(EXE)" ; \ 512 - fi 513 544 514 545 .PHONY: installoptopt 515 546 installoptopt: ··· 520 551 $(LN) ocamlc.opt$(EXE) ocamlc$(EXE); \ 521 552 $(LN) ocamlopt.opt$(EXE) ocamlopt$(EXE); \ 522 553 $(LN) ocamllex.opt$(EXE) ocamllex$(EXE) 554 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" 555 + $(INSTALL_PROG) flexlink.opt$(EXE) "$(INSTALL_BINDIR)" 556 + cd "$(INSTALL_BINDIR)"; \ 557 + $(LN) flexlink.opt$(EXE) flexlink$(EXE) 558 + endif 523 559 $(INSTALL_DATA) \ 524 560 utils/*.cmx parsing/*.cmx typing/*.cmx bytecomp/*.cmx \ 525 561 file_formats/*.cmx \ ··· 740 776 .PHONY: runtime 741 777 runtime: stdlib/libcamlrun.$(A) 742 778 779 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "true" 780 + runtime: $(addprefix stdlib/flexdll/, $(FLEXDLL_OBJECTS)) 781 + stdlib/flexdll/flexdll%.$(O): $(FLEXDLL_SOURCES)/flexdll%.$(O) | stdlib/flexdll 782 + cp $< $@ 783 + stdlib/flexdll: 784 + $(MKDIR) $@ 785 + endif 786 + 743 787 .PHONY: makeruntime 744 788 makeruntime: 745 789 $(MAKE) -C runtime $(BOOT_FLEXLINK_CMD) all ··· 935 979 # Check that the stack limit is reasonable (Unix-only) 936 980 .PHONY: checkstack 937 981 ifeq "$(UNIX_OR_WIN32)" "unix" 938 - checkstack := tools/checkstack 939 - checkstack: $(checkstack)$(EXE) 982 + checkstack: tools/checkstack$(EXE) 940 983 $< 941 984 942 - .INTERMEDIATE: $(checkstack)$(EXE) $(checkstack).$(O) 943 - $(checkstack)$(EXE): $(checkstack).$(O) 944 - $(MKEXE) $(OUTPUTEXE)$@ $< 985 + .INTERMEDIATE: tools/checkstack$(EXE) tools/checkstack.$(O) 986 + tools/checkstack$(EXE): tools/checkstack.$(O) 987 + $(MAKE) -C tools $(BOOT_FLEXLINK_CMD) checkstack$(EXE) 945 988 else 946 989 checkstack: 947 990 @ ··· 1091 1134 .PHONY: distclean 1092 1135 distclean: clean 1093 1136 rm -f boot/ocamlrun boot/ocamlrun.exe boot/camlheader \ 1094 - boot/*.cm* boot/libcamlrun.a boot/libcamlrun.lib boot/ocamlc.opt 1137 + boot/ocamlruns boot/ocamlruns.exe \ 1138 + boot/flexlink.byte boot/flexlink.byte.exe \ 1139 + boot/flexdll_*.o boot/flexdll_*.obj \ 1140 + boot/*.cm* boot/libcamlrun.a boot/libcamlrun.lib boot/ocamlc.opt 1095 1141 rm -f Makefile.config Makefile.build_config 1096 1142 rm -f runtime/caml/m.h runtime/caml/s.h 1097 - rm -rf autom4te.cache 1143 + rm -rf autom4te.cache flexdll-sources 1098 1144 rm -f config.log config.status libtool 1099 1145 rm -f tools/eventlog_metadata 1100 1146 rm -f tools/*.bak
+5
Makefile.build_config.in
··· 38 38 # Which document generator: odoc or ocamldoc? 39 39 DOCUMENTATION_TOOL=@documentation_tool@ 40 40 DOCUMENTATION_TOOL_CMD=@documentation_tool_cmd@ 41 + 42 + # The location of the FlexDLL sources to use (usually provided as the flexdll 43 + # Git submodule) 44 + FLEXDLL_SOURCES=@flexdir@ 45 + BOOTSTRAPPING_FLEXDLL=@bootstrapping_flexdll@
+9 -7
Makefile.common
··· 34 34 INSTALL_STUBLIBDIR := $(DESTDIR)$(STUBLIBDIR) 35 35 INSTALL_MANDIR := $(DESTDIR)$(MANDIR) 36 36 37 - ifeq "$(UNIX_OR_WIN32)" "win32" 38 37 FLEXDLL_SUBMODULE_PRESENT := $(wildcard $(ROOTDIR)/flexdll/Makefile) 39 - else 40 - FLEXDLL_SUBMODULE_PRESENT = 41 - endif 42 38 43 39 # Variables used to represent the OCaml runtime system 44 40 # Most of the time, boot/ocamlrun and runtime/ocamlrun are the same. ··· 61 57 BOOT_OCAMLC = $(OCAMLRUN) $(ROOTDIR)/boot/ocamlc 62 58 endif 63 59 64 - ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" "" 60 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 65 61 FLEXLINK_ENV = 66 62 CAMLOPT_CMD = $(CAMLOPT) 67 63 OCAMLOPT_CMD = $(OCAMLOPT) ··· 69 65 ocamlc_cmd = $(ocamlc) 70 66 ocamlopt_cmd = $(ocamlopt) 71 67 else 68 + ifeq "$(wildcard $(ROOTDIR)/flexlink.opt$(EXE))" "" 72 69 FLEXLINK_ENV = \ 73 - OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe" 70 + OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun$(EXE) \ 71 + $(ROOTDIR)/boot/flexlink.byte$(EXE)" 72 + else 73 + FLEXLINK_ENV = \ 74 + OCAML_FLEXLINK="$(ROOTDIR)/flexlink.opt$(EXE) -I $(ROOTDIR)/stdlib/flexdll" 75 + endif # ifeq "$(wildcard $(ROOTDIR)/flexlink.opt$(EXE))" "" 74 76 CAMLOPT_CMD = $(FLEXLINK_ENV) $(CAMLOPT) 75 77 OCAMLOPT_CMD = $(FLEXLINK_ENV) $(OCAMLOPT) 76 78 MKLIB_CMD = $(FLEXLINK_ENV) $(MKLIB) 77 79 ocamlc_cmd = $(FLEXLINK_ENV) $(ocamlc) 78 80 ocamlopt_cmd = $(FLEXLINK_ENV) $(ocamlopt) 79 - endif 81 + endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 80 82 81 83 OPTCOMPFLAGS= 82 84 ifeq "$(FUNCTION_SECTIONS)" "true"
+7 -9
Makefile.config.in
··· 203 203 NATIVECCLIBS=@nativecclibs@ 204 204 SYSTHREAD_SUPPORT=@systhread_support@ 205 205 PACKLD=@PACKLD@ 206 - IFLEXDIR=@iflexdir@ 206 + FLEXDLL_CHAIN=@flexdll_chain@ 207 207 EXTRALIBS=@extralibs@ 208 208 CCOMPTYPE=@ccomptype@ 209 209 TOOLCHAIN=@toolchain@ ··· 251 251 MERGEMANIFESTEXE=test ! -f $(1).manifest \ 252 252 || mt -nologo -outputresource:$(1) -manifest $(1).manifest \ 253 253 && rm -f $(1).manifest 254 - MKEXE_BOOT=$(CC) $(OC_CFLAGS) $(CFLAGS) $(OUTPUTEXE)$(1) $(2) \ 254 + MKEXE_USING_COMPILER=$(CC) $(OC_CFLAGS) $(CFLAGS) $(OUTPUTEXE)$(1) $(2) \ 255 255 /link /subsystem:console $(OC_LDFLAGS) $(LDFLAGS) && ($(MERGEMANIFESTEXE)) 256 256 else 257 - MKEXE_BOOT=$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_LDFLAGS) $(LDFLAGS) \ 257 + MKEXE_USING_COMPILER=$(CC) $(OC_CFLAGS) $(CFLAGS) $(OC_LDFLAGS) $(LDFLAGS) \ 258 258 $(OUTPUTEXE)$(1) $(2) 259 259 endif # ifeq "$(TOOLCHAIN)" "msvc" 260 260 ··· 270 270 FIND=/usr/bin/find 271 271 SORT=/usr/bin/sort 272 272 SET_LD_PATH=PATH="$(PATH):$(LD_PATH)" 273 - FLEXLINK_CMD=flexlink 274 - FLEXDLL_CHAIN=@flexdll_chain@ 275 - # FLEXLINK_FLAGS must be safe to insert in an OCaml string 276 - FLEXLINK_FLAGS=@flexlink_flags@ 277 - FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS) 278 273 else # ifeq "$(UNIX_OR_WIN32)" "win32" 279 274 # On Unix, make sure FLEXLINK is defined but empty 280 - FLEXLINK = 281 275 SORT=sort 282 276 CYGPATH=echo 283 277 SET_LD_PATH=CAML_LD_LIBRARY_PATH="$(LD_PATH)" 284 278 endif # ifeq "$(UNIX_OR_WIN32)" "win32" 279 + 280 + FLEXLINK_FLAGS=@flexlink_flags@ 281 + FLEXLINK_CMD=flexlink 282 + FLEXLINK=$(FLEXLINK_CMD) $(FLEXLINK_FLAGS) 285 283 286 284 # Deprecated variables 287 285
+13 -21
README.win32.adoc
··· 62 62 Only the `make` Cygwin package is required. `diffutils` is required if you wish 63 63 to be able to run the test suite. 64 64 65 - Unless you are also compiling the Cygwin port of OCaml, you should not install 66 - the `gcc-core` or `flexdll` packages. If you do, care may be required to ensure 67 - that a particular build is using the correct installation of `flexlink`. 65 + Unless you are also compiling the Cygwin port of OCaml, you do not need the 66 + `gcc-core` or `flexdll` packages. If you do install them, care may be required 67 + to ensure that a particular build is using the correct installation of 68 + `flexlink`. 68 69 69 70 [[bmflex]] 70 71 In addition to Cygwin, FlexDLL must also be installed, which is available from ··· 75 76 install FlexDLL is included in your `PATH` environment variable. Note: binary 76 77 distributions of FlexDLL are compatible only with Visual Studio 2013 and 77 78 earlier; for Visual Studio 2015 and later, you will need to compile the C 78 - objects from source, or build ocaml using the flexdll target. 79 + objects from source, or configure ocaml with the `--with-flexdll` option. 79 80 80 81 The base bytecode system (ocamlc, ocaml, ocamllex, ocamlyacc, ...) of all three 81 82 ports runs without any additional tools. ··· 245 246 `mingw64-i686-gcc-core` package for 32-bit and the `mingw64-x86_64-gcc-core` 246 247 package for 64-bit. 247 248 248 - - Do not try to use the Cygwin version of flexdll for this port. 249 + - The Cygwin version of flexdll does not work with this port. 249 250 250 251 - The standalone mingw toolchain from the Mingw-w64 project 251 252 (http://mingw-w64.org/) is not supported. Please use the version packaged in ··· 290 291 to build entirely from sources. Since OCaml 4.03 and FlexDLL 0.35, it is now 291 292 possible to bootstrap the two programs simultaneously. The process is identical 292 293 for both ports. If you choose to compile this way, it is not necessary to 293 - install FlexDLL separately -- indeed, if you do install FlexDLL separately, you 294 - may need to be careful to ensure that `ocamlopt` picks up the correct `flexlink` 295 - in your `PATH`. 294 + install FlexDLL separately. 296 295 297 - You must place the FlexDLL sources for Version 0.35 or later in the directory 296 + You must extract the FlexDLL sources for Version 0.35 or later in the directory 298 297 `flexdll/` at the top-level directory of the OCaml distribution. This can be 299 298 done in one of three ways: 300 299 ··· 309 308 + 310 309 git submodule update --init 311 310 312 - OCaml is then compiled as normal for the port you require, except that before 313 - building the compiler itself, you must compile `flexdll`, i.e.: 311 + OCaml is then compiled normally for the port you require. 314 312 315 - make flexdll 316 313 make 317 - make flexlink.opt 318 314 make install 319 315 320 - * You should ignore the error messages that say ocamlopt was not found. 321 316 * `make install` will install FlexDLL by placing `flexlink.exe` 322 317 (and the default manifest file for the Microsoft port) in `bin/` and the 323 318 FlexDLL object files in `lib/`. 324 - * If you don't include `make flexlink.opt`, `flexlink.exe` will be a 325 - bytecode program. `make install` always installs the "best" 326 - `flexlink.exe` (i.e. there is never a `flexlink.opt.exe` installed). 327 - * If you have populated `flexdll/`, you *must* run 328 - `make flexdll`. If you wish to revert to using an externally 329 - installed FlexDLL, you must erase the contents of `flexdll/` before 330 - compiling. 319 + * If you have populated `flexdll/`, the build will always use it, ignoring 320 + any externally installed FlexDLL. You can override this behaviour by either 321 + erasing the contents of `flexdll/` or passing the `--without-flexdll` option 322 + to `configure`. 331 323 332 324 == Unicode support 333 325
+66
aclocal.m4
··· 130 130 saved_CC="$CC" 131 131 saved_CFLAGS="$CFLAGS" 132 132 saved_CPPFLAGS="$CPPFLAGS" 133 + saved_LIBS="$LIBS" 133 134 saved_ac_ext="$ac_ext" 134 135 saved_ac_compile="$ac_compile" 135 136 # Move the content of confdefs.h to another file so it does not ··· 147 148 CPPFLAGS="$saved_CPPFLAGS" 148 149 CFLAGS="$saved_CFLAGS" 149 150 CC="$saved_CC" 151 + LIBS="$saved_LIBS" 150 152 ]) 151 153 152 154 AC_DEFUN([OCAML_AS_HAS_DEBUG_PREFIX_MAP], [ ··· 290 292 LDFLAGS="$SAVED_LDFLAGS" 291 293 CFLAGS="$SAVED_CFLAGS" 292 294 ]) 295 + 296 + AC_DEFUN([OCAML_TEST_FLEXLINK], [ 297 + OCAML_CC_SAVE_VARIABLES 298 + 299 + AC_MSG_CHECKING([whether $1 works]) 300 + 301 + AC_COMPILE_IFELSE( 302 + [AC_LANG_SOURCE([int answer = 42;])], 303 + [# Create conftest1.$ac_objext as a symlink on Cygwin to ensure that native 304 + # flexlink can cope. The reverse test is unnecessary (a Cygwin-compiled 305 + # flexlink can read anything). 306 + mv conftest.$ac_objext conftest1.$ac_objext 307 + AS_CASE([$4],[*-pc-cygwin], 308 + [ln -s conftest1.$ac_objext conftest2.$ac_objext], 309 + [cp conftest1.$ac_objext conftest2.$ac_objext]) 310 + 311 + CC="$1 -chain $2 -exe" 312 + LIBS="conftest2.$ac_objext" 313 + CPPFLAGS="$3 $CPPFLAGS" 314 + AC_LINK_IFELSE( 315 + [AC_LANG_SOURCE([int main() { return 0; }])], 316 + [AC_MSG_RESULT([yes])], 317 + [AC_MSG_RESULT([no]) 318 + AC_MSG_ERROR([$1 does not work])])], 319 + [AC_MSG_RESULT([unexpected compile error]) 320 + AC_MSG_ERROR([error calling the C compiler])]) 321 + 322 + OCAML_CC_RESTORE_VARIABLES 323 + ]) 324 + 325 + AC_DEFUN([OCAML_TEST_FLEXDLL_H], [ 326 + OCAML_CC_SAVE_VARIABLES 327 + 328 + AS_IF([test -n "$1"],[CPPFLAGS="-I $1 $CPPFLAGS"]) 329 + have_flexdll_h=no 330 + AC_CHECK_HEADER([flexdll.h],[have_flexdll_h=yes],[have_flexdll_h=no]) 331 + AS_IF([test x"$have_flexdll_h" = 'xno'], 332 + [AS_IF([test -n "$1"], 333 + [AC_MSG_ERROR([$1/flexdll.h appears unusable])])]) 334 + 335 + OCAML_CC_RESTORE_VARIABLES 336 + ]) 337 + 338 + AC_DEFUN([OCAML_TEST_FLEXLINK_WHERE], [ 339 + OCAML_CC_SAVE_VARIABLES 340 + 341 + AC_MSG_CHECKING([if "$1 -where" includes flexdll.h]) 342 + flexlink_where="$($1 -where | tr -d '\r')" 343 + CPPFLAGS="$CPPFLAGS -I \"$flexlink_where\"" 344 + cat > conftest.c <<"EOF" 345 + #include <flexdll.h> 346 + int main (void) {return 0;} 347 + EOF 348 + cat > conftest.Makefile <<EOF 349 + all: 350 + $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 351 + EOF 352 + AS_IF([make -f conftest.Makefile >/dev/null 2>/dev/null], 353 + [have_flexdll_h=yes 354 + AC_MSG_RESULT([yes])], 355 + [AC_MSG_RESULT([no])]) 356 + 357 + OCAML_CC_RESTORE_VARIABLES 358 + ])
+377 -76
configure
··· 699 699 INSTALL_DATA 700 700 INSTALL_SCRIPT 701 701 INSTALL_PROGRAM 702 + flexlink 702 703 ac_ct_DEP_CC 703 704 DEP_CC 704 705 CPP ··· 799 800 AR 800 801 shebangscripts 801 802 long_shebang 802 - iflexdir 803 + bootstrapping_flexdll 804 + flexdir 803 805 ocamlc_cppflags 804 806 ocamlc_cflags 805 807 nativecclibs ··· 910 912 enable_flat_float_array 911 913 enable_function_sections 912 914 with_afl 915 + with_flexdll 913 916 enable_shared 914 917 enable_static 915 918 with_pic ··· 1602 1605 --with-odoc build documentation with odoc 1603 1606 --with-target-bindir location of binary programs on target system 1604 1607 --with-afl use the AFL fuzzer 1608 + --with-flexdll bootstrap FlexDLL from the given sources 1605 1609 --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use 1606 1610 both] 1607 1611 --with-aix-soname=aix|svr4|both ··· 2793 2797 oc_dll_ldflags="" 2794 2798 with_sharedlibs=true 2795 2799 ostype="Unix" 2796 - iflexdir="" 2797 2800 SO="so" 2798 2801 toolchain="cc" 2799 2802 profinfo=false ··· 2801 2804 extralibs= 2802 2805 instrumented_runtime=false 2803 2806 instrumented_runtime_libs="" 2807 + bootstrapping_flexdll=false 2804 2808 2805 2809 # Information about the package 2806 2810 ··· 2848 2852 # Note: This is present for the flexdll bootstrap where it exposed as the old 2849 2853 # TOOLPREF variable. It would be better if flexdll where updated to require 2850 2854 # WINDRES instead. 2855 + 2851 2856 2852 2857 2853 2858 ··· 3335 3340 # Check whether --with-afl was given. 3336 3341 if test "${with_afl+set}" = set; then : 3337 3342 withval=$with_afl; 3343 + fi 3344 + 3345 + 3346 + 3347 + # Check whether --with-flexdll was given. 3348 + if test "${with_flexdll+set}" = set; then : 3349 + withval=$with_flexdll; if test x"$withval" = 'xyes'; then : 3350 + with_flexdll=flexdll 3351 + fi 3338 3352 fi 3339 3353 3340 3354 ··· 12787 12801 12788 12802 if test x"$enable_shared" = "xno"; then : 12789 12803 with_sharedlibs=false 12804 + case $host in #( 12805 + *-pc-windows|*-w64-mingw32) : 12806 + as_fn_error $? "Cannot build native Win32 with --disable-shared" "$LINENO" 5 ;; #( 12807 + *) : 12808 + ;; 12809 + esac 12810 + fi 12811 + 12812 + # Define flexlink chain and flags correctly for the different Windows ports 12813 + case $host in #( 12814 + i686-*-cygwin) : 12815 + flexdll_chain='cygwin' 12816 + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216" ;; #( 12817 + x86_64-*-cygwin) : 12818 + flexdll_chain='cygwin64' 12819 + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216" ;; #( 12820 + *-*-cygwin*) : 12821 + as_fn_error $? "unknown cygwin variant" "$LINENO" 5 ;; #( 12822 + i686-w64-mingw32) : 12823 + flexdll_chain='mingw' 12824 + flexlink_flags="-chain $flexdll_chain -stack 16777216" ;; #( 12825 + x86_64-w64-mingw32) : 12826 + flexdll_chain='mingw64' 12827 + flexlink_flags="-chain $flexdll_chain -stack 33554432" ;; #( 12828 + i686-pc-windows) : 12829 + flexdll_chain='msvc' 12830 + flexlink_flags="-merge-manifest -stack 16777216" ;; #( 12831 + x86_64-pc-windows) : 12832 + flexdll_chain='msvc64' 12833 + flexlink_flags="-x64 -merge-manifest -stack 33554432" ;; #( 12834 + *) : 12835 + ;; 12836 + esac 12837 + 12838 + if test x"$enable_shared" != 'xno'; then : 12839 + 12840 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for flexdll sources" >&5 12841 + $as_echo_n "checking for flexdll sources... " >&6; } 12842 + if test x"$with_flexdll" = "xno"; then : 12843 + flexdir='' 12844 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled" >&5 12845 + $as_echo "disabled" >&6; } 12846 + else 12847 + flexmsg='' 12848 + case $target in #( 12849 + *-*-cygwin*|*-w64-mingw32|*-pc-windows) : 12850 + if test x"$with_flexdll" = 'x' -o x"$with_flexdll" = 'xflexdll'; then : 12851 + if test -f 'flexdll/flexdll.h'; then : 12852 + flexdir=flexdll 12853 + iflexdir='$(ROOTDIR)/flexdll' 12854 + with_flexdll="$iflexdir" 12855 + else 12856 + if test x"$with_flexdll" != 'x'; then : 12857 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: requested but not available" >&5 12858 + $as_echo "requested but not available" >&6; } 12859 + as_fn_error $? "exiting" "$LINENO" 5 12860 + fi 12861 + fi 12862 + else 12863 + rm -rf flexdll-sources 12864 + if test -f "$with_flexdll/flexdll.h"; then : 12865 + mkdir -p flexdll-sources 12866 + cp -r "$with_flexdll"/* flexdll-sources/ 12867 + flexdir='flexdll-sources' 12868 + iflexdir='$(ROOTDIR)/flexdll-sources' 12869 + flexmsg=" (from $with_flexdll)" 12870 + else 12871 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: requested but not available" >&5 12872 + $as_echo "requested but not available" >&6; } 12873 + as_fn_error $? "exiting" "$LINENO" 5 12874 + fi 12875 + fi 12876 + if test x"$flexdir" = 'x'; then : 12877 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 12878 + $as_echo "no" >&6; } 12879 + else 12880 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $iflexdir$flexmsg" >&5 12881 + $as_echo "$iflexdir$flexmsg" >&6; } 12882 + bootstrapping_flexdll=true 12883 + # The submodule should be searched *before* any other -I paths 12884 + internal_cppflags="-I $iflexdir $internal_cppflags" 12885 + fi ;; #( 12886 + *) : 12887 + if test x"$with_flexdll" != 'x'; then : 12888 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: requested but not supported" >&5 12889 + $as_echo "requested but not supported" >&6; } 12890 + as_fn_error $? "exiting" "$LINENO" 5 12891 + fi ;; 12892 + esac 12893 + fi 12894 + 12895 + # Extract the first word of "flexlink", so it can be a program name with args. 12896 + set dummy flexlink; ac_word=$2 12897 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 12898 + $as_echo_n "checking for $ac_word... " >&6; } 12899 + if ${ac_cv_prog_flexlink+:} false; then : 12900 + $as_echo_n "(cached) " >&6 12901 + else 12902 + if test -n "$flexlink"; then 12903 + ac_cv_prog_flexlink="$flexlink" # Let the user override the test. 12904 + else 12905 + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR 12906 + for as_dir in $PATH 12907 + do 12908 + IFS=$as_save_IFS 12909 + test -z "$as_dir" && as_dir=. 12910 + for ac_exec_ext in '' $ac_executable_extensions; do 12911 + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then 12912 + ac_cv_prog_flexlink="flexlink" 12913 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 12914 + break 2 12915 + fi 12916 + done 12917 + done 12918 + IFS=$as_save_IFS 12919 + 12920 + fi 12921 + fi 12922 + flexlink=$ac_cv_prog_flexlink 12923 + if test -n "$flexlink"; then 12924 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flexlink" >&5 12925 + $as_echo "$flexlink" >&6; } 12926 + else 12927 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 12928 + $as_echo "no" >&6; } 12929 + fi 12930 + 12931 + 12932 + 12933 + if test -n "$flexlink" -a -z "$flexdir"; then : 12934 + 12935 + 12936 + 12937 + saved_CC="$CC" 12938 + saved_CFLAGS="$CFLAGS" 12939 + saved_CPPFLAGS="$CPPFLAGS" 12940 + saved_LIBS="$LIBS" 12941 + saved_ac_ext="$ac_ext" 12942 + saved_ac_compile="$ac_compile" 12943 + # Move the content of confdefs.h to another file so it does not 12944 + # get included 12945 + mv confdefs.h confdefs.h.bak 12946 + touch confdefs.h 12947 + 12948 + 12949 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $flexlink works" >&5 12950 + $as_echo_n "checking whether $flexlink works... " >&6; } 12951 + 12952 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext 12953 + /* end confdefs.h. */ 12954 + int answer = 42; 12955 + _ACEOF 12956 + if ac_fn_c_try_compile "$LINENO"; then : 12957 + # Create conftest1.$ac_objext as a symlink on Cygwin to ensure that native 12958 + # flexlink can cope. The reverse test is unnecessary (a Cygwin-compiled 12959 + # flexlink can read anything). 12960 + mv conftest.$ac_objext conftest1.$ac_objext 12961 + case $host in #( 12962 + *-pc-cygwin) : 12963 + ln -s conftest1.$ac_objext conftest2.$ac_objext ;; #( 12964 + *) : 12965 + cp conftest1.$ac_objext conftest2.$ac_objext ;; 12966 + esac 12967 + 12968 + CC="$flexlink -chain $flexdll_chain -exe" 12969 + LIBS="conftest2.$ac_objext" 12970 + CPPFLAGS="$internal_cppflags $CPPFLAGS" 12971 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext 12972 + /* end confdefs.h. */ 12973 + int main() { return 0; } 12974 + _ACEOF 12975 + if ac_fn_c_try_link "$LINENO"; then : 12976 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 12977 + $as_echo "yes" >&6; } 12978 + else 12979 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 12980 + $as_echo "no" >&6; } 12981 + as_fn_error $? "$flexlink does not work" "$LINENO" 5 12982 + fi 12983 + rm -f core conftest.err conftest.$ac_objext \ 12984 + conftest$ac_exeext conftest.$ac_ext 12985 + else 12986 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unexpected compile error" >&5 12987 + $as_echo "unexpected compile error" >&6; } 12988 + as_fn_error $? "error calling the C compiler" "$LINENO" 5 12989 + fi 12990 + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 12991 + 12992 + 12993 + # Restore the content of confdefs.h 12994 + mv confdefs.h.bak confdefs.h 12995 + ac_compile="$saved_ac_compile" 12996 + ac_ext="$saved_ac_ext" 12997 + CPPFLAGS="$saved_CPPFLAGS" 12998 + CFLAGS="$saved_CFLAGS" 12999 + CC="$saved_CC" 13000 + LIBS="$saved_LIBS" 13001 + 13002 + 13003 + 13004 + case $host in #( 13005 + *-w64-mingw32|*-pc-windows) : 13006 + flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" 13007 + if test -z "$flexlink_where"; then : 13008 + as_fn_error $? "$flexlink is not executable from a native Win32 process" "$LINENO" 5 13009 + 13010 + fi ;; #( 13011 + *) : 13012 + ;; 13013 + esac 13014 + 13015 + fi 13016 + 13017 + 13018 + 13019 + saved_CC="$CC" 13020 + saved_CFLAGS="$CFLAGS" 13021 + saved_CPPFLAGS="$CPPFLAGS" 13022 + saved_LIBS="$LIBS" 13023 + saved_ac_ext="$ac_ext" 13024 + saved_ac_compile="$ac_compile" 13025 + # Move the content of confdefs.h to another file so it does not 13026 + # get included 13027 + mv confdefs.h confdefs.h.bak 13028 + touch confdefs.h 13029 + 13030 + 13031 + if test -n "$flexdir"; then : 13032 + CPPFLAGS="-I $flexdir $CPPFLAGS" 13033 + fi 13034 + have_flexdll_h=no 13035 + ac_fn_c_check_header_mongrel "$LINENO" "flexdll.h" "ac_cv_header_flexdll_h" "$ac_includes_default" 13036 + if test "x$ac_cv_header_flexdll_h" = xyes; then : 13037 + have_flexdll_h=yes 13038 + else 13039 + have_flexdll_h=no 13040 + fi 13041 + 13042 + 13043 + if test x"$have_flexdll_h" = 'xno'; then : 13044 + if test -n "$flexdir"; then : 13045 + as_fn_error $? "$flexdir/flexdll.h appears unusable" "$LINENO" 5 13046 + fi 13047 + fi 13048 + 13049 + 13050 + # Restore the content of confdefs.h 13051 + mv confdefs.h.bak confdefs.h 13052 + ac_compile="$saved_ac_compile" 13053 + ac_ext="$saved_ac_ext" 13054 + CPPFLAGS="$saved_CPPFLAGS" 13055 + CFLAGS="$saved_CFLAGS" 13056 + CC="$saved_CC" 13057 + LIBS="$saved_LIBS" 13058 + 13059 + 13060 + 13061 + if test -n "$flexlink" -a x"$have_flexdll_h" = 'xno'; then : 13062 + 13063 + 13064 + saved_CC="$CC" 13065 + saved_CFLAGS="$CFLAGS" 13066 + saved_CPPFLAGS="$CPPFLAGS" 13067 + saved_LIBS="$LIBS" 13068 + saved_ac_ext="$ac_ext" 13069 + saved_ac_compile="$ac_compile" 13070 + # Move the content of confdefs.h to another file so it does not 13071 + # get included 13072 + mv confdefs.h confdefs.h.bak 13073 + touch confdefs.h 13074 + 13075 + 13076 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"$flexlink -where\" includes flexdll.h" >&5 13077 + $as_echo_n "checking if \"$flexlink -where\" includes flexdll.h... " >&6; } 13078 + flexlink_where="$($flexlink -where | tr -d '\r')" 13079 + CPPFLAGS="$CPPFLAGS -I \"$flexlink_where\"" 13080 + cat > conftest.c <<"EOF" 13081 + #include <flexdll.h> 13082 + int main (void) {return 0;} 13083 + EOF 13084 + cat > conftest.Makefile <<EOF 13085 + all: 13086 + $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 13087 + EOF 13088 + if make -f conftest.Makefile >/dev/null 2>/dev/null; then : 13089 + have_flexdll_h=yes 13090 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 13091 + $as_echo "yes" >&6; } 13092 + else 13093 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 13094 + $as_echo "no" >&6; } 13095 + fi 13096 + 13097 + 13098 + # Restore the content of confdefs.h 13099 + mv confdefs.h.bak confdefs.h 13100 + ac_compile="$saved_ac_compile" 13101 + ac_ext="$saved_ac_ext" 13102 + CPPFLAGS="$saved_CPPFLAGS" 13103 + CFLAGS="$saved_CFLAGS" 13104 + CC="$saved_CC" 13105 + LIBS="$saved_LIBS" 13106 + 13107 + 13108 + if test "x$have_flexdll_h" = 'xyes'; then : 13109 + internal_cppflags="$internal_cppflags -I \"$flexlink_where\"" 13110 + fi 13111 + 13112 + fi 13113 + 13114 + fi 13115 + 13116 + if test x"$have_flexdll_h" = 'xno'; then : 13117 + case $host in #( 13118 + *-*-cygwin*) : 13119 + if $with_sharedlibs; then : 13120 + with_sharedlibs=false 13121 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: flexdll.h not found: shared library support disabled." >&5 13122 + $as_echo "$as_me: WARNING: flexdll.h not found: shared library support disabled." >&2;} 13123 + 13124 + fi ;; #( 13125 + *-w64-mingw32|*-pc-windows) : 13126 + as_fn_error $? "flexdll.h is required for native Win32" "$LINENO" 5 ;; #( 13127 + *) : 13128 + ;; 13129 + esac 13130 + fi 13131 + 13132 + if test -z "$flexdir" -o x"$have_flexdll_h" = 'xno'; then : 13133 + case $host in #( 13134 + *-*-cygwin*) : 13135 + if $with_sharedlibs; then : 13136 + if test -z "$flexlink"; then : 13137 + with_sharedlibs=false 13138 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: flexlink/flexdll.h not found: shared library support disabled." >&5 13139 + $as_echo "$as_me: WARNING: flexlink/flexdll.h not found: shared library support disabled." >&2;} 13140 + 13141 + fi 13142 + fi ;; #( 13143 + *-w64-mingw32|*-pc-windows) : 13144 + if test -z "$flexlink"; then : 13145 + as_fn_error $? "flexlink is required for native Win32" "$LINENO" 5 13146 + fi ;; #( 13147 + *) : 13148 + ;; 13149 + esac 12790 13150 fi 12791 13151 12792 13152 case $CC,$host in #( ··· 12797 13157 *,*-*-haiku*) : 12798 13158 mathlib="" ;; #( 12799 13159 *,*-*-cygwin*) : 12800 - case $target in #( 12801 - i686-*) : 12802 - flavor=cygwin ;; #( 12803 - x86_64-*) : 12804 - flavor=cygwin64 ;; #( 12805 - *) : 12806 - as_fn_error $? "unknown cygwin variant" "$LINENO" 5 ;; 12807 - esac 12808 13160 common_cppflags="$common_cppflags -U_WIN32" 12809 13161 if $with_sharedlibs; then : 12810 - flexlink="flexlink -chain $flavor -merge-manifest -stack 16777216" 12811 - flexdir=`$flexlink -where | tr -d '\015'` 12812 - if test -z "$flexdir"; then : 12813 - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: flexlink not found: native shared libraries won't be available. 12814 - " >&5 12815 - $as_echo "$as_me: WARNING: flexlink not found: native shared libraries won't be available. 12816 - " >&2;} 12817 - with_sharedlibs=false 13162 + mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' 13163 + mkexedebugflag="-link -g" 12818 13164 else 12819 - iflexdir="-I\"$flexdir\"" 12820 - mkexe="$flexlink -exe" 12821 - mkexedebugflag="-link -g" 12822 - 12823 - fi 12824 - 12825 - fi 12826 - if ! $with_sharedlibs; then : 12827 13165 mkexe="$mkexe -Wl,--stack,16777216" 12828 13166 oc_ldflags="-Wl,--stack,16777216" 12829 13167 12830 13168 fi 12831 13169 ostype="Cygwin" ;; #( 12832 13170 *,*-*-mingw32) : 12833 - if $with_sharedlibs; then : 12834 - case $host in #( 13171 + case $host in #( 12835 13172 i686-*-*) : 12836 - flexdll_chain="mingw"; oc_dll_ldflags="-static-libgcc" ;; #( 12837 - x86_64-*-*) : 12838 - flexdll_chain="mingw64" ;; #( 13173 + oc_dll_ldflags="-static-libgcc" ;; #( 12839 13174 *) : 12840 13175 ;; 12841 13176 esac 12842 - flexlink="flexlink -chain $flexdll_chain -merge-manifest -stack 16777216" 12843 - flexdir=`$flexlink -where | tr -d '\015'` 12844 - if test -z "$flexdir"; then : 12845 - flexdir='$(ROOTDIR)/flexdll' 12846 - fi 12847 - iflexdir="-I\"$flexdir\"" 12848 - mkexedebugflag="-link -g" 12849 - fi 13177 + mkexedebugflag="-link -g" 12850 13178 ostype="Win32" 12851 13179 toolchain="mingw" 12852 13180 mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' ··· 12857 13185 ostype="Win32" 12858 13186 mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' 12859 13187 oc_ldflags='/ENTRY:wmainCRTStartup' 12860 - case $host in #( 12861 - i686-pc-windows) : 12862 - flexdll_chain=msvc ;; #( 12863 - x86_64-pc-windows) : 12864 - flexdll_chain=msvc64 ;; #( 12865 - *) : 12866 - ;; 12867 - esac 12868 - if $with_sharedlibs; then : 12869 - flexlink="flexlink -chain $flexdll_chain -merge-manifest -stack 16777216" 12870 - flexdir=`$flexlink -where | tr -d '\015'` 12871 - if test -z "$flexdir"; then : 12872 - flexdir='$(ROOTDIR)/flexdll' 12873 - fi 12874 - iflexdir="-I\"$flexdir\"" 12875 - mkexedebugflag='' 12876 - fi ;; #( 13188 + mkexedebugflag='' ;; #( 12877 13189 *,x86_64-*-linux*) : 12878 13190 $as_echo "#define HAS_ARCH_CODE32 1" >>confdefs.h 12879 13191 ;; #( ··· 13691 14003 mkmaindll='$(FLEXLINK) -maindll' 13692 14004 shared_libraries_supported=$with_sharedlibs ;; #( 13693 14005 *-*-cygwin*) : 13694 - mksharedlib="$flexlink" 13695 - mkmaindll="$flexlink -maindll" 14006 + mksharedlib='$(FLEXLINK)' 14007 + mkmaindll='$(FLEXLINK) -maindll' 13696 14008 shared_libraries_supported=true ;; #( 13697 14009 powerpc-ibm-aix*) : 13698 14010 case $ocaml_cv_cc_vendor in #( ··· 16784 17096 saved_CC="$CC" 16785 17097 saved_CFLAGS="$CFLAGS" 16786 17098 saved_CPPFLAGS="$CPPFLAGS" 17099 + saved_LIBS="$LIBS" 16787 17100 saved_ac_ext="$ac_ext" 16788 17101 saved_ac_compile="$ac_compile" 16789 17102 # Move the content of confdefs.h to another file so it does not ··· 16826 17139 CPPFLAGS="$saved_CPPFLAGS" 16827 17140 CFLAGS="$saved_CFLAGS" 16828 17141 CC="$saved_CC" 17142 + LIBS="$saved_LIBS" 16829 17143 16830 17144 16831 17145 ··· 16840 17154 saved_CC="$CC" 16841 17155 saved_CFLAGS="$CFLAGS" 16842 17156 saved_CPPFLAGS="$CPPFLAGS" 17157 + saved_LIBS="$LIBS" 16843 17158 saved_ac_ext="$ac_ext" 16844 17159 saved_ac_compile="$ac_compile" 16845 17160 # Move the content of confdefs.h to another file so it does not ··· 16905 17220 CPPFLAGS="$saved_CPPFLAGS" 16906 17221 CFLAGS="$saved_CFLAGS" 16907 17222 CC="$saved_CC" 17223 + LIBS="$saved_LIBS" 16908 17224 16909 17225 16910 17226 if $aspp_ok && $as_ok; then : ··· 17249 17565 windows_unicode=0 ;; 17250 17566 esac 17251 17567 17252 - # Define flexlink chain and flags correctly for the different Windows ports 17253 - case $host in #( 17254 - i686-w64-mingw32) : 17255 - flexdll_chain='mingw' 17256 - flexlink_flags="-chain $flexdll_chain -stack 16777216" ;; #( 17257 - x86_64-w64-mingw32) : 17258 - flexdll_chain='mingw64' 17259 - flexlink_flags="-chain $flexdll_chain -stack 33554432" ;; #( 17260 - i686-pc-windows) : 17261 - flexdll_chain='msvc' 17262 - flexlink_flags="-merge-manifest -stack 16777216" ;; #( 17263 - x86_64-pc-windows) : 17264 - flexdll_chain='msvc64' 17265 - flexlink_flags="-x64 -merge-manifest -stack 33554432" ;; #( 17266 - *) : 17267 - ;; 17268 - esac 17269 - 17270 17568 # Define default prefix correctly for the different Windows ports 17271 17569 if test x"$prefix" = "xNONE"; then : 17272 17570 case $host in #( ··· 17327 17625 else 17328 17626 stdlib_manpages=false 17329 17627 fi 17628 + 17629 + # Do not permanently cache the result of flexdll.h 17630 + unset ac_cv_header_flexdll_h 17330 17631 17331 17632 cat >confcache <<\_ACEOF 17332 17633 # This file is a shell script that caches the results of configure
+129 -56
configure.ac
··· 57 57 oc_dll_ldflags="" 58 58 with_sharedlibs=true 59 59 ostype="Unix" 60 - iflexdir="" 61 60 SO="so" 62 61 toolchain="cc" 63 62 profinfo=false ··· 65 64 extralibs= 66 65 instrumented_runtime=false 67 66 instrumented_runtime_libs="" 67 + bootstrapping_flexdll=false 68 68 69 69 # Information about the package 70 70 ··· 116 116 AC_SUBST([nativecclibs]) 117 117 AC_SUBST([ocamlc_cflags]) 118 118 AC_SUBST([ocamlc_cppflags]) 119 - AC_SUBST([iflexdir]) 119 + AC_SUBST([flexdir]) 120 + AC_SUBST([bootstrapping_flexdll]) 120 121 AC_SUBST([long_shebang]) 121 122 AC_SUBST([shebangscripts]) 122 123 AC_SUBST([AR]) ··· 394 395 [AS_HELP_STRING([--with-afl], 395 396 [use the AFL fuzzer])]) 396 397 398 + AC_ARG_WITH([flexdll], 399 + [AS_HELP_STRING([--with-flexdll], 400 + [bootstrap FlexDLL from the given sources])], 401 + [AS_IF([test x"$withval" = 'xyes'],[with_flexdll=flexdll])]) 402 + 397 403 AS_IF([test x"$enable_unix_lib" = "xno"], 398 404 [AS_IF([test x"$enable_debugger" = "xyes"], 399 405 [AC_MSG_ERROR([replay debugger requires the unix library])], ··· 676 682 # [*-pc-windows], 677 683 # [enable_shared=yes]) 678 684 679 - AS_IF([test x"$enable_shared" = "xno"],[with_sharedlibs=false]) 685 + AS_IF([test x"$enable_shared" = "xno"], 686 + [with_sharedlibs=false 687 + AS_CASE([$host], 688 + [*-pc-windows|*-w64-mingw32], 689 + [AC_MSG_ERROR([Cannot build native Win32 with --disable-shared])])]) 690 + 691 + # Define flexlink chain and flags correctly for the different Windows ports 692 + AS_CASE([$host], 693 + [i686-*-cygwin], 694 + [flexdll_chain='cygwin' 695 + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"], 696 + [x86_64-*-cygwin], 697 + [flexdll_chain='cygwin64' 698 + flexlink_flags="-chain $flexdll_chain -merge-manifest -stack 16777216"], 699 + [*-*-cygwin*], 700 + [AC_MSG_ERROR([unknown cygwin variant])], 701 + [i686-w64-mingw32], 702 + [flexdll_chain='mingw' 703 + flexlink_flags="-chain $flexdll_chain -stack 16777216"], 704 + [x86_64-w64-mingw32], 705 + [flexdll_chain='mingw64' 706 + flexlink_flags="-chain $flexdll_chain -stack 33554432"], 707 + [i686-pc-windows], 708 + [flexdll_chain='msvc' 709 + flexlink_flags="-merge-manifest -stack 16777216"], 710 + [x86_64-pc-windows], 711 + [flexdll_chain='msvc64' 712 + flexlink_flags="-x64 -merge-manifest -stack 33554432"]) 713 + 714 + AS_IF([test x"$enable_shared" != 'xno'], [ 715 + AC_MSG_CHECKING([for flexdll sources]) 716 + AS_IF([test x"$with_flexdll" = "xno"], 717 + [flexdir='' 718 + AC_MSG_RESULT([disabled])], 719 + [flexmsg='' 720 + AS_CASE([$target], 721 + [*-*-cygwin*|*-w64-mingw32|*-pc-windows], 722 + [AS_IF([test x"$with_flexdll" = 'x' -o x"$with_flexdll" = 'xflexdll'], 723 + [AS_IF([test -f 'flexdll/flexdll.h'], 724 + [flexdir=flexdll 725 + iflexdir='$(ROOTDIR)/flexdll' 726 + with_flexdll="$iflexdir"], 727 + [AS_IF([test x"$with_flexdll" != 'x'], 728 + [AC_MSG_RESULT([requested but not available]) 729 + AC_MSG_ERROR([exiting])])])], 730 + [rm -rf flexdll-sources 731 + AS_IF([test -f "$with_flexdll/flexdll.h"], 732 + [mkdir -p flexdll-sources 733 + cp -r "$with_flexdll"/* flexdll-sources/ 734 + flexdir='flexdll-sources' 735 + iflexdir='$(ROOTDIR)/flexdll-sources' 736 + flexmsg=" (from $with_flexdll)"], 737 + [AC_MSG_RESULT([requested but not available]) 738 + AC_MSG_ERROR([exiting])])]) 739 + AS_IF([test x"$flexdir" = 'x'], 740 + [AC_MSG_RESULT([no])], 741 + [AC_MSG_RESULT([$iflexdir$flexmsg]) 742 + bootstrapping_flexdll=true 743 + # The submodule should be searched *before* any other -I paths 744 + internal_cppflags="-I $iflexdir $internal_cppflags"])], 745 + [AS_IF([test x"$with_flexdll" != 'x'], 746 + [AC_MSG_RESULT([requested but not supported]) 747 + AC_MSG_ERROR([exiting])])])]) 748 + 749 + AC_CHECK_PROG([flexlink],[flexlink],[flexlink]) 750 + 751 + AS_IF([test -n "$flexlink" -a -z "$flexdir"],[ 752 + OCAML_TEST_FLEXLINK([$flexlink], [$flexdll_chain], 753 + [$internal_cppflags], [$host]) 754 + 755 + AS_CASE([$host], 756 + [*-w64-mingw32|*-pc-windows], 757 + [flexlink_where="$(cmd /c "$flexlink" -where 2>/dev/null)" 758 + AS_IF([test -z "$flexlink_where"], 759 + [AC_MSG_ERROR([$flexlink is not executable from a native Win32 process]) 760 + ])]) 761 + ]) 762 + 763 + OCAML_TEST_FLEXDLL_H([$flexdir]) 764 + 765 + AS_IF([test -n "$flexlink" -a x"$have_flexdll_h" = 'xno'], 766 + [OCAML_TEST_FLEXLINK_WHERE([$flexlink]) 767 + AS_IF([test "x$have_flexdll_h" = 'xyes'], 768 + [internal_cppflags="$internal_cppflags -I \"$flexlink_where\""]) 769 + ]) 770 + ]) 771 + 772 + AS_IF([test x"$have_flexdll_h" = 'xno'], 773 + [AS_CASE([$host], 774 + [*-*-cygwin*], 775 + [AS_IF([$with_sharedlibs], 776 + [with_sharedlibs=false 777 + AC_MSG_WARN([flexdll.h not found: shared library support disabled.]) 778 + ])], 779 + [*-w64-mingw32|*-pc-windows], 780 + [AC_MSG_ERROR([flexdll.h is required for native Win32])])]) 781 + 782 + AS_IF([test -z "$flexdir" -o x"$have_flexdll_h" = 'xno'], 783 + [AS_CASE([$host], 784 + [*-*-cygwin*], 785 + [AS_IF([$with_sharedlibs], 786 + [AS_IF([test -z "$flexlink"], 787 + [with_sharedlibs=false 788 + AC_MSG_WARN( 789 + [flexlink/flexdll.h not found: shared library support disabled.]) 790 + ])])], 791 + [*-w64-mingw32|*-pc-windows], 792 + [AS_IF([test -z "$flexlink"], 793 + [AC_MSG_ERROR([flexlink is required for native Win32])])])]) 680 794 681 795 AS_CASE([$CC,$host], 682 796 [*,*-*-darwin*], ··· 684 798 AC_DEFINE([HAS_ARCH_CODE32], [1])], 685 799 [*,*-*-haiku*], [mathlib=""], 686 800 [*,*-*-cygwin*], 687 - [AS_CASE([$target], 688 - [i686-*], [flavor=cygwin], 689 - [x86_64-*], [flavor=cygwin64], 690 - [AC_MSG_ERROR([unknown cygwin variant])]) 691 - common_cppflags="$common_cppflags -U_WIN32" 801 + [common_cppflags="$common_cppflags -U_WIN32" 692 802 AS_IF([$with_sharedlibs], 693 - [flexlink="flexlink -chain $flavor -merge-manifest -stack 16777216" 694 - flexdir=`$flexlink -where | tr -d '\015'` 695 - AS_IF([test -z "$flexdir"], 696 - [AC_MSG_WARN( 697 - [flexlink not found: native shared libraries won't be available.] 698 - ) 699 - with_sharedlibs=false], 700 - [iflexdir="-I\"$flexdir\"" 701 - mkexe="$flexlink -exe" 702 - mkexedebugflag="-link -g"] 703 - )] 704 - ) 705 - AS_IF([! $with_sharedlibs], 803 + [mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' 804 + mkexedebugflag="-link -g"], 706 805 [mkexe="$mkexe -Wl,--stack,16777216" 707 806 oc_ldflags="-Wl,--stack,16777216"] 708 807 ) 709 808 ostype="Cygwin"], 710 809 [*,*-*-mingw32], 711 - [AS_IF([$with_sharedlibs], 712 - [AS_CASE([$host], 713 - [i686-*-*], [flexdll_chain="mingw"; oc_dll_ldflags="-static-libgcc"], 714 - [x86_64-*-*], [flexdll_chain="mingw64"]) 715 - flexlink="flexlink -chain $flexdll_chain -merge-manifest -stack 16777216" 716 - flexdir=`$flexlink -where | tr -d '\015'` 717 - AS_IF([test -z "$flexdir"], [flexdir='$(ROOTDIR)/flexdll']) 718 - iflexdir="-I\"$flexdir\"" 719 - mkexedebugflag="-link -g"]) 810 + [AS_CASE([$host], 811 + [i686-*-*], [oc_dll_ldflags="-static-libgcc"]) 812 + mkexedebugflag="-link -g" 720 813 ostype="Win32" 721 814 toolchain="mingw" 722 815 mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' ··· 727 820 ostype="Win32" 728 821 mkexe='$(FLEXLINK) -exe $(if $(OC_LDFLAGS),-link "$(OC_LDFLAGS)")' 729 822 oc_ldflags='/ENTRY:wmainCRTStartup' 730 - AS_CASE([$host], 731 - [i686-pc-windows], [flexdll_chain=msvc], 732 - [x86_64-pc-windows], [flexdll_chain=msvc64]) 733 - AS_IF([$with_sharedlibs], 734 - [flexlink="flexlink -chain $flexdll_chain -merge-manifest -stack 16777216" 735 - flexdir=`$flexlink -where | tr -d '\015'` 736 - AS_IF([test -z "$flexdir"], [flexdir='$(ROOTDIR)/flexdll']) 737 - iflexdir="-I\"$flexdir\"" 738 - mkexedebugflag=''])], 823 + mkexedebugflag=''], 739 824 [*,x86_64-*-linux*], 740 825 AC_DEFINE([HAS_ARCH_CODE32], [1]), 741 826 [xlc*,powerpc-ibm-aix*], ··· 863 948 mkmaindll='$(FLEXLINK) -maindll' 864 949 shared_libraries_supported=$with_sharedlibs], 865 950 [*-*-cygwin*], 866 - [mksharedlib="$flexlink" 867 - mkmaindll="$flexlink -maindll" 951 + [mksharedlib='$(FLEXLINK)' 952 + mkmaindll='$(FLEXLINK) -maindll' 868 953 shared_libraries_supported=true], 869 954 [powerpc-ibm-aix*], 870 955 [AS_CASE([$ocaml_cv_cc_vendor], ··· 1867 1952 [AC_MSG_ERROR([unexpected windows unicode mode])])], 1868 1953 [windows_unicode=0]) 1869 1954 1870 - # Define flexlink chain and flags correctly for the different Windows ports 1871 - AS_CASE([$host], 1872 - [i686-w64-mingw32], 1873 - [flexdll_chain='mingw' 1874 - flexlink_flags="-chain $flexdll_chain -stack 16777216"], 1875 - [x86_64-w64-mingw32], 1876 - [flexdll_chain='mingw64' 1877 - flexlink_flags="-chain $flexdll_chain -stack 33554432"], 1878 - [i686-pc-windows], 1879 - [flexdll_chain='msvc' 1880 - flexlink_flags="-merge-manifest -stack 16777216"], 1881 - [x86_64-pc-windows], 1882 - [flexdll_chain='msvc64' 1883 - flexlink_flags="-x64 -merge-manifest -stack 33554432"]) 1884 - 1885 1955 # Define default prefix correctly for the different Windows ports 1886 1956 AS_IF([test x"$prefix" = "xNONE"], 1887 1957 [AS_CASE([$host], ··· 1914 1984 1915 1985 AS_IF([test x"$enable_stdlib_manpages" != "xno"], 1916 1986 [stdlib_manpages=true],[stdlib_manpages=false]) 1987 + 1988 + # Do not permanently cache the result of flexdll.h 1989 + unset ac_cv_header_flexdll_h 1917 1990 1918 1991 AC_OUTPUT
+2 -1
ocamltest/ocaml_actions.ml
··· 1086 1086 Ocaml_variables.nativecc_libs, Ocamltest_config.nativecc_libs; 1087 1087 Ocaml_variables.mkdll, 1088 1088 Sys.getenv_with_default_value "MKDLL" Ocamltest_config.mkdll; 1089 - Ocaml_variables.mkexe, Ocamltest_config.mkexe; 1089 + Ocaml_variables.mkexe, 1090 + Sys.getenv_with_default_value "MKEXE" Ocamltest_config.mkexe; 1090 1091 Ocaml_variables.c_preprocessor, Ocamltest_config.c_preprocessor; 1091 1092 Ocaml_variables.cc, Ocamltest_config.cc; 1092 1093 Ocaml_variables.csc, Ocamltest_config.csc;
+26 -24
runtime/Makefile
··· 83 83 84 84 libcamlrun_OBJECTS := $(BYTECODE_C_SOURCES:.c=.b.$(O)) 85 85 86 + libcamlrun_non_shared_OBJECTS := \ 87 + $(subst $(UNIX_OR_WIN32).b.$(O),$(UNIX_OR_WIN32)_non_shared.b.$(O), \ 88 + $(libcamlrun_OBJECTS)) 89 + 86 90 libcamlrund_OBJECTS := $(BYTECODE_C_SOURCES:.c=.bd.$(O)) \ 87 91 instrtrace.bd.$(O) 88 92 ··· 101 105 102 106 # General (non target-specific) assembler and compiler flags 103 107 104 - ifdef BOOTSTRAPPING_FLEXLINK 105 - OC_CPPFLAGS += -DBOOTSTRAPPING_FLEXLINK 106 - endif 107 - 108 108 # On Windows, OCAML_STDLIB_DIR needs to be defined dynamically 109 109 110 110 ifeq "$(UNIX_OR_WIN32)" "win32" ··· 123 123 OCAML_STDLIB_DIR = $(LIBDIR) 124 124 STDLIB_CPP_FLAG = -DOCAML_STDLIB_DIR='"$(OCAML_STDLIB_DIR)"' 125 125 endif 126 - 127 - OC_CPPFLAGS += $(IFLEXDIR) 128 126 129 127 ifneq "$(CCOMPTYPE)" "msvc" 130 128 OC_CFLAGS += -g ··· 138 136 OC_NATIVE_CPPFLAGS += -DMODEL_$(MODEL) 139 137 endif 140 138 141 - OC_NATIVE_CPPFLAGS += -DSYS_$(SYSTEM) $(IFLEXDIR) 139 + OC_NATIVE_CPPFLAGS += -DSYS_$(SYSTEM) 142 140 143 141 OC_DEBUG_CPPFLAGS=-DDEBUG 144 142 OC_INSTR_CPPFLAGS=-DCAML_INSTR ··· 154 152 155 153 # Commands used to build native libraries 156 154 155 + LIBS := $(BYTECCLIBS) 156 + 157 157 ifeq "$(UNIX_OR_WIN32)" "win32" 158 - LIBS = $(BYTECCLIBS) $(EXTRALIBS) 159 - ifdef BOOTSTRAPPING_FLEXLINK 160 - MAKE_OCAMLRUN=$(MKEXE_BOOT) 161 - else 162 - MAKE_OCAMLRUN = $(MKEXE) -o $(1) $(2) 163 - endif 164 - else 165 - LIBS = $(BYTECCLIBS) 166 - MAKE_OCAMLRUN = $(MKEXE) -o $(1) $(2) 158 + LIBS += $(EXTRALIBS) 167 159 endif 168 160 169 161 # Build, install and clean targets ··· 200 192 .PHONY: clean 201 193 clean: 202 194 rm -f *.o *.obj *.a *.lib *.so *.dll ld.conf 203 - rm -f ocamlrun ocamlrund ocamlruni 204 - rm -f ocamlrun.exe ocamlrund.exe ocamlruni.exe 195 + rm -f ocamlrun ocamlrund ocamlruni ocamlruns 196 + rm -f ocamlrun.exe ocamlrund.exe ocamlruni.exe ocamlruns.exe 205 197 rm -f primitives primitives.new prims.c $(GENERATED_HEADERS) 206 198 rm -f domain_state*.inc 207 199 rm -rf $(DEPDIR) ··· 272 264 # Libraries and programs 273 265 274 266 ocamlrun$(EXE): prims.$(O) libcamlrun.$(A) 275 - $(call MAKE_OCAMLRUN,$@,$^ $(LIBS)) 267 + $(MKEXE) -o $@ $^ $(LIBS) 268 + 269 + ocamlruns$(EXE): prims.$(O) libcamlrun_non_shared.$(A) 270 + $(call MKEXE_USING_COMPILER,$@,$^ $(LIBS)) 276 271 277 272 libcamlrun.$(A): $(libcamlrun_OBJECTS) 273 + $(call MKLIB,$@, $^) 274 + 275 + libcamlrun_non_shared.$(A): $(libcamlrun_non_shared_OBJECTS) 278 276 $(call MKLIB,$@, $^) 279 277 280 278 ocamlrund$(EXE): prims.$(O) libcamlrund.$(A) ··· 350 348 $(DEPDIR)/$(1).$(D): %.c | $(DEPDIR) $(GENERATED_HEADERS) 351 349 $$(DEP_CC) $$(OC_CPPFLAGS) $$(CPPFLAGS) $$< -MT \ 352 350 '$$*$(subst %,,$(1)).$(O)' -MF $$@ 353 - endif 354 - $(1).$(O): %.c 351 + endif # ifneq "$(1)" "%" 352 + $(1).$(O): $(2).c 355 353 else 356 - $(1).$(O): %.c $(CONFIG_HEADERS) $(GENERATED_HEADERS) $(RUNTIME_HEADERS) 357 - endif 354 + $(1).$(O): $(2).c $(CONFIG_HEADERS) $(GENERATED_HEADERS) $(RUNTIME_HEADERS) 355 + endif # ifneq "$(COMPUTE_DEPS)" "false" 358 356 $$(CC) -c $$(OC_CFLAGS) $$(CFLAGS) $$(OC_CPPFLAGS) $$(CPPFLAGS) \ 359 357 $$(OUTPUTOBJ)$$@ $$< 360 358 endef ··· 365 363 endif 366 364 367 365 $(foreach object_type, $(object_types), \ 368 - $(eval $(call COMPILE_C_FILE,$(object_type)))) 366 + $(eval $(call COMPILE_C_FILE,$(object_type),%))) 369 367 370 368 dynlink.%.$(O): OC_CPPFLAGS += $(STDLIB_CPP_FLAG) 371 369 372 370 startup_byt.%.$(O): OC_CPPFLAGS += $(STDLIB_CPP_FLAG) -DHOST='"$(HOST)"' 371 + 372 + $(UNIX_OR_WIN32)_non_shared.%.$(O): OC_CPPFLAGS += -DBUILDING_LIBCAMLRUNS 373 + 374 + $(eval $(call COMPILE_C_FILE,$(UNIX_OR_WIN32)_non_shared.%,$(UNIX_OR_WIN32))) 373 375 374 376 $(foreach object_type,$(subst %,,$(object_types)), \ 375 377 $(eval dynlink$(object_type).$(O): $(ROOTDIR)/Makefile.config))
-4
runtime/caml/config.h
··· 41 41 42 42 #include "s.h" 43 43 44 - #ifdef BOOTSTRAPPING_FLEXLINK 45 - #undef SUPPORT_DYNAMIC_LINKING 46 - #endif 47 - 48 44 #ifndef CAML_NAME_SPACE 49 45 #include "compatibility.h" 50 46 #endif
+6 -5
runtime/unix.c
··· 30 30 #include <sys/ioctl.h> 31 31 #include <fcntl.h> 32 32 #include "caml/config.h" 33 - #ifdef SUPPORT_DYNAMIC_LINKING 33 + #if defined(SUPPORT_DYNAMIC_LINKING) && !defined(BUILDING_LIBCAMLRUNS) 34 + #define WITH_DYNAMIC_LINKING 34 35 #ifdef __CYGWIN__ 35 36 #include "flexdll.h" 36 37 #else ··· 225 226 return res; 226 227 } 227 228 228 - #ifdef SUPPORT_DYNAMIC_LINKING 229 + #ifdef WITH_DYNAMIC_LINKING 229 230 #ifdef __CYGWIN__ 230 231 /* Use flexdll */ 231 232 ··· 256 257 return flexdll_dlerror(); 257 258 } 258 259 259 - #else 260 + #else /* ! __CYGWIN__ */ 260 261 /* Use normal dlopen */ 261 262 262 263 #ifndef RTLD_GLOBAL ··· 296 297 return (char*) dlerror(); 297 298 } 298 299 299 - #endif 300 + #endif /* __CYGWIN__ */ 300 301 #else 301 302 302 303 void * caml_dlopen(char * libname, int for_execution, int global) ··· 323 324 return "dynamic loading not supported on this platform"; 324 325 } 325 326 326 - #endif 327 + #endif /* WITH_DYNAMIC_LINKING */ 327 328 328 329 /* Add to [contents] the (short) names of the files contained in 329 330 the directory named [dirname]. No entries are added for [.] and [..].
+8 -3
runtime/win32.c
··· 48 48 #include "caml/sys.h" 49 49 50 50 #include "caml/config.h" 51 - #ifdef SUPPORT_DYNAMIC_LINKING 51 + 52 + #if defined(SUPPORT_DYNAMIC_LINKING) && !defined(BUILDING_LIBCAMLRUNS) 53 + #define WITH_DYNAMIC_LINKING 54 + #endif 55 + 56 + #ifdef WITH_DYNAMIC_LINKING 52 57 #include <flexdll.h> 53 58 #endif 54 59 ··· 214 219 return res; 215 220 } 216 221 217 - #ifdef SUPPORT_DYNAMIC_LINKING 222 + #ifdef WITH_DYNAMIC_LINKING 218 223 219 224 void * caml_dlopen(wchar_t * libname, int for_execution, int global) 220 225 { ··· 275 280 return "dynamic loading not supported on this platform"; 276 281 } 277 282 278 - #endif 283 + #endif /* WITH_DYNAMIC_LINKING */ 279 284 280 285 /* Proper emulation of signal(), including ctrl-C and ctrl-break */ 281 286
+3 -2
stdlib/Makefile
··· 158 158 # Again, pattern weirdness here means that the dot is always present so that 159 159 # tmpheader.exe matches. 160 160 tmpheader%exe: $(HEADERPROGRAM)%$(O) 161 - $(call MKEXE_BOOT,$@,$^ $(EXTRALIBS)) 161 + $(call MKEXE_USING_COMPILER,$@,$^ $(EXTRALIBS)) 162 162 # FIXME This is wrong - mingw could invoke strip; MSVC equivalent? 163 163 ifneq "$(UNIX_OR_WIN32)" "win32" 164 164 strip $@ ··· 176 176 177 177 ifeq "$(UNIX_OR_WIN32)" "unix" 178 178 tmptargetcamlheader%exe: $(TARGETHEADERPROGRAM)%$(O) 179 - $(call MKEXE_BOOT,$@,$^ $(EXTRALIBS)) 179 + $(call MKEXE_USING_COMPILER,$@,$^ $(EXTRALIBS)) 180 180 strip $@ 181 181 182 182 $(TARGETHEADERPROGRAM)%$(O): $(HEADERPROGRAM).c ··· 254 254 255 255 clean:: 256 256 rm -f *.cm* *.o *.obj *.a *.lib *.odoc 257 + rm -rf flexdll 257 258 258 259 include .depend 259 260
+30 -19
testsuite/Makefile
··· 42 42 else # Non-cygwin Unix 43 43 find := find 44 44 endif 45 - FLEXLINK_ENV = 46 45 else # Windows 47 46 find := /usr/bin/find 48 - FLEXDLL_SUBMODULE_PRESENT := $(wildcard ../flexdll/Makefile) 49 - ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" "" 50 - FLEXLINK_ENV = 51 - else 52 - FLEXLINK_ENV = \ 53 - OCAML_FLEXLINK="$(ROOTDIR_HOST)/boot/ocamlrun \ 54 - $(ROOTDIR_HOST)/flexdll/flexlink.exe" 55 - endif 56 47 endif 57 48 49 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 50 + FLEXLINK_ENV = 51 + else 52 + # The testsuite needs an absolute path to the runtime, so override the 53 + # definition in Makefile.common 54 + FLEXLINK_DLL_LDFLAGS=$(if $(OC_DLL_LDFLAGS), -link "$(OC_DLL_LDFLAGS)") 55 + FLEXLINK_EXE_LDFLAGS=$(if $(OC_LDFLAGS), -link "$(OC_LDFLAGS)") 56 + ifeq "$(wildcard $(ROOTDIR_HOST)/flexlink.opt$(EXE))" "" 57 + FLEXLINK_ENV = \ 58 + OCAML_FLEXLINK="$(ROOTDIR_HOST)/boot/ocamlrun$(EXE) \ 59 + $(ROOTDIR_HOST)/boot/flexlink.byte$(EXE)" 60 + MKDLL=$(ROOTDIR_HOST)/boot/ocamlrun$(EXE) \ 61 + $(ROOTDIR_HOST)/boot/flexlink.byte$(EXE) \ 62 + $(FLEXLINK_FLAGS) $(FLEXLINK_DLL_LDFLAGS) 63 + MKEXE=$(ROOTDIR_HOST)/boot/ocamlrun$(EXE) \ 64 + $(ROOTDIR_HOST)/boot/flexlink.byte$(EXE) \ 65 + $(FLEXLINK_FLAGS) -exe $(FLEXLINK_EXE_LDFLAGS) 66 + else 67 + FLEXLINK_ENV = \ 68 + OCAML_FLEXLINK="$(ROOTDIR_HOST)/flexlink.opt$(EXE) \ 69 + -I $(ROOTDIR_HOST)/stdlib/flexdll" 70 + MKDLL=$(ROOTDIR_HOST)/flexlink.opt$(EXE) -I $(ROOTDIR_HOST)/stdlib/flexdll \ 71 + $(FLEXLINK_FLAGS) $(FLEXLINK_DLL_LDFLAGS) 72 + MKEXE=$(ROOTDIR_HOST)/flexlink.opt$(EXE) -I $(ROOTDIR_HOST)/stdlib/flexdll \ 73 + $(FLEXLINK_FLAGS) -exe $(FLEXLINK_EXE_LDFLAGS) 74 + endif # ifeq "$(wildcard $(ROOTDIR_HOST)/flexlink.opt$(EXE))" "" 75 + endif # ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 76 + 58 77 ifeq "$(ocamltest_program)" "" 59 78 ocamltest = $(error ocamltest not found in $(ocamltest_directory)) 60 79 else 61 - ifeq "$(FLEXLINK_ENV)" "" 62 - ocamltest := MKDLL="$(MKDLL)" SORT=$(SORT) MAKE=$(MAKE) $(ocamltest_program) 63 - else 64 - FLEXLINK_DLL_LDFLAGS=$(if $(OC_DLL_LDFLAGS), -link "$(OC_DLL_LDFLAGS)") 65 - MKDLL=$(ROOTDIR_HOST)/boot/ocamlrun $(ROOTDIR_HOST)/flexdll/flexlink.exe \ 66 - $(FLEXLINK_FLAGS) $(FLEXLINK_DLL_LDFLAGS) 67 - 68 - ocamltest := $(FLEXLINK_ENV) MKDLL="$(MKDLL)" SORT=$(SORT) MAKE=$(MAKE) \ 69 - $(ocamltest_program) 70 - endif 80 + ocamltest := $(FLEXLINK_ENV) MKEXE="$(MKEXE)" MKDLL="$(MKDLL)" SORT=$(SORT) \ 81 + MAKE=$(MAKE) $(ocamltest_program) 71 82 endif 72 83 73 84 # PROMOTE is only meant to be used internally in recursive calls;
+5
tools/Makefile
··· 314 314 $(ROOTDIR)/otherlibs/$(UNIXLIB)/unix.cma \ 315 315 caml_tex.ml 316 316 317 + # checkstack tool 318 + 319 + checkstack$(EXE): checkstack.$(O) 320 + $(MKEXE) $(OUTPUTEXE)$@ $< 321 + 317 322 #Scan latex files, and run ocaml code examples 318 323 319 324 caml_tex := caml-tex$(EXE)
+1
tools/ci/appveyor/appveyor_build.cmd
··· 122 122 set CYGWIN_PACKAGES=%CYGWIN_PACKAGES% gcc-core flexdll 123 123 set CYGWIN_COMMANDS=%CYGWIN_COMMANDS% x86_64-pc-cygwin-gcc flexlink 124 124 ) 125 + if "%PORT:~0,6%%BOOTSTRAP_FLEXDLL%" equ "cygwinfalse" set CYGWIN_PACKAGES=%CYGWIN_PACKAGES% flexdll 125 126 126 127 set CYGWIN_INSTALL_PACKAGES= 127 128 set CYGWIN_UPGRADE_REQUIRED=%FORCE_CYGWIN_UPGRADE%
+2 -4
tools/ci/appveyor/appveyor_build.sh
··· 89 89 } 90 90 91 91 APPVEYOR_BUILD_FOLDER=$(echo "$APPVEYOR_BUILD_FOLDER" | cygpath -f -) 92 - FLEXDLLROOT="$(echo "$OCAMLROOT" | cygpath -f -)/bin/flexdll" 92 + FLEXDLLROOT="$PROGRAMFILES/flexdll" 93 93 OCAMLROOT=$(echo "$OCAMLROOT" | cygpath -f - -m) 94 94 95 95 if [[ $BOOTSTRAP_FLEXDLL = 'false' ]] ; then ··· 178 178 # For an explanation of the sed command, see 179 179 # https://github.com/appveyor/ci/issues/1824 180 180 script --quiet --return --command \ 181 - "( test "$BOOTSTRAP_FLEXDLL" = 'false' || "\ 182 - "$MAKE -C ../$BUILD_PREFIX-$PORT flexdll ) && "\ 183 - "$MAKE -C ../$BUILD_PREFIX-$PORT world.opt" \ 181 + "$MAKE -C ../$BUILD_PREFIX-$PORT world.opt" \ 184 182 "../$BUILD_PREFIX-$PORT/build.log" | 185 183 sed -e 's/\d027\[K//g' \ 186 184 -e 's/\d027\[m/\d027[0m/g' \
+2 -6
utils/Makefile
··· 19 19 20 20 include $(ROOTDIR)/Makefile.common 21 21 22 - ifeq "$(UNIX_OR_WIN32)" "win32" 23 - ifeq "$(wildcard $(ROOTDIR)/flexdll/Makefile)" "" 22 + ifeq "$(BOOTSTRAPPING_FLEXDLL)" "false" 24 23 FLEXDLL_DIR = 25 24 else 26 - FLEXDLL_DIR = $(if $(wildcard $(ROOTDIR)/flexdll/flexdll_*.$(O)),+flexdll) 27 - endif 28 - else 29 - FLEXDLL_DIR = 25 + FLEXDLL_DIR = +flexdll 30 26 endif 31 27 32 28 FLEXLINK_FLAGS ?=
+3 -3
utils/config.mlp
··· 58 58 let default_rpath = "%%RPATH%%" 59 59 let mksharedlibrpath = "%%MKSHAREDLIBRPATH%%" 60 60 let ar = "%%ARCMD%%" 61 + let supports_shared_libraries = %%SUPPORTS_SHARED_LIBRARIES%% 61 62 let mkdll, mkexe, mkmaindll = 62 63 (* @@DRA Cygwin - but only if shared libraries are enabled, which we 63 64 should be able to detect? *) 64 - if Sys.os_type = "Win32" then 65 + if Sys.win32 || Sys.cygwin && supports_shared_libraries then 65 66 try 66 67 let flexlink = 67 68 let flexlink = Sys.getenv "OCAML_FLEXLINK" in 68 69 let f i = 69 70 let c = flexlink.[i] in 70 - if c = '/' then '\\' else c in 71 + if c = '/' && Sys.win32 then '\\' else c in 71 72 (String.init (String.length flexlink) f) ^ " %%FLEXLINK_FLAGS%%" in 72 73 flexlink ^ "%%FLEXLINK_DLL_LDFLAGS%%", 73 74 flexlink ^ " -exe%%FLEXLINK_LDFLAGS%%", ··· 83 84 let safe_string = %%FORCE_SAFE_STRING%% 84 85 let default_safe_string = %%DEFAULT_SAFE_STRING%% 85 86 let windows_unicode = %%WINDOWS_UNICODE%% != 0 86 - let supports_shared_libraries = %%SUPPORTS_SHARED_LIBRARIES%% 87 87 88 88 let flat_float_array = %%FLAT_FLOAT_ARRAY%% 89 89