From 88cb86670abfb6a8773f292b269584448b412c3f Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Wed, 5 Feb 2014 15:39:36 +0000 Subject: [PATCH] Unify $host_os case statement in configure.ac There's no good reason for the Solaris check to be separate from the rest. Signed-off-by: David Woodhouse --- compat.c | 6 +++++- configure.ac | 19 +++++++++---------- openconnect-internal.h | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/compat.c b/compat.c index acb97d6b..44a191aa 100644 --- a/compat.c +++ b/compat.c @@ -29,7 +29,11 @@ #include "openconnect-internal.h" -#ifdef __sun__ +#ifdef HAVE_SUNOS_BROKEN_TIME +/* + * On SunOS, time() goes backwards. Thankfully, gethrtime() doesn't. + * https://www.illumos.org/issues/1871 and, for Solaris 11, CR7121035. + */ #include time_t openconnect__time(time_t *t) diff --git a/configure.ac b/configure.ac index efb90f0a..02ddc5b5 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,10 @@ AC_DEFINE_UNQUOTED(DEFAULT_VPNCSCRIPT, "${with_vpnc_script}") AC_SUBST(DEFAULT_VPNCSCRIPT, "${with_vpnc_script}") use_openbsd_libtool= +symver_time= +symver_getline= +symver_asprintf= + case $host_os in *linux* | *gnu*) AC_MSG_NOTICE([Applying feature macros for GNU build]) @@ -74,6 +78,11 @@ case $host_os in AC_MSG_NOTICE([Applying feature macros for OpenBSD build]) use_openbsd_libtool=true ;; + *solaris*|*sunos*) + AC_MSG_NOTICE([Applying workaround for broken SunOS time() function]) + AC_DEFINE(HAVE_SUNOS_BROKEN_TIME) + symver_time="openconnect__time;" + ;; *) # On FreeBSD the only way to get vsyslog() visible is to define # *nothing*, which makes absolutely everything visible. @@ -82,16 +91,6 @@ case $host_os in ;; esac -symver_time= -symver_getline= -symver_asprintf= - -case $host_os in - *solaris*|*sunos*) - symver_time="openconnect__time;" - ;; -esac - AC_CHECK_FUNC(fdevname_r, [AC_DEFINE(HAVE_FDEVNAME_R, 1)], []) AC_CHECK_FUNC(getline, [AC_DEFINE(HAVE_GETLINE, 1)], [symver_getline="openconnect__getline;"]) AC_CHECK_FUNC(strcasestr, [AC_DEFINE(HAVE_STRCASESTR, 1)], []) diff --git a/openconnect-internal.h b/openconnect-internal.h index 632c2db6..8bb8ee60 100644 --- a/openconnect-internal.h +++ b/openconnect-internal.h @@ -330,7 +330,7 @@ struct openconnect_info { /****************************************************************************/ /* Oh Solaris how we hate thee! */ -#ifdef __sun__ +#ifdef HAVE_SUNOS_BROKEN_TIME #define time(x) openconnect__time(x) time_t openconnect__time(time_t *t); #endif