#!/bin/bash PACKAGE=rockplug VERSION=0.0.99 PREFIX="" EPREFIX=\${PREFIX} BINDIR=\${EPREFIX}/bin SBINDIR=\${EPREFIX}/sbin SYSCONFDIR=\${PREFIX}/etc LOCALSTATEDIR=\${PREFIX}/var DOCDIR=\${PREFIX}/doc PCI_IDS=/usr/share/pci.ids USB_IDS=/usr/share/usb.ids ISAPNP_IDS=/usr/share/isapnp.ids DISTSYSCONF=/etc/conf TARGET=full usage() { cat <<-EOF \`configure\' configures ROCKPLUG to adapt to many kinds of systems. Usage: ./configure [OPTION]... Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit Installation directories: --root=ROOT installation root directory [$ROOT] --prefix=PREFIX install architecture-independent files in PREFIX [$PREFIX] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [$EPREFIX] By default, \`make install\' will install all the files in \`/sbin\', \`/etc\' etc. You can specify an installation prefix other than \`/usr/local\' using \`--prefix\', for instance \`--prefix=$HOME\'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [$BINDIR] --sbindir=DIR system admin executables [$SBINDIR] --sysconfdir=DIR read-only single-machine data [$SYSCONFDIR] --localstatedir=DIR modifiable single-machine data [$LOCALSTATEDIR] --docdir=DIR documentation directory [$DOCDIR] Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-pci-ids=path set full path to pci.ids [$PCI_IDS] --with-usb-ids=path set full path to usb.ids [$USB_IDS] --with-isapnp-ids=path set full path to isapnp.ids [$ISAPNP_IDS] --with-sysconf=path set distribution sysconfig path [$DISTSYSCONF] Targets --enable-target=target install target specific files: full,embedded see README for further info [$TARGET] Report bugs to . EOF } for arg; do option=`expr "x$arg" : 'x\([^=]*\)'` withopt=`expr "x$arg" : 'x--with-\([^=]*\)'` withoutopt=`expr "x$arg" : 'x--with-\([^=]*\)'` enableopt=`expr "x$arg" : 'x--enable-\([^=]*\)'` disableopt=`expr "x$arg" : 'x--disable-\([^=]*\)'` optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'` case "$option" in -h|--help) usage exit ;; --prefix) PREFIX=$optarg ;; --exec-prefix) EPREFIX=$optarg ;; --bindir) BINDIR=$optarg ;; --sbindir) SBINDIR=$optarg ;; --datadir) DATADIR=$optarg ;; --sysconfdir) SYSCONFDIR=$optarg ;; --localstatedir) LOCALSTATEDIR=$optarg ;; --libdir) LIBDIR=$optarg ;; --infodir) INFODIR=$optarg ;; --mandir) MANDIR=$optarg ;; --enable-*) eval "enable_$enableopt=yes" ;; --disable-*) eval "enable_$enableopt=no" ;; --with-*) eval "with_$withopt=${optarg:-yes}" ;; --without-*) #@FIXME eval "without_$withoutopt=${optarg:-yes}" ;; *) echo "Skipping option \"$arg\""; ;; esac done ############################################################################# # checks for programs ############################################################################# #check_program_failed program check_program_failed() { echo echo "*** program $1 not found" exit -1 } #check_program_failed_in_PATH program check_program_failed_in_PATH() { echo echo "*** program $1 not found in PATH=$PATH" exit -1 } #check_program program [failed] [success] check_program() { echo -n "Checking for $1..." found=0 if [ -x $1 ]; then found=1 else path="`type -p $1`" if [ -x "$path" -a -n "$path" ]; then found=1 fi fi if [ "$found" -eq 1 ]; then if [ -n "$3" ]; then eval "$3" fi echo " ok"; else if [ -n "$2" ]; then eval "$2" else echo " failed" fi return 1 fi return 0 } ############################################################################# # autoconf style variable replacement ############################################################################# substf=subs.sed subst_create() { rm -f $substf sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >$substf <> $substf" } subst_run() { local list="$*" [ -z "$list" ] && list="`find . -name '*.in'`" local each ; for each in $list; do file="`echo $each | sed "s,.in$,,"`" echo "Creating $file from $each" cat $each | sed -f $substf > $file done } subst_create TOP=`dirname $0` subst TOP subst PREFIX subst EPREFIX subst BINDIR subst SBINDIR subst SYSCONFDIR subst LOCALSTATEDIR subst DOCDIR subst PCI_IDS subst USB_IDS subst ISAPNP_IDS subst TARGET subst DISTSYSCONF ############################################################################# ############################################################################# ############################################################################# export PATH=/bin:/sbin:/usr/sbin:/usr/bin check_program sed "check_program_failed_in_PATH sed" check_program grep "check_program_failed_in_PATH grep" check_program hexdump "check_program_failed_in_PATH hexdump" check_program /bin/bash "check_program_failed /bin/bash" echo -n "Checking for bash version..." BASH_VERSION="`/bin/bash --version | grep version | sed 's,.*version \([^.]*\).*,\1,'`" if [ "$BASH_VERSION" -ne 2 ]; then echo echo echo "*** bash version 2.0 or higher required" exit -1 fi echo " $BASH_VERSION" if ! check_program gawk; then check_program awk "check_program_failed_in_PATH [g]awk" fi check_program logger '' "LOGGER=\$path" ; subst LOGGER check_program modprobe check_program rmmod check_program touch check_program chmod check_program chown check_program chgrp check_program cat check_program tr subst_run chmod 0755 install-rockplug.sh # Local variables: # mode: shell-script # basic-offset: 2 # End: