glib-config-2.0.in 1.91 KB
Newer Older
Owen Taylor's avatar
Owen Taylor committed
1 2 3 4 5 6
#!/bin/sh

prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no

Tim Janik's avatar
Tim Janik committed
7 8 9 10 11 12 13 14 15 16 17 18 19
usage()
{
	cat <<EOF
Usage: glib-config [OPTIONS] [LIBRARIES]
Options:
	[--prefix[=DIR]]
	[--exec-prefix[=DIR]]
	[--version]
	[--libs]
	[--cflags]
Libraries:
	glib
	gmodule
Tim Janik's avatar
Tim Janik committed
20
	gobject
21
	gthread
Tim Janik's avatar
Tim Janik committed
22 23 24
EOF
	exit $1
}
Owen Taylor's avatar
Owen Taylor committed
25 26

if test $# -eq 0; then
Tim Janik's avatar
Tim Janik committed
27
	usage 1 1>&2
Owen Taylor's avatar
Owen Taylor committed
28 29
fi

Tim Janik's avatar
Tim Janik committed
30 31
lib_glib=yes

Owen Taylor's avatar
Owen Taylor committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45
while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      if test $exec_prefix_set = no ; then
        exec_prefix=$optarg
      fi
      ;;
    --prefix)
Tim Janik's avatar
Tim Janik committed
46
      echo_prefix=yes
Owen Taylor's avatar
Owen Taylor committed
47 48 49 50 51 52
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      exec_prefix_set=yes
      ;;
    --exec-prefix)
Tim Janik's avatar
Tim Janik committed
53
      echo_exec_prefix=yes
Owen Taylor's avatar
Owen Taylor committed
54 55 56
      ;;
    --version)
      echo @GLIB_VERSION@
Tim Janik's avatar
Tim Janik committed
57
      exit 0
Owen Taylor's avatar
Owen Taylor committed
58 59
      ;;
    --cflags)
60
      includes="-I@includedir@/glib-2.0"
Tim Janik's avatar
Tim Janik committed
61
      echo_cflags=yes
Owen Taylor's avatar
Owen Taylor committed
62 63
      ;;
    --libs)
Tim Janik's avatar
Tim Janik committed
64 65 66 67 68 69 70
      echo_libs=yes
      ;;
    glib)
      lib_glib=yes
      ;;
    gmodule)
      lib_gmodule=yes
Owen Taylor's avatar
Owen Taylor committed
71
      ;;
Tim Janik's avatar
Tim Janik committed
72 73 74
    gobject)
      lib_gobject=yes
      ;;
75 76 77
    gthread)
      lib_gthread=yes
      ;;
Owen Taylor's avatar
Owen Taylor committed
78
    *)
Tim Janik's avatar
Tim Janik committed
79
      usage 1 1>&2
Owen Taylor's avatar
Owen Taylor committed
80 81 82 83 84
      ;;
  esac
  shift
done

Tim Janik's avatar
Tim Janik committed
85 86 87 88 89 90 91
if test "$echo_prefix" = "yes"; then
	echo $prefix
fi
if test "$echo_exec_prefix" = "yes"; then
	echo $exec_prefix
fi
if test "$echo_cflags" = "yes"; then
92 93 94 95
	cflags=""
	if test "$lib_gthread" = "yes"; then
		cflags="$cflags @G_THREAD_CFLAGS@"
	fi
96
	echo -I@libdir@/glib-2.0/include $includes $cflags
Tim Janik's avatar
Tim Janik committed
97 98
fi
if test "$echo_libs" = "yes"; then
99 100
	libsp=""
	libsa=""
Tim Janik's avatar
Tim Janik committed
101
	if test "$lib_glib" = "yes"; then
102
		libsp="$libsp -lglib-1.3"
Tim Janik's avatar
Tim Janik committed
103
	fi
Tim Janik's avatar
Tim Janik committed
104
	if test "$lib_gobject" = "yes"; then
105
		libsp="-lgobject-1.3 $libsp"
Tim Janik's avatar
Tim Janik committed
106
	fi
107
	if test "$lib_gthread" = "yes"; then
108
		libsp="-lgthread-1.3 $libsp"
109 110 111
		libsa="$libsa @G_THREAD_LIBS@"
	fi
	if test "$lib_gmodule" = "yes"; then
112
		libsp="@G_MODULE_LDFLAGS@ -lgmodule-1.3 $libsp"
113
		libsa="$libsa @G_MODULE_LIBS@"
114
	fi
115
	echo -L@libdir@ $libsp $libsa
Tim Janik's avatar
Tim Janik committed
116
fi