#!/bin/sh
#*=====================================================================*/
#*    serrano/trashcan/bigloo1.9e/configure                            */
#*    -------------------------------------------------------------    */
#*    Author      :  Manuel Serrano                                    */
#*    Creation    :  Tue Jan 25 16:05:10 1994                          */
#*    Last change :  Wed Jan 20 07:41:05 1999 (serrano)                */
#*    -------------------------------------------------------------    */
#*    The Bigloo configuration file                                    */
#*=====================================================================*/

#*---------------------------------------------------------------------*/
#*    User variables                                                   */
#*---------------------------------------------------------------------*/
#*--- paths -----------------------------------------------------------*/
prefix=/usr/local
bindir=$prefix/bin
libdir=$prefix/lib/bigloo
mandir=$prefix/man/man1
infodir=$prefix/info
docdir=$prefix/doc
lispdir=$prefix/xemacs/site-lisp
tmp=/tmp

#*--- compilers, linkers and shells -----------------------------------*/
cc=gcc
cflags=-O2
as=as
ar=ar
arflags=qcv
shell=/bin/sh
xemacs=xemacs
makeinfo=makeinfo

#*--- readline library ------------------------------------------------*/
readline=-lreadline

#*--- socket library (left empty for automatic configuration) ---------*/
socketlibs=

#*--- indent ----------------------------------------------------------*/
indent="/usr/local/bin/indent -npro -bap -bad -nbc -bl -ncdb -nce -nfc1 -ip0 -nlp -npcs -nsc -nsob -cli0.5 -di0 -l80 -d1 -c0 -ts2 -st"

#*--- mask of Bigloo intalled files -----------------------------------*/
bmask=755

#*--- ld shared library option ----------------------------------------*/
# set this variable to `no-share' if you don't want shared library
ldopt=

#*--- should the compiler be dynamically linked?  ---------------------*/
# the legal value for that variable is `yes' or `no'
sharedcompiler=no

#*---------------------------------------------------------------------*/
#*    Hacker variables                                                 */
#*    -------------------------------------------------------------    */
#*    Don't modifiy these variables unless you know what you are       */
#*    doing.                                                           */
#*---------------------------------------------------------------------*/
#*--- The basename of the compiler ------------------------------------*/
bigloo=bigloo

#*--- libraries -------------------------------------------------------*/
libraryname=$bigloo

#--- additional user library used to link bigloo applications ---------*/
extralibs="-lm"

#*---------------------------------------------------------------------*/
#*               !!! DON'T EDIT AFTER THIS COMMENT !!!                 */
#*---------------------------------------------------------------------*/
action=all
bigloo_cfg=runtime/Include/bigloo_cfg.h
makefile_cfg=Dmakefile.cfg
autoconfdir=`dirname $0 2> /dev/null`/autoconf
pwd='pwd'

if [ $? != "0" ]; then
   autoconfdir="autoconf"
fi

if [ $action = "all" ]; then
  if [ "$pwd" = "/home/tahoe/serrano/prgm/project/bigloo" ]; then
     echo "*** ERROR: can't configure all in that directory: $pwd";
     exit -1;
  fi
fi

# Argument parsing
while : ; do
  case $1 in
    "")
      break;;

    --bigloo_cfg.h=*)
      action="bigloo_cfg";
      bigloo_cfg="`echo $1 | sed 's/^[-a-z_.]*=//'`";;

    --Dmakefile.cfg=*)
      action="Dmakefile.cfg";
      makefile_cfg="`echo $1 | sed 's/^[-Da-z.]*=//'`";;

    --bindir=*)
      bindir="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --libdir=*)
      libdir="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --mandir=*)
      mandir="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --infodir=*)
      infodir="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --docdir=*)
      docdir="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --indent=*)
      indent="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --lispdir=*)
      lispdir="`echo $1 | sed 's/^[-a-z]*=//'`";;

    --prefix=*)
      prefix="`echo $1 | sed 's/^[-a-z]*=//'`";
      bindir=$prefix/bin;
      libdir=$prefix/lib/bigloo;
      mandir=$prefix/man/man1;
      infodir=$prefix/info;
      docdir=$prefix/doc;
      lispdir=$prefix/xemacs/site-lisp;;

    -*)
      echo "Usage: configure [options]" >&2;
      echo "   --bigloo_cfg.h=file" >&2;
      echo "   --Dmakefile.cfg=file" >&2;
      echo "   --bindir=file" >&2;
      echo "   --libdir=file" >&2;
      echo "   --mandir=file" >&2;
      echo "   --infodir=file" >&2;
      echo "   --docdir=file" >&2;
      echo "   --indent=file" >&2;
      exit -1;
  esac
  shift
done

#*---------------------------------------------------------------------*/
#*    all action                                                       */
#*---------------------------------------------------------------------*/
if [ $action = "all" ]; then
  if [ -d bin ]; then
     rm -rf bin
  fi
  mkdir bin

  if [ -d lib ]; then
     rm -rf lib
  fi
  mkdir lib
fi

#*---------------------------------------------------------------------*/
#*    Testing C compiler                                               */
#*---------------------------------------------------------------------*/
$autoconfdir/cctest --cc="$cc"
if [ $? != "0" ]; then
  echo "*** ERROR:configure:the C compiler does not seem to work. Aborting";
  exit 1;
fi

#*---------------------------------------------------------------------*/
#*    bigloo_cfg.h                                                     */
#*    -------------------------------------------------------------    */
#*    This part of the configure script produces the file              */
#*    runtime/Include/bigloo_cfg.h. This file contains all the         */
#*    machine dependant information used by Bigloo.                    */
#*---------------------------------------------------------------------*/
if [ $action = "all" -o $action = "bigloo_cfg" ]; then

  # We first cleanup the file
  rm -f $bigloo_cfg 2> /dev/null
  echo "/* Automatically generated file (don't edit) */" > $bigloo_cfg
  echo "/* `date` */" >> $bigloo_cfg

  # The stack direction
  stackgrows=`$autoconfdir/stackdown --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:stack. Aborting";
     exit 1;
  fi

  echo "#undef STACK_GROWS_DOWN" >> $bigloo_cfg
  if( test $stackgrows = "1" ); then
    echo "   stack grows: down"
    echo "#define STACK_GROWS_DOWN 1" >> $bigloo_cfg
  else
    echo "   stack grows: up"
    echo "#define STACK_GROWS_DOWN 0" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # The pointer alignment
  alignment=`$autoconfdir/alignment --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:alignment. Aborting";
     exit 1;
  fi

  echo "   ptr alignment: " $alignment
  echo "#undef PTR_ALIGNMENT" >> $bigloo_cfg
  echo "#define PTR_ALIGNMENT $alignment" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # setjmp/longjmp
  prefix=`$autoconfdir/setjmp --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:setjmp. Aborting";
     exit 1;
  fi

  setjmp="$prefix"setjmp
  longjmp="$prefix"longjmp

  echo "   setjmp: $setjmp longjmp: $longjmp"
  echo "#undef SETJMP" >> $bigloo_cfg
  echo "#define SETJMP $setjmp" >> $bigloo_cfg
  echo "#undef LONGJMP" >> $bigloo_cfg
  echo "#define LONGJMP $longjmp" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # Does the system have bcopy?
  bcopy=`$autoconfdir/bcopy --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:bcopy. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_BCOPY" >> $bigloo_cfg
  if( test $bcopy = "1" ); then
    echo "   bcopy: yes"
    echo "#define HAVE_BCOPY 1" >> $bigloo_cfg
  else
    echo "   bcopy: no"
    echo "#define HAVE_BCOPY 0" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # The number of window register
  window=`$autoconfdir/winreg --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:winreg. Aborting";
     exit 1;
  fi

  echo "   nb window register: " $window
  echo "#undef NB_WINDOW_REGISTER" >> $bigloo_cfg
  echo "#define NB_WINDOW_REGISTER $window" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # Does the system have sigsetmask?
  sigsetmask=`$autoconfdir/sigsetmask --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:sigsetmask. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_SIGSETMASK" >> $bigloo_cfg
  if( test $sigsetmask = "0" ); then
    echo "   sigsetmask: no"
    echo "#define HAVE_SIGSETMASK 0" >> $bigloo_cfg
   else
    echo "   sigsetmask: yes"
    echo "#define HAVE_SIGSETMASK 1" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # Does the system have sigprocmask?
  sigprocmask=`$autoconfdir/sigprocmask --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:sigprocmask. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_SIGPROCMASK" >> $bigloo_cfg
  if( test $sigprocmask = "0" ); then
    echo "   sigprocmask: no"
    echo "#define HAVE_SIGPROCMASK 0" >> $bigloo_cfg
  else
    echo "   sigprocmask: yes"
    echo "#define HAVE_SIGPROCMASK 1" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # A warning if neither sigsetmask nor sigprocmask is defined
  if( test $sigsetmask = "0" -a $sigprocmask = "0"); then
     echo "*** WARNING:sigsetmask nor sigprocmask: yes"
     echo "(^C disabled in the interpreter)."
  fi
  echo "" >> $bigloo_cfg

  # Does the system have alloca?
  alloca=`$autoconfdir/alloca --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:alloca. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_ALLOCA" >> $bigloo_cfg
  if( test $alloca = "1" ); then
    echo "   alloca: yes"
    echo "#define HAVE_ALLOCA 1" >> $bigloo_cfg
  else
    echo "   alloca: no"
    echo "#define HAVE_ALLOCA 0" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # Does the system have getcwd?
  getcwd=`$autoconfdir/getcwd --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:getcwd. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_GETCWD" >> $bigloo_cfg
  if( test $getcwd = "0" ); then
    echo "   getcwd: no"
    echo "#define HAVE_GETCWD 0" >> $bigloo_cfg
  else
    echo "   getcwd: yes"
    echo "#define HAVE_GETCWD 1" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # Does the system have getwd?
  getwd=`$autoconfdir/getwd --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:getwd. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_GETWD" >> $bigloo_cfg
  if( test $getwd = "0" ); then
    echo "   getwd: no"
    echo "#define HAVE_GETWD 0" >> $bigloo_cfg
  else
    echo "   getwd: yes"
    echo "#define HAVE_GETWD 1" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # Where to find the socket api
  socket=`$autoconfdir/socket --cc="$cc" --lib="$socketlibs"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:socket. Aborting";
     exit 1;
  fi

  if [ "$socket " = " " ]; then
    echo "   socket: yes"
  else
    echo "   socket: $socket"
    extralibs="$extralibs $socket"
  fi

  # Are the static constants aligned?
  cnstalign=`$autoconfdir/cnstalign --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:cnstalign. Aborting";
     exit 1;
  fi

  enforcedcnstalign=`$autoconfdir/enforcedcnstalign --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:enforcedcnstalign. Aborting";
     exit 1;
  fi

  echo "#undef CONSTANT_ALIGNED" >> $bigloo_cfg
  if( test $cnstalign = "1" ); then
    echo "   constant alignment: ok"
    echo "#define CONSTANT_ALIGNED 1" >> $bigloo_cfg
  elif( test $cnstalign = "0" ); then
    if( test $enforcedcnstalign = "1" ); then
       echo "   constant alignment: enforced"
       echo "#define CONSTANT_ALIGNED 0" >> $bigloo_cfg
    else
       echo "***ERROR:configure:illegal alignment."
       echo "It is then impossible install Bigloo on this architecture, sorry."
       exit 1
    fi
  fi
  echo "" >> $bigloo_cfg

  # Does this system implements pipe?
  pipe=`$autoconfdir/pipe --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:pipe. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_PIPE" >> $bigloo_cfg
  if( test $pipe = "0" ); then
    echo "   popen/pclose: no"
    echo "#define HAVE_PIPE 0" >> $bigloo_cfg
  else
    echo "   popen/pclose: yes"
    echo "#define HAVE_PIPE 1" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # Does this compiler implements longlong?
  longlong=`$autoconfdir/longlong --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:longlong. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_LONGLONG" >> $bigloo_cfg
  if( test $longlong = "1" ); then
    echo "   long long: yes"
    echo "#define HAVE_LONGLONG 1" >> $bigloo_cfg
  else
    echo "   long long: no"
    echo "#define HAVE_LONGLONG 0" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # Is sigchld available for us
  sigchld=`$autoconfdir/sigchld --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:sigchld. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_SIGCHLD" >> $bigloo_cfg
  if( test $sigchld = "1" ); then
    echo "   sigchld: yes"
    echo "#define HAVE_SIGCHLD 1" >> $bigloo_cfg
  else
    echo "   sigchld: no"
    echo "#define HAVE_SIGCHLD 0" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg
  
  # Is sigaction available
  sigaction=`$autoconfdir/sigaction --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:sigaction. Aborting";
     exit 1;
  fi

  echo "#undef HAVE_SIGACTION" >> $bigloo_cfg
  if( test $sigaction = "1" ); then
    echo "   sigaction: yes"
    echo "#define HAVE_SIGACTION 1" >> $bigloo_cfg
  else
    echo "   sigaction: no"
    echo "#define HAVE_SIGACTION 0" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg
  
  # for now only the port is Unix
  echo "   operating system: unix"
  $autoconfdir/unix >> $bigloo_cfg
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:os. Aborting";
     exit 1;
  fi
  echo "" >> $bigloo_cfg

  rl=`$autoconfdir/readline --cc="$cc" --readline="$readline"`
  if [ "$?" = "0" ]; then
     readline="no"
  else
     readline=$rl
  fi
  echo "   readline: $readline"

  # which shell to use
  `$shell -c "ls -l > /dev/null 2> /dev/null"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:$shell. Aborting";
     exit 1;
  fi

  echo "   shell: $shell"
  echo "#undef SHELL" >> $bigloo_cfg
  echo "#define SHELL \"$shell\"" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # which C compiler to use
  echo "   c compiler: $cc"
  echo "#undef C_COMPILER" >> $bigloo_cfg
  echo "#define C_COMPILER \"$cc\"" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # the library directory
  echo "   library directory: $libdir"
  echo "#undef LIBRARY_DIRECTORY" >> $bigloo_cfg
  echo "#define LIBRARY_DIRECTORY \"$libdir\"" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # additionals non bigloo library
  echo "   additional libraries: $extralibs"
  echo "#undef USER_LIBRARIES" >> $bigloo_cfg
  echo "#define USER_LIBRARIES \"$extralibs\"" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # the C beautifier
  echo "#undef C_BEAUTIFIER" >> $bigloo_cfg
  if( test `$autoconfdir/indent --cc="$cc" --cflags="$cflags" --indent="$indent"` != "1" ); then
    echo "   c beautifier: no"
    echo "#define C_BEAUTIFIER \"\"" >> $bigloo_cfg
  else
    echo "   c beautifier: $indent"
    echo "#define C_BEAUTIFIER \"$indent\"" >> $bigloo_cfg
  fi
  echo "" >> $bigloo_cfg

  # library basename
  echo "   library basename: $libraryname"
  echo "#undef LIBRARY_BASE_NAME" >> $bigloo_cfg
  echo "#define LIBRARY_BASE_NAME \"$libraryname\"" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # double precision
  prec=`$autoconfdir/doubleprec --cc="$cc"`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:doubleprec. Aborting";
     exit 1;
  fi

  echo "   double precision: $prec"
  echo "#undef DOUBLE_PRECISION" >> $bigloo_cfg
  echo "#define DOUBLE_PRECISION $prec" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # static link additional option
  ldstaticopt=`$autoconfdir/ldstaticopt`
  echo "#undef ADDITIONAL_STATIC_LINK_OPTION" >> $bigloo_cfg
  echo "#define ADDITIONAL_STATIC_LINK_OPTION \"$ldstaticopt\"" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # shared link additional option
  ldsharedopt=`$autoconfdir/ldsharedopt $libdir`
  echo "#undef ADDITIONAL_SHARED_LINK_OPTION" >> $bigloo_cfg
  echo "#define ADDITIONAL_SHARED_LINK_OPTION \"$ldsharedopt\"" >> $bigloo_cfg
  echo "" >> $bigloo_cfg

  # The shared libraries
  if( test "$ldopt" = "no-share" ); then
     ldopt=
  else
     ldopt=`$autoconfdir/ldshare --cc="$cc" -ldopt="$ldopt"`
  fi
  echo "#undef HAVE_SHARED_LIBRARY" >> $bigloo_cfg

  if( test "$ldopt" = "" ); then
    echo "   shared library: no (because I don't know ld option)"
    echo "#define HAVE_SHARED_LIBRARY 0" >> $bigloo_cfg
  else
    echo "   shared library: yes"
    echo "#define HAVE_SHARED_LIBRARY 1" >> $bigloo_cfg
  fi
fi
  
#*---------------------------------------------------------------------*/
#*    Dmakefile.cfg                                                    */
#*    -------------------------------------------------------------    */
#*    This part of the configure script produces the file              */
#*    Dmakefile.cfg. This file contains machine dependant informations */
#*    and location where Bigloo is to be installed.                    */
#*---------------------------------------------------------------------*/
if [ $action = "all" -o $action = "Dmakefile.cfg" ]; then

  # We create an unexisting temporary file name
  name=$tmp/foo
  while( test -f "$name.s" -o -f "$name.o" ); do 
    name="$name"x;
  done

  # We first cleanup the file
  rm -f $makefile_cfg 2> /dev/null
  touch $makefile_cfg

  # The basename
  echo "LIBRARYNAME=\"$libraryname\"" >> $makefile_cfg

  # The C compiler
  echo "CC=\"$cc\"" >> $makefile_cfg
  echo "CFLAGS=\"$cflags\"" >> $makefile_cfg

  # The assembler
  echo "   checking $as"
  as=`$autoconfdir/ascpp -as="$as" -cc="$cc" -tmp=$tmp --name=$name`
  if [ $? != "0" ]; then
     echo "*** ERROR:configure:as. Aborting";
     exit 1;
  fi

  if [ "$as " = " " ]; then
    echo "***ERROR:configure:$as:can't find as that invokes cpp,";
    echo "set $as variable."
    rm -f $name.s $name.o
    exit 1;
  else
     echo "AS=\"$as\"" >> $makefile_cfg
  fi 

  # Ar checking
  echo "   checking $ar $arflags"

  (cd $tmp; 
   compile="$ar $arflags $name.a $name.o > /dev/null 2> /dev/null";
   if eval $compile; then
     /bin/rm -f $name.s $name.o $name.a
   else
      arflags="-q -c";
      compile="$ar $arflags $name.a $name.o > /dev/null 2> /dev/null";
      if eval $compile; then
        /bin/rm -f $name.s $name.o $name.a
      else
        echo "***ERROR:configure:ar:Can't automatically setup ar flags"; 
        echo "Please, set ar flags up inside ./configure";
        /bin/rm -f $name.s $name.o $name.a; 
        exit 1
      fi
   fi) || exit $*
  echo "AR=\"$ar\"" >> $makefile_cfg
  echo "ARFLAGS=\"$arflags\"" >> $makefile_cfg
  
  # Does the system require ranlib?
  if( test `$autoconfdir/ranlib --cc="$cc"` = "0" ); then
     echo "   ranlib: no"
     echo "RANLIB=true" >> $makefile_cfg
  else
     echo "   ranlib: yes"
     echo "RANLIB=\"ranlib\"" >> $makefile_cfg
  fi

  # The shared libraries
  if( test "$ldopt" = "" ); then
    echo "LD=true" >> $makefile_cfg
  else
    echo "LD=\"ld $ldopt\"" >> $makefile_cfg
  fi

  # readline
  echo "READLINE=\"$readline\"" >> $makefile_cfg

  # The xemacs source path
  if( test -d $lispdir ); then
     xemacslisppath=$lispdir
  else
     xemacslisppath=`$autoconfdir/xemacspath --xemacs="$xemacs"`
  fi

  if( test "$xemacslisppath" = "" ); then
     echo "   xemacs: no (because I can't find xemacs lisp path)"
  else
     echo "   xemacs lisp path: $xemacslisppath"
     echo "EMACSDIR=\"$xemacslisppath\"" >> $makefile_cfg
  fi

  # bmask
  echo "BMASK=$bmask" >> $makefile_cfg

  # The release number
  echo "BVERSION=" >> $makefile_cfg
  echo "CVERSION=" >> $makefile_cfg

  # additional bigloo compiler link flags (some architecture such as AIX
  # require a special to link huge executable)
  ldextraopt=`$autoconfdir/ldextraopt --cc="$cc"`

  echo "EXTRA_LD_OPT=\"$ldextraopt\"" >> $makefile_cfg
  if [ $sharedcompiler = "yes" ]; then
     echo "SHRD_COMP=yes" >> $makefile_cfg;
  else
     echo "SHRD_COMP=no" >> $makefile_cfg;
  fi

  # The info version
  $autoconfdir/oldinfo --makeinfo="$makeinfo"

  if [ "$?" = "0" ]; then
     echo "   makeinfo: new version"
     echo "INFOOPTION=\"-U oldinfo\"" >> $makefile_cfg
     echo "INFOPS=yes" >> $makefile_cfg
  else
     echo "   makeinfo: old version (won't be able to produce ps file)"
     echo "INFOOPTION=\"-D oldinfo\"" >> $makefile_cfg
     echo "INFOPS=no" >> $makefile_cfg
  fi

  # the common Makefile entry
  echo "" >> $makefile_cfg
  echo "boot:" >> $makefile_cfg
  echo "	\$(MAKE) Dboot \\" >> $makefile_cfg
  echo "                 EXTRA_LD_OPT=\$(EXTRA_LD_OPT) \\" >> $makefile_cfg
  echo "                 LIBRARYNAME=\$(LIBRARYNAME) \\" >> $makefile_cfg
  echo "                 CC=\$(CC) \\" >> $makefile_cfg
  echo "                 CFLAGS=\$(CFLAGS) \\" >> $makefile_cfg
  echo "                 AS=\$(AS) \\" >> $makefile_cfg
  echo "                 AR=\$(AR) \\" >> $makefile_cfg
  echo "                 ARFLAGS=\$(ARFLAGS) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 LD=\$(LD) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE) \\" >> $makefile_cfg
  echo "                 SHRD_COMP=\$(SHRD_COMP) \\" >> $makefile_cfg
  echo "                 EXTRALIBS=\"$extralibs\" \\" >> $makefile_cfg
  echo "                 INFOOPTION=\$(INFOOPTION) \\" >> $makefile_cfg
  echo "                 INFOPS=\$(INFOPS) \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "compile-cigloo:" >> $makefile_cfg
  echo "	\$(MAKE) Dcigloo \\" >> $makefile_cfg
  echo "                 BIGLOO=$bindir""/bigloo \\" >> $makefile_cfg
  echo "                 LIBRARYNAME=\$(LIBRARYNAME) \\" >> $makefile_cfg
  echo "                 CC=\$(CC) \\" >> $makefile_cfg
  echo "                 CFLAGS=\$(CFLAGS) \\" >> $makefile_cfg
  echo "                 AS=\$(AS) \\" >> $makefile_cfg
  echo "                 AR=\$(AR) \\" >> $makefile_cfg
  echo "                 ARFLAGS=\$(ARFLAGS) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 LD=\$(LD) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE) \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "compile-bde:" >> $makefile_cfg
  echo "	\$(MAKE) Dbde \\" >> $makefile_cfg
  echo "                 BIGLOO=$bindir""/bigloo \\" >> $makefile_cfg
  echo "                 LIBRARYNAME=\$(LIBRARYNAME) \\" >> $makefile_cfg
  echo "                 CC=\$(CC) \\" >> $makefile_cfg
  echo "                 CFLAGS=\$(CFLAGS) \\" >> $makefile_cfg
  echo "                 AS=\$(AS) \\" >> $makefile_cfg
  echo "                 AR=\$(AR) \\" >> $makefile_cfg
  echo "                 ARFLAGS=\$(ARFLAGS) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 LD=\$(LD) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE) \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "compile-bdb:" >> $makefile_cfg
  echo "	\$(MAKE) Dbdb \\" >> $makefile_cfg
  echo "                 BIGLOO=$bindir""/bigloo \\" >> $makefile_cfg
  echo "                 LIBRARYNAME=\$(LIBRARYNAME) \\" >> $makefile_cfg
  echo "                 CC=\$(CC) \\" >> $makefile_cfg
  echo "                 CFLAGS=\$(CFLAGS) \\" >> $makefile_cfg
  echo "                 AS=\$(AS) \\" >> $makefile_cfg
  echo "                 AR=\$(AR) \\" >> $makefile_cfg
  echo "                 ARFLAGS=\$(ARFLAGS) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 LD=\$(LD) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE) \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "compile-bmacs:" >> $makefile_cfg
  echo "	\$(MAKE) EMACSDIR=\"$xemacslisppath\" Dbmacs" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "install:" >> $makefile_cfg
  echo "	\$(MAKE) Dinstall \\" >> $makefile_cfg
  echo "                 BVERSION=\$(BVERSION) \\" >> $makefile_cfg
  echo "                 CVERSION=\$(CVERSION) \\" >> $makefile_cfg
  echo "                 BINDIR=$bindir \\" >> $makefile_cfg
  echo "                 LIBDIR=$libdir \\" >> $makefile_cfg
  echo "                 MANDIR=$mandir \\" >> $makefile_cfg
  echo "                 INFODIR=$infodir \\" >> $makefile_cfg
  echo "                 DOCDIR=$docdir \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "install-cigloo:" >> $makefile_cfg
  echo "	\$(MAKE) Dinstall-cigloo \\" >> $makefile_cfg
  echo "                 BVERSION=\$(BVERSION) \\" >> $makefile_cfg
  echo "                 CVERSION=\$(CVERSION) \\" >> $makefile_cfg
  echo "                 BINDIR=$bindir \\" >> $makefile_cfg
  echo "                 LIBDIR=$libdir \\" >> $makefile_cfg
  echo "                 MANDIR=$mandir \\" >> $makefile_cfg
  echo "                 INFODIR=$infodir \\" >> $makefile_cfg
  echo "                 DOCDIR=$docdir \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "install-bde:" >> $makefile_cfg
  echo "	\$(MAKE) Dinstall-bde \\" >> $makefile_cfg
  echo "                 BVERSION=\$(BVERSION) \\" >> $makefile_cfg
  echo "                 CVERSION=\$(CVERSION) \\" >> $makefile_cfg
  echo "                 BINDIR=$bindir \\" >> $makefile_cfg
  echo "                 LIBDIR=$libdir \\" >> $makefile_cfg
  echo "                 MANDIR=$mandir \\" >> $makefile_cfg
  echo "                 INFODIR=$infodir \\" >> $makefile_cfg
  echo "                 DOCDIR=$docdir \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "install-bdb:" >> $makefile_cfg
  echo "	\$(MAKE) Dinstall-bdb \\" >> $makefile_cfg
  echo "                 BVERSION=\$(BVERSION) \\" >> $makefile_cfg
  echo "                 CVERSION=\$(CVERSION) \\" >> $makefile_cfg
  echo "                 BINDIR=$bindir \\" >> $makefile_cfg
  echo "                 LIBDIR=$libdir \\" >> $makefile_cfg
  echo "                 MANDIR=$mandir \\" >> $makefile_cfg
  echo "                 INFODIR=$infodir \\" >> $makefile_cfg
  echo "                 DOCDIR=$docdir \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "install-bmacs:" >> $makefile_cfg
  echo "	\$(MAKE) Dinstall-bmacs \\" >> $makefile_cfg
  echo "                 BVERSION=\$(BVERSION) \\" >> $makefile_cfg
  echo "                 CVERSION=\$(CVERSION) \\" >> $makefile_cfg
  echo "                 BINDIR=$bindir \\" >> $makefile_cfg
  echo "                 LIBDIR=$libdir \\" >> $makefile_cfg
  echo "                 MANDIR=$mandir \\" >> $makefile_cfg
  echo "                 EMACSDIR=$xemacslisppath \\" >> $makefile_cfg
  echo "                 INFODIR=$infodir \\" >> $makefile_cfg
  echo "                 DOCDIR=$docdir \\" >> $makefile_cfg
  echo "                 BMASK=\$(BMASK) \\" >> $makefile_cfg
  echo "                 RANLIB=\$(RANLIB) \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE)" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "uninstall:" >> $makefile_cfg
  echo "	\$(MAKE) Duninstall \\" >> $makefile_cfg
  echo "                 BINDIR=$bindir \\" >> $makefile_cfg
  echo "                 LIBDIR=$libdir \\" >> $makefile_cfg
  echo "                 MANDIR=$mandir \\" >> $makefile_cfg
  echo "                 INFODIR=$infodir \\" >> $makefile_cfg
  echo "                 EMACSDIR=$xemacslisppath \\" >> $makefile_cfg
  echo "                 READLINE=\$(READLINE) \\" >> $makefile_cfg
  echo "                 DOCDIR=$docdir" >> $makefile_cfg
  echo "" >> $makefile_cfg
  echo "clean:" >> $makefile_cfg
  echo "	\$(MAKE) Dclean \\" >> $makefile_cfg
  echo "                 BINDIR=$bindir \\" >> $makefile_cfg
  echo "                 LIBDIR=$libdir \\" >> $makefile_cfg
  echo "                 MANDIR=$mandir \\" >> $makefile_cfg
  echo "                 MANDIR=$infodir \\" >> $makefile_cfg
  echo "                 DOCDIR=$docdir" >> $makefile_cfg
  echo "" >> $makefile_cfg
fi

#*---------------------------------------------------------------------*/
#*    Ok, we are done now                                              */
#*---------------------------------------------------------------------*/
echo "configuration done."
echo "-------------------"
