* Tagged the 0.8.0 release.
[vlc.git] / vlc-config.in.in
blob9353452392974230f44f7ce7330a8dc59f52cf00
1 #!/bin/sh
3 prefix="@prefix@"
4 exec_prefix="@exec_prefix@"
5 exec_prefix_set=no
7 release="@release@"
8 debug="@debug@"
9 gprof="@gprof@"
10 cprof="@cprof@"
11 optim="@optim@"
13 plugins="@PLUGINS@"
14 builtins="@BUILTINS@"
16 cppflags=""
17 cflags=""
18 cxxflags=""
19 objcflags=""
20 ldflags=""
22 cflags_tuning="@CFLAGS_TUNING@"
23 cflags_optim="@CFLAGS_OPTIM@"
24 cflags_optim_nodebug="@CFLAGS_OPTIM_NODEBUG@"
25 cflags_nooptim="@CFLAGS_NOOPTIM@"
28 # Do not touch below this place unless you really know what you are doing
30 usage()
32 cat << BLAH
33 Usage: vlc-config OPTIONS MODULES
34 Options:
35 [--prefix[=DIR]] set prefix
36 [--exec-prefix[=DIR]] set exec prefix
37 [--version] print version and exit
38 [--linkage] print linkage mode (c, c++, objc)
39 [--target] print targets and exit
40 [--libs] output linking flags
41 [--cflags] output C compilation flags
42 [--cxxflags] output C++ compilation flags
43 [--objcflags] output Objective C compilation flags
44 Modules:
45 vlc the main VLC object
46 plugin flags for plugin modules
47 builtin flags for built-in modules
48 pic flags for PIC code
49 MODULE any available module (dummy, gtk, avi, etc.)
50 BLAH
51 exit $1
54 register_flags()
56 case "$1" in
57 #@1@#
60 esac
63 register_targets()
65 case "$1" in
66 #@2@#
69 esac
72 if test $# -eq 0; then
73 usage 1 1>&2
77 # No need to include the default @*FLAGS@ values here because they are
78 # automatically added when using $(COMPILE), $(CXXCOMPILE) or $(OBJCCOMPILE)
80 if test "@includedir@" != "/usr/include"; then
81 includes="-I@includedir@"
83 if test "${top_builddir}" != ""; then
84 top_builddir="${top_builddir}/"
86 cppflags="${includes}"
87 libs="-L@libdir@"
88 module=""
89 linkage="c"
92 # On Linux and Solaris, activate 64-bit off_t (by default under BSD)
94 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE"
97 # Gettext, data and plugin location
99 cppflags="${cppflags} -DLOCALEDIR=\"@datadir@/locale\""
100 cppflags="${cppflags} -DDATA_PATH=\"${prefix}/share/vlc\""
101 cppflags="${cppflags} -DPLUGIN_PATH=\"${prefix}/lib/vlc\""
104 # Various additional defines
106 if [ "${debug}" = yes ]; then
107 cppflags="${cppflags} -DDEBUG"
108 cflags="${cflags} -g"
109 cxxflags="${cxxflags} -g"
110 objcflags="${objcflags} -g"
111 ldflags="${ldflags} -g"
113 if [ "${cprof}" = yes ]; then
114 cppflags="${cppflags} -DCPROF"
115 cflags="${cflags} -finstrument-functions"
116 cxxflags="${cxxflags} -finstrument-functions"
117 objcflags="${objcflags} -finstrument-functions"
119 if [ "${gprof}" = yes ]; then
120 cppflags="${cppflags} -DGPROF"
121 cflags="${cflags} -pg"
122 cxxflags="${cxxflags} -pg"
123 objcflags="${objcflags} -pg"
124 ldflags="${ldflags} -pg"
126 if [ "${release}" = yes ]; then
127 cppflags="${cppflags} -DHAVE_RELEASE"
129 if [ "${optim}" = yes ]; then
130 cppflags="${cppflags} ${cflags_optim} ${cflags_tuning}"
131 if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
132 cppflags="${cppflags} ${cflags_optim_nodebug}"
134 else
135 cppflags="${cppflags} ${cflags_nooptim}"
139 # The main argument loop
141 while test $# -gt 0; do
142 case "$1" in
143 -*=*) optarg=`echo "$1" | sed 's/-_a-zA-Z0-9*=//'` ;;
144 *) optarg= ;;
145 esac
147 case "$1" in
148 --prefix=*)
149 prefix="${optarg}"
150 if test "${exec_prefix_set}" = no ; then
151 exec_prefix="${optarg}"
154 --prefix)
155 echo_prefix=yes
157 --exec-prefix=*)
158 exec_prefix="${optarg}"
159 exec_prefix_set=yes
161 --exec-prefix)
162 echo_exec_prefix=yes
164 --version)
165 echo "@VERSION@"
166 exit 0
168 --linkage)
169 echo_linkage=yes
171 --target)
172 echo_target=yes
174 --cflags)
175 echo_cflags=yes
177 --cxxflags)
178 echo_cxxflags=yes
180 --objcflags)
181 echo_objcflags=yes
183 --libs)
184 echo_libs=yes
187 usage 1 1>&1
189 vlc)
190 cppflags="${cppflags} -D__VLC__"
192 plugin)
193 echo_plugin=yes
194 cppflags="${cppflags} -D__VLC__ -D__PLUGIN__"
196 pic)
197 echo_pic=yes
199 builtin)
200 echo_builtin=yes
201 cppflags="${cppflags} -D__VLC__ -D__BUILTIN__"
203 mozilla)
206 module="$1"
208 esac
210 # Register per-module *FLAGS
211 register_flags "$1"
213 # Register module targets
214 register_targets "$1"
216 shift
217 done
220 # If a module was requested, use its name
222 if test -n "${module}"; then
223 cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module}"
227 # Output what we were asked
229 if test "${echo_linkage}" = yes; then
230 if test "${echo_plugin}" = yes; then
231 for module in `echo "${plugins}"`; do
232 register_flags "${module}"
233 done
235 if test "${echo_builtin}" = yes; then
236 for module in `echo "${builtins}"`; do
237 register_flags "${module}"
238 done
240 echo "${linkage}"
241 exit 0
244 if test "${echo_target}" = yes; then
245 if test "${echo_plugin}" = yes; then
246 for module in `echo "${plugins}"`; do
247 register_targets "${module}"
248 done
249 for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_plugin "; done
250 printf '\n'
252 if test "${echo_builtin}" = yes; then
253 for module in `echo "${builtins}"`; do
254 register_targets "${module}"
255 done
256 if test "${echo_pic}" = yes; then
257 for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_pic.a "; done
258 else
259 for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
261 printf '\n'
263 exit 0
266 if test "${echo_prefix}" = yes; then
267 echo "${prefix}"
269 if test "${echo_exec_prefix}" = yes; then
270 echo "${exec_prefix}"
272 if test "${echo_cppflags}" = yes; then
273 echo "${cppflags}"
275 if test "${echo_cflags}" = yes; then
276 echo "${cppflags} ${cflags}"
278 if test "${echo_cxxflags}" = yes; then
279 echo "${cppflags} ${cxxflags}"
281 if test "${echo_objcflags}" = yes; then
282 echo "${cppflags} ${objcflags}"
284 if test "${echo_libs}" = yes; then
285 if test "${echo_builtin}" = yes; then
286 for module in `echo "${builtins}"`; do
287 register_targets "${module}"
288 register_flags "${module}"
289 done
290 if test "${echo_pic}" = yes; then
291 for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_pic.a "; done
292 else
293 for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
296 echo "${libs} ${ldflags}"