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