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 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 for v in "-1.9" "19" "-1.8" "18" "-1.7" "17"; do
54 if automake${v} --version >/dev/null 2>&1; then
61 if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
62 amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
67 no|1.[0123456]|1.[0123456].*|1[0123456])
69 echo "$0: you need automake version 1.7 or later"
76 if glibtoolize --version >/dev/null 2>&1; then
77 libtoolize="glibtoolize"
78 elif libtoolize --version >/dev/null 2>&1; then
79 libtoolize="libtoolize"
82 if test "$libtoolize" = "no"; then
84 echo "$0: you need libtool"
89 if gettextize --version >/dev/null 2>&1; then
90 # Autopoint is available from 0.11.3, but we need 0.11.5
91 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
92 '>=' 0.11.5 >/dev/null 2>&1; then
93 # We have gettext, and a recent version! Everything is cool.
97 # User's gettext is too old. try to continue anyway.
102 echo "you need gettextize (package gettext-devel or gettext)"
106 # Check for pkg-config
107 if pkg-config --version >/dev/null 2>&1; then
108 # We have pkg-config, everything is cool.
114 aclocal=aclocal${amvers}
115 automake=automake${amvers}
117 autoheader=autoheader
120 ## Generate the modules makefile, by parsing modules/**/Modules.am
124 echo "generating modules/**/Makefile.am and m4/private.m4"
126 # Prepare m4/private.m4
127 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
128 dnl Private VLC macros - generated by bootstrap
132 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
133 dnl User does not have pkg-config, so assume package was not found
134 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
139 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
140 dnl User does not have gettext, so this is a no-op
141 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
146 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
147 dnl The required AM_CONDITIONAL calls
148 dnl XXX: too many conditionals make the build very slow, disabled them
149 AC_DEFUN([VLC_CONDITIONALS], [
151 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
152 dnl The required AC_SUBST calls
153 AC_DEFUN([VLC_SUBSTS], [
155 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
156 dnl The required AC_OUTPUT calls
157 dnl XXX: this feature is only supported starting from automake-1.7
158 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
160 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
161 dnl Helper macro for vlc-config generation
162 AC_DEFUN([VLC_CONFIG_HELPER], [
163 cat >> vlc-config.in << BLAH
168 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
169 # Autogenerated by bootstrap - DO NOT EDIT
171 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
174 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
177 modf="modules/${dir}/Modules.am"
178 makf="modules/${dir}/Makefile.am"
179 basedir="`echo "${dir}" | cut -f1 -d/`"
180 # automake will not recurse for make dist if we don't define SUBDIRS = .
181 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
182 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
187 extra_libs="${extra_libs} lib${mod}_plugin.a lib${mod}.a"
188 extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la lib${mod}_builtin.la"
190 rm -f "${makf}" && cat > "${makf}" << EOF
192 # ${makf} automatically generated from ${modf} by bootstrap
193 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
201 EXTRA_DIST = Modules.am
205 SUFFIXES = _plugin\$(LIBEXT) _plugin.a
207 libvlcdir = \$(libdir)/vlc/\$(basedir)
209 EXTRA_LIBRARIES = ${extra_libs}
210 EXTRA_LTLIBRARIES = ${extra_ltlibs}
214 LTLIBVLC = \$(top_builddir)/src/libvlc.la
217 LIBVLC = -L\$(top_builddir)/src -lvlc
224 \$(top_builddir)/compile
226 # Find out which modules were enabled and tell make to build them
229 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
230 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; \\
231 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; \\
232 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
235 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
236 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; \\
237 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; \\
238 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
242 # Build a plugin with the adequate linker and linker's flags
243 _plugin.a_plugin\$(LIBEXT):
244 @mod="\$*" ; mod=\$\${mod#lib} ; \
245 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBADD) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
246 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
247 c++) ld="\$(CXXLINK)" ;; \
248 objc) ld="\$(OBJCLINK)" ;; \
249 c|*) ld="\$(LINK)" ;; \
251 echo \$\$ld \$< \$\$ldfl ; \
253 #ifneq (,\$(findstring cygwin,\$(host)))
254 # mv -f "\$@.exe" "\$@"
256 @if test -f "\$@.exe"; then mv -f "\$@.exe" "\$@"; fi
259 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
260 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
267 -rm -f *.a *\$(LIBEXT)
270 clean-local: \$(clean_modules)
272 ### automake creates libvlcdir after running install-*-local
273 ### so we have to create it ourselves first
274 install-exec-local: all-modules
276 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
277 z=\$\$(\$(VLC_CONFIG) --list plugin); \
278 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
280 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
283 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
284 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
285 for mod in \$(mods); do \
287 in *\ \$\${mod}\ *) \
288 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
289 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
293 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
294 for mod in \$(mods); do \
296 in *\ \$\${mod}\ *) \
297 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
298 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
306 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
307 z=\$\$(\$(VLC_CONFIG) --list plugin); \
308 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
310 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
313 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
314 for mod in \$(mods); do \
316 in *\ \$\${mod}\ *) \
317 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
318 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
322 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
323 for mod in \$(mods); do \
325 in *\ \$\${mod}\ *) \
326 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
327 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
336 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
339 cat >> m4/private.m4-tmp4 << EOF
340 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
342 # Generation of modules/**/Makefile.am
343 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
345 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
346 # the resulting file size.
347 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
348 # work properly with any automake version I tested.
349 cat >> "${makf}" << EOF
353 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
354 clean_modules += clean-${mod}
356 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
360 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
361 BUILT_SOURCES += \$(B${mod})
364 cat >> "${makf}" << EOF
365 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
366 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
368 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
369 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
370 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
373 cat >> "${makf}" << EOF
374 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
375 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
376 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
377 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
378 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
379 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
380 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \\
381 -rpath '\$(libvlcdir)' -avoid-version -module -shrext \$(LIBEXT) \\
382 -export-symbol-regex ^\$(VLC_ENTRY)\$\$
383 lib${mod}_plugin_la_LIBADD = \$(LTLIBVLC)
385 lib${mod}_a_SOURCES = \$(SOURCES_${mod})
386 lib${mod}_builtin_la_SOURCES = \$(SOURCES_${mod})
388 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
389 nodist_lib${mod}_a_SOURCES = \$(nodist_SOURCES_${mod})
390 nodist_lib${mod}_builtin_la_SOURCES = \$(nodist_SOURCES_${mod})
393 cat >> "${makf}" << EOF
394 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
395 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
396 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
397 lib${mod}_builtin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
398 lib${mod}_builtin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
399 lib${mod}_builtin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
405 cat >> m4/private.m4-tmp1 << EOF
408 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
409 cat >> m4/private.m4-tmp2 << EOF
412 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
413 cat >> m4/private.m4-tmp3 << EOF
416 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
417 cat >> m4/private.m4-tmp4 << EOF
421 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
426 ### classic bootstrap stuff
430 # remove autotools cruft
431 rm -f aclocal.m4 configure config.log config.h config.h.in
432 rm -Rf autom4te*.cache
433 # remove old autotools extra cruft
434 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
435 # remove new autotools extra cruft
438 # remove libtool cruft
439 rm -f ltmain.sh libtool ltconfig
440 # remove gettext cruft
444 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
446 # Automake complains if these are not present
447 rm -f vlc-config.in && printf "" > vlc-config.in
448 if [ "$GETTEXT" != "yes" ]; then
449 test -d intl || mkdir intl
450 printf "" > intl/Makefile.am
451 printf "" > ABOUT-NLS
454 # Libtoolize directory
455 ${libtoolize} --copy --force
456 if test -f "ltmain.sh"; then
457 echo "$0: working around a minor libtool issue"
458 mv ltmain.sh autotools/
463 ${aclocal} ${ACLOCAL_ARGS}
466 ${automake} --add-missing --copy -Wall
469 ## files which need to be regenerated
471 rm -f vlc-config.in vlc-config
472 rm -f src/misc/modules_builtin.h
478 ## Tell the user about gettext, pkg-config and sed
480 if [ "${GETTEXT}" = "old" ]; then
483 ==========================================================
484 NOTE: you have an old version of gettext installed on your
485 system. The vlc build will work, but if your system does not
486 have libintl you will not have internationalization support.
487 We suggest upgrading to gettext 0.11.5 or later.
491 if [ "$PKGCONFIG" = "no" ]; then
494 ==============================================================
495 NOTE: you do not have the "pkg-config" utility on your system;
496 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be