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