3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.70 2003/07/17 13:09:46 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
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}
95 -rm -f *.a *.so *.dll *.sl *.dylib
98 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
100 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
103 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
106 # cat >> m4/private.m4-tmp1 << EOF
107 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
108 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
110 cat >> m4/private.m4-tmp4 << EOF
111 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
113 # Generation of modules/**/Makefile.am
114 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
116 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
117 # the resulting file size.
118 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
119 # work properly with any automake version I tested.
120 cat >> modules/${dir}/Makefile.am << EOF
126 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
128 -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
132 cat >> modules/${dir}/Makefile.am << EOF
135 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
136 if test "\$(plugin)" != "no" \\
137 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
138 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
140 if test "\$(builtin)" != "no" \\
141 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
142 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
144 if test "\$(pic)" != "no" \\
145 && \$(VLC_CONFIG) --target builtin pic | grep "${dir}/lib${mod}_pic\\.a" >/dev/null 2>&1; then \\
146 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_pic.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
150 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
151 if test "\$(plugin)" != "no" \\
152 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
153 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
155 if test "\$(builtin)" != "no" \\
156 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
157 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
163 L${mod}p = lib${mod}_plugin.a
164 D${mod}p = lib${mod}_plugin\$(LIBEXT)
165 L${mod}b = lib${mod}.a
166 L${mod}pic = lib${mod}_pic.a
168 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
169 B${mod} = \$(nodist_SOURCES_${mod})
172 cat >> modules/${dir}/Makefile.am << EOF
176 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
177 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
180 cat >> modules/${dir}/Makefile.am << EOF
181 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
183 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
184 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
187 cat >> modules/${dir}/Makefile.am << EOF
188 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
189 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
190 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
192 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
194 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
195 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
198 cat >> modules/${dir}/Makefile.am << EOF
199 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
200 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
201 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
203 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
205 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
206 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
209 cat >> modules/${dir}/Makefile.am << EOF
210 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
211 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
212 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
214 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
215 lib${mod}_DATA = \$(D${mod}p)
217 lib${mod}dir = \$(libdir)/vlc/${topdir}
218 ${PRIVATE}noinst_LIBRARIES += \$(L${mod}p)
219 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
220 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
221 ${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}\` ;; \\
222 ${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}\` ;; \\
223 ${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}\` ;; \\
231 cat >> m4/private.m4-tmp1 << EOF
232 AM_CONDITIONAL(UNTRUE, false)
235 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
236 cat >> m4/private.m4-tmp2 << EOF
239 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
240 cat >> m4/private.m4-tmp3 << EOF
243 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
244 cat >> m4/private.m4-tmp4 << EOF
248 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
253 ### classic bootstrap stuff
257 # remove autotools cruft
258 rm -f aclocal.m4 configure config.log config.h config.h.in
259 # remove old autotools extra cruft
260 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
261 # remove new autotools extra cruft
262 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
263 # remove libtool cruft
264 rm -f ltmain.sh libtool ltconfig
265 # remove gettext cruft
268 # remove old vlc cruft
269 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
272 if gettextize --version >/dev/null 2>&1; then
273 # Autopoint is available from 0.11.3, but we need 0.11.5
274 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
275 '>=' 0.11.5 >/dev/null 2>&1; then
276 # We have gettext, and a recent version! Everything is cool.
280 # User's gettext is too old. try to continue anyway.
283 echo > intl/Makefile.am
284 cat >> m4/private.m4 << EOF
285 dnl User's gettext is too old, so this is a no-op
286 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
291 # we don't have gettext. grmbl. try to continue anyway.
294 echo > intl/Makefile.am
295 cat >> m4/private.m4 << EOF
296 dnl User does not have gettext, so this is a no-op
297 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
303 # Check for pkg-config
304 if pkg-config --version >/dev/null 2>&1; then
305 # We have pkg-config, everything is cool.
308 # Not present, use a workaround.
309 cat >> m4/private.m4 << EOF
310 dnl User does not have pkg-config, so this is a no-op
311 AC_DEFUN([PKG_CHECK_MODULES], [])
319 if automake-1.7 --version >/dev/null 2>&1; then
321 # If we also have 1.6, use it instead because it is faster
322 if automake-1.6 --version >/dev/null 2>&1; then
323 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1; then
327 elif automake-1.6 --version >/dev/null 2>&1; then
329 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
332 elif automake-1.5 --version >/dev/null 2>&1; then
335 elif automake --version > /dev/null 2>&1; then
337 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
338 0|0.*|1|1.[01234]|1.[01234][-.]*)
347 if test "${amvers}" = "none"; then
349 echo "you need automake version 1.5 or later"
353 # Automake complains if this is not present
354 rm -f vlc-config.in && printf "" > vlc-config.in
357 aclocal${amvers} -I m4
360 automake${amvers} --add-missing --copy
363 ## files which need to be regenerated
365 rm -f vlc-config.in vlc-config
366 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
367 rm -f include/vlc_symbols.h
368 rm -f mozilla/vlcintf.h
374 ## Tell the user about gettext, pkg-config and sed
380 ===========================================================
381 IMPORTANT NOTE: you do not have gettext installed on your
382 system. The vlc build will work, but you will not have
383 internationalization support. We suggest installing gettext.
388 ==========================================================
389 NOTE: you have an old version of gettext installed on your
390 system. The vlc build will work, but if your system does not
391 have libintl you will not have internationalization support.
392 We suggest upgrading to gettext 0.11.5 or later.
401 ==============================================================
402 NOTE: you do not have the "pkg-config" utility on your system;
403 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
409 case "$AUTOMAKESUCKS" in
413 =============================================================
414 IMPORTANT NOTE: your version of automake has a bug which will
415 prevent proper plugin compilation. Either compile VLC with
416 the --disable-plugins flag, or use a version of automake newer
417 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
422 case "$INSTALLSUCKS" in
426 =============================================================
427 IMPORTANT NOTE: your version of automake has a bug which will
428 prevent proper installation. Do not use "make install" with this
429 version of automake, or use a version of automake newer than 1.5
430 (such as 1.6 or 1.7).