3 ## bootstrap file for vlc, the VideoLAN Client
4 ## $Id: bootstrap,v 1.29 2002/11/19 17:38:06 sam Exp $
6 ## Authors: Samuel Hocevar <sam@zoy.org>
9 ### Get a sane environment, just in case
21 if test "$do_help" = "yes"
25 --config create Makefile and configure scripts (read HACKING)
26 --update-vc update Microsoft Visual Studio files
27 --update-po update translation files
36 test "$EMAIL" = "sam@zoy.org" && do_help=yes || do_help=no
39 while test $# -gt 0; do
53 echo "$0: unknown option $1"
62 ## Give help if needed
67 ## Update the MSVC project files
69 if test "$do_vc" = "yes"
73 echo "no Makefile found, did you run ./configure?"
77 echo "generating Visual Studio files..."
82 # Sources that get built under Win32
83 LIBVLC_SOURCES=`make show-libvlc-sources | grep '^X: ' | cut -b3-`
84 LIBVLC_HEADERS=`make show-libvlc-headers | grep '^X: ' | cut -b3-`
85 LIBVLC_PKG_HEADERS=`make show-libvlc-pkg-headers | grep '^X: ' | cut -b3-`
88 for target in evc/libvlc.vcp msvc/libvlc.dsp
92 # Top of the project file
93 perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
95 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
97 cat >> ${target} << EOF
98 # Begin Source File${M}
99 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
100 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
101 # End Source File${M}
104 for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
106 cat >> ${target} << EOF
107 # Begin Group "${subdir}"${M}
109 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
111 if test "${target}" = "evc/libvlc.vcp"
113 cat >> ${target} << EOF
114 # Begin Source File${M}
115 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
116 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
117 !IF "\$(CFG)" == "vlc - Win32 (WCE MIPS) Release"${M}
118 # PROP Intermediate_Dir "MIPSRel\\${subdir}"${M}
119 # PROP Output_Dir "MIPSRel\\${subdir}"${M}
120 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE MIPS) Debug"${M}
121 # PROP Intermediate_Dir "MIPSDbg\\${subdir}"${M}
122 # PROP Output_Dir "MIPSDbg\\${subdir}"${M}
123 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH4) Release"${M}
124 # PROP Intermediate_Dir "SH4Rel\\${subdir}"${M}
125 # PROP Output_Dir "SH4Rel\\${subdir}"${M}
126 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH4) Debug"${M}
127 # PROP Intermediate_Dir "SH4Dbg\\${subdir}"${M}
128 # PROP Output_Dir "SH4Dbg\\${subdir}"${M}
129 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH3) Release"${M}
130 # PROP Intermediate_Dir "SH3Rel\\${subdir}"${M}
131 # PROP Output_Dir "SH3Rel\\${subdir}"${M}
132 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH3) Debug"${M}
133 # PROP Intermediate_Dir "SH3Dbg\\${subdir}"${M}
134 # PROP Output_Dir "SH3Dbg\\${subdir}"${M}
135 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE ARM) Release"${M}
136 # PROP Intermediate_Dir "ARMRel\\${subdir}"${M}
137 # PROP Output_Dir "ARMRel\\${subdir}"${M}
138 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE ARM) Debug"${M}
139 # PROP Intermediate_Dir "ARMDbg\\${subdir}"${M}
140 # PROP Output_Dir "ARMDbg\\${subdir}"${M}
141 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE x86em) Release"${M}
142 # PROP Intermediate_Dir "X86EMRel\\${subdir}"${M}
143 # PROP Output_Dir "X86EMRel\\${subdir}"${M}
144 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE x86em) Debug"${M}
145 # PROP Intermediate_Dir "X86EMDbg\\${subdir}"${M}
146 # PROP Output_Dir "X86EMDbg\\${subdir}"${M}
148 # End Source File${M}
151 cat >> ${target} << EOF
152 # Begin Source File${M}
153 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
154 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
155 !IF "\$(CFG)" == "vlc - Win32 Release"${M}
156 # PROP Intermediate_Dir "Release\\${subdir}"${M}
157 # PROP Output_Dir "Release\\${subdir}"${M}
158 !ELSEIF "\$(CFG)" == "vlc - Win32 Debug"${M}
159 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
160 # PROP Output_Dir "Debug\\${subdir}"${M}
162 # End Source File${M}
166 cat >> ${target} << EOF
171 perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${target}.in >> ${target}
172 for file in ${LIBVLC_HEADERS}
174 cat >> ${target} << EOF
175 # Begin Source File${M}
176 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
177 # End Source File${M}
180 cat >> ${target} << EOF
181 # Begin Group "vlc"${M}
183 for file in ${LIBVLC_PKG_HEADERS}
185 cat >> ${target} << EOF
186 # Begin Source File${M}
187 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
188 # End Source File${M}
191 cat >> ${target} << EOF
194 perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
200 test "${dir}" = "evc" && suf="vcp" || suf="dsp"
203 makefile="`grep '^L_'${plugin}'_pic =' Modules.am | sed -e 's@.* modules@modules@' -e 's@/[^/]*$@/Modules.am@'`"
204 source="${dir}/plugins.${suf}.in"
205 target="${dir}/plugin_${plugin}.${suf}"
208 perl -pe 'if(/§SOURCES§/){last;} s/§PLUGIN§/'${plugin}'/g' < ${source} > ${target}
209 # this is an attempt at getting a list of plugin sources
210 sed -ne 's/^SOURCES_'${plugin}'.*=//; t foo; /^[a-zA-Z]/q; :foo p' < ${makefile} | tr '\\ ' '\n\n' | sed -ne 's,/,\\\\,g; s/.*modules/modules/p' | while read source
212 cat >> ${target} << EOF
213 # Begin Source File${M}
214 SOURCE="..\\${source}"${M}
215 # End Source File${M}
218 # sed is really nicer for this... unfortunately it's broken under cygwin
219 # sed -ne '1,/§SOURCES§/d; /§HEADERS§/,$d; p' < ${source} >> ${target}
220 perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){if(/§HEADERS§/){last;}print $_}' < ${source} >> ${target}
221 ### header generation disabled
222 ## cat >> ${target} << EOF
223 ### Begin Source File${M}
224 ##SOURCE="..\\test.h"${M}
225 ### End Source File${M}
227 # sed -ne '1,/§HEADERS§/d; p' < ${source} >> ${target}
228 perl -e 'while(<>){if(/§HEADERS§/){last;}}while(<>){print $_}' < ${source} >> ${target}
233 for target in evc/vlc.vcp msvc/vlc.dsp
237 # Top of the project file
238 perl -pe 'if(/§SOURCES§/){last;}' < ${target}.in > ${target}
240 if test "${target}" = "evc/vlc.vcp"
242 cat >> ${target} << EOF
243 # Begin Source File${M}
244 SOURCE="..\\evc\\vlc.c"${M}
245 # End Source File${M}
248 cat >> ${target} << EOF
249 # Begin Source File${M}
250 SOURCE="..\\src\\vlc.c"${M}
251 # End Source File${M}
254 # Bottom of the project file - handles resource files too
255 perl -e 'while(<>){if(/§SOURCES§/){last;}}while(<>){print $_}' < ${target}.in >> ${target}
263 ## Update the potfiles because no one ever does it
265 if test "$do_po" = "yes"
268 make update-po #2>&1 | grep '^[^:]*:$' | cut -f1 -d: | tr '\n' ' ' | sed 's/ $//'
275 ## Check that our tools don't suck
278 if test ! 20000 -eq `perl -e 'printf "%s\n","a"x20000' | sed -e 's/.//' 2>/dev/null | wc -c`
287 ## Generate the modules makefile, by parsing modules/**/Modules.am
290 printf "generating Modules.am and configure.ac"
295 ALL_FLAGS="`sed -n -e '/^[^=A-Z]*[A-Z]*FLAGS_[^=]*=/s/[^=A-Z]*\([A-Z]*FLAGS_[^=]*=\).*/\1/p' < configure.ac.in | sort | uniq`"
297 cat >> configure.ac << EOF
298 dnl ################################################################
299 dnl # Do not edit this file, it was generated from configure.ac.in #
300 dnl ################################################################
303 sed -n -e '/dnl do not touch this line/q;p' < configure.ac.in >> configure.ac
306 for mf in `sed -ne 's@[^a-z]*\([^ ]*\)am.*@modules/\1am@p' < modules/Makefile.am`
309 dir=`echo ${mf} | sed -e 's@\(.*\)/.*@\1@'`
310 topdir=`echo ${dir} | cut -f2 -d/`
311 sym=`echo ${dir} | sed -e 'y@/@_@'`
312 cat >> Modules.am << EOF
315 include ${dir}/Modules.am
318 sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
321 if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
322 echo "AC_SUBST(CPPFLAGS_${mod})" >> configure.ac; fi
323 if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
324 echo "AC_SUBST(CFLAGS_${mod})" >> configure.ac; fi
325 if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
327 echo "AC_SUBST(CXXFLAGS_${mod})" >> configure.ac; fi
328 if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
330 echo "AC_SUBST(OBJCFLAGS_${mod})" >> configure.ac; fi
331 if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
332 echo "AC_SUBST(LDFLAGS_${mod})" >> configure.ac; fi
333 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
336 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
339 cat >> configure.ac << EOF
340 AM_CONDITIONAL(${mod}_plugin, test x\$${mod}_plugin = xyes)
341 AM_CONDITIONAL(${mod}_builtin, test x\$${mod}_builtin = xyes)
343 # Generation of Modules.am
344 # ~~~~~~~~~~~~~~~~~~~~~~~~
345 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
346 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
347 # the resulting file size.
348 # - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
349 # does not seem to work properly with any automake version I tested.
350 cat >> Modules.am << EOF
355 L_${mod}_p = ${dir}/lib${mod}_plugin.a
357 D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
358 ${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
361 L_${mod}_b = ${dir}/lib${mod}.a
362 F_${mod}_b = \$(LDFLAGS_${mod})
364 L_${mod}_pic = ${dir}/lib${mod}_pic.a
366 ${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
369 L_builtin += \$(L_${mod}_b)
370 L_builtin_pic += \$(L_${mod}_pic)
371 LDFLAGS_builtin += \$(F_${mod}_b)
372 ${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
373 PLUGIN_FILES += \$(D_${mod}_p)
375 ${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
376 ${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
377 ${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
378 ${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
379 ${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
380 ${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
382 ${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
383 ${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
384 ${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
385 ${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
386 ${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
387 ${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
389 ${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
390 ${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
391 ${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
392 ${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
393 ${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
394 ${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
396 libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
397 lib${mod}_DATA = \$(D_${mod}_p)
399 lib${mod}dir = \$(libdir)/vlc/${topdir}
400 ${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
401 ${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
402 ${PRIVATE} \$(${LINKER}) \$^ -shared \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})
409 echo "AM_CONDITIONAL(UNTRUE, false)" >> configure.ac
410 sed -n -e '/dnl do not touch this line/,//p' < configure.ac.in >> configure.ac
415 ### classic bootstrap stuff
418 rm -f aclocal.m4 m4/oldgettext.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
422 if gettextize --version >/dev/null 2>&1
424 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
425 '>' 0.11.2 >/dev/null 2>&1
427 # We have gettext, and a recent version! Everything is cool.
431 # User's gettext is too old. try to continue anyway.
433 echo > intl/Makefile.am
434 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
437 # we don't have gettext. grmbl. try to continue anyway.
439 echo > intl/Makefile.am
440 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
446 if automake-1.7 --version >/dev/null 2>&1
450 if automake-1.6 --version >/dev/null 2>&1
453 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
454 then AUTOMAKESUCKS=yes
457 if automake-1.5 --version >/dev/null 2>&1
461 if automake --version > /dev/null 2>&1
463 amvers=`automake --version | sed -e '1s/[^0-9]*//' -e q`
469 if expr "$amvers" "<" "1.5" > /dev/null 2>&1
478 if test x$amvers = xnone
481 echo "you need automake version 1.5 or later"
486 aclocal${amvers} -I m4 || exit 1
489 automake${amvers} --foreign --add-missing --copy || PERLSUCKS=yes
497 echo "==========================================================="
498 echo "IMPORTANT NOTE: automake failed. On certain systems this is"
499 echo "because of insufficient stack size. Please set the stack"
500 echo "size to something bigger or unlimited (\`unlimit stacksize')"
501 echo "and try again."
506 # Wrap automake's long lines, because the Solaris sed doesn't support lines
507 # longer than 3999 characters, and ./configure calls sed. We use Perl instead
508 # of sed for obvious reasons :)
509 perl -ne 'if(/^.{500}/) {s/(.{200}[^ ]* )/$1\\\n\t/g} print $_' < Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp Makefile.in
514 ## headers which need to be regenerated
516 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
517 rm -f include/vlc_symbols.h
518 rm -f mozilla/vlcintf.h
526 ## Glade sometimes sucks
528 echo "workarounds for annoying glade features"
529 for file in gnome_interface.c gtk_interface.c
531 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
533 rm -f /tmp/$$.$file.bak
534 cat > /tmp/$$.$file.bak << EOF
535 /* This file was created automatically by glade and fixed by bootstrap */
540 -e 's#_("-:--:--")#"-:--:--"#' \
541 -e 's#_("---")#"---"#' \
542 -e 's#_("--")#"--"#' \
543 -e 's#_("/dev/dvd")#"/dev/dvd"#' \
544 -e 's#_(\("./."\))#\1#' \
545 < modules/gui/gtk/$file >> /tmp/$$.$file.bak
546 mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
551 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
553 rm -f /tmp/$$.$file.bak
554 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
555 mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
559 ## Tell the user about gettext and sed
566 echo "==========================================================="
567 echo "IMPORTANT NOTE: you do not have gettext installed on your"
568 echo "system. The vlc build will work, but you will not have"
569 echo "internationalization support. We suggest installing gettext."
573 echo "=========================================================="
574 echo "NOTE: you have an old version of gettext installed on your"
575 echo "system. We suggest upgrading to gettext 0.11.3 or later."
579 case "$AUTOMAKESUCKS" in
584 echo "============================================================="
585 echo "IMPORTANT NOTE: your version of automake has a bug which will"
586 echo "prevent proper plugin compilation. Either compile VLC with"
587 echo "the --disable-plugins flag, or use a version of automake newer"
588 echo "than 1.6.1 (1.6.2 is OK, and so are the 1.5 series)."
597 echo "============================================================="
598 echo "IMPORTANT NOTE: the version of 'sed' on your system is unable"
599 echo "to handle long lines. bootstrap will try its best to generate"
600 echo "a correct Makefile, but you should expect problems. We highly"
601 echo "recommend installing GNU sed."