[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master dde4558: User -I and -L values in BuildProgram
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master dde4558: User -I and -L values in BuildProgram's configuration file |
Date: |
Sun, 11 Feb 2018 10:52:35 -0500 (EST) |
branch: master
commit dde45587250264f0ed19f90bb1974e5cf35420e7
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
User -I and -L values in BuildProgram's configuration file
When the user passes special values to the `-I' and `-L' compilation
options through the `CPPFLAGS' and `LDFLAGS' directories at configure time
(for example if GSL is installed in a non-standard place), it is also
necessary to pass those directories to BuildProgram. This was not done
until now, so it would fail at `make check'.
We now read the values to `CPPFLAGS' and `LDFLAGS' at configure time and in
BuildProgram's `Makefile.am', we write these values into a new
configuration file which is in the build directory and will be used for
checks and installed. Therefore, the original BuildProgram configuration
file (in the source directory) is now called `astbuildprog.conf.in'.
This issue was found by Michel Tallon.
This fixes bug #53122.
---
THANKS | 1 +
bin/buildprog/Makefile.am | 41 ++++++++++++++++++++--
.../{astbuildprog.conf => astbuildprog.conf.in} | 0
configure.ac | 10 ++++++
doc/announce-acknowledge.txt | 1 +
tests/Makefile.am | 1 +
tests/prepconf.sh | 18 +++++++---
7 files changed, 65 insertions(+), 7 deletions(-)
diff --git a/THANKS b/THANKS
index 79561bf..d64a447 100644
--- a/THANKS
+++ b/THANKS
@@ -46,6 +46,7 @@ support in Gnuastro. The list is ordered alphabetically (by
family name).
Richard Stallman address@hidden
Ole Streicher address@hidden
Alfred M. Szmidt address@hidden
+ Michel Tallon address@hidden
Éric Thiébaut address@hidden
Ignacio Trujillo address@hidden
David Valls-Gabaud address@hidden
diff --git a/bin/buildprog/Makefile.am b/bin/buildprog/Makefile.am
index d9b6912..1c89124 100644
--- a/bin/buildprog/Makefile.am
+++ b/bin/buildprog/Makefile.am
@@ -35,9 +35,46 @@ bin_PROGRAMS = astbuildprog
astbuildprog_LDADD = -lgnuastro
-astbuildprog_SOURCES = main.c ui.c buildprog.c
+astbuildprog_SOURCES = main.c ui.c buildprog.c astbuildprog.conf
+
+EXTRA_DIST = main.h authors-cite.h args.h ui.h buildprog.h astbuildprog.conf.in
+
+
+
+
+
+# Build the final configuration file. The main problem is the possible
+# CPPFLAGS and LDFLAGS that the user might have given at configure time
+# (stored in `IN_CPPFLAGS' and `IN_LDFLAGS' Makefile
+# variables). BuildProgram also needs to know these directories in order to
+# compile its programs. Here, we will be going
+astbuildprog.conf: $(top_srcdir)/bin/buildprog/astbuildprog.conf.in
+ cp $< $@
+ infoadded="no"; \
+ for i in $(IN_CPPFLAGS); do \
+ if test x"$$i" != x; then \
+ if test $$infoadded = "no"; then \
+ echo "" >> $@; \
+ echo "# Installation information" >> $@; \
+ infoadded="yes"; \
+ fi; \
+ v=$$(echo $$i | sed -e 's/-I//'); \
+ echo " includedir $$v" >> $@; \
+ fi; \
+ done; \
+ for i in $(IN_LDFLAGS); do \
+ if test x"$$i" != x; then \
+ if test $$infoadded = "no"; then \
+ echo "" >> $@; \
+ echo "# Installation information" >> $@; \
+ infoadded="yes"; \
+ fi; \
+ v=$$(echo $$i | sed -e 's/-L//'); \
+ echo " linkdir $$v" >> $@; \
+ fi; \
+ done
+
-EXTRA_DIST = main.h authors-cite.h args.h ui.h buildprog.h
diff --git a/bin/buildprog/astbuildprog.conf
b/bin/buildprog/astbuildprog.conf.in
similarity index 100%
rename from bin/buildprog/astbuildprog.conf
rename to bin/buildprog/astbuildprog.conf.in
diff --git a/configure.ac b/configure.ac
index 071cc68..0b73dd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,16 @@ AC_DEFINE([IN_GNUASTRO_BUILD], [1], [In building, not usage])
+# If any specific CPPFLAGS and LDFLAGS are given, we need to keep the raw
+# values (before they are changed in the next step) to pass onto
+# BuildProgram (which also needs them).
+AC_SUBST(IN_LDFLAGS, "$LDFLAGS")
+AC_SUBST(IN_CPPFLAGS, "$CPPFLAGS")
+
+
+
+
+
# Generic compiler flags for all sub-directories.
CFLAGS="-Wall -O3 $CFLAGS"
CXXFLAGS="-Wall -O3 $CXXFLAGS"
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index a0d9bf5..e0b35d5 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -4,3 +4,4 @@ Antonio Diaz Diaz
Guillaume Mahler
Ole Streicher
Éric Thiébaut
+Michel Tallon
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 809c727..9032a48 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -191,6 +191,7 @@ AM_CPPFLAGS = -I../lib
AM_TESTS_ENVIRONMENT = \
export mkdir_p="$(MKDIR_P)"; \
export topsrc=$(top_srcdir); \
+export topbuild=$(top_builddir); \
export haslibjpeg=$(MAYBE_HASLIBJPEG); \
export hasgnulibtool=$(MAYBE_HASGNULIBTOOL); \
export hasghostscript=$(MAYBE_HASGHOSTSCRIPT);
diff --git a/tests/prepconf.sh b/tests/prepconf.sh
index 2786519..5ba5887 100755
--- a/tests/prepconf.sh
+++ b/tests/prepconf.sh
@@ -68,10 +68,18 @@ rm addedoptions.txt
# ---------------------------------
#
# Each utility's configuration file is copied in the `tests' directory for
-# easy readability.
-for prog in arithmetic buildprog convertt convolve cosmiccal crop fits \
- match mkcatalog mknoise mkprof noisechisel statistics table \
- warp
+# easy readability. Note that some programs may need to build their
+# configuration files during compilation. Hence, their configuration files
+# are in the build directory, not the source directory.
+
+# Source directory configuraion files:
+for prog in arithmetic buildprog convertt convolve cosmiccal crop fits \
+ match mkcatalog mknoise mkprof noisechisel statistics table warp
do
- cp $topsrc/bin/$prog/ast$prog.conf .gnuastro/ast$prog.conf
+ if test -f $topsrc/bin/$prog/ast$prog.conf; then
+ ctopdir=$topsrc
+ else
+ ctopdir=$topbuild
+ fi
+ cp $ctopdir/bin/$prog/ast$prog.conf .gnuastro/ast$prog.conf
done
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnuastro-commits] master dde4558: User -I and -L values in BuildProgram's configuration file,
Mohammad Akhlaghi <=