2 dnl Copyright (C) 2012 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 AC_DEFUN([gl_FUNC_HYPOTL],
9 AC_REQUIRE([gl_MATH_H_DEFAULTS])
10 AC_REQUIRE([gl_FUNC_HYPOT])
12 dnl Test whether hypotl() exists. Assume that hypotl(), if it exists, is
13 dnl defined in the same library as hypot().
15 LIBS="$LIBS $HYPOT_LIBM"
16 AC_CHECK_FUNCS([hypotl])
18 if test $ac_cv_func_hypotl = yes; then
19 HYPOTL_LIBM="$HYPOT_LIBM"
22 dnl Find libraries needed to link lib/hypotl.c.
23 if test $HAVE_SAME_LONG_DOUBLE_AS_DOUBLE = 1; then
24 HYPOTL_LIBM="$HYPOT_LIBM"
26 AC_REQUIRE([gl_FUNC_FABSL])
27 AC_REQUIRE([gl_FUNC_FREXPL])
28 AC_REQUIRE([gl_FUNC_LDEXPL])
29 AC_REQUIRE([gl_FUNC_SQRTL])
31 dnl Append $FABSL_LIBM to HYPOTL_LIBM, avoiding gratuitous duplicates.
32 case " $HYPOTL_LIBM " in
34 *) HYPOTL_LIBM="$HYPOTL_LIBM $FABSL_LIBM" ;;
36 dnl Append $FREXPL_LIBM to HYPOTL_LIBM, avoiding gratuitous duplicates.
37 case " $HYPOTL_LIBM " in
38 *" $FREXPL_LIBM "*) ;;
39 *) HYPOTL_LIBM="$HYPOTL_LIBM $FREXPL_LIBM" ;;
41 dnl Append $LDEXPL_LIBM to HYPOTL_LIBM, avoiding gratuitous duplicates.
42 case " $HYPOTL_LIBM " in
43 *" $LDEXPL_LIBM "*) ;;
44 *) HYPOTL_LIBM="$HYPOTL_LIBM $LDEXPL_LIBM" ;;
46 dnl Append $SQRTL_LIBM to HYPOTL_LIBM, avoiding gratuitous duplicates.
47 case " $HYPOTL_LIBM " in
49 *) HYPOTL_LIBM="$HYPOTL_LIBM $SQRTL_LIBM" ;;
53 AC_SUBST([HYPOTL_LIBM])