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
52 rm -f m4/autoconf260.m4
53 case "$(autoconf --version|head -1)" in
55 echo "Hey, your autoconf is quite old. Update it." >&2
60 echo "Enabling provisional autoconf 2.59 work-around. Update autoconf ASAP."
61 cp -f extras/m4/autoconf260.m4 m4/
67 for v in "-1.9" "19" "-1.8" "18" "-1.7" "17"; do
68 if automake${v} --version >/dev/null 2>&1; then
75 if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
76 amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
81 no|1.[0123456]|1.[0123456].*|1[0123456])
83 echo "$0: you need automake version 1.7 or later"
90 if glibtoolize --version >/dev/null 2>&1; then
91 libtoolize="glibtoolize"
92 elif libtoolize --version >/dev/null 2>&1; then
93 libtoolize="libtoolize"
96 if test "$libtoolize" = "no"; then
98 echo "$0: you need libtool"
103 if gettextize --version >/dev/null 2>&1; then
104 # Autopoint is available from 0.11.3, but we need 0.11.5
105 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
106 '>=' 0.11.5 >/dev/null 2>&1; then
107 # We have gettext, and a recent version! Everything is cool.
111 # User's gettext is too old. try to continue anyway.
116 echo "you need gettextize (package gettext-devel or gettext)"
120 # Check for pkg-config
121 if pkg-config --version >/dev/null 2>&1; then
122 # We have pkg-config, everything is cool.
128 aclocal=aclocal${amvers}
129 automake=automake${amvers}
131 autoheader=autoheader
134 ## Generate the modules makefile, by parsing modules/**/Modules.am
138 echo "generating modules/**/Makefile.am and m4/private.m4"
140 # Prepare m4/private.m4
141 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
142 dnl Private VLC macros - generated by bootstrap
146 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
147 dnl User does not have pkg-config, so assume package was not found
148 AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
153 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
154 dnl User does not have gettext, so this is a no-op
155 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
160 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
161 dnl The required AM_CONDITIONAL calls
162 dnl XXX: too many conditionals make the build very slow, disabled them
163 AC_DEFUN([VLC_CONDITIONALS], [
165 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
166 dnl The required AC_SUBST calls
167 AC_DEFUN([VLC_SUBSTS], [
169 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
170 dnl The required AC_OUTPUT calls
171 dnl XXX: this feature is only supported starting from automake-1.7
172 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
174 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
175 dnl Helper macro for vlc-config generation
176 AC_DEFUN([VLC_CONFIG_HELPER], [
177 cat >> vlc-config.in << BLAH
182 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
183 # Autogenerated by bootstrap - DO NOT EDIT
185 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
188 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
191 modf="modules/${dir}/Modules.am"
192 makf="modules/${dir}/Makefile.am"
193 basedir="`echo "${dir}" | cut -f1 -d/`"
194 # automake will not recurse for make dist if we don't define SUBDIRS = .
195 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
196 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
201 extra_libs="${extra_libs} lib${mod}_plugin.a lib${mod}.a"
202 extra_ltlibs="${extra_ltlibs} lib${mod}_plugin.la lib${mod}_builtin.la"
204 rm -f "${makf}" && cat > "${makf}" << EOF
206 # ${makf} automatically generated from ${modf} by bootstrap
207 # DO NOT EDIT - edit Modules.am or \$(top_srcdir)/bootstrap instead
215 EXTRA_DIST = Modules.am
219 SUFFIXES = _plugin\$(LIBEXT) _plugin.a
221 libvlcdir = \$(libdir)/vlc/\$(basedir)
223 EXTRA_LIBRARIES = ${extra_libs}
224 EXTRA_LTLIBRARIES = ${extra_ltlibs}
228 LTLIBVLC = \$(top_builddir)/src/libvlc.la
231 LIBVLC = -L\$(top_builddir)/src -lvlc
238 \$(top_builddir)/compile
240 # Find out which modules were enabled and tell make to build them
243 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
244 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; \\
245 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; \\
246 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
249 @set fnord \$\$MAKEFLAGS; amf=\$\$2; targets=\`\\
250 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; \\
251 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; \\
252 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
256 # Build a plugin with the adequate linker and linker's flags
257 _plugin.a_plugin\$(LIBEXT):
258 @mod="\$*" ; mod=\$\${mod#lib} ; \
259 ldfl="\`\$(VLC_CONFIG) --libs plugin \$\$mod\` \$(LIBADD) -u \$(SYMPREF)\$(VLC_ENTRY)" ; \
260 case \`\$(VLC_CONFIG) --linkage \$\$mod\` in \\
261 c++) ld="\$(CXXLINK)" ;; \
262 objc) ld="\$(OBJCLINK)" ;; \
263 c|*) ld="\$(LINK)" ;; \
265 echo \$\$ld \$< \$\$ldfl ; \
267 #ifneq (,\$(findstring cygwin,\$(host)))
268 # mv -f "\$@.exe" "\$@"
270 @if test -f "\$@.exe"; then mv -f "\$@.exe" "\$@"; fi
273 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
274 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
281 -rm -f *.a *\$(LIBEXT)
284 clean-local: \$(clean_modules)
286 ### automake creates libvlcdir after running install-*-local
287 ### so we have to create it ourselves first
288 install-exec-local: all-modules
290 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
291 z=\$\$(\$(VLC_CONFIG) --list plugin); \
292 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
294 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" install-libvlcLTLIBRARIES || exit \$\$? ; \
297 mkdir -p -- "\$(DESTDIR)\$(libvlcdir)"
298 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
299 for mod in \$(mods); do \
301 in *\ \$\${mod}\ *) \
302 echo \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
303 \$(INSTALL_PROGRAM) "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
307 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
308 for mod in \$(mods); do \
310 in *\ \$\${mod}\ *) \
311 echo \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
312 \$(INSTALL_DATA) "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" || exit \$\$?; \
320 @if test -z "\$(libvlc_LTLIBRARIES)"; then \
321 z=\$\$(\$(VLC_CONFIG) --list plugin); \
322 m=\`for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo -n " lib\$\${mod}_plugin.la" ;; esac; done\` ; \
324 \$(MAKE) \$(AM_MAKEFLAGS) libvlc_LTLIBRARIES="\$\$m" uninstall-libvlcLTLIBRARIES || exit \$\$?; \
327 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
328 for mod in \$(mods); do \
330 in *\ \$\${mod}\ *) \
331 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
332 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
336 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
337 for mod in \$(mods); do \
339 in *\ \$\${mod}\ *) \
340 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
341 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
350 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
353 cat >> m4/private.m4-tmp4 << EOF
354 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
356 # Generation of modules/**/Makefile.am
357 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
358 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
359 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
360 # the resulting file size.
361 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
362 # work properly with any automake version I tested.
363 cat >> "${makf}" << EOF
367 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
368 clean_modules += clean-${mod}
370 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
374 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
375 BUILT_SOURCES += \$(B${mod})
378 cat >> "${makf}" << EOF
379 lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
380 lib${mod}_plugin_la_SOURCES = \$(SOURCES_${mod})
382 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
383 nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
384 nodist_lib${mod}_plugin_la_SOURCES = \$(nodist_SOURCES_${mod})
387 cat >> "${makf}" << EOF
388 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
389 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
390 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
391 lib${mod}_plugin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
392 lib${mod}_plugin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
393 lib${mod}_plugin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
394 lib${mod}_plugin_la_LDFLAGS = \`\$(VLC_CONFIG) --libs plugin ${mod}\` \\
395 -rpath '\$(libvlcdir)' -avoid-version -module -shrext \$(LIBEXT) \\
396 -export-symbol-regex ^\$(VLC_ENTRY)\$\$
397 lib${mod}_plugin_la_LIBADD = \$(LTLIBVLC)
399 lib${mod}_a_SOURCES = \$(SOURCES_${mod})
400 lib${mod}_builtin_la_SOURCES = \$(SOURCES_${mod})
402 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
403 nodist_lib${mod}_a_SOURCES = \$(nodist_SOURCES_${mod})
404 nodist_lib${mod}_builtin_la_SOURCES = \$(nodist_SOURCES_${mod})
407 cat >> "${makf}" << EOF
408 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
409 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
410 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
411 lib${mod}_builtin_la_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
412 lib${mod}_builtin_la_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
413 lib${mod}_builtin_la_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
419 cat >> m4/private.m4-tmp1 << EOF
422 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
423 cat >> m4/private.m4-tmp2 << EOF
426 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
427 cat >> m4/private.m4-tmp3 << EOF
430 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
431 cat >> m4/private.m4-tmp4 << EOF
435 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
440 ### classic bootstrap stuff
444 # remove autotools cruft
445 rm -f aclocal.m4 configure config.log config.h config.h.in
446 rm -Rf autom4te*.cache
447 # remove old autotools extra cruft
448 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
449 # remove new autotools extra cruft
452 # remove libtool cruft
453 rm -f ltmain.sh libtool ltconfig
454 # remove gettext cruft
458 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
460 # Automake complains if these are not present
461 rm -f vlc-config.in && printf "" > vlc-config.in
462 if [ "$GETTEXT" != "yes" ]; then
463 test -d intl || mkdir intl
464 printf "" > intl/Makefile.am
465 printf "" > ABOUT-NLS
468 # Libtoolize directory
469 ${libtoolize} --copy --force
470 if test -f "ltmain.sh"; then
471 echo "$0: working around a minor libtool issue"
472 mv ltmain.sh autotools/
477 ${aclocal} ${ACLOCAL_ARGS}
480 ${automake} --add-missing --copy -Wall
483 ## files which need to be regenerated
485 rm -f vlc-config.in vlc-config
486 rm -f src/misc/modules_builtin.h
492 ## Tell the user about gettext, pkg-config and sed
494 if [ "${GETTEXT}" = "old" ]; then
497 ==========================================================
498 NOTE: you have an old version of gettext installed on your
499 system. The vlc build will work, but if your system does not
500 have libintl you will not have internationalization support.
501 We suggest upgrading to gettext 0.11.5 or later.
505 if [ "$PKGCONFIG" = "no" ]; then
508 ==============================================================
509 NOTE: you do not have the "pkg-config" utility on your system;
510 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be