On 3/02/20 6:41 pm, Jeffrey Walton wrote:
On Mon, Feb 3, 2020 at 12:26 AM Niels Möller wrote:
Jeffrey Walton writes:
On Sun, Feb 2, 2020 at 11:48 PM Niels Möller wrote:
I don't have any time to spend on testing with these systems or compilers. Do you think it makes sense to change from -G to -shared unconditionally for Solaris? It makes no sense to try to do something more clever based on compiler used, without any contributor able to test it.
Since I have no recent experience with Solaris, nor time to gain any experience, I'd like to hear your opinion on the above question, before I commit any change.
Fair enough. I think your best option is to do nothing at the moment. The problem is documented, so searchers should find the fix.
And I can work around it in my scripts with the following:
IS_SUNC=$("$CC" -V 2>&1 | grep -i -c -E 'sun|studio') IS_SOLARIS=$(uname -s | grep -i -c 'sunos') ... if [[ "$IS_SOLARIS" -ne 0 && "$IS_SUNC" -eq 0 ]]; then sed 's/ -G / -shared /g' configure > configure.fixed mv configure.fixed configure; chmod +x configure fi
I _think_ the best (but unavailable) option is an Autoconf test. But Autoconf does not let you compile and link two files (one for a shared object, and one for a test driver). So it is not an option at this moment. Maybe someone can file another bug report :)
To build a .c file with different flags include it into the autoconf test as you would an extra .h file:
SAVED_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -shared" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include "src/foo.c"]],[[]])], [ AC_MSG_RESULT(yes) ], [ CFLAGS="$SAVED_CFLAGS"; AC_MSG_RESULT(no) ])
Amos