81b462a405
Don't set openmp to fix a build failure with codesourcery toolchain that doesn't have OpenMP >= 4.5 indeed upstream doesn't want to remove the build failure if the user provides --enable-openmp and OpenMP is < 4.5: https://github.com/rpm-software-management/rpm/pull/1433 Fixes: - http://autobuild.buildroot.org/results/05dd945d24e8684aad6a2343ba7f6f8a7cea8349 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
79 lines
2.5 KiB
Diff
79 lines
2.5 KiB
Diff
From 6a780f10c2b600cfc38f8b8f20cb7e40b979f541 Mon Sep 17 00:00:00 2001
|
|
From: Michal Domonkos <mdomonko@redhat.com>
|
|
Date: Tue, 4 Aug 2020 16:50:21 +0200
|
|
Subject: [PATCH] Check for OpenMP version at configure time
|
|
|
|
Only accept OpenMP >= 4.5, due to the "priority" clause that we use
|
|
since commit 6f6f5e7, and also document that in the INSTALL file.
|
|
|
|
If explicitly required with --enable-openmp, fail configuration if the
|
|
version is not available.
|
|
|
|
https://www.openmp.org/wp-content/uploads/openmp-4.5.pdf
|
|
|
|
Resolves: #1315
|
|
[Retrieved from:
|
|
https://github.com/rpm-software-management/rpm/commit/6a780f10c2b600cfc38f8b8f20cb7e40b979f541]
|
|
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|
---
|
|
INSTALL | 6 ++++++
|
|
configure.ac | 25 +++++++++++++++++++++++--
|
|
2 files changed, 29 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/INSTALL b/INSTALL
|
|
index cfbe54a3e..7622b2efe 100644
|
|
--- a/INSTALL
|
|
+++ b/INSTALL
|
|
@@ -142,6 +142,12 @@ If you plan on using cryptographic signatures you will need a version
|
|
of GPG, available from
|
|
http://www.gnupg.org/
|
|
|
|
+OpenMP multithreading support is automatically enabled if your C compiler has
|
|
+support for OpenMP version 4.5 or higher (to disable, pass the --disable-openmp
|
|
+option to configure). For GCC, OpenMP 4.5 is fully supported since GCC 6.1,
|
|
+which is available from
|
|
+ http://www.gnu.org/
|
|
+
|
|
To compile RPM:
|
|
--------------
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 1346ee704..35003619d 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -167,11 +167,32 @@ AC_SUBST(WITH_LZMA_LIB)
|
|
|
|
# AC_OPENMP supports --enable/disable-openmp out of the box, but it doesn't
|
|
# actually give us a way to conditionalize the build based on that. Argh.
|
|
+# Version 4.5 (201511) introduced "priority" clause for tasks.
|
|
OPENMP_CFLAGS=
|
|
AC_OPENMP
|
|
AS_IF([test "x$ac_cv_prog_c_openmp" != x &&
|
|
- test "x$ac_cv_prog_c_openmp" != unsupported],[
|
|
- AC_DEFINE(ENABLE_OPENMP, 1, [Enable multithreading support?])
|
|
+ test "x$ac_cv_prog_c_openmp" != xunsupported],[
|
|
+ old_CFLAGS=$CFLAGS
|
|
+ CFLAGS="$CFLAGS $OPENMP_CFLAGS"
|
|
+ AC_MSG_CHECKING([OpenMP is at least version 4.5])
|
|
+ AC_RUN_IFELSE(
|
|
+ [AC_LANG_PROGRAM(
|
|
+ [#include <omp.h>],
|
|
+ [#if _OPENMP < 201511
|
|
+ exit(1);
|
|
+ #endif
|
|
+ ]
|
|
+ )],
|
|
+ [AC_MSG_RESULT([yes])
|
|
+ AC_DEFINE(ENABLE_OPENMP, 1, [Enable multithreading support?])
|
|
+ ],
|
|
+ [AC_MSG_RESULT([no])
|
|
+ if test "$enable_openmp" = "yes"; then
|
|
+ AC_MSG_ERROR([OpenMP too old])
|
|
+ fi
|
|
+ ]
|
|
+ )
|
|
+ CFLAGS=$old_CFLAGS
|
|
])
|
|
AC_SUBST(OPENMP_CFLAGS)
|
|
|