CMENU config problems...

michael sweet sweetmr at SCT60A.SUNYCT.EDU
Thu Feb 14 07:39:06 AEST 1991


Seems the _old_ version of the CMENU configuration script got stuck in the
tar I put on vgr...  Included at the end of this message is the correct
script, which handles things *much* better.

One other note: because IRIX is fairly BSD compatible, the config script
incorrectly determines that IRIX is BSD-based.  Just toggle it over to
SYSV and all will work properly.  (I'm still looking for a consistant way
of determining BSD/SYSV; anyone have any ideas?  It has to be something
I can check for in a script, i.e. the existance of a file(s) or particular
data structure in a header file...)

Sorry about any problems!

 -Mike Sweet

------------------------------------------------------------------------------
"The only        TASC                      (315) 724-1100 (voice)
 truth is that   555 French Road           (315) 724-2031 (fax)
 there are no    New Hartford, NY  13413   Internet: sweetmr at sct60a.sunyct.edu
 truths, only beliefs."                    Delphi:   DODGECOLT
------------------------------------------------------------------------------

---------- CMENU config program starts here! ----------

#! /bin/csh -f
#
# $Header$
#
# $Log$
#
# This is the configuration script for the CMENU library.  It looks
# at the host system and determines 1) the OS type [BSD or SYSV based],
# 2) the CURSES level of support including line drawing chars and
# display attributes, and 3) whether the host uses the termcap or
# terminfo capability databases.
#
# So far, this has only been tested on the following systems:
#
#  Gould Powernode/9000 series (UTX/32) - BSD
#  Sillicon Graphics 4D series (IRIX)   - SYS V
#  Sun 3/xxx series (UNIX)              - BSD
#  DEC VAX 11/7xx series (ULTRIX)       - BSD
#
#
# This script is probably FAR from perfect, and true hackers may know
# more about the host than this script! :)  For example, the current
# release of UTX/32 (for the Gould series) has a SYS V curses library
# accessible from the /usr/5lib and /usr/5include directories.
# Unfortunately, this is not a standard practice, so I really _can't_
# work that in... :(
#
# -Mike Sweet 2/6/91
#
# Copyright (c) 1990,1991 TASC
#
# Correspondence should be addressed to:
#
#   TASC
#    555 French Road
#    New Hartford, NY  13413
#    Attn: Michael Sweet
#
#    Voice: (315) 724-1100
#    Fax:   (315) 724-2031
#    EMail: sweetmr at sct60a.sunyct.edu (Internet)
#           DODGECOLT (Delphi)
#
#
# Permission is granted to distribute and use this software free of charge,
# so long as the following conditions are met:
#    1. The use or distribution of this software is provided free of charge,
#       or for the cost of the distribution medium.
#    2. All files associated with this software are provided without
#       change during distribution.  Pre-configuration of this software
#       is permitted, but the configuration script must still be included.
#    3. All copyright notices remain intact, as well as comments and
#       revision information.
#    3. All documentation remains unchanged.
#
# You MAY alter this software to meet your needs, however distribution of
# altered software must be documented as such.
#
# TASC makes no warrentees as to the usuability or functioning of this
# software.  Support is not guaranteed, but is provided on a limited basis
# via electronic correspondence only.
#
#

echo "CMENU Configuration Program Version 1.0"
echo "Copyright (c) 1990,1991 TASC"
echo "by Mike Sweet 2/6/91"
echo ""
echo "Checking out your system. .  ."

#
# Check for BSD/SYS V type systems...
#

if (-e /usr/include/dirent.h) then
 set x = "`grep direct /usr/include/dirent.h`"
 if ($#x > 0) then
  set OSTYPE = "BSD"
 else
  set OSTYPE = "SYSV"
 endif
else
 set OSTYPE = "BSD"
endif

#
# Check for a 'new' version of curses...
#

if (`grep A_BOLD /usr/include/curses.h`) then
 set OLDCURSES = 0
else
 set OLDCURSES = 1
endif

#
# Check for line drawing chars...
#

if (`grep ACS_ULCORNER /usr/include/curses.h`) then
 set ACS = 1
else
 set ACS = 0
endif

#
# Check for keyboard translation...
#

if (`grep KEY_MIN /usr/include/curses.h`) then
 set KEY = 1
else
 set KEY = 0
endif

#
# Check for terminfo/termcap databases...
#

if (-d /usr/lib/terminfo) then
 set TERMINFO = 1
else
 set TERMINFO = 0
endif

#
# Try to figure out what directory to put the man pages into...
#

if (-d /usr/man/local) then
 set MANDIR = "/usr/man/local"
else if (-d /usr/catman/local) then
 set MANDIR = "/usr/catman/local"
else if (-d /usr/man) then
 set MANDIR = "/usr/man"
else
 set MANDIR = "/usr/catman"
endif

#
# And then the library directory....
#

if (-d /usr/lib/local) then
 set LIBDIR = "/usr/lib/local"
else if (-d /usr/local/lib) then
 set LIBDIR = "/usr/local/lib"
else
 set LIBDIR = "/usr/lib"
endif

#
# And the include directory...
#

if (-d /usr/local/include) then
 set INCDIR = "/usr/local/include"
else if (-d /usr/include/local) then
 set INCDIR = "/usr/include/local"
else
 set INCDIR = "/usr/include"
endif

#
# Now show what we know and ask the user some more questions...
#

menu:

echo ""
echo ""

if ($OLDCURSES == 1) then
 echo "1) Curses (OLD)"
else
 echo "1) Curses (NEW)"
endif

if ($TERMINFO == 1) then
 echo "2) Terminal Database (terminfo)"
else
 echo "2) Terminal Database (termcap)"
endif

if ($ACS == 1) then
 echo "3) Line Drawing Support (YES)"
else
 echo "3) Line Drawing Support (NO)"
endif

if ($KEY == 1) then
 echo "4) Special Key Mapping (YES)"
else
 echo "4) Special Key Mapping (NO)"
endif

echo "5) Manual page directory = $MANDIR"
echo "6) Library directory = $LIBDIR"
echo "7) Header file directory = $INCDIR"
echo "8) Operating System Type = $OSTYPE"

echo ""
echo ""
echo "Enter a number to change an entry, 'quit' to quit CMENU configuration,"
echo -n "or type 'done' to finish the configuration--->  "

set x = $<

switch ($x)
 case 1 :
  if ($OLDCURSES == 1) then
   set OLDCURSES = 0
  else
   set OLDCURSES = 1
  endif
  breaksw

 case 2 :
  if ($TERMINFO == 1) then
   set TERMINFO = 0
  else
   set TERMINFO = 1
  endif
  breaksw

 case 3 :
  if ($ACS == 1) then
   set ACS = 0
  else
   set ACS = 1
  endif
  breaksw

 case 4 :
  if ($KEY == 1) then
   set KEY = 0
  else
   set KEY = 1
  endif
  breaksw

 case 5 :
  echo ""
  echo "WARNING:  I do not understand environment variables or ~\!"
  echo ""
  echo -n "New manual page directory?  --->  "
  set y = $<
  if ("$y" != "") then
   set MANDIR = "$y"
  endif
  breaksw

 case 6 :
  echo ""
  echo "WARNING:  I do not understand environment variables or ~\!"
  echo ""
  echo -n "New library directory?  --->  "
  set y = $<
  if ("$y" != "") then
   set LIBDIR = "$y"
  endif
  breaksw

 case 7 :
  echo ""
  echo "WARNING:  I do not understand environment variables or ~\!"
  echo ""
  echo -n "New header file directory?  --->  "
  set y = $<
  if ("$y" != "") then
   set INCDIR = "$y"
  endif
  breaksw

 case 8 :
  if ($OSTYPE == "BSD") then
   set OSTYPE = "SYSV"
  else
   set OSTYPE = "BSD"
  endif
  breaksw

 case "done" :
 # create the header file 'sed' script...
  echo ""
  echo "Configuring the header file. .  ."

  rm -f config.sed
  echo "s/OLDCURSES[ 	]*[0-9]/OLDCURSES $OLDCURSES/g" > config.sed
  echo "s/TERMINFO[ 	]*[0-9]/TERMINFO $TERMINFO/g" >> config.sed
  echo "s/ACSMAP[ 	]*[0-9]/ACSMAP $ACS/g" >> config.sed
  echo "s/KEYMAP[ 	]*[0-9]/KEYMAP $KEY/g" >> config.sed
  sed -f config.sed < cmenu.h >cmenu.h.new

# then do the makefile 'sed' script...
  echo ""
  echo "Configuring the makefile. .  ."

  rm -f config.sed
  echo "/^LIBDIR[ 	]*=.*/c\" > config.sed
  echo "LIBDIR	=	$LIBDIR" >> config.sed
  echo "/^MANDIR[ 	]*=.*/c\" >> config.sed
  echo "MANDIR	=	$MANDIR" >> config.sed
  echo "/^INCDIR[ 	]*=.*/c\" >> config.sed
  echo "INCDIR	=	$INCDIR" >> config.sed
  echo "/^OSTYPE[ 	]*=.*/c\" >> config.sed
  echo "OSTYPE	=	$OSTYPE" >> config.sed
  sed -f config.sed < makefile > makefile.new
  rm -f config.sed

# finally, move the originals to '.old' and the new ones from '.new'...
  mv -f cmenu.h cmenu.h.old
  mv -f cmenu.h.new cmenu.h
  mv -f makefile makefile.old
  mv -f makefile.new makefile

  echo ""
  echo "Configuration complete.  You may now type 'make install' to install"
  echo "the CMENU library."
  echo ""

  exit
  breaksw

 case "quit" :
  echo ""
  echo "Configuration aborted\!"
  echo ""
  exit

 default :
  echo ""
  echo "Please enter a number from 1 to 8, 'quit', or 'done'\!"
  echo ""
  breaksw
endsw

goto menu


----------- END OF CMENU CONFIG SCRIPT! ----------



More information about the Comp.sys.sgi mailing list