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