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