OSDN Git Service

Update.
[pf3gnuchains/gcc-fork.git] / configure
index d8b8087..f8e6866 100755 (executable)
--- a/configure
+++ b/configure
@@ -62,6 +62,7 @@ moveifchange=
 norecursion=
 other_options=
 package_makefile_frag=
+package_makefile_rules_frag=
 prefix=/usr/local
 progname=
 program_prefix=
@@ -81,7 +82,7 @@ subdirs=
 target_alias=NOTARGET
 target_makefile_frag=
 undefs=NOUNDEFS
-version="$Revision: 1.1.1.1 $"
+version="$Revision: 1.22 $"
 x11=default
 
 ### we might need to use some other shell than /bin/sh for running subshells
@@ -761,6 +762,25 @@ do
   test -n "$DEFAULT_YACC" && break
 done
 
+# Generate a default definition for M4.  This is used if the makefile can't
+# locate m4 in objdir.
+
+for prog in gm4 gnum4 m4
+do
+  set dummy $prog; tmp=$2
+  IFS="${IFS=   }"; save_ifs="$IFS"; IFS="${IFS}:"
+  for dir in $PATH; do
+    test -z "$dir" && dir=.
+    if test -f $dir/$tmp; then
+      DEFAULT_M4="$prog"
+      break
+    fi
+  done
+  IFS="$save_ifs"
+
+  test -n "$DEFAULT_M4" && break
+done
+
 # Generate a default definition for LEX.  This is used if the makefile can't
 # locate flex in objdir.
 
@@ -894,10 +914,10 @@ else
        echo 'void f(){}' > conftest.c
        if test -z "`${CC} -g -c conftest.c 2>&1`"; then
          CFLAGS=${CFLAGS-"-g -O2"}
-         CXXFLAGS=${CFLAGS-"-g -O2"}
+         CXXFLAGS=${CXXFLAGS-"-g -O2"}
        else
          CFLAGS=${CFLAGS-"-O2"}
-         CXXFLAGS=${CFLAGS-"-O2"}
+         CXXFLAGS=${CXXFLAGS-"-O2"}
        fi
        rm -f conftest*
        break
@@ -992,27 +1012,34 @@ for subdir in . ${subdirs} ; do
                 set ${links}; link=$1; shift; links=$*
 
                 if [ ! -r ${srcdir}/${file} ] ; then
+                  if [ ! -r ${file} ] ; then
+                   
                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
                         exit 1
+                 else
+                       srcfile=${file}
+                 fi
+               else
+                       srcfile=${srcdir}/${file}
                 fi
 
                 ${remove} -f ${link}
                # Make a symlink if possible, otherwise try a hard link
-               if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
+               if ${symbolic_link} ${srcfile} ${link} >/dev/null 2>&1 ; then
                        true
                else
                        # We need to re-remove the file because Lynx leaves a 
                        # very strange directory there when it fails an NFS symlink.
                        ${remove} -r -f ${link}
-                       ${hard_link} ${srcdir}/${file} ${link}
+                       ${hard_link} ${srcfile} ${link}
                fi
                 if [ ! -r ${link} ] ; then
-                        echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
+                        echo '***' "${progname}: unable to link \"${link}\" to \"${srcfile}\"." 1>&2
                         exit 1
                 fi
 
-                echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
+                echo "Linked \"${link}\" to \"${srcfile}\"."
         done
 
         # Create a .gdbinit file which runs the one in srcdir
@@ -1038,25 +1065,25 @@ EOF
         # been somewhat optimized and is perhaps a bit twisty.
 
         # code is order so as to try to sed the smallest input files we know.
+        # so do these separately because I don't trust the order of sed -e expressions.
 
-        # the four makefile fragments MUST end up in the resulting Makefile in this order: 
-        # package, target, host, and site.  so do these separately because I don't trust the
-        #  order of sed -e expressions.
+        # the five makefile fragments MUST end up in the resulting Makefile in this order: 
+        # package macros, target, host, site, and package rules.
 
         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
 
             # Conditionalize the makefile for this package from "Makefile.in" (or whatever it's called) into Makefile.tem.
             rm -f ${subdir}/${Makefile}.tem
-            case "${package_makefile_frag}" in
+            case "${package_makefile_rules_frag}" in
               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
               *)
-                      if [ ! -f ${package_makefile_frag} ] ; then
-                              package_makefile_frag=${srcdir}/${package_makefile_frag}
+                      if [ ! -f ${package_makefile_rules_frag} ] ; then
+                              package_makefile_rules_frag=${srcdir}/${package_makefile_rules_frag}
                       fi
-                      if [ -f ${package_makefile_frag} ] ; then
-                              sed -e "/^####/  r ${package_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
+                      if [ -f ${package_makefile_rules_frag} ] ; then
+                              sed -e "/^####/  r ${package_makefile_rules_frag}" ${srcdir}/${subdir}/${Makefile_in} > ${Makefile}.tem
                       else
-                              echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
+                              echo '***' Expected package makefile rules fragment \"${package_makefile_rules_frag}\" 1>&2
                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
                       fi
@@ -1115,10 +1142,24 @@ EOF
                       fi
                       ;;
             esac
-            # real copy now in ${Makefile}
-
-            mv ${Makefile} ${subdir}/Makefile.tem
+            # working copy now in ${Makefile}
 
+            # Emit the default values of this package's macros.
+            rm -f ${subdir}/Makefile.tem
+            case "${package_makefile_frag}" in
+              "") mv ${Makefile} ${subdir}/Makefile.tem ;;
+              *)
+                      if [ ! -f ${package_makefile_frag} ] ; then
+                              package_makefile_frag=${srcdir}/${package_makefile_frag}
+                      fi
+                      if [ -f ${package_makefile_frag} ] ; then
+                              sed -e "/^####/  r ${package_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
+                      else
+                              echo '***' Expected package makefile fragment \"${package_makefile_rules_frag}\" 1>&2
+                              echo '***' is missing in ${PWD=`pwd`}. 1>&2
+                              mv ${Makefile} ${subdir}/Makefile.tem
+                      fi
+            esac
             # real copy now in ${subdir}/Makefile.tem
 
             # prepend warning about editting, and a bunch of variables.
@@ -1171,6 +1212,22 @@ EOF
                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
             fi 
 
+           # provide a proper gxx_include_dir to all subdirs.
+           # Note, if you change the default, make sure to fix both here
+           # and in the gcc subdirectory.
+           if test -z "${with_gxx_include_dir}"; then
+               echo gxx_include_dir = '${prefix}/include/g++' >> ${Makefile}
+           else
+               echo gxx_include_dir = ${with_gxx_include_dir} >> ${Makefile}
+           fi
+
+           # record if we want to build shared libs.
+           if test -z "${enable_shared}"; then
+               echo enable_shared = no >> ${Makefile}
+           else
+               echo enable_shared = ${enable_shared} >> ${Makefile}
+           fi
+
             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
             # remove any form feeds.
             if [ -z "${subdirs}" ]; then
@@ -1221,6 +1278,7 @@ EOF
                     -e "s|^tooldir[    ]*=.*$|tooldir = ${tooldir}|" \
                    -e "s:^DEFAULT_YACC[         ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
                    -e "s:^DEFAULT_LEX[  ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
+                   -e "s:^DEFAULT_M4[  ]*=.*$:DEFAULT_M4 = ${DEFAULT_M4}:" \
                     ${subdir}/Makefile.tem >> ${Makefile}
 
            # If this is a Canadian Cross, preset the values of many more