configure
author Balazs Dezso <deba@inf.elte.hu>
Mon, 27 Apr 2009 20:46:09 +0200
changeset 23 3e28dbeed635
child 34 eda742a0b1b4
permissions -rwxr-xr-x
Fix compilation order (#273)
     1 #!/bin/bash
     2 
     3 quiet=0
     4 function quiet { [[ $quiet == 1 ]]; }
     5 
     6 if [[ "$1" == "-q" ]]; then
     7   quiet=1
     8   shift
     9 fi
    10 
    11 prev=
    12 for option
    13 do
    14   if test -n "$prev"
    15   then
    16     eval "$prev=\$option"
    17     prev=
    18     continue
    19   fi
    20 
    21   optarg=`expr "x$option" : 'x[^=]*=\(.*\)'`
    22 
    23   case $option in
    24       --lemon-doc-prefix)
    25 	  prev=lemon_doc_prefix ;;
    26       --lemon-doc-prefix=*)
    27       lemon_doc_prefix=$optarg ;;
    28       --help | -h)
    29 	  cat << EOF
    30 Usage: $0 [OPTION]
    31 
    32 Options:
    33   -h, --help                  display this help and exit
    34       --lemon-doc-prefix=loc  The location of the lemon doc. By default it is
    35                               http://lemon.cs.elte.hu/pub/doc/1.0
    36 
    37 Expamle:
    38   $0 --lemon-doc-prefix=file://usr/local/share/doc/lemon/docs/
    39 EOF
    40     exit 0
    41     ;;
    42 
    43   *)
    44     cat << EOF >&2
    45 $0: unrecognized option: $option
    46 Try \`$0 --help' for more information.
    47 EOF
    48     exit 1
    49     ;;
    50 
    51   esac
    52 done
    53 
    54 
    55 if test -z "$lemon_doc_prefix"
    56 then
    57     lemon_doc_prefix='http://lemon.cs.elte.hu/pub/doc/1.0'
    58 fi
    59 lemon_doc_prefix=$(echo $lemon_doc_prefix|sed 's/\//\\\\\\\//g')
    60 
    61 lemon_cflags=$(pkg-config --cflags lemon|sed 's/\//\\\//g')
    62 lemon_libs=$(pkg-config --libs lemon|sed 's/\//\\\//g')
    63 
    64 
    65 sed -e "s/@lemon_cflags@/${lemon_cflags}/g" \
    66     -e "s/@lemon_libs@/${lemon_libs}/g" \
    67    -e "s/@make_lemon_doc_prefix@/${lemon_doc_prefix}/g" \
    68     < Makefile.in > Makefile