aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorJohannes Pfau <johannespfau@gmail.com>2019-02-18 23:29:39 +0000
committerIain Buclaw <ibuclaw@gcc.gnu.org>2019-02-18 23:29:39 +0000
commit36d7f1518f347e2cdc21dcfd380e8316df139496 (patch)
treeb39c85a4affc15b249d6b9c57cdb3a4c0f2dd256 /libphobos
parent0232a2191b72a57a84c0d9967b7b00bdfdab898e (diff)
downloadgcc-36d7f1518f347e2cdc21dcfd380e8316df139496.zip
gcc-36d7f1518f347e2cdc21dcfd380e8316df139496.tar.gz
gcc-36d7f1518f347e2cdc21dcfd380e8316df139496.tar.bz2
libphobos: Detect if qsort_r is available
Merges upstream druntime bbfb58e8. libphobos/ChangeLog: 2019-02-19 Johannes Pfau <johannespfau@gmail.com> PR d/88127 * m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_CLIB): Add new macro. * configure.ac: Use DRUNTIME_LIBRARIES_CLIB. * configure: Regenerate * Makefile.in: Regenerate * libdruntime/gcc/config.d.in: Add Have_Qsort_R. * libdruntime/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. From-SVN: r268999
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/ChangeLog12
-rw-r--r--libphobos/Makefile.in1
-rwxr-xr-xlibphobos/configure26
-rw-r--r--libphobos/configure.ac1
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/Makefile.in1
-rw-r--r--libphobos/libdruntime/gcc/config.d.in3
-rw-r--r--libphobos/libdruntime/rt/qsort.d18
-rw-r--r--libphobos/m4/druntime/libraries.m412
-rw-r--r--libphobos/src/Makefile.in1
-rw-r--r--libphobos/testsuite/Makefile.in1
11 files changed, 75 insertions, 3 deletions
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index c2bfe50..5e24d94 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,3 +1,15 @@
+2019-02-19 Johannes Pfau <johannespfau@gmail.com>
+
+ PR d/88127
+ * m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_CLIB): Add new macro.
+ * configure.ac: Use DRUNTIME_LIBRARIES_CLIB.
+ * configure: Regenerate
+ * Makefile.in: Regenerate
+ * libdruntime/gcc/config.d.in: Add Have_Qsort_R.
+ * libdruntime/Makefile.in: Regenerate.
+ * src/Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+
2019-02-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* testsuite/lib/libphobos-dg.exp: Tabify.
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index 87eaf28..e7c156a 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -213,6 +213,7 @@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@
DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@
DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@
DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@
+DCFG_HAVE_QSORT_R = @DCFG_HAVE_QSORT_R@
DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@
DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@
DEFS = @DEFS@
diff --git a/libphobos/configure b/libphobos/configure
index 4741c28..7bb034b 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -650,6 +650,7 @@ LIBATOMIC
DCFG_HAVE_LIBATOMIC
DCFG_HAVE_64BIT_ATOMICS
DCFG_HAVE_ATOMIC_BUILTINS
+DCFG_HAVE_QSORT_R
DRUNTIME_OS_MINFO_BRACKETING_FALSE
DRUNTIME_OS_MINFO_BRACKETING_TRUE
DCFG_MINFO_BRACKETING
@@ -11498,7 +11499,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11501 "configure"
+#line 11502 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11604,7 +11605,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11607 "configure"
+#line 11608 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14137,6 +14138,27 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ DCFG_HAVE_QSORT_R=false
+ ac_fn_c_check_func "$LINENO" "qsort_r" "ac_cv_func_qsort_r"
+if test "x$ac_cv_func_qsort_r" = xyes; then :
+ DCFG_HAVE_QSORT_R=true
+fi
+
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
gdc_save_DFLAGS=$GDCFLAGS
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3701a24..b436dc0 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -126,6 +126,7 @@ DRUNTIME_OS_SOURCES
DRUNTIME_OS_THREAD_MODEL
DRUNTIME_OS_ARM_EABI_UNWINDER
DRUNTIME_OS_MINFO_BRACKETING
+DRUNTIME_LIBRARIES_CLIB
WITH_LOCAL_DRUNTIME([
AC_LANG_PUSH([D])
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 09ce8d0..1a09ebf 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-fb4bda91b0b43b5a18e1c143943c101ad4e17667
+bbfb58e8a921cabdd0002a40bf63fe35ed7c77e8
The first line of this file holds the git revision number of the last
merge done from the dlang/druntime repository.
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 02331af..8f4ff8b 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -1096,6 +1096,7 @@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@
DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@
DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@
DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@
+DCFG_HAVE_QSORT_R = @DCFG_HAVE_QSORT_R@
DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@
DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@
DEFS = @DEFS@
diff --git a/libphobos/libdruntime/gcc/config.d.in b/libphobos/libdruntime/gcc/config.d.in
index 1b5d5d9..4652bf0 100644
--- a/libphobos/libdruntime/gcc/config.d.in
+++ b/libphobos/libdruntime/gcc/config.d.in
@@ -43,3 +43,6 @@ enum GNU_Have_64Bit_Atomics = @DCFG_HAVE_64BIT_ATOMICS@;
// Do we have libatomic available
enum GNU_Have_LibAtomic = @DCFG_HAVE_LIBATOMIC@;
+
+// Do we have qsort_r function
+enum Have_Qsort_R = @DCFG_HAVE_QSORT_R@;
diff --git a/libphobos/libdruntime/rt/qsort.d b/libphobos/libdruntime/rt/qsort.d
index 6c3e71c..af0c1eb 100644
--- a/libphobos/libdruntime/rt/qsort.d
+++ b/libphobos/libdruntime/rt/qsort.d
@@ -27,8 +27,26 @@ else version (TVOS)
else version (WatchOS)
version = Darwin;
+// qsort_r was added in glibc in 2.8. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88127
version (CRuntime_Glibc)
{
+ version (GNU)
+ {
+ import gcc.config : Have_Qsort_R;
+ enum Glibc_Qsort_R = Have_Qsort_R;
+ }
+ else
+ {
+ enum Glibc_Qsort_R = true;
+ }
+}
+else
+{
+ enum Glibc_Qsort_R = false;
+}
+
+static if (Glibc_Qsort_R)
+{
alias extern (C) int function(scope const void *, scope const void *, scope void *) Cmp;
extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, Cmp cmp, scope void *arg);
diff --git a/libphobos/m4/druntime/libraries.m4 b/libphobos/m4/druntime/libraries.m4
index 17f9346..35a791d 100644
--- a/libphobos/m4/druntime/libraries.m4
+++ b/libphobos/m4/druntime/libraries.m4
@@ -161,3 +161,15 @@ AC_DEFUN([DRUNTIME_LIBRARIES_BACKTRACE],
AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
AC_LANG_POP([C])
])
+
+# DRUNTIME_LIBRARIES_CLIB
+# -----------------------
+# Perform various feature checks on the C library.
+AC_DEFUN([DRUNTIME_LIBRARIES_CLIB],
+[
+ AC_LANG_PUSH([C])
+ DCFG_HAVE_QSORT_R=false
+ AC_CHECK_FUNC(qsort_r, [DCFG_HAVE_QSORT_R=true])
+ AC_SUBST(DCFG_HAVE_QSORT_R)
+ AC_LANG_POP([C])
+])
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index 3dffa6f..b6037ac 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -504,6 +504,7 @@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@
DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@
DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@
DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@
+DCFG_HAVE_QSORT_R = @DCFG_HAVE_QSORT_R@
DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@
DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@
DEFS = @DEFS@
diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in
index 205b673..78107d2 100644
--- a/libphobos/testsuite/Makefile.in
+++ b/libphobos/testsuite/Makefile.in
@@ -159,6 +159,7 @@ DCFG_ARM_EABI_UNWINDER = @DCFG_ARM_EABI_UNWINDER@
DCFG_HAVE_64BIT_ATOMICS = @DCFG_HAVE_64BIT_ATOMICS@
DCFG_HAVE_ATOMIC_BUILTINS = @DCFG_HAVE_ATOMIC_BUILTINS@
DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@
+DCFG_HAVE_QSORT_R = @DCFG_HAVE_QSORT_R@
DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@
DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@
DEFS = @DEFS@