#!/bin/csh -f set INPUT_FILE = Makefile_start set OUTPUT_FILE = Makefile set INSTALLDIR = /usr/local/bin if ( ${#argv} > 0 ) then if ( $1 == "--install-dir" ) then if ( ${#argv} < 2 ) then echo "--install-dir requires a directory" exit else set INSTALLDIR = $2 endif else echo "Unidentified argument $1" exit endif endif set type = "Unknown" set UNAME = `uname -a` if ( ` echo $UNAME | grep Linux | wc | awk '{print $1;}' ` == 1 ) then if ( ` echo $UNAME | grep 'i[3456]86' | wc | awk '{print $1};'` == 1 ) then set type = "Linux_x86" else set type = "Linux_Unknown" endif endif if ( ` echo $UNAME | grep Darwin | wc | awk '{print $1;}' ` == 1 ) then set type = "MacOSX" endif if ( ` echo $UNAME | grep SunOS | wc | awk '{print $1;}' ` == 1 ) then set type = "SunOS5" endif if ( ` echo $UNAME | grep IRIX | wc | awk '{print $1;}' ` == 1 ) then set type = "IRIX" endif #POSTFIX=REPLACE_POSTFIX #CC = REPLACE_CC #RANLIB=REPLACE_RANLIB #INSTALLDIR=REPLACE_INSTALLDIR if ( $type == "Linux_x86" ) then cat $INPUT_FILE | \ sed 's/REPLACE_CC/CC="cc -Wall"/' | \ sed 's/REPLACE_RANLIB/RANLIB="ranlib"/' | \ sed "s|REPLACE_INSTALLDIR|${INSTALLDIR}|" | \ sed 's/REPLACE_POSTFIX/_i386/' > $OUTPUT_FILE else if ( $type == "Linux_Unknown" ) then cat $INPUT_FILE | \ sed 's/REPLACE_CC/CC="cc -Wall"/' | \ sed 's/REPLACE_RANLIB/RANLIB="ranlib"/' | \ sed "s|REPLACE_INSTALLDIR|${INSTALLDIR}|" | \ sed 's/REPLACE_POSTFIX//' > $OUTPUT_FILE else if ( $type == "MacOSX" ) then cat $INPUT_FILE | \ sed 's/REPLACE_CC/CC="cc -Wall"/' | \ sed 's/REPLACE_RANLIB/RANLIB="ranlib -s"/' | \ sed "s|REPLACE_INSTALLDIR|${INSTALLDIR}|" | \ sed 's/REPLACE_POSTFIX/_osx/' > $OUTPUT_FILE else if ( $type == "SunOS5" ) then cat $INPUT_FILE | \ sed 's|REPLACE_CC|CC="/tsri/SunOS5/SunWorkShop/SUNWspro/bin/cc"|' | \ sed 's/REPLACE_RANLIB/RANLIB="echo Skipping ranlib"/' | \ sed "s|REPLACE_INSTALLDIR|${INSTALLDIR}|" | \ sed 's/REPLACE_POSTFIX/_sunos5/' > $OUTPUT_FILE else if ( $type == "IRIX" ) then cat $INPUT_FILE | \ sed 's|REPLACE_CC|CC="/tsri/gnu/sgi4DIRIX6/bin/gcc"|' | \ sed 's/REPLACE_RANLIB/RANLIB="echo Skipping ranlib"/' | \ sed "s|REPLACE_INSTALLDIR|${INSTALLDIR}|" | \ sed 's/REPLACE_POSTFIX/_irix/' > $OUTPUT_FILE else # Unknown operating system cat $INPUT_FILE | \ sed 's/REPLACE_CC/"CC=cc"/' | \ sed 's/REPLACE_RANLIB/RANLIB="echo Skipping ranlib"/' | \ sed "s|REPLACE_INSTALLDIR|${INSTALLDIR}|" | \ sed 's/REPLACE_POSTFIX//' > $OUTPUT_FILE endif echo echo echo "Bibutils Configuration" echo "----------------------" echo echo "Configured $OUTPUT_FILE to operating system $type." echo " If auto-identification of operating system failed, please" echo " e-mail cdputnam@ucsd.edu with the system type and output of" echo " the command: uname -a" echo echo "Set installation directory to $INSTALLDIR." echo " To modify install directory type: configure --install-dir DIR" echo " where DIR is the desired directory." echo if ( $OUTPUT_FILE == "Makefile" ) then echo "To compile, type: make" echo "To install, type: make install" echo "To make tgz package, type: make package" echo "To make deb package, type: make deb" else echo "To compile, type: make -f $OUTPUT_FILE" echo "To install, type: make -f $OUTPUT_FILE install" echo "To make tgz package, type: make -f $OUTPUT_FILE package" echo "To make deb package, type: make -f $OUTPUT_FILE deb" endif echo echo