view m4/expm1l.m4 @ 17363:5a51fb7777a9

sys_select, sys_time: port 2013-01-30 Solaris 2.6 fix to Cygwin Problem reported by Marco Atzeri in <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00000.html>. * lib/sys_select.in.h [HAVE_SYS_SELECT_H && _CYGWIN_SYS_TIME_H]: Simply delegate to the system <sys/select.h> in this case too. Also, pay attention to _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H only if OSF/1, since otherwise Cygwin breaks, and it doesn't seem to be needed on Solaris either. * lib/sys_time.in.h [_CYGWIN_SYS_TIME_H]: Simply delgate to the system <sys/time.h> in this case.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 19 Mar 2013 09:08:47 -0700
parents e542fd46ad6f
children 344018b6e5d7
line wrap: on
line source

# expm1l.m4 serial 2
dnl Copyright (C) 2010-2013 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_EXPM1L],
[
  AC_REQUIRE([gl_MATH_H_DEFAULTS])
  AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])

  dnl Persuade glibc <math.h> to declare expm1l().
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])

  EXPM1L_LIBM=
  AC_CACHE_CHECK([whether expm1l() can be used without linking with libm],
    [gl_cv_func_expm1l_no_libm],
    [
      AC_LINK_IFELSE(
        [AC_LANG_PROGRAM(
           [[#ifndef __NO_MATH_INLINES
             # define __NO_MATH_INLINES 1 /* for glibc */
             #endif
             #include <math.h>
             extern
             #ifdef __cplusplus
             "C"
             #endif
             long double expm1l (long double);
             long double (*funcptr) (long double) = expm1l;
             long double x;]],
           [[return funcptr (x) > 0.5
                    || expm1l (x) > 0.5;]])],
        [gl_cv_func_expm1l_no_libm=yes],
        [gl_cv_func_expm1l_no_libm=no])
    ])
  if test $gl_cv_func_expm1l_no_libm = no; then
    AC_CACHE_CHECK([whether expm1l() can be used with libm],
      [gl_cv_func_expm1l_in_libm],
      [
        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>
               extern
               #ifdef __cplusplus
               "C"
               #endif
               long double expm1l (long double);
               long double (*funcptr) (long double) = expm1l;
               long double x;]],
             [[return funcptr (x) > 0.5
                      || expm1l (x) > 0.5;]])],
          [gl_cv_func_expm1l_in_libm=yes],
          [gl_cv_func_expm1l_in_libm=no])
        LIBS="$save_LIBS"
      ])
    if test $gl_cv_func_expm1l_in_libm = yes; then
      EXPM1L_LIBM=-lm
    fi
  fi
  if test $gl_cv_func_expm1l_no_libm = yes \
     || test $gl_cv_func_expm1l_in_libm = yes; then
    HAVE_EXPM1L=1
    dnl Also check whether it's declared.
    dnl IRIX 6.5 has expm1l() in libm but doesn't declare it in <math.h>.
    AC_CHECK_DECL([expm1l], , [HAVE_DECL_EXPM1L=0], [[#include <math.h>]])
  else
    HAVE_EXPM1L=0
    HAVE_DECL_EXPM1L=0
    dnl Find libraries needed to link lib/expm1l.c.
    if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
      AC_REQUIRE([gl_FUNC_EXPM1])
      EXPM1L_LIBM="$EXPM1_LIBM"
    else
      AC_REQUIRE([gl_FUNC_ISNANL])
      AC_REQUIRE([gl_FUNC_EXPL])
      AC_REQUIRE([gl_FUNC_ROUNDL])
      AC_REQUIRE([gl_FUNC_LDEXPL])
      EXPM1L_LIBM=
      dnl Append $ISNANL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
      case " $EXPM1L_LIBM " in
        *" $ISNANL_LIBM "*) ;;
        *) EXPM1L_LIBM="$EXPM1L_LIBM $ISNANL_LIBM" ;;
      esac
      dnl Append $EXPL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
      case " $EXPM1L_LIBM " in
        *" $EXPL_LIBM "*) ;;
        *) EXPM1L_LIBM="$EXPM1L_LIBM $EXPL_LIBM" ;;
      esac
      dnl Append $ROUNDL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
      case " $EXPM1L_LIBM " in
        *" $ROUNDL_LIBM "*) ;;
        *) EXPM1L_LIBM="$EXPM1L_LIBM $ROUNDL_LIBM" ;;
      esac
      dnl Append $LDEXPL_LIBM to EXPM1L_LIBM, avoiding gratuitous duplicates.
      case " $EXPM1L_LIBM " in
        *" $LDEXPL_LIBM "*) ;;
        *) EXPM1L_LIBM="$EXPM1L_LIBM $LDEXPL_LIBM" ;;
      esac
    fi
  fi
  AC_SUBST([EXPM1L_LIBM])
])