home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cplusplus-8 / config.g++ < prev    next >
Encoding:
Text File  |  1992-02-07  |  8.2 KB  |  373 lines

  1. #!/bin/sh
  2. # Configuration script for GNU C++
  3. #   Copyright (C) 1988 Free Software Foundation, Inc.
  4.  
  5. #This file is part of GNU CC.
  6.  
  7. #GNU CC is free software; you can redistribute it and/or modify
  8. #it under the terms of the GNU General Public License as published by
  9. #the Free Software Foundation; either version 1, or (at your option)
  10. #any later version.
  11.  
  12. #GNU CC 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.  
  17. #You should have received a copy of the GNU General Public License
  18. #along with GNU CC; see the file COPYING.  If not, write to
  19. #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. #
  22. # Shell script to create proper links to machine-dependent files in
  23. # preparation for compiling g++.  Also, files borrowed verbatim from
  24. # GNU CC have their links made by this program.
  25. #
  26. # Usage: config.g++ [vint] machine
  27. #
  28. # If config.g++ succeeds, it leaves its status in config.status.
  29. # If config.g++ fails after disturbing the status quo, 
  30. #     config.status is removed.
  31. #
  32.  
  33. progname=$0
  34. remove=rm
  35. hard_link=ln
  36. symbolic_link='ln -s'
  37.  
  38. #for Test
  39. #remove="echo rm"
  40. #hard_link="echo ln"
  41. #symbolic_link="echo ln -s"
  42.  
  43. for arg in $*;
  44. do
  45.   case $arg in
  46.    -srcdir=*)
  47.     srcdir=`echo $arg | sed s/-srcdir=//`
  48.     ;;
  49.    -vint)
  50.     vint=on
  51.     ;;
  52.    *)
  53.     machine=$arg
  54.     ;;
  55.   esac
  56. done
  57.  
  58. # Find the source files, if location was not specified.
  59. if [ x$srcdir = x ]
  60. then
  61.     srcdirdefaulted=1
  62.     srcdir=.
  63.     if [ ! -r tree.c ]
  64.     then
  65.         srcdir=..
  66.     fi
  67. fi
  68.  
  69. if [ ! -r ${srcdir}/tree.c ]
  70. then
  71.     if [ x$srcdirdefaulted = x ]
  72.     then
  73.       echo "$progname: Can't find compiler sources in \`${srcdir}'." 1>&2
  74.     else
  75.       echo "$progname: Can't find compiler sources in \`.' or \`..'." 1>&2
  76.     fi
  77.     exit 1
  78. fi
  79.  
  80. if [ x$machine != x ];
  81. then
  82.     case $machine in
  83.     vax)                    # for vaxen running bsd
  84.         ;;
  85.     vms)                    # for vaxen running VMS
  86.         cpu_type=vax
  87.         configuration_file=xm-${machine}.h
  88.         machine_type=${machine}
  89.         ;;
  90.     vax-sysv | vaxv)            # for vaxen running system V
  91.         cpu_type=vax
  92.         configuration_file=xm-vaxv.h
  93.         machine_type=vaxv
  94.         ;;
  95.     sequent-i386)            # for Intel 80386's on Sequent Symmetry
  96.         cpu_type=i386
  97.         configuration_file=xm-i386.h
  98.         machine_type=seq386
  99.         ;;
  100.     i386-sysv | i386v)        # for Intel 80386's running system V
  101.         machine=i386v
  102.         cpu_type=i386
  103.         configuration_file=xm-${machine}.h
  104.         machine_type=${machine}
  105.         ;;
  106.     i386-sysv-gas | i386g)
  107.         cpu_type=i386
  108.         configuration_file=xm-i386v.h
  109.         machine_type=i386gas
  110.         ;;        
  111.     i860)
  112.         ;;
  113.     next)
  114.         cpu_type=m68k
  115.         target_machine=tm-next68.h
  116.         configuration_file=xm-next.h      
  117.         aux_output=out-next68.c
  118.         machine_type=next
  119.         ;;
  120.     nrw)
  121.         cpu_type=m88k
  122.         target_machine=tm-next88.h
  123.         configuration_file=xm-next.h      
  124.         aux_output=out-next88.c
  125.         machine_type=nrw
  126.     ;;
  127.     sun4 | sun-4)
  128.         cpu_type=sparc
  129.         configuration_file=xm-sparc.h
  130.         machine_type=sun4os3
  131.         ;;
  132.     sun3 | sun-3)
  133.         cpu_type=m68k
  134.         configuration_file=xm-m68k.h
  135.         machine_type=sun3
  136.         ;;
  137.     sun3-nfp | sun-3-nfp)
  138.         cpu_type=m68k
  139.         configuration_file=xm-m68k.h
  140.         machine_type=sun3-nfp
  141.         ;;
  142.     sun3-fpa | sun-3-fpa)
  143.         cpu_type=m68k
  144.         configuration_file=xm-m68k.h
  145.         machine_type=sun3-fpa
  146.         ;;
  147.     sun2 | sun-2)
  148.         cpu_type=m68k
  149.         configuration_file=xm-m68k.h
  150.         machine_type=sun2
  151.         ;;
  152.     sun386 | sun386i | roadrunner)
  153.         cpu_type=i386
  154.         configuration_file=xm-sun386i.h
  155.         machine_type=sun386i
  156.         ;;
  157.     sun4-os4 | sun-4-os4)
  158.         cpu_type=sparc
  159.         target_machine=tm-sparc.h
  160.         machine_type=sparc
  161.         ;;
  162.     sun3-os4 | sun-3-os4)
  163.         cpu_type=m68k
  164.         configuration_file=xm-m68k.h
  165.         machine_type=sun3
  166.         ;;
  167.     sun3-nfp-os4 | sun-3-nfp-os4)
  168.         cpu_type=m68k
  169.         configuration_file=xm-m68k.h
  170.         machine_type=sun3-nfp
  171.         ;;
  172.     sun3-fpa-os4 | sun-3-fpa-os4)
  173.         cpu_type=m68k
  174.         configuration_file=xm-m68k.h
  175.         machine_type=sun3-fpa
  176.         ;;
  177.     sun2-os4 |sun-2-os4)
  178.         cpu_type=m68k
  179.         configuration_file=xm-m68k.h
  180.         machine_type=sun2
  181.         ;;
  182.     hp9k320)            # HP 9000 series 300 with gcc alone
  183.         cpu_type=m68k
  184.         configuration_file=xm-hp9k320.h
  185.         ;;
  186.     hp9k320-old)            # HP 9000 series 300 with gcc alone
  187.         cpu_type=m68k
  188.         target_machine=tm-hp9k32old.h
  189.         configuration_file=xm-hp9k320.h
  190.         ;;
  191.     hp9k320-gas | hp9k320g)            #    with gnu as, ld and gdb
  192.         cpu_type=m68k
  193.         configuration_file=xm-hp9k320.h
  194.         ;;
  195.     hp9k320-bsd | hp300)        # HP 9000/3xx running Berkeley Unix
  196.         cpu_type=m68k
  197.         target_machine=tm-hp9k3bsd.h
  198.         ;;
  199.     hp9k800)            # HP 9000 series 800 with g++ alone
  200.         cpu_type=hp9k8
  201.         configuration_file=xm-hp9k8.h
  202.         aux_output=out-hp9k8.c
  203.         machine_type=hp9k8
  204.         ;;
  205.     isi68)
  206.         cpu_type=m68k
  207.         ;;
  208.     news800)
  209.             configuration_file=xm-m68k.h
  210.             target_machine=tm-news.h
  211.         cpu_type=m68k
  212.         ;;
  213.     news-gas | news-g)
  214.             configuration_file=xm-m68k.h
  215.             target_machine=tm-newsgas.h
  216.         cpu_type=m68k
  217.         ;;
  218.     altos | altos3068)        # Altos 3068 with gnu as, ld and gdb
  219.             cpu_type=m68k
  220.             configuration_file=xm-altos3068.h
  221.             target_machine=tm-altos3068.h
  222.             ;;
  223.     3b1)
  224.         cpu_type=m68k
  225.         configuration_file=xm-${machine}.h
  226.         ;;
  227.     sequent-ns32k | sequent)
  228.         cpu_type=ns32k
  229.         aux_output=out-ns32k.c
  230.         ;;
  231.     encore)
  232.         cpu_type=ns32k
  233.         aux_output=out-ns32k.c
  234.         ;;
  235.     genix)
  236.         machine=ns32k
  237.         cpu_type=ns32k
  238.         configuration_file=xm-genix.h
  239.         ;;
  240.     88000)
  241.         cpu_type=m88k
  242.         machine_type=${cpu_type}
  243.         ;;
  244.     alliant)                # Alliant FX/8
  245.         ;;
  246.     convex-c1)                # Convex C1
  247.         machine_type=convex1
  248.         cpu_type=convex
  249.         ;;
  250.     convex-c2)                # Convex C2
  251.         machine_type=convex2
  252.         cpu_type=convex
  253.         ;;
  254.     pyr)
  255.         ;;
  256.     iris)                    # Mostly like a MIPS.
  257.         cpu_type=mips
  258.         target_machine=tm-iris.h
  259.         configuration_file=xm-iris.h
  260.         ;;
  261.     mips)                # Default MIPS environment
  262.         ;;
  263.     mips-sysv)            # SYSV variant of MIPS system.
  264.         cpu_type=mips
  265.         target_machine=tm-mips-sysv.h
  266.             ;;
  267.     mips-bsd43)            # BSD 4.3 variant of MIPS system.
  268.         cpu_type=mips
  269.         target_machine=tm-mips-bsd.h
  270.             ;;
  271.     dec-3100 | decstation)        # Decstation or pmax.
  272.         cpu_type=mips
  273.         target_machine=tm-decstatn.h
  274.             ;;
  275. #    370)
  276. #        machine=370
  277. #        ;;
  278.     GNUmasscomp)
  279.         cpu_type=m68k
  280.         target_machine=tm-GNUmass.h
  281.         ;;
  282.     masscomp)
  283.         cpu_type=m68k
  284.         machine_description=masscomp.md
  285.         ;;
  286.     esac
  287.  
  288.     $remove -f config.h tm.h md aux-output.c
  289.  
  290.         # if cpu_type is not set, define cpu_type to machine.
  291.         #
  292.     cpu_type=${cpu_type-$machine}
  293.     configuration_file=${configuration_file-xm-$cpu_type.h}
  294.     machine_type=${machine_type-$machine}
  295.     target_machine=${target_machine-tm-${machine_type}.h}
  296.     machine_description=${machine_description-${cpu_type}.md}
  297.     aux_output=${aux_output=out-$cpu_type.c}
  298.  
  299.     if [ xx${vint} = xx ]
  300.     then
  301.         files="$configuration_file $target_machine
  302.             $machine_description $aux_output"
  303.         links="config.h tm.h md aux-output.c"
  304.     else
  305.         files="$configuration_file tm-vmc.h $target_machine
  306.             $machine_description $aux_output"
  307.         links="config.h tm.h tm-pre.h md aux-output.c"
  308.     fi
  309.  
  310.     while [ -n "$files" ]
  311.     do
  312.         # set file to car of files, files to cdr of files
  313.         set $files; file=$1; shift; files=$*
  314.         set $links; link=$1; shift; links=$*
  315.  
  316.         if [ ! -r ${srcdir}/config/$file ]
  317.         then
  318.             echo "$progname: cannot create a link \`$link'," 1>&2
  319.             echo "since the file \`config/$file' does not exist." 1>&2
  320.             exit 1
  321.         fi
  322.  
  323.         $remove -f $link
  324.         rm -f config.status
  325.         # Make a symlink if possible, otherwise try a hard link
  326.         $symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link
  327.  
  328.         if [ ! -r $link ]
  329.         then
  330.             echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2
  331.             exit 1
  332.         fi
  333.         echo "Linked \`$link' to \`${srcdir}/config/$file'."
  334.     done
  335.  
  336.     if [ xx${vint} = xx ]
  337.     then
  338.         echo "Links are now set up for use with a $machine." \
  339.             | tee config.status
  340.     else
  341.         echo "Links are now set up for use with a $machine (vint)." \
  342.             | tee config.status
  343.     fi
  344.  
  345.     # Install a makefile, and make it set VPATH
  346.     # if necessary so that the sources are found.
  347.     # Also change its value of srcdir.
  348.     # Also create a .gdbinit file which runs the one in srcdir
  349.     # and tells GDB to look there for source files.
  350.     case $srcdir in
  351.     .)
  352.         ;;
  353.     *)
  354.         echo "VPATH = ${srcdir}" > x
  355.         cat x ${srcdir}/Makefile.in | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile
  356.         rm x
  357.         echo "dir ${srcdir}" > .gdbinit
  358.         echo "source ${srcdir}/.gdbinit" >> .gdbinit
  359.         ;;
  360.     esac
  361.  
  362.     exit 0
  363. else
  364.     echo "Usage: $progname machine"
  365.     echo -n "Where \`machine' is something like "
  366.     echo "\`vax', \`sun3', \`umax', etc."
  367.     if [ -r config.status ]
  368.     then
  369.         cat config.status
  370.     fi
  371.     exit 1
  372. fi
  373.