mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-08 14:54:13 +01:00
replaced all local definitions of PI by a single one
For code maintainability, it is better to have a single definition of the constant than many ones dispatched in many places. In addition, we try to count on the constant M_PI that can be defined by the header <math.h> if possible because it may have the best accuracy for the platform. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
723f217355
commit
4799df5506
@@ -30,5 +30,24 @@ AC_CHECK_FUNC(atan,
|
||||
[LIBM=-lm],
|
||||
[AC_MSG_WARN(Could not find Math library, you may experience problems)
|
||||
LIBM=] )] ) dnl
|
||||
AC_CACHE_CHECK([if M_PI is defined in math.h], [wm_cv_libm_pi],
|
||||
[wm_cv_libm_pi="no"
|
||||
wm_save_CFLAGS="$CFLAGS"
|
||||
for wm_arg in dnl
|
||||
"% yes" dnl natively available (Unix98 compliant?)
|
||||
"-D_XOPEN_SOURCE=500" ; dnl Explicit request
|
||||
do
|
||||
AS_IF([wm_fn_lib_try_compile "math.h" "double val;" "val = M_PI" dnl
|
||||
"`echo "$wm_arg" | sed -e 's, *%.*$,,' `"],
|
||||
[wm_cv_libm_pi="`echo "$wm_arg" | sed -e 's,^.*% *,,' `" ; break])
|
||||
done
|
||||
CFLAGS="$wm_save_CFLAGS"])
|
||||
AS_IF([test "x$wm_cv_libm_pi" = "xno"],
|
||||
[AC_DEFINE([WM_PI], [(3.14159265358979323846)],
|
||||
[Defines how to access the value of Pi])],
|
||||
[AC_DEFINE([WM_PI], [(M_PI)],
|
||||
[Defines how to access the value of Pi])
|
||||
AS_IF([test "x$wm_cv_libm_pi" != "xyes"],
|
||||
[CFLAGS="$CFLAGS $wm_cv_libm_pi"]) ])
|
||||
AC_SUBST(LIBM) dnl
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user