3 ## bootstrap file for the VLC media player
6 ## Copyright (C) 2005-2006 the VideoLAN team
8 ## Initial author: Sam Hocevar <sam@zoy.org>
10 if test "$#" != "0"; then
12 echo " Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
13 echo " m4 macros and prepare Makefiles."
18 ### Get a sane environment, just in case
29 ## Check for various tools
36 # Check for contrib directory
37 if test -d extras/contrib/bin; then
38 export PATH=./extras/contrib/bin:$PATH
39 if test -d extras/contrib/share/aclocal; then
40 ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
42 if test ".`uname -s`" = ".Darwin"; then
43 export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
44 export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
45 elif test ".`uname -s`" = ".BeOS"; then
46 export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
47 export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
53 if automake-1.9 --version >/dev/null 2>&1; then
55 elif automake-1.8 --version >/dev/null 2>&1; then
57 elif automake-1.7 --version >/dev/null 2>&1; then
59 elif automake-1.6 --version >/dev/null 2>&1; then
61 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
64 elif automake-1.5 --version >/dev/null 2>&1; then
67 elif automake --version > /dev/null 2>&1; then
69 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
70 0|0.*|1|1.[01234]|1.[01234][-.]*)
81 if test "${amvers}" = "none"; then
83 echo "$0: you need automake version 1.5 or later"
89 if glibtoolize --version >/dev/null 2>&1; then
90 libtoolize="glibtoolize"
91 elif libtoolize --version >/dev/null 2>&1; then
92 libtoolize="libtoolize"
95 if test "$libtoolize" = "no"; then
97 echo "$0: you need libtool"
102 if gettextize --version >/dev/null 2>&1; then
103 # Autopoint is available from 0.11.3, but we need 0.11.5
104 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
105 '>=' 0.11.5 >/dev/null 2>&1; then
106 # We have gettext, and a recent version! Everything is cool.
110 # User's gettext is too old. try to continue anyway.
115 echo "you need gettextize (package gettext-devel or gettext)"
119 # Check for pkg-config
120 if pkg-config --version >/dev/null 2>&1; then
121 # We have pkg-config, everything is cool.
127 aclocal=aclocal${amvers}
128 automake=automake${amvers}
130 autoheader=autoheader
133 ## Generate the modules makefile, by parsing modules/**/Modules.am
137 echo "generating modules/**/Makefile.am and m4/private.m4"
139 # Prepare m4/private.m4
140 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
141 dnl Private VLC macros - generated by bootstrap
145 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
146 dnl User does not have pkg-config, so assume package was not found
147 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
152 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
153 dnl User does not have gettext, so this is a no-op
154 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
159 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
160 dnl The required AM_CONDITIONAL calls
161 dnl XXX: too many conditionals make the build very slow, disabled them
162 AC_DEFUN([VLC_CONDITIONALS], [
164 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
165 dnl The required AC_SUBST calls
166 AC_DEFUN([VLC_SUBSTS], [
168 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
169 dnl The required AC_OUTPUT calls
170 dnl XXX: this feature is only supported starting from automake-1.7
171 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
173 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
174 dnl Helper macro for vlc-config generation
175 AC_DEFUN([VLC_CONFIG_HELPER], [
176 cat >> vlc-config.in << BLAH
181 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
182 # Autogenerated by bootstrap - DO NOT EDIT
184 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
187 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
190 modf="modules/${dir}/Modules.am"
191 makf="modules/${dir}/Makefile.am"
192 basedir="`echo "${dir}" | cut -f1 -d/`"
193 # automake will not recurse for make dist if we don't define SUBDIRS = .
194 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
195 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
200 extra_libs="${extra_libs} lib${mod}_plugin.a lib${mod}.a lib${mod}_pic.a"
201 extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la lib${mod}_builtin.la"
203 rm -f "${makf}" && cat > "${makf}" << EOF
205 # ${makf} automatically generated from ${modf} by bootstrap
206 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
214 EXTRA_DIST = Modules.am
218 SUFFIXES = _plugin\$(LIBEXT) _plugin.a
220 libvlcdir = \$(libdir)/vlc/\$(basedir)
222 EXTRA_LIBRARIES = ${extra_libs}
223 EXTRA_LTLIBRARIES = ${extra_ltlibs}
227 LTLIBVLC = \$(top_builddir)/src/libvlc.la
230 LIBVLC = \$(top_builddir)/src/libvlc\$(LIBEXT)
236 # Find out which modules were enabled and tell make to build them
239 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
240 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; \\
241 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; \\
242 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
245 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
246 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; \\
247 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; \\
248 if test "\$(pic)" = "pic"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_pic.a;; esac; done; fi; \\
249 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
253 # Build a plugin with the adequate linker and linker's flags
254 _plugin.a_plugin\$(LIBEXT):
255 @mod="\$*" ; mod=\$\${mod#lib} ; \
256 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBADD) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
257 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
258 c++) ld="\$(CXXLINK)" ;; \
259 objc) ld="\$(OBJCLINK)" ;; \
260 c|*) ld="\$(LINK)" ;; \
262 echo \$\$ld \$< \$\$ldfl ; \
264 #ifneq (,\$(findstring cygwin,\$(host)))
265 # mv -f "\$@.exe" "\$@"
267 @if test -f "\$@.exe"; then mv -f "\$@.exe" "\$@"; fi
270 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
271 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
278 -rm -f *.a *\$(LIBEXT)
281 clean-local: \$(clean_modules)
283 ### automake creates libvlcdir after running install-*-local
284 ### so we have to create it ourselves first
285 install-exec-local: all-modules
287 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
288 z=\$\$(\$(VLC_CONFIG) --list plugin); \
289 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
291 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install ; \
294 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
295 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
296 for mod in \$(mods); do \
298 in *\ \$\${mod}\ *) \
299 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
300 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
304 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
305 for mod in \$(mods); do \
307 in *\ \$\${mod}\ *) \
308 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
309 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
314 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
315 for mod in \$(mods); do \
317 in *\ \$\${mod}\ *) \
318 echo \$(INSTALL_DATA) "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
319 \$(INSTALL_DATA) "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
328 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
329 z=\$\$(\$(VLC_CONFIG) --list plugin); \
330 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
332 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall ; \
335 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
336 for mod in \$(mods); do \
338 in *\ \$\${mod}\ *) \
339 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
340 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
344 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
345 for mod in \$(mods); do \
347 in *\ \$\${mod}\ *) \
348 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
349 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
354 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
355 for mod in \$(mods); do \
357 in *\ \$\${mod}\ *) \
358 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" ; \
359 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" || true; \
369 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
372 cat >> m4/private.m4-tmp4 << EOF
373 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
375 # Generation of modules/**/Makefile.am
376 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
378 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
379 # the resulting file size.
380 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
381 # work properly with any automake version I tested.
382 cat >> "${makf}" << EOF
386 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
387 clean_modules += clean-${mod}
389 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
393 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
394 BUILT_SOURCES += \$(B${mod})
397 cat >> "${makf}" << EOF
398 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
399 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
401 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
402 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
403 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
406 cat >> "${makf}" << EOF
407 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
408 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
409 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
410 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
411 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
412 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
413 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \\
414 -rpath '\$(libvlcdir)' -module -shrext \$(LIBEXT)
415 lib${mod}_plugin_la_LIBADD = \$(LTLIBVLC)
416 lib${mod}_plugin_la_DEPENDENCIES = \$(LTLIBVLC)
418 lib${mod}_pic_a_SOURCES = \$(SOURCES_${mod})
420 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
421 nodist_lib${mod}_pic_a_SOURCES = \$(nodist_SOURCES_${mod})
424 cat >> "${makf}" << EOF
425 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
426 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
427 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
429 lib${mod}_a_SOURCES = \$(SOURCES_${mod})
430 lib${mod}_builtin_la_SOURCES = \$(SOURCES_${mod})
432 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
433 nodist_lib${mod}_a_SOURCES = \$(nodist_SOURCES_${mod})
434 nodist_lib${mod}_builtin_la_SOURCES = \$(nodist_SOURCES_${mod})
437 cat >> "${makf}" << EOF
438 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
439 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
440 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
441 lib${mod}_builtin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\` -static
442 lib${mod}_builtin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\` -static
443 lib${mod}_builtin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\` -static
444 lib${mod}_builtin_la_LDFLAGS = -static
450 cat >> m4/private.m4-tmp1 << EOF
453 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
454 cat >> m4/private.m4-tmp2 << EOF
457 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
458 cat >> m4/private.m4-tmp3 << EOF
461 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
462 cat >> m4/private.m4-tmp4 << EOF
466 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
471 ### classic bootstrap stuff
475 # remove autotools cruft
476 rm -f aclocal.m4 configure config.log config.h config.h.in
477 rm -Rf autom4te*.cache
478 # remove old autotools extra cruft
479 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
480 # remove new autotools extra cruft
483 # remove libtool cruft
484 rm -f ltmain.sh libtool ltconfig
485 # remove gettext cruft
488 # remove old vlc cruft
489 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
490 # remove new vlc cruft
491 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
493 # Automake complains if these are not present
494 rm -f vlc-config.in && printf "" > vlc-config.in
495 if [ "$GETTEXT" != "yes" ]; then
496 test -d intl || mkdir intl
497 printf "" > intl/Makefile.am
498 printf "" > ABOUT-NLS
501 # Libtoolize directory
502 ${libtoolize} --copy --force
503 if test -f "ltmain.sh"; then
504 echo "$0: working around a minor libtool issue"
505 mv ltmain.sh autotools/
510 ${aclocal} ${ACLOCAL_ARGS}
513 ${automake} --add-missing --copy
516 ## files which need to be regenerated
518 rm -f vlc-config.in vlc-config
519 rm -f src/misc/modules_builtin.h
520 rm -f mozilla/vlcintf.h
526 ## Tell the user about gettext, pkg-config and sed
528 if [ "${GETTEXT}" = "old" ]; then
531 ==========================================================
532 NOTE: you have an old version of gettext installed on your
533 system. The vlc build will work, but if your system does not
534 have libintl you will not have internationalization support.
535 We suggest upgrading to gettext 0.11.5 or later.
539 if [ "$PKGCONFIG" = "no" ]; then
542 ==============================================================
543 NOTE: you do not have the "pkg-config" utility on your system;
544 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
549 if [ "$AUTOMAKESUCKS" = "yes" ]; then
552 =============================================================
553 IMPORTANT NOTE: your version of automake has a bug which will
554 prevent proper plugin compilation. Either compile VLC with
555 the --disable-plugins flag, or use a version of automake newer
556 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
560 if [ "$INSTALLSUCKS" = "yes" ]; then
563 =============================================================
564 IMPORTANT NOTE: your version of automake has a bug which will
565 prevent proper installation. Do not use "make install" with this
566 version of automake, or use a version of automake newer than 1.5
567 (such as 1.6 or 1.7).