Cygwin support contributed by Stefan Ondrejicka <ondrej@idata.sk>.
[platform/upstream/glib.git] / glib-config-2.0.in
1 #!/bin/sh
2
3 prefix=@prefix@
4 exec_prefix=@exec_prefix@
5 exec_prefix_set=no
6
7 usage()
8 {
9         cat <<EOF
10 Usage: glib-config-2.0 [OPTIONS] [LIBRARIES]
11 Options:
12         [--prefix[=DIR]]
13         [--exec-prefix[=DIR]]
14         [--version]
15         [--libs]
16         [--cflags]
17         [--help]
18 Libraries:
19         glib
20         gmodule
21         gobject
22         gthread
23 EOF
24         exit $1
25 }
26
27 if test $# -eq 0; then
28         usage 1 1>&2
29 fi
30
31 lib_glib=yes
32
33 while test $# -gt 0; do
34   case "$1" in
35   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
36   *) optarg= ;;
37   esac
38
39   case $1 in
40     --prefix=*)
41       prefix=$optarg
42       if test $exec_prefix_set = no ; then
43         exec_prefix=$optarg
44       fi
45       ;;
46     --prefix)
47       echo_prefix=yes
48       ;;
49     --exec-prefix=*)
50       exec_prefix=$optarg
51       exec_prefix_set=yes
52       ;;
53     --exec-prefix)
54       echo_exec_prefix=yes
55       ;;
56     --version)
57       echo @GLIB_VERSION@
58       exit 0
59       ;;
60     --cflags)
61       includes="-I@includedir@/glib-2.0"
62       echo_cflags=yes
63       ;;
64     --libs)
65       echo_libs=yes
66       ;;
67     glib)
68       lib_glib=yes
69       ;;
70     gmodule)
71       lib_gmodule=yes
72       ;;
73     gobject)
74       lib_gobject=yes
75       ;;
76     gthread)
77       lib_gthread=yes
78       ;;
79     --help | -h)
80       usage 0 1>&2
81       ;;
82     *)
83       usage 1 1>&2
84       ;;
85   esac
86   shift
87 done
88
89 if test "$echo_prefix" = "yes"; then
90         echo $prefix
91 fi
92 if test "$echo_exec_prefix" = "yes"; then
93         echo $exec_prefix
94 fi
95 if test "$echo_cflags" = "yes"; then
96         cflags=""
97         if test "$lib_gthread" = "yes"; then
98                 cflags="$cflags @G_THREAD_CFLAGS@"
99         fi
100         echo -I@libdir@/glib-2.0/include $includes $cflags
101 fi
102 if test "$echo_libs" = "yes"; then
103         libsp=""
104         libsa=""
105         if test "$lib_glib" = "yes"; then
106                 libsp="$libsp -lglib-1.3"
107                 libsa="$libsa @ICONV_LIBS@ @INTLLIBS@" 
108         fi
109         if test "$lib_gobject" = "yes"; then
110                 libsp="-lgobject-1.3 $libsp"
111         fi
112         if test "$lib_gthread" = "yes"; then
113                 libsp="-lgthread-1.3 $libsp"
114                 libsa="$libsa @G_THREAD_LIBS@"
115         fi
116         if test "$lib_gmodule" = "yes"; then
117                 libsp="@G_MODULE_LDFLAGS@ -lgmodule-1.3 $libsp"
118                 libsa="$libsa @G_MODULE_LIBS@"
119         fi
120         echo -L@libdir@ $libsp $libsa
121 fi