1 | #!/bin/sh |
---|
2 | |
---|
3 | prefix="@prefix@" |
---|
4 | exec_prefix="@exec_prefix@" |
---|
5 | bindir="@bindir@" |
---|
6 | includedir="@includedir@" |
---|
7 | libdir="@libdir@" |
---|
8 | PACKAGE_VERSION="@PACKAGE_VERSION@" |
---|
9 | # PTHREAD_CFLAGS="@PTHREAD_CFLAGS@" |
---|
10 | # PTHREAD_LIBS="@PTHREAD_LIBS@" |
---|
11 | |
---|
12 | openal_dynamic_ldflags="-lopenal" |
---|
13 | # TODO: configure should provide the following... |
---|
14 | openal_static_ldflags="-lopenal" |
---|
15 | |
---|
16 | prefix_set=no |
---|
17 | echo_prefix=no |
---|
18 | exec_prefix_set=no |
---|
19 | echo_exec_prefix=no |
---|
20 | bindir_set=no |
---|
21 | echo_bindir=no |
---|
22 | includedir_set=no |
---|
23 | echo_includedir=no |
---|
24 | libdir_set=no |
---|
25 | echo_libdir=no |
---|
26 | echo_version=no |
---|
27 | echo_cflags=no |
---|
28 | static_libs=no |
---|
29 | echo_libs=no |
---|
30 | |
---|
31 | usage() |
---|
32 | { |
---|
33 | cat <<EOF 1>&2 |
---|
34 | Usage: openal-config [OPTIONS] |
---|
35 | Options: |
---|
36 | --prefix[=DIR] print/set default prefix |
---|
37 | --exec-prefix[=DIR] print/set prefix for machine-specific files |
---|
38 | --bindir[=DIR] print/set prefix for executable programs |
---|
39 | --includedir[=DIR] print/set prefix for include files |
---|
40 | --libdir[=DIR] print/set prefix for libraries |
---|
41 | --version print OpenAL package version |
---|
42 | --cflags print flags for C compiler |
---|
43 | --static specify that static linker flags are wanted |
---|
44 | --libs print flags for linker |
---|
45 | EOF |
---|
46 | exit 1 |
---|
47 | } |
---|
48 | |
---|
49 | if test $# -eq 0; then |
---|
50 | usage |
---|
51 | fi |
---|
52 | |
---|
53 | while test $# -gt 0; do |
---|
54 | case "$1" in |
---|
55 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; |
---|
56 | *) optarg="" ;; |
---|
57 | esac |
---|
58 | |
---|
59 | case $1 in |
---|
60 | --prefix=*) |
---|
61 | prefix="${optarg}" |
---|
62 | prefix_set="yes" |
---|
63 | ;; |
---|
64 | --prefix) |
---|
65 | echo_prefix="yes" |
---|
66 | ;; |
---|
67 | --exec-prefix=*) |
---|
68 | exec_prefix="${optarg}" |
---|
69 | exec_prefix_set="yes" |
---|
70 | ;; |
---|
71 | --exec-prefix) |
---|
72 | echo_exec_prefix="yes" |
---|
73 | ;; |
---|
74 | --bindir=*) |
---|
75 | bindir="${optarg}" |
---|
76 | bindir_set="yes" |
---|
77 | ;; |
---|
78 | --bindir) |
---|
79 | echo_bindir="yes" |
---|
80 | ;; |
---|
81 | --includedir=*) |
---|
82 | includedir="${optarg}" |
---|
83 | includedir_set="yes" |
---|
84 | ;; |
---|
85 | --includedir) |
---|
86 | echo_includedir="yes" |
---|
87 | ;; |
---|
88 | --libdir=*) |
---|
89 | libdir="${optarg}" |
---|
90 | libdir_set="yes" |
---|
91 | ;; |
---|
92 | --libdir) |
---|
93 | echo_libdir="yes" |
---|
94 | ;; |
---|
95 | --version) |
---|
96 | echo_version="yes" |
---|
97 | ;; |
---|
98 | --cflags) |
---|
99 | echo_cflags="yes" |
---|
100 | ;; |
---|
101 | --static) |
---|
102 | static_libs="yes" |
---|
103 | ;; |
---|
104 | --libs) |
---|
105 | echo_libs="yes" |
---|
106 | ;; |
---|
107 | *) |
---|
108 | usage |
---|
109 | ;; |
---|
110 | esac |
---|
111 | shift |
---|
112 | done |
---|
113 | |
---|
114 | if test "${echo_prefix}" = "yes"; then |
---|
115 | echo "${prefix}" |
---|
116 | fi |
---|
117 | |
---|
118 | if test "${exec_prefix_set}" = "no" && test "${prefix_set}" = "yes"; then |
---|
119 | exec_prefix="$prefix" |
---|
120 | exec_prefix_set="yes" |
---|
121 | fi |
---|
122 | |
---|
123 | if test "$echo_exec_prefix" = "yes"; then |
---|
124 | echo "${exec_prefix}" |
---|
125 | fi |
---|
126 | |
---|
127 | if test "${bindir_set}" = "no" && test "${exec_prefix_set}" = "yes"; then |
---|
128 | bindir="${exec_prefix}/bin" |
---|
129 | fi |
---|
130 | |
---|
131 | if test "$echo_bindir" = "yes"; then |
---|
132 | echo "${bindir}" |
---|
133 | fi |
---|
134 | |
---|
135 | if test "${includedir_set}" = "no" && test "${prefix_set}" = "yes"; then |
---|
136 | includedir="${prefix}/include" |
---|
137 | fi |
---|
138 | |
---|
139 | if test "$echo_includedir" = "yes"; then |
---|
140 | echo "${includedir}" |
---|
141 | fi |
---|
142 | |
---|
143 | if test "${libdir_set}" = "no" && test "${exec_prefix_set}" = "yes"; then |
---|
144 | libdir="${exec_prefix}/lib" |
---|
145 | fi |
---|
146 | |
---|
147 | if test "$echo_libdir" = "yes"; then |
---|
148 | echo "${libdir}" |
---|
149 | fi |
---|
150 | |
---|
151 | if test "$echo_version" = "yes"; then |
---|
152 | echo "${PACKAGE_VERSION}" |
---|
153 | fi |
---|
154 | |
---|
155 | if test "$echo_cflags" = "yes"; then |
---|
156 | if test "${includedir}" = "/usr/include" ; then |
---|
157 | incpath="" |
---|
158 | else |
---|
159 | incpath="-I${includedir}" |
---|
160 | fi |
---|
161 | echo "${PTHREAD_CFLAGS} ${incpath}" |
---|
162 | fi |
---|
163 | |
---|
164 | if test "$echo_libs" = "yes"; then |
---|
165 | if test "${libdir}" = "/usr/lib" ; then |
---|
166 | libpathflag="" |
---|
167 | else |
---|
168 | libpathflag="-L${libdir}" |
---|
169 | fi |
---|
170 | if test "${static_libs}" = "yes"; then |
---|
171 | ldflags="${openal_static_ldflags}" |
---|
172 | else |
---|
173 | ldflags="${openal_dynamic_ldflags}" |
---|
174 | fi |
---|
175 | echo "${libpathflag} ${ldflags} ${PTHREAD_LIBS}" |
---|
176 | fi |
---|