[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 481b53a 13/14: -Qunused-arguments now dealt wi
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 481b53a 13/14: -Qunused-arguments now dealt with in CXXFLAGS |
Date: |
Sun, 17 Dec 2017 11:31:19 -0500 (EST) |
branch: master
commit 481b53a1eef9ba62d6d528ab27dcf44811ff95a2
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
-Qunused-arguments now dealt with in CXXFLAGS
Until now, we would completely disable the C++ check if it didn't recognize
the `-Qunused-arguments' that `AX_PTHREAD' defines in
`PTHREAD_CFLAGS'. This was because we were putting `PTHREAD_CFLAGS'
directly into `CFLAGS' and `LDFLAGS'. Since the latter is used for both C
and C++, it would cause problems if C++ didn't recognize
`-Qunused-arguments'.
From this commit onward, we only add `PTHREAD_CFLAGS' to `CFLAGS' and
`CXXFLAGS' and leave `LDFLAGS' alone. Also, `CXXFLAGS' is checked during
configuration to see if it contains `-Qunused-arguments'. If so, it will
check if C++ can compile with it or not. If not, this option will be
removed from the final `CXXFLAGS'. So now, even if the C++ compiler doesn't
recognize this option, we don't have a problem.
---
configure.ac | 25 +++++++++++++++----------
doc/gnuastro.texi | 17 +++++++++++------
tests/Makefile.am | 10 +++-------
tests/lib/{versioncpp.cpp => versioncxx.cpp} | 0
tests/lib/{versioncpp.sh => versioncxx.sh} | 2 +-
5 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5175b71..35c9ae5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,6 +62,7 @@ AC_SUBST(GAL_LT_VERSION)
# Checks for programs.
: ${CFLAGS=""}
+: ${CXXFLAGS=""}
AC_PROG_CC
AC_PROG_CXX
gl_EARLY
@@ -88,6 +89,7 @@ AC_DEFINE([IN_GNUASTRO_BUILD], [1], [In building, not usage])
# Generic compiler flags for all sub-directories.
CFLAGS="-Wall -O3 $CFLAGS"
+CXXFLAGS="-Wall -O3 $CXXFLAGS"
LDFLAGS="-L\$(top_builddir)/lib $LDFLAGS"
CPPFLAGS="-I\$(top_srcdir)/lib $CPPFLAGS"
@@ -99,6 +101,7 @@ CPPFLAGS="-I\$(top_srcdir)/lib $CPPFLAGS"
# comes from the GNU Autoconf Archive's ax_pthread.m4, see there for the
# documentation. Note that
AX_PTHREAD([],[AC_MSG_ERROR([AC_PACKAGE_NAME Needs POSIX Threads (pthread)])])
+CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CC="$PTHREAD_CC"
@@ -108,20 +111,22 @@ 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
+# puts this option in `PTHREAD_CFLAGS' when the C compiler knows this
+# option. We then pass it to CFLAGS and CXXFLAGS above. But as reported in
+# bug #52490, it can happen that sometimes, the C++ compiler doesn't
+# recognize it. So we need to do a separate check for C++.
+cxxflags_tmp=
+for flg in $CXXFLAGS; 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) ])
+ [cxx_Qunused_arguments=yes;
+ cxxflags_tmp="$cxxflags_tmp $flg"],
+ [cxx_Qunused_arguments=no])
+ AC_LANG(C) ],
+ [ cxxflags_tmp="$cxxflags_tmp $flg"])
done
-AM_CONDITIONAL([COND_NO_CPP_QUNUSED_ARGUMENTS_PROBLEM],
- [test "x$cpp_Qunused_arguments_problem" = "xno"])
+CXXFLAGS="$cxxflags_tmp"
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 6b3efbe..f77f851 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -24503,12 +24503,17 @@ that invested heavily in Python 2.x cannot benefit
from Python 3.x or
future versions any more. Some converters are available, but since they are
automatic, lots of complications might arise in the address@hidden
example see @url{https://arxiv.org/abs/1712.00461, Jenness (2017)} which
-describes how LSST is managing the transition.}. If a research project
-begins using Python 3.x today, there is no telling how compatible their
-investments will be when Python 4.x or 5.x will come out. This stems from
-the core principles of Python, which are very useful when you look in the
-`on the go' basis as described before and not future usage. Future-proof
-code (as long as current operating systems will be used) is written in C.
+describes how LSST is managing the transition.}.
+
+If a research project begins using Python 3.x today, there is no telling
+how compatible their investments will be when Python 4.x or 5.x will come
+out. This stems from the core principles of Python, which are very useful
+when you look in the `on the go' basis as described before and not future
+usage. Reproducibility (ability to run the code in the future) is a core
+principal of any scientific result, or the software that produced that
+result. Rebuilding all the dependencies of a software in an obsolete
+language is not easy. Future-proof code (as long as current operating
+systems will be used) is written in C.
The portability of C is best demonstrated by the fact that both C++ and
Python are part of the C-family of programming languages which also include
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 866486e..5bb9924 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -51,11 +51,6 @@ 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
@@ -214,8 +209,9 @@ 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 = multithread $(MAYBE_VERSIONCPP)
+check_PROGRAMS = multithread versioncxx
multithread_SOURCES = lib/multithread.c
+versioncxx_SOURCES = lib/versioncxx.cpp
lib/multithread.sh: mkprof/mosaic1.sh.log
@@ -223,7 +219,7 @@ lib/multithread.sh: mkprof/mosaic1.sh.log
# Final Tests
# ===========
-TESTS = prepconf.sh lib/multithread.sh $(MAYBE_VERSIONCPP_SH) \
+TESTS = prepconf.sh lib/multithread.sh lib/versioncxx.sh \
$(MAYBE_ARITHMETIC_TESTS) $(MAYBE_BUILDPROG_TESTS) \
$(MAYBE_CONVERTT_TESTS) $(MAYBE_CONVOLVE_TESTS) $(MAYBE_COSMICCAL_TESTS) \
$(MAYBE_CROP_TESTS) $(MAYBE_FITS_TESTS) $(MAYBE_MATCH_TESTS) \
diff --git a/tests/lib/versioncpp.cpp b/tests/lib/versioncxx.cpp
similarity index 100%
rename from tests/lib/versioncpp.cpp
rename to tests/lib/versioncxx.cpp
diff --git a/tests/lib/versioncpp.sh b/tests/lib/versioncxx.sh
similarity index 97%
rename from tests/lib/versioncpp.sh
rename to tests/lib/versioncxx.sh
index 24cfed2..5438c14 100755
--- a/tests/lib/versioncpp.sh
+++ b/tests/lib/versioncxx.sh
@@ -22,7 +22,7 @@
# Set the variables (The executable is in the build tree). Do the
# basic checks to see if the executable is made or if the defaults
# file exists (basicchecks.sh is in the source tree).
-execname=./versioncpp
+execname=./versioncxx
- [gnuastro-commits] master c46e36d 03/14: Minor corrections in webpage script, (continued)
- [gnuastro-commits] master c46e36d 03/14: Minor corrections in webpage script, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master 0bbdf6d 05/14: Minor corrections to optional dependencies, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master 74dd74f 08/14: Match program's man page is built, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master c6a96b2 07/14: In citation, primarily was changed to initially, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master 0487ba5 14/14: Initializing delta and dist arrays in match library, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master 2631def 10/14: Minor edits in book's configuration options and intro, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master d7a7c37 12/14: Minor edits in book, acknowledgements updated, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master c448b38 04/14: Better explanation on GNU Libtool in book, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master f0a4d1e 01/14: In configure, current directory removed from PATH, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master 104b657 06/14: Configuration warning if PATH includes current directory, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master 481b53a 13/14: -Qunused-arguments now dealt with in CXXFLAGS,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 182f397 11/14: No -pthread flag in LDFLAGS, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master e9842b5 02/14: Webpage translations now fully incorporated, Mohammad Akhlaghi, 2017/12/17
- [gnuastro-commits] master eef4e80 09/14: Arithmetic's binary operators don't need compiled types, Mohammad Akhlaghi, 2017/12/17