]> git.sesse.net Git - vlc/blob - vlc-config.in.in
* mozilla/Makefile.am: Moved mozilla plugin generation directives here.
[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_srcdir}" != ""; then
84   top_srcdir="${top_srcdir}/"
85 fi
86 cppflags="${includes}"
87 libs="-L@libdir@"
88 module=""
89 linkage="c"
90
91 #
92 #  On Linux and Solaris, activate 64-bit off_t (by default under BSD)
93 #
94 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE"
95
96 #
97 #  Gettext, data and plugin location
98 #
99 cppflags="${cppflags} -DLOCALEDIR=\"@datadir@/locale\""
100 cppflags="${cppflags} -DDATA_PATH=\"${prefix}/share/vlc\""
101 cppflags="${cppflags} -DPLUGIN_PATH=\"${prefix}/lib/vlc\""
102
103 #
104 #  Various additional defines
105 #
106 if [ "${debug}" = yes ]; then
107   cppflags="${cppflags} -DDEBUG"
108   cflags="${cflags} -g"
109   cxxflags="${cxxflags} -g"
110   objcflags="${objcflags} -g"
111   ldflags="${ldflags} -g"
112 fi
113 if [ "${cprof}" = yes ]; then
114   cppflags="${cppflags} -DCPROF"
115   cflags="${cflags} -finstrument-functions"
116   cxxflags="${cxxflags} -finstrument-functions"
117   objcflags="${objcflags} -finstrument-functions"
118 fi
119 if [ "${gprof}" = yes ]; then
120   cppflags="${cppflags} -DGPROF"
121   cflags="${cflags} -pg"
122   cxxflags="${cxxflags} -pg"
123   objcflags="${objcflags} -pg"
124   ldflags="${ldflags} -pg"
125 fi
126 if [ "${release}" = yes ]; then
127   cppflags="${cppflags} -DHAVE_RELEASE"
128 fi
129 if [ "${optim}" = yes ]; then
130   cppflags="${cppflags} ${cflags_optim} ${cflags_tuning}"
131   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
132     cppflags="${cppflags} ${cflags_optim_nodebug}"
133   fi
134 else
135   cppflags="${cppflags} ${cflags_nooptim}"
136 fi
137
138 #
139 #  The main argument loop
140 #
141 while test $# -gt 0; do
142   case "$1" in
143   -*=*) optarg=`echo "$1" | sed 's/-_a-zA-Z0-9*=//'` ;;
144   *) optarg= ;;
145   esac
146
147   case "$1" in
148     --prefix=*)
149       prefix="${optarg}"
150       if test "${exec_prefix_set}" = no ; then
151         exec_prefix="${optarg}"
152       fi
153       ;;
154     --prefix)
155       echo_prefix=yes
156       ;;
157     --exec-prefix=*)
158       exec_prefix="${optarg}"
159       exec_prefix_set=yes
160       ;;
161     --exec-prefix)
162       echo_exec_prefix=yes
163       ;;
164     --version)
165       echo "@VERSION@"
166       exit 0
167       ;;
168     --linkage)
169       echo_linkage=yes
170       ;;
171     --target)
172       echo_target=yes
173       ;;
174     --cflags)
175       echo_cflags=yes
176       ;;
177     --cxxflags)
178       echo_cxxflags=yes
179       ;;
180     --objcflags)
181       echo_objcflags=yes
182       ;;
183     --libs)
184       echo_libs=yes
185       ;;
186     -*)
187       usage 1 1>&1
188       ;;
189     vlc)
190       cppflags="${cppflags} -D__VLC__"
191       ;;
192     plugin)
193       echo_plugin=yes
194       cppflags="${cppflags} -D__VLC__ -D__PLUGIN__"
195       ;;
196     pic)
197       echo_pic=yes
198       ;;
199     builtin)
200       echo_builtin=yes
201       cppflags="${cppflags} -D__VLC__ -D__BUILTIN__"
202       ;;
203     mozilla)
204       ;;
205     *)
206       module="$1"
207       ;;
208   esac
209
210   # Register per-module *FLAGS
211   register_flags "$1"
212
213   # Register module targets
214   register_targets "$1"
215
216   shift
217 done
218
219 #
220 #  If a module was requested, use its name
221 #
222 if test -n "${module}"; then
223   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module}"
224 fi
225
226 #
227 #  Output what we were asked
228 #
229 if test "${echo_linkage}" = yes; then
230   if test "${echo_plugin}" = yes; then
231     for module in `echo "${plugins}"`; do
232       register_flags "${module}"
233     done
234   fi
235   if test "${echo_builtin}" = yes; then
236     for module in `echo "${builtins}"`; do
237       register_flags "${module}"
238     done
239   fi
240   echo "${linkage}"
241   exit 0
242 fi
243
244 if test "${echo_target}" = yes; then
245   if test "${echo_plugin}" = yes; then
246     for module in `echo "${plugins}"`; do
247       register_targets "${module}"
248     done
249     for target in `echo "${list}"`; do printf "${top_srcdir}modules/${target}_plugin "; done
250     printf '\n'
251   fi
252   if test "${echo_builtin}" = yes; then
253     for module in `echo "${builtins}"`; do
254       register_targets "${module}"
255     done
256     if test "${echo_pic}" = yes; then
257       for target in `echo "${list}"`; do printf "${top_srcdir}modules/${target}_pic.a "; done
258     else
259       for target in `echo "${list}"`; do printf "${top_srcdir}modules/${target}.a "; done
260     fi
261     printf '\n'
262   fi
263   exit 0
264 fi
265
266 if test "${echo_prefix}" = yes; then
267   echo "${prefix}"
268 fi
269 if test "${echo_exec_prefix}" = yes; then
270   echo "${exec_prefix}"
271 fi
272 if test "${echo_cppflags}" = yes; then
273   echo "${cppflags}"
274 fi
275 if test "${echo_cflags}" = yes; then
276   echo "${cppflags} ${cflags}"
277 fi
278 if test "${echo_cxxflags}" = yes; then
279   echo "${cppflags} ${cxxflags}"
280 fi
281 if test "${echo_objcflags}" = yes; then
282   echo "${cppflags} ${objcflags}"
283 fi
284 if test "${echo_libs}" = yes; then
285   if test "${echo_builtin}" = yes; then
286     for module in `echo "${builtins}"`; do
287       register_targets "${module}"
288       register_flags "${module}"
289     done
290     if test "${echo_pic}" = yes; then
291       for target in `echo "${list}"`; do printf "${top_srcdir}modules/${target}_pic.a "; done
292     else
293       for target in `echo "${list}"`; do printf "${top_srcdir}modules/${target}.a "; done
294     fi
295   fi
296   echo "${libs} ${ldflags}"
297 fi
298