3 ## bootstrap file for vlc, the VideoLAN Client
4 ## $Id: bootstrap,v 1.26 2002/11/13 15:28:23 sam Exp $
6 ## Authors: Samuel Hocevar <sam@zoy.org>
9 ### get a sane environment
19 while test $# -gt 0; do
28 echo "$0: unknown option $1"
29 echo "recognized flags are --update-vc and --update-po"
37 ## Update the MSVC project files
39 if test "$do_vc" = "no"
41 echo "not updating MSVC or eVC project file. use --update-vc to force doing it."
45 echo "no Makefile found, did you run ./configure?"
52 # Sources that get built under Win32
53 LIBVLC_SOURCES=`make show-libvlc-sources | grep '^X: ' | cut -b3-`
54 LIBVLC_HEADERS=`make show-libvlc-headers | grep '^X: ' | cut -b3-`
55 LIBVLC_PKG_HEADERS=`make show-libvlc-pkg-headers | grep '^X: ' | cut -b3-`
57 for target in evc/vlc.vcp msvc/vlc.dsp
60 # Top of the project file
61 cat ${target}.in > ${target}
63 cat >> ${target} << EOF
64 # Begin Group "Source Files"${M}
65 # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"${M}
66 # Begin Group "vlc"${M}
67 # Begin Source File${M}
69 if test "${target}" = "evc/vlc.vcp"
71 cat >> ${target} << EOF
72 SOURCE="..\\evc\\vlc.c"${M}
75 cat >> ${target} << EOF
76 SOURCE="..\\src\\vlc.c"${M}
79 cat >> ${target} << EOF
82 # Begin Group "libvlc"${M}
84 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep -v "/.*/"`
86 cat >> ${target} << EOF
87 # Begin Source File${M}
88 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
89 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
93 for subdir in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/.*/" | cut -f2 -d/ | sort | uniq`
95 cat >> ${target} << EOF
96 # Begin Group "${subdir}"${M}
98 for file in `for i in ${LIBVLC_SOURCES} ; do echo $i ; done | grep "/${subdir}/"`
100 if test "${target}" = "evc/vlc.vcp"
102 cat >> ${target} << EOF
103 # Begin Source File${M}
104 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
105 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
106 !IF "\$(CFG)" == "vlc - Win32 (WCE MIPS) Release"${M}
107 # PROP Intermediate_Dir "Release\\${subdir}"${M}
108 # PROP Output_Dir "Release\\${subdir}"${M}
109 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE MIPS) Debug"${M}
110 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
111 # PROP Output_Dir "Debug\\${subdir}"${M}
112 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH4) Release"${M}
113 # PROP Intermediate_Dir "Release\\${subdir}"${M}
114 # PROP Output_Dir "Release\\${subdir}"${M}
115 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH4) Debug"${M}
116 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
117 # PROP Output_Dir "Debug\\${subdir}"${M}
118 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH3) Release"${M}
119 # PROP Intermediate_Dir "Release\\${subdir}"${M}
120 # PROP Output_Dir "Release\\${subdir}"${M}
121 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE SH3) Debug"${M}
122 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
123 # PROP Output_Dir "Debug\\${subdir}"${M}
124 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE ARM) Release"${M}
125 # PROP Intermediate_Dir "Release\\${subdir}"${M}
126 # PROP Output_Dir "Release\\${subdir}"${M}
127 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE ARM) Debug"${M}
128 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
129 # PROP Output_Dir "Debug\\${subdir}"${M}
130 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE x86em) Release"${M}
131 # PROP Intermediate_Dir "Release\\${subdir}"${M}
132 # PROP Output_Dir "Release\\${subdir}"${M}
133 !ELSEIF "\$(CFG)" == "vlc - Win32 (WCE x86em) Debug"${M}
134 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
135 # PROP Output_Dir "Debug\\${subdir}"${M}
137 # End Source File${M}
140 cat >> ${target} << EOF
141 # Begin Source File${M}
142 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
143 # ADD CPP /D "__VLC__" /D PLUGIN_PATH=\\"plugins\\" /D DATA_PATH=\\"share\\"${M}
144 !IF "\$(CFG)" == "vlc - Win32 Release"${M}
145 # PROP Intermediate_Dir "Release\\${subdir}"${M}
146 # PROP Output_Dir "Release\\${subdir}"${M}
147 !ELSEIF "\$(CFG)" == "vlc - Win32 Debug"${M}
148 # PROP Intermediate_Dir "Debug\\${subdir}"${M}
149 # PROP Output_Dir "Debug\\${subdir}"${M}
151 # End Source File${M}
155 cat >> ${target} << EOF
159 cat >> ${target} << EOF
164 echo 'no modules yet'
166 cat >> ${target} << EOF
167 # Begin Group "Header Files"${M}
168 # PROP Default_Filter "h;hpp;hxx;hm;inl"${M}
170 for file in ${LIBVLC_HEADERS}
172 cat >> ${target} << EOF
173 # Begin Source File${M}
174 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
175 # End Source File${M}
178 cat >> ${target} << EOF
179 # Begin Group "vlc"${M}
181 for file in ${LIBVLC_PKG_HEADERS}
183 cat >> ${target} << EOF
184 # Begin Source File${M}
185 SOURCE="..\\`echo $file | sed -e 's%/%\\\\%g'`"${M}
186 # End Source File${M}
189 cat >> ${target} << EOF
193 # Bottom of the project file - handles resource files too
194 cat ${target}.out >> ${target}
201 ## Update the potfiles because no one ever does it
203 if test "$do_po" = "no"
205 echo "not updating potfiles. use --update-po to force doing it."
208 make update-po 2>&1 | grep '^[^:]*:$' | cut -f1 -d: | tr '\n' ' ' | sed 's/ $//'
215 ## Check that our tools don't suck
218 if test ! 20000 -eq `perl -e 'printf "%s\n","a"x20000' | sed -e 's/.//' 2>/dev/null | wc -c`
227 ## Generate the modules makefile, by parsing modules/**/Modules.am
230 printf "generating Modules.am and configure.ac"
235 ALL_FLAGS="`sed -n -e '/^[^=A-Z]*[A-Z]*FLAGS_[^=]*=/s/[^=A-Z]*\([A-Z]*FLAGS_[^=]*=\).*/\1/p' < configure.ac.in | sort | uniq`"
237 cat >> configure.ac << EOF
238 dnl ################################################################
239 dnl # Do not edit this file, it was generated from configure.ac.in #
240 dnl ################################################################
243 sed -n -e '/dnl do not touch this line/q;p' < configure.ac.in >> configure.ac
246 for mf in `sed -ne 's@[^a-z]*\([^ ]*\)am.*@modules/\1am@p' < modules/Makefile.am`
249 dir=`echo ${mf} | sed -e 's@\(.*\)/.*@\1@'`
250 topdir=`echo ${dir} | cut -f2 -d/`
251 sym=`echo ${dir} | sed -e 'y@/@_@'`
252 cat >> Modules.am << EOF
255 include ${dir}/Modules.am
258 sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf} | while read mod
261 if echo "$ALL_FLAGS" | grep '^CPPFLAGS_'${mod}'=$' >/dev/null 2>&1; then
262 echo "AC_SUBST(CPPFLAGS_${mod})" >> configure.ac; fi
263 if echo "$ALL_FLAGS" | grep '^CFLAGS_'${mod}'=$' >/dev/null 2>&1; then
264 echo "AC_SUBST(CFLAGS_${mod})" >> configure.ac; fi
265 if echo "$ALL_FLAGS" | grep '^CXXFLAGS_'${mod}'=$' >/dev/null 2>&1; then
267 echo "AC_SUBST(CXXFLAGS_${mod})" >> configure.ac; fi
268 if echo "$ALL_FLAGS" | grep '^OBJCFLAGS_'${mod}'=$' >/dev/null 2>&1; then
270 echo "AC_SUBST(OBJCFLAGS_${mod})" >> configure.ac; fi
271 if echo "$ALL_FLAGS" | grep '^LDFLAGS_'${mod}'=$' >/dev/null 2>&1; then
272 echo "AC_SUBST(LDFLAGS_${mod})" >> configure.ac; fi
273 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
276 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
279 cat >> configure.ac << EOF
280 AM_CONDITIONAL(${mod}_plugin, test x\$${mod}_plugin = xyes)
281 AM_CONDITIONAL(${mod}_builtin, test x\$${mod}_builtin = xyes)
283 # Generation of Modules.am
284 # ~~~~~~~~~~~~~~~~~~~~~~~~
285 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
286 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
287 # the resulting file size.
288 # - *_CFLAGS, *_CXXFLAGS etc. include *_CPPFLAGS because per-object CPPFLAGS
289 # does not seem to work properly with any automake version I tested.
290 cat >> Modules.am << EOF
295 L_${mod}_p = ${dir}/lib${mod}_plugin.a
297 D_${mod}_p = ${dir}/lib${mod}_plugin\$(LIBEXT)
298 ${NODIST}B_${mod}_p = \$(nodist_SOURCES_${mod})
301 L_${mod}_b = ${dir}/lib${mod}.a
302 F_${mod}_b = \$(LDFLAGS_${mod})
304 L_${mod}_pic = ${dir}/lib${mod}_pic.a
306 ${NODIST}B_${mod}_b = \$(nodist_SOURCES_${mod})
309 L_builtin += \$(L_${mod}_b)
310 L_builtin_pic += \$(L_${mod}_pic)
311 LDFLAGS_builtin += \$(F_${mod}_b)
312 ${PRIVATE}BUILT_SOURCES += \$(B_${mod}_p) \$(B_${mod}_b)
313 PLUGIN_FILES += \$(D_${mod}_p)
315 ${PRIVATE}${sym}_lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
316 ${NODIST}${PRIVATE}nodist_${sym}_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
317 ${sym}_lib${mod}_plugin_a_CPPFLAGS = \$(CPPFLAGS_plugin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
318 ${sym}_lib${mod}_plugin_a_CFLAGS = \$(CFLAGS_plugin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
319 ${sym}_lib${mod}_plugin_a_CXXFLAGS = \$(CXXFLAGS_plugin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
320 ${sym}_lib${mod}_plugin_a_OBJCFLAGS = \$(OBJCFLAGS_plugin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_plugin_a_CPPFLAGS)
322 ${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
323 ${NODIST}nodist_${sym}_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
324 ${sym}_lib${mod}_pic_a_CPPFLAGS = \$(CPPFLAGS_builtin_pic) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
325 ${sym}_lib${mod}_pic_a_CFLAGS = \$(CFLAGS_builtin_pic) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
326 ${sym}_lib${mod}_pic_a_CXXFLAGS = \$(CXXFLAGS_builtin_pic) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
327 ${sym}_lib${mod}_pic_a_OBJCFLAGS = \$(OBJCFLAGS_builtin_pic) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_pic_a_CPPFLAGS)
329 ${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
330 ${NODIST}nodist_${sym}_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
331 ${sym}_lib${mod}_a_CPPFLAGS = \$(CPPFLAGS_builtin) \$(CPPFLAGS_${mod}) -DMODULE_NAME=${mod} -DMODULE_NAME_IS_${mod}
332 ${sym}_lib${mod}_a_CFLAGS = \$(CFLAGS_builtin) \$(CFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
333 ${sym}_lib${mod}_a_CXXFLAGS = \$(CXXFLAGS_builtin) \$(CXXFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
334 ${sym}_lib${mod}_a_OBJCFLAGS = \$(OBJCFLAGS_builtin) \$(OBJCFLAGS_${mod}) \$(${sym}_lib${mod}_a_CPPFLAGS)
336 libvlc_LIBRARIES += \$(L_${mod}_b) \$(L_${mod}_pic)
337 lib${mod}_DATA = \$(D_${mod}_p)
339 lib${mod}dir = \$(libdir)/vlc/${topdir}
340 ${PRIVATE}noinst_LIBRARIES += \$(L_${mod}_p)
341 ${PRIVATE}${dir}/lib${mod}_plugin\$(LIBEXT): \$(${sym}_lib${mod}_plugin_a_OBJECTS)
342 ${PRIVATE} \$(${LINKER}) \$^ -shared \$(LDFLAGS_plugins) \$(LDFLAGS_${mod})
349 echo "AM_CONDITIONAL(UNTRUE, false)" >> configure.ac
350 sed -n -e '/dnl do not touch this line/,//p' < configure.ac.in >> configure.ac
355 ### classic bootstrap stuff
358 rm -f aclocal.m4 m4/oldgettext.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
362 if gettextize --version >/dev/null 2>&1
364 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
365 '>' 0.11.2 >/dev/null 2>&1
367 # We have gettext, and a recent version! Everything is cool.
371 # User's gettext is too old. try to continue anyway.
373 echo > intl/Makefile.am
374 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
377 # we don't have gettext. grmbl. try to continue anyway.
379 echo > intl/Makefile.am
380 echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/oldgettext.m4
386 if automake-1.7 --version >/dev/null 2>&1
390 if automake-1.6 --version >/dev/null 2>&1
393 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
394 then AUTOMAKESUCKS=yes
397 if automake-1.5 --version >/dev/null 2>&1
401 if automake --version > /dev/null 2>&1
403 amvers=`automake --version | sed -e '1s/[^0-9]*//' -e q`
409 if expr "$amvers" "<" "1.5" > /dev/null 2>&1
418 if test x$amvers = xnone
421 echo "you need automake version 1.5 or later"
426 aclocal${amvers} -I m4 || exit 1
429 automake${amvers} --foreign --add-missing --copy || PERLSUCKS=yes
437 echo "==========================================================="
438 echo "IMPORTANT NOTE: automake failed. On certain systems this is"
439 echo "because of insufficient stack size. Please set the stack"
440 echo "size to something bigger or unlimited (\`unlimit stacksize')"
441 echo "and try again."
446 # Wrap automake's long lines, because the Solaris sed doesn't support lines
447 # longer than 3999 characters, and ./configure calls sed. We use Perl instead
448 # of sed for obvious reasons :)
449 perl -ne 'if(/^.{500}/) {s/(.{200}[^ ]* )/$1\\\n\t/g} print $_' < Makefile.in > Makefile.in.tmp && mv Makefile.in.tmp Makefile.in
454 ## headers which need to be regenerated
456 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
457 rm -f include/vlc_symbols.h
458 rm -f mozilla/vlcintf.h
466 ## Glade sometimes sucks
468 echo "workarounds for annoying glade features"
469 for file in gnome_interface.c gtk_interface.c
471 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
473 rm -f /tmp/$$.$file.bak
474 cat > /tmp/$$.$file.bak << EOF
475 /* This file was created automatically by glade and fixed by bootstrap */
480 -e 's#_("-:--:--")#"-:--:--"#' \
481 -e 's#_("---")#"---"#' \
482 -e 's#_("--")#"--"#' \
483 -e 's#_("/dev/dvd")#"/dev/dvd"#' \
484 -e 's#_(\("./."\))#\1#' \
485 < modules/gui/gtk/$file >> /tmp/$$.$file.bak
486 mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
491 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
493 rm -f /tmp/$$.$file.bak
494 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
495 mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
499 ## Tell the user about gettext and sed
506 echo "==========================================================="
507 echo "IMPORTANT NOTE: you do not have gettext installed on your"
508 echo "system. The vlc build will work, but you will not have"
509 echo "internationalization support. We suggest installing gettext."
513 echo "=========================================================="
514 echo "NOTE: you have an old version of gettext installed on your"
515 echo "system. We suggest upgrading to gettext 0.11.3 or later."
519 case "$AUTOMAKESUCKS" in
524 echo "============================================================="
525 echo "IMPORTANT NOTE: your version of automake has a bug which will"
526 echo "prevent proper plugin compilation. Either compile VLC with"
527 echo "the --disable-plugins flag, or use a version of automake newer"
528 echo "than 1.6.1 (1.6.2 is OK, and so are the 1.5 series)."
537 echo "============================================================="
538 echo "IMPORTANT NOTE: the version of 'sed' on your system is unable"
539 echo "to handle long lines. bootstrap will try its best to generate"
540 echo "a correct Makefile, but you should expect problems. We highly"
541 echo "recommend installing GNU sed."