]> git.sesse.net Git - vlc/blob - vlc-config.in.in
Set PLUGIN_PATH and LOCALEDIR only for libvlc
[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 #  Various additional defines
104 #
105 if [ "${debug}" = yes ]; then
106   cppflags="${cppflags} -DDEBUG"
107   cflags="${cflags} -g"
108   cxxflags="${cxxflags} -g"
109   objcflags="${objcflags} -g"
110   ldflags="${ldflags} -g"
111 fi
112 if [ "${cprof}" = yes ]; then
113   cppflags="${cppflags} -DCPROF"
114   cflags="${cflags} -finstrument-functions"
115   cxxflags="${cxxflags} -finstrument-functions"
116   objcflags="${objcflags} -finstrument-functions"
117 fi
118 if [ "${gprof}" = yes ]; then
119   cppflags="${cppflags} -DGPROF"
120   cflags="${cflags} -pg"
121   cxxflags="${cxxflags} -pg"
122   objcflags="${objcflags} -pg"
123   ldflags="${ldflags} -pg"
124 fi
125 if [ "${release}" = yes ]; then
126   cppflags="${cppflags} -DHAVE_RELEASE"
127 fi
128 if [ "${optim}" = size ]; then
129   cflags="${cflags} ${cflags_optim_size} ${cflags_tuning}"
130   cxxflags="${cxxflags} ${cflags_optim_size} ${cflags_tuning}"
131   objcflags="${objcflags} ${cflags_optim_size} ${cflags_tuning}"
132   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
133     cflags="${cflags} ${cflags_optim_nodebug}"
134     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
135     objcflags="${objcflags} ${cflags_optim_nodebug}"
136   fi
137 elif [ "${optim}" = speed ]; then
138   cflags="${cflags} ${cflags_optim_speed} ${cflags_tuning}"
139   cxxflags="${cxxflags} ${cflags_optim_speed} ${cflags_tuning}"
140   objcflags="${objcflags} ${cflags_optim_speed} ${cflags_tuning}"
141   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
142     cflags="${cflags} ${cflags_optim_nodebug}"
143     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
144     objcflags="${objcflags} ${cflags_optim_nodebug}"
145   fi
146 else
147   cflags="${cflags} ${cflags_nooptim}"
148   cxxflags="${cxxflags} ${cflags_nooptim}"
149   objcflags="${objcflags} ${cflags_nooptim}"
150 fi
151
152 #
153 #  The main argument loop
154 #
155 while test $# -gt 0; do
156   case "$1" in
157   -*=*) optarg=`echo "$1" | sed 's/-[_a-zA-Z0-9\-]*=//'` ;;
158   *) optarg= ;;
159   esac
160
161   case "$1" in
162     --prefix=*)
163       prefix="${optarg}"
164       if test "${exec_prefix_set}" = no ; then
165         exec_prefix="${optarg}"
166       fi
167       ;;
168     --prefix)
169       echo_prefix=yes
170       ;;
171     --exec-prefix=*)
172       exec_prefix="${optarg}"
173       exec_prefix_set=yes
174       ;;
175     --exec-prefix)
176       echo_exec_prefix=yes
177       ;;
178     --version)
179       echo "@VERSION@"
180       exit 0
181       ;;
182     --linkage)
183       echo_linkage=yes
184       ;;
185     --target)
186       echo_target=yes
187       ;;
188     --list)
189       echo_list=yes
190       ;;
191     --cflags)
192       echo_cflags=yes
193       ;;
194     --cppflags)
195       echo_cppflags=yes
196       ;;
197     --cxxflags)
198       echo_cxxflags=yes
199       ;;
200     --objcflags)
201       echo_objcflags=yes
202       ;;
203     --ldflags)
204       echo_ldflags=yes
205       ;;
206     --libs|-libs)
207       echo_libs=yes
208       ;;
209     -*)
210       usage 1 1>&1
211       ;;
212     libvlc)
213       cppflags="${cppflags} -D__LIBVLC__ -I${top_builddir}src/misc"
214       ;;
215     plugin)
216       echo_plugin=yes
217       cppflags="${cppflags} -D__LIBVLC__ -D__PLUGIN__"
218       ;;
219     builtin)
220       echo_builtin=yes
221       cppflags="${cppflags} -D__LIBVLC__ -D__BUILTIN__"
222       ;;
223     pic)
224       ;;
225     mozilla)
226       ;;
227     external)
228       echo_external=yes
229       libs="${libs} -lvlc -lvlc-control"
230       ;;      
231     *)
232       module="$1"
233       ;;
234   esac
235
236   # Register per-module *FLAGS
237   register_flags "$1"
238
239   # Register module targets
240   register_targets "$1"
241
242   shift
243 done
244
245 #
246 #  If a module was requested, use its name
247 #
248 if test -n "${module}"; then
249   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module}"
250 fi
251
252 #
253 #  Output what we were asked
254 #
255 if test "${echo_linkage}" = yes; then
256   if test "${echo_plugin}" = yes; then
257     for module in `echo "${plugins}"`; do
258       register_flags "${module}"
259     done
260   fi
261   if test "${echo_builtin}" = yes; then
262     for module in `echo "${builtins}"`; do
263       register_flags "${module}"
264     done
265   fi
266   echo "${linkage}"
267   exit 0
268 fi
269
270 if test "${echo_target}" = yes; then
271   if test "${echo_plugin}" = yes; then
272     for module in `echo "${plugins}"`; do
273       register_targets "${module}"
274     done
275     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_plugin "; done
276     printf '\n'
277   fi
278   if test "${echo_builtin}" = yes; then
279     for module in `echo "${builtins}"`; do
280       register_targets "${module}"
281     done
282     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
283     printf '\n'
284   fi
285   exit 0
286 fi
287
288 if test "${echo_list}" = yes; then
289   if test "${echo_plugin}" = yes; then
290     echo "${plugins}"
291     printf '\n'
292   fi
293   if test "${echo_builtin}" = yes; then
294     echo "${builtins}"
295     printf '\n'
296   fi
297   exit 0
298 fi
299
300 if test "${echo_prefix}" = yes; then
301   echo "${prefix}"
302 fi
303 if test "${echo_exec_prefix}" = yes; then
304   echo "${exec_prefix}"
305 fi
306 if test "${echo_cppflags}" = yes; then
307   echo "${cppflags}"
308 fi
309 if test "${echo_cflags}" = yes; then
310   echo "${cppflags} ${cflags}"
311 fi
312 if test "${echo_cxxflags}" = yes; then
313   echo "${cppflags} ${cxxflags}"
314 fi
315 if test "${echo_objcflags}" = yes; then
316   echo "${cppflags} ${objcflags}"
317 fi
318 if test "${echo_ldflags}" = yes; then
319   echo "${ldflags}"
320 fi
321
322 # Libs
323 # There are 4 possibilities
324 #  - We are a plugin or a builtin
325 #  - We are building from the outside (external):
326 #       - Give full libvlc linkflags + -lvlc (in libdir)
327 #       - Link with builtins in libdir
328 #  - We are building something from the inside (builtin)
329 #       - Link with builtins in place
330 #  If you want something shared from the inside (binding),
331 #  you need "builtin vlc"
332 if test "${echo_libs}" = yes; then
333   if test "${echo_builtin}" = yes; then
334     for module in `echo "${builtins}"`; do
335       register_targets "${module}"
336       register_flags "${module}"
337     done
338     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
339   fi
340   if test "${echo_external}" = yes; then
341     for module in `echo "${builtins}"`; do
342       libs="${libs} @libdir@/vlc/lib${module}.a"
343     done
344     for module in `echo "${builtins}"`; do
345       register_flags "${module}"
346     done
347     register_flags "vlc"
348   fi
349   echo "${libs}"
350 fi