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" "-1.6" "16" "-1.5" "15"; 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 -1.6|16|1.6|1.6.0*|1.6.1*)
75 no|1.[01234]|1.[01234].*|1[01234])
77 echo "$0: you need automake version 1.5 or later"
84 if glibtoolize --version >/dev/null 2>&1; then
85 libtoolize="glibtoolize"
86 elif libtoolize --version >/dev/null 2>&1; then
87 libtoolize="libtoolize"
90 if test "$libtoolize" = "no"; then
92 echo "$0: you need libtool"
97 if gettextize --version >/dev/null 2>&1; then
98 # Autopoint is available from 0.11.3, but we need 0.11.5
99 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
100 '>=' 0.11.5 >/dev/null 2>&1; then
101 # We have gettext, and a recent version! Everything is cool.
105 # User's gettext is too old. try to continue anyway.
110 echo "you need gettextize (package gettext-devel or gettext)"
114 # Check for pkg-config
115 if pkg-config --version >/dev/null 2>&1; then
116 # We have pkg-config, everything is cool.
122 aclocal=aclocal${amvers}
123 automake=automake${amvers}
125 autoheader=autoheader
128 ## Generate the modules makefile, by parsing modules/**/Modules.am
132 echo "generating modules/**/Makefile.am and m4/private.m4"
134 # Prepare m4/private.m4
135 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
136 dnl Private VLC macros - generated by bootstrap
140 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
141 dnl User does not have pkg-config, so assume package was not found
142 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
147 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
148 dnl User does not have gettext, so this is a no-op
149 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
154 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
155 dnl The required AM_CONDITIONAL calls
156 dnl XXX: too many conditionals make the build very slow, disabled them
157 AC_DEFUN([VLC_CONDITIONALS], [
159 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
160 dnl The required AC_SUBST calls
161 AC_DEFUN([VLC_SUBSTS], [
163 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
164 dnl The required AC_OUTPUT calls
165 dnl XXX: this feature is only supported starting from automake-1.7
166 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
168 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
169 dnl Helper macro for vlc-config generation
170 AC_DEFUN([VLC_CONFIG_HELPER], [
171 cat >> vlc-config.in << BLAH
176 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
177 # Autogenerated by bootstrap - DO NOT EDIT
179 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
182 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
185 modf="modules/${dir}/Modules.am"
186 makf="modules/${dir}/Makefile.am"
187 basedir="`echo "${dir}" | cut -f1 -d/`"
188 # automake will not recurse for make dist if we don't define SUBDIRS = .
189 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
190 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
195 extra_libs="${extra_libs} lib${mod}_plugin.a lib${mod}.a"
196 extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la lib${mod}_builtin.la"
198 rm -f "${makf}" && cat > "${makf}" << EOF
200 # ${makf} automatically generated from ${modf} by bootstrap
201 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
209 EXTRA_DIST = Modules.am
213 SUFFIXES = _plugin\$(LIBEXT) _plugin.a
215 libvlcdir = \$(libdir)/vlc/\$(basedir)
217 EXTRA_LIBRARIES = ${extra_libs}
218 EXTRA_LTLIBRARIES = ${extra_ltlibs}
222 LTLIBVLC = \$(top_builddir)/src/libvlc.la
225 LIBVLC = \$(top_builddir)/src/libvlc\$(LIBEXT)
231 # Find out which modules were enabled and tell make to build them
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.la;; 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}_builtin.la;; esac; done; fi; \\
237 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
240 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
241 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; \\
242 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; \\
243 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
247 # Build a plugin with the adequate linker and linker's flags
248 _plugin.a_plugin\$(LIBEXT):
249 @mod="\$*" ; mod=\$\${mod#lib} ; \
250 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBADD) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
251 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
252 c++) ld="\$(CXXLINK)" ;; \
253 objc) ld="\$(OBJCLINK)" ;; \
254 c|*) ld="\$(LINK)" ;; \
256 echo \$\$ld \$< \$\$ldfl ; \
258 #ifneq (,\$(findstring cygwin,\$(host)))
259 # mv -f "\$@.exe" "\$@"
261 @if test -f "\$@.exe"; then mv -f "\$@.exe" "\$@"; fi
264 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
265 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
272 -rm -f *.a *\$(LIBEXT)
275 clean-local: \$(clean_modules)
277 ### automake creates libvlcdir after running install-*-local
278 ### so we have to create it ourselves first
279 install-exec-local: all-modules
281 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
282 z=\$\$(\$(VLC_CONFIG) --list plugin); \
283 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
285 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
288 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
289 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
290 for mod in \$(mods); do \
292 in *\ \$\${mod}\ *) \
293 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
294 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
298 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
299 for mod in \$(mods); do \
301 in *\ \$\${mod}\ *) \
302 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
303 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
311 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
312 z=\$\$(\$(VLC_CONFIG) --list plugin); \
313 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
315 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
318 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
319 for mod in \$(mods); do \
321 in *\ \$\${mod}\ *) \
322 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
323 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
327 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
328 for mod in \$(mods); do \
330 in *\ \$\${mod}\ *) \
331 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
332 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
341 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
344 cat >> m4/private.m4-tmp4 << EOF
345 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
347 # Generation of modules/**/Makefile.am
348 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
350 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
351 # the resulting file size.
352 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
353 # work properly with any automake version I tested.
354 cat >> "${makf}" << EOF
358 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
359 clean_modules += clean-${mod}
361 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
365 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
366 BUILT_SOURCES += \$(B${mod})
369 cat >> "${makf}" << EOF
370 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
371 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
373 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
374 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
375 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
378 cat >> "${makf}" << EOF
379 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
380 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
381 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
382 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
383 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
384 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
385 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \\
386 -rpath '\$(libvlcdir)' -module -shrext \$(LIBEXT)
387 lib${mod}_plugin_la_LIBADD = \$(LTLIBVLC)
389 lib${mod}_a_SOURCES = \$(SOURCES_${mod})
390 lib${mod}_builtin_la_SOURCES = \$(SOURCES_${mod})
392 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
393 nodist_lib${mod}_a_SOURCES = \$(nodist_SOURCES_${mod})
394 nodist_lib${mod}_builtin_la_SOURCES = \$(nodist_SOURCES_${mod})
397 cat >> "${makf}" << EOF
398 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin \$(pic) ${mod}\`
399 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin \$(pic) ${mod}\`
400 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin \$(pic) ${mod}\`
401 lib${mod}_builtin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
402 lib${mod}_builtin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
403 lib${mod}_builtin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
409 cat >> m4/private.m4-tmp1 << EOF
412 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
413 cat >> m4/private.m4-tmp2 << EOF
416 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
417 cat >> m4/private.m4-tmp3 << EOF
420 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
421 cat >> m4/private.m4-tmp4 << EOF
425 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
430 ### classic bootstrap stuff
434 # remove autotools cruft
435 rm -f aclocal.m4 configure config.log config.h config.h.in
436 rm -Rf autom4te*.cache
437 # remove old autotools extra cruft
438 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
439 # remove new autotools extra cruft
442 # remove libtool cruft
443 rm -f ltmain.sh libtool ltconfig
444 # remove gettext cruft
448 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
450 # Automake complains if these are not present
451 rm -f vlc-config.in && printf "" > vlc-config.in
452 if [ "$GETTEXT" != "yes" ]; then
453 test -d intl || mkdir intl
454 printf "" > intl/Makefile.am
455 printf "" > ABOUT-NLS
458 # Libtoolize directory
459 ${libtoolize} --copy --force
460 if test -f "ltmain.sh"; then
461 echo "$0: working around a minor libtool issue"
462 mv ltmain.sh autotools/
467 ${aclocal} ${ACLOCAL_ARGS}
470 ${automake} --add-missing --copy
473 ## files which need to be regenerated
475 rm -f vlc-config.in vlc-config
476 rm -f src/misc/modules_builtin.h
477 rm -f mozilla/vlcintf.h
483 ## Tell the user about gettext, pkg-config and sed
485 if [ "${GETTEXT}" = "old" ]; then
488 ==========================================================
489 NOTE: you have an old version of gettext installed on your
490 system. The vlc build will work, but if your system does not
491 have libintl you will not have internationalization support.
492 We suggest upgrading to gettext 0.11.5 or later.
496 if [ "$PKGCONFIG" = "no" ]; then
499 ==============================================================
500 NOTE: you do not have the "pkg-config" utility on your system;
501 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
506 if [ "$AUTOMAKESUCKS" = "yes" ]; then
509 =============================================================
510 IMPORTANT NOTE: your version of automake has a bug which will
511 prevent proper plugin compilation. Either compile VLC with
512 the --disable-plugins flag, or use a version of automake newer
513 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
517 if [ "$INSTALLSUCKS" = "yes" ]; then
520 =============================================================
521 IMPORTANT NOTE: your version of automake has a bug which will
522 prevent proper installation. Do not use "make install" with this
523 version of automake, or use a version of automake newer than 1.5
524 (such as 1.6 or 1.7).