#!/bin/bash quiet=0 function quiet { [[ $quiet == 1 ]]; } if [[ "$1" == "-q" ]]; then quiet=1 shift fi prev= for option do if test -n "$prev" then eval "$prev=\$option" prev= continue fi optarg=`expr "x$option" : 'x[^=]*=\(.*\)'` case $option in --lemon-doc-prefix) prev=lemon_doc_prefix ;; --lemon-doc-prefix=*) lemon_doc_prefix=$optarg ;; --help | -h) cat << EOF Usage: $0 [OPTION] Options: -h, --help display this help and exit --lemon-doc-prefix=loc The location of the lemon doc. By default it is http://lemon.cs.elte.hu/pub/doc/1.0 Expamle: $0 --lemon-doc-prefix=file://usr/local/share/doc/lemon/docs/ EOF exit 0 ;; *) cat << EOF >&2 $0: unrecognized option: $option Try \`$0 --help' for more information. EOF exit 1 ;; esac done if test -z "$lemon_doc_prefix" then lemon_doc_prefix='http://lemon.cs.elte.hu/pub/doc/1.0' fi lemon_doc_prefix=$(echo $lemon_doc_prefix|sed 's/\//\\\\\\\//g') lemon_cflags=$(pkg-config --cflags lemon|sed 's/\//\\\//g') lemon_libs=$(pkg-config --libs lemon|sed 's/\//\\\//g') sed -e "s/@lemon_cflags@/${lemon_cflags}/g" \ -e "s/@lemon_libs@/${lemon_libs}/g" \ -e "s/@make_lemon_doc_prefix@/${lemon_doc_prefix}/g" \ < Makefile.in > Makefile