···220220 link:toplevel/[]:: interactive system
221221 link:typing/[]:: typechecking -- see xref:typing/HACKING.adoc[]
222222 link:utils/[]:: utility libraries
223223- link:winpthreads/[]:: winpthreads submodule -- see <<winpthreads,further>>
224223 link:yacc/[]:: parser generator
225224226225[#tips]
···770769If you would like to receive email notifications of all commits made to the main
771770git repository, you can subscribe to the caml-commits@inria.fr mailing list by
772771visiting https://sympa.inria.fr/sympa/info/caml-commits[its web page.]
773773-774774-[#winpthreads]
775775-=== The `winpthreads` library for the MSVC port
776776-777777-The `winpthreads` library is used to emulate `pthread` for the MSVC
778778-port. Upstream bundles it along with all the MinGW libraries so our
779779-`winpthreads` submodule points to `git subtree` repository rather than
780780-upstream directly.
781781-782782-To recreate the `winpthreads` repository from upstream, you can do:
783783-784784-[source,sh]
785785-----
786786-git clone -o upstream https://git.code.sf.net/p/mingw-w64/mingw-w64 winpthreads
787787-cd winpthreads
788788-git checkout upstream/master
789789-git branch -D master
790790-git subtree -P mingw-w64-libraries/winpthreads split -b master
791791-----
792792-793793-As subtree splitting is deterministic, repeating these operations later will
794794-allow to update `master`, for instance by:
795795-796796-[source,sh]
797797-----
798798-git fetch upstream
799799-git checkout upstream/master
800800-git subtree -P mingw-w64-libraries/winpthreads split -b tmp
801801-git checkout master
802802-git merge --ff-only tmp
803803-git branch -d tmp
804804-----
805805-806806-and then go on updating the `winpthreads` submodule in the `ocaml` repository.
807772808773Happy Hacking!
···94949595# The submodules should be searched *before* any other external -I paths
9696OC_INCLUDES = $(addprefix -I $(ROOTDIR)/, \
9797- runtime @flexdll_source_dir@ @winpthreads_source_include_dir@)
9797+ runtime @flexdll_source_dir@)
9898OC_CPPFLAGS = $(OC_INCLUDES) @oc_cppflags@
9999100100OC_BYTECODE_CPPFLAGS = $(OC_INCLUDES) @oc_bytecode_cppflags@
···142142# Git submodule)
143143FLEXDLL_SOURCE_DIR=@flexdll_source_dir@
144144BOOTSTRAPPING_FLEXDLL=@bootstrapping_flexdll@
145145-146146-# The location of the Winpthreads sources to use (usually provided as the
147147-# winpthreads Git submodule)
148148-WINPTHREADS_SOURCE_DIR=@winpthreads_source_dir@
149145150146### Where to install documentation
151147PACKAGE_TARNAME = @PACKAGE_TARNAME@
-10
aclocal.m4
···363363 OCAML_CC_RESTORE_VARIABLES
364364])
365365366366-AC_DEFUN([OCAML_TEST_WINPTHREADS_PTHREAD_H], [
367367- OCAML_CC_SAVE_VARIABLES
368368-369369- AS_IF([test -n "$1"],[CPPFLAGS="-I $1 $CPPFLAGS"])
370370- AC_CHECK_HEADER([pthread.h],[],
371371- [AC_MSG_ERROR([cannot find or use pthread.h from winpthreads])])
372372-373373- OCAML_CC_RESTORE_VARIABLES
374374-])
375375-376366AC_DEFUN([OCAML_TARGET_IS_EXECUTABLE], [
377367 AC_MSG_CHECKING([whether target executables can be run in the build])
378368 old_cross_compiling="$cross_compiling"
-116
configure
···894894launch_method_target
895895launch_method
896896shebangscripts
897897-winpthreads_source_include_dir
898898-winpthreads_source_dir
899897flexdll_dir
900898bootstrapping_flexdll
901899flexdll_source_dir
···10661064enable_runtime_search_target
10671065with_afl
10681066with_flexdll
10691069-with_winpthreads_msvc
10701067with_zstd
10711068enable_shared
10721069enable_static
···18061803 --with-relative-libdir, defaults to ../lib/ocaml)
18071804 --with-afl use the AFL fuzzer
18081805 --with-flexdll bootstrap FlexDLL from the given sources
18091809- --with-winpthreads-msvc build winpthreads (only for the MSVC port) from the
18101810- given sources
18111806 --without-zstd disable compression of compilation artefacts
18121807 --with-gnu-ld assume the C compiler uses GNU ld [default=no]
18131808 --with-sysroot[=DIR] Search for dependent libraries within DIR (or the
···35643559356535603566356135673567-35683568-35693562 # TODO: rename this variable
3570356335713564···44964489 withval=$with_flexdll; if test x"$withval" = 'xyes'
44974490then :
44984491 with_flexdll=flexdll
44994499-fi
45004500-fi
45014501-45024502-45034503-45044504-# Check whether --with-winpthreads-msvc was given.
45054505-if test ${with_winpthreads_msvc+y}
45064506-then :
45074507- withval=$with_winpthreads_msvc; if test x"$withval" = 'xyes'
45084508-then :
45094509- with_winpthreads_msvc=winpthreads
45104492fi
45114493fi
45124494···1764017622 *) :
1764117623 encode_C_literal="encode-C-utf8-literal" ;;
1764217624esac
1764317643-1764417644-# Winpthreads emulation library for the MSVC port
1764517645-{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for winpthreads sources" >&5
1764617646-printf %s "checking for winpthreads sources... " >&6; }
1764717647-if test x"$with_winpthreads_msvc" = "xno"
1764817648-then :
1764917649- winpthreads_source_dir=''
1765017650- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: disabled" >&5
1765117651-printf "%s\n" "disabled" >&6; }
1765217652-else $as_nop
1765317653- winpthreadmsg=''
1765417654- case $target in #(
1765517655- *-pc-windows) :
1765617656- if test x"$with_winpthreads_msvc" = 'x' || test x"$with_winpthreads_msvc" = x'winpthreads'
1765717657-then :
1765817658- if test -f 'winpthreads/src/winpthread_internal.h'
1765917659-then :
1766017660- winpthreads_source_dir=winpthreads
1766117661-else $as_nop
1766217662- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: required but not available (uninitialized submodule?)" >&5
1766317663-printf "%s\n" "required but not available (uninitialized submodule?)" >&6; }
1766417664- as_fn_error $? "exiting" "$LINENO" 5
1766517665-fi
1766617666-else $as_nop
1766717667- rm -rf winpthreads-sources
1766817668- if test -f "$with_winpthreads_msvc/src/winpthread_internal.h"
1766917669-then :
1767017670- mkdir -p winpthreads-sources/src winpthreads-sources/include
1767117671- cp "$with_winpthreads_msvc"/src/*.c winpthreads-sources/src
1767217672- cp "$with_winpthreads_msvc"/src/*.h winpthreads-sources/src
1767317673- cp "$with_winpthreads_msvc"/include/*.h winpthreads-sources/include
1767417674- winpthreads_source_dir='winpthreads-sources'
1767517675- winpthreadsmsg=" (from $with_winpthreads_msvc)"
1767617676-else $as_nop
1767717677- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: requested but not available" >&5
1767817678-printf "%s\n" "requested but not available" >&6; }
1767917679- as_fn_error $? "exiting" "$LINENO" 5
1768017680-fi
1768117681-fi
1768217682- if test x"$winpthreads_source_dir" = 'x'
1768317683-then :
1768417684- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
1768517685-printf "%s\n" "no" >&6; }
1768617686-else $as_nop
1768717687- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $winpthreads_source_dir$winpthreadsmsg" >&5
1768817688-printf "%s\n" "$winpthreads_source_dir$winpthreadsmsg" >&6; }
1768917689- winpthreads_source_include_dir="$winpthreads_source_dir/include"
1769017690-1769117691-1769217692- saved_CC="$CC"
1769317693- saved_CFLAGS="$CFLAGS"
1769417694- saved_CPPFLAGS="$CPPFLAGS"
1769517695- saved_LIBS="$LIBS"
1769617696- saved_ac_ext="$ac_ext"
1769717697- saved_ac_compile="$ac_compile"
1769817698- # Move the content of confdefs.h to another file so it does not
1769917699- # get included
1770017700- mv confdefs.h confdefs.h.bak
1770117701- touch confdefs.h
1770217702-1770317703-1770417704- if test -n "$winpthreads_source_include_dir"
1770517705-then :
1770617706- CPPFLAGS="-I $winpthreads_source_include_dir $CPPFLAGS"
1770717707-fi
1770817708- ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
1770917709-if test "x$ac_cv_header_pthread_h" = xyes
1771017710-then :
1771117711-1771217712-else $as_nop
1771317713- as_fn_error $? "cannot find or use pthread.h from winpthreads" "$LINENO" 5
1771417714-fi
1771517715-1771617716-1771717717-1771817718- # Restore the content of confdefs.h
1771917719- mv confdefs.h.bak confdefs.h
1772017720- ac_compile="$saved_ac_compile"
1772117721- ac_ext="$saved_ac_ext"
1772217722- CPPFLAGS="$saved_CPPFLAGS"
1772317723- CFLAGS="$saved_CFLAGS"
1772417724- CC="$saved_CC"
1772517725- LIBS="$saved_LIBS"
1772617726-1772717727-1772817728-fi ;; #(
1772917729- *) :
1773017730- if test x"$with_winpthreads_msvc" != 'x'
1773117731-then :
1773217732- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: requested but not supported" >&5
1773317733-printf "%s\n" "requested but not supported" >&6; }
1773417734- as_fn_error $? "exiting" "$LINENO" 5
1773517735-else $as_nop
1773617736- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: skipping on that platform" >&5
1773717737-printf "%s\n" "skipping on that platform" >&6; }
1773817738-fi ;;
1773917739-esac
1774017740-fi
17741176251774217626## Program to use to install files
1774317627
-45
configure.ac
···193193AC_SUBST([flexdll_source_dir])
194194AC_SUBST([bootstrapping_flexdll])
195195AC_SUBST([flexdll_dir])
196196-AC_SUBST([winpthreads_source_dir])
197197-AC_SUBST([winpthreads_source_include_dir])
198196AC_SUBST([shebangscripts])
199197AC_SUBST([launch_method])
200198AC_SUBST([launch_method_target])
···755753 [AS_HELP_STRING([--with-flexdll],
756754 [bootstrap FlexDLL from the given sources])],
757755 [AS_IF([test x"$withval" = 'xyes'],[with_flexdll=flexdll])])
758758-759759-AC_ARG_WITH([winpthreads-msvc],
760760- [AS_HELP_STRING([--with-winpthreads-msvc],
761761- [build winpthreads (only for the MSVC port) from the given sources])],
762762- [AS_IF([test x"$withval" = 'xyes'], [with_winpthreads_msvc=winpthreads])])
763756764757AC_ARG_WITH([zstd],
765758 [AS_HELP_STRING([--without-zstd],
···13471340 [*-w64-mingw32*|*-pc-windows],
13481341 [encode_C_literal="encode-C-utf16-literal"],
13491342 [encode_C_literal="encode-C-utf8-literal"])
13501350-13511351-# Winpthreads emulation library for the MSVC port
13521352-AC_MSG_CHECKING([for winpthreads sources])
13531353-AS_IF([test x"$with_winpthreads_msvc" = "xno"],
13541354- [winpthreads_source_dir=''
13551355- AC_MSG_RESULT([disabled])],
13561356- [winpthreadmsg=''
13571357- AS_CASE([$target],
13581358- [*-pc-windows],
13591359- [dnl When bootstrapping from the git submodule (winpthreads directory),
13601360- dnl just use that, however if another directory has been specified with
13611361- dnl --with-winpthreads-msvc=<path> then copy the contents of <path> to
13621362- dnl winpthreads-sources.
13631363- AS_IF([m4_normalize([test x"$with_winpthreads_msvc" = 'x'
13641364- || test x"$with_winpthreads_msvc" = x'winpthreads'])],
13651365- [AS_IF([test -f 'winpthreads/src/winpthread_internal.h'],
13661366- [winpthreads_source_dir=winpthreads],
13671367- [AC_MSG_RESULT([required but not available (uninitialized submodule?)])
13681368- AC_MSG_ERROR([exiting])])],
13691369- [rm -rf winpthreads-sources
13701370- AS_IF([test -f "$with_winpthreads_msvc/src/winpthread_internal.h"],
13711371- [mkdir -p winpthreads-sources/src winpthreads-sources/include
13721372- cp "$with_winpthreads_msvc"/src/*.c winpthreads-sources/src
13731373- cp "$with_winpthreads_msvc"/src/*.h winpthreads-sources/src
13741374- cp "$with_winpthreads_msvc"/include/*.h winpthreads-sources/include
13751375- winpthreads_source_dir='winpthreads-sources'
13761376- winpthreadsmsg=" (from $with_winpthreads_msvc)"],
13771377- [AC_MSG_RESULT([requested but not available])
13781378- AC_MSG_ERROR([exiting])])])
13791379- AS_IF([test x"$winpthreads_source_dir" = 'x'],
13801380- [AC_MSG_RESULT([no])],
13811381- [AC_MSG_RESULT([$winpthreads_source_dir$winpthreadsmsg])
13821382- winpthreads_source_include_dir="$winpthreads_source_dir/include"
13831383- OCAML_TEST_WINPTHREADS_PTHREAD_H([$winpthreads_source_include_dir])])],
13841384- [AS_IF([test x"$with_winpthreads_msvc" != 'x'],
13851385- [AC_MSG_RESULT([requested but not supported])
13861386- AC_MSG_ERROR([exiting])],
13871387- [AC_MSG_RESULT([skipping on that platform])])])])
1388134313891344## Program to use to install files
13901345AC_PROG_INSTALL