configure
author Alpar Juttner <alpar@cs.elte.hu>
Wed, 05 Nov 2008 17:10:54 +0000
changeset 17 0b3b26cd1cea
child 34 eda742a0b1b4
permissions -rwxr-xr-x
Better build system

- configure script added
- demo/*.cc are now compiled (the executables are in demo/build)
- version number appears in the doc and automatically updates
- the cross reference to the lemon doc can be relocated (e.g. to a local
copy of the doc)
- some repo reorganization has taken place
- better .hgignore
alpar@17
     1
#!/bin/bash
alpar@17
     2
alpar@17
     3
quiet=0
alpar@17
     4
function quiet { [[ $quiet == 1 ]]; }
alpar@17
     5
alpar@17
     6
if [[ "$1" == "-q" ]]; then
alpar@17
     7
  quiet=1
alpar@17
     8
  shift
alpar@17
     9
fi
alpar@17
    10
alpar@17
    11
prev=
alpar@17
    12
for option
alpar@17
    13
do
alpar@17
    14
  if test -n "$prev"
alpar@17
    15
  then
alpar@17
    16
    eval "$prev=\$option"
alpar@17
    17
    prev=
alpar@17
    18
    continue
alpar@17
    19
  fi
alpar@17
    20
alpar@17
    21
  optarg=`expr "x$option" : 'x[^=]*=\(.*\)'`
alpar@17
    22
alpar@17
    23
  case $option in
alpar@17
    24
      --lemon-doc-prefix)
alpar@17
    25
	  prev=lemon_doc_prefix ;;
alpar@17
    26
      --lemon-doc-prefix=*)
alpar@17
    27
      lemon_doc_prefix=$optarg ;;
alpar@17
    28
      --help | -h)
alpar@17
    29
	  cat << EOF
alpar@17
    30
Usage: $0 [OPTION]
alpar@17
    31
alpar@17
    32
Options:
alpar@17
    33
  -h, --help                  display this help and exit
alpar@17
    34
      --lemon-doc-prefix=loc  The location of the lemon doc. By default it is
alpar@17
    35
                              http://lemon.cs.elte.hu/pub/doc/1.0
alpar@17
    36
alpar@17
    37
Expamle:
alpar@17
    38
  $0 --lemon-doc-prefix=file://usr/local/share/doc/lemon/docs/
alpar@17
    39
EOF
alpar@17
    40
    exit 0
alpar@17
    41
    ;;
alpar@17
    42
alpar@17
    43
  *)
alpar@17
    44
    cat << EOF >&2
alpar@17
    45
$0: unrecognized option: $option
alpar@17
    46
Try \`$0 --help' for more information.
alpar@17
    47
EOF
alpar@17
    48
    exit 1
alpar@17
    49
    ;;
alpar@17
    50
alpar@17
    51
  esac
alpar@17
    52
done
alpar@17
    53
alpar@17
    54
alpar@17
    55
if test -z "$lemon_doc_prefix"
alpar@17
    56
then
alpar@17
    57
    lemon_doc_prefix='http://lemon.cs.elte.hu/pub/doc/1.0'
alpar@17
    58
fi
alpar@17
    59
lemon_doc_prefix=$(echo $lemon_doc_prefix|sed 's/\//\\\\\\\//g')
alpar@17
    60
alpar@17
    61
lemon_cflags=$(pkg-config --cflags lemon|sed 's/\//\\\//g')
alpar@17
    62
lemon_libs=$(pkg-config --libs lemon|sed 's/\//\\\//g')
alpar@17
    63
alpar@17
    64
alpar@17
    65
sed -e "s/@lemon_cflags@/${lemon_cflags}/g" \
alpar@17
    66
    -e "s/@lemon_libs@/${lemon_libs}/g" \
alpar@17
    67
   -e "s/@make_lemon_doc_prefix@/${lemon_doc_prefix}/g" \
alpar@17
    68
    < Makefile.in > Makefile