Skip to content

Commit

Permalink
configure: work around modff() not existing
Browse files Browse the repository at this point in the history
Happens on HP-UX/PA-RISC.

Thanks to Richard Lloyd for reporting the issue.

Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Aug 22, 2018
1 parent 60a4878 commit b1af630
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion config/hwloc.m4
Expand Up @@ -444,8 +444,15 @@ EOF])
AC_CHECK_DECLS([fabsf], [
AC_CHECK_LIB([m], [fabsf],
[HWLOC_LIBS="-lm $HWLOC_LIBS"])
[need_libm=yes])
], [], [[#include <math.h>]])
AC_CHECK_DECLS([modff], [
AC_CHECK_LIB([m], [modff],
[need_libm=yes])
], [], [[#include <math.h>]])
if test x$need_libm = xyes; then
HWLOC_LIBS="-lm $HWLOC_LIBS"
fi
AC_CHECK_HEADERS([picl.h], [
AC_CHECK_LIB([picl], [picl_initialize],
Expand Down
4 changes: 4 additions & 0 deletions contrib/windows/private_config.h
Expand Up @@ -59,6 +59,10 @@
*/
#define HAVE_DECL_FABSF 1

/* Define to 1 if you have the declaration of `modff', and to 0 if you don't.
*/
#define HAVE_DECL_MODFF 1

/* Define to 1 if you have the declaration of `HW_NCPU', and to 0 if you
don't. */
/* #undef HAVE_DECL_HW_NCPU */
Expand Down
4 changes: 4 additions & 0 deletions include/private/misc.h
Expand Up @@ -517,6 +517,10 @@ hwloc__obj_type_is_icache(hwloc_obj_type_t type)
#define fabsf(f) fabs((double)(f))
#endif

#if !HAVE_DECL_MODFF
#define modff(x,iptr) (float)modf((double)x,(double *)iptr)
#endif

#if HAVE_DECL__SC_PAGE_SIZE
#define hwloc_getpagesize() sysconf(_SC_PAGE_SIZE)
#elif HAVE_DECL__SC_PAGESIZE
Expand Down

0 comments on commit b1af630

Please sign in to comment.