]> git.sesse.net Git - vlc/blob - vlc-config.in.in
Remove spurious warning
[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 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=\"@datadir@/vlc\""
104 cppflags="${cppflags} -DPLUGIN_PATH=\"@libdir@/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     --list)
178       echo_list=yes
179       ;;
180     --cflags)
181       echo_cflags=yes
182       ;;
183     --cxxflags)
184       echo_cxxflags=yes
185       ;;
186     --objcflags)
187       echo_objcflags=yes
188       ;;
189     --libs)
190       echo_libs=yes
191       ;;
192     -*)
193       usage 1 1>&1
194       ;;
195     vlc)
196       cppflags="${cppflags} -D__VLC__ -I${top_builddir}src/misc"
197       ;;
198     plugin)
199       echo_plugin=yes
200       cppflags="${cppflags} -D__VLC__ -D__PLUGIN__"
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 libs="-L@libdir@"
227
228 #
229 #  If a module was requested, use its name
230 #
231 if test -n "${module}"; then
232   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module}"
233 fi
234
235 #
236 #  Output what we were asked
237 #
238 if test "${echo_linkage}" = yes; then
239   if test "${echo_plugin}" = yes; then
240     for module in `echo "${plugins}"`; do
241       register_flags "${module}"
242     done
243   fi
244   if test "${echo_builtin}" = yes; then
245     for module in `echo "${builtins}"`; do
246       register_flags "${module}"
247     done
248   fi
249   echo "${linkage}"
250   exit 0
251 fi
252
253 if test "${echo_target}" = yes; then
254   if test "${echo_plugin}" = yes; then
255     for module in `echo "${plugins}"`; do
256       register_targets "${module}"
257     done
258     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}_plugin "; done
259     printf '\n'
260   fi
261   if test "${echo_builtin}" = yes; then
262     for module in `echo "${builtins}"`; do
263       register_targets "${module}"
264     done
265     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
266     printf '\n'
267   fi
268   exit 0
269 fi
270
271 if test "${echo_list}" = yes; then
272   if test "${echo_plugin}" = yes; then
273     echo "${plugins}"
274     printf '\n'
275   fi
276   if test "${echo_builtin}" = yes; then
277     echo "${builtins}"
278     printf '\n'
279   fi
280   exit 0
281 fi
282
283 if test "${echo_prefix}" = yes; then
284   echo "${prefix}"
285 fi
286 if test "${echo_exec_prefix}" = yes; then
287   echo "${exec_prefix}"
288 fi
289 if test "${echo_cppflags}" = yes; then
290   echo "${cppflags}"
291 fi
292 if test "${echo_cflags}" = yes; then
293   echo "${cppflags} ${cflags}"
294 fi
295 if test "${echo_cxxflags}" = yes; then
296   echo "${cppflags} ${cxxflags}"
297 fi
298 if test "${echo_objcflags}" = yes; then
299   echo "${cppflags} ${objcflags}"
300 fi
301
302 # Libs
303 # There are 4 possibilities
304 #  - We are a plugin or a builtin
305 #  - We are building from the outside (external):
306 #       - Give full libvlc linkflags + -lvlc (in libdir)
307 #       - Link with builtins in libdir
308 #  - We are building something from the inside (builtin)
309 #       - Link with builtins in place
310 #  If you want something shared from the inside (binding),
311 #  you need "builtin vlc"
312 if test "${echo_libs}" = yes; then
313   if test "${echo_builtin}" = yes; then
314     for module in `echo "${builtins}"`; do
315       register_targets "${module}"
316       register_flags "${module}"
317     done
318     for target in `echo "${list}"`; do printf "${top_builddir}modules/${target}.a "; done
319   fi
320   if test "${echo_external}" = yes; then
321     for module in `echo "${builtins}"`; do
322       ldflags="${ldflags} @libdir@/vlc/lib${module}.a"
323     done
324     for module in `echo "${builtins}"`; do
325       register_flags "${module}"
326     done
327     register_flags "vlc"
328   fi
329   echo "${libs} ${ldflags}"
330 fi