libphobos: Detect if qsort_r is available
authorJohannes Pfau <johannespfau@gmail.com>
Mon, 18 Feb 2019 23:29:39 +0000 (23:29 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Mon, 18 Feb 2019 23:29:39 +0000 (23:29 +0000)
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

libphobos/ChangeLog
libphobos/Makefile.in
libphobos/configure
libphobos/configure.ac
libphobos/libdruntime/MERGE
libphobos/libdruntime/Makefile.in
libphobos/libdruntime/gcc/config.d.in
libphobos/libdruntime/rt/qsort.d
libphobos/m4/druntime/libraries.m4
libphobos/src/Makefile.in
libphobos/testsuite/Makefile.in

index c2bfe5034b35d0185fc616777343540b4a19fdae..5e24d948513980c692231e79e7fa2eee9b3532d6 100644 (file)
@@ -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.
index 87eaf28aba7c8601013cecafa026776821292acc..e7c156aa5eb22dcadb4487726b66b337a9b02a33 100644 (file)
@@ -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@
index 4741c287a44cc1634c5147f00182c55140d2cc5b..7bb034b841d2b3cdea62a2d6c47aec1b58f76035 100755 (executable)
@@ -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
index 3701a241b8e359644815ce1c3f371a70497012b3..b436dc034ae07f37ef31f8b89e1d39832bd68ec4 100644 (file)
@@ -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])
index 09ce8d03566a29036e81a962fa403e4c57d3a65c..1a09ebf54109833ac9a8142fe7bc2303c104fde4 100644 (file)
@@ -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.
index 02331af95bd02c309d78bb6e2494f1583d5ede0a..8f4ff8b1831694ffc854730a21dbec0691d0cac4 100644 (file)
@@ -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@
index 1b5d5d9b69248ba6f6689ca7384a9f81fdd0d718..4652bf095313055e8786ce7377cacdf82133e402 100644 (file)
@@ -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@;
index 6c3e71c35c75afc0561387f272a7c70c9771e3d8..af0c1eb704aaf36af79373fe2878ab12ef8022f2 100644 (file)
@@ -27,7 +27,25 @@ 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);
index 17f93468b874863cd76240771e8a7382f66217f5..35a791d137a57171ddea8d1c7db7c9ac64c00089 100644 (file)
@@ -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])
+])
index 3dffa6f6093e3ed78f2def486f4a94e0610cadf5..b6037ac0ff0e58567a1b1b8a6c357135db4a8916 100644 (file)
@@ -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@
index 205b6731d3d9b025b2bf15429b591096fb0f6b75..78107d22680500fa9df8dd9d93781eb3fb7b4cce 100644 (file)
@@ -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@