]> git.sesse.net Git - vlc/blob - vlc-config.in.in
mpeg: Flag unused arguments.
[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         [--list]                  print modules names and exit
43         [--libs]                  output linking flags
44         [--cflags]                output C compilation flags
45         [--cxxflags]              output C++ compilation flags
46         [--objcflags]             output Objective C compilation flags
47 Modules:
48         vlc                       the main VLC object
49         plugin                    flags for plugin modules
50         builtin                   flags for built-in modules
51         pic                       flags for PIC code
52         MODULE                    any available module (dummy, gtk, avi, etc.)
53 BLAH
54         exit $1
55 }
56
57 register_flags()
58 {
59   case "$1" in
60     #@1@#
61     *)
62       ;;
63   esac
64 }
65
66 if test $# -eq 0; then
67         usage 1 1>&2
68 fi
69
70 #
71 #  No need to include the default @*FLAGS@ values here because they are
72 #  automatically added when using $(COMPILE), $(CXXCOMPILE) or $(OBJCCOMPILE)
73 #
74 if test "@includedir@" != "/usr/include"; then
75   includes="-I@includedir@"
76 fi
77 if test "${top_builddir}" != ""; then
78   top_builddir="${top_builddir}/"
79 elif test "${TOP_BUILDDIR}" != ""; then
80   top_builddir="${TOP_BUILDDIR}/"
81 fi
82 includes="${includes}"
83 cppflags="${includes}"
84 module=""
85 linkage="c"
86
87 #
88 #  On Linux and Solaris, activate 64-bit off_t (by default under BSD)
89 #
90 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE"
91
92 #
93 #  Various additional defines
94 #
95 if [ "${debug}" = yes ]; then
96   cppflags="${cppflags} -DDEBUG"
97   cflags="${cflags} -g"
98   cxxflags="${cxxflags} -g"
99   objcflags="${objcflags} -g"
100   ldflags="${ldflags} -g"
101 fi
102 if [ "${cprof}" = yes ]; then
103   cppflags="${cppflags} -DCPROF"
104   cflags="${cflags} -finstrument-functions"
105   cxxflags="${cxxflags} -finstrument-functions"
106   objcflags="${objcflags} -finstrument-functions"
107 fi
108 if [ "${gprof}" = yes ]; then
109   cppflags="${cppflags} -DGPROF"
110   cflags="${cflags} -pg"
111   cxxflags="${cxxflags} -pg"
112   objcflags="${objcflags} -pg"
113   ldflags="${ldflags} -pg"
114 fi
115 if [ "${release}" = yes ]; then
116   cppflags="${cppflags} -DHAVE_RELEASE"
117 fi
118 if [ "${optim}" = size ]; then
119   cflags="${cflags} ${cflags_optim_size} ${cflags_tuning}"
120   cxxflags="${cxxflags} ${cflags_optim_size} ${cflags_tuning}"
121   objcflags="${objcflags} ${cflags_optim_size} ${cflags_tuning}"
122   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
123     cflags="${cflags} ${cflags_optim_nodebug}"
124     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
125     objcflags="${objcflags} ${cflags_optim_nodebug}"
126   fi
127 elif [ "${optim}" = speed ]; then
128   cflags="${cflags} ${cflags_optim_speed} ${cflags_tuning}"
129   cxxflags="${cxxflags} ${cflags_optim_speed} ${cflags_tuning}"
130   objcflags="${objcflags} ${cflags_optim_speed} ${cflags_tuning}"
131   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
132     cflags="${cflags} ${cflags_optim_nodebug}"
133     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
134     objcflags="${objcflags} ${cflags_optim_nodebug}"
135   fi
136 else
137   cflags="${cflags} ${cflags_nooptim}"
138   cxxflags="${cxxflags} ${cflags_nooptim}"
139   objcflags="${objcflags} ${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   # Mangle plugin name, if applicable
152   # This is just a convenience hack for modules/common.am
153   tgt="$1"
154   tgt="${tgt##*/}"
155   case "$tgt" in
156     lib*_plugin_la-*.lo)
157       tgt="${tgt#*lib}"
158       tgt="${tgt%_plugin_la-*.lo}"
159       ;;
160     lib*_plugin.la)
161       tgt="${tgt#lib}"
162       tgt="${tgt%_plugin.la}"
163       ;;
164     *)
165       ;;
166   esac
167
168   case "$tgt" in
169     --prefix=*)
170       prefix="${optarg}"
171       if test "${exec_prefix_set}" = no ; then
172         exec_prefix="${optarg}"
173       fi
174       ;;
175     --prefix)
176       echo_prefix=yes
177       ;;
178     --exec-prefix=*)
179       exec_prefix="${optarg}"
180       exec_prefix_set=yes
181       ;;
182     --exec-prefix)
183       echo_exec_prefix=yes
184       ;;
185     --version)
186       echo "@VERSION@"
187       exit 0
188       ;;
189     --linkage)
190       echo_linkage=yes
191       ;;
192     --list)
193       echo_list=yes
194       ;;
195     --cflags)
196       echo_cflags=yes
197       ;;
198     --cppflags)
199       echo_cppflags=yes
200       ;;
201     --cxxflags)
202       echo_cxxflags=yes
203       ;;
204     --objcflags)
205       echo_objcflags=yes
206       ;;
207     --ldflags)
208       echo_ldflags=yes
209       ;;
210     --libs|-libs)
211       echo_libs=yes
212       ;;
213     -*)
214       usage 1 1>&1
215       ;;
216     libvlccore)
217       cppflags="${cppflags} -D__LIBVLC__ -I${top_builddir}src/misc"
218       ;;
219     plugin)
220       echo_plugin=yes
221       cppflags="${cppflags} -D__LIBVLC__ -D__PLUGIN__"
222       ;;
223     builtin)
224       echo_builtin=yes
225       cppflags="${cppflags} -D__LIBVLC__ -D__BUILTIN__"
226       ;;
227     pic)
228       ;;
229     mozilla)
230       ;;
231     *)
232       module="$tgt"
233       ;;
234   esac
235
236   # Register per-module *FLAGS
237   register_flags "$tgt"
238
239   shift
240 done
241
242 #
243 #  If a module was requested, use its name
244 #
245 if test -n "${module}"; then
246   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module} -DMODULE_STRING=\"${module}\""
247 fi
248
249 #
250 #  Output what we were asked
251 #
252 if test "${echo_linkage}" = yes; then
253   echo "${linkage}"
254   exit 0
255 fi
256
257 if test "${echo_list}" = yes; then
258   if test "${echo_plugin}" = yes; then
259     echo "${plugins}"
260     printf '\n'
261   fi
262   if test "${echo_builtin}" = yes; then
263     echo "${builtins}"
264     printf '\n'
265   fi
266   exit 0
267 fi
268
269 if test "${echo_prefix}" = yes; then
270   echo "${prefix}"
271 fi
272 if test "${echo_exec_prefix}" = yes; then
273   echo "${exec_prefix}"
274 fi
275 if test "${echo_cppflags}" = yes; then
276   echo "${cppflags}"
277 fi
278 if test "${echo_cflags}" = yes; then
279   echo "${cppflags} ${cflags}"
280 fi
281 if test "${echo_cxxflags}" = yes; then
282   echo "${cppflags} ${cxxflags}"
283 fi
284 if test "${echo_objcflags}" = yes; then
285   echo "${cppflags} ${objcflags}"
286 fi
287 if test "${echo_ldflags}" = yes; then
288   echo "${ldflags}"
289 fi
290
291 # Libs
292 # There are 4 possibilities
293 #  - We are a plugin or a builtin
294 #  - We are building something from the inside (builtin)
295 #       - Link with builtins in place
296 #  If you want something shared from the inside (binding),
297 #  you need "builtin vlc"
298 if test "${echo_libs}" = yes; then
299   echo "${libs}"
300 fi