]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
allocate mutex globally ... that might work better
authorTobias Oetiker <tobi@oetiker.ch>
Wed, 22 Jul 2015 13:12:37 +0000 (15:12 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Wed, 22 Jul 2015 13:12:37 +0000 (15:12 +0200)
configure
src/rrd_parsetime.c

index dd8b95d7254fc06b349932f2f3bc1f6aa5621e45..056715c9cd5643a98e74af013ae78bd566a13149 100755 (executable)
--- a/configure
+++ b/configure
@@ -19931,6 +19931,240 @@ CORE_LIBS="$LIBS"
 
 if test $enable_rrd_graph != no; then
 
+ 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
+
+ EX_CHECK_STATE=NO
+ ex_check_save_LIBS=${LIBS}
+ ex_check_save_CPPFLAGS=${CPPFLAGS}
+ ex_check_save_LDFLAGS=${LDFLAGS}
+ if test "x""" != "x"; then
+   CPPFLAGS="$CPPFLAGS -I"""
+ fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_access_version_number in -lpng" >&5
+$as_echo_n "checking for png_access_version_number in -lpng... " >&6; }
+if ${ac_cv_lib_png_png_access_version_number+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char png_access_version_number ();
+int
+main ()
+{
+return png_access_version_number ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_png_png_access_version_number=yes
+else
+  ac_cv_lib_png_png_access_version_number=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_access_version_number" >&5
+$as_echo "$ac_cv_lib_png_png_access_version_number" >&6; }
+if test "x$ac_cv_lib_png_png_access_version_number" = xyes; then :
+
+    ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
+if test "x$ac_cv_header_png_h" = xyes; then :
+  LIBS="-lpng ${LIBS}";EX_CHECK_STATE=YES
+fi
+
+
+fi
+
+ if test $EX_CHECK_STATE = NO; then
+        for ac_prog in pkg-config
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PKGCONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PKGCONFIG"; then
+  ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_PKGCONFIG="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+PKGCONFIG=$ac_cv_prog_PKGCONFIG
+if test -n "$PKGCONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
+$as_echo "$PKGCONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$PKGCONFIG" && break
+done
+test -n "$PKGCONFIG" || PKGCONFIG="no"
+
+    if test "$PKGCONFIG" != "no"; then
+          if $PKGCONFIG --exists libpng; then
+             CPPFLAGS=${CPPFLAGS}" "`$PKGCONFIG --cflags libpng`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-L libpng`
+             LDFLAGS=${LDFLAGS}" "`$PKGCONFIG --libs-only-other libpng`
+             LIBS=${LIBS}" "`$PKGCONFIG --libs-only-l libpng`
+                            unset ac_cv_lib_`echo png | sed 's/[^_a-zA-Z0-9]/_/g;s/^[0-9]/_/'`_png_access_version_number
+             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_access_version_number in -lpng" >&5
+$as_echo_n "checking for png_access_version_number in -lpng... " >&6; }
+if ${ac_cv_lib_png_png_access_version_number+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpng  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char png_access_version_number ();
+int
+main ()
+{
+return png_access_version_number ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_png_png_access_version_number=yes
+else
+  ac_cv_lib_png_png_access_version_number=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_access_version_number" >&5
+$as_echo "$ac_cv_lib_png_png_access_version_number" >&6; }
+if test "x$ac_cv_lib_png_png_access_version_number" = xyes; then :
+
+                unset ac_cv_header_`echo png.h | sed 's/[^_a-zA-Z0-9]/_/g;s/^[0-9]/_/'`
+                ac_fn_c_check_header_mongrel "$LINENO" "png.h" "ac_cv_header_png_h" "$ac_includes_default"
+if test "x$ac_cv_header_png_h" = xyes; then :
+  EX_CHECK_STATE=YES
+fi
+
+
+
+fi
+
+          else
+             { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no libpng.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&5
+$as_echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I found a copy of pkgconfig, but there is no libpng.pc file around.
+  You may want to set the PKG_CONFIG_PATH variable to point to its
+  location.
+----------------------------------------------------------------------------
+                       " >&2;}
+           fi
+     fi
+  fi
+
+  if test ${EX_CHECK_STATE} = NO; then
+     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of libpng. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libpng and its header files. If
+  you have not installed libpng, you can get it either from its original home on
+
+     ftp://ftp.simplesystems.org/pub/libpng/png/src/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of libpng is 1.4.8.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&5
+$as_echo "$as_me: WARNING:
+----------------------------------------------------------------------------
+* I could not find a working copy of libpng. Check config.log for hints on why
+  this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
+  so that compiler and the linker can find libpng and its header files. If
+  you have not installed libpng, you can get it either from its original home on
+
+     ftp://ftp.simplesystems.org/pub/libpng/png/src/
+
+  You can find also find an archive copy on
+
+     http://oss.oetiker.ch/rrdtool/pub/libs
+
+  The last tested version of libpng is 1.4.8.
+
+       LIBS=$LIBS
+   LDFLAGS=$LDFLAGS
+  CPPFLAGS=$CPPFLAGS
+
+----------------------------------------------------------------------------
+                " >&2;}
+       EX_CHECK_ALL_ERR=YES
+       LIBS="${ex_check_save_LIBS}"
+       CPPFLAGS="${ex_check_save_CPPFLAGS}"
+       LDFLAGS="${ex_check_save_LDFLAGS}"
+   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
+
+
+
+
  ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
index e02e27d930d5c0c7a948ccaed0e4f293cc524c26..c2ecbca86996a9a467c140fc553aa9e0b20f1fe9 100644 (file)
@@ -833,11 +833,13 @@ static char *day(
  * mktime() The return value is either TIME_OK (aka NULL) or
  * the pointer to the error message in the case of problems
  */
+
+static mutex_t parsetime_mutex = MUTEX_INITIALIZER;
+
 char     *rrd_parsetime(
     const char *tspec,
     rrd_time_value_t * ptv)
 {
-    static mutex_t parsetime_mutex = MUTEX_INITIALIZER;
     time_t    now = time(NULL);
     int       hr = 0;