echo "$ac_t"none 1>&6
fi
+# Check to see if options -o and -c are simultaneously supported by compiler
+echo $ac_n "checking if $compiler supports -c and -o options... $ac_c" 1>&6
+$rm conftest*
+echo "int some_variable = 0;" > conftest.c
+save_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -c -o conftest.o"
+echo "$progname:@LINENO@: checking if $compiler supports -c and -o options" >&5
+if { (eval echo $progname:@LINENO@: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; 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
+ echo "$ac_t"no 1>&6
+ compiler_c_o=no
+ else
+ echo "$ac_t"yes 1>&6
+ compiler_c_o=yes
+ fi
+else
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ compiler_c_o=no
+ echo "$ac_t"no 1>&6
+fi
+CFLAGS="$save_CFLAGS"
+$rm conftest*
+
# Check for any special shared library compilation flags.
if test -n "$special_shlib_compile_flags"; then
echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2
old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \
allow_undefined_flag no_undefined_flag \
finish_cmds finish_eval global_symbol_pipe \
- hardcode_libdir_flag_spec hardcode_libdir_separator; do
+ hardcode_libdir_flag_spec hardcode_libdir_separator compiler_c_o; do
case "$var" in
reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
trap "$rm \"$ofile\"; exit 1" 1 2 15
echo "creating $ofile"
$rm "$ofile"
+ if test "$compiler_c_o" = no; then
+ $echo "**** Warning ! Your compiler doesn't support -c and -o options"
+ $echo "**** If you use a single makefile, with relative directories and"
+ $echo "**** use the -o option of libtool gcc, we strongly discourage"
+ $echo "**** to make parallel builds (make -j n) if there are source"
+ $echo "**** files with the same name in different subdirectories"
+ fi
cat <<EOF > "$ofile"
#! $SHELL
# Additional compiler flags for building library objects.
pic_flag=$pic_flag
+# Does compiler simultaneously support -c and -o options
+compiler_c_o=$compiler_c_o
+
# Compiler flag to prevent dynamic linking.
link_static_flag=$link_static_flag
srcfile="$nonopt"
suppress_output=
+ user_target=no
for arg
do
# Accept any command-line options.
case "$arg" in
-o)
- $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
- $echo "$help" 1>&2
- exit 1
+ if test "$user_target" != "no"; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit 1
+ fi
+ user_target=next
;;
-static)
;;
esac
+ case "$user_target" in
+ next)
+ # The next one is the -o target name
+ user_target=yes
+ continue
+ ;;
+ yes)
+ # We got the output file
+ user_target=set
+ libobj="$arg"
+ continue
+ ;;
+ esac
+
# Accept the current argument as the source file.
lastarg="$srcfile"
srcfile="$arg"
# sets, so we specify it separately.
case "$lastarg" in
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
- lastarg="\"$lastarg\""
- ;;
+ lastarg="\"$lastarg\""
+ ;;
esac
# Add the previous argument to base_compile.
if test -z "$base_compile"; then
- base_compile="$lastarg"
+ base_compile="$lastarg"
else
- base_compile="$base_compile $lastarg"
+ base_compile="$base_compile $lastarg"
fi
done
- # Get the name of the library object.
- libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ case "$user_target" in
+ set)
+ ;;
+ no)
+ # Get the name of the library object.
+ libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ ;;
+ *)
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit 1
+ ;;
+ esac
# Recognize several different file suffixes.
- xform='[cCFSfms]'
+ # If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSfmso]'
case "$libobj" in
*.ada) xform=ada ;;
*.adb) xform=adb ;;
case "$libobj" in
*.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
*)
- $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
exit 1
;;
esac
trap "$run $rm $libobj; exit 1" 1 2 15
fi
+ # Calculate the filename of the output object if compiler does
+ # not support -o with -c
+ if test "$compiler_c_o" = no; then
+ output_obj=`$echo "$Xsrcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.o
+ fi
+
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
# Without this assignment, base_compile gets emptied.
fbsd_hideous_sh_bug=$base_compile
# All platforms use -DPIC, to notify preprocessed assembler code.
- $show "$base_compile$pic_flag -DPIC $srcfile"
- if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
+ command="$base_compile$pic_flag -DPIC $srcfile"
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $libobj"
+ output_obj="$libobj"
+ fi
+
+ $show "$command"
+ if $run eval "$command"; then :
else
- test -n "$obj" && $run $rm $obj
+ test -n "$output_obj" && $run $rm $output_obj
exit 1
fi
+ # Just move the object if needed, then go on to compile the next one
+ if test "$compiler_c_o" = no; then
+ $show "$mv $output_obj $libobj"
+ $run $mv $output_obj $libobj || exit $?
+ fi
+
# If we have no pic_flag, then copy the object into place and finish.
if test -z "$pic_flag"; then
- $show "$LN_S $obj $libobj"
- $run $LN_S $obj $libobj
+ $show "$LN_S $libobj $obj"
+ $run $LN_S $libobj $obj
exit $?
fi
- # Just move the object, then go on to compile the next one
- $show "$mv $obj $libobj"
- $run $mv $obj $libobj || exit $?
-
# Allow error messages only from the first compilation.
suppress_output=' >/dev/null 2>&1'
fi
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
+ command="$base_compile $srcfile"
+ if test "$compiler_c_o" = yes; then
+ command="$command -o $obj"
+ output_obj="$obj"
+ fi
+
# Suppress compiler output if we already did a PIC compilation.
- $show "$base_compile $srcfile$suppress_output"
- if $run eval "$base_compile \$srcfile$suppress_output"; then :
+ command="$command$suppress_output"
+ $show "$command"
+ if $run eval "$command"; then :
else
- $run $rm $obj $libobj
+ $run $rm $output_obj $libobj
exit 1
fi
+
+ # Just move the object if needed
+ if test "$compiler_c_o" = no; then
+ $show "$mv $output_obj $obj"
+ $run $mv $output_obj $obj || exit $?
+ fi
fi
# Create an invalid libtool object if no PIC, so that we do not
fi
oldlibs=
+ # calculate the name of the file, without its directory
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+
case "$output" in
"")
$echo "$modename: you must specify an output file" 1>&2
exit 1
;;
- */* | *\\*)
- $echo "$modename: output file \`$output' must have no directory components" 1>&2
- $echo "$help" 1>&2
- exit 1
- ;;
-
*.a)
if test -n "$link_against_libtool_libs"; then
$echo "$modename: error: cannot link libtool libraries into archives" 1>&2
# Create the output directory, or remove our outputs if we need to.
if test -d $objdir; then
- $show "${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
- $run ${rm}r $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
+ $show "${rm}r $objdir/$outputname $objdir/$libname.* $objdir/${libname}${release}.*"
+ $run ${rm}r $objdir/$outputname $objdir/$libname.* $objdir/${libname}${release}.*
else
$show "$mkdir $objdir"
$run $mkdir $objdir
fi
# Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
- finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
+ compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$outputname"'%g'`
+ finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$outputname"'T%g'`
# Create the binary in the object directory, then wrap it.
if test ! -d $objdir; then
$echo > $output "\
#! $SHELL
-# $output - temporary wrapper script for $objdir/$output
+# $output - temporary wrapper script for $objdir/$outputname
# Generated by $PROGRAM - GNU $PACKAGE $VERSION
#
# The $output program cannot be directly executed until all the libtool
test -n \"\$absdir\" && thisdir=\"\$absdir\"
progdir=\"\$thisdir/$objdir\"
- program='$output'
+ program='$outputname'
if test -f \"\$progdir/\$program\"; then"