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