7a53ed29b79155d18bcc99607af77e0ab84e189c
[gedcom-parse.git] / gedcom-config.in
1 #!/bin/sh
2
3 prefix=@prefix@
4 exec_prefix=@exec_prefix@
5 exec_prefix_set=no
6 version=@VERSION@
7
8 gedcom_libs="-L@libdir@ -lgedcom -lutf8tools"
9 gedcom_cflags="-I@includedir@"
10 gedcom_gom_libs="-L@libdir@ -lgedcom_gom -lgedcom -lutf8tools"
11 gedcom_gom_cflags="-I@includedir@"
12
13 usage()
14 {
15         cat <<EOF
16 Usage: gedcom-config [OPTIONS] [LIBRARIES]
17 Options:
18         [--prefix[=DIR]]
19         [--exec-prefix[=DIR]]
20         [--version]
21         [--libs]
22         [--cflags]
23 Libraries:
24         gom
25 EOF
26         exit $1
27 }
28
29 while test $# -gt 0; do
30   case "$1" in
31   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
32   *) optarg= ;;
33   esac
34
35   case $1 in
36     --prefix=*)
37       prefix=$optarg
38       if test $exec_prefix_set = no ; then
39         exec_prefix=$optarg
40       fi
41       ;;      
42     --prefix)
43       echo_prefix=yes
44       ;;
45     --exec-prefix=*)
46       exec_prefix=$optarg
47       exec_prefix_set=yes
48       ;;
49     --exec-prefix)
50       echo_exec_prefix=yes
51       ;;
52     --version)
53       echo $version
54       ;;
55     --cflags)
56       echo_cflags=yes
57       ;;
58     --libs)
59       echo_libs=yes
60       ;;
61     gom)
62       lib_gom=yes
63       ;;
64     *)
65       usage 1 1>&2
66       ;;
67   esac
68   shift
69 done
70
71 if test "$echo_prefix" = "yes"; then
72         echo $prefix
73 fi
74
75 if test "$echo_exec_prefix" = "yes"; then
76         echo $exec_prefix
77 fi
78
79 if test "$lib_gom" = "yes"; then
80       gedcom_cflags="$gedcom_gom_cflags"
81       gedcom_libs="$gedcom_gom_libs"
82 fi
83
84 if test "$echo_cflags" = "yes"; then
85       echo $gedcom_cflags
86 fi
87
88 if test "$echo_libs" = "yes"; then
89       echo $gedcom_libs
90 fi