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 = -L\$(top_builddir)/src -lvlc
226 \$(top_builddir)/compile
228 # Find out which modules were enabled and tell make to build them
231 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
232 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; \\
233 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; \\
234 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
237 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
238 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; \\
239 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; \\
240 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
244 # Build a plugin with the adequate linker and linker's flags
245 _plugin.a_plugin\$(LIBEXT):
246 @mod="\$*" ; mod=\$\${mod#lib} ; \
247 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBADD) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
248 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
249 c++) ld="\$(CXXLINK)" ;; \
250 objc) ld="\$(OBJCLINK)" ;; \
251 c|*) ld="\$(LINK)" ;; \
253 echo \$\$ld \$< \$\$ldfl ; \
255 #ifneq (,\$(findstring cygwin,\$(host)))
256 # mv -f "\$@.exe" "\$@"
258 @if test -f "\$@.exe"; then mv -f "\$@.exe" "\$@"; fi
261 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
262 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
269 -rm -f *.a *\$(LIBEXT)
272 clean-local: \$(clean_modules)
274 ### automake creates libvlcdir after running install-*-local
275 ### so we have to create it ourselves first
276 install-exec-local: all-modules
278 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
279 z=\$\$(\$(VLC_CONFIG) --list plugin); \
280 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
282 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
285 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
286 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
287 for mod in \$(mods); do \
289 in *\ \$\${mod}\ *) \
290 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
291 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
295 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
296 for mod in \$(mods); do \
298 in *\ \$\${mod}\ *) \
299 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
300 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
308 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
309 z=\$\$(\$(VLC_CONFIG) --list plugin); \
310 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
312 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
315 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
316 for mod in \$(mods); do \
318 in *\ \$\${mod}\ *) \
319 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
320 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
324 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
325 for mod in \$(mods); do \
327 in *\ \$\${mod}\ *) \
328 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
329 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
338 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
341 cat >> m4/private.m4-tmp4 << EOF
342 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
344 # Generation of modules/**/Makefile.am
345 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
347 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
348 # the resulting file size.
349 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
350 # work properly with any automake version I tested.
351 cat >> "${makf}" << EOF
355 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
356 clean_modules += clean-${mod}
358 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
362 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
363 BUILT_SOURCES += \$(B${mod})
366 cat >> "${makf}" << EOF
367 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
368 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
370 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
371 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
372 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
375 cat >> "${makf}" << EOF
376 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
377 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
378 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
379 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
380 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
381 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
382 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \\
383 -rpath '\$(libvlcdir)' -avoid-version -module -shrext \$(LIBEXT) \\
384 -export-symbol-regex ^\$(VLC_ENTRY)\$\$
385 lib${mod}_plugin_la_LIBADD = \$(LTLIBVLC)
387 lib${mod}_a_SOURCES = \$(SOURCES_${mod})
388 lib${mod}_builtin_la_SOURCES = \$(SOURCES_${mod})
390 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
391 nodist_lib${mod}_a_SOURCES = \$(nodist_SOURCES_${mod})
392 nodist_lib${mod}_builtin_la_SOURCES = \$(nodist_SOURCES_${mod})
395 cat >> "${makf}" << EOF
396 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
397 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
398 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
399 lib${mod}_builtin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
400 lib${mod}_builtin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
401 lib${mod}_builtin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
407 cat >> m4/private.m4-tmp1 << EOF
410 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
411 cat >> m4/private.m4-tmp2 << EOF
414 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
415 cat >> m4/private.m4-tmp3 << EOF
418 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
419 cat >> m4/private.m4-tmp4 << EOF
423 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
428 ### classic bootstrap stuff
432 # remove autotools cruft
433 rm -f aclocal.m4 configure config.log config.h config.h.in
434 rm -Rf autom4te*.cache
435 # remove old autotools extra cruft
436 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
437 # remove new autotools extra cruft
440 # remove libtool cruft
441 rm -f ltmain.sh libtool ltconfig
442 # remove gettext cruft
446 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
448 # Automake complains if these are not present
449 rm -f vlc-config.in && printf "" > vlc-config.in
450 if [ "$GETTEXT" != "yes" ]; then
451 test -d intl || mkdir intl
452 printf "" > intl/Makefile.am
453 printf "" > ABOUT-NLS
456 # Libtoolize directory
457 ${libtoolize} --copy --force
458 if test -f "ltmain.sh"; then
459 echo "$0: working around a minor libtool issue"
460 mv ltmain.sh autotools/
465 ${aclocal} ${ACLOCAL_ARGS}
468 ${automake} --add-missing --copy -Wall
471 ## files which need to be regenerated
473 rm -f vlc-config.in vlc-config
474 rm -f src/misc/modules_builtin.h
480 ## Tell the user about gettext, pkg-config and sed
482 if [ "${GETTEXT}" = "old" ]; then
485 ==========================================================
486 NOTE: you have an old version of gettext installed on your
487 system. The vlc build will work, but if your system does not
488 have libintl you will not have internationalization support.
489 We suggest upgrading to gettext 0.11.5 or later.
493 if [ "$PKGCONFIG" = "no" ]; then
496 ==============================================================
497 NOTE: you do not have the "pkg-config" utility on your system;
498 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be