Skip to content

Commit

Permalink
Unify $host_os case statement in configure.ac
Browse files Browse the repository at this point in the history
There's no good reason for the Solaris check to be separate from the rest.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Feb 5, 2014
1 parent 0f1e550 commit 88cb866
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 5 additions & 1 deletion compat.c
Expand Up @@ -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 <sys/time.h>

time_t openconnect__time(time_t *t)
Expand Down
19 changes: 9 additions & 10 deletions configure.ac
Expand Up @@ -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])
Expand All @@ -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.
Expand All @@ -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)], [])
Expand Down
2 changes: 1 addition & 1 deletion openconnect-internal.h
Expand Up @@ -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
Expand Down

0 comments on commit 88cb866

Please sign in to comment.