|
| 1 | +#!/bin/sh |
| 2 | +#************************************************************************* |
| 3 | +# |
| 4 | +# Program: PostgreSQL customisation utility |
| 5 | +# File: customise |
| 6 | +# |
| 7 | +# Version: 6.0 |
| 8 | +# Date: 08.01.97 |
| 9 | +# Function: Write Makefile.custom for PostgreSQL |
| 10 | +# |
| 11 | +# Copyright: (c) Dr. Andrew C. R. Martin 1997 |
| 12 | +# Author: Dr. Andrew C. R. Martin |
| 13 | +# Address: Biomolecular Structure & Modelling Unit, |
| 14 | +# Department of Biochemistry & Molecular Biology, |
| 15 | +# University College, |
| 16 | +# Gower Street, |
| 17 | +# London. |
| 18 | +# WC1E 6BT. |
| 19 | +# EMail: martin@biochem.ucl.ac.uk |
| 20 | +# andrew@stagleys.demon.co.uk |
| 21 | +# |
| 22 | +#************************************************************************* |
| 23 | +# |
| 24 | +# This program is distributed under the copyright for PostgreSQL |
| 25 | +# |
| 26 | +#************************************************************************* |
| 27 | +# |
| 28 | +# Function: |
| 29 | +# ========= |
| 30 | +# This program prompts the user to enter basic customisation options |
| 31 | +# for a local installation of PostgreSQL. From these answers it writes |
| 32 | +# a Makefile.custom |
| 33 | +# |
| 34 | +# It is intended as a stop-gap measure until autoconf is implemeted. |
| 35 | +# |
| 36 | +#************************************************************************* |
| 37 | +# |
| 38 | +# Revision History: |
| 39 | +# ================= |
| 40 | +# V6.0 08.01.96 Original version for PostgreSQL V6.0 |
| 41 | +# |
| 42 | +#************************************************************************* |
| 43 | +# Customise the customisation! Set variables for default directories |
| 44 | +# ------------------------------------------------------------------ |
| 45 | +libdir="/usr/local/lib" |
| 46 | +incdir="/usr/local/include" |
| 47 | + |
| 48 | +#************************************************************************* |
| 49 | +# readln "prompt" "default" |
| 50 | +# ------------------------- |
| 51 | +# Reads a line into $ans. |
| 52 | +# Based on code from the Linux Configure utility |
| 53 | +# |
| 54 | +# 08.01.96 Original By: ACRM |
| 55 | +readln () { |
| 56 | + echo -n "$1 " |
| 57 | + IFS='@' read ans </dev/tty || exit 1 |
| 58 | + [ -z "$ans" ] && ans=$2 |
| 59 | +} |
| 60 | + |
| 61 | +#************************************************************************* |
| 62 | +# bool "question" "default" |
| 63 | +# ------------------------- |
| 64 | +# Ask a yes or no question |
| 65 | +# Based on code from the Linux Configure utility |
| 66 | +# |
| 67 | +# 08.01.96 Original By: ACRM |
| 68 | +bool () { |
| 69 | + ans="" |
| 70 | + def=$2 |
| 71 | + while [ "$ans" != "y" -a "$ans" != "n" ]; do |
| 72 | + readln "$1 (y/n) [$def] " "$def" |
| 73 | + done |
| 74 | +} |
| 75 | + |
| 76 | +#************************************************************************* |
| 77 | +# Start of main customise program |
| 78 | +# ------------------------------- |
| 79 | +echo "Welcome to the PostgreSQL V6.0 cutomisation utility." |
| 80 | +echo " " |
| 81 | + |
| 82 | +echo "You may build PostgreSQL for one of the following systems" |
| 83 | +echo " aix IBM on AIX 3.2.5" |
| 84 | +echo " alpha DEC Alpha AXP on OSF/1 2.0" |
| 85 | +echo " BSD44_derived OSs derived from 4.4-lite BSD (NetBSD, FreeBSD)" |
| 86 | +echo " bsdi BSD/OS 2.0, 2.01, 2.1" |
| 87 | +echo " dgux DG/UX 5.4R3.10" |
| 88 | +echo " hpux HP PA-RISC on HP-UX 9.0" |
| 89 | +echo " i386_solaris i386 Solaris" |
| 90 | +echo " irix5 SGI MIPS on IRIX 5.3 or better" |
| 91 | +echo " linux Intel x86 on Linux 1.2 and Linux ELF" |
| 92 | +echo " next Motorola MC68K or Intel x86 on NeXTSTEP 3.2" |
| 93 | +echo " sparc_solaris SUN SPARC on Solaris 2.4" |
| 94 | +echo " sunos4 SUN SPARC on SunOS 4.1.3" |
| 95 | +echo " svr4 Intel x86 on Intel SVR4" |
| 96 | +echo " ultrix4 DEC MIPS on Ultrix 4.4" |
| 97 | + |
| 98 | +readln "Enter port name:" "UNKNOWN" |
| 99 | +if [ "$ans" = "UNKNOWN" ] ; then |
| 100 | + echo "You must enter a port name from the list above." |
| 101 | + echo "Please start again!" |
| 102 | + exit 1 |
| 103 | +fi |
| 104 | + |
| 105 | +portname=$ans |
| 106 | +echo >Makefile.custom "PORTNAME= $portname" |
| 107 | + |
| 108 | +if [ "$portname" = "linux" ] ; then |
| 109 | + bool "Is this an ELF system?" "y" |
| 110 | + if [ "$ans" = "n" ] ; then |
| 111 | + echo >>Makefile.custom "LINUX_ELF= " |
| 112 | + fi |
| 113 | +fi |
| 114 | + |
| 115 | +def="/usr/local/pgsql" |
| 116 | +readln "Where do you wish to install Postgres [$def]?" "$def" |
| 117 | +if [ "$ans" != "$def" ] ; then |
| 118 | + echo >>Makefile.custom "POSTGRESDIR= $ans" |
| 119 | +fi |
| 120 | + |
| 121 | +if [ "$portname" = "irix5" ] ; then |
| 122 | + echo >>Makefile.custom "IPCSDIR= /usr/sbin" |
| 123 | +else |
| 124 | + def="/usr/bin" |
| 125 | + readln "Where are the IPCS utilities stored [$def]?" "$def" |
| 126 | + if [ "$ans" != "$def" ] ; then |
| 127 | + echo >>Makefile.custom "IPCSDIR= $ans" |
| 128 | + fi |
| 129 | +fi |
| 130 | + |
| 131 | +bool "Compile C++ library?" "n" |
| 132 | +if [ "$ans" = "y" ] ; then |
| 133 | + echo >>Makefile.custom "HAVE_Cplusplus= true" |
| 134 | +fi |
| 135 | + |
| 136 | +bool "Compile Tcl utilities?" "n" |
| 137 | +if [ "$ans" = "y" ] ; then |
| 138 | + echo >>Makefile.custom "USE_TCL= true" |
| 139 | + |
| 140 | + def=$incdir |
| 141 | + readln "Tcl include directory [$def]?" "$def" |
| 142 | + echo >>Makefile.custom "TCL_INCDIR= $ans" |
| 143 | + |
| 144 | + def=$libdir |
| 145 | + readln "Tcl library directory [$def]?" "$def" |
| 146 | + echo >>Makefile.custom "TCL_LIBDIR= $ans" |
| 147 | + |
| 148 | + def="7.5" |
| 149 | + readln "Tcl version [$def]?" "$def" |
| 150 | + echo >>Makefile.custom "TCL_LIB= -ltcl$ans" |
| 151 | + |
| 152 | + def=$incdir |
| 153 | + readln "Tk include directory [$def]?" "$def" |
| 154 | + echo >>Makefile.custom "TK_INCDIR= $ans" |
| 155 | + |
| 156 | + def=$libdir |
| 157 | + readln "Tk library directory [$def]?" "$def" |
| 158 | + echo >>Makefile.custom "TK_LIBDIR= $ans" |
| 159 | + |
| 160 | + def="4.1" |
| 161 | + readln "Tk version [$def]?" "$def" |
| 162 | + echo >>Makefile.custom "TK_LIB= -ltk$ans" |
| 163 | + |
| 164 | + def="/usr/include" |
| 165 | + readln "X11 include directory [$def]?" "$def" |
| 166 | + echo >>Makefile.custom "X11_INCDIR= $ans" |
| 167 | + |
| 168 | + def="/usr/lib" |
| 169 | + readln "X11 library directory [$def]?" "$def" |
| 170 | + echo >>Makefile.custom "X11_LIBDIR= $ans" |
| 171 | + |
| 172 | + echo " " |
| 173 | + echo "If you need to enter more than one library, the second" |
| 174 | + echo "and subsequent ones should be preceeded by -l" |
| 175 | + def="X11" |
| 176 | + readln "X11 library [$def]?" "$def" |
| 177 | + echo >>Makefile.custom "X11_LIB= $ans" |
| 178 | +fi |
| 179 | + |
| 180 | + |
| 181 | +echo " " |
| 182 | +echo "Which BSD-compatible Install utility do you wish to use?" |
| 183 | +echo "Under Irix the default will chown all your installed files" |
| 184 | +echo "to root, so you are recommended to obtain ginstall" |
| 185 | +readln "Enter program name: [system default]" "DEFAULT" |
| 186 | +if [ "$ans" != "DEFAULT" ] ; then |
| 187 | + echo >>Makefile.custom "CUSTOM_INSTALL= $ans" |
| 188 | +fi |
| 189 | +echo " " |
| 190 | + |
| 191 | +bool "Do you wish the psql program to use the GNU readline library?" "n" |
| 192 | +if [ "$ans" = "y" ] ; then |
| 193 | + echo >>Makefile.custom "USE_READLINE= true" |
| 194 | + |
| 195 | + echo " " |
| 196 | + echo "If the include files for any of the following libraries are" |
| 197 | + echo "split across multiple directories, you should put a -I before" |
| 198 | + echo "the second and subsequent directories. For example:" |
| 199 | + echo "/usr/local/include -I/usr/local/include/readline" |
| 200 | + echo " " |
| 201 | + |
| 202 | +### Readline library ### |
| 203 | + def=$incdir |
| 204 | + readln "Readline include directory [$def]" "$def" |
| 205 | + echo >>Makefile.custom "READLINE_INC= -I$ans" |
| 206 | + |
| 207 | + rldirdef=$libdir |
| 208 | + readln "Readline library directory [$rldirdef]" "$rldirdef" |
| 209 | + rldir=$ans |
| 210 | + |
| 211 | + rllibdef="readline" |
| 212 | + readln "Name of the readline library [$rllibdef]" "$rllibdef" |
| 213 | + rllib=$ans |
| 214 | + |
| 215 | + echo >>Makefile.custom "READLINE_LIB= -L$rldir -l$rllib" |
| 216 | + |
| 217 | +### Curses library ### |
| 218 | + crdirdef=$libdir |
| 219 | + readln "Curses library directory [$crdirdef]" "$crdirdef" |
| 220 | + crdir=$ans |
| 221 | + |
| 222 | + crlibdef="curses" |
| 223 | + readln "Name of the curses library [$crlibdef]" "$crlibdef" |
| 224 | + crlib=$ans |
| 225 | + |
| 226 | + echo >>Makefile.custom "CURSES_LIB= -L$crdir -l$crlib" |
| 227 | + |
| 228 | +### Separate history library ### |
| 229 | + bool "Does your readline have a separate history library?" "n" |
| 230 | + if [ "$ans" != "n" ] ; then |
| 231 | + def="$incdir -I$incdir/readline" |
| 232 | + readln "History include directory [$def]" "$def" |
| 233 | + echo >>Makefile.custom "HISTORY_INC= -I$ans" |
| 234 | + |
| 235 | + histdirdef="$libdir" |
| 236 | + readln "History library directory [$histdirdef]" "$histdirdef" |
| 237 | + histdir=$ans |
| 238 | + |
| 239 | + histlibdef="history" |
| 240 | + readln "Name of the history library [$histlibdef]" "$histlibdef" |
| 241 | + histlib=$ans |
| 242 | + |
| 243 | + echo >>Makefile.custom "HISTORY_LIB= -L$histdir -l$histlib" |
| 244 | + fi |
| 245 | +fi |
| 246 | + |
| 247 | +echo " " |
| 248 | +readln "Specify C compiler: [cc]" "DEFAULT" |
| 249 | +if [ "$ans" != "DEFAULT" ] ; then |
| 250 | + echo >>Makefile.custom "CUSTOM_CC= $ans" |
| 251 | +fi |
| 252 | + |
| 253 | +readln "Specify any custom C compilation flags: [none]" "DEFAULT" |
| 254 | +if [ "$ans" != "DEFAULT" ] ; then |
| 255 | + echo >>Makefile.custom "CUSTOM_COPT= $ans" |
| 256 | +fi |
| 257 | + |
| 258 | +echo " " |
| 259 | +echo "You may choose to switch of assert checking. This will speed the" |
| 260 | +echo "program up, but may miss some potentially fatal bugs!" |
| 261 | +bool "Switch off assert checking" "n" |
| 262 | +if [ "$ans" = "y" ] ; then |
| 263 | + echo >>Makefile.custom "CASSERT= " |
| 264 | +fi |
0 commit comments