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