annotate m4/floorl.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16392
7e35e3b2a920 floorl: Provide function definition on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
1 # floorl.m4 serial 11
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16392
diff changeset
2 dnl Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
9293
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 AC_DEFUN([gl_FUNC_FLOORL],
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 [
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
15924
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
10 AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
11
9293
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 dnl Persuade glibc <math.h> to declare floorl().
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15924
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
14
9293
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 dnl Test whether floorl() is declared.
15618
9d4b273deacd Properly quote AC_CHECK_DECLS' 4th argument.
Bruno Haible <bruno@clisp.org>
parents: 15003
diff changeset
16 AC_CHECK_DECLS([floorl], , , [[#include <math.h>]])
9293
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 if test "$ac_cv_have_decl_floorl" = yes; then
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 dnl Test whether floorl() can be used without libm.
9419
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
19 gl_FUNC_FLOORL_LIBS
9293
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 if test "$FLOORL_LIBM" = "?"; then
9420
9e0484f26251 Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 9419
diff changeset
21 dnl Sun C 5.0 on Solaris declares floorl() and has it in the system-wide
9e0484f26251 Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 9419
diff changeset
22 dnl libm.so, but not in the libm.so that the compiler uses.
9e0484f26251 Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 9419
diff changeset
23 REPLACE_FLOORL=1
9293
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 fi
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 else
13142
6b79b839590c math: Fix some C++ test errors on Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 13140
diff changeset
26 HAVE_DECL_FLOORL=0
9420
9e0484f26251 Fix link errors with Sun C 5.0 on Solaris 10.
Bruno Haible <bruno@clisp.org>
parents: 9419
diff changeset
27 fi
13142
6b79b839590c math: Fix some C++ test errors on Cygwin.
Bruno Haible <bruno@clisp.org>
parents: 13140
diff changeset
28 if test $HAVE_DECL_FLOORL = 0 || test $REPLACE_FLOORL = 1; then
15924
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
29 dnl Find libraries needed to link lib/floorl.c.
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
30 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
31 AC_REQUIRE([gl_FUNC_FLOOR])
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
32 FLOORL_LIBM="$FLOOR_LIBM"
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
33 else
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
34 FLOORL_LIBM=
dfbcd662bdd1 floorl: Simplify for platforms where 'long double' == 'double'.
Bruno Haible <bruno@clisp.org>
parents: 15618
diff changeset
35 fi
9293
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 fi
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 AC_SUBST([FLOORL_LIBM])
b4e0b96fc4ba New module 'floorl'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 ])
9419
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
39
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
40 # Determines the libraries needed to get the floorl() function.
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
41 # Sets FLOORL_LIBM.
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
42 AC_DEFUN([gl_FUNC_FLOORL_LIBS],
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
43 [
11229
6dad92faecd1 Avoid spurious "(cached)" in configure output.
Bruno Haible <bruno@clisp.org>
parents: 9425
diff changeset
44 gl_CACHE_VAL_SILENT([gl_cv_func_floorl_libm], [
9425
b60ac48de79f Rename the cache variable to contain the special marker '_cv_'.
Bruno Haible <bruno@clisp.org>
parents: 9420
diff changeset
45 gl_cv_func_floorl_libm=?
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
46 AC_LINK_IFELSE(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
47 [AC_LANG_PROGRAM(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
48 [[#ifndef __NO_MATH_INLINES
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
49 # define __NO_MATH_INLINES 1 /* for glibc */
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
50 #endif
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
51 #include <math.h>
16392
7e35e3b2a920 floorl: Provide function definition on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
52 long double (*funcptr) (long double) = floorl;
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
53 long double x;]],
16392
7e35e3b2a920 floorl: Provide function definition on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
54 [[x = funcptr (x) + floorl(x);]])],
9425
b60ac48de79f Rename the cache variable to contain the special marker '_cv_'.
Bruno Haible <bruno@clisp.org>
parents: 9420
diff changeset
55 [gl_cv_func_floorl_libm=])
b60ac48de79f Rename the cache variable to contain the special marker '_cv_'.
Bruno Haible <bruno@clisp.org>
parents: 9420
diff changeset
56 if test "$gl_cv_func_floorl_libm" = "?"; then
9419
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
57 save_LIBS="$LIBS"
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
58 LIBS="$LIBS -lm"
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
59 AC_LINK_IFELSE(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
60 [AC_LANG_PROGRAM(
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
61 [[#ifndef __NO_MATH_INLINES
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
62 # define __NO_MATH_INLINES 1 /* for glibc */
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
63 #endif
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
64 #include <math.h>
16392
7e35e3b2a920 floorl: Provide function definition on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
65 long double (*funcptr) (long double) = floorl;
13578
1e26f884665f Modernize AC_TRY_LINK invocations.
Bruno Haible <bruno@clisp.org>
parents: 13142
diff changeset
66 long double x;]],
16392
7e35e3b2a920 floorl: Provide function definition on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 16201
diff changeset
67 [[x = funcptr (x) + floorl(x);]])],
9425
b60ac48de79f Rename the cache variable to contain the special marker '_cv_'.
Bruno Haible <bruno@clisp.org>
parents: 9420
diff changeset
68 [gl_cv_func_floorl_libm="-lm"])
9419
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
69 LIBS="$save_LIBS"
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
70 fi
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
71 ])
9425
b60ac48de79f Rename the cache variable to contain the special marker '_cv_'.
Bruno Haible <bruno@clisp.org>
parents: 9420
diff changeset
72 FLOORL_LIBM="$gl_cv_func_floorl_libm"
9419
8c764a2deb81 Put the test whether the floor or ceil variant needs libm into a separate macro.
Bruno Haible <bruno@clisp.org>
parents: 9293
diff changeset
73 ])