view m4/floorl.m4 @ 14894:b22360ddefc4

gnulib-tool: Better isolation between different gnulib-tool invocations. * gnulib-tool: New option --witness-c-macro. (witness_c_macro): New variable. (func_emit_lib_Makefile_am): If --witness-c-macro was specified, let AM_CPPFLAGS define it as a C macro. (func_emit_tests_Makefile_am): Likewise. (func_import): Store witness_c_macro setting in gnulib-cache.m4 and read it from there. * m4/gnulib-common.m4 (gl_MODULE_INDICATOR_CONDITION): Define through m4_define, not AC_DEFUN. (gl_MODULE_INDICATOR_SET_VARIABLE_AUX, gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR): New macros. (gl_MODULE_INDICATOR_SET_VARIABLE): Use them. * modules/arpa_inet (Makefile.am): Use sed expression s/.../.../, not s|...|...|, to substitute the values of the GNULIB_* module indicator variables. * modules/dirent (Makefile.am): Likewise. * modules/fcntl-h (Makefile.am): Likewise. * modules/iconv-h (Makefile.am): Likewise. * modules/langinfo (Makefile.am): Likewise. * modules/locale (Makefile.am): Likewise. * modules/math (Makefile.am): Likewise. * modules/netdb (Makefile.am): Likewise. * modules/poll-h (Makefile.am): Likewise. * modules/pty (Makefile.am): Likewise. * modules/search (Makefile.am): Likewise. * modules/signal (Makefile.am): Likewise. * modules/spawn (Makefile.am): Likewise. * modules/stdio (Makefile.am): Likewise. * modules/stdlib (Makefile.am): Likewise. * modules/string (Makefile.am): Likewise. * modules/sys_ioctl (Makefile.am): Likewise. * modules/sys_select (Makefile.am): Likewise. * modules/sys_socket (Makefile.am): Likewise. * modules/sys_stat (Makefile.am): Likewise. * modules/sys_times (Makefile.am): Likewise. * modules/sys_utsname (Makefile.am): Likewise. * modules/sys_wait (Makefile.am): Likewise. * modules/termios (Makefile.am): Likewise. * modules/time (Makefile.am): Likewise. * modules/unistd (Makefile.am): Likewise. * modules/wchar (Makefile.am): Likewise.
author Bruno Haible <bruno@clisp.org>
date Wed, 08 Jun 2011 13:23:56 +0200
parents 97fc9a21a8fb
children e9d6250b22fe
line wrap: on
line source

# floorl.m4 serial 7
dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.

AC_DEFUN([gl_FUNC_FLOORL],
[
  AC_REQUIRE([gl_MATH_H_DEFAULTS])
  dnl Persuade glibc <math.h> to declare floorl().
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
  dnl Test whether floorl() is declared.
  AC_CHECK_DECLS([floorl], , , [#include <math.h>])
  if test "$ac_cv_have_decl_floorl" = yes; then
    dnl Test whether floorl() can be used without libm.
    gl_FUNC_FLOORL_LIBS
    if test "$FLOORL_LIBM" = "?"; then
      dnl Sun C 5.0 on Solaris declares floorl() and has it in the system-wide
      dnl libm.so, but not in the libm.so that the compiler uses.
      REPLACE_FLOORL=1
    fi
  else
    HAVE_DECL_FLOORL=0
  fi
  if test $HAVE_DECL_FLOORL = 0 || test $REPLACE_FLOORL = 1; then
    AC_LIBOBJ([floorl])
    FLOORL_LIBM=
  fi
  AC_SUBST([FLOORL_LIBM])
])

# Determines the libraries needed to get the floorl() function.
# Sets FLOORL_LIBM.
AC_DEFUN([gl_FUNC_FLOORL_LIBS],
[
  gl_CACHE_VAL_SILENT([gl_cv_func_floorl_libm], [
    gl_cv_func_floorl_libm=?
    AC_LINK_IFELSE(
      [AC_LANG_PROGRAM(
         [[#ifndef __NO_MATH_INLINES
           # define __NO_MATH_INLINES 1 /* for glibc */
           #endif
           #include <math.h>
           long double x;]],
         [[x = floorl(x);]])],
      [gl_cv_func_floorl_libm=])
    if test "$gl_cv_func_floorl_libm" = "?"; then
      save_LIBS="$LIBS"
      LIBS="$LIBS -lm"
      AC_LINK_IFELSE(
        [AC_LANG_PROGRAM(
           [[#ifndef __NO_MATH_INLINES
             # define __NO_MATH_INLINES 1 /* for glibc */
             #endif
             #include <math.h>
             long double x;]],
           [[x = floorl(x);]])],
        [gl_cv_func_floorl_libm="-lm"])
      LIBS="$save_LIBS"
    fi
  ])
  FLOORL_LIBM="$gl_cv_func_floorl_libm"
])