]> git.sesse.net Git - vlc/blob - bootstrap
* modules/gui/wxwindows/*, include/vlc_interface.h: new generic "open file" dialog.
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap file for the VLC media player
4 ##  $Id: bootstrap,v 1.70 2003/07/17 13:09:46 sam Exp $
5 ##
6 ##  Authors: Sam Hocevar <sam@zoy.org>
7
8 if test "$#" != "0"; then
9   echo "Usage: $0"
10   echo "  Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
11   echo "  m4 macros and prepare Makefiles."
12   exit 1
13 fi
14
15 ###
16 ###  Get a sane environment, just in case
17 ###
18 LANG=C
19 export LANG
20 CYGWIN=binmode
21 export CYGWIN
22
23 set -e
24
25 ##
26 ## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
27 ##
28 AUTOMAKESUCKS=no
29 INSTALLSUCKS=no
30
31 ##
32 ## Generate the modules makefile, by parsing modules/**/Modules.am
33 ##
34
35 printf "generating modules/**/Makefile.am and m4/private.m4"
36
37 # Prepare m4/private.m4
38 rm -f m4/private.m4 && cat > m4/private.m4 << EOF
39 dnl  Private VLC macros - generated by bootstrap
40
41 EOF
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], [
46 EOF
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], [
50 EOF
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([
55 EOF
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
60 EOF
61
62 modules=""
63
64 rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
65 # Autogenerated by bootstrap - DO NOT EDIT
66 EXTRA_DIST = LIST
67 SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
68 #DIST_SUBDIRS = \$(SUBDIRS)
69 EOF
70
71 for dir in `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
72 do
73   printf "."
74   mf="modules/${dir}/Modules.am"
75   basedir="${dir%%\/*}"
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
79
80 # Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead
81
82 NULL =
83 libvlc_LIBRARIES =
84 noinst_LIBRARIES =
85 noinst_HEADERS =
86 EXTRA_DIST = Modules.am
87 BUILT_SOURCES =
88 SUBDIRS = ${subdirs}
89 #DIST_SUBDIRS = \$(SUBDIRS)
90 libvlcdir = \$(libdir)/vlc/${basedir}
91 include Modules.am
92
93 clean: clean-local
94 clean-local:
95         -rm -f *.a *.so *.dll *.sl *.dylib
96
97 EOF
98   for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
99   do
100     if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
101         PRIVATE='#'; else
102         PRIVATE=''; fi
103     if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
104         NODIST=''; else
105         NODIST='#'; fi
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)
109 #EOF
110     cat >> m4/private.m4-tmp4 << EOF
111     ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
112 EOF
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
121 # The ${mod} plugin
122 clean: clean-${mod}
123 all: all-${mod}
124
125 EOF
126     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
127 clean-${mod}:
128         -test -z "\$(nodist_SOURCES_${mod})" || rm -f \$(nodist_SOURCES_${mod})
129
130 EOF
131     fi
132     cat >> modules/${dir}/Makefile.am << EOF
133 all-${mod}:
134 if BUILD_MOZILLA
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; \\
139         fi; \\
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; \\
143         fi; \\
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; \\
147         fi; \\
148         test -z "\$\$fail"
149 else
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; \\
154         fi; \\
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; \\
158         fi; \\
159         test -z "\$\$fail"
160 endif
161
162 if UNTRUE
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
167 EOF
168     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
169 B${mod} = \$(nodist_SOURCES_${mod})
170 EOF
171     fi
172     cat >> modules/${dir}/Makefile.am << EOF
173 endif
174
175 EOF
176     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
177 ${PRIVATE}BUILT_SOURCES += \$(B${mod})
178 EOF
179     fi
180     cat >> modules/${dir}/Makefile.am << EOF
181 ${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
182 EOF
183     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
184 ${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
185 EOF
186     fi
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}\`
191
192 lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
193 EOF
194     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
195 nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
196 EOF
197     fi
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}\`
202
203 lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
204 EOF
205     if [ "${NODIST}" != "#" ]; then cat >> modules/${dir}/Makefile.am << EOF
206 nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
207 EOF
208     fi
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}\`
213
214 libvlc_LIBRARIES += \$(L${mod}b) \$(L${mod}pic)
215 lib${mod}_DATA = \$(D${mod}p)
216
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}\` ;; \\
224 ${PRIVATE}      esac
225
226
227 EOF
228   done
229 done
230
231 cat >> m4/private.m4-tmp1 << EOF
232   AM_CONDITIONAL(UNTRUE, false)
233 ])
234 EOF
235 cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
236 cat >> m4/private.m4-tmp2 << EOF
237 ])
238 EOF
239 cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
240 cat >> m4/private.m4-tmp3 << EOF
241 ])])
242 EOF
243 cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
244 cat >> m4/private.m4-tmp4 << EOF
245 BLAH
246 ])
247 EOF
248 cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
249
250 echo "done."
251
252 ###
253 ###  classic bootstrap stuff
254 ###
255 set -x
256
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
266 rm -f ABOUT-NLS
267 rm -Rf intl
268 # remove old vlc cruft
269 rm -f m4/oldgettext.m4 stamp-pic configure.ac.in Modules.am
270
271 # Check for gettext
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.
277   autopoint
278   GETTEXT=yes
279 else
280   # User's gettext is too old. try to continue anyway.
281   echo > ABOUT-NLS
282   mkdir -p intl
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], [])
287
288 EOF
289   GETTEXT=old
290 fi;else
291   # we don't have gettext. grmbl. try to continue anyway.
292   echo > ABOUT-NLS
293   mkdir -p intl
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], [])
298
299 EOF
300   GETTEXT=no
301 fi
302
303 # Check for pkg-config
304 if pkg-config --version >/dev/null 2>&1; then
305   # We have pkg-config, everything is cool.
306   PKGCONFIG=yes
307 else
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], [])
312
313 EOF
314   PKGCONFIG=no
315 fi
316
317 # Check for automake
318 amvers="none"
319 if automake-1.7 --version >/dev/null 2>&1; then
320   amvers="-1.7"
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
324       amvers="-1.6"
325     fi
326   fi
327 elif automake-1.6 --version >/dev/null 2>&1; then
328   amvers="-1.6"
329   if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1; then
330     AUTOMAKESUCKS=yes
331   fi
332 elif automake-1.5 --version >/dev/null 2>&1; then
333   INSTALLSUCKS=yes
334   amvers="-1.5"
335 elif automake --version > /dev/null 2>&1; then
336   amvers=""
337   case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
338     0|0.*|1|1.[01234]|1.[01234][-.]*)
339       amvers="none" ;;
340     1.5|1.5.*)
341       INSTALLSUCKS=yes ;;
342     1.6|1.6.0|1.6.1)
343       AUTOMAKESUCKS=yes ;;
344   esac
345 fi
346
347 if test "${amvers}" = "none"; then
348   set +x
349   echo "you need automake version 1.5 or later"
350   exit 1
351 fi
352
353 # Automake complains if this is not present
354 rm -f vlc-config.in && printf "" > vlc-config.in
355
356 # Do the rest
357 aclocal${amvers} -I m4
358 autoconf
359 autoheader
360 automake${amvers} --add-missing --copy
361
362 ##
363 ##  files which need to be regenerated
364 ##
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
369
370 # Shut up
371 set +x
372
373 ##
374 ##  Tell the user about gettext, pkg-config and sed
375 ##
376 case "${GETTEXT}" in
377   yes) ;;
378   no) cat << EOF
379
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.
384 EOF
385   ;;
386   old) cat << EOF
387
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.
393 EOF
394   ;;
395 esac
396
397 case "$PKGCONFIG" in
398   yes) ;;
399   no) cat << EOF
400
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
404 reliable.
405 EOF
406   ;;
407 esac
408
409 case "$AUTOMAKESUCKS" in
410   no) ;;
411   yes) cat << EOF
412
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).
418 EOF
419   ;;
420 esac
421
422 case "$INSTALLSUCKS" in
423   no) ;;
424   yes) cat << EOF
425
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).
431 EOF
432   ;;
433 esac
434