summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Hinderer <seb@tarides.com>2023-03-09 18:32:12 +0100
committerSébastien Hinderer <seb@tarides.com>2023-03-14 17:34:39 +0100
commit74d164a8fbbec113d951710708dc2ba8114a79d2 (patch)
tree75a822c9ef17ca45efa77fa708e6e73cf6001f99
parent6fd3475e124e21d4433556ffd4e19e80a66cfb0c (diff)
downloadocaml-74d164a8fbbec113d951710708dc2ba8114a79d2.tar.gz
Compute OC_NATIVE_CPPFLAGS during configure rather than during build
-rw-r--r--Makefile.build_config.in3
-rwxr-xr-xconfigure4
-rw-r--r--configure.ac3
3 files changed, 8 insertions, 2 deletions
diff --git a/Makefile.build_config.in b/Makefile.build_config.in
index 88883d2cf5..0429921e2b 100644
--- a/Makefile.build_config.in
+++ b/Makefile.build_config.in
@@ -63,8 +63,7 @@ OC_CPPFLAGS=-I$(ROOTDIR)/runtime @oc_cppflags@
# These flags should be passed *in addition* to those in OC_CPPFLAGS, they
# should not replace them.
-OC_NATIVE_CPPFLAGS=\
- -DNATIVE_CODE -DTARGET_$(ARCH) -DMODEL_$(MODEL) -DSYS_$(SYSTEM)
+OC_NATIVE_CPPFLAGS=-DNATIVE_CODE @native_cppflags@
# Additional link-time options
# To support dynamic loading of shared libraries (they need to look at
diff --git a/configure b/configure
index 6d392286ec..45c2ba3bb9 100755
--- a/configure
+++ b/configure
@@ -876,6 +876,7 @@ ln
unix_or_win32
ocamlsrcdir
systhread_support
+native_cppflags
system
model
arch64
@@ -3353,6 +3354,7 @@ OCAML_VERSION_SHORT=5.1
+
# TODO: rename this variable
@@ -15447,6 +15449,8 @@ fi; system=elf ;; #(
;;
esac
+native_cppflags="-DTARGET_${arch} -DMODEL_${model} -DSYS_${system}"
+
case $ccomptype in #(
msvc) :
runtime_asm_objects=${arch}nt.${OBJEXT} ;; #(
diff --git a/configure.ac b/configure.ac
index e4943d23e5..44c8c3b9c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -115,6 +115,7 @@ AC_SUBST([arch])
AC_SUBST([arch64])
AC_SUBST([model])
AC_SUBST([system])
+AC_SUBST([native_cppflags])
AC_SUBST([systhread_support])
AC_SUBST([ocamlsrcdir])
AC_SUBST([unix_or_win32])
@@ -1273,6 +1274,8 @@ AS_CASE([$host],
[has_native_backend=yes; arch=riscv; model=riscv64; system=linux]
)
+native_cppflags="-DTARGET_${arch} -DMODEL_${model} -DSYS_${system}"
+
AS_CASE([$ccomptype],
[msvc],
[runtime_asm_objects=${arch}nt.${OBJEXT}],