make 'ASMFLAGS' behavior similar to 'CFLAGS' and 'CXXFLAGS' variables

sav_ix at ukr.net sav_ix at ukr.net
Sun Jun 4 16:30:53 UTC 2017


Hello, everyone,

Currently, if 'CFLAGS' and 'CXXFLAGS' variables not defined by User, they're autodetected during GMP configuration and used for appropriate compiler 'gcc' and 'g++' respectively during build.
For some reason 'ASMFLAGS' variable don't autodetected at all; if defined by User, it doesn't used for assembler check during configuration, and used with 'CFLAGS' and 'CXXFLAGS' during build.

Even if don't take into account, that "the same things are done in different way", this makes binding of GMP to a particular assembler (GCC or GCC-like). As a consequence, 3rd party assembler (e.g. YASM, yasm.torall.net) can't be used for GMP build, since it receive GCC C and C++ compiler keys, instead of expected from 'ASMFLAGS' variable, and throw error.

This could be changed by setting 'ASMFLAGS' as the only variable, used with 'CCAS', and initializing 'ASMFLAGS' from 'CFLAGS', if it wasn't defined by User (patch added in attachment).
Tested build and check using mingw-w64 for <Debug|Release><Shared|Static> configurations with and without YASM as 3rd party assembler, and found no regressions (all tasks finished successfully). Didn't tested tune, as it's not available for this compiler; expected, that it should be built without errors too.

Don't know the reason, why 'CCAS' variable was used with 'CPPFLAGS' in addition to 'CFLAGS' (object files, built from 'mpn/*.asm' files, are linked only with 'gmp' C library, but not 'gmpxx' C++ library; in addition, 'CXXFLAGS' could contain C++ compiler specific keys, e.g. '-std=gnu++11', which would be passed to C compiler 'gcc'). Thus this patch initialize 'ASMFLAGS' from 'CFLAGS' variable only, but not 'CXXFLAGS'.

Environment: Windows 10 x64, mingw-w64 6.3.0 x86_64, MSYS2 20161025 x86_64,GMP-6.2.0-dev (changeset 17426:330407782736).
Alexander

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp_asmflags_fix.zip
Type: application/x-zip-compressed
Size: 1283 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20170604/3df6d32d/attachment.bin>


More information about the gmp-bugs mailing list