]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - aclocal.m4
ncurses 6.3 - patch 20220729
[ncurses.git] / aclocal.m4
index 320cb18f7e6e0e3b4b8e6b0176701cc189ab370e..72954be317dfd8af79b8199fd7a656b4cfcb8872 100644 (file)
@@ -29,7 +29,7 @@ dnl***************************************************************************
 dnl
 dnl Author: Thomas E. Dickey 1995-on
 dnl
-dnl $Id: aclocal.m4,v 1.1004 2022/02/05 17:48:07 tom Exp $
+dnl $Id: aclocal.m4,v 1.1007 2022/07/27 23:34:31 tom Exp $
 dnl Macros used in NCURSES auto-configuration script.
 dnl
 dnl These macros are maintained separately from NCURSES.  The copyright on
@@ -6094,7 +6094,7 @@ CF_UPPER(cf_map_lib_basename,$2)
 eval $1="\$${cf_map_lib_basename}_NAME"
 ])dnl
 dnl ---------------------------------------------------------------------------
-dnl CF_MATH_LIB version: 10 updated: 2020/12/31 18:40:20
+dnl CF_MATH_LIB version: 11 updated: 2022/07/27 19:01:48
 dnl -----------
 dnl Checks for libraries.  At least one UNIX system, Apple Macintosh
 dnl Rhapsody 5.5, does not have -lm.  We cannot use the simpler
@@ -6104,18 +6104,42 @@ AC_DEFUN([CF_MATH_LIB],
 AC_CACHE_CHECK(if -lm needed for math functions,
        cf_cv_need_libm,[
        AC_TRY_LINK([
-       #include <stdio.h>
-       #include <stdlib.h>
-       #include <math.h>
+               #include <stdio.h>
+               #include <stdlib.h>
+               #include <math.h>
        ],
        [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)],
        [cf_cv_need_libm=no],
        [cf_cv_need_libm=yes])])
+
 if test "$cf_cv_need_libm" = yes
 then
-ifelse($1,,[
-       CF_ADD_LIB(m)
-],[$1=-lm])
+
+       cf_save_LIBS="$LIBS"
+       LIBS="$LIBS -lm"
+       AC_CACHE_CHECK(if -lm is available for math functions,
+       cf_cv_have_libm,[
+       AC_TRY_LINK([
+               #include <stdio.h>
+               #include <stdlib.h>
+               #include <math.h>
+       ],
+       [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)],
+       [cf_cv_have_libm=yes],
+       [cf_cv_have_libm=no])])
+       LIBS="$cf_save_LIBS"
+
+       if test "$cf_cv_have_libm" = yes
+       then
+               ifelse($1,,[CF_ADD_LIB(m)],[$1=-lm])
+       fi
+else
+       cf_cv_have_libm=yes
+fi
+
+if test "$cf_cv_have_libm" = yes
+then
+       AC_DEFINE(HAVE_MATH_FUNCS,1,[Define to 1 if math functions are available])
 fi
 ])
 dnl ---------------------------------------------------------------------------