3 ## bootstrap file for the VLC media player
5 ## Copyright (C) 2005-2006 the VideoLAN team
7 ## Authors: Sam Hocevar <sam@zoy.org>
8 ## RĂ©mi Denis-Courmont <rem # videolan # org>
10 ## Muahaha! no annoying dollar I dee dollar that causes rebuild at commit
12 if test "$#" != "0"; then
14 echo " Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
15 echo " m4 macros and prepare Makefiles."
20 ### Get a sane environment, just in case
31 ## Check for various tools
38 # Check for contrib directory
39 if test -d extras/contrib/bin; then
40 export PATH=./extras/contrib/bin:$PATH
41 if test -d extras/contrib/share/aclocal; then
42 ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
44 if test ".`uname -s`" = ".Darwin"; then
45 export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
46 export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
47 elif test ".`uname -s`" = ".BeOS"; then
48 export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
49 export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
55 for v in "-1.9" "19" "-1.8" "18" "-1.7" "17"; do
56 if automake${v} --version >/dev/null 2>&1; then
63 if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
64 amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
69 no|1.[0123456]|1.[0123456].*|1[0123456])
71 echo "$0: you need automake version 1.7 or later"
78 if glibtoolize --version >/dev/null 2>&1; then
79 libtoolize="glibtoolize"
80 elif libtoolize --version >/dev/null 2>&1; then
81 libtoolize="libtoolize"
84 if test "$libtoolize" = "no"; then
86 echo "$0: you need libtool"
91 if gettextize --version >/dev/null 2>&1; then
92 # Autopoint is available from 0.11.3, but we need 0.11.5
93 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
94 '>=' 0.11.5 >/dev/null 2>&1; then
95 # We have gettext, and a recent version! Everything is cool.
99 # User's gettext is too old. try to continue anyway.
104 echo "you need gettextize (package gettext-devel or gettext)"
108 # Check for pkg-config
109 if pkg-config --version >/dev/null 2>&1; then
110 # We have pkg-config, everything is cool.
116 aclocal=aclocal${amvers}
117 automake=automake${amvers}
119 autoheader=autoheader
122 ## Generate the modules makefile, by parsing modules/**/Modules.am
126 echo "generating modules/**/Makefile.am and m4/private.m4"
128 # Prepare m4/private.m4
129 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
130 dnl Private VLC macros - generated by bootstrap
134 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
135 dnl User does not have pkg-config, so assume package was not found
136 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
141 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
142 dnl User does not have gettext, so this is a no-op
143 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
148 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
149 dnl The required AM_CONDITIONAL calls
150 dnl XXX: too many conditionals make the build very slow, disabled them
151 AC_DEFUN([VLC_CONDITIONALS], [
153 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
154 dnl The required AC_SUBST calls
155 AC_DEFUN([VLC_SUBSTS], [
157 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
158 dnl The required AC_OUTPUT calls
159 dnl XXX: this feature is only supported starting from automake-1.7
160 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
162 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
163 dnl Helper macro for vlc-config generation
164 AC_DEFUN([VLC_CONFIG_HELPER], [
165 cat >> vlc-config.in << BLAH
170 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
171 # Autogenerated by bootstrap - DO NOT EDIT
173 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
176 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
179 modf="modules/${dir}/Modules.am"
180 makf="modules/${dir}/Makefile.am"
181 basedir="`echo "${dir}" | cut -f1 -d/`"
182 # automake will not recurse for make dist if we don't define SUBDIRS = .
183 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
184 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
189 extra_libs="${extra_libs} lib${mod}_plugin.a lib${mod}.a"
190 extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la lib${mod}_builtin.la"
192 rm -f "${makf}" && cat > "${makf}" << EOF
194 # ${makf} automatically generated from ${modf} by bootstrap
195 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
203 EXTRA_DIST = Modules.am
207 SUFFIXES = _plugin\$(LIBEXT) _plugin.a
209 libvlcdir = \$(libdir)/vlc/\$(basedir)
211 EXTRA_LIBRARIES = ${extra_libs}
212 EXTRA_LTLIBRARIES = ${extra_ltlibs}
216 LTLIBVLC = \$(top_builddir)/src/libvlc.la
219 LIBVLC = \$(top_builddir)/src/libvlc\$(LIBEXT)
225 # Find out which modules were enabled and tell make to build them
228 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
229 if test "\$(plugin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin.la;; esac; done; fi; \\
230 if test "\$(builtin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_builtin.la;; esac; done; fi; \\
231 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
234 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
235 if test "\$(plugin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list plugin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_plugin\$(LIBEXT);; esac; done; fi; \\
236 if test "\$(builtin)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}.a;; esac; done; fi; \\
237 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
241 # Build a plugin with the adequate linker and linker's flags
242 _plugin.a_plugin\$(LIBEXT):
243 @mod="\$*" ; mod=\$\${mod#lib} ; \
244 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBADD) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
245 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
246 c++) ld="\$(CXXLINK)" ;; \
247 objc) ld="\$(OBJCLINK)" ;; \
248 c|*) ld="\$(LINK)" ;; \
250 echo \$\$ld \$< \$\$ldfl ; \
252 #ifneq (,\$(findstring cygwin,\$(host)))
253 # mv -f "\$@.exe" "\$@"
255 @if test -f "\$@.exe"; then mv -f "\$@.exe" "\$@"; fi
258 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
259 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
266 -rm -f *.a *\$(LIBEXT)
269 clean-local: \$(clean_modules)
271 ### automake creates libvlcdir after running install-*-local
272 ### so we have to create it ourselves first
273 install-exec-local: all-modules
275 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
276 z=\$\$(\$(VLC_CONFIG) --list plugin); \
277 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
279 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
282 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
283 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
284 for mod in \$(mods); do \
286 in *\ \$\${mod}\ *) \
287 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
288 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
292 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
293 for mod in \$(mods); do \
295 in *\ \$\${mod}\ *) \
296 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
297 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
305 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
306 z=\$\$(\$(VLC_CONFIG) --list plugin); \
307 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
309 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
312 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
313 for mod in \$(mods); do \
315 in *\ \$\${mod}\ *) \
316 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
317 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
321 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
322 for mod in \$(mods); do \
324 in *\ \$\${mod}\ *) \
325 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
326 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
335 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
338 cat >> m4/private.m4-tmp4 << EOF
339 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
341 # Generation of modules/**/Makefile.am
342 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
343 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
344 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
345 # the resulting file size.
346 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
347 # work properly with any automake version I tested.
348 cat >> "${makf}" << EOF
352 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
353 clean_modules += clean-${mod}
355 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
359 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
360 BUILT_SOURCES += \$(B${mod})
363 cat >> "${makf}" << EOF
364 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
365 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
367 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
368 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
369 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
372 cat >> "${makf}" << EOF
373 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
374 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
375 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
376 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
377 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
378 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
379 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \\
380 -rpath '\$(libvlcdir)' -avoid-version -module -shrext \$(LIBEXT)
381 lib${mod}_plugin_la_LIBADD = \$(LTLIBVLC)
383 lib${mod}_a_SOURCES = \$(SOURCES_${mod})
384 lib${mod}_builtin_la_SOURCES = \$(SOURCES_${mod})
386 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
387 nodist_lib${mod}_a_SOURCES = \$(nodist_SOURCES_${mod})
388 nodist_lib${mod}_builtin_la_SOURCES = \$(nodist_SOURCES_${mod})
391 cat >> "${makf}" << EOF
392 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin \$(pic) ${mod}\`
393 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin \$(pic) ${mod}\`
394 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin \$(pic) ${mod}\`
395 lib${mod}_builtin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
396 lib${mod}_builtin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
397 lib${mod}_builtin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
403 cat >> m4/private.m4-tmp1 << EOF
406 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
407 cat >> m4/private.m4-tmp2 << EOF
410 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
411 cat >> m4/private.m4-tmp3 << EOF
414 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
415 cat >> m4/private.m4-tmp4 << EOF
419 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
424 ### classic bootstrap stuff
428 # remove autotools cruft
429 rm -f aclocal.m4 configure config.log config.h config.h.in
430 rm -Rf autom4te*.cache
431 # remove old autotools extra cruft
432 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
433 # remove new autotools extra cruft
436 # remove libtool cruft
437 rm -f ltmain.sh libtool ltconfig
438 # remove gettext cruft
442 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
444 # Automake complains if these are not present
445 rm -f vlc-config.in && printf "" > vlc-config.in
446 if [ "$GETTEXT" != "yes" ]; then
447 test -d intl || mkdir intl
448 printf "" > intl/Makefile.am
449 printf "" > ABOUT-NLS
452 # Libtoolize directory
453 ${libtoolize} --copy --force
454 if test -f "ltmain.sh"; then
455 echo "$0: working around a minor libtool issue"
456 mv ltmain.sh autotools/
461 ${aclocal} ${ACLOCAL_ARGS}
464 ${automake} --add-missing --copy -Wall
467 ## files which need to be regenerated
469 rm -f vlc-config.in vlc-config
470 rm -f src/misc/modules_builtin.h
471 rm -f mozilla/vlcintf.h
477 ## Tell the user about gettext, pkg-config and sed
479 if [ "${GETTEXT}" = "old" ]; then
482 ==========================================================
483 NOTE: you have an old version of gettext installed on your
484 system. The vlc build will work, but if your system does not
485 have libintl you will not have internationalization support.
486 We suggest upgrading to gettext 0.11.5 or later.
490 if [ "$PKGCONFIG" = "no" ]; then
493 ==============================================================
494 NOTE: you do not have the "pkg-config" utility on your system;
495 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be