home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / cnews.tar / conf / useanswers < prev    next >
Text File  |  1995-01-02  |  4KB  |  182 lines

  1. #! /bin/sh
  2. # useanswers [-v] answers makeinc substs config.make
  3. # this is an undocumented interface which may change; use at your own risk
  4.  
  5. uaverbose=no
  6. case "$1" in
  7. -v)    uaverbose=yes ; shift    ;;
  8. esac
  9.  
  10. uaans="$1"
  11. uamakeinc="$2"
  12. uasubsts="$3"
  13. uacm="$4"
  14.  
  15. tf=/tmp/ua$$
  16.  
  17. if test ! -r $uaans
  18. then
  19.     echo "$0: unable to read \`$uaans'" >&2
  20.     exit 1
  21. fi
  22. . $uaans
  23.  
  24. test " $uaverbose" = " yes" && echo "building $uamakeinc..."
  25. (
  26.     echo "# makefile substitutions file"
  27.     echo "# how to include ../include/config.make"
  28.     case "$include" in
  29.     svr4)    echo 'INCLUDE        include ../include/config.make' ;;
  30.     bsd|noway)    echo 'INCLUDE        .include "../include/config.make"' ;;
  31.     *)    echo 'Internal error, aborting...' >&2
  32.         exit 1
  33.         ;;
  34.     esac
  35. ) >$tf
  36. if cmp $tf $uamakeinc >/dev/null 2>/dev/null
  37. then
  38.     echo "unchanged, old one left in place"
  39. else
  40.     >$uamakeinc
  41.     if test ! -w $uamakeinc
  42.     then
  43.         echo "$0: unable to create \`$uamakeinc'; aborting" >&2
  44.         exit 1
  45.     fi
  46.     cp $tf $uamakeinc || exit 1
  47. fi
  48.  
  49. test " $uaverbose" = " yes" && echo "building $uasubsts..."
  50. (
  51.     echo "# general substitutions file"
  52.     echo "NEWSBIN    $newsbin"
  53.     echo "NEWSCTL    $newsctl"
  54.     echo "NEWSARTS    $newsarts"
  55.     echo "NEWSOV    $newsov"
  56.     echo "NEWSPATH    $newspath"
  57.     echo "NEWSUMASK    $newsumask"
  58.     echo "NEWSCONFIG    $newsconfig"
  59. ) >$tf
  60. if cmp $tf $uasubsts >/dev/null 2>/dev/null
  61. then
  62.     echo "unchanged, old one left in place"
  63. else
  64.     >$uasubsts
  65.     if test ! -w $uasubsts
  66.     then
  67.         echo "$0: unable to create \`$uasubsts'; aborting" >&2
  68.         exit 1
  69.     fi
  70.     cp $tf $uasubsts || exit 1
  71. fi
  72.  
  73. test " $uaverbose" = " yes" && echo "building $uacm..."
  74. (
  75.     echo "# make header file"
  76.     echo "# pathname variables"
  77.     echo "# =()<NEWSARTS=@<NEWSARTS>@>()="
  78.     echo "NEWSARTS=$newsarts"
  79.     echo "# =()<NEWSOV=@<NEWSOV>@>()="
  80.     echo "NEWSOV=$newsov"
  81.     echo "# =()<NEWSBIN=@<NEWSBIN>@>()="
  82.     echo "NEWSBIN=$newsbin"
  83.     echo "# =()<NEWSCTL=@<NEWSCTL>@>()="
  84.     echo "NEWSCTL=$newsctl"
  85.     echo "# =()<NEWSCONFIG=@<NEWSCONFIG>@>()="
  86.     echo "NEWSCONFIG=$newsconfig"
  87.     echo
  88.     echo "# workaround for System V make bug"
  89.     echo "SHELL=/bin/sh"
  90.     echo
  91.     echo "# directories where things go"
  92.     echo "UIBIN=$bin"
  93.     echo "RBIN=$rbin"
  94.     echo
  95.     echo "# compilation stuff"
  96.     echo "# LIB is for makefile dependencies, LIBS for cc invocations"
  97.     echo "LIB=../libcnews.a"
  98.     echo "LIBS=../libcnews.a $postlibs"
  99.     tmp=
  100.     case "$addrsize" in
  101.     small)    tmp='-DSMALLMEM'    ;;
  102.     esac
  103.     case "$faststrchr" in
  104.     yes)    tmp="$tmp -DFASTSTRCHR"    ;;
  105.     esac
  106.     echo "CFLAGS=\$(MORECFLAGS) $copts $tmp -I../include"
  107.     echo "LDFLAGS=\$(CFLAGS) $ldopts"
  108.     echo "LINTFLAGS=\$(MORELINTFLAGS) -I../include"
  109.     echo
  110.     echo "# directories etc."
  111.     echo "CONF=../conf"
  112.     case "$include" in
  113.     noway)    echo "MAKE=../conf/maker"    ;;
  114.     *)    echo "MAKE=$make"        ;;
  115.     esac
  116.     case "$cc" in
  117.     ''|cc)    ;;
  118.     *)    echo "CC=$cc"    ;;
  119.     esac
  120.     echo "TO=\$(CONF)/cpto"
  121.     echo "IN=\$(CONF)/cmpto \$(CMPOPT)"
  122.     echo "CF=\$(CONF)/checkfile \$(CMPOPT)"
  123.     echo "MKDIR=\$(CONF)/mkdirs"
  124.     echo "MX=chmod +x"
  125.     case "$ranlib" in
  126.     yes)    up=update.ran    ;;
  127.     *)    up=update.sym    ;;
  128.     esac
  129.     echo "UPDATE=\$(CONF)/$up ../libcnews.a"
  130.     echo "LIBCMP=\$(CONF)/libcmp ../libcnews.a"
  131.     echo
  132.     echo "# misc configuration bits"
  133.     echo "SPACEFOR=$dftype"
  134.     case "$sftype" in
  135.     c)    echo "DOSPACEFOR=dospacefor"    ;;
  136.     sh)    echo "DOSPACEFOR="    ;;
  137.     esac
  138.     echo "QUEUELEN=$uucptype"
  139.     echo "UID=$newsuid"
  140.     echo "GID=$newsgid"
  141.     echo "SIZE=$addrsize"
  142.     uadbz=libdbz
  143.     for f in $fake
  144.     do
  145.         if test " $f" = " dbz.o"
  146.         then
  147.             uadbz=
  148.         fi
  149.     done
  150.     echo "DBZ=$uadbz"
  151.     case "$faststdio" in
  152.     yes)    echo "STDIO=ourstdio"    ;;
  153.     *)    echo "STDIO=sysstdio"    ;;
  154.     esac
  155.     case "$nfsgroup" in
  156.     yes)    echo "SERVER=server"
  157.         echo "SERVERNAME=$server"
  158.         ;;
  159.     *)    echo "SERVER="    ;;
  160.     esac
  161.     echo "REPORTTO=$newsmaster"
  162.     echo "URGENTTO=$newscrisis"
  163.     echo
  164.     echo "# things for testing"
  165.     echo "HERE=. ../conf/rsetup ;"
  166.     echo
  167.     echo "# fake files needed"
  168.     echo "HFAKE=$fakehdrs"
  169.     echo "OFAKE=$fake"
  170. ) >$tf
  171. # this one we always change, so makefile knows when quiz was re-run
  172. >$uacm
  173. if test ! -w $uacm
  174. then
  175.     echo "$0: unable to create \`$uacm'; aborting" >&2
  176.     exit 1
  177. fi
  178. cp $tf $uacm || exit 1
  179.  
  180. rm -f $tf
  181. exit 0
  182.