3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.66 2003/07/07 16:53:48 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
65 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
66 # Autogenerated by bootstrap - DO NOT EDIT
68 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
69 #DIST_SUBDIRS = \$(SUBDIRS)
72 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
75 mf="modules/${dir}/Modules.am"
76 basedir="`echo ${dir} | cut -f1 -d/`"
77 # automake will not recurse for make dist if we don't define SUBDIRS = .
78 subdirs="`sed -ne 's,'modules/${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
79 #parent=`echo ${dir} | sed -e 's@[^/]*@..@g'`
80 #echo " modules/${dir}/Makefile" >> m4/private.m4-tmp3
81 rm -f modules/${dir}/Makefile.am && cat > modules/${dir}/Makefile.am << EOF
83 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
89 EXTRA_DIST = Modules.am
92 #DIST_SUBDIRS = \$(SUBDIRS)
93 libvlcdir = \$(libdir)/vlc/${basedir}
98 rm -f *.a *.so *.dll *.sl *.dylib
101 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
103 count="`expr ${count} + 1`"
104 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
107 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
110 # cat >> m4/private.m4-tmp1 << EOF
111 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
112 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
114 cat >> m4/private.m4-tmp4 << EOF
115 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
117 # Generation of modules/**/Makefile.am
118 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
120 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
121 # the resulting file size.
122 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
123 # work properly with any automake version I tested.
124 cat >> modules/${dir}/Makefile.am << EOF
130 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
132 rm -f \$(nodist_SOURCES_${mod})
136 cat >> modules/${dir}/Makefile.am << EOF
139 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
140 if test "\$(plugin)" != "no" \\
141 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
142 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
144 if test "\$(builtin)" != "no" \\
145 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
146 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
148 if test "\$(pic)" != "no" \\
149 && \$(VLC_CONFIG) --target builtin pic | grep "${dir}/lib${mod}_pic\\.a" >/dev/null 2>&1; then \\
150 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_pic.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
154 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
155 if test "\$(plugin)" != "no" \\
156 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
157 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
159 if test "\$(builtin)" != "no" \\
160 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
161 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
167 L${count}p = lib${mod}_plugin.a
168 D${count}p = lib${mod}_plugin\$(LIBEXT)
169 L${count}b = lib${mod}.a
170 L${count}pic = lib${mod}_pic.a
172 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
173 B${count} = \$(nodist_SOURCES_${mod})
176 cat >> modules/${dir}/Makefile.am << EOF
180 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
181 ${PRIVATE}BUILT_SOURCES += \$(B${count})
184 cat >> modules/${dir}/Makefile.am << EOF
185 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
187 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
188 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
191 cat >> modules/${dir}/Makefile.am << EOF
192 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
193 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
194 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
196 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
198 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
199 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
202 cat >> modules/${dir}/Makefile.am << EOF
203 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
204 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
205 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
207 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
209 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
210 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
213 cat >> modules/${dir}/Makefile.am << EOF
214 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
215 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
216 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
218 libvlc_LIBRARIES += \$(L${count}b) \$(L${count}pic)
219 lib${mod}_DATA = \$(D${count}p)
221 lib${mod}dir = \$(libdir)/vlc/${topdir}
222 ${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
223 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
224 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
225 ${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}\` ;; \\
226 ${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}\` ;; \\
227 ${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}\` ;; \\
235 cat >> m4/private.m4-tmp1 << EOF
236 AM_CONDITIONAL(UNTRUE, false)
239 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
240 cat >> m4/private.m4-tmp2 << EOF
243 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
244 cat >> m4/private.m4-tmp3 << EOF
247 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
248 cat >> m4/private.m4-tmp4 << EOF
252 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
257 ### classic bootstrap stuff
261 # remove autotools cruft
262 rm -f aclocal.m4 configure configure.ac.in config.log Modules.am config.h config.h.in
263 # remove old autotools extra cruft
264 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
265 # remove new autotools extra cruft
266 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
267 # remove libtool cruft
268 rm -f ltmain.sh libtool ltconfig
269 # remove gettext cruft
270 rm -f m4/oldgettext.m4 ABOUT-NLS
274 if gettextize --version >/dev/null 2>&1; then
275 # Autopoint is available from 0.11.3, but we need 0.11.5
276 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
277 '>=' 0.11.5 >/dev/null 2>&1; then
278 # We have gettext, and a recent version! Everything is cool.
282 # User's gettext is too old. try to continue anyway.
285 echo > intl/Makefile.am
286 cat >> m4/private.m4 << EOF
287 dnl User's gettext is too old, so this is a no-op
288 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
293 # we don't have gettext. grmbl. try to continue anyway.
296 echo > intl/Makefile.am
297 cat >> m4/private.m4 << EOF
298 dnl User does not have gettext, so this is a no-op
299 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
305 # Check for pkg-config
306 if pkg-config --version >/dev/null 2>&1; then
307 # We have pkg-config, everything is cool.
310 # Not present, use a workaround.
311 cat >> m4/private.m4 << EOF
312 dnl User does not have pkg-config, so this is a no-op
313 AC_DEFUN([PKG_CHECK_MODULES], [])
321 if automake-1.7 --version >/dev/null 2>&1; then
323 # If we also have 1.6, use it instead because it is faster
324 if automake-1.6 --version >/dev/null 2>&1; then
325 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1
329 elif automake-1.6 --version >/dev/null 2>&1; then
331 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
332 then AUTOMAKESUCKS=yes
334 elif automake-1.5 --version >/dev/null 2>&1; then
337 elif automake --version > /dev/null 2>&1; then
339 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
340 0|0.*|1|1.[01234]|1.[01234][-.]*)
349 if test "${amvers}" = "none"; then
351 echo "you need automake version 1.5 or later"
355 # Automake complains if this is not present
356 rm -f vlc-config.in && printf "" > vlc-config.in
359 aclocal${amvers} -I m4
362 automake${amvers} --add-missing --copy
365 ## files which need to be regenerated
367 rm -f vlc-config.in vlc-config
368 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
369 rm -f include/vlc_symbols.h
370 rm -f mozilla/vlcintf.h
376 ## Tell the user about gettext, pkg-config and sed
382 ===========================================================
383 IMPORTANT NOTE: you do not have gettext installed on your
384 system. The vlc build will work, but you will not have
385 internationalization support. We suggest installing gettext.
390 ==========================================================
391 NOTE: you have an old version of gettext installed on your
392 system. The vlc build will work, but if your system does not
393 have libintl you will not have internationalization support.
394 We suggest upgrading to gettext 0.11.5 or later.
403 ==============================================================
404 NOTE: you do not have the "pkg-config" utility on your system;
405 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
411 case "$AUTOMAKESUCKS" in
415 =============================================================
416 IMPORTANT NOTE: your version of automake has a bug which will
417 prevent proper plugin compilation. Either compile VLC with
418 the --disable-plugins flag, or use a version of automake newer
419 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
424 case "$INSTALLSUCKS" in
428 =============================================================
429 IMPORTANT NOTE: your version of automake has a bug which will
430 prevent proper installation. Do not use "make install" with this
431 version of automake, or use a version of automake newer than 1.5
432 (such as 1.6 or 1.7).