home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cplusplus-8 / config.gcc < prev    next >
Encoding:
Text File  |  1991-01-16  |  9.0 KB  |  406 lines

  1. #!/bin/sh
  2. # Configuration script for GNU CC
  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 gcc.
  24. #
  25. # Usage: config.gcc [vint] machine
  26. #
  27. # If config.gcc succeeds, it leaves its status in config.status.
  28. # If config.gcc fails after disturbing the status quo, 
  29. #     config.status is removed.
  30. #
  31.  
  32. progname=$0
  33.  
  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.     ultrix)                    # for vaxen running ultrix
  86.         cpu_type=vax
  87.         ;;
  88.         tahoe)                                  # for tahoe's running bsd
  89.                 ;;
  90.         harris)                                 # for harris tahoe, using COFF.
  91.         cpu_type=tahoe
  92.                 ;;
  93.     vms)                    # for vaxen running VMS
  94.         cpu_type=vax
  95.         configuration_file=xm-${machine}.h
  96.         target_machine=tm-${machine}.h
  97.         ;;
  98.     vax-sysv | vaxv)            # for vaxen running system V
  99.         cpu_type=vax
  100.         configuration_file=xm-vaxv.h
  101.         target_machine=tm-vaxv.h
  102.         ;;
  103.     sequent-i386)            # for Intel 80386's on Sequent Symmetry
  104.         cpu_type=i386
  105.         configuration_file=xm-i386.h
  106.         target_machine=tm-seq386.h
  107.         ;;
  108.     i386-mach)
  109.         cpu_type=i386
  110.         configuration_file=xm-i386.h
  111.         target_machine=tm-i386gas.h
  112.         ;;
  113.     i386-sysv | i386v)        # for Intel 80386's running system V
  114.         machine=i386v
  115.         cpu_type=i386
  116.         configuration_file=xm-${machine}.h
  117.         ;;
  118.     i386-sysv4 | i386v4)        # for Intel 80386's running system V.4
  119.         machine=i386v4
  120.         cpu_type=i386
  121.         configuration_file=xm-i386v.h
  122.         ;;
  123.     i386-sysv-gas | i386g)
  124.         cpu_type=i386
  125.         configuration_file=xm-i386v.h
  126.         target_machine=tm-i386vgas.h
  127.         ;;        
  128.     i386-sco)            # for Intel 80386's running SCO system
  129.         machine=i386sco
  130.         cpu_type=i386
  131.         configuration_file=xm-i386v.h
  132.         ;;
  133.     i386-esix)            # for Intel 80386's running ESIX system
  134.         machine=i386esix
  135.         cpu_type=i386
  136.         configuration_file=xm-i386v.h
  137.         ;;
  138.     i386-aix | ps2-aix | aix386 | ps2aix )        # for IBM PS/2 running AIX
  139.         machine=aix386
  140.         cpu_type=i386
  141.         configuration_file=xm-${machine}.h
  142.         ;;
  143.     i860)
  144.         ;;
  145.     next )
  146.         cpu_type=m68k
  147.         target_machine=tm-next.h
  148.         ;;
  149.     sun4-os3 | sun-4-os3)
  150.         cpu_type=sparc
  151.         target_machine=tm-sun4os3.h
  152.         ;;
  153.     sun3-os3 | sun-3-os3)
  154.         cpu_type=m68k
  155.         target_machine=tm-sun3os3.h
  156.         ;;
  157.     sun3-nfp-os3 | sun-3-nfp-os3)
  158.         cpu_type=m68k
  159.         target_machine=tm-sun3os3nf.h
  160.         ;;
  161.     sun3-mach)
  162.         cpu_type=m68k
  163.         target_machine=tm-sun3mach.h
  164.         ;;
  165.     sun2 | sun-2 | sun2-os3 | sun-2-os3)
  166.         cpu_type=m68k
  167.         target_machine=tm-sun2.h
  168.         ;;
  169.     sun2-os4 | sun-2-os4)
  170.         cpu_type=m68k
  171.         target_machine=tm-sun2os4.h
  172.         ;;
  173.     sun386 | sun386i | roadrunner)
  174.         cpu_type=i386
  175.         configuration_file=xm-sun386i.h
  176.         target_machine=tm-sun386i.h
  177.         ;;
  178.     sun4 | sun-4 | sun4-os4 | sun-4-os4)
  179.         cpu_type=sparc
  180.         target_machine=tm-sparc.h
  181.         ;;
  182.     sun3 | sun-3 | sun3-os4 | sun-3-os4)
  183.         cpu_type=m68k
  184.         target_machine=tm-sun3.h
  185.         ;;
  186.     sun3-nfp | sun-3-nfp | sun3-nfp-os4 | sun-3-nfp-os4)
  187.         cpu_type=m68k
  188.         target_machine=tm-sun3-nfp.h
  189.         ;;
  190.     sun2-os4 |sun-2-os4)
  191.         cpu_type=m68k
  192.         target_machine=tm-sun2.h
  193.         ;;
  194.     hp9k320)            # HP 9000 series 300 with gcc alone
  195.         cpu_type=m68k
  196.         configuration_file=xm-hp9k320.h
  197.         ;;
  198.     hp9k320-old)            # HP 9000 series 300 with gcc alone
  199.         cpu_type=m68k
  200.         target_machine=tm-hp9k32old.h
  201.         configuration_file=xm-hp9k320.h
  202.         ;;
  203.     hp9k320-gas | hp9k320g)        #    with gnu as, ld and gdb
  204.         cpu_type=m68k
  205.         configuration_file=xm-hp9k320.h
  206.         target_machine=tm-hp9k320g.h
  207.         ;;
  208.     hp9k320-bsd)            # HP 9000/3xx running Berkeley Unix
  209.         cpu_type=m68k
  210.         target_machine=tm-hp9k3bsd.h
  211.         ;;
  212.     isi68)
  213.         cpu_type=m68k
  214.         ;;
  215.     isi68-nfp)
  216.         cpu_type=m68k
  217.         ;;
  218.     news | news800)
  219.             configuration_file=xm-m68k.h
  220.             target_machine=tm-news.h
  221.         cpu_type=m68k
  222.         ;;
  223.     news-gas | news-g)
  224.             configuration_file=xm-m68k.h
  225.             target_machine=tm-newsgas.h
  226.         cpu_type=m68k
  227.         ;;
  228.     altos | altos3068)        # Altos 3068 with gnu as, ld and gdb
  229.             cpu_type=m68k
  230.             configuration_file=xm-altos3068.h
  231.             target_machine=tm-altos3068.h
  232.             ;;
  233.     3b1)
  234.         cpu_type=m68k
  235.         configuration_file=xm-${machine}.h
  236.         ;;
  237.     3b1g | 3b1-gas)
  238.         machine=3b1g
  239.         cpu_type=m68k
  240.         configuration_file=xm-3b1.h
  241.         ;;
  242.     delta68k | motorola-3300 | delta)
  243.         cpu_type=m68k
  244.         configuration_file=xm-delta68k.h
  245.         target_machine=tm-delta68k.h
  246.         ;;
  247.     sequent-ns32k | sequent)
  248.         machine=sequent
  249.         cpu_type=ns32k
  250.         ;;
  251.     encore)
  252.         cpu_type=ns32k
  253.         ;;
  254.     genix)
  255.         target_machine=tm-genix.h
  256.         machine=ns32k
  257.         cpu_type=ns32k
  258.         configuration_file=xm-genix.h
  259.         ;;
  260.     88000)
  261.         cpu_type=m88k
  262.         target_machine=tm-${cpu_type}.h
  263.         ;;
  264.     alliant)                # Alliant FX/8
  265.         ;;
  266.     convex-c1)                # Convex C1
  267.         if [ -r /usr/include/stdlib.h ]
  268.         then
  269.             target_machine=tm-convex1.h
  270.         else
  271.             target_machine=tm-conv1os7.h
  272.         fi
  273.         cpu_type=convex
  274.         ;;
  275.     convex-c2)                # Convex C2
  276.         if [ -r /usr/include/stdlib.h ]
  277.         then
  278.             target_machine=tm-convex2.h
  279.         else
  280.             target_machine=tm-conv2os7.h
  281.         fi
  282.         cpu_type=convex
  283.         ;;
  284.     iris)                    # Mostly like a MIPS.
  285.         cpu_type=mips
  286.         target_machine=tm-iris.h
  287.         configuration_file=xm-iris.h
  288.         ;;
  289.     mips)                # Default MIPS environment
  290.         ;;
  291.     mips-sysv)            # SYSV variant of MIPS system.
  292.         cpu_type=mips
  293.         target_machine=tm-mips-sysv.h
  294.             ;;
  295.     mips-bsd43)            # BSD 4.3 variant of MIPS system.
  296.         cpu_type=mips
  297.         target_machine=tm-mips-bsd.h
  298.             ;;
  299.     mips-news | news-3600 | risc-news)    # Sony NEWS 3600 or risc/news.
  300.         cpu_type=mips
  301.         target_machine=tm-mips-news.h
  302.         ;;
  303.     dec-3100 | decstation)        # Decstation or pmax.
  304.         cpu_type=mips
  305.         target_machine=tm-decstatn.h
  306.             ;;
  307.     apollo68)
  308.         cpu_type=m68k
  309.         ;;
  310.     tower)        # NCR Tower 32 SVR3. as with sdb debugging.
  311.         cpu_type=m68k
  312.         target_machine=tm-tower-as.h
  313.         configuration_file=xm-tower.h
  314.         ;;
  315.     pyr | pyramid)
  316.         machine=pyr
  317.         ;;
  318. #    370)
  319. #        machine=370
  320. #        ;;
  321.     esac
  322.  
  323.         # if cpu_type is not set, define cpu_type to machine.
  324.         #
  325.     cpu_type=${cpu_type-$machine}
  326.     configuration_file=${configuration_file-xm-$cpu_type.h}
  327.     target_machine=${target_machine-tm-$machine.h}
  328.     machine_description=${cpu_type}.md
  329.     aux_output=${aux_output-out-$cpu_type.c}
  330.  
  331.     if [ xx${vint} = xx ]
  332.     then
  333.         files="$configuration_file $target_machine
  334.             $machine_description $aux_output"
  335.         links="config.h tm.h md aux-output.c"
  336.     else
  337.         files="$configuration_file tm-vmc.h $target_machine
  338.             $machine_description $aux_output"
  339.         links="config.h tm.h tm-pre.h md aux-output.c"
  340.     fi
  341.  
  342.     while [ -n "$files" ]
  343.     do
  344.         # set file to car of files, files to cdr of files
  345.         set $files; file=$1; shift; files=$*
  346.         set $links; link=$1; shift; links=$*
  347.  
  348.         if [ ! -r ${srcdir}/config/$file ]
  349.         then
  350.             echo "$progname: cannot create a link \`$link'," 1>&2
  351.             echo "since the file \`config/$file' does not exist." 1>&2
  352.             exit 1
  353.         fi
  354.  
  355.         $remove -f $link
  356.         rm -f config.status
  357.         # Make a symlink if possible, otherwise try a hard link
  358.         $symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link
  359.  
  360.         if [ ! -r $link ]
  361.         then
  362.             echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2
  363.             exit 1
  364.         fi
  365.         echo "Linked \`$link' to \`${srcdir}/config/$file'."
  366.     done
  367.  
  368.     if [ xx${vint} = xx ]
  369.     then
  370.         echo "Links are now set up for use with a $machine." \
  371.             | tee config.status
  372.     else
  373.         echo "Links are now set up for use with a $machine (vint)." \
  374.             | tee config.status
  375.     fi
  376.  
  377.     # Install a makefile, and make it set VPATH
  378.     # if necessary so that the sources are found.
  379.     # Also change its value of srcdir.
  380.     # Also create a .gdbinit file which runs the one in srcdir
  381.     # and tells GDB to look there for source files.
  382.     case $srcdir in
  383.     .)
  384.         ;;
  385.     *)
  386.         echo "VPATH = ${srcdir}" > x
  387.         cat x ${srcdir}/Makefile | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile
  388.         rm x
  389.         echo "dir ." > .gdbinit
  390.         echo "dir ${srcdir}" >> .gdbinit
  391.         echo "source ${srcdir}/.gdbinit" >> .gdbinit
  392.         ;;
  393.     esac
  394.  
  395.     exit 0
  396. else
  397.     echo "Usage: $progname machine"
  398.     echo -n "Where \`machine' is something like "
  399.     echo "\`vax', \`sun3', \`encore', etc."
  400.     if [ -r config.status ]
  401.     then
  402.         cat config.status
  403.     fi
  404.     exit 1
  405. fi
  406.