From: Niels Provos Date: Tue, 22 Feb 2005 16:12:34 +0000 (+0000) Subject: compilation fixes for IRIX; from Nick Mathewson X-Git-Tag: release-1.1b~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a46c2609bfa4d68e78665dd55461af9b1ce9651b;p=libevent compilation fixes for IRIX; from Nick Mathewson svn:r132 --- diff --git a/acconfig.h b/acconfig.h index 834e810c..eab2a275 100644 --- a/acconfig.h +++ b/acconfig.h @@ -16,15 +16,7 @@ /* Define if timeradd is defined in */ #undef HAVE_TIMERADD #ifndef HAVE_TIMERADD -#undef timerclear -#undef timerisset -#undef timercmp -#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#define timercmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec == (uvp)->tv_sec) ? \ - ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ - ((tvp)->tv_sec cmp (uvp)->tv_sec)) +#undef timersub #define timeradd(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \ @@ -45,6 +37,26 @@ } while (0) #endif /* !HAVE_TIMERADD */ +#undef HAVE_TIMERCLEAR +#ifndef HAVE_TIMERCLEAR +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif + +#undef HAVE_TIMERCMP +#ifndef HAVE_TIMERCMP +#undef timercmp +#define timercmp(tvp, uvp, cmp) \ + (((tvp)->tv_sec == (uvp)->tv_sec) ? \ + ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ + ((tvp)->tv_sec cmp (uvp)->tv_sec)) +#endif + +#undef HAVE_TIMERISSET +#ifndef HAVE_TIMERISSET +#undef timerisset +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#endif + /* Define if TAILQ_FOREACH is defined in */ #undef HAVE_TAILQFOREACH #ifndef HAVE_TAILQFOREACH @@ -62,3 +74,6 @@ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ } while (0) #endif /* TAILQ_FOREACH */ + +/* Define to __FUNCTION__ or __file__ if your compiler doesn't have __func__ */ +#undef __func__ diff --git a/configure.in b/configure.in index 52c2a3ef..c040b767 100644 --- a/configure.in +++ b/configure.in @@ -63,6 +63,48 @@ if test "x$ac_cv_header_sys_time_h" = "xyes"; then ) fi +if test "x$ac_cv_header_sys_time_h" = "xyes"; then + AC_MSG_CHECKING(for timercmp in sys/time.h) + AC_EGREP_CPP(yes, +[ +#include +#ifdef timercmp + yes +#endif +], [ AC_DEFINE(HAVE_TIMERCMP, 1, + [Define if timercmp is defined in ]) + AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) +) +fi + +if test "x$ac_cv_header_sys_time_h" = "xyes"; then + AC_MSG_CHECKING(for timerclear in sys/time.h) + AC_EGREP_CPP(yes, +[ +#include +#ifdef timerclear + yes +#endif +], [ AC_DEFINE(HAVE_TIMERCLEAR, 1, + [Define if timerclear is defined in ]) + AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) +) +fi + +if test "x$ac_cv_header_sys_time_h" = "xyes"; then + AC_MSG_CHECKING(for timerisset in sys/time.h) + AC_EGREP_CPP(yes, +[ +#include +#ifdef timerisset + yes +#endif +], [ AC_DEFINE(HAVE_TIMERISSET, 1, + [Define if timerisset is defined in ]) + AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no) +) +fi + dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE @@ -277,4 +319,19 @@ AC_TRY_COMPILE([ [Define to unsigned int if you dont have it])] ) +AC_MSG_CHECKING([whether our compiler supports __func__]) +AC_TRY_COMPILE([], + [void foo() { const char *cp = __func__; }], + AC_MSG_RESULT([yes]), + AC_MSG_RESULT([no]) + AC_MSG_CHECKING([whether our compiler supports __FUNCTION__]) + AC_TRY_COMPILE([], + [void foo() { const char *cp = __FUNCTION__; }], + AC_MSG_RESULT([yes]) + AC_DEFINE(__func__, __FUNCTION__, + [Define to appropriate substitue if compiler doesnt have __func__]), + AC_MSG_RESULT([no]) + AC_DEFINE(__func__, __FILE__, + [Define to appropriate substitue if compiler doesnt have __func__]))) + AC_OUTPUT(Makefile test/Makefile sample/Makefile)