Blame m4/printf-frexp.m4

Packit 8f70b4
# printf-frexp.m4 serial 5
Packit 8f70b4
dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
Packit 8f70b4
dnl This file is free software; the Free Software Foundation
Packit 8f70b4
dnl gives unlimited permission to copy and/or distribute it,
Packit 8f70b4
dnl with or without modifications, as long as this notice is preserved.
Packit 8f70b4
Packit 8f70b4
dnl Check how to define printf_frexp() without linking with libm.
Packit 8f70b4
Packit 8f70b4
AC_DEFUN([gl_FUNC_PRINTF_FREXP],
Packit 8f70b4
[
Packit 8f70b4
  AC_REQUIRE([gl_CHECK_FREXP_NO_LIBM])
Packit 8f70b4
  if test $gl_cv_func_frexp_no_libm = yes; then
Packit 8f70b4
    gl_FUNC_FREXP_WORKS
Packit 8f70b4
    case "$gl_cv_func_frexp_works" in
Packit 8f70b4
      *yes)
Packit 8f70b4
        AC_DEFINE([HAVE_FREXP_IN_LIBC], [1],
Packit 8f70b4
          [Define if the frexp function is available in libc.])
Packit 8f70b4
        ;;
Packit 8f70b4
    esac
Packit 8f70b4
  fi
Packit 8f70b4
Packit 8f70b4
  AC_CACHE_CHECK([whether ldexp can be used without linking with libm],
Packit 8f70b4
    [gl_cv_func_ldexp_no_libm],
Packit 8f70b4
    [
Packit 8f70b4
      AC_LINK_IFELSE(
Packit 8f70b4
        [AC_LANG_PROGRAM(
Packit 8f70b4
           [[#include <math.h>
Packit 8f70b4
             double x;
Packit 8f70b4
             int y;]],
Packit 8f70b4
           [[return ldexp (x, y) < 1;]])],
Packit 8f70b4
        [gl_cv_func_ldexp_no_libm=yes],
Packit 8f70b4
        [gl_cv_func_ldexp_no_libm=no])
Packit 8f70b4
    ])
Packit 8f70b4
  if test $gl_cv_func_ldexp_no_libm = yes; then
Packit 8f70b4
    AC_DEFINE([HAVE_LDEXP_IN_LIBC], [1],
Packit 8f70b4
      [Define if the ldexp function is available in libc.])
Packit 8f70b4
  fi
Packit 8f70b4
])