]> git.sesse.net Git - vlc/blob - vlc-config.in.in
Merge mediacontrol to trunk
[vlc] / vlc-config.in.in
1 #!/bin/sh
2
3 prefix="@prefix@"
4 exec_prefix="@exec_prefix@"
5 exec_prefix_set=no
6
7 release="@release@"
8 debug="@debug@"
9 gprof="@gprof@"
10 cprof="@cprof@"
11 optim="@optim@"
12
13 plugins="@PLUGINS@"
14 builtins="@BUILTINS@"
15
16 cppflags=""
17 cflags=""
18 cxxflags=""
19 objcflags=""
20 ldflags=""
21
22 cflags_tuning="@CFLAGS_TUNING@"
23 cflags_optim="@CFLAGS_OPTIM@"
24 cflags_optim_nodebug="@CFLAGS_OPTIM_NODEBUG@"
25 cflags_nooptim="@CFLAGS_NOOPTIM@"
26
27 #
28 #  Do not touch below this place unless you really know what you are doing
29 #
30 usage()
31 {
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
52 }
53
54 register_flags()
55 {
56   case "$1" in
57     #@1@#
58     *)
59       ;;
60   esac
61 }
62
63 register_targets()
64 {
65   case "$1" in
66     #@2@#
67     *)
68       ;;
69   esac
70 }
71
72 if test $# -eq 0; then
73         usage 1 1>&2
74 fi
75
76 #
77 #  No need to include the default @*FLAGS@ values here because they are
78 #  automatically added when using $(COMPILE), $(CXXCOMPILE) or $(OBJCCOMPILE)
79 #
80 if test "@includedir@" != "/usr/include"; then
81   includes="-I@includedir@"
82 fi
83 if test "${top_builddir}" != ""; then
84   top_builddir="${top_builddir}/"
85 elif test "${TOP_BUILDDIR}" != ""; then
86   top_builddir="${TOP_BUILDDIR}/"
87 fi
88 includes="${includes} -I${top_builddir}include"
89 cppflags="${includes}"
90 libs="-L@libdir@"
91 module=""
92 linkage="c"
93
94 #
95 #  On Linux and Solaris, activate 64-bit off_t (by default under BSD)
96 #
97 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE"
98
99 #
100 #  Gettext, data and plugin location
101 #
102 cppflags="${cppflags} -DLOCALEDIR=\"@datadir@/locale\""
103 cppflags="${cppflags} -DDATA_PATH=\"${prefix}/share/vlc\""
104 cppflags="${cppflags} -DPLUGIN_PATH=\"${prefix}/lib/vlc\""
105
106 #
107 #  Various additional defines
108 #
109 if [ "${debug}" = yes ]; then
110   cppflags="${cppflags} -DDEBUG"
111   cflags="${cflags} -g"
112   cxxflags="${cxxflags} -g"
113   objcflags="${objcflags} -g"
114   ldflags="${ldflags} -g"
115 fi
116 if [ "${cprof}" = yes ]; then
117   cppflags="${cppflags} -DCPROF"
118   cflags="${cflags} -finstrument-functions"
119   cxxflags="${cxxflags} -finstrument-functions"
120   objcflags="${objcflags} -finstrument-functions"
121 fi
122 if [ "${gprof}" = yes ]; then
123   cppflags="${cppflags} -DGPROF"
124   cflags="${cflags} -pg"
125   cxxflags="${cxxflags} -pg"
126   objcflags="${objcflags} -pg"
127   ldflags="${ldflags} -pg"
128 fi
129 if [ "${release}" = yes ]; then
130   cppflags="${cppflags} -DHAVE_RELEASE"
131 fi
132 if [ "${optim}" = yes ]; then
133   cppflags="${cppflags} ${cflags_optim} ${cflags_tuning}"
134   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
135     cppflags="${cppflags} ${cflags_optim_nodebug}"
136   fi
137 else
138   cppflags="${cppflags} ${cflags_nooptim}"
139 fi
140
141 #
142 #  The main argument loop
143 #
144 while test $# -gt 0; do
145   case "$1" in
146   -*=*) optarg=`echo "$1" | sed 's/-_a-zA-Z0-9*=//'` ;;
147   *) optarg= ;;
148   esac
149
150   case "$1" in
151     --prefix=*)
152       prefix="${optarg}"
153       if test "${exec_prefix_set}" = no ; then
154         exec_prefix="${optarg}"
155       fi
156       ;;
157     --prefix)
158       echo_prefix=yes
159       ;;
160     --exec-prefix=*)
161       exec_prefix="${optarg}"
162       exec_prefix_set=yes
163       ;;
164     --exec-prefix)
165       echo_exec_prefix=yes
166       ;;
167     --version)
168       echo "@VERSION@"
169       exit 0
170       ;;
171     --linkage)
172       echo_linkage=yes
173       ;;
174     --target)
175       echo_target=yes
176       ;;
177     --cflags)
178       echo_cflags=yes
179       ;;
180     --cxxflags)
181       echo_cxxflags=yes
182       ;;
183     --objcflags)
184       echo_objcflags=yes
185       ;;
186     --libs)
187       echo_libs=yes
188       ;;
189     -*)
190       usage 1 1>&1
191       ;;
192     vlc)
193       cppflags="${cppflags} -D__VLC__ -I${top_builddir}src/misc"
194       ;;
195     plugin)
196       echo_plugin=yes
197       cppflags="${cppflags} -D__VLC__ -D__PLUGIN__"
198       ;;
199     pic)
200       echo_pic=yes
201       ;;
202     builtin)
203       echo_builtin=yes
204       cppflags="${cppflags} -D__VLC__ -D__BUILTIN__"
205       ;;
206     mozilla)
207       ;;
208     external)
209       echo_external=yes
210       ldflags="${ldflags} -lvlc"
211       ;;      
212     *)
213       module="$1"
214       ;;
215   esac
216
217   # Register per-module *FLAGS
218   register_flags "$1"
219
220   # Register module targets
221   register_targets "$1"
222
223   shift
224 done
225
226 #
227 #  If a module was requested, use its name
228 #
229 if test -n "${module}"; then
230   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module}"
231 fi
232
233 #
234 #  Output what we were asked
235 #
236 if test "${echo_linkage}" = yes; then
237   if test "${echo_plugin}" = yes; then
238     for module in `echo "${plugins}"`; do
239       register_flags "${module}"
240     done
241   fi
242   if test "${echo_builtin}" = yes; then
243     for module in `echo "${builtins}"`; do
244       register_flags "${module}"
245     done
246   fi
247   echo "${linkage}"
248   exit 0
249 fi
250
251 if test "${echo_target}" = yes; then
252   if test "${echo_plugin}" = yes; then
253     for module in `echo "${plugins}"`; do
254       register_targets "${module}"
255     done
256     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_plugin "; done
257     printf '\n'
258   fi
259   if test "${echo_builtin}" = yes; then
260     for module in `echo "${builtins}"`; do
261       register_targets "${module}"
262     done
263     if test "${echo_pic}" = yes; then
264       for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_pic.a "; done
265     else
266       for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
267     fi
268     printf '\n'
269   fi
270   exit 0
271 fi
272
273 if test "${echo_prefix}" = yes; then
274   echo "${prefix}"
275 fi
276 if test "${echo_exec_prefix}" = yes; then
277   echo "${exec_prefix}"
278 fi
279 if test "${echo_cppflags}" = yes; then
280   echo "${cppflags}"
281 fi
282 if test "${echo_cflags}" = yes; then
283   echo "${cppflags} ${cflags}"
284 fi
285 if test "${echo_cxxflags}" = yes; then
286   echo "${cppflags} ${cxxflags}"
287 fi
288 if test "${echo_objcflags}" = yes; then
289   echo "${cppflags} ${objcflags}"
290 fi
291 if test "${echo_libs}" = yes; then
292   if test "${echo_builtin}" = yes; then
293     for module in `echo "${builtins}"`; do
294       register_targets "${module}"
295       register_flags "${module}"
296     done
297     if test "${echo_pic}" = yes; then
298       for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_pic.a "; done
299     else
300       for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
301     fi
302   fi
303   if test "${echo_external}" = yes; then
304     if test "${echo_pic}" = yes; then
305       for module in `echo "${builtins}"`; do
306         ldflags="${ldflags} @libdir@/vlc/lib${module}_pic.a"
307       done
308     else
309       for module in `echo "${builtins}"`; do
310         ldflags="${ldflags} @libdir@/vlc/lib${module}.a"
311       done
312     fi
313     for module in `echo "${builtins}"`; do
314       register_flags "${module}"
315     done
316     register_flags "vlc"
317   fi
318   echo "${libs} ${ldflags}"
319 fi