3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.73 2003/10/20 10:37:56 gbazin Exp $
6 ## Authors: Sam Hocevar <sam@zoy.org>
8 if test "$#" != "0"; then
10 echo " Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
11 echo " m4 macros and prepare Makefiles."
16 ### Get a sane environment, just in case
26 ## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
32 ## Generate the modules makefile, by parsing modules/**/Modules.am
35 printf "generating modules/**/Makefile.am and m4/private.m4"
37 # Prepare m4/private.m4
38 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
39 dnl Private VLC macros - generated by bootstrap
42 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
43 dnl The required AM_CONDITIONAL calls
44 dnl XXX: too many conditionals make the build very slow, disabled them
45 AC_DEFUN([AX_VLC_CONDITIONALS], [
47 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
48 dnl The required AC_SUBST calls
49 AC_DEFUN([AX_VLC_SUBSTS], [
51 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
52 dnl The required AC_OUTPUT calls
53 dnl XXX: this feature is only supported starting from automake-1.7
54 AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
56 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
57 dnl Helper macro for vlc-config generation
58 AC_DEFUN([AX_VLC_CONFIG_HELPER], [
59 cat >> vlc-config.in << BLAH
64 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
65 # Autogenerated by bootstrap - DO NOT EDIT
67 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
68 #DIST_SUBDIRS = \$(SUBDIRS)
71 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
74 mf="modules/${dir}/Modules.am"
76 # automake will not recurse for make dist if we don't define SUBDIRS = .
77 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
78 rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
80 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
86 EXTRA_DIST = Modules.am
89 #DIST_SUBDIRS = \$(SUBDIRS)
90 libvlcdir = \$(libdir)/vlc/${basedir}
94 # There's no need for pic code on win32 so get rid of this to substantially
95 # reduce the compilation time.
101 -rm -f *.a *.so *.dll *.sl *.dylib
104 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
106 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
109 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
112 # cat >> m4/private.m4-tmp1 << EOF
113 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
114 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
116 cat >> m4/private.m4-tmp4 << EOF
117 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
119 # Generation of modules/**/Makefile.am
120 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
121 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
122 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
123 # the resulting file size.
124 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
125 # work properly with any automake version I tested.
126 cat >> modules/${dir}/Makefile.am << EOF
132 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
134 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
138 cat >> modules/${dir}/Makefile.am << EOF
141 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
142 if test "\$(plugin)" != "no" \\
143 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
144 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
146 if test "\$(builtin)" != "no" \\
147 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
148 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
150 if test "\$(pic)" != "no" \\
151 && \$(VLC_CONFIG) --target builtin pic | grep "${dir}/lib${mod}_pic\\.a" >/dev/null 2>&1; then \\
152 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_pic.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
156 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
157 if test "\$(plugin)" != "no" \\
158 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
159 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
161 if test "\$(builtin)" != "no" \\
162 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
163 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
169 L${mod}p = lib${mod}_plugin.a
170 D${mod}p = lib${mod}_plugin\$(LIBEXT)
171 L${mod}b = lib${mod}.a
172 L${mod}pic = lib${mod}_pic.a
174 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
175 B${mod} = \$(nodist_SOURCES_${mod})
178 cat >> modules/${dir}/Makefile.am << EOF
182 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
183 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
186 cat >> modules/${dir}/Makefile.am << EOF
187 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
189 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
190 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
193 cat >> modules/${dir}/Makefile.am << EOF
194 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
195 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
196 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
198 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
200 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
201 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
204 cat >> modules/${dir}/Makefile.am << EOF
205 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
206 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
207 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
209 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
211 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
212 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
215 cat >> modules/${dir}/Makefile.am << EOF
216 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
217 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
218 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
220 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
221 lib${mod}_DATA = \$(D${mod}p)
223 lib${mod}dir = \$(libdir)/vlc/${topdir}
224 ${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
225 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
226 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
227 ${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}\` ;; \\
228 ${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}\` ;; \\
229 ${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}\` ;; \\
237 cat >> m4/private.m4-tmp1 << EOF
238 AM_CONDITIONAL(UNTRUE, false)
241 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
242 cat >> m4/private.m4-tmp2 << EOF
245 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
246 cat >> m4/private.m4-tmp3 << EOF
249 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
250 cat >> m4/private.m4-tmp4 << EOF
254 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
259 ### classic bootstrap stuff
263 # remove autotools cruft
264 rm -f aclocal.m4 configure config.log config.h config.h.in
265 # remove old autotools extra cruft
266 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
267 # remove new autotools extra cruft
268 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
269 # remove libtool cruft
270 rm -f ltmain.sh libtool ltconfig
271 # remove gettext cruft
274 # remove old vlc cruft
275 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
276 # remove new vlc cruft
277 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
280 if gettextize --version >/dev/null 2>&1; then
281 # Autopoint is available from 0.11.3, but we need 0.11.5
282 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
283 '>=' 0.11.5 >/dev/null 2>&1; then
284 # We have gettext, and a recent version! Everything is cool.
288 # User's gettext is too old. try to continue anyway.
291 echo > intl/Makefile.am
292 cat >> m4/private.m4 << EOF
293 dnl User's gettext is too old, so this is a no-op
294 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
300 # we don't have gettext. grmbl. try to continue anyway.
303 echo > intl/Makefile.am
304 cat >> m4/private.m4 << EOF
305 dnl User does not have gettext, so this is a no-op
306 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
313 # Check for pkg-config
314 if pkg-config --version >/dev/null 2>&1; then
315 # We have pkg-config, everything is cool.
318 # Not present, use a workaround.
319 cat >> m4/private.m4 << EOF
320 dnl User does not have pkg-config, so this is a no-op
321 AC_DEFUN([PKG_CHECK_MODULES], [:])
329 if automake-1.7 --version >/dev/null 2>&1; then
331 # If we also have 1.6, use it instead because it is faster
332 if automake-1.6 --version >/dev/null 2>&1; then
333 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
337 elif automake-1.6 --version >/dev/null 2>&1; then
339 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
342 elif automake-1.5 --version >/dev/null 2>&1; then
345 elif automake --version > /dev/null 2>&1; then
347 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
348 0|0.*|1|1.[01234]|1.[01234][-.]*)
357 if test "${amvers}" = "none"; then
359 echo "you need automake version 1.5 or later"
363 aclocal=aclocal${amvers}
364 automake=automake${amvers}
366 autoheader=autoheader
368 # Automake complains if this is not present
369 rm -f vlc-config.in && printf "" > vlc-config.in
376 ${automake} --add-missing --copy
379 ## files which need to be regenerated
381 rm -f vlc-config.in vlc-config
382 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
383 rm -f include/vlc_symbols.h
384 rm -f mozilla/vlcintf.h
390 ## Tell the user about gettext, pkg-config and sed
396 ===========================================================
397 IMPORTANT NOTE: you do not have gettext installed on your
398 system. The vlc build will work, but you will not have
399 internationalization support. We suggest installing gettext.
404 ==========================================================
405 NOTE: you have an old version of gettext installed on your
406 system. The vlc build will work, but if your system does not
407 have libintl you will not have internationalization support.
408 We suggest upgrading to gettext 0.11.5 or later.
417 ==============================================================
418 NOTE: you do not have the "pkg-config" utility on your system;
419 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
425 case "$AUTOMAKESUCKS" in
429 =============================================================
430 IMPORTANT NOTE: your version of automake has a bug which will
431 prevent proper plugin compilation. Either compile VLC with
432 the --disable-plugins flag, or use a version of automake newer
433 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
438 case "$INSTALLSUCKS" in
442 =============================================================
443 IMPORTANT NOTE: your version of automake has a bug which will
444 prevent proper installation. Do not use "make install" with this
445 version of automake, or use a version of automake newer than 1.5
446 (such as 1.6 or 1.7).