1 # check-math-lib.m4 serial 4
2 dnl Copyright (C) 2007, 2009-2017 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 dnl gl_CHECK_MATH_LIB (VARIABLE, EXPRESSION [, EXTRA-CODE])
9 dnl Sets the shell VARIABLE according to the libraries needed by EXPRESSION
10 dnl to compile and link: to the empty string if no extra libraries are needed,
11 dnl to "-lm" if -lm is needed, or to "missing" if it does not compile and
14 dnl Example: gl_CHECK_MATH_LIB([ROUNDF_LIBM], [x = roundf (x);])
15 AC_DEFUN([gl_CHECK_MATH_LIB], [
18 for libm in "" "-lm"; do
19 LIBS="$save_LIBS $libm"
20 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
21 #ifndef __NO_MATH_INLINES
22 # define __NO_MATH_INLINES 1 /* for glibc */