* Makefile.in (INSTALL_PROGRAM_ARGS): New variable.
[external/binutils.git] / configure
index 36afd7d..d96874d 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,7 +3,8 @@
 ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
 
 # Configuration script
-# Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
+# Copyright (C) 1988, 90, 91, 92, 93, 94, 95, 96, 1997
+# Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -47,7 +48,7 @@ Makefile=Makefile
 Makefile_in=Makefile.in
 arguments=
 build_alias=
-cache_file=
+cache_file=config.cache
 cache_file_option=
 configdirs=
 exec_prefix=
@@ -573,9 +574,9 @@ esac
 case "${build_alias}" in
 "")
        if result=`${config_shell} ${configsub} ${host_alias}` ; then
-           build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-           build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-           build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+           build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+           build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+           build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
            build=${build_cpu}-${build_vendor}-${build_os}
            build_alias=${host_alias}
        fi
@@ -583,9 +584,9 @@ case "${build_alias}" in
 *)
        if result=`${config_shell} ${configsub} ${build_alias}` ; then
            buildopt="--build=${build_alias}"
-           build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-           build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-           build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+           build_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+           build_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+           build_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
            build=${build_cpu}-${build_vendor}-${build_os}
        else
            echo "Unrecognized build system name ${build_alias}." 1>&2
@@ -600,9 +601,9 @@ else
     echo "Unrecognized host system name ${host_alias}." 1>&2
     exit 1
 fi
-host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+host_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 host=${host_cpu}-${host_vendor}-${host_os}
 
 . ${tmpfile}.hst
@@ -613,9 +614,9 @@ else
     echo "Unrecognized target system name ${target_alias}." 1>&2
     exit 1
 fi
-target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
-target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
-target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
+target_cpu=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $result | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 target=${target_cpu}-${target_vendor}-${target_os}
 
 . ${tmpfile}.tgt
@@ -673,10 +674,8 @@ fi
 if [ -z "${CC}" -a -r Makefile ]; then
   sed -n -e ':loop
 /\\$/ N
-s/\\$/\\*hpuxsedbug*/
-/\\$/ b loop
-s/\\\*hpuxsedbug\*/\\/g
 s/\\\n//g
+t loop
 /^CC[  ]*=/ s/CC[      ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
   CC=`tail -1 Makefile.cc`
   rm -f Makefile.cc
@@ -685,10 +684,8 @@ fi
 if [ -z "${CXX}" -a -r Makefile ]; then
   sed -n -e ':loop
 /\\$/ N
-s/\\$/\\*hpuxsedbug*/
-/\\$/ b loop
-s/\\\*hpuxsedbug\*/\\/g
 s/\\\n//g
+t loop
 /^CXX[         ]*=/ s/CXX[     ]*=[    ]*\(.*\)/\1/p' < Makefile > Makefile.cc
   CXX=`tail -1 Makefile.cc`
   rm -f Makefile.cc
@@ -738,18 +735,17 @@ if [ "${build}" != "${host}" ]; then
 
   tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
   tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
-  tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET HOST_PREFIX"
+  tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET GCC_FOR_TARGET HOST_PREFIX"
   tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
   tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
+  tools="${tools} WINDRES WINDRES_FOR_TARGET"
 
   for var in ${tools}; do
     if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
       sed -n -e ':loop
 /\\$/ N
-s/\\$/\\*hpuxsedbug*/
-/\\$/ b loop
-s/\\\*hpuxsedbug\*/\\/g
 s/\\\n//g
+t loop
 /^'"${var}"'[  ]*=/ s/'"${var}"'[      ]*=[    ]*\(.*\)/\1/p' \
        < Makefile > Makefile.v
       t=`tail -1 Makefile.v`
@@ -765,12 +761,15 @@ s/\\\n//g
   AS=${AS-${host_alias}-as}
   AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
   CC=${CC-${host_alias}-gcc}
-  CXX=${CXX-${host_alias}-gcc}
+  CFLAGS=${CFLAGS-"-g -O2"}
+  CXX=${CXX-${host_alias}-c++}
+  CXXFLAGS=${CXXFLAGS-"-g -O2"}
   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
   CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
-  CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-gcc}
+  CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-c++}
   DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
   DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
+  GCC_FOR_TARGET=${GCC_FOR_TARGET-${CC_FOR_TARGET-${target_alias}-gcc}}
   HOST_PREFIX=${build_alias}-
   HOST_PREFIX_1=${build_alias}-
   LD=${LD-${host_alias}-ld}
@@ -780,6 +779,8 @@ s/\\\n//g
   NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
   RANLIB=${RANLIB-${host_alias}-ranlib}
   RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
+  WINDRES=${WINDRES-${host_alias}-windres}
+  WINDRES_FOR_TARGET=${WINDRES_FOR_TARGET-${target_alias}-windres}
 
   if [ -z "${BISON}" ]; then
     IFS="${IFS=        }"; save_ifs="$IFS"; IFS="${IFS}:"
@@ -827,6 +828,7 @@ s/\\\n//g
   export LD
   export NM
   export RANLIB
+  export WINDRES
 else
   # If CC is still not set, try to get gcc.
   if [ -z "${CC}" ]; then
@@ -834,7 +836,16 @@ else
     for dir in $PATH; do
       test -z "$dir" && dir=.
       if test -f $dir/gcc; then
-       CC="gcc -O2"
+       CC="gcc"
+       echo 'void f(){}' > conftest.c
+       if test -z "`${CC} -g -c conftest.c 2>&1`"; then
+         CFLAGS=${CFLAGS-"-g -O2"}
+         CXXFLAGS=${CFLAGS-"-g -O2"}
+       else
+         CFLAGS=${CFLAGS-"-O2"}
+         CXXFLAGS=${CFLAGS-"-O2"}
+       fi
+       rm -f conftest*
        break
       fi
     done
@@ -842,11 +853,15 @@ else
     CC=${CC-cc}
   fi
 
-  CXX=${CXX-"gcc"}
+  CXX=${CXX-"c++"}
+  CFLAGS=${CFLAGS-"-g"}
+  CXXFLAGS=${CXXFLAGS-"-g -O2"}
 fi
 
 export CC
 export CXX
+export CFLAGS
+export CXXFLAGS
 
 case "$host" in
        *go32*)
@@ -1108,35 +1123,45 @@ EOF
                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
                 rm -f ${subdir}/Makefile.tem
                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
-            fi
-            sed -e "s:^prefix[         ]*=.*$:prefix = ${prefix}:" \
-                    -e "s:^exec_prefix[        ]*=.*$:exec_prefix = ${exec_prefix}:" \
+           fi
+           sed     -e "s|^prefix[      ]*=.*$|prefix = ${prefix}|" \
+                    -e "s|^exec_prefix[        ]*=.*$|exec_prefix = ${exec_prefix}|" \
                    -e "/^CC[   ]*=/{
                        :loop1
                        /\\\\$/ N
-                       s/\\\\$/\\\\*hpuxsedbug*/
-                       /\\\\$/ b loop1
-                       s/\\\\\\*hpuxsedbug\\*/\\\\/g
                        s/\\\\\\n//g
+                       t loop1
                        s%^CC[  ]*=.*$%CC = ${CC}%
                        }" \
                    -e "/^CXX[  ]*=/{
                        :loop2
                        /\\\\$/ N
-                       s/\\\\$/\\\\*hpuxsedbug*/
-                       /\\\\$/ b loop2
-                       s/\\\\\\*hpuxsedbug\\*/\\\\/g
                        s/\\\\\\n//g
+                       t loop2
                        s%^CXX[         ]*=.*$%CXX = ${CXX}%
                        }" \
+                   -e "/^CFLAGS[       ]*=/{
+                       :loop3
+                       /\\\\$/ N
+                       s/\\\\\\n//g
+                       t loop3
+                       s%^CFLAGS[      ]*=.*$%CFLAGS = ${CFLAGS}%
+                       }" \
+                   -e "/^CXXFLAGS[     ]*=/{
+                       :loop4
+                       /\\\\$/ N
+                       s/\\\\\\n//g
+                       t loop4
+                       s%^CXXFLAGS[    ]*=.*$%CXXFLAGS = ${CXXFLAGS}%
+                       }" \
                    -e "s:^SHELL[        ]*=.*$:SHELL = ${config_shell}:" \
                    -e "s:^GDB_TK[       ]*=.*$:GDB_TK = ${GDB_TK}:" \
-                    -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
+                    -e "s|^srcdir[     ]*=.*$|srcdir = ${makesrcdir}|" \
                     -e "s/\f//" \
                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
-                    -e "s:^tooldir[    ]*=.*$:tooldir = ${tooldir}:" \
+                    -e "s|^tooldir[    ]*=.*$|tooldir = ${tooldir}|" \
                    -e "s:^DEFAULT_YACC[         ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
                    -e "s:^DEFAULT_LEX[  ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
                     ${subdir}/Makefile.tem >> ${Makefile}
@@ -1214,14 +1239,14 @@ ${progname}" ${arguments}  "
         if [ -r ${subdir}/config.back ] ; then
                 mv -f ${subdir}/config.back ${subdir}/config.status
         fi
-        ${moveifchange} ${subdir}/config.new ${subdir}/config.status
+       ${config_shell} ${moveifchange} ${subdir}/config.new ${subdir}/config.status
         ;;
 
     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
     esac
 done
 
-# If there are subdirectories, then recur. 
+# If there are subdirectories, then recur.
 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
         for configdir in ${configdirs} ; do
 
@@ -1251,6 +1276,10 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
                                 newsrcdir=${srcdir}/${configdir}
                                 srcdiroption="--srcdir=${newsrcdir}"
                                 ;;
+                        ?:*) # absolute path on win32
+                                newsrcdir=${srcdir}/${configdir}
+                                srcdiroption="--srcdir=${newsrcdir}"
+                                ;;
                         *) # otherwise relative
                                 newsrcdir=../${srcdir}/${configdir}
                                 srcdiroption="--srcdir=${newsrcdir}"
@@ -1264,6 +1293,9 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
                        /*) # absolute path
                                cache_file_option="--cache-file=${cache_file}"
                                ;;
+                       ?:*) # absolute path on win32
+                               cache_file_option="--cache-file=${cache_file}"
+                               ;;
                        *) # relative path
                                cache_file_option="--cache-file=../${cache_file}"
                                ;;
@@ -1275,6 +1307,7 @@ if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
                         elif [ -f ${newsrcdir}/configure.in ] ; then
                                 case "${progname}" in
                                 /*)     recprog=${progname} ;;
+                                ?:*)    recprog=${progname} ;;
                                 *)      recprog=../${progname} ;;
                                 esac
                        else