libvlc_audio: we don't need VLC_PUBLIC_API here (already declared in the
[vlc.git] / 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 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 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   cppflags="${cppflags} -DDEBUG"
99   cflags="${cflags} -g ${cflags_werror}"
100   cxxflags="${cxxflags} -g"
101   objcflags="${objcflags} -g"
102   ldflags="${ldflags} -g"
103 fi
104 if [ "${cprof}" = yes ]; then
105   cppflags="${cppflags} -DCPROF"
106   cflags="${cflags} -finstrument-functions"
107   cxxflags="${cxxflags} -finstrument-functions"
108   objcflags="${objcflags} -finstrument-functions"
109 fi
110 if [ "${gprof}" = yes ]; then
111   cppflags="${cppflags} -DGPROF"
112   cflags="${cflags} -pg"
113   cxxflags="${cxxflags} -pg"
114   objcflags="${objcflags} -pg"
115   ldflags="${ldflags} -pg"
116 fi
117 if [ "${release}" = yes ]; then
118   cppflags="${cppflags} -DHAVE_RELEASE"
119 fi
120 if [ "${optim}" = size ]; then
121   cflags="${cflags} ${cflags_optim_size} ${cflags_tuning}"
122   cxxflags="${cxxflags} ${cflags_optim_size} ${cflags_tuning}"
123   objcflags="${objcflags} ${cflags_optim_size} ${cflags_tuning}"
124   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
125     cflags="${cflags} ${cflags_optim_nodebug}"
126     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
127     objcflags="${objcflags} ${cflags_optim_nodebug}"
128   fi
129 elif [ "${optim}" = speed ]; then
130   cflags="${cflags} ${cflags_optim_speed} ${cflags_tuning}"
131   cxxflags="${cxxflags} ${cflags_optim_speed} ${cflags_tuning}"
132   objcflags="${objcflags} ${cflags_optim_speed} ${cflags_tuning}"
133   if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
134     cflags="${cflags} ${cflags_optim_nodebug}"
135     cxxflags="${cxxflags} ${cflags_optim_nodebug}"
136     objcflags="${objcflags} ${cflags_optim_nodebug}"
137   fi
138 else
139   cflags="${cflags} ${cflags_nooptim}"
140   cxxflags="${cxxflags} ${cflags_nooptim}"
141   objcflags="${objcflags} ${cflags_nooptim}"
142 fi
143
144 #
145 #  The main argument loop
146 #
147 while test $# -gt 0; do
148   case "$1" in
149   -*=*) optarg=`echo "$1" | sed 's/-[_a-zA-Z0-9\-]*=//'` ;;
150   *) optarg= ;;
151   esac
152
153   # Mangle plugin name, if applicable
154   # This is just a convenience hack for modules/common.am
155   tgt="$1"
156   tgt="${tgt##*/}"
157   case "$tgt" in
158     lib*_plugin_la-*.lo)
159       tgt="${tgt#*lib}"
160       tgt="${tgt%_plugin_la-*.lo}"
161       ;;
162     lib*_plugin.la)
163       tgt="${tgt#lib}"
164       tgt="${tgt%_plugin.la}"
165       ;;
166     *)
167       ;;
168   esac
169
170   case "$tgt" in
171     --prefix=*)
172       prefix="${optarg}"
173       if test "${exec_prefix_set}" = no ; then
174         exec_prefix="${optarg}"
175       fi
176       ;;
177     --prefix)
178       echo_prefix=yes
179       ;;
180     --exec-prefix=*)
181       exec_prefix="${optarg}"
182       exec_prefix_set=yes
183       ;;
184     --exec-prefix)
185       echo_exec_prefix=yes
186       ;;
187     --version)
188       echo "@VERSION@"
189       exit 0
190       ;;
191     --linkage)
192       echo_linkage=yes
193       ;;
194     --list)
195       echo_list=yes
196       ;;
197     --cflags)
198       echo_cflags=yes
199       ;;
200     --cppflags)
201       echo_cppflags=yes
202       ;;
203     --cxxflags)
204       echo_cxxflags=yes
205       ;;
206     --objcflags)
207       echo_objcflags=yes
208       ;;
209     --ldflags)
210       echo_ldflags=yes
211       ;;
212     --libs|-libs)
213       echo_libs=yes
214       ;;
215     -*)
216       usage 1 1>&1
217       ;;
218     libvlccore)
219       cppflags="${cppflags} -D__LIBVLC__ -I${top_builddir}src/misc"
220       ;;
221     plugin)
222       echo_plugin=yes
223       cppflags="${cppflags} -D__LIBVLC__ -D__PLUGIN__"
224       ;;
225     builtin)
226       echo_builtin=yes
227       cppflags="${cppflags} -D__LIBVLC__ -D__BUILTIN__"
228       ;;
229     pic)
230       ;;
231     mozilla)
232       ;;
233     *)
234       module="$tgt"
235       ;;
236   esac
237
238   # Register per-module *FLAGS
239   register_flags "$tgt"
240
241   shift
242 done
243
244 #
245 #  If a module was requested, use its name
246 #
247 if test -n "${module}"; then
248   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module} -DMODULE_STRING=\"${module}\""
249 fi
250
251 #
252 #  Output what we were asked
253 #
254 if test "${echo_linkage}" = yes; then
255   echo "${linkage}"
256   exit 0
257 fi
258
259 if test "${echo_list}" = yes; then
260   if test "${echo_plugin}" = yes; then
261     echo "${plugins}"
262     printf '\n'
263   fi
264   if test "${echo_builtin}" = yes; then
265     echo "${builtins}"
266     printf '\n'
267   fi
268   exit 0
269 fi
270
271 if test "${echo_prefix}" = yes; then
272   echo "${prefix}"
273 fi
274 if test "${echo_exec_prefix}" = yes; then
275   echo "${exec_prefix}"
276 fi
277 if test "${echo_cppflags}" = yes; then
278   echo "${cppflags}"
279 fi
280 if test "${echo_cflags}" = yes; then
281   echo "${cppflags} ${cflags}"
282 fi
283 if test "${echo_cxxflags}" = yes; then
284   echo "${cppflags} ${cxxflags}"
285 fi
286 if test "${echo_objcflags}" = yes; then
287   echo "${cppflags} ${objcflags}"
288 fi
289 if test "${echo_ldflags}" = yes; then
290   echo "${ldflags}"
291 fi
292
293 # Libs
294 # There are 4 possibilities
295 #  - We are a plugin or a builtin
296 #  - We are building something from the inside (builtin)
297 #       - Link with builtins in place
298 #  If you want something shared from the inside (binding),
299 #  you need "builtin vlc"
300 if test "${echo_libs}" = yes; then
301   echo "${libs}"
302 fi