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