dnl
-dnl This file contains stuff.
+dnl This file contains macros for testing linkage.
dnl
dnl
#endif
],
[ $1(0);],
- [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
+ [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
AC_LANG_RESTORE
])
fi
AC_MSG_RESULT($glibcxx_cv_func_$1_use)
])
+
+dnl
+dnl Define autoheader template for using the underscore functions
+dnl For each parameter, create a macro where if func doesn't exist,
+dnl but _func does, then it will "#define func _func".
+dnl
+dnl GLIBCXX_MAYBE_UNDERSCORED_FUNCS
+AC_DEFUN([GLIBCXX_MAYBE_UNDERSCORED_FUNCS],
+[AC_FOREACH([glibcxx_ufunc], [$1],
+ [AH_VERBATIM(_[]glibcxx_ufunc,
+[#if defined (]AS_TR_CPP(HAVE__[]glibcxx_ufunc)[) && ! defined (]AS_TR_CPP(HAVE_[]glibcxx_ufunc)[)
+# define ]AS_TR_CPP(HAVE_[]glibcxx_ufunc)[ 1
+# define ]glibcxx_ufunc[ _]glibcxx_ufunc[
+#endif])])
+])
+
+
dnl
dnl Check to see if the (math function) argument passed is
dnl 1) declared when using the c++ compiler
AC_CHECK_FUNCS(_$1)
fi
fi
+ GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
])
dnl HAVE_XYZ is defined for each of the functions, or for none of them.
dnl Doing it this way saves significant configure time.
AC_DEFUN([GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1], [
+ define([funclist],patsubst($3,\(\w+\)\(\W*\),\1 ))dnl
AC_MSG_CHECKING([for $1 functions])
AC_CACHE_VAL(glibcxx_cv_func_$2_use, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <math.h>],
- [ `for x in $3; do echo "$x (0);"; done` ],
+ patsubst(funclist,[\w+],[\& (0);]),
[glibcxx_cv_func_$2_use=yes],
[glibcxx_cv_func_$2_use=no])
AC_LANG_RESTORE])
AC_MSG_RESULT($glibcxx_cv_func_$2_use)
if test x$glibcxx_cv_func_$2_use = x"yes"; then
- AC_CHECK_FUNCS($3)
+ AC_CHECK_FUNCS(funclist)
+ else
+ AC_MSG_CHECKING([for _$1 functions])
+ AC_CACHE_VAL(glibcxx_cv_func__$2_use, [
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ AC_TRY_COMPILE([#include <math.h>],
+ patsubst(funclist,[\w+],[_\& (0);]),
+ [glibcxx_cv_func__$2_use=yes],
+ [glibcxx_cv_func__$2_use=no])
+ AC_LANG_RESTORE])
+ AC_MSG_RESULT($glibcxx_cv_func__$2_use)
+ if test x$glibcxx_cv_func__$2_use = x"yes"; then
+ AC_CHECK_FUNCS(patsubst(funclist,[\w+],[_\&]))
+ fi
fi
+ GLIBCXX_MAYBE_UNDERSCORED_FUNCS(funclist)
+ undefine([funclist])
])
dnl
AC_CHECK_FUNCS(_$1)
fi
fi
+ GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
])
AC_CHECK_FUNCS(_$1)
fi
fi
+ GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
])
dnl
dnl argument 1 is name of function to check
dnl
-dnl ASSUMES argument is a math function with TWO parameters
+dnl ASSUMES argument is a stdlib function with TWO parameters
dnl
dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2
AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2], [
if test x$glibcxx_cv_func_$1_use = x"yes"; then
AC_CHECK_FUNCS($1)
fi
+ GLIBCXX_MAYBE_UNDERSCORED_FUNCS($1)
])
dnl
dnl argument 1 is name of function to check
dnl
-dnl ASSUMES argument is a function with THREE parameters
+dnl ASSUMES argument is a stdlib function with THREE parameters
dnl
dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3
AC_DEFUN([GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3], [
])
fi
AC_MSG_RESULT($glibcxx_cv_func_$1_link)
+ define([NAME], [translit([$1],[abcdefghijklmnopqrstuvwxyz],
+ [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])
if test x$glibcxx_cv_func_$1_link = x"yes"; then
- ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- AC_DEFINE_UNQUOTED(${ac_tr_func})
+ AC_DEFINE([HAVE_]NAME, 1, [Define if the compiler/host combination has $1.])
fi
+ undefine([NAME])
fi
])
GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
-
- dnl There is, without a doubt, a more elegant way to have these
- dnl names exported so that they won't be stripped out of acconfig.h by
- dnl autoheader. I leave this as an exercise to somebody less frustrated
- dnl than I.... please email the libstdc++ list if you can figure out a
- dnl more elegant approach (see autoconf/acgen.m4 and specifically
- dnl AC_CHECK_FUNC for things to steal.)
- dummyvar=no
- if test x$dummyvar = x"yes"; then
- AC_DEFINE(HAVE___BUILTIN_ABS)
- AC_DEFINE(HAVE___BUILTIN_LABS)
- AC_DEFINE(HAVE___BUILTIN_COS)
- AC_DEFINE(HAVE___BUILTIN_COSF)
- AC_DEFINE(HAVE___BUILTIN_COSL)
- AC_DEFINE(HAVE___BUILTIN_FABS)
- AC_DEFINE(HAVE___BUILTIN_FABSF)
- AC_DEFINE(HAVE___BUILTIN_FABSL)
- AC_DEFINE(HAVE___BUILTIN_SIN)
- AC_DEFINE(HAVE___BUILTIN_SINF)
- AC_DEFINE(HAVE___BUILTIN_SINL)
- AC_DEFINE(HAVE___BUILTIN_SQRT)
- AC_DEFINE(HAVE___BUILTIN_SQRTF)
- AC_DEFINE(HAVE___BUILTIN_SQRTL)
- fi
])
dnl
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
+ GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(modf)
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
- dnl Some runtimes have these functions with a preceding underscore. Please
- dnl keep this sync'd with the one above. And if you add any new symbol,
- dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
- dnl Check to see if certain C math functions exist.
-
- dnl Check to see if basic C math functions have float versions.
- GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
- _float_trig,
- _acosf _asinf _atanf \
- _cosf _sinf _tanf \
- _coshf _sinhf _tanhf)
- GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
- _float_round,
- _ceilf _floorf)
-
- dnl Check to see if basic C math functions have long double versions.
- GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
- _long_double_trig,
- _acosl _asinl _atanl \
- _cosl _sinl _tanl \
- _coshl _sinhl _tanhl)
- GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
- _long_double_round,
- _ceill _floorl)
-
LIBS="$ac_save_LIBS"
CXXFLAGS="$ac_save_CXXFLAGS"
])
AC_REPLACE_MATHFUNCS(copysignf)
dnl For __signbit to signbit conversions.
+ dnl Not sure why this is done, as these will be macros mostly.
+ dnl Should probably coordinate this with std_cmath.h.
AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"])
+
AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"])
dnl Compile the long double complex functions only if the function
AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"])
fi
- # XXX Review this. Nothing uses it.
+ # Used in libmath/Makefile.am.
if test -n "$LIBMATHOBJS"; then
need_libmath=yes
fi
dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
AC_DEFUN([AC_REPLACE_MATHFUNCS],
[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])])
-
-dnl vim:et:ts=2