From c0394c26f80ec2f05728ab04cd7f21cfe90a3fcc Mon Sep 17 00:00:00 2001 From: cpickett Date: Tue, 30 Dec 2008 01:37:21 +0000 Subject: [PATCH] * only check for those functions that we currently need to check for to solve portability problems, and avoid checking for things where we don't currently use the result generated in config.h * add stubs for setenv, unsetenv, localtime_r, and fileno git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@481 64e312b2-a51f-0410-8e61-82d0ca0eb02a --- configure.ac | 7 ++----- lib/fileno.c | 0 lib/libcompat.h | 22 +++++++++++++++++++--- lib/localtime_r.c | 0 lib/setenv.c | 0 lib/unsetenv.c | 0 6 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 lib/fileno.c create mode 100644 lib/localtime_r.c create mode 100644 lib/setenv.c create mode 100644 lib/unsetenv.c diff --git a/configure.ac b/configure.ac index 364d413..1c1569d 100644 --- a/configure.ac +++ b/configure.ac @@ -115,13 +115,10 @@ AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(long, 4) # Checks for library functions. -AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_REALLOC -AC_FUNC_STRFTIME -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([alarm gettimeofday localtime_r memmove memset putenv setenv strerror strrchr strstr]) -AC_REPLACE_FUNCS([sleep strdup strsignal]) +AC_REPLACE_FUNCS([fileno localtime_r setenv sleep strdup strsignal unsetenv]) +AC_CHECK_DECLS([fileno, localtime_r, malloc, realloc, setenv, sleep, strdup, strsignal, unsetenv]) # Output files AC_CONFIG_HEADERS([config.h]) diff --git a/lib/fileno.c b/lib/fileno.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/libcompat.h b/lib/libcompat.h index f57dfa0..18cd5bb 100644 --- a/lib/libcompat.h +++ b/lib/libcompat.h @@ -7,25 +7,41 @@ /* defines size_t */ #include +#if !HAVE_FILENO +int fileno(FILE *stream); +#endif /* !HAVE_FILENO */ + +#if !HAVE_LOCALTIME_R +struct tm *localtime_r(const time_t *clock, struct tm *result); +#endif /* !HAVE_LOCALTIME_R */ + #if !HAVE_MALLOC -void *rpl_malloc (size_t n) +void *rpl_malloc (size_t n); #endif /* !HAVE_MALLOC */ #if !HAVE_REALLOC -void *rpl_realloc (void *p, size_t n) +void *rpl_realloc (void *p, size_t n); #endif /* !HAVE_REALLOC */ +#if !HAVE_SETENV +int setenv(const char *name, const char *value, int overwrite); +#endif /* !HAVE_SETENV */ + #if !HAVE_SLEEP unsigned int sleep (unsigned int seconds); #endif /* !HAVE_SLEEP */ #if !HAVE_STRDUP -char *strdup (const char *str) +char *strdup (const char *str); #endif /* !HAVE_STRDUP */ #if !HAVE_STRSIGNAL const char *strsignal(int sig); #endif /* !HAVE_STRSIGNAL */ +#if !HAVE_UNSETENV +void unsetenv(const char *name); +#endif /* !HAVE_UNSETENV */ + /* silence warnings about an empty library */ void ck_do_nothing (void); diff --git a/lib/localtime_r.c b/lib/localtime_r.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/setenv.c b/lib/setenv.c new file mode 100644 index 0000000..e69de29 diff --git a/lib/unsetenv.c b/lib/unsetenv.c new file mode 100644 index 0000000..e69de29 -- 2.49.0