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