]> git.sesse.net Git - vlc/blob - vlc-config.in.in
Don't set DATA_PATH when building plugins - fixes #1464
[vlc] / vlc-config.in.in
1 #!/bin/sh
2
3 prefix="@prefix@"
4 exec_prefix="@exec_prefix@"
5 exec_prefix_set=no
6 datarootdir="@datarootdir@"
7
8 release="@release@"
9 debug="@debug@"
10 gprof="@gprof@"
11 cprof="@cprof@"
12 optim="@optim@"
13
14 plugins="@PLUGINS@ "
15 builtins="@BUILTINS@ "
16
17 cppflags=""
18 cflags=""
19 cxxflags=""
20 objcflags=""
21 ldflags=""
22 libs=""
23
24 cflags_tuning="@CFLAGS_TUNING@"
25 cflags_optim_size="@CFLAGS_OPTIM_SIZE@"
26 cflags_optim_speed="@CFLAGS_OPTIM_SPEED@"
27 cflags_optim_nodebug="@CFLAGS_OPTIM_NODEBUG@"
28 cflags_nooptim="@CFLAGS_NOOPTIM@"
29
30 #
31 #  Do not touch below this place unless you really know what you are doing
32 #
33 usage()
34 {
35         cat << BLAH
36 Usage: vlc-config OPTIONS MODULES
37 Options:
38         [--prefix[=DIR]]          set prefix
39         [--exec-prefix[=DIR]]     set exec prefix
40         [--version]               print version and exit
41         [--linkage]               print linkage mode (c, c++, objc)
42         [--target]                print targets and exit
43         [--list]                  print modules names and exit
44         [--libs]                  output linking flags
45         [--cflags]                output C compilation flags
46         [--cxxflags]              output C++ compilation flags
47         [--objcflags]             output Objective C compilation flags
48 Modules:
49         vlc                       the main VLC object
50         plugin                    flags for plugin modules
51         builtin                   flags for built-in modules
52         pic                       flags for PIC code
53         MODULE                    any available module (dummy, gtk, avi, etc.)
54 BLAH
55         exit $1
56 }
57
58 register_flags()
59 {
60   case "$1" in
61     #@1@#
62     *)
63       ;;
64   esac
65 }
66
67 register_targets()
68 {
69   case "$1" in
70     #@2@#
71     *)
72       ;;
73   esac
74 }
75
76 if test $# -eq 0; then
77         usage 1 1>&2
78 fi
79
80 #
81 #  No need to include the default @*FLAGS@ values here because they are
82 #  automatically added when using $(COMPILE), $(CXXCOMPILE) or $(OBJCCOMPILE)
83 #
84 if test "@includedir@" != "/usr/include"; then
85   includes="-I@includedir@"
86 fi
87 if test "${top_builddir}" != ""; then
88   top_builddir="${top_builddir}/"
89 elif test "${TOP_BUILDDIR}" != ""; then
90   top_builddir="${TOP_BUILDDIR}/"
91 fi
92 includes="${includes}"
93 cppflags="${includes}"
94 module=""
95 linkage="c"
96
97 #
98 #  On Linux and Solaris, activate 64-bit off_t (by default under BSD)
99 #
100 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE"
101
102 #
103 #  Gettext, data and plugin location
104 #
105 cppflags="${cppflags} -DLOCALEDIR=\"@datadir@/locale\""
106 cppflags="${cppflags} -DPLUGIN_PATH=\"@libdir@/vlc\""
107
108 #
109 #  Various additional defines
110 #
111 if [ "${debug}" = yes ]; then
112   cppflags="${cppflags} -DDEBUG"
113   cflags="${cflags} -g"
114   cxxflags="${cxxflags} -g"
115   objcflags="${objcflags} -g"
116   ldflags="${ldflags} -g"
117 fi
118 if [ "${cprof}" = yes ]; then
119   cppflags="${cppflags} -DCPROF"
120   cflags="${cflags} -finstrument-functions"
121   cxxflags="${cxxflags} -finstrument-functions"
122   objcflags="${objcflags} -finstrument-functions"
123 fi
124 if [ "${gprof}" = yes ]; then
125   cppflags="${cppflags} -DGPROF"
126   cflags="${cflags} -pg"
127   cxxflags="${cxxflags} -pg"
128   objcflags="${objcflags} -pg"
129   ldflags="${ldflags} -pg"
130 fi
131 if [ "${release}" = yes ]; then
132   cppflags="${cppflags} -DHAVE_RELEASE"
133 fi
134 if [ "${optim}" = size ]; then
135   cflags="${cflags} ${cflags_optim_size} ${cflags_tuning}"
136   cxxflags="${cxxflags} ${cflags_optim_size} ${cflags_tuning}"
137   objcflags="${objcflags} ${cflags_optim_size} ${cflags_tuning}"
138   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
139     cflags="${cflags} ${cflags_optim_nodebug}"
140     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
141     objcflags="${objcflags} ${cflags_optim_nodebug}"
142   fi
143 elif [ "${optim}" = speed ]; then
144   cflags="${cflags} ${cflags_optim_speed} ${cflags_tuning}"
145   cxxflags="${cxxflags} ${cflags_optim_speed} ${cflags_tuning}"
146   objcflags="${objcflags} ${cflags_optim_speed} ${cflags_tuning}"
147   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
148     cflags="${cflags} ${cflags_optim_nodebug}"
149     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
150     objcflags="${objcflags} ${cflags_optim_nodebug}"
151   fi
152 else
153   cflags="${cflags} ${cflags_nooptim}"
154   cxxflags="${cxxflags} ${cflags_nooptim}"
155   objcflags="${objcflags} ${cflags_nooptim}"
156 fi
157
158 #
159 #  The main argument loop
160 #
161 while test $# -gt 0; do
162   case "$1" in
163   -*=*) optarg=`echo "$1" | sed 's/-[_a-zA-Z0-9\-]*=//'` ;;
164   *) optarg= ;;
165   esac
166
167   case "$1" in
168     --prefix=*)
169       prefix="${optarg}"
170       if test "${exec_prefix_set}" = no ; then
171         exec_prefix="${optarg}"
172       fi
173       ;;
174     --prefix)
175       echo_prefix=yes
176       ;;
177     --exec-prefix=*)
178       exec_prefix="${optarg}"
179       exec_prefix_set=yes
180       ;;
181     --exec-prefix)
182       echo_exec_prefix=yes
183       ;;
184     --version)
185       echo "@VERSION@"
186       exit 0
187       ;;
188     --linkage)
189       echo_linkage=yes
190       ;;
191     --target)
192       echo_target=yes
193       ;;
194     --list)
195       echo_list=yes
196       ;;
197     --cflags)
198       echo_cflags=yes
199       ;;
200     --cppflags)
201       echo_cppflags=yes
202       ;;
203     --cxxflags)
204       echo_cxxflags=yes
205       ;;
206     --objcflags)
207       echo_objcflags=yes
208       ;;
209     --ldflags)
210       echo_ldflags=yes
211       ;;
212     --libs|-libs)
213       echo_libs=yes
214       ;;
215     -*)
216       usage 1 1>&1
217       ;;
218     libvlc)
219       cppflags="${cppflags} -D__LIBVLC__ -I${top_builddir}src/misc"
220       ;;
221     plugin)
222       echo_plugin=yes
223       cppflags="${cppflags} -D__LIBVLC__ -D__PLUGIN__"
224       ;;
225     builtin)
226       echo_builtin=yes
227       cppflags="${cppflags} -D__LIBVLC__ -D__BUILTIN__"
228       ;;
229     pic)
230       ;;
231     mozilla)
232       ;;
233     external)
234       echo_external=yes
235       libs="${libs} -lvlc -lvlc-control"
236       ;;      
237     *)
238       module="$1"
239       ;;
240   esac
241
242   # Register per-module *FLAGS
243   register_flags "$1"
244
245   # Register module targets
246   register_targets "$1"
247
248   shift
249 done
250
251 #
252 #  If a module was requested, use its name
253 #
254 if test -n "${module}"; then
255   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module}"
256 fi
257
258 #
259 #  Output what we were asked
260 #
261 if test "${echo_linkage}" = yes; then
262   if test "${echo_plugin}" = yes; then
263     for module in `echo "${plugins}"`; do
264       register_flags "${module}"
265     done
266   fi
267   if test "${echo_builtin}" = yes; then
268     for module in `echo "${builtins}"`; do
269       register_flags "${module}"
270     done
271   fi
272   echo "${linkage}"
273   exit 0
274 fi
275
276 if test "${echo_target}" = yes; then
277   if test "${echo_plugin}" = yes; then
278     for module in `echo "${plugins}"`; do
279       register_targets "${module}"
280     done
281     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_plugin "; done
282     printf '\n'
283   fi
284   if test "${echo_builtin}" = yes; then
285     for module in `echo "${builtins}"`; do
286       register_targets "${module}"
287     done
288     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
289     printf '\n'
290   fi
291   exit 0
292 fi
293
294 if test "${echo_list}" = yes; then
295   if test "${echo_plugin}" = yes; then
296     echo "${plugins}"
297     printf '\n'
298   fi
299   if test "${echo_builtin}" = yes; then
300     echo "${builtins}"
301     printf '\n'
302   fi
303   exit 0
304 fi
305
306 if test "${echo_prefix}" = yes; then
307   echo "${prefix}"
308 fi
309 if test "${echo_exec_prefix}" = yes; then
310   echo "${exec_prefix}"
311 fi
312 if test "${echo_cppflags}" = yes; then
313   echo "${cppflags}"
314 fi
315 if test "${echo_cflags}" = yes; then
316   echo "${cppflags} ${cflags}"
317 fi
318 if test "${echo_cxxflags}" = yes; then
319   echo "${cppflags} ${cxxflags}"
320 fi
321 if test "${echo_objcflags}" = yes; then
322   echo "${cppflags} ${objcflags}"
323 fi
324 if test "${echo_ldflags}" = yes; then
325   echo "${ldflags}"
326 fi
327
328 # Libs
329 # There are 4 possibilities
330 #  - We are a plugin or a builtin
331 #  - We are building from the outside (external):
332 #       - Give full libvlc linkflags + -lvlc (in libdir)
333 #       - Link with builtins in libdir
334 #  - We are building something from the inside (builtin)
335 #       - Link with builtins in place
336 #  If you want something shared from the inside (binding),
337 #  you need "builtin vlc"
338 if test "${echo_libs}" = yes; then
339   if test "${echo_builtin}" = yes; then
340     for module in `echo "${builtins}"`; do
341       register_targets "${module}"
342       register_flags "${module}"
343     done
344     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
345   fi
346   if test "${echo_external}" = yes; then
347     for module in `echo "${builtins}"`; do
348       libs="${libs} @libdir@/vlc/lib${module}.a"
349     done
350     for module in `echo "${builtins}"`; do
351       register_flags "${module}"
352     done
353     register_flags "vlc"
354   fi
355   echo "${libs}"
356 fi