home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / gnu / gdb-4.14-src.lha / gdb-4.14 / configure < prev    next >
Encoding:
Text File  |  1995-03-10  |  33.3 KB  |  1,029 lines

  1. #!/bin/sh
  2.  
  3. ### WARNING: this file contains embedded tabs.  Do not run untabify on this file.
  4.  
  5. # Configuration script
  6. # Copyright (C) 1988, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
  7.  
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Please report any problems running this configure script to
  21. # configure@cygnus.com
  22. # Please do not send reports about other problems to this address.  See
  23. # gdb/README, gas/README, etc., for info on where and how to report
  24. # problems about particular tools.
  25.  
  26. # This file was written by K. Richard Pixley.
  27.  
  28. #
  29. # Shell script to create proper links to machine-dependent files in
  30. # preparation for compilation.
  31. #
  32. # If configure succeeds, it leaves its status in config.status.
  33. # If configure fails after disturbing the status quo, 
  34. #       config.status is removed.
  35. #
  36.  
  37. # In places where the argument to echo may start with a '-', we must
  38. # use /bin/echo since the AmigaDOS pdksh builtin echo botches this case.
  39. # For simplicity, just replace them all...  -fnf
  40.  
  41. export PATH || (/bin/echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  42.  
  43. remove=rm
  44. hard_link=cp
  45. symbolic_link=cp
  46.  
  47. #for Test
  48. #remove="/bin/echo rm"
  49. #hard_link="/bin/echo ln"
  50. #symbolic_link="/bin/echo ln -s"
  51.  
  52. # clear some things potentially inherited from environment.
  53.  
  54. Makefile=Makefile
  55. Makefile_in=Makefile.in
  56. arguments=$*
  57. build_alias=
  58. configdirs=
  59. exec_prefix=
  60. exec_prefixoption=
  61. fatal=
  62. floating_point=default
  63. gas=default
  64. host_alias=NOHOST
  65. host_makefile_frag=
  66. moveifchange=
  67. norecursion=
  68. other_options=
  69. package_makefile_frag=
  70. # This is a hack so we don't have to remember to always configure using
  71. # the "--prefix=/gnu" option.  Personally I feel this should be settable
  72. # in a config file.  -fnf
  73. prefix=/gnu
  74. progname=
  75. program_prefix=
  76. program_prefixoption=
  77. program_suffix=
  78. program_suffixoption=
  79. program_transform_name=
  80. program_transform_nameoption=
  81. redirect=">/dev/null"
  82. removing=
  83. site=
  84. site_makefile_frag=
  85. site_option=
  86. srcdir=
  87. srctrigger=
  88. subdirs=
  89. target_alias=NOTARGET
  90. target_makefile_frag=
  91. undefs=NOUNDEFS
  92. version="$Revision: 1.199 $"
  93. x11=default
  94.  
  95. ### we might need to use some other shell than /bin/sh for running subshells
  96. #
  97. config_shell=${CONFIG_SHELL-/bin/sh}
  98.  
  99. NO_EDIT="This file was generated automatically by configure.  Do not edit."
  100.  
  101. ## this is a little touchy and won't always work, but...
  102. ##
  103. ## if the argv[0] starts with a slash then it is an absolute name that can (and
  104. ## must) be used as is.
  105. ##
  106. ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
  107. ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  108. ##
  109.  
  110. # For some reason, the value of $0 in AmigaDOS pdksh ends up with a
  111. # trailing '/' that needs to be stripped.
  112. progname=`/bin/echo $0 | sed 's:/$::'`
  113. # if PWD already has a value, it is probably wrong.
  114. # The AmigaDOS pksh can't change the value of PWD, it's readonly.
  115. #if [ -n "$PWD" ]; then PWD=`pwd`; fi
  116.  
  117. case "${progname}" in
  118. /*) ;;
  119. */*) ;;
  120. *)
  121.         PATH=$PATH:${PWD=`pwd`} ; export PATH
  122.         ;;
  123. esac
  124.  
  125. # Loop over all args
  126.  
  127. while :
  128. do
  129.  
  130. # Break out if there are no more args
  131.     case $# in
  132.     0)
  133.         break
  134.         ;;
  135.     esac
  136.  
  137. # Get the first arg, and shuffle
  138.     option=$1
  139.     shift
  140.  
  141. # Make all options have two hyphens
  142.     orig_option=$option    # Save original for error messages
  143.     case $option in
  144.     --*) ;;
  145.     -*) option=-$option ;;
  146.     esac
  147.         
  148. # Split out the argument for options that take them
  149.     case $option in
  150.     --*=*)
  151.         optarg=`/bin/echo $option | sed -e 's/^[^=]*=//'`
  152.         ;;
  153. # These options have mandatory values.  Since we didn't find an = sign,
  154. # the value must be in the next argument
  155.     --b* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-*)
  156.         optarg=$1
  157.         shift
  158.         ;;
  159.     esac
  160.  
  161. # Now, process the options
  162.     case $option in
  163.  
  164.     --build* | --b*)
  165.         case "$build_alias" in
  166.         "") build_alias=$optarg ;;
  167.         *) /bin/echo '***' Can only configure for one build machine at a time.  1>&2
  168.            fatal=yes
  169.            ;;
  170.         esac
  171.         ;;
  172. # Accepted for compatibility with new autoconf; ignored.
  173.     --cache*)
  174.         ;;
  175.     --disable-*)
  176.         enableopt=`/bin/echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  177.         eval $enableopt=no
  178.         disableoptions="$disableoptions $option"
  179.         ;;
  180.     --enable-*)
  181.         case "$option" in
  182.         *=*)    ;;
  183.         *)    optarg=yes ;;
  184.         esac
  185.  
  186.         enableopt=`/bin/echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  187.         eval $enableopt="$optarg"
  188.         enableoptions="$enableoptions $option"
  189.         ;;
  190.     --exec-prefix* | --ex*)
  191.         exec_prefix=$optarg
  192.         exec_prefixoption="--exec-prefix=$optarg"
  193.         ;;
  194.     --gas | --g*)
  195.         gas=yes
  196.         ;;
  197.     --help | --he*)
  198.         fatal=yes
  199.         ;;
  200.     --host* | --ho*)
  201.         case $host_alias in
  202.         NOHOST) host_alias=$optarg ;;
  203.         *) /bin/echo '***' Can only configure for one host at a time.  1>&2
  204.            fatal=yes
  205.            ;;
  206.         esac
  207.         ;;
  208.     --nfp | --nf*)
  209.         floating_point=no
  210.         ;;
  211.     --norecursion | --no*)
  212.         norecursion=yes
  213.         ;;
  214.     --prefix* | --pre*)
  215.         prefix=$optarg
  216.         prefixoption="--prefix=$optarg"
  217.         ;;
  218.     --program-prefix* | --program-p*)
  219.         program_prefix=$optarg
  220.         program_prefixoption="--program-prefix=$optarg"
  221.         ;;
  222.     --program-suffix* | --program-s*)
  223.         program_suffix=$optarg
  224.         program_suffixoption="--program-suffix=$optarg"
  225.         ;;
  226.     --program-transform-name* | --program-t*)
  227.         # Double any backslashes or dollar signs in the argument
  228.         program_transform_name="${program_transform_name} -e `/bin/echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  229.         program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
  230.         ;;
  231.     --rm)
  232.         removing=--rm
  233.         ;;
  234.     --silent | --sil* | --quiet | --q*)
  235.         redirect=">/dev/null"
  236.         verbose=--silent
  237.         ;;
  238.     --site* | --sit*)
  239.         site=$optarg
  240.         site_option="--site=$optarg"
  241.         ;;
  242.     --srcdir*/ | --sr*/)
  243.                 # Remove trailing slashes.  Otherwise, when the file name gets
  244.                 # bolted into an object file as debug info, it has two slashes
  245.                 # in it.  Ordinarily this is ok, but emacs takes double slash
  246.                 # to mean "forget the first part".
  247.         srcdir=`/bin/echo $optarg | sed -e 's:/$::'`
  248.         ;;
  249.     --srcdir* | --sr*)
  250.         srcdir=$optarg
  251.         ;;
  252.     --target* | --ta*)
  253.         case $target_alias in
  254.         NOTARGET) target_alias=$optarg ;;
  255.         *) /bin/echo '***' Can only configure for one target at a time.  1>&2
  256.            fatal=yes
  257.            ;;
  258.         esac
  259.         ;;
  260.     --tmpdir* | --tm*)
  261.         TMPDIR=$optarg
  262.         tmpdiroption="--tmpdir=$optarg"
  263.         ;;
  264.     --verbose | --v | --verb*)
  265.         redirect=
  266.         verbose=--verbose
  267.         ;;
  268.     --version | --V | --vers*)
  269.         /bin/echo "This is Cygnus Configure version" `/bin/echo ${version} | sed 's/[ $:]//g'`
  270.         exit 0
  271.         ;;
  272.     --with-*)
  273.         case "$option" in
  274.         *=*)    ;;
  275.         *)    optarg=yes ;;
  276.         esac
  277.  
  278.         withopt=`/bin/echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  279.         eval $withopt="$optarg"
  280.         withoptions="$withoptions $option"
  281.         ;;
  282.     --without-*)
  283.         withopt=`/bin/echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  284.         eval $withopt=no
  285.         withoutoptions="$withoutoptions $option"
  286.         ;;
  287.     --x)    with_x=yes
  288.         withoptions="$withoptions --with-x"
  289.         ;;
  290.     --x-i* | --x-l*) other_options="$other_options $orig_option"
  291.         ;;
  292.     --*)
  293.         /bin/echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
  294.         exit 1
  295.         ;;
  296.     *)
  297.         case $undefs in
  298.         NOUNDEFS) undefs=$option ;;
  299.         *) /bin/echo '***' Can only configure for one host and one target at a time.  1>&2
  300.            fatal=yes
  301.            ;;
  302.         esac
  303.         ;;
  304.     esac
  305. done
  306.  
  307. # process host and target
  308.  
  309. # Do some error checking and defaulting for the host and target type.
  310. # The inputs are:
  311. #    configure --host=HOST --target=TARGET UNDEFS
  312. #
  313. # The rules are:
  314. # 1. You aren't allowed to specify --host, --target, and undefs at the
  315. #    same time.
  316. # 2. Host defaults to undefs.
  317. # 3. If undefs is not specified, then host defaults to the current host,
  318. #    as determined by config.guess.
  319. # 4. Target defaults to undefs.
  320. # 5. If undefs is not specified, then target defaults to host.
  321.  
  322. case "${fatal}" in
  323. "")
  324.     # Make sure that host, target & undefs aren't all specified at the
  325.     # same time.
  326.     case $host_alias---$target_alias---$undefs in
  327.     NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
  328.         ;;
  329.     *) /bin/echo '***' Can only configure for one host and one target at a time.  1>&2
  330.        fatal=yes
  331.        break 2
  332.         ;;
  333.     esac
  334.  
  335.     # Now, do defaulting for host.
  336.     case $host_alias in
  337.     NOHOST)
  338.         case $undefs in
  339.         NOUNDEFS)
  340.             # Neither --host option nor undefs were present.
  341.             # Call config.guess.
  342.             guesssys=`/bin/echo ${progname} | sed 's/configure$/config.guess/'`
  343.             if host_alias=`${guesssys}`
  344.             then
  345.                 # If the string we are going to use for
  346.                 # the target is a prefix of the string
  347.                 # we just guessed for the host, then
  348.                 # assume we are running native, and force
  349.                 # the same string for both target and host.
  350.                 case $target_alias in
  351.                 NOTARGET) ;;
  352.                 *)
  353.                     if expr $host_alias : $target_alias >/dev/null
  354.                     then
  355.                         host_alias=$target_alias
  356.                     fi
  357.                     ;;
  358.                 esac
  359.                 /bin/echo "Configuring for a ${host_alias} host." 1>&2
  360.                 arguments="--host=$host_alias $arguments"
  361.             else
  362.                 /bin/echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
  363.                 fatal=yes
  364.             fi
  365.             ;;
  366.         *)
  367.             host_alias=$undefs
  368.             ;;
  369.         esac
  370.     esac
  371.  
  372.     # Do defaulting for target.  If --target option isn't present, default
  373.     # to undefs.  If undefs isn't present, default to host.
  374.     case $target_alias in
  375.     NOTARGET)
  376.         case $undefs in
  377.         NOUNDEFS)
  378.             target_alias=$host_alias
  379.             ;;
  380.         *)
  381.             target_alias=$undefs
  382.             ;;
  383.         esac
  384.     esac
  385.     ;;
  386. *) ;;
  387. esac
  388.  
  389. if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
  390.     exec 1>&2
  391.     /bin/echo Usage: configure [OPTIONS] [HOST]
  392.     echo
  393.     /bin/echo Options: [defaults in brackets]
  394.     /bin/echo ' --prefix=MYDIR         install into MYDIR [/usr/local]'
  395.     /bin/echo ' --exec-prefix=MYDIR     install host-dependent files into MYDIR [/usr/local]'
  396.     /bin/echo ' --help             print this message [normal config]'
  397.     /bin/echo ' --build=BUILD         configure for building on BUILD [BUILD=HOST]'
  398.     /bin/echo ' --host=HOST         configure for HOST [determined via config.guess]'
  399.     /bin/echo ' --norecursion         configure this directory only [recurse]'
  400.     /bin/echo ' --program-prefix=FOO     prepend FOO to installed program names [""]'
  401.     /bin/echo ' --program-suffix=FOO     append FOO to installed program names [""]'
  402.     /bin/echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
  403.     /bin/echo ' --site=SITE         configure with site-specific makefile for SITE'
  404.     /bin/echo ' --srcdir=DIR         find the sources in DIR [. or ..]'
  405.     /bin/echo ' --target=TARGET     configure for TARGET [TARGET=HOST]'
  406.     /bin/echo ' --tmpdir=TMPDIR     create temporary files in TMPDIR [/tmp]'
  407.     /bin/echo ' --nfp             configure for software floating point [hard float]'
  408.     /bin/echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
  409.     /bin/echo ' --without-FOO         package FOO is NOT available'
  410.     /bin/echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
  411.     /bin/echo ' --disable-FOO         do not include feature FOO'
  412.     echo
  413.     /bin/echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
  414.     echo
  415.     if [ -r config.status ] ; then
  416.         cat config.status
  417.     fi
  418.  
  419.     exit 1
  420. fi
  421.  
  422. configsub=`/bin/echo ${progname} | sed 's/configure$/config.sub/'`
  423. moveifchange=`/bin/echo ${progname} | sed 's/configure$/move-if-change/'`
  424.  
  425. # this is a hack.  sun4 must always be a valid host alias or this will fail.
  426. if ${configsub} sun4 >/dev/null 2>&1 ; then
  427.         true
  428. else
  429.         /bin/echo '***' cannot find config.sub.  1>&2
  430.         exit 1
  431. fi
  432.  
  433. touch config.junk
  434. if ${moveifchange} config.junk config.trash ; then
  435.         true
  436. else
  437.         /bin/echo '***' cannot find move-if-change.  1>&2
  438.         exit 1
  439. fi
  440. rm -f config.junk config.trash
  441.  
  442. case "${srcdir}" in
  443. "")
  444.         if [ -r configure.in ] ; then
  445.                 srcdir=.
  446.         else
  447.                 if [ -r ${progname}.in ] ; then
  448.                         srcdir=`/bin/echo ${progname} | sed 's:/configure$::'`
  449.                 else
  450.                         /bin/echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
  451.                         exit 1
  452.                 fi
  453.         fi
  454.         ;;
  455. *) ;;
  456. esac
  457.  
  458. ### warn about some conflicting configurations.
  459.  
  460. case "${srcdir}" in
  461. ".") ;;
  462. *)
  463.         if [ -f ${srcdir}/config.status ] ; then
  464.                 /bin/echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
  465.                 exit 1
  466.         fi
  467. esac
  468.  
  469. # default exec_prefix
  470. case "${exec_prefixoption}" in
  471. "") exec_prefix="\$(prefix)" ;;
  472. *) ;;
  473. esac
  474.  
  475. ### break up ${srcdir}/configure.in.
  476. case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
  477. "")
  478.         /bin/echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
  479.         exit 1
  480.         ;;
  481. *) ;;
  482. esac
  483.  
  484. case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
  485. "")
  486.         /bin/echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
  487.         exit 1
  488.         ;;
  489. *) ;;
  490. esac
  491.  
  492. case "${TMPDIR}" in
  493. "") TMPDIR=/tmp ; export TMPDIR ;;
  494. *) ;;
  495. esac
  496.  
  497. # keep this filename short for &%*%$*# 14 char file names
  498. tmpfile=${TMPDIR}/cONf$$
  499. # Note that under many versions of sh a trap handler for 0 will *override* any
  500. # exit status you explicitly specify!  At this point, the only non-error exit
  501. # is at the end of the script; these actions are duplicated there, minus
  502. # the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
  503. # trap handler, or you'll lose.
  504. trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
  505.  
  506. # split ${srcdir}/configure.in into common, per-host, per-target,
  507. # and post-target parts.  Post-target is optional.
  508. sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
  509. sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
  510. if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
  511.   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
  512.   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
  513. else
  514.   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
  515.   /bin/echo >${tmpfile}.pos
  516. fi
  517.  
  518. ### do common part of configure.in
  519.  
  520. . ${tmpfile}.com
  521.  
  522. # some sanity checks on configure.in
  523. case "${srctrigger}" in
  524. "")
  525.         /bin/echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
  526.         exit 1
  527.         ;;
  528. *) ;;
  529. esac
  530.  
  531. case "${build_alias}" in
  532. "")    ;;
  533. *)
  534.     if result=`${config_shell} ${configsub} ${build_alias}` ; then
  535.         buildopt="--build=${build_alias}"
  536.         build_cpu=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  537.         build_vendor=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  538.         build_os=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  539.         build=${build_cpu}-${build_vendor}-${build_os}
  540.     else
  541.         /bin/echo "Unrecognized build system name ${build_alias}." 1>&2
  542.         exit 1
  543.     fi
  544.     ;;
  545. esac
  546.  
  547. if result=`${config_shell} ${configsub} ${host_alias}` ; then
  548.     true
  549. else
  550.     /bin/echo "Unrecognized host system name ${host_alias}." 1>&2
  551.     exit 1
  552. fi
  553. host_cpu=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  554. host_vendor=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  555. host_os=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  556. host=${host_cpu}-${host_vendor}-${host_os}
  557.  
  558. . ${tmpfile}.hst
  559.  
  560. if result=`${config_shell} ${configsub} ${target_alias}` ; then
  561.     true
  562. else
  563.     /bin/echo "Unrecognized target system name ${target_alias}." 1>&2
  564.     exit 1
  565. fi
  566. target_cpu=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  567. target_vendor=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  568. target_os=`/bin/echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  569. target=${target_cpu}-${target_vendor}-${target_os}
  570.  
  571. . ${tmpfile}.tgt
  572.  
  573. # Find the source files, if location was not specified.
  574. case "${srcdir}" in
  575. "")
  576.         srcdirdefaulted=1
  577.         srcdir=.
  578.         if [ ! -r ${srctrigger} ] ; then
  579.                 srcdir=..
  580.         fi
  581.         ;;
  582. *) ;;
  583. esac
  584.  
  585. if [ ! -r ${srcdir}/${srctrigger} ] ; then
  586.         case "${srcdirdefaulted}" in
  587.         "") /bin/echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
  588.         *)  /bin/echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
  589.         esac
  590.  
  591.         /bin/echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  592.         exit 1
  593. fi
  594.  
  595. # Some systems (e.g., one of the i386-aix systems the gas testers are
  596. # using) don't handle "\$" correctly, so don't use it here.
  597. tooldir='$(exec_prefix)'/${target_alias}
  598.  
  599. if [ "${host_alias}" != "${target_alias}" ] ; then
  600.     if [ "${program_prefixoption}" = "" ] ; then
  601.         if [ "${program_suffixoption}" = "" ] ; then 
  602.             if [ "${program_transform_nameoption}" = "" ] ; then
  603.                 program_prefix=${target_alias}- ;
  604.             fi
  605.         fi
  606.     fi
  607. fi
  608.  
  609. # Merge program_prefix and program_suffix onto program_transform_name.
  610. # (program_suffix used to use $, but it's hard to preserve $ through both
  611. # make and sh.)
  612. if [ "${program_suffix}" != "" ] ; then
  613.     program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
  614. fi
  615.  
  616. if [ "${program_prefix}" != "" ] ; then
  617.     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
  618. fi
  619.  
  620. for subdir in . ${subdirs} ; do
  621.  
  622.     # ${subdir} is relative path from . to the directory we're currently
  623.     # configuring.
  624.     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  625.     invsubdir=`/bin/echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  626.  
  627.     ### figure out what to do with srcdir
  628.     case "${srcdir}" in
  629.         ".")  # no -srcdir option.  We're building in place.
  630.                 makesrcdir=. ;;
  631.         /*) # absolute path
  632.                 makesrcdir=`/bin/echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  633.                 ;;
  634.         *) # otherwise relative
  635.                 case "${subdir}" in
  636.                 .) makesrcdir=${srcdir} ;;
  637.                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
  638.                 esac
  639.                 ;;
  640.     esac
  641.  
  642.     if [ "${subdir}/" != "./" ] ; then
  643.         Makefile=${subdir}/Makefile
  644.     fi
  645.  
  646.     if [ ! -d ${subdir} ] ; then
  647.         if mkdir ${subdir} ; then
  648.                 true
  649.         else
  650.                 /bin/echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
  651.                 exit 1
  652.         fi
  653.     fi
  654.  
  655.     case "${removing}" in
  656.     "")
  657.         case "${subdir}" in
  658.         .) ;;
  659.         *) eval /bin/echo Building in ${subdir} ${redirect} ;;
  660.         esac
  661.  
  662.         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
  663.         # Set up the list of links to be made.
  664.         # ${links} is the list of link names, and ${files} is the list of names to link to.
  665.  
  666.         # Make the links.
  667.         configlinks="${links}"
  668.         if [ -r ${subdir}/config.status ] ; then
  669.                 mv -f ${subdir}/config.status ${subdir}/config.back
  670.         fi
  671.         while [ -n "${files}" ] ; do
  672.                 # set file to car of files, files to cdr of files
  673.                 set ${files}; file=$1; shift; files=$*
  674.                 set ${links}; link=$1; shift; links=$*
  675.  
  676.                 if [ ! -r ${srcdir}/${file} ] ; then
  677.                         /bin/echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  678.                         /bin/echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
  679.                         exit 1
  680.                 fi
  681.  
  682.                 ${remove} -f ${link}
  683.         # Make a symlink if possible, otherwise try a hard link
  684.         if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
  685.             true
  686.         else
  687.             # We need to re-remove the file because Lynx leaves a 
  688.             # very strange directory there when it fails an NFS symlink.
  689.             ${remove} -r -f ${link}
  690.             ${hard_link} ${srcdir}/${file} ${link}
  691.         fi
  692.                 if [ ! -r ${link} ] ; then
  693.                         /bin/echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  694.                         exit 1
  695.                 fi
  696.  
  697.                 /bin/echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  698.         done
  699.  
  700.         # Create a .gdbinit file which runs the one in srcdir
  701.         # and tells GDB to look there for source files.
  702.  
  703.         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
  704.                 case ${srcdir} in
  705.                 .) ;;
  706.                 *) cat > ${subdir}/.gdbinit <<EOF
  707. # ${NO_EDIT}
  708. dir ${makesrcdir}
  709. dir .
  710. source ${makesrcdir}/.gdbinit
  711. EOF
  712.                         ;;
  713.                 esac
  714.         fi
  715.  
  716.         # Install a makefile, and make it set VPATH
  717.         # if necessary so that the sources are found.
  718.         # Also change its value of srcdir.
  719.         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
  720.         # been somewhat optimized and is perhaps a bit twisty.
  721.  
  722.         # code is order so as to try to sed the smallest input files we know.
  723.  
  724.         # the four makefile fragments MUST end up in the resulting Makefile in this order: 
  725.         # package, target, host, and site.  so do these separately because I don't trust the
  726.         #  order of sed -e expressions.
  727.  
  728.         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
  729.  
  730.             # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
  731.             rm -f ${subdir}/Makefile.tem
  732.               case "${site}" in
  733.               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
  734.               *)
  735.                       site_makefile_frag=${srcdir}/config/ms-${site}
  736.  
  737.                       if [ -f ${site_makefile_frag} ] ; then
  738.                               sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
  739.                                       > ${subdir}/Makefile.tem
  740.                       else
  741.                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
  742.                               site_makefile_frag=
  743.                       fi
  744.                       ;;
  745.             esac
  746.             # working copy now in ${subdir}/Makefile.tem
  747.  
  748.             # Conditionalize the makefile for this host.
  749.             rm -f ${Makefile}
  750.             case "${host_makefile_frag}" in
  751.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  752.               *)
  753.                       if [ ! -f ${host_makefile_frag} ] ; then
  754.                               host_makefile_frag=${srcdir}/${host_makefile_frag}
  755.                       fi
  756.                       if [ -f ${host_makefile_frag} ] ; then
  757.                               sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  758.                       else
  759.                               /bin/echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
  760.                               /bin/echo '***' is missing in ${PWD=`pwd`}. 1>&2
  761.                               mv ${subdir}/Makefile.tem ${Makefile}
  762.                       fi
  763.             esac
  764.             # working copy now in ${Makefile}
  765.  
  766.             # Conditionalize the makefile for this target.
  767.             rm -f ${subdir}/Makefile.tem
  768.             case "${target_makefile_frag}" in
  769.               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  770.               *)
  771.                       if [ ! -f ${target_makefile_frag} ] ; then
  772.                               target_makefile_frag=${srcdir}/${target_makefile_frag}
  773.                       fi
  774.                       if [ -f ${target_makefile_frag} ] ; then
  775.                               sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  776.                       else
  777.                               mv ${Makefile} ${subdir}/Makefile.tem
  778.                               target_makefile_frag=
  779.                       fi
  780.                       ;;
  781.             esac
  782.             # real copy now in ${subdir}/Makefile.tem
  783.  
  784.             # Conditionalize the makefile for this package.
  785.             rm -f ${Makefile}
  786.             case "${package_makefile_frag}" in
  787.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  788.               *)
  789.                       if [ ! -f ${package_makefile_frag} ] ; then
  790.                               package_makefile_frag=${srcdir}/${package_makefile_frag}
  791.                       fi
  792.                       if [ -f ${package_makefile_frag} ] ; then
  793.                               sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  794.                   rm -f ${subdir}/Makefile.tem
  795.                       else
  796.                               /bin/echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
  797.                               /bin/echo '***' is missing in ${PWD=`pwd`}. 1>&2
  798.                               mv ${subdir}/Makefile.tem ${Makefile}
  799.                       fi
  800.             esac
  801.             # working copy now in ${Makefile}
  802.  
  803.             mv ${Makefile} ${subdir}/Makefile.tem
  804.  
  805.             # real copy now in ${subdir}/Makefile.tem
  806.  
  807.             # prepend warning about editting, and a bunch of variables.
  808.             rm -f ${Makefile}
  809.             cat > ${Makefile} <<EOF
  810. # ${NO_EDIT}
  811. VPATH = ${makesrcdir}
  812. links = ${configlinks}
  813. host_alias = ${host_alias}
  814. host_cpu = ${host_cpu}
  815. host_vendor = ${host_vendor}
  816. host_os = ${host_os}
  817. host_canonical = ${host_cpu}-${host_vendor}-${host_os}
  818. target_alias = ${target_alias}
  819. target_cpu = ${target_cpu}
  820. target_vendor = ${target_vendor}
  821. target_os = ${target_os}
  822. target_canonical = ${target_cpu}-${target_vendor}-${target_os}
  823. EOF
  824.         case "${build}" in
  825.           "") ;;
  826.           *)  cat >> ${Makefile} << EOF
  827. build_alias = ${build_alias}
  828. build_cpu = ${build_cpu}
  829. build_vendor = ${build_vendor}
  830. build_os = ${build_os}
  831. build_canonical = ${build_cpu}-${build_vendor}-${build_os}
  832. EOF
  833.         esac
  834.  
  835.             case "${package_makefile_frag}" in
  836.               "") ;;
  837.               /*) /bin/echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
  838.               *)  /bin/echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
  839.             esac
  840.  
  841.             case "${target_makefile_frag}" in
  842.               "") ;;
  843.               /*) /bin/echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
  844.               *)  /bin/echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
  845.             esac
  846.  
  847.             case "${host_makefile_frag}" in
  848.               "") ;;
  849.               /*) /bin/echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
  850.               *)  /bin/echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
  851.             esac
  852.  
  853.             if [ "${site_makefile_frag}" != "" ] ; then
  854.                 /bin/echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
  855.             fi 
  856.  
  857.         # make sure that some sort of reasonable default exists for these 
  858.         # two variables
  859.         CXX=${CXX-"g++ -O"}
  860.         CC=${CC-gcc}
  861.  
  862.             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  863.             # remove any form feeds.
  864.             if [ -z "${subdirs}" ]; then
  865.                 rm -f ${subdir}/Makefile.tem2
  866.                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
  867.                     -e "s:^NONSUBDIRS[     ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
  868.                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
  869.                 rm -f ${subdir}/Makefile.tem
  870.                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
  871.             fi
  872.             sed -e "s:^prefix[     ]*=.*$:prefix = ${prefix}:" \
  873.                     -e "s:^exec_prefix[     ]*=.*$:exec_prefix = ${exec_prefix}:" \
  874.             -e "s:^SHELL[     ]*=.*$:SHELL = ${config_shell}:" \
  875.                     -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
  876.                     -e "s/ //" \
  877.                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
  878.                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
  879.                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
  880.                     -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
  881.                     ${subdir}/Makefile.tem >> ${Makefile}
  882.             # final copy now in ${Makefile}
  883.  
  884.         else
  885.            /bin/echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
  886.         fi
  887.  
  888.         rm -f ${subdir}/Makefile.tem
  889.  
  890.         case "${host_makefile_frag}" in
  891.         "") using= ;;
  892.         *) using="and \"${host_makefile_frag}\"" ;;
  893.         esac
  894.  
  895.         case "${target_makefile_frag}" in
  896.         "") ;;
  897.         *) using="${using} and \"${target_makefile_frag}\"" ;;
  898.         esac
  899.  
  900.         case "${site_makefile_frag}" in
  901.         "") ;;
  902.         *) using="${using} and \"${site_makefile_frag}\"" ;;
  903.         esac
  904.  
  905.         newusing=`/bin/echo "${using}" | sed 's/and/using/'`
  906.         using=${newusing}
  907.         /bin/echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  908.  
  909.         . ${tmpfile}.pos
  910.  
  911.         # describe the chosen configuration in config.status.
  912.         # Make that file a shellscript which will reestablish
  913.         # the same configuration.  Used in Makefiles to rebuild
  914.         # Makefiles.
  915.  
  916.         case "${norecursion}" in
  917.         "") arguments="${arguments} --norecursion" ;;
  918.         *) ;;
  919.         esac
  920.  
  921.         if [ ${subdir} = . ] ; then
  922.             /bin/echo "#!/bin/sh
  923. # ${NO_EDIT}
  924. # This directory was configured as follows:
  925. ${progname}" ${arguments}  "
  926. # ${using}" > ${subdir}/config.new
  927.         else
  928.             /bin/echo "#!/bin/sh
  929. # ${NO_EDIT}
  930. # This directory was configured as follows:
  931. cd ${invsubdir}
  932. ${progname}" ${arguments}  "
  933. # ${using}" > ${subdir}/config.new
  934.         fi
  935.         chmod a+x ${subdir}/config.new
  936.         if [ -r ${subdir}/config.back ] ; then
  937.                 mv -f ${subdir}/config.back ${subdir}/config.status
  938.         fi
  939.         ${moveifchange} ${subdir}/config.new ${subdir}/config.status
  940.         ;;
  941.  
  942.     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
  943.     esac
  944. done
  945.  
  946. # If there are subdirectories, then recur. 
  947. if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
  948.         for configdir in ${configdirs} ; do
  949.  
  950.                 if [ -d ${srcdir}/${configdir} ] ; then
  951.                         eval /bin/echo Configuring ${configdir}... ${redirect}
  952.                         case "${srcdir}" in
  953.                         ".") ;;
  954.                         *)
  955.                                 if [ ! -d ./${configdir} ] ; then
  956.                                         if mkdir ./${configdir} ; then
  957.                                                 true
  958.                                         else
  959.                                                 /bin/echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
  960.                                                 exit 1
  961.                                         fi
  962.                                 fi
  963.                                 ;;
  964.                         esac
  965.  
  966.                         POPDIR=${PWD=`pwd`}
  967.                         cd ${configdir} 
  968.  
  969. ### figure out what to do with srcdir
  970.                         case "${srcdir}" in
  971.                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
  972.                         /*) # absolute path
  973.                                 newsrcdir=${srcdir}/${configdir}
  974.                                 srcdiroption="--srcdir=${newsrcdir}"
  975.                                 ;;
  976.                         *) # otherwise relative
  977.                                 newsrcdir=../${srcdir}/${configdir}
  978.                                 srcdiroption="--srcdir=${newsrcdir}"
  979.                                 ;;
  980.                         esac
  981.  
  982. ### check for guested configure, otherwise fix possibly relative progname
  983.                         if [ -f ${newsrcdir}/configure ] ; then
  984.                                 recprog=${newsrcdir}/configure
  985.                         elif [ -f ${newsrcdir}/configure.in ] ; then
  986.                                 case "${progname}" in
  987.                                 /*)     recprog=${progname} ;;
  988.                                 *)      recprog=../${progname} ;;
  989.                                 esac
  990.             else
  991.                 eval /bin/echo No configuration information in ${configdir} ${redirect}
  992.                 recprog=
  993.                         fi
  994.  
  995. ### The recursion line is here.
  996.             if [ ! -z "${recprog}" ] ; then
  997.                             /bin/echo ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} ${prefixoption} ${tmpdiroption} ${exec_prefixoption} ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${removing} ${redirect}
  998.                             if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  999.                                     ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  1000.                                     ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect} ; then
  1001.                                     true
  1002.                             else
  1003.                     /bin/echo Configure in `pwd` failed, exiting. 1>&2
  1004.                                     exit 1
  1005.                             fi
  1006.             fi
  1007.  
  1008.                         cd ${POPDIR}
  1009.                 fi
  1010.         done
  1011. fi
  1012.  
  1013. # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
  1014. # and reset the trap handler.
  1015. rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
  1016. trap 0
  1017.  
  1018. exit 0
  1019.  
  1020. #
  1021. # Local Variables:
  1022. # fill-column: 131
  1023. # End:
  1024. #
  1025.  
  1026. # end of configure
  1027.