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