--- configure.orig	2018-11-09 11:03:06 UTC
+++ configure
@@ -22659,12 +22659,13 @@ case "$host_os" in
 darwin*)
     ;;
 *)
-    for ac_func in clock_gettime
+    for ac_func in clock_gettime clock_nanosleep
 do :
-  ac_fn_c_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
-if test "x$ac_cv_func_clock_gettime" = xyes; then :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_CLOCK_GETTIME 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
  CLOCK_LIB=
 else
@@ -23330,8 +23331,12 @@ $as_echo_n "checking whether pthread_setaffinity_np is
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+    #if  defined(__DragonFly__) || defined(__FreeBSD__)
+    #include <pthread_np.h>
+    #else
     #define _GNU_SOURCE
     #include <pthread.h>
+    #endif
     int main() {
        void *a = (void*) &pthread_setaffinity_np;
        long b = (long) a;
@@ -23350,11 +23355,20 @@ rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS="$save_LIBS"
 
-ac_fn_c_check_header_mongrel "$LINENO" "linux/futex.h" "ac_cv_header_linux_futex_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_futex_h" = xyes; then :
-  DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"
+for ac_header in linux/futex.h sys/umtx.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#include <errno.h>
+     #include <sys/types.h>
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ DEFINES="$DEFINES -DHAVE_LINUX_FUTEX_H"
 fi
 
+done
 
 
 # Check whether --enable-selinux was given.
@@ -24252,7 +24266,7 @@ fi
 
 
 case "$host_os" in
-linux*)
+linux* | freebsd*)
     dri3_default=yes
     ;;
 *)
@@ -26640,31 +26654,11 @@ fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$XCB_RANDR_PKG_ERRORS" >&5
 
-	as_fn_error $? "Package requirements ($randr_modules) were not met:
-
-$XCB_RANDR_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables XCB_RANDR_CFLAGS
-and XCB_RANDR_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
+	have_xlease=no
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables XCB_RANDR_CFLAGS
-and XCB_RANDR_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
+	have_xlease=no
 else
 	XCB_RANDR_CFLAGS=$pkg_cv_XCB_RANDR_CFLAGS
 	XCB_RANDR_LIBS=$pkg_cv_XCB_RANDR_LIBS
@@ -26732,31 +26726,11 @@ fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$XLIB_RANDR_PKG_ERRORS" >&5
 
-	as_fn_error $? "Package requirements ($xlib_randr_modules) were not met:
-
-$XLIB_RANDR_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables XLIB_RANDR_CFLAGS
-and XLIB_RANDR_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details." "$LINENO" 5
+	have_xlease=no
 elif test $pkg_failed = untried; then
      	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables XLIB_RANDR_CFLAGS
-and XLIB_RANDR_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details" "$LINENO" 5; }
+	have_xlease=no
 else
 	XLIB_RANDR_CFLAGS=$pkg_cv_XLIB_RANDR_CFLAGS
 	XLIB_RANDR_LIBS=$pkg_cv_XLIB_RANDR_LIBS
@@ -28792,9 +28766,6 @@ rm -f core conftest.err conftest.$ac_objext conftest.$
         CLANG_LIBDIR=${LLVM_LIBDIR}
     fi
     CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION}
-    if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then :
-  as_fn_error $? "Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries." "$LINENO" 5
-fi
 fi
  if test "x$enable_opencl" = xyes; then
   HAVE_CLOVER_TRUE=
