3 ## bootstrap file for the VLC media player
4 ## $Id: bootstrap,v 1.53 2003/06/27 23:31:24 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
24 ## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
30 ## Check that our tools don't suck
34 ## Generate the modules makefile, by parsing modules/**/Modules.am
37 printf "generating modules/**/Makefile.am and m4/private.m4"
39 # Prepare Modules.am and m4/private.m4
40 rm -f Modules.am && echo > Modules.am
41 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
42 dnl Private VLC macros - generated by bootstrap
45 rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
46 dnl The required AM_CONDITIONAL calls
47 dnl XXX: too many conditionals make the build very slow, disabled them
48 AC_DEFUN([AX_VLC_CONDITIONALS], [
50 rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
51 dnl The required AC_SUBST calls
52 AC_DEFUN([AX_VLC_SUBSTS], [
54 rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
55 dnl The required AC_OUTPUT calls
56 dnl XXX: this feature is only supported starting from automake-1.7
57 AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
59 rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
60 dnl Helper macro for vlc-config generation
61 AC_DEFUN([AX_VLC_CONFIG_HELPER], [
62 cat >> vlc-config.in << BLAH
68 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
69 # Autogenerated by bootstrap - DO NOT EDIT
71 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
72 #DIST_SUBDIRS = \$(SUBDIRS)
75 for dir in `sed -ne 's,\(modules/.*\)/Makefile,\1,p' configure.ac`
78 mf="${dir}/Modules.am"
79 basedir="`echo ${dir} | cut -f2 -d/`"
80 # automake will not recurse for make dist if we don't define SUBDIRS = .
81 subdirs="`sed -ne 's,'${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
82 #parent=`echo ${dir} | sed -e 's@[^/]*@..@g'`
83 #echo " ${dir}/Makefile" >> m4/private.m4-tmp3
84 rm -f ${dir}/Makefile.am && cat > ${dir}/Makefile.am << EOF
86 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
92 EXTRA_DIST = Modules.am
95 #DIST_SUBDIRS = \$(SUBDIRS)
96 libvlcdir = \$(libdir)/vlc/${basedir}
99 for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
101 count="`expr ${count} + 1`"
102 if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
105 if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
108 # cat >> m4/private.m4-tmp1 << EOF
109 #dnl AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
110 #dnl AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
112 cat >> Modules.am << EOF
113 ${dir}/lib${mod}_plugin: ${dir}/lib${mod}_plugin\$(LIBEXT)
114 ${dir}/lib${mod}_plugin\$(LIBEXT): include/vlc_symbols.h FORCE
115 cd ${dir} && \$(MAKE) lib${mod}_plugin\$(LIBEXT)
116 ${dir}/lib${mod}.a: include/vlc_symbols.h FORCE
117 cd ${dir} && \$(MAKE) lib${mod}.a
118 ${dir}/lib${mod}_pic.a: include/vlc_symbols.h FORCE
119 cd ${dir} && \$(MAKE) lib${mod}_pic.a
122 cat >> m4/private.m4-tmp4 << EOF
123 ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
125 # Generation of modules/**/Makefile.am
126 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127 # - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
128 # S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
129 # the resulting file size.
130 # - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
131 # work properly with any automake version I tested.
132 cat >> ${dir}/Makefile.am << EOF
136 L${count}p = lib${mod}_plugin.a
137 D${count}p = lib${mod}_plugin\$(LIBEXT)
138 L${count}b = lib${mod}.a
139 L${count}pic = lib${mod}_pic.a
141 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
142 B${count}p = \$(nodist_SOURCES_${mod})
143 B${count}b = \$(nodist_SOURCES_${mod})
146 cat >> ${dir}/Makefile.am << EOF
150 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
151 ${PRIVATE}BUILT_SOURCES += \$(B${count}p) \$(B${count}b)
154 cat >> ${dir}/Makefile.am << EOF
155 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
157 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
158 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
161 cat >> ${dir}/Makefile.am << EOF
162 lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
163 lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
164 lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`
166 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
168 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
169 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
172 cat >> ${dir}/Makefile.am << EOF
173 lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
174 lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
175 lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`
177 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
179 if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
180 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
183 cat >> ${dir}/Makefile.am << EOF
184 lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
185 lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
186 lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`
188 libvlc_LIBRARIES += \$(L${count}b) \$(L${count}pic)
189 lib${mod}_DATA = \$(D${count}p)
191 lib${mod}dir = \$(libdir)/vlc/${topdir}
192 ${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
193 ${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
194 ${PRIVATE} case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
195 ${PRIVATE} c++) \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
196 ${PRIVATE} objc) \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
197 ${PRIVATE} c|*) \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
205 cat >> m4/private.m4-tmp1 << EOF
206 AM_CONDITIONAL(UNTRUE, false)
209 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
210 cat >> m4/private.m4-tmp2 << EOF
213 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
214 cat >> m4/private.m4-tmp3 << EOF
217 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
218 cat >> m4/private.m4-tmp4 << EOF
222 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
227 ### classic bootstrap stuff
231 # remove autotools cruft
232 rm -f aclocal.m4 configure configure.ac.in config.log
233 # remove old autotools extra cruft
234 rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
235 # remove new autotools extra cruft
236 (cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
237 # remove libtool cruft
238 rm -f ltmain.sh libtool ltconfig
239 # remove gettext cruft
240 rm -f m4/oldgettext.m4 ABOUT-NLS
244 if gettextize --version >/dev/null 2>&1; then
245 # Autopoint is available from 0.11.3, but we need 0.11.5
246 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
247 '>=' 0.11.5 >/dev/null 2>&1; then
248 # We have gettext, and a recent version! Everything is cool.
252 # User's gettext is too old. try to continue anyway.
255 echo > intl/Makefile.am
256 cat >> m4/private.m4 << EOF
257 dnl User's gettext is too old, so this is a no-op
258 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
263 # we don't have gettext. grmbl. try to continue anyway.
266 echo > intl/Makefile.am
267 cat >> m4/private.m4 << EOF
268 dnl User does not have gettext, so this is a no-op
269 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
275 # Check for pkg-config
276 if pkg-config --version >/dev/null 2>&1; then
277 # We have pkg-config, everything is cool.
280 # Not present, use a workaround.
281 cat >> m4/private.m4 << EOF
282 dnl User does not have pkg-config, so this is a no-op
283 AC_DEFUN([PKG_CHECK_MODULES], [])
291 if automake-1.7 --version >/dev/null 2>&1; then
293 # If we also have 1.6, use it instead because it is faster
294 if automake-1.6 --version >/dev/null 2>&1; then
295 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1
299 elif automake-1.6 --version >/dev/null 2>&1; then
301 if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
302 then AUTOMAKESUCKS=yes
304 elif automake-1.5 --version >/dev/null 2>&1; then
307 elif automake --version > /dev/null 2>&1; then
309 case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
310 0|0.*|1|1.[01234]|1.[01234].*)
319 if test "${amvers}" = "none"; then
321 echo "you need automake version 1.5 or later"
325 # Automake complains if this is not present
326 rm -f vlc-config.in && printf "" > vlc-config.in
329 aclocal${amvers} -I m4 || exit 1
332 automake${amvers} --add-missing --copy
337 ## files which need to be regenerated
339 rm -f vlc-config.in vlc-config
340 rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
341 rm -f include/vlc_symbols.h
342 rm -f mozilla/vlcintf.h
350 ## Tell the user about gettext, pkg-config and sed
358 ===========================================================
359 IMPORTANT NOTE: you do not have gettext installed on your
360 system. The vlc build will work, but you will not have
361 internationalization support. We suggest installing gettext.
367 ==========================================================
368 NOTE: you have an old version of gettext installed on your
369 system. The vlc build will work, but if your system does not
370 have libintl you will not have internationalization support.
371 We suggest upgrading to gettext 0.11.5 or later.
382 ==============================================================
383 NOTE: you do not have the "pkg-config" utility on your system;
384 detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
390 case "$AUTOMAKESUCKS" in
396 =============================================================
397 IMPORTANT NOTE: your version of automake has a bug which will
398 prevent proper plugin compilation. Either compile VLC with
399 the --disable-plugins flag, or use a version of automake newer
400 than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
405 case "$INSTALLSUCKS" in
411 =============================================================
412 IMPORTANT NOTE: your version of automake has a bug which will
413 prevent proper installation. Do not use "make install" with this
414 version of automake, or use a version of automake newer than 1.5
415 (such as 1.6 or 1.7).