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