[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Supressing output with AC_CHECK_DECL, etc.
From: |
Jason Curl |
Subject: |
Supressing output with AC_CHECK_DECL, etc. |
Date: |
Sat, 05 May 2007 00:47:45 +1000 |
Hello,
I've had to invent a new check for 'localtime_r()' if we need to define
_REENTRANT or not. For example:
Cygwin/Linux:
#include <time.h>
Solaris/Interix-3.5:
#define _REENTRANT
#include <time.h>
Then we can use localtime_r() without warnings.
However, my macro that I've written prints out twice checking for localtime_r
because
the first time I check and if it isn't there, I repeat the check with _REENTRANT
defined. How can I supress these printouts from AC_CHECK_DECL and replace them
with my own?
I'm using autoconf-2.61. It appears that AC_FD_MSG will always print something.
Comments on the macro are also welcome.
Thanks,
Jason.
# $Source: /home/cvs/repository/LX2005/code/m4/systimer.m4,v $
# $Id: systimer.m4,v 1.2 2007/05/04 13:25:39 a15595 Exp $
# LX_HEADER_TIMEFUNC
# ------------------
# Checks for the inclusion style for <time.h> and <sys/time.h>. On some
# systems (e.g. Interix-3.5) if we want localtime_r() we also need to define
# _REENTRANT.
#
# TODO: When checking for localtime_r() have better control over what is printed
AC_DEFUN([LX_HEADER_TIMEFUNC],
[AC_CHECK_HEADERS(sys/time.h)
if test -z $ac_cv_header_time; then
AC_HEADER_TIME
fi
# Check if we have the following functions
AC_CHECK_DECL([timersub],
[AC_DEFINE(HAVE_TIMERSUB,1,[Some OSes don't have this])],
[AC_LIBOBJ([timersub])],
[#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
])
AC_CHECK_DECL([timeradd],
[AC_DEFINE(HAVE_TIMERADD,1,[Some OSes don't have this])],
[AC_LIBOBJ([timeradd])],
[#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
])
# Check if we have 'localtime_r()'
])
AC_CHECK_DECL([timeradd],
[AC_DEFINE(HAVE_TIMERADD,1,[Some OSes don't have this])],
[AC_LIBOBJ([timeradd])],
[#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
])
# Check if we have 'localtime_r()'
AC_CHECK_DECL([localtime_r],
[AC_DEFINE(HAVE_LOCALTIME_R,1,[Not all Operating Systems support this])],
[unset ac_cv_have_decl_localtime_r
AC_CHECK_DECL([localtime_r],
[AC_DEFINE(HAVE_LOCALTIME_R,1,[Not all Operating Systems support this])
AC_DEFINE(_REENTRANT,1,[When including time, provides
localtime_r()])],
[],
[#define _REENTRANT
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
])],
[#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
])
])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Supressing output with AC_CHECK_DECL, etc.,
Jason Curl <=