Mercurial > hg > octave-nkf
comparison configure.ac @ 15852:cd115ec92248
build: Check that system has math defines such as M_PI.
* configure.ac: Check for math defines such as M_PI. Fail to build
if no defines can be found.
* liboctave/numeric/lo-specfun.cc: Use M_PI from math.h now that
build system has verified that it is present.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 26 Dec 2012 12:56:38 -0800 |
parents | ffd1a99733bd |
children | 98f6abe01b5a |
comparison
equal
deleted
inserted
replaced
15851:4bfe605f5ecf | 15852:cd115ec92248 |
---|---|
2010 | 2010 |
2011 dnl Use multiple AC_CHECKs to avoid line continuations '\' in list | 2011 dnl Use multiple AC_CHECKs to avoid line continuations '\' in list |
2012 AC_CHECK_FUNCS([acosh acoshf asinh asinhf atanh atanhf cbrt cbrtf]) | 2012 AC_CHECK_FUNCS([acosh acoshf asinh asinhf atanh atanhf cbrt cbrtf]) |
2013 AC_CHECK_FUNCS([erf erff erfc erfcf exp2f hypotf _hypotf log2 log2f]) | 2013 AC_CHECK_FUNCS([erf erff erfc erfcf exp2f hypotf _hypotf log2 log2f]) |
2014 | 2014 |
2015 ## Check for math defines such as M_LN2 in math.h | |
2016 AC_CACHE_CHECK([for MATH DEFINES in math.h], | |
2017 [octave_cv_header_math_defines], | |
2018 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
2019 #include <math.h> | |
2020 ]], [[ | |
2021 double x = M_LN2;]])], | |
2022 octave_cv_header_math_defines=yes, | |
2023 octave_cv_header_math_defines=no) | |
2024 ]) | |
2025 | |
2026 if test $octave_cv_header_math_defines = no; then | |
2027 ## Check again and try defining _USE_MATH_DEFINES | |
2028 AC_CACHE_CHECK([whether _USE_MATH_DEFINES needs to be defined], | |
2029 [octave_cv_header__use_math_defines], | |
2030 [save_CPPFLAGS="$CPPFLAGS" | |
2031 CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES" | |
2032 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
2033 #include <math.h> | |
2034 ]], [[ | |
2035 double x = M_LN2;]])], | |
2036 octave_cv_header__use_math_defines=yes, | |
2037 octave_cv_header__use_math_defines=no) | |
2038 CPPFLAGS="$save_CPPFLAGS" | |
2039 ]) | |
2040 if test $octave_cv_header__use_math_defines = yes; then | |
2041 octave_cv_header_math_defines=yes | |
2042 AC_DEFINE(_USE_MATH_DEFINES, 1, | |
2043 [Define to 1 if _USE_MATH_DEFINES is required to get math constants like M_LN2.]) | |
2044 CPPFLAGS="$CPPFLAGS -D_USE_MATH_DEFINES" | |
2045 fi | |
2046 fi | |
2047 | |
2048 if test $octave_cv_header_math_defines = yes; then | |
2049 AC_DEFINE(HAVE_MATH_DEFINES, 1, | |
2050 [Define to 1 if defines such as M_PI are available in math.h]) | |
2051 else | |
2052 AC_MSG_ERROR([MATH DEFINES in math.h such as M_PI are required to build Octave]) | |
2053 fi | |
2054 | |
2015 ## Windows-specific tests for extra #defines | 2055 ## Windows-specific tests for extra #defines |
2016 case $canonical_host_type in | 2056 case $canonical_host_type in |
2017 *-*-msdosmsvc | *-*-mingw*) | 2057 *-*-msdosmsvc | *-*-mingw*) |
2018 AC_MSG_CHECKING([for required _WIN32_WINNT]) | 2058 AC_MSG_CHECKING([for required _WIN32_WINNT]) |
2019 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 2059 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ |
2024 ]], [])], | 2064 ]], [])], |
2025 [AC_MSG_RESULT([none])], | 2065 [AC_MSG_RESULT([none])], |
2026 [AC_DEFINE(_WIN32_WINNT, 0x0403, | 2066 [AC_DEFINE(_WIN32_WINNT, 0x0403, |
2027 [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.]) | 2067 [Define to 0x0403 to access InitializeCriticalSectionAndSpinCount.]) |
2028 AC_MSG_RESULT([0x0403])]) | 2068 AC_MSG_RESULT([0x0403])]) |
2029 AC_MSG_CHECKING([whether _USE_MATH_DEFINES needs to be defined]) | |
2030 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
2031 #include <math.h> | |
2032 ]], [[ | |
2033 int x = M_LN2;]])], | |
2034 [AC_MSG_RESULT([no])], | |
2035 [AC_DEFINE(_USE_MATH_DEFINES, 1, | |
2036 [Define to 1 if your system needs to define math constants like M_LN2.]) | |
2037 AC_MSG_RESULT([yes])]) | |
2038 ;; | 2069 ;; |
2039 esac | 2070 esac |
2040 | 2071 |
2041 ## Windows-specific use of functions | 2072 ## Windows-specific use of functions |
2042 case $canonical_host_type in | 2073 case $canonical_host_type in |