From e9786ddcfcdeae8e6230f9c4b8f51445a3ff1d9c Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Wed, 9 Aug 2017 21:08:08 +0300 Subject: Improve checking for MPFR in API at dl_load time. --- gawkapi.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'gawkapi.h') diff --git a/gawkapi.h b/gawkapi.h index d87ddb76..1c6c74ec 100644 --- a/gawkapi.h +++ b/gawkapi.h @@ -1114,6 +1114,8 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id) \ api->major_version, api->minor_version); \ exit(1); \ } \ +\ + check_mpfr_version(extension); \ \ /* load functions */ \ for (i = 0, j = sizeof(func_table) / sizeof(func_table[0]); i < j; i++) { \ @@ -1139,11 +1141,8 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id) \ return (errors == 0); \ } -/* - * If you are using extended-precision calculations in your library, please - * call this macro from your init_func. - */ -#define check_mpfr_version(extension) { \ +#if defined __GNU_MP_VERSION && defined MPFR_VERSION_MAJOR +#define check_mpfr_version(extension) do { \ if (api->gmp_major_version != __GNU_MP_VERSION \ || api->gmp_minor_version < __GNU_MP_VERSION_MINOR) { \ fprintf(stderr, #extension ": GMP version mismatch with gawk!\n"); \ @@ -1160,7 +1159,10 @@ int dl_load(const gawk_api_t *const api_p, awk_ext_id_t id) \ api->mpfr_major_version, api->mpfr_minor_version); \ exit(1); \ } \ -} +} while (0) +#else +#define check_mpfr_version(extension) /* nothing */ +#endif #endif /* GAWK */ -- cgit v1.2.1