build: Pass through CFLAGS and LDFLAGS to ocaml compiler (RHBZ#1630636).
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 20 Sep 2018 12:47:34 +0000 (13:47 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 29 Nov 2022 08:13:39 +0000 (08:13 +0000)
configure.ac
src/Makefile.in

index c9c7e34..a8e757c 100644 (file)
@@ -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])
index 03c6362..ba4eb1d 100644 (file)
@@ -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.