From 15f0601f39b2aa477e6f1f2558575f98b873a193 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 20 Sep 2018 13:47:34 +0100
Subject: [PATCH 20/20] build: Pass through CFLAGS and LDFLAGS to ocaml
compiler (RHBZ#1630636).
---
configure.ac | 4 ++++
src/Makefile.in | 6 ++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index c9c7e34..a8e757c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,10 @@ AC_CHECK_PROG(OCAML_GETTEXT,ocaml-gettext,ocaml-gettext)
dnl Check for msgfmt tool.
AC_CHECK_PROG(MSGFMT,msgfmt,msgfmt)
+dnl Substitute CFLAGS and LDFLAGS if set.
+AC_SUBST([CFLAGS])
+AC_SUBST([LDFLAGS])
+
dnl Write gettext modules for the programs.
dnl http://www.le-gall.net/sylvain+violaine/documentation/ocaml-gettext/html/reference-manual/ch03s04.html
AC_MSG_NOTICE([creating src/opt_gettext.ml])
diff --git a/src/Makefile.in b/src/Makefile.in
index 03c6362..ba4eb1d 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -64,8 +64,8 @@ OBJS += main.cmo
XOBJS := $(OBJS:.cmo=.cmx)
-OCAMLCFLAGS := -g -warn-error CDEFLMPSUVYZX-3
-OCAMLCLIBS := -linkpkg
+OCAMLCFLAGS := -g -warn-error CDEFLMPSUVYZX-3 -ccopt '@CFLAGS@'
+OCAMLCLIBS := -linkpkg -runtime-variant _pic -cclib '@LDFLAGS@'
OCAMLOPTPACKAGES := $(OCAMLCPACKAGES)
OCAMLOPTFLAGS := $(OCAMLCFLAGS)
@@ -85,13 +85,11 @@ opt: $(OPT_TARGETS)
virt-top: $(OBJS)
ocamlfind ocamlc $(OCAMLCPACKAGES) $(OCAMLCFLAGS) $(OCAMLCLIBS) \
- -runtime-variant _pic \
-o $@ $^
virt-top.opt: $(XOBJS)
ocamlfind ocamlopt \
$(OCAMLOPTPACKAGES) $(OCAMLOPTFLAGS) $(OCAMLOPTLIBS) \
- -runtime-variant _pic \
-o $@ $^
# Manual page.
--
2.19.0.rc0