> If --enable-multilib or --disable-multilib are passed then things > are performed as today, more or less. If these flags are not > explicitly given then gcc has to do something different
This sounds reasonable. We could have a specific check, with the following cumulative conditions (to make it as unobtrusive as possible for current users). If: 1. we build a native compiler 2. on x86_64-linux (and possible other x86_64 targets whose maintainers want to opt in) 3. and neither --enable-multilib nor --disable-multilib were passed then: a. we check that the native compiler can handle 32-bit, by compiling a test executable with the "-m32" option b. if we fail, we error out of the configure process, indicating that this can be overriden with --{enable,disable}-multilib I suspect this might catch (at configure time) the large majority of users who currently get stuck at stage 2 with the "gnu/stubs-32.h" error, while being invisible to a large majority of the power users. Question: what are the pitfalls of the test proposed above? are there typical use cases that I have not thought of, and that would trigger this check? FX PS: I attach a tentative patch implementing such as check in configure.ac.
Index: configure.ac =================================================================== --- configure.ac (revision 201292) +++ configure.ac (working copy) @@ -2861,6 +2861,26 @@ case "${target}" in ;; esac +# Special user-friendly check for native x86_64-linux build, if +# multilib is not explicitly enabled. +case "$target:$have_compiler:$host:$target:$enable_multilib" in + x86_64-*linux*:yes:$build:$build:) + # Make sure we have a developement environment that handles 32-bit + dev64=no + echo "int main () { return 0; }" > conftest.c + ${CC} -m32 -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c + if test $? = 0 ; then + if test -s conftest || test -s conftest.exe ; then + dev64=yes + fi + fi + rm -f conftest* + if test x${dev64} != xyes ; then + AC_MSG_ERROR([I suspect your system does not have 32-bit developement libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.]) + fi + ;; +esac + # Default to --enable-multilib. if test x${enable_multilib} = x ; then target_configargs="--enable-multilib ${target_configargs}"