X-Git-Url: https://ncurses.scripts.mit.edu/?a=blobdiff_plain;f=aclocal.m4;h=72954be317dfd8af79b8199fd7a656b4cfcb8872;hb=3183ac61c6bf0a75ee65dc8cbebf54f7c143df46;hp=320cb18f7e6e0e3b4b8e6b0176701cc189ab370e;hpb=79b07cae47a6fa064aa4d2ea70fe930884751eb4;p=ncurses.git diff --git a/aclocal.m4 b/aclocal.m4 index 320cb18f..72954be3 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -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 - #include - #include + #include + #include + #include ], [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 + #include + #include + ], + [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 ---------------------------------------------------------------------------