commit:     71595d02b69ce844e12e2344531f6af9e437c4d1
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Aug  5 00:00:00 2021 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Aug  5 00:02:38 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=71595d02

sci-libs/qd: new revision that works with autoconf-2.71.

In this -r1, I've added a patch that solves bug 775215 by not setting
CC=$CXX during ./configure. At the same time, I've refactored our
other build system patch into a series of smaller patches (with
explanatory commit messages) that can be sent upstream.

Finally, I've removed USE=static-libs support from the ebuild. It
doesn't do anyone any good.

Closes: https://bugs.gentoo.org/775215
Package-Manager: Portage-3.0.20, Repoman-3.0.2
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 ...gure.ac-update-QD_PATCH_VERSION-to-2.3.22.patch |  31 +++++++
 ...c-replace-AM_CONFIG_HEADER-with-AC_CONFIG.patch |  34 +++++++
 ...e.ac-replace-AC_PROG_LIBTOOL-with-LT_INIT.patch |  37 ++++++++
 ....ac-fix-syntax-of-all-AC_ARG_ENABLE-calls.patch | 100 ++++++++++++++++++++
 ...efile.am-fix-underlinking-of-libqdmod-and.patch |  35 +++++++
 ...006-configure.ac-remove-enable-debug-flag.patch | 102 +++++++++++++++++++++
 ...0007-config.h.in-remove-QD_DEBUG-constant.patch |  29 ++++++
 ...c-don-t-assume-that-O2-is-a-valid-compile.patch |  47 ++++++++++
 .../0009-configure.ac-don-t-set-CC-to-CXX.patch    |  46 ++++++++++
 ...c-don-t-manually-search-for-compiler-name.patch |  81 ++++++++++++++++
 .../0011-qd-config.in-remove-REQ_CXXFLAGS.patch    |  27 ++++++
 ...figure.ac-remove-the-enable-warnings-flag.patch |  55 +++++++++++
 sci-libs/qd/qd-2.3.22-r1.ebuild                    |  61 ++++++++++++
 13 files changed, 685 insertions(+)

diff --git 
a/sci-libs/qd/files/0001-configure.ac-update-QD_PATCH_VERSION-to-2.3.22.patch 
b/sci-libs/qd/files/0001-configure.ac-update-QD_PATCH_VERSION-to-2.3.22.patch
new file mode 100644
index 00000000000..4fe4d49fa92
--- /dev/null
+++ 
b/sci-libs/qd/files/0001-configure.ac-update-QD_PATCH_VERSION-to-2.3.22.patch
@@ -0,0 +1,31 @@
+From a05e1577085507266908f40ff8e5246e10eb72d1 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 18:29:45 -0400
+Subject: [PATCH 01/12] configure.ac: update QD_PATCH_VERSION to 2.3.22.
+
+Autotools currently thinks that this is version 2.3.12, as can be seen
+when running
+
+  $ ./configure
+  configuring qd 2.3.12...
+
+We update QD_PATCH_VERSION within configure.ac to fix that.
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 2ca10c9..7485936 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,6 +1,6 @@
+ #                                               -*- Autoconf -*-
+ # Process this file with autoconf to produce a configure script.
+-define([QD_PATCH_VERSION], 12)
++define([QD_PATCH_VERSION], 22)
+ AC_PREREQ(2.60)
+ AC_INIT(qd, 2.3.QD_PATCH_VERSION, dhbai...@lbl.gov)
+ AC_CONFIG_SRCDIR([src/qd_real.cpp])
+-- 
+2.31.1
+

diff --git 
a/sci-libs/qd/files/0002-configure.ac-replace-AM_CONFIG_HEADER-with-AC_CONFIG.patch
 
b/sci-libs/qd/files/0002-configure.ac-replace-AM_CONFIG_HEADER-with-AC_CONFIG.patch
new file mode 100644
index 00000000000..956feb27511
--- /dev/null
+++ 
b/sci-libs/qd/files/0002-configure.ac-replace-AM_CONFIG_HEADER-with-AC_CONFIG.patch
@@ -0,0 +1,34 @@
+From 0641c0b9dd87bfbef6a7b6e77cf4b264e3fa84d7 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 18:32:21 -0400
+Subject: [PATCH 02/12] configure.ac: replace AM_CONFIG_HEADER with
+ AC_CONFIG_HEADERS.
+
+The AM_CONFIG_HEADER macro is obsolete, as evidenced by warnings like,
+
+  configure.ac:21: warning: 'AM_CONFIG_HEADER': this macro is obsolete.
+  configure.ac:21: You should use the 'AC_CONFIG_HEADERS' macro instead.
+
+This commit uses the suggested replacement.
+---
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 7485936..7b52a9e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -18,8 +18,8 @@ echo "configuring $PACKAGE $VERSION..."
+ 
+ AC_CONFIG_AUX_DIR(config)
+ AM_INIT_AUTOMAKE([nostdinc foreign])
+-AM_CONFIG_HEADER([config.h])
+-AM_CONFIG_HEADER([include/qd/qd_config.h])
++AC_CONFIG_HEADERS([config.h])
++AC_CONFIG_HEADERS([include/qd/qd_config.h])
+ 
+ AC_CANONICAL_HOST
+ 
+-- 
+2.31.1
+

diff --git 
a/sci-libs/qd/files/0003-configure.ac-replace-AC_PROG_LIBTOOL-with-LT_INIT.patch
 
b/sci-libs/qd/files/0003-configure.ac-replace-AC_PROG_LIBTOOL-with-LT_INIT.patch
new file mode 100644
index 00000000000..e436c04716d
--- /dev/null
+++ 
b/sci-libs/qd/files/0003-configure.ac-replace-AC_PROG_LIBTOOL-with-LT_INIT.patch
@@ -0,0 +1,37 @@
+From a6ba0059c80849ef349b9d02e5972f89fcd59793 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 18:40:26 -0400
+Subject: [PATCH 03/12] configure.ac: replace AC_PROG_LIBTOOL with LT_INIT.
+
+The AC_PROG_LIBTOOL macro is obsolete, according to modern versions of
+autoconf:
+
+  configure.ac:316: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
+  configure.ac:316: You should run autoupdate.
+
+Running autoupdate replaces it with a call to LT_INIT, which is what
+this commit does too. We have also removed a call AC_DISABLE_SHARED,
+which no longer affects anything; its removal is "harmless" since, at
+worst, it will cause some people to build shared libraries that they
+do not need.
+---
+ configure.ac | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 7b52a9e..31b32f5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -312,8 +312,7 @@ AC_SUBST(FFLAGS, $FCFLAGS)
+ AC_CHECK_LIB(m,sqrt)
+ 
+ # libtool stuff
+-AC_DISABLE_SHARED
+-AC_PROG_LIBTOOL
++LT_INIT
+ 
+ # Output
+ AC_CONFIG_FILES([Makefile config/Makefile src/Makefile include/Makefile 
+-- 
+2.31.1
+

diff --git 
a/sci-libs/qd/files/0004-configure.ac-fix-syntax-of-all-AC_ARG_ENABLE-calls.patch
 
b/sci-libs/qd/files/0004-configure.ac-fix-syntax-of-all-AC_ARG_ENABLE-calls.patch
new file mode 100644
index 00000000000..aad1936b701
--- /dev/null
+++ 
b/sci-libs/qd/files/0004-configure.ac-fix-syntax-of-all-AC_ARG_ENABLE-calls.patch
@@ -0,0 +1,100 @@
+From 829c868c9655fa7dfd4a64a42476fe1eddadc792 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 18:47:12 -0400
+Subject: [PATCH 04/12] configure.ac: fix syntax of all AC_ARG_ENABLE calls.
+
+Currently, we find AC_ARG_ENABLE being called like
+
+  AC_ARG_ENABLE(enable_inline, ...
+
+where the corresponding argument should be --enable-inline. The
+autoconf documentation however suggests that this should be
+
+  AC_ARG_ENABLE([inline], ...
+
+so we update all of these calls accordingly. In the process, we update
+all of the corresponding AC_HELP_STRING instances, since that macro
+has been superseded by AS_HELP_STRING.
+---
+ configure.ac | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 31b32f5..1e91cd1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -25,7 +25,7 @@ AC_CANONICAL_HOST
+ 
+ # Checks for arguments
+ # --enable-inline
+-AC_ARG_ENABLE(enable_inline, AC_HELP_STRING(--enable-inline, [inline commonly 
used functions.  [[default=yes]]]))
++AC_ARG_ENABLE([inline], AS_HELP_STRING(--enable-inline, [inline commonly used 
functions.  [[default=yes]]]))
+ AC_MSG_CHECKING([if commonly used function is to be inlined])
+ if test "$enable_inline" != "no"; then
+   enable_inline="yes"
+@@ -34,7 +34,7 @@ fi
+ AC_MSG_RESULT($enable_inline)
+ 
+ # --enable-ieee-add
+-AC_ARG_ENABLE(enable_ieee_add, AC_HELP_STRING(--enable-ieee-add, [use 
addition that satisfies IEEE-style error bound instead of Cray-style error 
bound.  [[default=no]]]))
++AC_ARG_ENABLE([ieee-add], AS_HELP_STRING(--enable-ieee-add, [use addition 
that satisfies IEEE-style error bound instead of Cray-style error bound.  
[[default=no]]]))
+ AC_MSG_CHECKING([if addition with IEEE-style error bound is to be used])
+ if test "$enable_ieee_add" = "yes"; then
+   AC_DEFINE([QD_IEEE_ADD], [1], [Define to 1 to use additions with IEEE-style 
error bounds.])
+@@ -44,7 +44,7 @@ fi
+ AC_MSG_RESULT($enable_ieee_add)
+ 
+ # --enable-sloppy-mul
+-AC_ARG_ENABLE(enable_sloppy_mul, AC_HELP_STRING(--enable-sloppy-mul, [use 
fast but slightly inaccurate multiplication.  [[default=yes]]]))
++AC_ARG_ENABLE([sloppy-mul], AS_HELP_STRING(--enable-sloppy-mul, [use fast but 
slightly inaccurate multiplication.  [[default=yes]]]))
+ AC_MSG_CHECKING([if sloppy multiplication is to be used])
+ if test "$enable_sloppy_mul" != "no"; then
+   enable_sloppy_mul="yes"
+@@ -53,7 +53,7 @@ fi
+ AC_MSG_RESULT($enable_sloppy_mul)
+ 
+ # --enable-sloppy-div
+-AC_ARG_ENABLE(enable_sloppy_div, AC_HELP_STRING(--enable-sloppy-div, [use 
fast but slightly inaccurate division.  [[default=yes]]]))
++AC_ARG_ENABLE([sloppy-div], AS_HELP_STRING(--enable-sloppy-div, [use fast but 
slightly inaccurate division.  [[default=yes]]]))
+ AC_MSG_CHECKING([if sloppy division is to be used])
+ if test "$enable_sloppy_div" != "no"; then
+   enable_sloppy_div="yes"
+@@ -63,7 +63,7 @@ AC_MSG_RESULT($enable_sloppy_div)
+ 
+ 
+ # --enable-debug
+-AC_ARG_ENABLE(enable_debug, AC_HELP_STRING(--enable-debug, [enable debugging 
code. [[default=no]]]))
++AC_ARG_ENABLE([debug], AS_HELP_STRING(--enable-debug, [enable debugging code. 
[[default=no]]]))
+ AC_MSG_CHECKING([if debugging code is to be enabled])
+ if test "$enable_debug" = "yes"; then
+   AC_DEFINE([QD_DEBUG], [1], [Define to 1 to enable debugging code.])
+@@ -73,7 +73,7 @@ fi
+ AC_MSG_RESULT($enable_debug)
+ 
+ # --enable-warnings
+-AC_ARG_ENABLE(enable_warnings, AC_HELP_STRING(--enable-warnings, [enable 
compiler warnings. [[default=no]]]))
++AC_ARG_ENABLE([warnings], AS_HELP_STRING(--enable-warnings, [enable compiler 
warnings. [[default=no]]]))
+ AC_MSG_CHECKING([if compiler warnings is to be enabled])
+ if test "$enable_warnings" != "yes"; then
+   enable_warnings="no"
+@@ -149,7 +149,7 @@ if test "$enable_debug" = "yes"; then
+ fi
+ 
+ # --enable-fma
+-AC_ARG_ENABLE(enable_fma, AC_HELP_STRING(--enable-fma, [use fused 
multiply-add/subtract (auto,gnu,ia64,c99,ibm,compiler).  Use this option with 
care.  [[default=auto]]]))
++AC_ARG_ENABLE([fma], AS_HELP_STRING(--enable-fma, [use fused 
multiply-add/subtract (auto,gnu,ia64,c99,ibm,compiler).  Use this option with 
care.  [[default=auto]]]))
+ if test "x$enable_fma" = "x"; then
+   enable_fma="auto"
+ fi
+@@ -248,7 +248,7 @@ if test "$FCFLAGS" = ""; then
+     FCFLAGS="-O2"
+   fi
+ fi
+-AC_ARG_ENABLE(enable_fortran, AC_HELP_STRING(--enable-fortran, [build Fortran 
77/90 interfaces [[default=auto]]]))
++AC_ARG_ENABLE([fortran], AS_HELP_STRING(--enable-fortran, [build Fortran 
77/90 interfaces [[default=auto]]]))
+ if test "$enable_fortran" != "no"; then
+   AC_LANG_PUSH(Fortran)
+   AC_PROG_FC([xlf95 ifort pathf95 f95 gfortran g95 pgf95 lf95 fort ifc efc 
pathf90 xlf90 pgf90 epcf90 xlf f90])
+-- 
+2.31.1
+

diff --git 
a/sci-libs/qd/files/0005-fortran-Makefile.am-fix-underlinking-of-libqdmod-and.patch
 
b/sci-libs/qd/files/0005-fortran-Makefile.am-fix-underlinking-of-libqdmod-and.patch
new file mode 100644
index 00000000000..cbd58a3af5f
--- /dev/null
+++ 
b/sci-libs/qd/files/0005-fortran-Makefile.am-fix-underlinking-of-libqdmod-and.patch
@@ -0,0 +1,35 @@
+From 12e53493a0413590d9dc0a0eaeeb4dfec71a1a8c Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 18:52:30 -0400
+Subject: [PATCH 05/12] fortran/Makefile.am: fix underlinking of libqdmod and
+ libqd_f_main.
+
+The libqdmod library needs to be linked to the just-built libqd, and
+then libqd_f_main needs to be linked to both the just-built libqd and
+the just-built libqdmod. Moreover, both of them need to be linked
+against whatever is in $FCLIBS.
+
+This commit adds two "_LIBADD" lines to fortran/Makefile.am to ensure
+that this happens. Their absence most likely only causes problems when
+the user has "--as-needed" in his LDFLAGS.
+---
+ fortran/Makefile.am | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/fortran/Makefile.am b/fortran/Makefile.am
+index 1ab54f7..7a67c08 100644
+--- a/fortran/Makefile.am
++++ b/fortran/Makefile.am
+@@ -16,7 +16,9 @@ endif
+ 
+ lib_LTLIBRARIES = libqdmod.la libqd_f_main.la
+ libqdmod_la_SOURCES = ddext.f ddmod.f qdext.f qdmod.f f_dd.cpp f_qd.cpp
++libqdmod_la_LIBADD = $(top_builddir)/src/libqd.la $(FCLIBS)
+ libqd_f_main_la_SOURCES = main.cpp
++libqd_f_main_la_LIBADD = $(top_builddir)/src/libqd.la libqdmod.la $(FCLIBS)
+ ddmod.lo: $(DDEXT) ddext.lo
+ qdmod.lo: ddmod.lo $(DDMOD) qdext.lo
+ $(QDMOD): qdmod.lo $(DDMOD)
+-- 
+2.31.1
+

diff --git a/sci-libs/qd/files/0006-configure.ac-remove-enable-debug-flag.patch 
b/sci-libs/qd/files/0006-configure.ac-remove-enable-debug-flag.patch
new file mode 100644
index 00000000000..151ec930e5a
--- /dev/null
+++ b/sci-libs/qd/files/0006-configure.ac-remove-enable-debug-flag.patch
@@ -0,0 +1,102 @@
+From 6aac051631b20f5cde990fb3eda8dae85ff29666 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 19:01:17 -0400
+Subject: [PATCH 06/12] configure.ac: remove --enable-debug flag.
+
+The --enable-debug flag only does two things at the moment:
+
+  1. It adds "-O" (as opposed to "-O2") to your CXXFLAGS and FCFLAGS.
+  2. It adds "-g" to your CXXFLAGS and FCFLAGS.
+
+When using gcc and gfortran, this is a convenient way to enable those
+debugging flags. However, those options are not guaranteed to be
+supported by other compilers. In the interest of simplicity and
+portability, this commit simply removes the flag.
+
+It would of course be possible to compile two test programs with
+CXXFLAGS="-g -O" and FCFLAGS="-g -O" to determine whether or not those
+flags are supported. That would solve half of the problem, but would
+be a no-op (that is, it would not enable any debugging features) on
+systems where the flags are not supported. That problem is more
+difficult to solve, and hints that it's best to leave specific
+compiler flags out of the build system whenever possible.
+---
+ configure.ac | 30 ++----------------------------
+ 1 file changed, 2 insertions(+), 28 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 1e91cd1..108e58a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -62,16 +62,6 @@ fi
+ AC_MSG_RESULT($enable_sloppy_div)
+ 
+ 
+-# --enable-debug
+-AC_ARG_ENABLE([debug], AS_HELP_STRING(--enable-debug, [enable debugging code. 
[[default=no]]]))
+-AC_MSG_CHECKING([if debugging code is to be enabled])
+-if test "$enable_debug" = "yes"; then
+-  AC_DEFINE([QD_DEBUG], [1], [Define to 1 to enable debugging code.])
+-else
+-  enable_debug="no"
+-fi
+-AC_MSG_RESULT($enable_debug)
+-
+ # --enable-warnings
+ AC_ARG_ENABLE([warnings], AS_HELP_STRING(--enable-warnings, [enable compiler 
warnings. [[default=no]]]))
+ AC_MSG_CHECKING([if compiler warnings is to be enabled])
+@@ -84,11 +74,7 @@ AC_MSG_RESULT($enable_warnings)
+ # Checks for programs.
+ AC_LANG(C++)
+ if test "$CXXFLAGS" = ""; then
+-  if test "$enable_debug" = "yes"; then
+-    CXXFLAGS="-O"
+-  else
+-    CXXFLAGS="-O2"
+-  fi
++  CXXFLAGS="-O2"
+ fi
+ 
+ # Set up compiler search list.  DUe to possible case insensitive filesystems, 
+@@ -144,10 +130,6 @@ if test "$enable_warnings" = "yes"; then
+   fi
+ fi
+ 
+-if test "$enable_debug" = "yes"; then
+-  CXXFLAGS="$CXXFLAGS -g"
+-fi
+-
+ # --enable-fma
+ AC_ARG_ENABLE([fma], AS_HELP_STRING(--enable-fma, [use fused 
multiply-add/subtract (auto,gnu,ia64,c99,ibm,compiler).  Use this option with 
care.  [[default=auto]]]))
+ if test "x$enable_fma" = "x"; then
+@@ -242,11 +224,7 @@ AC_DEFINE([QD_HAVE_STD], [1], [Define to 1 if your 
compiler have the C++ standar
+ 
+ # Check for fortran-90 compiler
+ if test "$FCFLAGS" = ""; then
+-  if test "$enable_debug" = "yes"; then
+-    FCFLAGS="-O"
+-  else
+-    FCFLAGS="-O2"
+-  fi
++  FCFLAGS="-O2"
+ fi
+ AC_ARG_ENABLE([fortran], AS_HELP_STRING(--enable-fortran, [build Fortran 
77/90 interfaces [[default=auto]]]))
+ if test "$enable_fortran" != "no"; then
+@@ -296,14 +274,10 @@ if test "$enable_fortran" != "no"; then
+   fi
+   AC_SUBST(REQ_FCFLAGS)
+   FCFLAGS="$FCFLAGS $REQ_FCFLAGS"
+-  if test "$enable_debug" = "yes"; then
+-    FCFLAGS="$FCFLAGS -g"
+-  fi
+   AC_LANG_POP(Fortran)
+ fi
+ AM_CONDITIONAL(UPCASE_MODULE, [test "$module_case" = "uppercase"])
+ AM_CONDITIONAL(HAVE_FORTRAN, [test "$enable_fortran" = "yes"])
+-AM_CONDITIONAL(QD_DEBUG, [test "$enable_debug" = "yes"])
+ 
+ AC_SUBST(F77, $FC)
+ AC_SUBST(FFLAGS, $FCFLAGS)
+-- 
+2.31.1
+

diff --git a/sci-libs/qd/files/0007-config.h.in-remove-QD_DEBUG-constant.patch 
b/sci-libs/qd/files/0007-config.h.in-remove-QD_DEBUG-constant.patch
new file mode 100644
index 00000000000..f3538b4953e
--- /dev/null
+++ b/sci-libs/qd/files/0007-config.h.in-remove-QD_DEBUG-constant.patch
@@ -0,0 +1,29 @@
+From 0e7e6933467c76f97c4c1233558c3e1f8f17b52e Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 19:08:36 -0400
+Subject: [PATCH 07/12] config.h.in: remove QD_DEBUG constant.
+
+Having removed the --enable-debug flag from the configure script in an
+earlier commit, the constant QD_DEBUG will never be defined (or used,
+as it happens) in config.h. We remove it too.
+---
+ config.h.in | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/config.h.in b/config.h.in
+index a08fd0e..dcb4272 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -112,9 +112,6 @@
+ /* Define this macro to be the copysign(x, y) function. */
+ #undef QD_COPYSIGN
+ 
+-/* Define to 1 to enable debugging code. */
+-#undef QD_DEBUG
+-
+ /* If fused multiply-add is available, define correct macro for using it. */
+ #undef QD_FMA
+ 
+-- 
+2.31.1
+

diff --git 
a/sci-libs/qd/files/0008-configure.ac-don-t-assume-that-O2-is-a-valid-compile.patch
 
b/sci-libs/qd/files/0008-configure.ac-don-t-assume-that-O2-is-a-valid-compile.patch
new file mode 100644
index 00000000000..5f560a816ae
--- /dev/null
+++ 
b/sci-libs/qd/files/0008-configure.ac-don-t-assume-that-O2-is-a-valid-compile.patch
@@ -0,0 +1,47 @@
+From fc272f5407e10e84dc1d3e0013bc6d43ecedc5db Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 19:10:34 -0400
+Subject: [PATCH 08/12] configure.ac: don't assume that "-O2" is a valid
+ compiler flag.
+
+Our configure script presently adds "-O2" to both CXXFLAGS and FCFLAGS
+when those variables are empty. If using gcc and gfortran, this
+enables some safe optimizations, but no checks are performed to ensure
+that the compiler actually understands "-O2". While we could compile
+some test programs to check, it may be simplest to leave the compiler
+flags up to the person (the user) who chooses the compilers themselves.
+
+Support for --enable-debug was removed in a recent commit for similar
+reasons.
+---
+ configure.ac | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 108e58a..823fa9e 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -73,9 +73,6 @@ AC_MSG_RESULT($enable_warnings)
+ 
+ # Checks for programs.
+ AC_LANG(C++)
+-if test "$CXXFLAGS" = ""; then
+-  CXXFLAGS="-O2"
+-fi
+ 
+ # Set up compiler search list.  DUe to possible case insensitive filesystems, 
+ # Cygwin and Apple systems sometimes gets confused between cc and CC.
+@@ -223,9 +220,7 @@ AC_DEFINE([QD_API], [], [Any special symbols needed for 
exporting APIs.])
+ AC_DEFINE([QD_HAVE_STD], [1], [Define to 1 if your compiler have the C++ 
standard include files.])
+ 
+ # Check for fortran-90 compiler
+-if test "$FCFLAGS" = ""; then
+-  FCFLAGS="-O2"
+-fi
++
+ AC_ARG_ENABLE([fortran], AS_HELP_STRING(--enable-fortran, [build Fortran 
77/90 interfaces [[default=auto]]]))
+ if test "$enable_fortran" != "no"; then
+   AC_LANG_PUSH(Fortran)
+-- 
+2.31.1
+

diff --git a/sci-libs/qd/files/0009-configure.ac-don-t-set-CC-to-CXX.patch 
b/sci-libs/qd/files/0009-configure.ac-don-t-set-CC-to-CXX.patch
new file mode 100644
index 00000000000..14269ce2d75
--- /dev/null
+++ b/sci-libs/qd/files/0009-configure.ac-don-t-set-CC-to-CXX.patch
@@ -0,0 +1,46 @@
+From eff1594d04f140d9e0a4c423a0685481a612c8ca Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 19:15:44 -0400
+Subject: [PATCH 09/12] configure.ac: don't set $CC to $CXX.
+
+The build system currently sets $CC to whatever $CXX that the
+configure script is able to find. This was harmless until now because
+C++ is a superset of C, so the C++ compiler should be able to compile
+any C code. But in the recently-released autoconf-2.71, the test
+program infrastructure no longer emits the
+
+  #ifdef __cplusplus
+  extern "C"
+  #endif
+
+in the same place it used to, which is breaking the test for
+name-mangling in the AC_FC_WRAPPERS macro. The macro thinks that it's
+compiling C code, but using a compiler that expects C++. While this may
+be fixable within autoconf, letting AC_PROG_CC detect the C compiler
+separately is both morally correct in this case and happens to solve the
+issue anyway.
+
+This fixes a build issue that was reported on Gentoo linux.
+
+Gentoo-bug: https://bugs.gentoo.org/775215
+---
+ configure.ac | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 823fa9e..a657e8f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -84,9 +84,6 @@ case $host in
+ esac
+ 
+ AC_PROG_CXX($cxx_list)
+-if test "$CC" = ""; then
+-  CC="$CXX";
+-fi
+ AC_PROG_CC
+ 
+ 
+-- 
+2.31.1
+

diff --git 
a/sci-libs/qd/files/0010-configure.ac-don-t-manually-search-for-compiler-name.patch
 
b/sci-libs/qd/files/0010-configure.ac-don-t-manually-search-for-compiler-name.patch
new file mode 100644
index 00000000000..e8bef28db32
--- /dev/null
+++ 
b/sci-libs/qd/files/0010-configure.ac-don-t-manually-search-for-compiler-name.patch
@@ -0,0 +1,81 @@
+From 18d508793abbfc4045af7c7c91f6d71bb5bb7ef1 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 19:31:36 -0400
+Subject: [PATCH 10/12] configure.ac: don't manually search for compiler
+ names/flags.
+
+The AC_PROG_CXX macro is generally capable of finding the best C++
+compiler on the system these days, including the flags it needs.  This
+commit removes the hard-coded list of C++ compilers, and the manual
+computation of REQ_CXXFLAGS based on the name of the compiler.
+
+This serves another purpose: the qd-config program is capable of
+outputting an appropriate "-I" flag to allow consumers to use libqd
+when it is installed in a nonstandard location. At the moment, however,
+that "-I" flag is accompanied by whatever other REQ_CXXFLAGS were
+computed -- and many of those flags are invalid in the other context.
+By eliminating REQ_CXXFLAGS, we solve that problem too.
+---
+ configure.ac | 43 +------------------------------------------
+ 1 file changed, 1 insertion(+), 42 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index a657e8f..5ac7079 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -73,51 +73,10 @@ AC_MSG_RESULT($enable_warnings)
+ 
+ # Checks for programs.
+ AC_LANG(C++)
+-
+-# Set up compiler search list.  DUe to possible case insensitive filesystems, 
+-# Cygwin and Apple systems sometimes gets confused between cc and CC.
+-# Try to use vendor compilers first, as they are often the fastest.
+-case $host in 
+-  *cygwin* | *mingw* ) cxx_list="" ;;
+-  *apple* ) cxx_list="xlC_r xlC icpc pathCC c++ g++ gpp" ;;
+-  * ) cxx_list="xlC_r xlC icpc pathCC pgCC cxx aCC CC cc++ FCC KCC RCC c++ 
g++ gpp" ;;
+-esac
+-
+-AC_PROG_CXX($cxx_list)
++AC_PROG_CXX
+ AC_PROG_CC
+ 
+ 
+-CXX_PROG_NAME=`basename $CXX`
+-case $host in
+-  powerpc*-*-*)
+-    case "$CXX_PROG_NAME" in
+-      xlC*) 
+-        REQ_CXXFLAGS="$REQ_CXXFLAGS -qstrict"
+-      ;;
+-    esac
+-  ;;
+-  i?86-*-* | k?*-*-* | athlon-*-* | ia64-*-* | x86_64-*-*)
+-    case "$CXX_PROG_NAME" in
+-      icc|icpc|ecc)
+-        REQ_CXXFLAGS="$REQ_CXXFLAGS -mp"
+-        if test "$enable_warnings" = "yes"; then
+-          CXXFLAGS="$CXXFLAGS -wd1572 -wd981 -wd1418 -wd1419"
+-        fi
+-      ;;
+-    esac
+-  ;;
+-  alpha*-*-*)
+-    case "$CXX_PROG_NAME" in
+-      cxx) 
+-        CXXFLAGS="$CXXFLAGS -std strict_ansi -tweak"
+-      ;;
+-    esac
+-  ;;
+-esac
+-
+-AC_SUBST(REQ_CXXFLAGS)
+-CXXFLAGS="$CXXFLAGS $REQ_CXXFLAGS"
+-
+ if test "$enable_warnings" = "yes"; then
+   if test "$GCC" = "yes"; then
+     CXXFLAGS="$CXXFLAGS -Wall"
+-- 
+2.31.1
+

diff --git a/sci-libs/qd/files/0011-qd-config.in-remove-REQ_CXXFLAGS.patch 
b/sci-libs/qd/files/0011-qd-config.in-remove-REQ_CXXFLAGS.patch
new file mode 100644
index 00000000000..7c36b768d6e
--- /dev/null
+++ b/sci-libs/qd/files/0011-qd-config.in-remove-REQ_CXXFLAGS.patch
@@ -0,0 +1,27 @@
+From 8d9e74e71cd2c0878c85b3559eeb66ec5020a99b Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 19:36:23 -0400
+Subject: [PATCH 11/12] qd-config.in: remove @REQ_CXXFLAGS@.
+
+We no longer compute REQ_CXXFLAGS in configure.ac, so this commit
+removes the empty variable from qd-config.in.
+---
+ qd-config.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/qd-config.in b/qd-config.in
+index 3abfcb7..56bc960 100644
+--- a/qd-config.in
++++ b/qd-config.in
+@@ -14,7 +14,7 @@ builddir="@abs_top_builddir@"
+ build_CXXFLAGS="@CXXFLAGS@"
+ build_LDFLAGS="@LDFLAGS@"
+ CXX="@CXX@"
+-CXXFLAGS="-I$includedir @REQ_CXXFLAGS@"
++CXXFLAGS="-I$includedir"
+ FC="@FC@"
+ 
+ LDFLAGS="-L$libdir -lqd @LIBS@"
+-- 
+2.31.1
+

diff --git 
a/sci-libs/qd/files/0012-configure.ac-remove-the-enable-warnings-flag.patch 
b/sci-libs/qd/files/0012-configure.ac-remove-the-enable-warnings-flag.patch
new file mode 100644
index 00000000000..a7cb94077f8
--- /dev/null
+++ b/sci-libs/qd/files/0012-configure.ac-remove-the-enable-warnings-flag.patch
@@ -0,0 +1,55 @@
+From b02e5c5403b1ac88b1fd606f3c1147330c47700c Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <mich...@orlitzky.com>
+Date: Wed, 4 Aug 2021 19:38:31 -0400
+Subject: [PATCH 12/12] configure.ac: remove the --enable-warnings flag.
+
+This flag simply adds "-Wall" to $CXXFLAGS when it is enabled and the
+value of the $GCC variable is true. Given how easy it is to run
+
+  CXXFLAGS=-Wall ./configure
+
+(which uses standard knowledge) compared to
+
+  ./configure --enable-warnings
+
+(which does not), I don't think this flag warrants the extra complexity
+in configure.ac. This commit removes the option.
+---
+ configure.ac | 15 ---------------
+ 1 file changed, 15 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5ac7079..46640e5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -62,27 +62,12 @@ fi
+ AC_MSG_RESULT($enable_sloppy_div)
+ 
+ 
+-# --enable-warnings
+-AC_ARG_ENABLE([warnings], AS_HELP_STRING(--enable-warnings, [enable compiler 
warnings. [[default=no]]]))
+-AC_MSG_CHECKING([if compiler warnings is to be enabled])
+-if test "$enable_warnings" != "yes"; then
+-  enable_warnings="no"
+-fi
+-AC_MSG_RESULT($enable_warnings)
+-
+-
+ # Checks for programs.
+ AC_LANG(C++)
+ AC_PROG_CXX
+ AC_PROG_CC
+ 
+ 
+-if test "$enable_warnings" = "yes"; then
+-  if test "$GCC" = "yes"; then
+-    CXXFLAGS="$CXXFLAGS -Wall"
+-  fi
+-fi
+-
+ # --enable-fma
+ AC_ARG_ENABLE([fma], AS_HELP_STRING(--enable-fma, [use fused 
multiply-add/subtract (auto,gnu,ia64,c99,ibm,compiler).  Use this option with 
care.  [[default=auto]]]))
+ if test "x$enable_fma" = "x"; then
+-- 
+2.31.1
+

diff --git a/sci-libs/qd/qd-2.3.22-r1.ebuild b/sci-libs/qd/qd-2.3.22-r1.ebuild
new file mode 100644
index 00000000000..3baf812eeb5
--- /dev/null
+++ b/sci-libs/qd/qd-2.3.22-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+FORTRAN_NEEDED=fortran
+
+inherit autotools fortran-2
+
+DESCRIPTION="Quad-double and double-double float arithmetics"
+HOMEPAGE="https://www.davidhbailey.com/dhbsoftware/";
+SRC_URI="http://crd.lbl.gov/~dhbailey/mpdist/${P}.tar.gz";
+
+SLOT="0"
+LICENSE="BSD"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="cpu_flags_x86_fma3 cpu_flags_x86_fma4 doc fortran"
+
+PATCHES=(
+       "${FILESDIR}/0001-configure.ac-update-QD_PATCH_VERSION-to-2.3.22.patch"
+       
"${FILESDIR}/0002-configure.ac-replace-AM_CONFIG_HEADER-with-AC_CONFIG.patch"
+       
"${FILESDIR}/0003-configure.ac-replace-AC_PROG_LIBTOOL-with-LT_INIT.patch"
+       
"${FILESDIR}/0004-configure.ac-fix-syntax-of-all-AC_ARG_ENABLE-calls.patch"
+       
"${FILESDIR}/0005-fortran-Makefile.am-fix-underlinking-of-libqdmod-and.patch"
+       "${FILESDIR}/0006-configure.ac-remove-enable-debug-flag.patch"
+       "${FILESDIR}/0007-config.h.in-remove-QD_DEBUG-constant.patch"
+       
"${FILESDIR}/0008-configure.ac-don-t-assume-that-O2-is-a-valid-compile.patch"
+       "${FILESDIR}/0009-configure.ac-don-t-set-CC-to-CXX.patch"
+       
"${FILESDIR}/0010-configure.ac-don-t-manually-search-for-compiler-name.patch"
+       "${FILESDIR}/0011-qd-config.in-remove-REQ_CXXFLAGS.patch"
+       "${FILESDIR}/0012-configure.ac-remove-the-enable-warnings-flag.patch"
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       econf \
+               --disable-static \
+               --disable-ieee-add \
+               --disable-sloppy-mul \
+               --disable-sloppy-div \
+               --enable-inline \
+               $(use_enable cpu_flags_x86_fma$(usex cpu_flags_x86_fma3 3 4) 
fma) \
+               $(use_enable fortran)
+}
+
+src_install() {
+       default
+
+       dosym qd_real.h /usr/include/qd/qd.h
+       dosym dd_real.h /usr/include/qd/dd.h
+
+       if ! use doc; then
+               rm "${ED}"/usr/share/doc/${PF}/*.pdf || die
+       fi
+
+       find "${D}" -name '*.la' -delete || die
+}

Reply via email to