mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 11:26:16 +01:00
build: Improve tests for frexpl() and ldexpl()
The test programs for those in the Meson build files will not work for Visual Studio prior to 2013 (whereas the rest of the code does). Improve the tests for these by: -Adding a test to see whether we can re-define a prototype for these functions, using cc.compiles(). If so, set HAVE_DECL_xxxx to be 0, otherwise set HAVE_DECL_xxxx to be 1. Also, for glib/gnulib/frexpl.c, don't undefine frexpl on Visual Studio, otherwise we will not be able to compile/link it on Visual Studio compilers.
This commit is contained in:
parent
2ed56ccc0c
commit
a1fbeb3e4f
@ -14,6 +14,8 @@ long double rpl_frexpl (long double x, int *expptr)
|
||||
return x;
|
||||
else if (isinf (x))
|
||||
return x;
|
||||
#ifndef _MSC_VER
|
||||
#undef frexpl
|
||||
#endif
|
||||
return frexpl (x, expptr);
|
||||
}
|
||||
|
@ -29,7 +29,11 @@ extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
|
||||
#if !defined (_MSC_VER) || defined (TEST_FREXPL_DECL)
|
||||
long double frexpl (long double, int *);
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
int result = 0;
|
||||
@ -128,3 +132,11 @@ else
|
||||
gl_cv_func_frexpl_broken_beyond_repair = false
|
||||
endif
|
||||
endif
|
||||
|
||||
frexpl_test_decl = '''
|
||||
#define TEST_FREXPL_DECL 1
|
||||
''' + frexpl_test
|
||||
|
||||
build_result = cc.compiles(frexpl_test_decl,
|
||||
name : 'frexpl prototype can be re-listed')
|
||||
gl_cv_func_frexpl_decl = build_result
|
||||
|
@ -9,7 +9,11 @@ extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
|
||||
#if !defined (_MSC_VER) || defined (TEST_LDEXPL_DECL)
|
||||
long double ldexpl (long double, int);
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
int result = 0;
|
||||
@ -43,3 +47,11 @@ else
|
||||
gl_cv_func_ldexpl_works = true
|
||||
endif
|
||||
endif
|
||||
|
||||
ldexpl_test_decl = '''
|
||||
#define TEST_LDEXPL_DECL 1
|
||||
''' + ldexpl_test
|
||||
|
||||
build_result = cc.compiles(ldexpl_test_decl,
|
||||
name : 'ldexpl prototype can be re-listed')
|
||||
gl_cv_func_ldexpl_decl = build_result
|
||||
|
@ -282,6 +282,7 @@ endif
|
||||
|
||||
math_h_config.set ('REPLACE_FREXP', gl_cv_func_frexp_works ? 0 : 1)
|
||||
math_h_config.set ('REPLACE_FREXPL', gl_cv_func_frexpl_works ? 0 : 1)
|
||||
math_h_config.set ('HAVE_DECL_FREXPL', gl_cv_func_frexpl_decl ? 0 : 1)
|
||||
|
||||
math_h_config.set ('REPLACE_ITOLD', 0)
|
||||
math_h_config.set ('REPLACE_HUGE_VAL', 0)
|
||||
@ -293,6 +294,7 @@ else
|
||||
gl_cv_func_ldexpl_works = false
|
||||
endif
|
||||
math_h_config.set ('REPLACE_LDEXPL', gl_cv_func_ldexpl_works ? 0 : 1)
|
||||
math_h_config.set ('HAVE_DECL_LDEXPL', gl_cv_func_ldexpl_decl ? 0 : 1)
|
||||
|
||||
math_h = configure_file (input: 'gnulib_math.h.in',
|
||||
output: 'gnulib_math.h',
|
||||
|
Loading…
Reference in New Issue
Block a user