]> git.sesse.net Git - vlc/blob - bootstrap
* Re-enabled package-* Makefile rules,
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap file for vlc, the VideoLAN Client
4 ##  $Id: bootstrap,v 1.35 2002/12/25 21:02:35 massiot Exp $
5 ##
6 ##  Authors: Samuel Hocevar <sam@zoy.org>
7
8 ###
9 ###  Get a sane environment, just in case
10 ###
11 LANG=C
12 export LANG
13 CYGWIN=binmode
14 export CYGWIN
15
16 ##
17 ##  Give help
18 ##
19 help()
20 {
21   if test "$do_help" = "yes"
22   then
23     cat << EOF
24 recognized flags are:
25   --config        create Makefile and configure scripts (read HACKING)
26   --update-vc     update Microsoft Visual Studio files
27   --update-po     update translation files
28 EOF
29     exit 1
30   fi
31 }
32
33 ###
34 ###  argument check
35 ###
36 test "$EMAIL" = "sam@zoy.org" && do_help=yes || do_help=no
37 do_po=no
38 do_vc=no
39 while test $# -gt 0; do
40   case "$1" in
41     --config)
42       do_help=no
43       ;;
44     --update-vc)
45       do_help=no
46       do_vc=yes
47       ;;
48     --update-po)
49       do_help=no
50       do_po=yes
51       ;;
52     *)
53       echo "$0: unknown option $1"
54       do_help=yes
55       help
56       ;;
57   esac
58   shift
59 done
60
61 ##
62 ##  Give help if needed
63 ##
64 help
65
66 ##
67 ##  Update the MSVC project files
68 ##
69 if test "$do_vc" = "yes"
70 then
71   if test ! -f Makefile
72   then
73     echo "no Makefile found, did you run ./configure?"
74     exit 1
75   fi
76
77   echo "generating Visual Studio files..."
78
79   #  The evil ^M
80   M='\r'
81
82   #  Sources that get built under Win32 - FIXME: anyone wanna deuglify this? :)
83   LIBVLC_SOURCES=`awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_common'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p';  awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_win32'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_dirent'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_getopt'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'SOURCES_libvlc_libc'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'`
84
85   LIBVLC_HEADERS=`awk 'BEGIN{a=0}{if(!a&&/^'HEADERS_include'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'; awk 'BEGIN{a=0}{if(!a&&/^'HEADERS_include_built'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'`
86
87   LIBVLC_PKG_HEADERS=`awk 'BEGIN{a=0}{if(!a&&/^'dist_pkginclude_HEADERS'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' < Makefile.am | tr '\\ ' '\n\n' | sed -ne 's/[^$-_a-zA-Z0-9][^$-_a-zA-Z0-9]*\([a-zA-Z]\)/\1/p'`
88
89   # Clean up
90   rm -f evc/*.vcp msvc/*.dsp
91
92   # libvlc files
93   for target in evc/libvlc.vcp msvc/libvlc.dsp
94   do
95     echo "${target}"
96     #  Top of the project file
97     perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
98     #  The source files
99     for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
100     do
101       cat >> ${target} << EOF
102 # Begin Source File${M}
103 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
104 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
105 # End Source File${M}
106 EOF
107     done
108     for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
109     do
110       cat >> ${target} << EOF
111 # Begin Group "${subdir}"${M}
112 EOF
113       for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
114       do
115       if test "${target}" = "evc/libvlc.vcp"
116       then
117         cat >> ${target} << EOF
118 # Begin Source File${M}
119 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
120 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
121 !IF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Release"${M}
122 # PROP Output_Dir "MIPSRel\\${subdir}"${M}
123 # PROP Intermediate_Dir "MIPSRel\\${subdir}"${M}
124 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE MIPS) Debug"${M}
125 # PROP Output_Dir "MIPSDbg\\${subdir}"${M}
126 # PROP Intermediate_Dir "MIPSDbg\\${subdir}"${M}
127 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Release"${M}
128 # PROP Output_Dir "SH4Rel\\${subdir}"${M}
129 # PROP Intermediate_Dir "SH4Rel\\${subdir}"${M}
130 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH4) Debug"${M}
131 # PROP Output_Dir "SH4Dbg\\${subdir}"${M}
132 # PROP Intermediate_Dir "SH4Dbg\\${subdir}"${M}
133 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Release"${M}
134 # PROP Output_Dir "SH3Rel\\${subdir}"${M}
135 # PROP Intermediate_Dir "SH3Rel\\${subdir}"${M}
136 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE SH3) Debug"${M}
137 # PROP Output_Dir "SH3Dbg\\${subdir}"${M}
138 # PROP Intermediate_Dir "SH3Dbg\\${subdir}"${M}
139 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Release"${M}
140 # PROP Output_Dir "ARMRel\\${subdir}"${M}
141 # PROP Intermediate_Dir "ARMRel\\${subdir}"${M}
142 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE ARM) Debug"${M}
143 # PROP Output_Dir "ARMDbg\\${subdir}"${M}
144 # PROP Intermediate_Dir "ARMDbg\\${subdir}"${M}
145 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Release"${M}
146 # PROP Output_Dir "X86EMRel\\${subdir}"${M}
147 # PROP Intermediate_Dir "X86EMRel\\${subdir}"${M}
148 !ELSEIF "\$(CFG)" == "libvlc - Win32 (WCE x86em) Debug"${M}
149 # PROP Output_Dir "X86EMDbg\\${subdir}"${M}
150 # PROP Intermediate_Dir "X86EMDbg\\${subdir}"${M}
151 !ENDIF${M}
152 # End Source File${M}
153 EOF
154         else
155           cat >> ${target} << EOF
156 # Begin Source File${M}
157 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
158 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
159 !IF "\$(CFG)" == "libvlc - Win32 Release"${M}
160 # PROP Output_Dir "Release\\${subdir}"${M}
161 # PROP Intermediate_Dir "Release\\${subdir}"${M}
162 !ELSEIF "\$(CFG)" == "libvlc - Win32 Debug"${M}
163 # PROP Output_Dir "Debug\\${subdir}"${M}
164 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
165 !ENDIF${M}
166 # End Source File${M}
167 EOF
168         fi
169       done
170       cat >> ${target} << EOF
171 # End Group${M}
172 EOF
173     done
174     #  The headers
175     perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${target}.in >> ${target}
176     for file in ${LIBVLC_HEADERS}
177     do
178       cat >> ${target} << EOF
179 # Begin Source File${M}
180 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
181 # End Source File${M}
182 EOF
183     done
184     cat >> ${target} << EOF
185 # Begin Group "vlc"${M}
186 EOF
187     for file in ${LIBVLC_PKG_HEADERS}
188     do
189       cat >> ${target} << EOF
190 # Begin Source File${M}
191 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
192 # End Source File${M}
193 EOF
194     done
195     cat >> ${target} << EOF
196 # End Group${M}
197 EOF
198     perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
199   done
200
201   # plugins files
202   grep '^L_[^ ]*_pic =' Modules.am | while read a b c
203   do
204     makefile="`echo $c | sed -e 's@/[^/]*$@/Modules.am@'`"
205     plugin="`echo $a | sed 's/L_\(.*\)_pic/\1/'`"
206     # this is an attempt at getting a list of plugin sources... we take the
207     # production and remove everything that does not contain "module", which
208     # means you miss $(NULL), but other variables too.
209     cfiles=`grep -v '[^-_a-zA-Z0-9]*#' ${makefile} | awk 'BEGIN{a=0}{if(!a&&/^SOURCES_'${plugin}'[^-_a-zA-Z0-9]*=/){a=1;print$0;next;}if(a){if(/^[a-zA-Z]/){exit;}print $0}}' | tr '\\ ' '\n\n' | sed -ne 's,/,\\\\,g; s/.*modules/modules/p'`
210     hfiles=`for i in ${cfiles} ; do echo $i ; done | grep '\.h$'`
211     cfiles=`for i in ${cfiles} ; do echo $i ; done | grep -v '\.h$'`
212     for dir in evc msvc
213     do
214       test "${dir}" = "evc" && suf="vcp" || suf="dsp"
215       source="${dir}/plugins.${suf}.in"
216       target="${dir}/plugin_${plugin}.${suf}"
217       echo "${target}"
218       perl -pe 'if(/§SOURCES§/){last;} s/§PLUGIN§/'${plugin}'/g' < ${source} > ${target}
219       for cfile in ${cfiles}
220       do
221         cat >> ${target} << EOF
222 # Begin Source File${M}
223 SOURCE="..\\${cfile}"${M}
224 # End Source File${M}
225 EOF
226       done
227       # sed is really nicer for this... unfortunately it's broken under cygwin
228       # sed -ne '1,/§SOURCES§/d; /§HEADERS§/,$d; p' < ${source} >> ${target}
229       perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${source} >> ${target}
230       for hfile in ${hfiles}
231       do
232         cat >> ${target} << EOF
233 # Begin Source File${M}
234 SOURCE="..\\${hfile}"${M}
235 # End Source File${M}
236 EOF
237       done
238       # sed -ne '1,/§HEADERS§/d; p' < ${source} >> ${target}
239       perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${source} >> ${target}
240     done
241   done
242
243   # vlc files
244   for target in evc/vlc.vcp msvc/vlc.dsp
245   do
246     echo "${target}"
247     #  Top of the project file
248     perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
249     #  The source files
250     if test "${target}" = "evc/vlc.vcp"
251     then
252       cat >> ${target} << EOF
253 # Begin Source File${M}
254 SOURCE="..\\evc\\vlc.c"${M}
255 # End Source File${M}
256 EOF
257     else
258       cat >> ${target} << EOF
259 # Begin Source File${M}
260 SOURCE="..\\src\\vlc.c"${M}
261 # End Source File${M}
262 EOF
263     fi
264     #  Bottom of the project file - handles resource files too
265     perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
266   done
267
268   echo "done."
269   exit 0
270 fi
271
272 ##
273 ##  Update the potfiles because no one ever does it
274 ##
275 if test "$do_po" = "yes"
276 then
277   cd po
278   make update-po #2>&1 | grep '^[^:]*:$' | cut -f1 -d: | tr '\n' ' ' | sed 's/ $//'
279   cd ..
280
281   exit 0
282 fi
283
284 ##
285 ## Check that our tools don't suck
286 ##
287 SEDSUCKS=no
288 if test ! 20000 -eq `perl -e 'printf "%s\n","a"x20000' | sed -e 's/.//' 2>/dev/null | wc -c`
289 then
290   SEDSUCKS=yes
291 fi
292
293 PERLSUCKS=no
294 AUTOMAKESUCKS=no
295 INSTALLSUCKS=no
296
297 # Mac OS X stacksize sucks
298 if test x`uname -s` = xDarwin; then ulimit -s 20000; fi
299
300 ##
301 ## Generate the modules makefile, by parsing modules/**/Modules.am
302 ##
303
304 printf "generating Modules.am and configure.ac"
305
306 echo > Modules.am
307 echo > configure.ac
308
309 ALL_FLAGS="`sed -n -e '/^[^=A-Z]*[A-Z]*FLAGS_[^=]*=/s/[^=A-Z]*\([A-Z]*FLAGS_[^=]*=\).*/\1/p' < configure.ac.in | sort | uniq`"
310
311 cat >> configure.ac << EOF
312 dnl ################################################################
313 dnl # Do not edit this file, it was generated from configure.ac.in #
314 dnl ################################################################
315
316 EOF
317 sed -n -e '/dnl do not touch this line/q;p' < configure.ac.in >> configure.ac
318
319 modules=""
320 for mf in `sed -ne 's@[^a-z]*\([^ ]*\)am.*@modules/\1am@p' < modules/Makefile.am`
321 do
322   printf "."
323   dir=`echo ${mf} | sed -e 's@\(.*\)/.*@\1@'`
324   topdir=`echo ${dir} | cut -f2 -d/`
325   sym=`echo ${dir} | sed -e 'y@/@_@'`
326   cat >> Modules.am << EOF
327 # Directory ${dir}
328
329 include ${dir}/Modules.am
330
331 EOF
332   sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
333   do
334     LINKER="LINK"
335     if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
336         echo "AC_SUBST(CPPFLAGS_${mod})" >> configure.ac; fi
337     if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
338         echo "AC_SUBST(CFLAGS_${mod})" >> configure.ac; fi
339     if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
340         LINKER="CXXLINK"
341         echo "AC_SUBST(CXXFLAGS_${mod})" >> configure.ac; fi
342     if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
343         LINKER="OBJCLINK"
344         echo "AC_SUBST(OBJCFLAGS_${mod})" >> configure.ac; fi
345     if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
346         echo "AC_SUBST(LDFLAGS_${mod})" >> configure.ac; fi
347     if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
348         PRIVATE='#'; else
349         PRIVATE=''; fi
350     if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
351         NODIST=''; else
352         NODIST='#'; fi
353     cat >> configure.ac << EOF
354 AM_CONDITIONAL(${mod}_plugin, test x\$${mod}_plugin = xyes)
355 AM_CONDITIONAL(${mod}_builtin, test x\$${mod}_builtin = xyes)
356 EOF
357 # Generation of Modules.am
358 # ~~~~~~~~~~~~~~~~~~~~~~~~
359 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
360 #   S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
361 #   the resulting file size.
362 # - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
363 #   does not seem to work properly with any automake version I tested.
364     cat >> Modules.am << EOF
365 # The ${mod} plugin
366
367 if ${mod}_plugin
368 if UNTRUE
369 L_${mod}_p = ${dir}/lib${mod}_plugin.a
370 endif
371 D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
372 ${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
373 endif
374 if ${mod}_builtin
375 L_${mod}_b = ${dir}/lib${mod}.a
376 F_${mod}_b = \$(LDFLAGS_${mod})
377 if BUILD_MOZILLA
378 L_${mod}_pic = ${dir}/lib${mod}_pic.a
379 endif
380 ${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
381 endif
382
383 L_builtin += \$(L_${mod}_b)
384 L_builtin_pic += \$(L_${mod}_pic)
385 LDFLAGS_builtin += \$(F_${mod}_b)
386 ${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
387 PLUGIN_FILES += \$(D_${mod}_p)
388
389 ${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
390 ${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
391 ${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
392 ${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
393 ${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
394 ${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
395
396 ${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
397 ${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
398 ${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
399 ${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
400 ${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
401 ${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
402
403 ${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
404 ${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
405 ${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
406 ${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
407 ${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
408 ${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
409
410 libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
411 lib${mod}_DATA = \$(D_${mod}_p)
412
413 lib${mod}dir = \$(libdir)/vlc/${topdir}
414 ${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
415 ${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
416 ${PRIVATE}      \$(${LINKER}) \$^ -shared \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})
417
418
419 EOF
420   done
421 done
422
423 echo "AM_CONDITIONAL(UNTRUE, false)" >> configure.ac
424 sed -n -e '/dnl do not touch this line/,//p' < configure.ac.in >> configure.ac
425
426 echo "done."
427
428 ###
429 ###  classic bootstrap stuff
430 ###
431 set -x
432 rm -f aclocal.m4 m4/oldgettext.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
433 rm -Rf intl
434
435 # Check for gettext
436 if gettextize --version >/dev/null 2>&1
437 then
438 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
439         '>' 0.11.2 >/dev/null 2>&1
440 then
441   # We have gettext, and a recent version! Everything is cool.
442   autopoint || exit 1
443   GETTEXT=yes
444 else
445   # User's gettext is too old. try to continue anyway.
446   mkdir -p intl
447   echo > intl/Makefile.am
448   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
449   GETTEXT=old
450 fi;else
451   # we don't have gettext. grmbl. try to continue anyway.
452   mkdir -p intl
453   echo > intl/Makefile.am
454   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
455   GETTEXT=no
456 fi
457
458 # Check for automake
459 amvers="none"
460 if automake-1.7 --version >/dev/null 2>&1
461 then
462   amvers="-1.7"
463 else
464   if automake-1.6 --version >/dev/null 2>&1
465   then
466     amvers="-1.6"
467     if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
468     then AUTOMAKESUCKS=yes
469     fi
470   else
471     if automake-1.5 --version >/dev/null 2>&1
472     then
473       INSTALLSUCKS=yes
474       amvers="-1.5"
475     else
476       if automake --version > /dev/null 2>&1
477       then
478         amvers=`automake --version | sed -e '1s/[^0-9]*//' -e q`
479         case $amvers in
480         1.6|1.6.0|1.6.1)
481           AUTOMAKESUCKS=yes ;;
482         1.5.*)
483           INSTALLSUCKS=yes ;;
484         esac
485
486         if expr "$amvers" "<" "1.5" > /dev/null 2>&1
487         then amvers="none"
488         else amvers=""
489         fi
490       fi
491     fi
492   fi
493 fi
494
495 if test x$amvers = xnone
496 then
497   set +x
498   echo "you need automake version 1.5 or later"
499   exit 1
500 fi
501
502 # Do the rest
503 aclocal${amvers} -I m4 || exit 1
504 autoheader || exit 1
505
506 automake${amvers} --foreign --add-missing --copy || PERLSUCKS=yes
507
508 case "$PERLSUCKS" in
509   no)
510   ;;
511   yes)
512     set +x
513     cat << EOF
514
515 =======================================================================
516 IMPORTANT NOTE: automake failed, please check the error messages. If it
517 actually segfaulted, it might be because of insufficient stack size; set
518 the stack size to something bigger or unlimited (\`unlimit stacksize')
519 and try again.
520 EOF
521     exit 1
522   ;;
523 esac
524
525 # Wrap automake's long lines, because the Solaris sed doesn't support lines
526 # longer than 3999 characters, and ./configure calls sed. We use Perl instead
527 # of sed for obvious reasons :)
528 perl -ne 'if(/^.{500}/) {s/(.{200}[^ ]* )/$1\\\n\t/g} print $_' < Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp Makefile.in
529
530 autoconf || exit 1
531
532 ##
533 ##  headers which need to be regenerated
534 ##
535 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
536 rm -f include/vlc_symbols.h
537 rm -f mozilla/vlcintf.h
538
539 ##
540 ##  Shut up
541 ##
542 set +x
543
544 ##
545 ##  Glade sometimes sucks
546 ##
547 echo "workarounds for annoying glade features"
548 for file in gnome_interface.c gtk_interface.c
549 do
550 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
551 then
552     rm -f /tmp/$$.$file.bak
553     cat > /tmp/$$.$file.bak << EOF
554 /* This file was created automatically by glade and fixed by bootstrap */
555
556 #include <vlc/vlc.h>
557 EOF
558     sed -e 1,7d \
559         -e 's#_("-:--:--")#"-:--:--"#' \
560         -e 's#_("---")#"---"#' \
561         -e 's#_("--")#"--"#' \
562         -e 's#_("/dev/dvd")#"/dev/dvd"#' \
563         -e 's#_(\("./."\))#\1#' \
564         < modules/gui/gtk/$file >> /tmp/$$.$file.bak
565     mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
566 fi
567 done
568
569 file=gtk_support.h
570 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
571 then
572     rm -f /tmp/$$.$file.bak
573     sed -e 's/DO NOT EDIT THIS FILE.*/This file was created automatically by glade and fixed by bootstrap/ ; s/#if.*ENABLE_NLS.*/#if defined( ENABLE_NLS ) \&\& defined ( HAVE_GETTEXT )/' < modules/gui/gtk/$file > /tmp/$$.$file.bak
574     mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
575 fi
576
577 ##
578 ##  Tell the user about gettext and sed
579 ##
580 case "$GETTEXT" in
581   yes)
582   ;;
583   no)
584     cat << EOF
585
586 ===========================================================
587 IMPORTANT NOTE: you do not have gettext installed on your
588 system. The vlc build will work, but you will not have
589 internationalization support. We suggest installing gettext.
590 EOF
591   ;;
592   old)
593     cat << EOF
594
595 ==========================================================
596 NOTE: you have an old version of gettext installed on your
597 system. We suggest upgrading to gettext 0.11.3 or later.
598 EOF
599   ;;
600 esac
601
602 case "$AUTOMAKESUCKS" in
603   no)
604   ;;
605   yes)
606     cat << EOF
607
608 =============================================================
609 IMPORTANT NOTE: your version of automake has a bug which will
610 prevent proper plugin compilation. Either compile VLC with
611 the --disable-plugins flag, or use a version of automake newer
612 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
613 EOF
614   ;;
615 esac
616
617 case "$INSTALLSUCKS" in
618   no)
619   ;;
620   yes)
621     cat << EOF
622
623 =============================================================
624 IMPORTANT NOTE: your version of automake has a bug which will
625 prevent proper installation. Do not use "make install" with this
626 version of automake, or use a version of automake newer than 1.5
627 (such as 1.6 or 1.7).
628 EOF
629   ;;
630 esac
631
632 case "$SEDSUCKS" in
633   no)
634   ;;
635   yes)
636     cat << EOF
637
638 =============================================================
639 IMPORTANT NOTE: the version of 'sed' on your system is unable
640 to handle long lines. bootstrap will try its best to generate
641 a correct Makefile, but you should expect problems. We highly
642 recommend installing GNU sed.
643 EOF
644   ;;
645 esac
646