add comments to profiles
[vlc.git] / vlc-config.in.in
blob55211fb5ce3f64286c297cd6bda83dac741b1e5c
1 #!/bin/sh
3 prefix="@prefix@"
4 exec_prefix="@exec_prefix@"
5 exec_prefix_set=no
6 datarootdir="@datarootdir@"
8 release="@release@"
9 debug="@debug@"
10 gprof="@gprof@"
11 cprof="@cprof@"
12 optim="@optim@"
14 plugins="@PLUGINS@ "
15 builtins="@BUILTINS@ "
17 cppflags=""
18 cflags=""
19 cxxflags=""
20 objcflags=""
21 ldflags=""
22 libs=""
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@"
31 # Do not touch below this place unless you really know what you are doing
33 usage()
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
57 register_flags()
59 case "$1" in
60 #@1@#
63 esac
66 if test $# -eq 0; then
67 usage 1 1>&2
71 # No need to include the default @*FLAGS@ values here because they are
72 # automatically added when using $(COMPILE), $(CXXCOMPILE) or $(OBJCCOMPILE)
74 if test "@includedir@" != "/usr/include"; then
75 includes="-I@includedir@"
77 if test "${top_builddir}" != ""; then
78 top_builddir="${top_builddir}/"
79 elif test "${TOP_BUILDDIR}" != ""; then
80 top_builddir="${TOP_BUILDDIR}/"
82 includes="${includes}"
83 cppflags="${includes}"
84 module=""
85 linkage="c"
88 # On Linux and Solaris, activate 64-bit off_t (by default under BSD)
90 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_LARGEFILE64_SOURCE -D_REENTRANT -D_THREAD_SAFE"
93 # Various additional defines
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"
102 if [ "${cprof}" = yes ]; then
103 cppflags="${cppflags} -DCPROF"
104 cflags="${cflags} -finstrument-functions"
105 cxxflags="${cxxflags} -finstrument-functions"
106 objcflags="${objcflags} -finstrument-functions"
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"
115 if [ "${release}" = yes ]; then
116 cppflags="${cppflags} -DHAVE_RELEASE"
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}"
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}"
136 else
137 cflags="${cflags} ${cflags_nooptim}"
138 cxxflags="${cxxflags} ${cflags_nooptim}"
139 objcflags="${objcflags} ${cflags_nooptim}"
143 # The main argument loop
145 while test $# -gt 0; do
146 case "$1" in
147 -*=*) optarg=`echo "$1" | sed 's/-[_a-zA-Z0-9\-]*=//'` ;;
148 *) optarg= ;;
149 esac
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}"
160 lib*_plugin.la)
161 tgt="${tgt#lib}"
162 tgt="${tgt%_plugin.la}"
166 esac
168 case "$tgt" in
169 --prefix=*)
170 prefix="${optarg}"
171 if test "${exec_prefix_set}" = no ; then
172 exec_prefix="${optarg}"
175 --prefix)
176 echo_prefix=yes
178 --exec-prefix=*)
179 exec_prefix="${optarg}"
180 exec_prefix_set=yes
182 --exec-prefix)
183 echo_exec_prefix=yes
185 --version)
186 echo "@VERSION@"
187 exit 0
189 --linkage)
190 echo_linkage=yes
192 --list)
193 echo_list=yes
195 --cflags)
196 echo_cflags=yes
198 --cppflags)
199 echo_cppflags=yes
201 --cxxflags)
202 echo_cxxflags=yes
204 --objcflags)
205 echo_objcflags=yes
207 --ldflags)
208 echo_ldflags=yes
210 --libs|-libs)
211 echo_libs=yes
214 usage 1 1>&1
216 libvlc)
217 cppflags="${cppflags} -D__LIBVLC__ -I${top_builddir}src/misc"
219 plugin)
220 echo_plugin=yes
221 cppflags="${cppflags} -D__LIBVLC__ -D__PLUGIN__"
223 builtin)
224 echo_builtin=yes
225 cppflags="${cppflags} -D__LIBVLC__ -D__BUILTIN__"
227 pic)
229 mozilla)
232 module="$tgt"
234 esac
236 # Register per-module *FLAGS
237 register_flags "$tgt"
239 shift
240 done
243 # If a module was requested, use its name
245 if test -n "${module}"; then
246 cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module} -DMODULE_STRING=\"${module}\""
250 # Output what we were asked
252 if test "${echo_linkage}" = yes; then
253 echo "${linkage}"
254 exit 0
257 if test "${echo_list}" = yes; then
258 if test "${echo_plugin}" = yes; then
259 echo "${plugins}"
260 printf '\n'
262 if test "${echo_builtin}" = yes; then
263 echo "${builtins}"
264 printf '\n'
266 exit 0
269 if test "${echo_prefix}" = yes; then
270 echo "${prefix}"
272 if test "${echo_exec_prefix}" = yes; then
273 echo "${exec_prefix}"
275 if test "${echo_cppflags}" = yes; then
276 echo "${cppflags}"
278 if test "${echo_cflags}" = yes; then
279 echo "${cppflags} ${cflags}"
281 if test "${echo_cxxflags}" = yes; then
282 echo "${cppflags} ${cxxflags}"
284 if test "${echo_objcflags}" = yes; then
285 echo "${cppflags} ${objcflags}"
287 if test "${echo_ldflags}" = yes; then
288 echo "${ldflags}"
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}"