[Darshan-commits] [Git][darshan/darshan][master] 5 commits: add autoconf test for fscanf redirect

Philip Carns xgitlab at cels.anl.gov
Fri Feb 14 07:33:18 CST 2020



Philip Carns pushed to branch master at darshan / darshan


Commits:
36d8e168 by Shane Snyder at 2020-02-13T22:10:11Z
add autoconf test for fscanf redirect

- - - - -
bb2909d1 by Shane Snyder at 2020-02-13T23:42:31Z
slight modification of autoconf test

- - - - -
82eb9e9e by Shane Snyder at 2020-02-14T00:00:35Z
need gnu_source for config check

- - - - -
7ff18700 by Shane Snyder at 2020-02-14T00:03:18Z
ifdef wrap in fscanf redirect case

- - - - -
9c769b2c by Philip Carns at 2020-02-14T13:33:14Z
Merge branch 'dev-fscanf-redefined' into 'master'

fix fscanf redefinitions

See merge request darshan/darshan!35
- - - - -


4 changed files:

- darshan-runtime/configure
- darshan-runtime/configure.in
- darshan-runtime/darshan-runtime-config.h.in
- darshan-runtime/lib/darshan-stdio.c


Changes:

=====================================
darshan-runtime/configure
=====================================
@@ -4832,6 +4832,38 @@ fi
 # End of MPI-only checks
 #
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fscanf redirect" >&5
+$as_echo_n "checking for fscanf redirect... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    #define _GNU_SOURCE
+    #include <stdio.h>
+    int fscanf(FILE *stream, const char *format, ...) {return(0);}
+    int __isoc99_fscanf(FILE *stream, const char *format, ...) {return(0);}
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_FSCANF_REDIRECT 1" >>confdefs.h
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
 DARSHAN_VERSION="3.2.0-pre1"
 
 


=====================================
darshan-runtime/configure.in
=====================================
@@ -481,6 +481,21 @@ AS_IF([$CC -show foo.c -o foo >& /dev/null],
 # End of MPI-only checks
 #
 
+AC_MSG_CHECKING(for fscanf redirect)
+AC_TRY_COMPILE(
+    [
+    #define _GNU_SOURCE
+    #include <stdio.h>
+    int fscanf(FILE *stream, const char *format, ...) {return(0);}
+    int __isoc99_fscanf(FILE *stream, const char *format, ...) {return(0);}
+    ],
+    [],
+    AC_MSG_RESULT(no),
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(HAVE_FSCANF_REDIRECT, 1, Define if fscanf is redirected to another function)
+)
+
+
 DARSHAN_VERSION="AC_PACKAGE_VERSION"
 AC_SUBST(darshan_lib_path)
 AC_SUBST(darshan_share_path)


=====================================
darshan-runtime/darshan-runtime-config.h.in
=====================================
@@ -6,6 +6,9 @@
 /* Define if struct aiocb64 type is defined */
 #undef HAVE_AIOCB64
 
+/* Define if fscanf is redirected to another function */
+#undef HAVE_FSCANF_REDIRECT
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 


=====================================
darshan-runtime/lib/darshan-stdio.c
=====================================
@@ -109,7 +109,9 @@ DARSHAN_FORWARD_DECL(getw, int, (FILE *stream));
 DARSHAN_FORWARD_DECL(_IO_getc, int, (FILE *stream));
 DARSHAN_FORWARD_DECL(_IO_putc, int, (int, FILE *stream));
 DARSHAN_FORWARD_DECL(fscanf, int, (FILE *stream, const char *format, ...));
+#ifndef HAVE_FSCANF_REDIRECT
 DARSHAN_FORWARD_DECL(__isoc99_fscanf, int, (FILE *stream, const char *format, ...));
+#endif
 DARSHAN_FORWARD_DECL(vfscanf, int, (FILE *stream, const char *format, va_list ap));
 DARSHAN_FORWARD_DECL(fgets, char*, (char *s, int size, FILE *stream));
 DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
@@ -696,6 +698,7 @@ int DARSHAN_DECL(getw)(FILE *stream)
     return(ret);
 }
 
+#ifndef HAVE_FSCANF_REDIRECT
 /* NOTE: some glibc versions use __isoc99_fscanf as the underlying symbol
  * rather than fscanf
  */
@@ -726,7 +729,7 @@ int DARSHAN_DECL(__isoc99_fscanf)(FILE *stream, const char *format, ...)
 
     return(ret);
 }
-
+#endif
 
 int DARSHAN_DECL(fscanf)(FILE *stream, const char *format, ...)
 {



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/733cac5d4597128584321ccc2d43f7643bfd2ea4...9c769b2cf415ea024d56df27526cb6d75e9199cc

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/compare/733cac5d4597128584321ccc2d43f7643bfd2ea4...9c769b2cf415ea024d56df27526cb6d75e9199cc
You're receiving this email because of your account on xgitlab.cels.anl.gov.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20200214/f46d98f4/attachment-0001.html>


More information about the Darshan-commits mailing list