3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.65 2003/07/05 14:47:53 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}
97 rm -f *.a *.so *.dll *.sl *.dylib
100 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
102 count="`expr ${count} + 1`"
103 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
106 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
109 # cat >> m4/private.m4-tmp1 << EOF
110 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
111 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
113 cat >> m4/private.m4-tmp4 << EOF
114 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
116 # Generation of modules/**/Makefile.am
117 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
119 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
120 # the resulting file size.
121 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
122 # work properly with any automake version I tested.
123 cat >> modules/${dir}/Makefile.am << EOF
130 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
131 if test "\$(plugin)" != "no" \\
132 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
133 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
135 if test "\$(builtin)" != "no" \\
136 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
137 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
139 if test "\$(pic)" != "no" \\
140 && \$(VLC_CONFIG) --target builtin pic | grep "${dir}/lib${mod}_pic\\.a" >/dev/null 2>&1; then \\
141 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_pic.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
145 @set fnord \$\$MAKEFLAGS; amf=\$\$2; \\
146 if test "\$(plugin)" != "no" \\
147 && \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1; then \\
148 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT) || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
150 if test "\$(builtin)" != "no" \\
151 && \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1; then \\
152 \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a || case "\$\$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \\
158 L${count}p = lib${mod}_plugin.a
159 D${count}p = lib${mod}_plugin\$(LIBEXT)
160 L${count}b = lib${mod}.a
161 L${count}pic = lib${mod}_pic.a
163 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
164 B${count} = \$(nodist_SOURCES_${mod})
167 cat >> modules/${dir}/Makefile.am << EOF
171 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
172 ${PRIVATE}BUILT_SOURCES += \$(B${count})
175 cat >> modules/${dir}/Makefile.am << EOF
176 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
178 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
179 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
182 cat >> modules/${dir}/Makefile.am << EOF
183 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
184 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
185 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
187 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
189 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
190 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
193 cat >> modules/${dir}/Makefile.am << EOF
194 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
195 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
196 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
198 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
200 if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
201 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
204 cat >> modules/${dir}/Makefile.am << EOF
205 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
206 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
207 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
209 libvlc_LIBRARIES += \$(L${count}b) \$(L${count}pic)
210 lib${mod}_DATA = \$(D${count}p)
212 lib${mod}dir = \$(libdir)/vlc/${topdir}
213 ${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
214 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
215 ${PRIVATE} @case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
216 ${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}\` ;; \\
217 ${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}\` ;; \\
218 ${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}\` ;; \\
226 cat >> m4/private.m4-tmp1 << EOF
227 AM_CONDITIONAL(UNTRUE, false)
230 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
231 cat >> m4/private.m4-tmp2 << EOF
234 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
235 cat >> m4/private.m4-tmp3 << EOF
238 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
239 cat >> m4/private.m4-tmp4 << EOF
243 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
248 ### classic bootstrap stuff
252 # remove autotools cruft
253 rm -f aclocal.m4 configure configure.ac.in config.log Modules.am config.h config.h.in
254 # remove old autotools extra cruft
255 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
256 # remove new autotools extra cruft
257 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
258 # remove libtool cruft
259 rm -f ltmain.sh libtool ltconfig
260 # remove gettext cruft
261 rm -f m4/oldgettext.m4 ABOUT-NLS
265 if gettextize --version >/dev/null 2>&1; then
266 # Autopoint is available from 0.11.3, but we need 0.11.5
267 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
268 '>=' 0.11.5 >/dev/null 2>&1; then
269 # We have gettext, and a recent version! Everything is cool.
273 # User's gettext is too old. try to continue anyway.
276 echo > intl/Makefile.am
277 cat >> m4/private.m4 << EOF
278 dnl User's gettext is too old, so this is a no-op
279 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
284 # we don't have gettext. grmbl. try to continue anyway.
287 echo > intl/Makefile.am
288 cat >> m4/private.m4 << EOF
289 dnl User does not have gettext, so this is a no-op
290 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
296 # Check for pkg-config
297 if pkg-config --version >/dev/null 2>&1; then
298 # We have pkg-config, everything is cool.
301 # Not present, use a workaround.
302 cat >> m4/private.m4 << EOF
303 dnl User does not have pkg-config, so this is a no-op
304 AC_DEFUN([PKG_CHECK_MODULES], [])
312 if automake-1.7 --version >/dev/null 2>&1; then
314 # If we also have 1.6, use it instead because it is faster
315 if automake-1.6 --version >/dev/null 2>&1; then
316 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1
320 elif automake-1.6 --version >/dev/null 2>&1; then
322 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
323 then AUTOMAKESUCKS=yes
325 elif automake-1.5 --version >/dev/null 2>&1; then
328 elif automake --version > /dev/null 2>&1; then
330 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
331 0|0.*|1|1.[01234]|1.[01234][-.]*)
340 if test "${amvers}" = "none"; then
342 echo "you need automake version 1.5 or later"
346 # Automake complains if this is not present
347 rm -f vlc-config.in && printf "" > vlc-config.in
350 aclocal${amvers} -I m4
353 automake${amvers} --add-missing --copy
356 ## files which need to be regenerated
358 rm -f vlc-config.in vlc-config
359 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
360 rm -f include/vlc_symbols.h
361 rm -f mozilla/vlcintf.h
367 ## Tell the user about gettext, pkg-config and sed
373 ===========================================================
374 IMPORTANT NOTE: you do not have gettext installed on your
375 system. The vlc build will work, but you will not have
376 internationalization support. We suggest installing gettext.
381 ==========================================================
382 NOTE: you have an old version of gettext installed on your
383 system. The vlc build will work, but if your system does not
384 have libintl you will not have internationalization support.
385 We suggest upgrading to gettext 0.11.5 or later.
394 ==============================================================
395 NOTE: you do not have the "pkg-config" utility on your system;
396 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
402 case "$AUTOMAKESUCKS" in
406 =============================================================
407 IMPORTANT NOTE: your version of automake has a bug which will
408 prevent proper plugin compilation. Either compile VLC with
409 the --disable-plugins flag, or use a version of automake newer
410 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
415 case "$INSTALLSUCKS" in
419 =============================================================
420 IMPORTANT NOTE: your version of automake has a bug which will
421 prevent proper installation. Do not use "make install" with this
422 version of automake, or use a version of automake newer than 1.5
423 (such as 1.6 or 1.7).