Commit 9c769b2c authored by Philip Carns's avatar Philip Carns

Merge branch 'dev-fscanf-redefined' into 'master'

fix fscanf redefinitions

See merge request !35
parents 733cac5d 7ff18700
...@@ -4832,6 +4832,38 @@ fi ...@@ -4832,6 +4832,38 @@ fi
# End of MPI-only checks # 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_VERSION="3.2.0-pre1"
......
...@@ -481,6 +481,21 @@ AS_IF([$CC -show foo.c -o foo >& /dev/null], ...@@ -481,6 +481,21 @@ AS_IF([$CC -show foo.c -o foo >& /dev/null],
# End of MPI-only checks # 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" DARSHAN_VERSION="AC_PACKAGE_VERSION"
AC_SUBST(darshan_lib_path) AC_SUBST(darshan_lib_path)
AC_SUBST(darshan_share_path) AC_SUBST(darshan_share_path)
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
/* Define if struct aiocb64 type is defined */ /* Define if struct aiocb64 type is defined */
#undef HAVE_AIOCB64 #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. */ /* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H #undef HAVE_INTTYPES_H
......
...@@ -109,7 +109,9 @@ DARSHAN_FORWARD_DECL(getw, int, (FILE *stream)); ...@@ -109,7 +109,9 @@ DARSHAN_FORWARD_DECL(getw, int, (FILE *stream));
DARSHAN_FORWARD_DECL(_IO_getc, int, (FILE *stream)); DARSHAN_FORWARD_DECL(_IO_getc, int, (FILE *stream));
DARSHAN_FORWARD_DECL(_IO_putc, int, (int, FILE *stream)); DARSHAN_FORWARD_DECL(_IO_putc, int, (int, FILE *stream));
DARSHAN_FORWARD_DECL(fscanf, int, (FILE *stream, const char *format, ...)); 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, ...)); 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(vfscanf, int, (FILE *stream, const char *format, va_list ap));
DARSHAN_FORWARD_DECL(fgets, char*, (char *s, int size, FILE *stream)); DARSHAN_FORWARD_DECL(fgets, char*, (char *s, int size, FILE *stream));
DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence)); DARSHAN_FORWARD_DECL(fseek, int, (FILE *stream, long offset, int whence));
...@@ -696,6 +698,7 @@ int DARSHAN_DECL(getw)(FILE *stream) ...@@ -696,6 +698,7 @@ int DARSHAN_DECL(getw)(FILE *stream)
return(ret); return(ret);
} }
#ifndef HAVE_FSCANF_REDIRECT
/* NOTE: some glibc versions use __isoc99_fscanf as the underlying symbol /* NOTE: some glibc versions use __isoc99_fscanf as the underlying symbol
* rather than fscanf * rather than fscanf
*/ */
...@@ -726,7 +729,7 @@ int DARSHAN_DECL(__isoc99_fscanf)(FILE *stream, const char *format, ...) ...@@ -726,7 +729,7 @@ int DARSHAN_DECL(__isoc99_fscanf)(FILE *stream, const char *format, ...)
return(ret); return(ret);
} }
#endif
int DARSHAN_DECL(fscanf)(FILE *stream, const char *format, ...) int DARSHAN_DECL(fscanf)(FILE *stream, const char *format, ...)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment