#!/bin/sh # # $Id: configure,v 1.4 2006/09/15 14:16:55 toad32767 Exp $ # # Configure script for UModPlayer B3 # This is a very small & simple script which modifies the Makefile # to set a user-specified prefix. # Its options are more or less the same that of GNU autoconf configure scripts. # # All of this code is under Public Domain. In case it's not legally possible, # permission is granted to anyone to use it for any purpose. # display the usage usage () { echo "usage: $0 [--prefix=]" } # replace (escape) the '/' character with '\/' addslashes () { # sed s:/:\/:g echo "$1" | sed 's/\//\\\//g' } # test if we have arguments if [ $# -gt 0 ] then if [ "$1" = "--help" ] then usage exit 0 else prefix=`echo "$1" | sed 's/^\([^=]*=\)//g'` if [ "$prefix" = "" ] then usage exit 1 fi fi else # default prefix prefix="/usr/local" fi if [ ! -r Makefile.in ] then echo "error: missing or unreadable " exit 2 fi # replace the @PREFIX@ tag with the appropriate content prefix=`addslashes "$prefix"` os=`uname` echo "$0: creating Makefile" # some preprocessing. see the Makefile.in file for comments if [ "$os" = "NetBSD" ] then prg1='awk' param1='/^@if_NetBSD@/ {gsub(/\@\@ /, "\n"); gsub(/\@[^\@]*\@/, "");} {print $0;}' else prg1='sed' param1='s/^@if_NetBSD.*$//g' fi if (test -d /usr/local/include && test -d /usr/local/lib) then prg2='awk' param2='/^@if_usr_local@/ {gsub(/\@\@ /, "\n"); gsub(/\@[^\@]*\@/, "");} {print $0;}' else prg2='sed' param2='s/^@if_usr_local.*$//g' fi sed="s/@PREFIX@/$prefix/g" cat Makefile.in | $prg1 "$param1" | $prg2 "$param2" | sed "$sed" > Makefile # create a simple echo "$0: creating config.h" login=`whoami` date=`date` echo >> config.h echo '/* edited by configure */' >> config.h echo "#define COMPILATION_DATE \"compiled by $login at $date on $os\"" >> config.h echo >> config.h echo "--- Please make sure you have the following" echo "--- libraries installed:" echo " [*] libmodplug >= 0.8" echo " freely available on " echo " [*] libao" echo " freely available on " echo " [*] libaiff >= 1.1" echo " freely available on " exit 0