2 dnl Copyright (C) 2010 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.
8 # tests whether the sqrt function is available in libc or libm. It sets
9 # SQRT_LIBM to empty or "-lm" accordingly.
11 AC_DEFUN([gl_MATHFUNC],
13 m4_pushdef([func], [$1])
14 m4_pushdef([FUNC], [translit([$1],[abcdefghijklmnopqrstuvwxyz],
15 [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
17 AC_CACHE_CHECK([whether func() can be used without linking with libm],
18 [gl_cv_func_]func[_no_libm],
21 [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
22 # define __NO_MATH_INLINES 1 /* for glibc */
26 [[return ]func[ (x) > 2 || ]func[ (x) < 0.4;]])],
27 [gl_cv_func_]func[_no_libm=yes],
28 [gl_cv_func_]func[_no_libm=no])
30 if test $gl_cv_func_[]func[]_no_libm = no; then
31 AC_CACHE_CHECK([whether func() can be used with libm],
32 [gl_cv_func_]func[_in_libm],
37 [AC_LANG_PROGRAM([[#ifndef __NO_MATH_INLINES
38 # define __NO_MATH_INLINES 1 /* for glibc */
42 [[return ]func[ (x) > 2 || ]func[ (x) < 0.4;]])],
43 [gl_cv_func_]func[_in_libm=yes],
44 [gl_cv_func_]func[_in_libm=no])
47 if test $gl_cv_func_[]func[]_in_libm = yes; then