Andrew's Makefile.custom generation program...hopefully should

reduce *some* confusion, eh? :)

From: Andrew Martin <martin@biochemistry.ucl.ac.uk>
This commit is contained in:
Marc G. Fournier 1997-01-13 18:54:30 +00:00
parent 949cfe5271
commit 40f4a330b7
1 changed files with 264 additions and 0 deletions

264
src/customize Normal file
View File

@ -0,0 +1,264 @@
#!/bin/sh
#*************************************************************************
#
# Program: PostgreSQL customisation utility
# File: customise
#
# Version: 6.0
# Date: 08.01.97
# Function: Write Makefile.custom for PostgreSQL
#
# Copyright: (c) Dr. Andrew C. R. Martin 1997
# Author: Dr. Andrew C. R. Martin
# Address: Biomolecular Structure & Modelling Unit,
# Department of Biochemistry & Molecular Biology,
# University College,
# Gower Street,
# London.
# WC1E 6BT.
# EMail: martin@biochem.ucl.ac.uk
# andrew@stagleys.demon.co.uk
#
#*************************************************************************
#
# This program is distributed under the copyright for PostgreSQL
#
#*************************************************************************
#
# Function:
# =========
# This program prompts the user to enter basic customisation options
# for a local installation of PostgreSQL. From these answers it writes
# a Makefile.custom
#
# It is intended as a stop-gap measure until autoconf is implemeted.
#
#*************************************************************************
#
# Revision History:
# =================
# V6.0 08.01.96 Original version for PostgreSQL V6.0
#
#*************************************************************************
# Customise the customisation! Set variables for default directories
# ------------------------------------------------------------------
libdir="/usr/local/lib"
incdir="/usr/local/include"
#*************************************************************************
# readln "prompt" "default"
# -------------------------
# Reads a line into $ans.
# Based on code from the Linux Configure utility
#
# 08.01.96 Original By: ACRM
readln () {
echo -n "$1 "
IFS='@' read ans </dev/tty || exit 1
[ -z "$ans" ] && ans=$2
}
#*************************************************************************
# bool "question" "default"
# -------------------------
# Ask a yes or no question
# Based on code from the Linux Configure utility
#
# 08.01.96 Original By: ACRM
bool () {
ans=""
def=$2
while [ "$ans" != "y" -a "$ans" != "n" ]; do
readln "$1 (y/n) [$def] " "$def"
done
}
#*************************************************************************
# Start of main customise program
# -------------------------------
echo "Welcome to the PostgreSQL V6.0 cutomisation utility."
echo " "
echo "You may build PostgreSQL for one of the following systems"
echo " aix IBM on AIX 3.2.5"
echo " alpha DEC Alpha AXP on OSF/1 2.0"
echo " BSD44_derived OSs derived from 4.4-lite BSD (NetBSD, FreeBSD)"
echo " bsdi BSD/OS 2.0, 2.01, 2.1"
echo " dgux DG/UX 5.4R3.10"
echo " hpux HP PA-RISC on HP-UX 9.0"
echo " i386_solaris i386 Solaris"
echo " irix5 SGI MIPS on IRIX 5.3 or better"
echo " linux Intel x86 on Linux 1.2 and Linux ELF"
echo " next Motorola MC68K or Intel x86 on NeXTSTEP 3.2"
echo " sparc_solaris SUN SPARC on Solaris 2.4"
echo " sunos4 SUN SPARC on SunOS 4.1.3"
echo " svr4 Intel x86 on Intel SVR4"
echo " ultrix4 DEC MIPS on Ultrix 4.4"
readln "Enter port name:" "UNKNOWN"
if [ "$ans" = "UNKNOWN" ] ; then
echo "You must enter a port name from the list above."
echo "Please start again!"
exit 1
fi
portname=$ans
echo >Makefile.custom "PORTNAME= $portname"
if [ "$portname" = "linux" ] ; then
bool "Is this an ELF system?" "y"
if [ "$ans" = "n" ] ; then
echo >>Makefile.custom "LINUX_ELF= "
fi
fi
def="/usr/local/pgsql"
readln "Where do you wish to install Postgres [$def]?" "$def"
if [ "$ans" != "$def" ] ; then
echo >>Makefile.custom "POSTGRESDIR= $ans"
fi
if [ "$portname" = "irix5" ] ; then
echo >>Makefile.custom "IPCSDIR= /usr/sbin"
else
def="/usr/bin"
readln "Where are the IPCS utilities stored [$def]?" "$def"
if [ "$ans" != "$def" ] ; then
echo >>Makefile.custom "IPCSDIR= $ans"
fi
fi
bool "Compile C++ library?" "n"
if [ "$ans" = "y" ] ; then
echo >>Makefile.custom "HAVE_Cplusplus= true"
fi
bool "Compile Tcl utilities?" "n"
if [ "$ans" = "y" ] ; then
echo >>Makefile.custom "USE_TCL= true"
def=$incdir
readln "Tcl include directory [$def]?" "$def"
echo >>Makefile.custom "TCL_INCDIR= $ans"
def=$libdir
readln "Tcl library directory [$def]?" "$def"
echo >>Makefile.custom "TCL_LIBDIR= $ans"
def="7.5"
readln "Tcl version [$def]?" "$def"
echo >>Makefile.custom "TCL_LIB= -ltcl$ans"
def=$incdir
readln "Tk include directory [$def]?" "$def"
echo >>Makefile.custom "TK_INCDIR= $ans"
def=$libdir
readln "Tk library directory [$def]?" "$def"
echo >>Makefile.custom "TK_LIBDIR= $ans"
def="4.1"
readln "Tk version [$def]?" "$def"
echo >>Makefile.custom "TK_LIB= -ltk$ans"
def="/usr/include"
readln "X11 include directory [$def]?" "$def"
echo >>Makefile.custom "X11_INCDIR= $ans"
def="/usr/lib"
readln "X11 library directory [$def]?" "$def"
echo >>Makefile.custom "X11_LIBDIR= $ans"
echo " "
echo "If you need to enter more than one library, the second"
echo "and subsequent ones should be preceeded by -l"
def="X11"
readln "X11 library [$def]?" "$def"
echo >>Makefile.custom "X11_LIB= $ans"
fi
echo " "
echo "Which BSD-compatible Install utility do you wish to use?"
echo "Under Irix the default will chown all your installed files"
echo "to root, so you are recommended to obtain ginstall"
readln "Enter program name: [system default]" "DEFAULT"
if [ "$ans" != "DEFAULT" ] ; then
echo >>Makefile.custom "CUSTOM_INSTALL= $ans"
fi
echo " "
bool "Do you wish the psql program to use the GNU readline library?" "n"
if [ "$ans" = "y" ] ; then
echo >>Makefile.custom "USE_READLINE= true"
echo " "
echo "If the include files for any of the following libraries are"
echo "split across multiple directories, you should put a -I before"
echo "the second and subsequent directories. For example:"
echo "/usr/local/include -I/usr/local/include/readline"
echo " "
### Readline library ###
def=$incdir
readln "Readline include directory [$def]" "$def"
echo >>Makefile.custom "READLINE_INC= -I$ans"
rldirdef=$libdir
readln "Readline library directory [$rldirdef]" "$rldirdef"
rldir=$ans
rllibdef="readline"
readln "Name of the readline library [$rllibdef]" "$rllibdef"
rllib=$ans
echo >>Makefile.custom "READLINE_LIB= -L$rldir -l$rllib"
### Curses library ###
crdirdef=$libdir
readln "Curses library directory [$crdirdef]" "$crdirdef"
crdir=$ans
crlibdef="curses"
readln "Name of the curses library [$crlibdef]" "$crlibdef"
crlib=$ans
echo >>Makefile.custom "CURSES_LIB= -L$crdir -l$crlib"
### Separate history library ###
bool "Does your readline have a separate history library?" "n"
if [ "$ans" != "n" ] ; then
def="$incdir -I$incdir/readline"
readln "History include directory [$def]" "$def"
echo >>Makefile.custom "HISTORY_INC= -I$ans"
histdirdef="$libdir"
readln "History library directory [$histdirdef]" "$histdirdef"
histdir=$ans
histlibdef="history"
readln "Name of the history library [$histlibdef]" "$histlibdef"
histlib=$ans
echo >>Makefile.custom "HISTORY_LIB= -L$histdir -l$histlib"
fi
fi
echo " "
readln "Specify C compiler: [cc]" "DEFAULT"
if [ "$ans" != "DEFAULT" ] ; then
echo >>Makefile.custom "CUSTOM_CC= $ans"
fi
readln "Specify any custom C compilation flags: [none]" "DEFAULT"
if [ "$ans" != "DEFAULT" ] ; then
echo >>Makefile.custom "CUSTOM_COPT= $ans"
fi
echo " "
echo "You may choose to switch of assert checking. This will speed the"
echo "program up, but may miss some potentially fatal bugs!"
bool "Switch off assert checking" "n"
if [ "$ans" = "y" ] ; then
echo >>Makefile.custom "CASSERT= "
fi