From fec57b3fba12979b5e2fbc5cacf53d8e2918260d Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Mon, 17 Nov 2003 11:19:07 +0000 Subject: [PATCH] * ltmain.in: In compile mode, delay parsing of -shared, -static, -prefer-pic and -prefer-non-pic until after tagged configuration has been read. In link mode, read tagged configuration before parsing any arguments. These arguments will now work when using a non-C compiler. --- ChangeLog | 8 ++++ ltmain.in | 138 +++++++++++++++++++++++++++++------------------------- 2 files changed, 82 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce3286d7b..a12622018 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-11-15 Scott James Remnant + + * ltmain.in: In compile mode, delay parsing of -shared, -static, + -prefer-pic and -prefer-non-pic until after tagged configuration + has been read. In link mode, read tagged configuration before + parsing any arguments. These arguments will now work when using + a non-C compiler. + 2003-11-14 Gary V. Vaughan * NEWS: Mention AC_LIBTOOL_TAGS. diff --git a/ltmain.in b/ltmain.in index 3bce91ef4..0ee019571 100644 --- a/ltmain.in +++ b/ltmain.in @@ -365,6 +365,7 @@ exec_cmd= suppress_output= arg_mode=normal libobj= + later= for arg do @@ -393,29 +394,8 @@ exec_cmd= continue ;; - -shared) - if test "$build_libtool_libs" != yes; then - $echo "$modename: can not build a shared library" 1>&2 - $echo "Fatal configuration error." 1>&2 - exit 1 - fi - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no + -shared | -static | -prefer-pic | -prefer-non-pic) + later="$later $arg" continue ;; @@ -565,6 +545,36 @@ exec_cmd= esac fi + for arg in $later; do + case $arg in + -shared) + if test "$build_libtool_libs" != yes; then + $echo "$modename: can not build a shared library" 1>&2 + $echo "Fatal configuration error." 1>&2 + exit 1 + fi + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` if test "X$xdir" = "X$obj"; then @@ -891,6 +901,47 @@ EOF vinfo= vinfo_number=no + # Infer tagged configuration to use if any are available and + # if one wasn't chosen via the "--tag" command line option. + # Only attempt this if the compiler in the base link + # command doesn't match the default compiler. + if test -n "$available_tags" && test -z "$tagname"; then + case "$base_compile " in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" + case "$base_compile " in + "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) + # The compiler in $compile_command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + $echo "$modename: unable to infer tagged configuration" + $echo "$modename: specify a tag with \`--tag'" 1>&2 + exit 1 +# else +# $echo "$modename: using $tagname tagged configuration" + fi + ;; + esac + fi + # We need to know -static, to get the right output filenames. for arg do @@ -1667,47 +1718,6 @@ EOF exit 1 fi - # Infer tagged configuration to use if any are available and - # if one wasn't chosen via the "--tag" command line option. - # Only attempt this if the compiler in the base link - # command doesn't match the default compiler. - if test -n "$available_tags" && test -z "$tagname"; then - case $base_compile in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`" - case $base_compile in - "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) - # The compiler in $compile_command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - $echo "$modename: unable to infer tagged configuration" - $echo "$modename: specify a tag with \`--tag'" 1>&2 - exit 1 -# else -# $echo "$modename: using $tagname tagged configuration" - fi - ;; - esac - fi - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" compile_command="$compile_command $arg" -- 2.47.2