]> git.sesse.net Git - vlc/blob - vlc-config.in.in
directory: handle fd:// syntax
[vlc] / vlc-config.in.in
1 #!@SHELL@
2
3 prefix="@prefix@"
4 exec_prefix="@exec_prefix@"
5 exec_prefix_set=no
6 datarootdir="@datarootdir@"
7
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 libs=""
22
23 cflags_tuning="@CFLAGS_TUNING@"
24 cflags_optim_size="@CFLAGS_OPTIM_SIZE@"
25 cflags_optim_speed="@CFLAGS_OPTIM_SPEED@"
26 cflags_optim_nodebug="@CFLAGS_OPTIM_NODEBUG@"
27 cflags_nooptim="@CFLAGS_NOOPTIM@"
28
29 cflags_werror="@CFLAGS_WERROR@"
30
31 #
32 #  Do not touch below this place unless you really know what you are doing
33 #
34 usage()
35 {
36         cat << BLAH
37 Usage: vlc-config OPTIONS MODULES
38 Options:
39         [--prefix[=DIR]]          set prefix
40         [--exec-prefix[=DIR]]     set exec prefix
41         [--version]               print version and exit
42         [--linkage]               print linkage mode (c, c++, objc)
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         libs                      flags for external libs
55 BLAH
56         exit $1
57 }
58
59 register_flags()
60 {
61   case "$1" in
62     #@1@#
63     *)
64       ;;
65   esac
66 }
67
68 if test $# -eq 0; then
69         usage 1 1>&2
70 fi
71
72 #
73 #  No need to include the default @*FLAGS@ values here because they are
74 #  automatically added when using $(COMPILE), $(CXXCOMPILE) or $(OBJCCOMPILE)
75 #
76 if test "@includedir@" != "/usr/include"; then
77   includes="-I@includedir@"
78 fi
79 if test "${top_builddir}" != ""; then
80   top_builddir="${top_builddir}/"
81 elif test "${TOP_BUILDDIR}" != ""; then
82   top_builddir="${TOP_BUILDDIR}/"
83 fi
84 includes="${includes}"
85 cppflags="${includes}"
86 module=""
87 linkage="c"
88
89 #
90 #  On Linux and Solaris, activate 64-bit off_t (by default under BSD)
91 #
92 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE"
93
94 #
95 #  Various additional defines
96 #
97 if [ "${debug}" = yes ]; then
98   cflags="${cflags} -g"
99   cxxflags="${cxxflags} -g"
100   objcflags="${objcflags} -g"
101   ldflags="${ldflags} -g"
102 fi
103 if [ "${cprof}" = yes ]; then
104   cflags="${cflags} -finstrument-functions"
105   cxxflags="${cxxflags} -finstrument-functions"
106   objcflags="${objcflags} -finstrument-functions"
107 fi
108 if [ "${gprof}" = yes ]; then
109   cflags="${cflags} -pg"
110   cxxflags="${cxxflags} -pg"
111   objcflags="${objcflags} -pg"
112   ldflags="${ldflags} -pg"
113 fi
114 if [ "${optim}" = size ]; then
115   cflags="${cflags} ${cflags_optim_size} ${cflags_tuning}"
116   cxxflags="${cxxflags} ${cflags_optim_size} ${cflags_tuning}"
117   objcflags="${objcflags} ${cflags_optim_size} ${cflags_tuning}"
118   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
119     cflags="${cflags} ${cflags_optim_nodebug}"
120     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
121     objcflags="${objcflags} ${cflags_optim_nodebug}"
122   fi
123 elif [ "${optim}" = speed ]; then
124   cflags="${cflags} ${cflags_optim_speed} ${cflags_tuning}"
125   cxxflags="${cxxflags} ${cflags_optim_speed} ${cflags_tuning}"
126   objcflags="${objcflags} ${cflags_optim_speed} ${cflags_tuning}"
127   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
128     cflags="${cflags} ${cflags_optim_nodebug}"
129     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
130     objcflags="${objcflags} ${cflags_optim_nodebug}"
131   fi
132 else
133   cflags="${cflags} ${cflags_nooptim}"
134   cxxflags="${cxxflags} ${cflags_nooptim}"
135   objcflags="${objcflags} ${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   # Mangle plugin name, if applicable
148   # This is just a convenience hack for modules/common.am
149   tgt="$1"
150   tgt="${tgt##*/}"
151   case "$tgt" in
152     lib*_plugin_la-*.lo)
153       tgt="${tgt#*lib}"
154       tgt="${tgt%_plugin_la-*.lo}"
155       ;;
156     lib*_plugin.la)
157       tgt="${tgt#lib}"
158       tgt="${tgt%_plugin.la}"
159       ;;
160     *)
161       ;;
162   esac
163
164   case "$tgt" in
165     --prefix=*)
166       prefix="${optarg}"
167       if test "${exec_prefix_set}" = no ; then
168         exec_prefix="${optarg}"
169       fi
170       ;;
171     --prefix)
172       echo_prefix=yes
173       ;;
174     --exec-prefix=*)
175       exec_prefix="${optarg}"
176       exec_prefix_set=yes
177       ;;
178     --exec-prefix)
179       echo_exec_prefix=yes
180       ;;
181     --version)
182       echo "@VERSION@"
183       exit 0
184       ;;
185     --linkage)
186       echo_linkage=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     libvlccore)
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     libs)
224       # Avoid to use werror on what is not vlc's code.
225       cflags_werror=""
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 # Set the Werror flags.
251 #
252
253 cflags="${cflags} ${cflags_werror}"
254
255 #
256 #  Output what we were asked
257 #
258 if test "${echo_linkage}" = yes; then
259   echo "${linkage}"
260   exit 0
261 fi
262
263 if test "${echo_list}" = yes; then
264   if test "${echo_plugin}" = yes; then
265     echo "${plugins}"
266     printf '\n'
267   fi
268   if test "${echo_builtin}" = yes; then
269     echo "${builtins}"
270     printf '\n'
271   fi
272   exit 0
273 fi
274
275 if test "${echo_prefix}" = yes; then
276   echo "${prefix}"
277 fi
278 if test "${echo_exec_prefix}" = yes; then
279   echo "${exec_prefix}"
280 fi
281 if test "${echo_cppflags}" = yes; then
282   echo "${cppflags}"
283 fi
284 if test "${echo_cflags}" = yes; then
285   echo "${cppflags} ${cflags}"
286 fi
287 if test "${echo_cxxflags}" = yes; then
288   echo "${cppflags} ${cxxflags}"
289 fi
290 if test "${echo_objcflags}" = yes; then
291   echo "${cppflags} ${objcflags}"
292 fi
293 if test "${echo_ldflags}" = yes; then
294   echo "${ldflags}"
295 fi
296
297 # Libs
298 # There are 4 possibilities
299 #  - We are a plugin or a builtin
300 #  - We are building something from the inside (builtin)
301 #       - Link with builtins in place
302 #  If you want something shared from the inside (binding),
303 #  you need "builtin vlc"
304 if test "${echo_libs}" = yes; then
305   echo "${libs}"
306 fi