[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master ba0ea5b 5/6: C++ compiler check for -Qunused-a
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master ba0ea5b 5/6: C++ compiler check for -Qunused-arguments |
Date: |
Sat, 25 Nov 2017 11:01:00 -0500 (EST) |
branch: master
commit ba0ea5b41e610d6831a28247662f1ab0739844a2
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
C++ compiler check for -Qunused-arguments
When checking for PThreads, `ax_pthread.m4' will check the C compiler for
possible options to avoid repetative arguments. This includes
`-Qunused-arguments'. It just does the check on the C compiler, but on some
systems (as reported in bug #52490), the C++ compiler might not recognize
it.
So we are using the GNU Autoconf Archives M4 tests for compile flags to see
if the C++ compiler also recognizes this option. If it doesn't, for the
time being, the C++ test in `make check' won't be run. The ideal way would
be to correct `CXXLINK' (created in the produced `tests/Makefile.in') and
remove this option (which comes in through `LDFLAGS') if it is not
recognized by the C++ compiler.
If using a previous Gnuastro bootstrap, please re-do the bootstrap after
this commit (a new Autoconf Archives is now needed).
---
bootstrap.conf | 2 +-
configure.ac | 22 +++++++++++++++++++++-
tests/Makefile.am | 18 ++++++++++--------
3 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 790ded0..f593304 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -99,7 +99,7 @@ bootstrap_post_import_hook()
{
# List of m4 files we need from the GNU Autoconf Archives (excluding the
# `ax_' prefix and `.m4' suffix):
- neededm4s="pthread compare_version"
+ neededm4s="pthread compare_version check_compile_flag"
# Get the necesssary Autoconf-archive macros. It is assumed that
# autoconf-archives is cloned the same directory as gnulib. Therefore we
diff --git a/configure.ac b/configure.ac
index f407dff..377c203 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,26 @@ CC="$PTHREAD_CC"
+# See if the C++ compiler understands `-Qunused-arguments'. AX_PTHREAD adds
+# this option to LDFLAGS when the C compiler knows this option. But as
+# reported in bug #52490, it can happen that at the same time, the C++
+# compiler doesn't recognize it.
+cpp_Qunused_arguments_problem=no
+for flg in $LDFLAGS; do
+ AS_IF([test "$flg" = \-Qunused-arguments],
+ [ AC_LANG(C++)
+ AX_CHECK_COMPILE_FLAG([-Qunused-arguments],
+ [cpp_Qunused_arguments_problem=no],
+ [cpp_Qunused_arguments_problem=yes])
+ AC_LANG(C) ])
+done
+AM_CONDITIONAL([COND_NO_CPP_QUNUSED_ARGUMENTS_PROBLEM],
+ [test "x$cpp_Qunused_arguments_problem" = "xno"])
+
+
+
+
+
# Check if `malloc(0)' returns valid pointer
AC_FUNC_MALLOC
@@ -129,7 +149,7 @@ AC_DEFINE_UNQUOTED([GAL_CONFIG_SIZEOF_SIZE_T],
[$ac_cv_sizeof_size_t],
AC_CHECK_SIZEOF([long])
AC_SUBST(SIZEOF_LONG, [$ac_cv_sizeof_long])
AC_DEFINE_UNQUOTED([GAL_CONFIG_SIZEOF_LONG], [$ac_cv_sizeof_long],
- [Depends on bit length of system.])
+ [On 32bit will be 4, on 64 bit, will be 8])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 18ab4e4..366b76e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -51,6 +51,11 @@ endif
if COND_HASGNULIBTOOL
MAYBE_HASGNULIBTOOL = "yes"
endif
+if COND_NO_CPP_QUNUSED_ARGUMENTS_PROBLEM
+ MAYBE_VERSIONCPP = versioncpp
+ MAYBE_VERSIONCPP_SH = lib/versioncpp.sh
+ versioncpp_SOURCES = lib/versioncpp.cpp
+endif
if COND_ARITHMETIC
MAYBE_ARITHMETIC_TESTS = arithmetic/snimage.sh arithmetic/onlynumbers.sh \
arithmetic/where.sh arithmetic/or.sh
@@ -172,11 +177,9 @@ endif
-
-
-# `config.h' is built by `../lib/Makefile.am' and is only meant for
-# outside users (internally `config.h' has everything. Thus, we need to add
-# it to the include directories of the test programs in this directory.
+# `config.h' is built by `../lib/Makefile.am' and is only meant for outside
+# users (internally `config.h' has everything). Thus, we need to add it to
+# the include directories of the test programs in this directory.
AM_CPPFLAGS = -I../lib
@@ -205,8 +208,7 @@ export hasghostscript=$(MAYBE_HASGHOSTSCRIPT);
# `TESTS'. So they do not need to be specified as any dependency, they will
# be present when the `.sh' based tests are run.
LDADD = -lgnuastro
-check_PROGRAMS = versioncpp multithread
-versioncpp_SOURCES = lib/versioncpp.cpp
+check_PROGRAMS = multithread $(MAYBE_VERSIONCPP)
multithread_SOURCES = lib/multithread.c
lib/multithread.sh: mkprof/mosaic1.sh.log
@@ -215,7 +217,7 @@ lib/multithread.sh: mkprof/mosaic1.sh.log
# Final Tests
# ===========
-TESTS = prepconf.sh lib/versioncpp.sh lib/multithread.sh \
+TESTS = prepconf.sh lib/multithread.sh $(MAYBE_VERSIONCPP_SH) \
$(MAYBE_ARITHMETIC_TESTS) $(MAYBE_BUILDPROG_TESTS) \
$(MAYBE_CONVERTT_TESTS) $(MAYBE_CONVOLVE_TESTS) $(MAYBE_COSMICCAL_TESTS) \
$(MAYBE_CROP_TESTS) $(MAYBE_FITS_TESTS) $(MAYBE_MKCATALOG_TESTS) \
- [gnuastro-commits] master updated (00bcde6 -> cf82f7b), Mohammad Akhlaghi, 2017/11/25
- [gnuastro-commits] master ef27131 1/6: Calloc instead of malloc when reading fits keyword comments, Mohammad Akhlaghi, 2017/11/25
- [gnuastro-commits] master cf82f7b 6/6: Installed libgnuastro.la doesn't have local -L dirs, Mohammad Akhlaghi, 2017/11/25
- [gnuastro-commits] master 4fe314c 3/6: Re-write of the Quick start section for Lzip, Mohammad Akhlaghi, 2017/11/25
- [gnuastro-commits] master f43c8b1 2/6: Adding some other useful steps to the tutorial, Mohammad Akhlaghi, 2017/11/25
- [gnuastro-commits] master a8e9e46 4/6: Acknowledged the help of Madusha and Floriane, Mohammad Akhlaghi, 2017/11/25
- [gnuastro-commits] master ba0ea5b 5/6: C++ compiler check for -Qunused-arguments,
Mohammad Akhlaghi <=