]> git.sesse.net Git - vlc/blob - vlc-config.in.in
129c7b7bb637c95d464fde3e3d1bd7a3275a8c34
[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 optim="@optim@"
9
10 plugins="@PLUGINS@ "
11 builtins="@BUILTINS@ "
12
13 cppflags=""
14 cflags=""
15 cxxflags=""
16 objcflags=""
17 ldflags=""
18 libs=""
19
20 cflags_tuning="@CFLAGS_TUNING@"
21
22 #
23 #  Do not touch below this place unless you really know what you are doing
24 #
25 usage()
26 {
27         cat << BLAH
28 Usage: vlc-config OPTIONS MODULES
29 Options:
30         [--prefix[=DIR]]          set prefix
31         [--exec-prefix[=DIR]]     set exec prefix
32         [--version]               print version and exit
33         [--linkage]               print linkage mode (c, c++, objc)
34         [--list]                  print modules names and exit
35         [--libs]                  output linking flags
36         [--cflags]                output C compilation flags
37         [--cxxflags]              output C++ compilation flags
38         [--objcflags]             output Objective C compilation flags
39 Modules:
40         vlc                       the main VLC object
41         plugin                    flags for plugin modules
42         builtin                   flags for built-in modules
43         pic                       flags for PIC code
44         MODULE                    any available module (dummy, gtk, avi, etc.)
45         libs                      flags for external libs
46 BLAH
47         exit $1
48 }
49
50 register_flags()
51 {
52   case "$1" in
53     #@1@#
54     *)
55       ;;
56   esac
57 }
58
59 if test $# -eq 0; then
60         usage 1 1>&2
61 fi
62
63 if test "${top_builddir}" != ""; then
64   top_builddir="${top_builddir}/"
65 elif test "${TOP_BUILDDIR}" != ""; then
66   top_builddir="${TOP_BUILDDIR}/"
67 fi
68 includes="${includes}"
69 cppflags="${includes}"
70 module=""
71 linkage="c"
72
73 #
74 #  On Linux and Solaris, activate 64-bit off_t (by default under BSD)
75 #
76 cppflags="${cppflags} -D_FILE_OFFSET_BITS=64 -D__USE_UNIX98 -D_REENTRANT -D_THREAD_SAFE"
77
78 #
79 #  Various additional defines
80 #
81 if [ "${optim}" = speed ]; then
82   cflags="${cflags} ${cflags_tuning}"
83   cxxflags="${cxxflags} ${cflags_tuning}"
84   objcflags="${objcflags} ${cflags_tuning}"
85 fi
86
87 #
88 #  The main argument loop
89 #
90 while test $# -gt 0; do
91   case "$1" in
92   -*=*) optarg=`echo "$1" | sed 's/-[_a-zA-Z0-9\-]*=//'` ;;
93   *) optarg= ;;
94   esac
95
96   # Mangle plugin name, if applicable
97   # This is just a convenience hack for modules/common.am
98   tgt="$1"
99   tgt="${tgt##*/}"
100   case "$tgt" in
101     lib*_plugin_la-*.lo)
102       tgt="${tgt#*lib}"
103       tgt="${tgt%_plugin_la-*.lo}"
104       ;;
105     lib*_plugin.la)
106       tgt="${tgt#lib}"
107       tgt="${tgt%_plugin.la}"
108       ;;
109     *)
110       ;;
111   esac
112
113   case "$tgt" in
114     --prefix=*)
115       prefix="${optarg}"
116       if test "${exec_prefix_set}" = no ; then
117         exec_prefix="${optarg}"
118       fi
119       ;;
120     --prefix)
121       echo_prefix=yes
122       ;;
123     --exec-prefix=*)
124       exec_prefix="${optarg}"
125       exec_prefix_set=yes
126       ;;
127     --exec-prefix)
128       echo_exec_prefix=yes
129       ;;
130     --version)
131       echo "@VERSION@"
132       exit 0
133       ;;
134     --linkage)
135       echo_linkage=yes
136       ;;
137     --list)
138       echo_list=yes
139       ;;
140     --cflags)
141       echo_cflags=yes
142       ;;
143     --cppflags)
144       echo_cppflags=yes
145       ;;
146     --cxxflags)
147       echo_cxxflags=yes
148       ;;
149     --objcflags)
150       echo_objcflags=yes
151       ;;
152     --ldflags)
153       echo_ldflags=yes
154       ;;
155     --libs|-libs)
156       echo_libs=yes
157       ;;
158     -*)
159       usage 1 1>&1
160       ;;
161     libvlccore)
162       cppflags="${cppflags} -D__LIBVLC__ -I${top_builddir}src/misc"
163       ;;
164     plugin)
165       echo_plugin=yes
166       cppflags="${cppflags} -D__LIBVLC__ -D__PLUGIN__"
167       ;;
168     builtin)
169       echo_builtin=yes
170       cppflags="${cppflags} -D__LIBVLC__ -D__BUILTIN__"
171       ;;
172     pic)
173       ;;
174     *)
175       module="$tgt"
176       ;;
177   esac
178
179   # Register per-module *FLAGS
180   register_flags "$tgt"
181
182   shift
183 done
184
185 #
186 #  If a module was requested, use its name
187 #
188 if test -n "${module}"; then
189   cppflags="${cppflags} -DMODULE_NAME=${module} -DMODULE_NAME_IS_${module} -DMODULE_STRING=\"${module}\""
190 fi
191
192 #
193 #  Output what we were asked
194 #
195 if test "${echo_linkage}" = yes; then
196   echo "${linkage}"
197   exit 0
198 fi
199
200 if test "${echo_list}" = yes; then
201   if test "${echo_plugin}" = yes; then
202     echo "${plugins}"
203     printf '\n'
204   fi
205   if test "${echo_builtin}" = yes; then
206     echo "${builtins}"
207     printf '\n'
208   fi
209   exit 0
210 fi
211
212 if test "${echo_prefix}" = yes; then
213   echo "${prefix}"
214 fi
215 if test "${echo_exec_prefix}" = yes; then
216   echo "${exec_prefix}"
217 fi
218 if test "${echo_cppflags}" = yes; then
219   echo "${cppflags}"
220 fi
221 if test "${echo_cflags}" = yes; then
222   echo "${cppflags} ${cflags}"
223 fi
224 if test "${echo_cxxflags}" = yes; then
225   echo "${cppflags} ${cxxflags}"
226 fi
227 if test "${echo_objcflags}" = yes; then
228   echo "${cppflags} ${objcflags}"
229 fi
230 if test "${echo_ldflags}" = yes; then
231   echo "${ldflags}"
232 fi
233
234 # Libs
235 # There are 4 possibilities
236 #  - We are a plugin or a builtin
237 #  - We are building something from the inside (builtin)
238 #       - Link with builtins in place
239 #  If you want something shared from the inside (binding),
240 #  you need "builtin vlc"
241 if test "${echo_libs}" = yes; then
242   echo "${libs}"
243 fi