Needed for build on systems with gcc-g++- and libstdc++ approx. v10.2.1 .

Inspiration: https://oprofile-list.sf.narkive.com/LnNOA65x/patch-link-ocount-with-librt-for-clock-gettime-only-when-needed

diff -uNr drbd-utils-9.15.0.orig/configure drbd-utils-9.15.0/configure
--- drbd-utils-9.15.0.orig/configure	2020-09-28 09:47:31.000000000 +0200
+++ drbd-utils-9.15.0/configure	2020-10-24 18:53:30.622000000 +0200
@@ -5746,12 +5746,18 @@
   fi
 
 
-            if test -z "$ac_ct_CXX" -o "$HAVE_CXX11" = "0"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No C++11 compiler found, disabling drbdmon build." >&5
-$as_echo "$as_me: WARNING: No C++11 compiler found, disabling drbdmon build." >&2;}
-      WITH_DRBDMON=no
-   fi
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime, timer_create, timer_settime, timer_delete in -lrt" >&5
+                        for ac_func in clock_gettime, timer_create, timer_settime, timer_delete
+do :
+  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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime, timer_create, timer_settime, timer_delete in -lrt" >&5
 $as_echo_n "checking for clock_gettime, timer_create, timer_settime, timer_delete in -lrt... " >&6; }
 if ${ac_cv_lib_rt_clock_gettime__timer_create__timer_settime__timer_delete+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -5797,8 +5803,11 @@
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find required librt functions, disabling drbdmon build." >&5
 $as_echo "$as_me: WARNING: Could not find required librt functions, disabling drbdmon build." >&2;}
-                 WITH_DRBDMON=no
+                                WITH_DRBDMON=no
+fi
+
 fi
+done
 
 fi
 
diff -uNr drbd-utils-9.15.0.orig/configure.ac drbd-utils-9.15.0/configure.ac
--- drbd-utils-9.15.0.orig/configure.ac	2020-09-28 09:21:06.000000000 +0200
+++ drbd-utils-9.15.0/configure.ac	2020-10-24 18:46:13.857000000 +0200
@@ -250,13 +250,14 @@
    dnl RCK: c++ testing is "special", CXX might be guessed to g++ even if not installed
    dnl we have to check the undocumented "$ac_ct_CXX"
    dnl https://lists.gnu.org/archive/html/bug-autoconf/2010-05/msg00001.html
-   if test -z "$ac_ct_CXX" -o "$HAVE_CXX11" = "0"; then
-      AC_MSG_WARN([No C++11 compiler found, disabling drbdmon build.])
-      WITH_DRBDMON=no
-   fi
-   AC_CHECK_LIB([rt], [clock_gettime, timer_create, timer_settime, timer_delete], [],
-                [AC_MSG_WARN([Could not find required librt functions, disabling drbdmon build.])
-                 WITH_DRBDMON=no])
+   dnl if test -z "$ac_ct_CXX" -o "$HAVE_CXX11" = "0"; then
+   dnl   AC_MSG_WARN([No C++11 compiler found, disabling drbdmon build.])
+   dnl   WITH_DRBDMON=no
+   dnl fi
+   AC_CHECK_FUNCS([clock_gettime, timer_create, timer_settime, timer_delete], [], [
+                  AC_CHECK_LIB([rt], [clock_gettime, timer_create, timer_settime, timer_delete], [],
+                               [AC_MSG_WARN([Could not find required librt functions, disabling drbdmon build.])
+                                WITH_DRBDMON=no])])
 fi
 
 if test x"$WITH_WINDRBD" = x"yes" ; then
diff -uNr drbd-utils-9.15.0.orig/user/shared/config.h.in drbd-utils-9.15.0/user/shared/config.h.in
--- drbd-utils-9.15.0.orig/user/shared/config.h.in	2018-11-29 10:45:55.000000000 +0100
+++ drbd-utils-9.15.0/user/shared/config.h.in	2020-09-28 23:48:42.046000004 +0200
@@ -22,6 +22,9 @@
    */
 #undef DRBD_RUN_DIR
 
+/* Define to 1 if you have the `clock_gettime,' function. */
+#undef HAVE_CLOCK_GETTIME_
+
 /* CTRL_ATTR_HDRSIZE defined in linux/genetlink.h */
 #undef HAVE_CTRL_ATTR_HDRSIZE
 
@@ -73,6 +76,15 @@
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the `timer_create,' function. */
+#undef HAVE_TIMER_CREATE_
+
+/* Define to 1 if you have the `timer_delete' function. */
+#undef HAVE_TIMER_DELETE
+
+/* Define to 1 if you have the `timer_settime,' function. */
+#undef HAVE_TIMER_SETTIME_
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
