I had the misfortune to try cvs libtool on hppa2.0-hp-hpux10.20 with a version of the unbundled cc that prints the following warning when +O3 is used with +Z,
cc: warning 8006: Do not use optimization levels higher than 2 to generate a shared library if a user of that library may redefine a routine within that library (8006) Alas that warning makes AC_LIBTOOL_COMPILER_OPTION decide +Z is no good. If AC_LIBTOOL_COMPILER_OPTION just wants to know if the option is accepted, then perhaps it could grep for it in the output, on the assumption "Unknown option: -foo" or similar would result from a bad one. That would avoid being tricked by informational messages, or even perhaps by compiler advertising banners. By way of a concrete suggestion, * libtool.m4 (AC_LIBTOOL_COMPILER_OPTION): Look for the name of the option in the output before rejecting it.
--- libtool.m4.old Mon Oct 8 10:27:14 2001 +++ libtool.m4 Mon Oct 8 10:30:11 2001 @@ -513,13 +513,14 @@ echo "$lt_simple_compile_test_code" > conftest.$ac_ext if (eval $ac_compile 2>conftest.err) && test -s $ac_outfile; then # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi + # So say no if there are warnings mentioning the option + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $2=yes + for lt_i in $3; do + if grep -- $lt_i conftest.err >/dev/null; then + $2=no + fi + done fi $rm conftest* CFLAGS="$save_CFLAGS"