3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.75 2003/10/24 11:53:59 sam 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
27 ## Check for various tools
34 if automake-1.7 --version >/dev/null 2>&1; then
36 # If we also have 1.6 (>> 1.6.1), use it instead because it is faster
37 if automake-1.6 --version >/dev/null 2>&1; then
38 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
42 elif automake-1.6 --version >/dev/null 2>&1; then
44 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
47 elif automake-1.5 --version >/dev/null 2>&1; then
50 elif automake --version > /dev/null 2>&1; then
52 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
53 0|0.*|1|1.[01234]|1.[01234][-.]*)
62 if test "${amvers}" = "none"; then
64 echo "you need automake version 1.5 or later"
69 if gettextize --version >/dev/null 2>&1; then
70 # Autopoint is available from 0.11.3, but we need 0.11.5
71 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
72 '>=' 0.11.5 >/dev/null 2>&1; then
73 # We have gettext, and a recent version! Everything is cool.
77 # User's gettext is too old. try to continue anyway.
80 echo > intl/Makefile.am
81 cat >> m4/private.m4 << EOF
82 dnl User's gettext is too old, so this is a no-op
83 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
89 # we don't have gettext. grmbl. try to continue anyway.
92 echo > intl/Makefile.am
93 cat >> m4/private.m4 << EOF
94 dnl User does not have gettext, so this is a no-op
95 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
102 # Check for pkg-config
103 if pkg-config --version >/dev/null 2>&1; then
104 # We have pkg-config, everything is cool.
107 # Not present, use a workaround.
108 cat >> m4/private.m4 << EOF
109 dnl User does not have pkg-config, so this is a no-op
110 AC_DEFUN([PKG_CHECK_MODULES], [:])
116 aclocal=aclocal${amvers}
117 automake=automake${amvers}
119 autoheader=autoheader
122 ## Generate the modules makefile, by parsing modules/**/Modules.am
126 printf "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
133 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
134 dnl The required AM_CONDITIONAL calls
135 dnl XXX: too many conditionals make the build very slow, disabled them
136 AC_DEFUN([AX_VLC_CONDITIONALS], [
138 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
139 dnl The required AC_SUBST calls
140 AC_DEFUN([AX_VLC_SUBSTS], [
142 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
143 dnl The required AC_OUTPUT calls
144 dnl XXX: this feature is only supported starting from automake-1.7
145 AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
147 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
148 dnl Helper macro for vlc-config generation
149 AC_DEFUN([AX_VLC_CONFIG_HELPER], [
150 cat >> vlc-config.in << BLAH
155 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
156 # Autogenerated by bootstrap - DO NOT EDIT
158 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
159 #DIST_SUBDIRS = \$(SUBDIRS)
162 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
165 mf="modules/${dir}/Modules.am"
166 basedir="${dir%%\/*}"
167 # automake will not recurse for make dist if we don't define SUBDIRS = .
168 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
169 rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
171 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
177 EXTRA_DIST = Modules.am
180 #DIST_SUBDIRS = \$(SUBDIRS)
181 libvlcdir = \$(libdir)/vlc/${basedir}
185 # There's no need for pic code on win32 so get rid of this to substantially
186 # reduce the compilation time.
192 -rm -f *.a *.so *.dll *.sl *.dylib
195 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
197 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
200 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
203 # cat >> m4/private.m4-tmp1 << EOF
204 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
205 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
207 cat >> m4/private.m4-tmp4 << EOF
208 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
210 # Generation of modules/**/Makefile.am
211 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
212 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
213 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
214 # the resulting file size.
215 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
216 # work properly with any automake version I tested.
217 cat >> modules/${dir}/Makefile.am << EOF
221 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
224 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
228 cat >> modules/${dir}/Makefile.am << EOF
232 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
233 if test "\$(plugin)" != "no" \\
234 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
235 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
237 if test "\$(builtin)" != "no" \\
238 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
239 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
241 if test "\$(pic)" != "no" \\
242 && \$(VLC_CONFIG) --target builtin pic | grep "${dir}/lib${mod}_pic\\.a" >/dev/null 2>&1; then \\
243 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_pic.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
247 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
248 if test "\$(plugin)" != "no" \\
249 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
250 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
252 if test "\$(builtin)" != "no" \\
253 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
254 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
260 L${mod}p = lib${mod}_plugin.a
261 D${mod}p = lib${mod}_plugin\$(LIBEXT)
262 L${mod}b = lib${mod}.a
263 L${mod}pic = lib${mod}_pic.a
265 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
266 B${mod} = \$(nodist_SOURCES_${mod})
269 cat >> modules/${dir}/Makefile.am << EOF
273 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
274 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
277 cat >> modules/${dir}/Makefile.am << EOF
278 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
280 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
281 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
284 cat >> modules/${dir}/Makefile.am << EOF
285 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
286 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
287 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
289 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
291 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
292 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
295 cat >> modules/${dir}/Makefile.am << EOF
296 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
297 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
298 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
300 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
302 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
303 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
306 cat >> modules/${dir}/Makefile.am << EOF
307 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
308 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
309 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
311 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
312 lib${mod}_DATA = \$(D${mod}p)
314 lib${mod}dir = \$(libdir)/vlc/${topdir}
315 ${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
316 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
317 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
318 ${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}\` ;; \\
319 ${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}\` ;; \\
320 ${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}\` ;; \\
328 cat >> m4/private.m4-tmp1 << EOF
329 AM_CONDITIONAL(UNTRUE, false)
332 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
333 cat >> m4/private.m4-tmp2 << EOF
336 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
337 cat >> m4/private.m4-tmp3 << EOF
340 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
341 cat >> m4/private.m4-tmp4 << EOF
345 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
350 ### classic bootstrap stuff
354 # remove autotools cruft
355 rm -f aclocal.m4 configure config.log config.h config.h.in
356 # remove old autotools extra cruft
357 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
358 # remove new autotools extra cruft
359 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
360 # remove libtool cruft
361 rm -f ltmain.sh libtool ltconfig
362 # remove gettext cruft
365 # remove old vlc cruft
366 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
367 # remove new vlc cruft
368 rm -f stamp-builtin stamp-h* mozilla/stamp-pic
370 # Automake complains if this is not present
371 rm -f vlc-config.in && printf "" > vlc-config.in
378 ${automake} --add-missing --copy
381 ## files which need to be regenerated
383 rm -f vlc-config.in vlc-config
384 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
385 rm -f include/vlc_symbols.h
386 rm -f mozilla/vlcintf.h
392 ## Tell the user about gettext, pkg-config and sed
398 ===========================================================
399 IMPORTANT NOTE: you do not have gettext installed on your
400 system. The vlc build will work, but you will not have
401 internationalization support. We suggest installing gettext.
406 ==========================================================
407 NOTE: you have an old version of gettext installed on your
408 system. The vlc build will work, but if your system does not
409 have libintl you will not have internationalization support.
410 We suggest upgrading to gettext 0.11.5 or later.
419 ==============================================================
420 NOTE: you do not have the "pkg-config" utility on your system;
421 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
427 case "$AUTOMAKESUCKS" in
431 =============================================================
432 IMPORTANT NOTE: your version of automake has a bug which will
433 prevent proper plugin compilation. Either compile VLC with
434 the --disable-plugins flag, or use a version of automake newer
435 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
440 case "$INSTALLSUCKS" in
444 =============================================================
445 IMPORTANT NOTE: your version of automake has a bug which will
446 prevent proper installation. Do not use "make install" with this
447 version of automake, or use a version of automake newer than 1.5
448 (such as 1.6 or 1.7).