3 ## bootstrap file for the VLC media player
6 ## Copyright (C) 2005 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 ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
40 if test ".`uname -s`" = ".Darwin"; then
41 export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
42 export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
43 elif test ".`uname -s`" = ".BeOS"; then
44 export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
45 export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
51 if automake-1.8 --version >/dev/null 2>&1; then
53 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
54 if automake-1.6 --version >/dev/null 2>&1; then
55 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
59 elif automake-1.9 --version >/dev/null 2>&1; then
61 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
62 if automake-1.6 --version >/dev/null 2>&1; then
63 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
67 elif automake-1.7 --version >/dev/null 2>&1; then
69 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
70 if automake-1.6 --version >/dev/null 2>&1; then
71 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
75 elif automake-1.6 --version >/dev/null 2>&1; then
77 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
80 elif automake-1.5 --version >/dev/null 2>&1; then
83 elif automake --version > /dev/null 2>&1; then
85 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
86 0|0.*|1|1.[01234]|1.[01234][-.]*)
97 if test "${amvers}" = "none"; then
99 echo "you need automake version 1.5 or later"
104 if gettextize --version >/dev/null 2>&1; then
105 # Autopoint is available from 0.11.3, but we need 0.11.5
106 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
107 '>=' 0.11.5 >/dev/null 2>&1; then
108 # We have gettext, and a recent version! Everything is cool.
112 # User's gettext is too old. try to continue anyway.
116 # we don't have gettext. grmbl. try to continue anyway.
121 # Check for pkg-config
122 if pkg-config --version >/dev/null 2>&1; then
123 # We have pkg-config, everything is cool.
129 aclocal=aclocal${amvers}
130 automake=automake${amvers}
132 autoheader=autoheader
135 ## Generate the modules makefile, by parsing modules/**/Modules.am
139 echo "generating modules/**/Makefile.am and m4/private.m4"
141 # Prepare m4/private.m4
142 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
143 dnl Private VLC macros - generated by bootstrap
147 if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
148 dnl User does not have pkg-config, so this is a no-op
149 AC_DEFUN([PKG_CHECK_MODULES], [:], [], [], [])
154 if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
155 dnl User does not have gettext, so this is a no-op
156 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
161 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
162 dnl The required AM_CONDITIONAL calls
163 dnl XXX: too many conditionals make the build very slow, disabled them
164 AC_DEFUN([VLC_CONDITIONALS], [
166 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
167 dnl The required AC_SUBST calls
168 AC_DEFUN([VLC_SUBSTS], [
170 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
171 dnl The required AC_OUTPUT calls
172 dnl XXX: this feature is only supported starting from automake-1.7
173 AC_DEFUN([VLC_MAKEFILES], [AC_OUTPUT([
175 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
176 dnl Helper macro for vlc-config generation
177 AC_DEFUN([VLC_CONFIG_HELPER], [
178 cat >> vlc-config.in << BLAH
183 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
184 # Autogenerated by bootstrap - DO NOT EDIT
186 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
189 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
192 modf="modules/${dir}/Modules.am"
193 makf="modules/${dir}/Makefile.am"
194 basedir="`echo "${dir}" | cut -f1 -d/`"
195 # automake will not recurse for make dist if we don't define SUBDIRS = .
196 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
197 mods="`sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < "${modf}" | xargs`"
201 extra_libs="${extra_libs} lib${mod}_plugin.a"
202 extra_libs="${extra_libs} lib${mod}.a lib${mod}_pic.a"
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
216 EXTRA_DIST = Modules.am
220 libvlcdir = \$(libdir)/vlc/\$(basedir)
222 EXTRA_LIBRARIES = ${extra_libs}
229 ### There's no need for pic code on win32 so get rid of this to substantially
230 ### reduce the compilation time.
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 if test "\$(pic)" != "no"; then z=\$\$(\$(VLC_CONFIG) --list builtin); for mod in \$(mods); do case "\$\$z " in *\ \$\${mod}\ *) echo lib\$\${mod}_pic.a;; esac; done; fi; \\
241 \`; case "\$\$targets" in *lib*) \$(MAKE) \$(AM_MAKEFLAGS) \$\$targets || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; ;; esac; \\
244 \$(srcdir)/Makefile.am: \$(srcdir)/Modules.am \$(top_srcdir)/bootstrap
245 cd \$(top_srcdir) && \$(SHELL) ./bootstrap
248 -rm -f *.a *\$(LIBEXT)
250 ### automake creates libvlcdir after running install-*-local
251 ### so we have to create it ourselves first
252 install-exec-local: all-modules
253 \$(mkdir_p) "\$(DESTDIR)\$(libvlcdir)"
254 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
255 for mod in \$(mods); do \
257 in *\ \$\${mod}\ *) \
258 echo \$(INSTALL_PROGRAM) -m 755 "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" ; \
259 \$(INSTALL_PROGRAM) -m 755 "lib\$\${mod}_plugin\$(LIBEXT)" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
263 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
264 for mod in \$(mods); do \
266 in *\ \$\${mod}\ *) \
267 echo \$(INSTALL_DATA) -m 644 "lib\$\${mod}.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
268 \$(INSTALL_DATA) -m 644 "lib\$\${mod}.a" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
273 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
274 for mod in \$(mods); do \
276 in *\ \$\${mod}\ *) \
277 echo \$(INSTALL_DATA) -m 644 "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libdir)/vlc/" ; \
278 \$(INSTALL_DATA) -m 644 "lib\$\${mod}_pic.a" "\$(DESTDIR)\$(libvlcdir)/" || exit \$\$?; \
285 @z=\$\$(\$(VLC_CONFIG) --list plugin); \
286 for mod in \$(mods); do \
288 in *\ \$\${mod}\ *) \
289 echo rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" ; \
290 rm -f "\$(DESTDIR)\$(libvlcdir)/lib\$\${mod}_plugin\$(LIBEXT)" || true; \
294 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
295 for mod in \$(mods); do \
297 in *\ \$\${mod}\ *) \
298 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" ; \
299 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}.a" || true; \
304 @z=\$\$(\$(VLC_CONFIG) --list builtin); \
305 for mod in \$(mods); do \
307 in *\ \$\${mod}\ *) \
308 echo rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" ; \
309 rm -f "\$(DESTDIR)\$(libdir)/vlc/lib\$\${mod}_pic.a" || true; \
318 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < "${modf}" >/dev/null 2>&1; then
321 if grep '^nodist_SOURCES_'${mod}'' < "${modf}" >/dev/null 2>&1; then
324 cat >> m4/private.m4-tmp4 << EOF
325 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
327 # Generation of modules/**/Makefile.am
328 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
330 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
331 # the resulting file size.
332 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
333 # work properly with any automake version I tested.
334 cat >> "${makf}" << EOF
338 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
339 clean-local: clean-${mod}
341 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
345 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
346 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
349 cat >> "${makf}" << EOF
350 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
352 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
353 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
356 cat >> "${makf}" << EOF
357 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
358 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
359 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
361 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
363 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
364 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
367 cat >> "${makf}" << EOF
368 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
369 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
370 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
372 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
374 if [ "${NODIST}" != "#" ]; then cat >> "${makf}" << EOF
375 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
378 cat >> "${makf}" << EOF
379 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
380 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
381 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
383 lib${mod}dir = \$(libdir)/vlc/${topdir}
384 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
385 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
386 ${PRIVATE} c++) echo \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \\\`\$(VLC_CONFIG) --libs plugin ${mod}\\\` ; \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
387 ${PRIVATE} objc) echo \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \\\`\$(VLC_CONFIG) --libs plugin ${mod}\\\` ; \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
388 ${PRIVATE} c|*) echo \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \\\`\$(VLC_CONFIG) --libs plugin ${mod}\\\` ; \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
396 cat >> m4/private.m4-tmp1 << EOF
399 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
400 cat >> m4/private.m4-tmp2 << EOF
403 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
404 cat >> m4/private.m4-tmp3 << EOF
407 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
408 cat >> m4/private.m4-tmp4 << EOF
412 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
417 ### classic bootstrap stuff
421 # remove autotools cruft
422 rm -f aclocal.m4 configure config.log config.h config.h.in
423 rm -Rf autom4te.cache
424 # remove old autotools extra cruft
425 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
426 # remove new autotools extra cruft
429 # remove libtool cruft
430 rm -f ltmain.sh libtool ltconfig
431 # remove gettext cruft
434 # remove old vlc cruft
435 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
436 # remove new vlc cruft
437 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
439 # Automake complains if these are not present
440 rm -f vlc-config.in && printf "" > vlc-config.in
441 if [ "$GETTEXT" != "yes" ]; then
442 test -d intl || mkdir intl
443 printf "" > intl/Makefile.am
444 printf "" > ABOUT-NLS
449 ${aclocal} ${ACLOCAL_ARGS}
452 ${automake} --add-missing --copy
455 ## files which need to be regenerated
457 rm -f vlc-config.in vlc-config
458 rm -f src/misc/modules_builtin.h
459 rm -f mozilla/vlcintf.h
465 ## Tell the user about gettext, pkg-config and sed
471 ===========================================================
472 IMPORTANT NOTE: you do not have gettext installed on your
473 system. The vlc build will work, but you will not have
474 internationalization support. We suggest installing gettext.
479 ==========================================================
480 NOTE: you have an old version of gettext installed on your
481 system. The vlc build will work, but if your system does not
482 have libintl you will not have internationalization support.
483 We suggest upgrading to gettext 0.11.5 or later.
492 ==============================================================
493 NOTE: you do not have the "pkg-config" utility on your system;
494 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
500 case "$AUTOMAKESUCKS" in
504 =============================================================
505 IMPORTANT NOTE: your version of automake has a bug which will
506 prevent proper plugin compilation. Either compile VLC with
507 the --disable-plugins flag, or use a version of automake newer
508 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
513 case "$INSTALLSUCKS" in
517 =============================================================
518 IMPORTANT NOTE: your version of automake has a bug which will
519 prevent proper installation. Do not use "make install" with this
520 version of automake, or use a version of automake newer than 1.5
521 (such as 1.6 or 1.7).