diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-19 18:53:31 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-20 02:54:04 +0000 |
commit | b73689649059060c5876a8ae281a2ded58a1b8fc (patch) | |
tree | a2b18d7154626619a3e597fd211c4e631c3414a2 | |
parent | 201a7e7d689bef213a0d303601c6ac41d02a21be (diff) |
Handle floorl() the same way we handle other not-on-all-platforms functions.
Use AC_CHECK_FUNC() for it, define FLOORL_LO to floorl.lo if we *don't*
have it, add FLOORL_LO to the list of items conditionally built in
libwsutil, and include "wsutil/floor.h" only if HAVE_FLOORL is *not*
defined, as that means it's *not* supplied by the platform and thus
*not* declared in <math.h>.
Also, use the standard export stuff in wsutil/floor.h.
Change-Id: Ic24aa69f65f2d15450d8b84b0c2b0c58f38edebe
Reviewed-on: https://code.wireshark.org/review/5901
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | ui/time_shift.c | 4 | ||||
-rw-r--r-- | wsutil/Makefile.am | 1 | ||||
-rw-r--r-- | wsutil/floor.h | 14 |
4 files changed, 22 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index 73572c524b..b55f2221a4 100644 --- a/configure.ac +++ b/configure.ac @@ -2648,6 +2648,14 @@ AC_C_BIGENDIAN # XXX - do we need this? AC_PROG_GCC_TRADITIONAL +AC_CHECK_FUNC(floorl, + [ + FLOORL_LO="" + AC_DEFINE(HAVE_FLOORL, 1, [Define if you have the floorl function.]) + ], + FLOORL_LO="floorl.lo") +AC_SUBST(FLOORL_LO) + AC_CHECK_FUNC(getopt, [ GETOPT_LO="" @@ -2736,7 +2744,6 @@ AC_SUBST(STRPTIME_LO) AC_CHECK_FUNCS(getprotobynumber gethostbyname2) AC_CHECK_FUNCS(issetugid) AC_CHECK_FUNCS(mmap mprotect sysconf) -AC_CHECK_FUNCS(floorl) dnl blank for now, but will be used in future AC_SUBST(wireshark_SUBDIRS) diff --git a/ui/time_shift.c b/ui/time_shift.c index d9275526ec..0f7af738bc 100644 --- a/ui/time_shift.c +++ b/ui/time_shift.c @@ -33,7 +33,9 @@ #include "ui/ui_util.h" -#include "wsutil/floor.h" +#ifndef HAVE_FLOORL +# include "wsutil/floor.h" +#endif #define SHIFT_POS 0 #define SHIFT_NEG 1 diff --git a/wsutil/Makefile.am b/wsutil/Makefile.am index fe998c40c9..99db32a887 100644 --- a/wsutil/Makefile.am +++ b/wsutil/Makefile.am @@ -31,6 +31,7 @@ libwsutil_abi_INCLUDES = \ # Optional objects that I know how to build. These will be # linked into libwsutil if necessary. wsutil_optional_objects = \ + @FLOORL_LO@ \ @GETOPT_LO@ \ @INET_ATON_LO@ \ @INET_NTOP_LO@ \ diff --git a/wsutil/floor.h b/wsutil/floor.h index d2b5a6ff65..b73ddbc466 100644 --- a/wsutil/floor.h +++ b/wsutil/floor.h @@ -21,10 +21,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef __FLOORL_H__ +#define __FLOORL_H__ + #include "config.h" -#include <glib.h> +#include "ws_symbol_export.h" + +/* + * Version of "floorl()", for the benefit of OSes that don't have it. + */ +WS_DLL_PUBLIC long double floorl(long double x); -#ifndef HAVE_FLOORL -long double floorl(long double x); -#endif +#endif /* __FLOORL_H__ */ |