3 ## bootstrap file for vlc, the VideoLAN Client
4 ## $Id: bootstrap,v 1.28 2002/11/18 11:50:42 sam Exp $
6 ## Authors: Samuel Hocevar <sam@zoy.org>
9 ### get a sane environment
19 if test "$do_help" = "yes"
23 --config create Makefile and configure scripts (read HACKING)
24 --update-vc update Microsoft Visual Studio files
25 --update-po update translation files
34 test "$EMAIL" = "sam@zoy.org" && do_help=yes || do_help=no
37 while test $# -gt 0; do
51 echo "$0: unknown option $1"
60 ## Give help if needed
65 ## Update the MSVC project files
67 if test "$do_vc" = "yes"
71 echo "no Makefile found, did you run ./configure?"
78 # Sources that get built under Win32
79 LIBVLC_SOURCES=`make show-libvlc-sources | grep '^X: ' | cut -b3-`
80 LIBVLC_HEADERS=`make show-libvlc-headers | grep '^X: ' | cut -b3-`
81 LIBVLC_PKG_HEADERS=`make show-libvlc-pkg-headers | grep '^X: ' | cut -b3-`
84 for target in evc/libvlc.vcp msvc/libvlc.dsp
87 # Top of the project file
88 cat ${target}.in > ${target}
90 cat >> ${target} << EOF
91 # Begin Group "Source Files"${M}
92 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"${M}
94 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
96 cat >> ${target} << EOF
97 # Begin Source File${M}
98 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
99 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
100 # End Source File${M}
103 for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
105 cat >> ${target} << EOF
106 # Begin Group "${subdir}"${M}
108 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
110 if test "${target}" = "evc/libvlc.vcp"
112 cat >> ${target} << EOF
113 # Begin Source File${M}
114 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
115 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
116 !IF "\$(CFG)" == "vlc - Win32 (WCE MIPS) Release"${M}
117 # PROP Intermediate_Dir "MIPSRel\\${subdir}"${M}
118 # PROP Output_Dir "MIPSRel\\${subdir}"${M}
119 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE MIPS) Debug"${M}
120 # PROP Intermediate_Dir "MIPSDbg\\${subdir}"${M}
121 # PROP Output_Dir "MIPSDbg\\${subdir}"${M}
122 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH4) Release"${M}
123 # PROP Intermediate_Dir "SH4Rel\\${subdir}"${M}
124 # PROP Output_Dir "SH4Rel\\${subdir}"${M}
125 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH4) Debug"${M}
126 # PROP Intermediate_Dir "SH4Dbg\\${subdir}"${M}
127 # PROP Output_Dir "SH4Dbg\\${subdir}"${M}
128 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH3) Release"${M}
129 # PROP Intermediate_Dir "SH3Rel\\${subdir}"${M}
130 # PROP Output_Dir "SH3Rel\\${subdir}"${M}
131 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH3) Debug"${M}
132 # PROP Intermediate_Dir "SH3Dbg\\${subdir}"${M}
133 # PROP Output_Dir "SH3Dbg\\${subdir}"${M}
134 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE ARM) Release"${M}
135 # PROP Intermediate_Dir "ARMRel\\${subdir}"${M}
136 # PROP Output_Dir "ARMRel\\${subdir}"${M}
137 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE ARM) Debug"${M}
138 # PROP Intermediate_Dir "ARMDbg\\${subdir}"${M}
139 # PROP Output_Dir "ARMDbg\\${subdir}"${M}
140 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE x86em) Release"${M}
141 # PROP Intermediate_Dir "X86EMRel\\${subdir}"${M}
142 # PROP Output_Dir "X86EMRel\\${subdir}"${M}
143 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE x86em) Debug"${M}
144 # PROP Intermediate_Dir "X86EMDbg\\${subdir}"${M}
145 # PROP Output_Dir "X86EMDbg\\${subdir}"${M}
147 # End Source File${M}
150 cat >> ${target} << EOF
151 # Begin Source File${M}
152 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
153 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
154 !IF "\$(CFG)" == "vlc - Win32 Release"${M}
155 # PROP Intermediate_Dir "Release\\${subdir}"${M}
156 # PROP Output_Dir "Release\\${subdir}"${M}
157 !ELSEIF "\$(CFG)" == "vlc - Win32 Debug"${M}
158 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
159 # PROP Output_Dir "Debug\\${subdir}"${M}
161 # End Source File${M}
165 cat >> ${target} << EOF
169 cat >> ${target} << EOF
173 cat >> ${target} << EOF
174 # Begin Group "Header Files"${M}
175 # PROP Default_Filter "h;hpp;hxx;hm;inl"${M}
177 for file in ${LIBVLC_HEADERS}
179 cat >> ${target} << EOF
180 # Begin Source File${M}
181 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
182 # End Source File${M}
185 cat >> ${target} << EOF
186 # Begin Group "vlc"${M}
188 for file in ${LIBVLC_PKG_HEADERS}
190 cat >> ${target} << EOF
191 # Begin Source File${M}
192 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
193 # End Source File${M}
196 cat >> ${target} << EOF
205 for target in evc/plugins.vcp msvc/plugins.dsp
208 # Top of the project file
209 cat ${target}.in > ${target}
211 cat >> ${target} << EOF
212 # Begin Group "Source Files"${M}
213 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"${M}
217 cat >> ${target} << EOF
218 # Begin Group "Header Files"${M}
219 # PROP Default_Filter "h;hpp;hxx;hm;inl"${M}
227 for target in evc/vlc.vcp msvc/vlc.dsp
230 # Top of the project file
231 cat ${target}.in > ${target}
233 cat >> ${target} << EOF
234 # Begin Group "Source Files"${M}
235 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"${M}
236 # Begin Source File${M}
238 if test "${target}" = "evc/vlc.vcp"
240 cat >> ${target} << EOF
241 SOURCE="..\\evc\\vlc.c"${M}
244 cat >> ${target} << EOF
245 SOURCE="..\\src\\vlc.c"${M}
248 cat >> ${target} << EOF
249 # End Source File${M}
252 # Bottom of the project file - handles resource files too
253 cat ${target}.out >> ${target}
260 ## Update the potfiles because no one ever does it
262 if test "$do_po" = "yes"
265 make update-po 2>&1 | grep '^[^:]*:$' | cut -f1 -d: | tr '\n' ' ' | sed 's/ $//'
272 ## Check that our tools don't suck
275 if test ! 20000 -eq `perl -e 'printf "%s\n","a"x20000' | sed -e 's/.//' 2>/dev/null | wc -c`
284 ## Generate the modules makefile, by parsing modules/**/Modules.am
287 printf "generating Modules.am and configure.ac"
292 ALL_FLAGS="`sed -n -e '/^[^=A-Z]*[A-Z]*FLAGS_[^=]*=/s/[^=A-Z]*\([A-Z]*FLAGS_[^=]*=\).*/\1/p' < configure.ac.in | sort | uniq`"
294 cat >> configure.ac << EOF
295 dnl ################################################################
296 dnl # Do not edit this file, it was generated from configure.ac.in #
297 dnl ################################################################
300 sed -n -e '/dnl do not touch this line/q;p' < configure.ac.in >> configure.ac
303 for mf in `sed -ne 's@[^a-z]*\([^ ]*\)am.*@modules/\1am@p' < modules/Makefile.am`
306 dir=`echo ${mf} | sed -e 's@\(.*\)/.*@\1@'`
307 topdir=`echo ${dir} | cut -f2 -d/`
308 sym=`echo ${dir} | sed -e 'y@/@_@'`
309 cat >> Modules.am << EOF
312 include ${dir}/Modules.am
315 sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
318 if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
319 echo "AC_SUBST(CPPFLAGS_${mod})" >> configure.ac; fi
320 if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
321 echo "AC_SUBST(CFLAGS_${mod})" >> configure.ac; fi
322 if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
324 echo "AC_SUBST(CXXFLAGS_${mod})" >> configure.ac; fi
325 if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
327 echo "AC_SUBST(OBJCFLAGS_${mod})" >> configure.ac; fi
328 if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
329 echo "AC_SUBST(LDFLAGS_${mod})" >> configure.ac; fi
330 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
333 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
336 cat >> configure.ac << EOF
337 AM_CONDITIONAL(${mod}_plugin, test x\$${mod}_plugin = xyes)
338 AM_CONDITIONAL(${mod}_builtin, test x\$${mod}_builtin = xyes)
340 # Generation of Modules.am
341 # ~~~~~~~~~~~~~~~~~~~~~~~~
342 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
343 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
344 # the resulting file size.
345 # - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
346 # does not seem to work properly with any automake version I tested.
347 cat >> Modules.am << EOF
352 L_${mod}_p = ${dir}/lib${mod}_plugin.a
354 D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
355 ${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
358 L_${mod}_b = ${dir}/lib${mod}.a
359 F_${mod}_b = \$(LDFLAGS_${mod})
361 L_${mod}_pic = ${dir}/lib${mod}_pic.a
363 ${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
366 L_builtin += \$(L_${mod}_b)
367 L_builtin_pic += \$(L_${mod}_pic)
368 LDFLAGS_builtin += \$(F_${mod}_b)
369 ${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
370 PLUGIN_FILES += \$(D_${mod}_p)
372 ${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
373 ${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
374 ${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
375 ${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
376 ${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
377 ${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
379 ${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
380 ${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
381 ${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
382 ${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
383 ${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
384 ${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
386 ${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
387 ${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
388 ${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
389 ${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
390 ${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
391 ${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
393 libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
394 lib${mod}_DATA = \$(D_${mod}_p)
396 lib${mod}dir = \$(libdir)/vlc/${topdir}
397 ${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
398 ${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
399 ${PRIVATE} \$(${LINKER}) \$^ -shared \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})
406 echo "AM_CONDITIONAL(UNTRUE, false)" >> configure.ac
407 sed -n -e '/dnl do not touch this line/,//p' < configure.ac.in >> configure.ac
412 ### classic bootstrap stuff
415 rm -f aclocal.m4 m4/oldgettext.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
419 if gettextize --version >/dev/null 2>&1
421 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
422 '>' 0.11.2 >/dev/null 2>&1
424 # We have gettext, and a recent version! Everything is cool.
428 # User's gettext is too old. try to continue anyway.
430 echo > intl/Makefile.am
431 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
434 # we don't have gettext. grmbl. try to continue anyway.
436 echo > intl/Makefile.am
437 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
443 if automake-1.7 --version >/dev/null 2>&1
447 if automake-1.6 --version >/dev/null 2>&1
450 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
451 then AUTOMAKESUCKS=yes
454 if automake-1.5 --version >/dev/null 2>&1
458 if automake --version > /dev/null 2>&1
460 amvers=`automake --version | sed -e '1s/[^0-9]*//' -e q`
466 if expr "$amvers" "<" "1.5" > /dev/null 2>&1
475 if test x$amvers = xnone
478 echo "you need automake version 1.5 or later"
483 aclocal${amvers} -I m4 || exit 1
486 automake${amvers} --foreign --add-missing --copy || PERLSUCKS=yes
494 echo "==========================================================="
495 echo "IMPORTANT NOTE: automake failed. On certain systems this is"
496 echo "because of insufficient stack size. Please set the stack"
497 echo "size to something bigger or unlimited (\`unlimit stacksize')"
498 echo "and try again."
503 # Wrap automake's long lines, because the Solaris sed doesn't support lines
504 # longer than 3999 characters, and ./configure calls sed. We use Perl instead
505 # of sed for obvious reasons :)
506 perl -ne 'if(/^.{500}/) {s/(.{200}[^ ]* )/$1\\\n\t/g} print $_' < Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp Makefile.in
511 ## headers which need to be regenerated
513 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
514 rm -f include/vlc_symbols.h
515 rm -f mozilla/vlcintf.h
523 ## Glade sometimes sucks
525 echo "workarounds for annoying glade features"
526 for file in gnome_interface.c gtk_interface.c
528 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
530 rm -f /tmp/$$.$file.bak
531 cat > /tmp/$$.$file.bak << EOF
532 /* This file was created automatically by glade and fixed by bootstrap */
537 -e 's#_("-:--:--")#"-:--:--"#' \
538 -e 's#_("---")#"---"#' \
539 -e 's#_("--")#"--"#' \
540 -e 's#_("/dev/dvd")#"/dev/dvd"#' \
541 -e 's#_(\("./."\))#\1#' \
542 < modules/gui/gtk/$file >> /tmp/$$.$file.bak
543 mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
548 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
550 rm -f /tmp/$$.$file.bak
551 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
552 mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
556 ## Tell the user about gettext and sed
563 echo "==========================================================="
564 echo "IMPORTANT NOTE: you do not have gettext installed on your"
565 echo "system. The vlc build will work, but you will not have"
566 echo "internationalization support. We suggest installing gettext."
570 echo "=========================================================="
571 echo "NOTE: you have an old version of gettext installed on your"
572 echo "system. We suggest upgrading to gettext 0.11.3 or later."
576 case "$AUTOMAKESUCKS" in
581 echo "============================================================="
582 echo "IMPORTANT NOTE: your version of automake has a bug which will"
583 echo "prevent proper plugin compilation. Either compile VLC with"
584 echo "the --disable-plugins flag, or use a version of automake newer"
585 echo "than 1.6.1 (1.6.2 is OK, and so are the 1.5 series)."
594 echo "============================================================="
595 echo "IMPORTANT NOTE: the version of 'sed' on your system is unable"
596 echo "to handle long lines. bootstrap will try its best to generate"
597 echo "a correct Makefile, but you should expect problems. We highly"
598 echo "recommend installing GNU sed."