bootstrap 12.1 KB
Newer Older
1
2
#! /bin/sh

3
##  bootstrap file for the VLC media player
4
##  $Id: bootstrap,v 1.55 2003/07/01 14:25:47 sam Exp $
5
##
Sam Hocevar's avatar
Sam Hocevar committed
6
##  Authors: Sam Hocevar <sam@zoy.org>
7

Sam Hocevar's avatar
Sam Hocevar committed
8
9
10
11
if test "$#" != "0"; then
  echo "Usage: $0"
  echo "  Calls automake, autoconf, autoheader, autopoint and other auto* to generate"
  echo "  m4 macros and prepare Makefiles."
12
13
14
  exit 1
fi

15
###
16
###  Get a sane environment, just in case
17
###
18
19
LANG=C
export LANG
20
21
CYGWIN=binmode
export CYGWIN
22

23
##
24
## Naively assume our system doesn't suck. Unfortunately it seldom doesn't.
25
##
26
27
AUTOMAKESUCKS=no
INSTALLSUCKS=no
28

29
30
31
##
## Check that our tools don't suck
##
32

33
34
35
36
##
## Generate the modules makefile, by parsing modules/**/Modules.am
##

Sam Hocevar's avatar
Sam Hocevar committed
37
printf "generating modules/**/Makefile.am and m4/private.m4"
38

Sam Hocevar's avatar
Sam Hocevar committed
39
# Prepare Modules.am and m4/private.m4
40
rm -f Modules.am && echo > Modules.am
Sam Hocevar's avatar
Sam Hocevar committed
41
rm -f m4/private.m4 && cat > m4/private.m4 << EOF
42
dnl  Private VLC macros - generated by bootstrap
43
44

EOF
Sam Hocevar's avatar
Sam Hocevar committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
rm -f m4/private.m4-tmp1 && cat > m4/private.m4-tmp1 << EOF
dnl  The required AM_CONDITIONAL calls
dnl  XXX: too many conditionals make the build very slow, disabled them
AC_DEFUN([AX_VLC_CONDITIONALS], [
EOF
rm -f m4/private.m4-tmp2 && cat > m4/private.m4-tmp2 << EOF
dnl  The required AC_SUBST calls
AC_DEFUN([AX_VLC_SUBSTS], [
EOF
rm -f m4/private.m4-tmp3 && cat > m4/private.m4-tmp3 << EOF
dnl  The required AC_OUTPUT calls
dnl  XXX: this feature is only supported starting from automake-1.7
AC_DEFUN([AX_VLC_MAKEFILES], [AC_OUTPUT([
EOF
rm -f m4/private.m4-tmp4 && cat > m4/private.m4-tmp4 << EOF
dnl  Helper macro for vlc-config generation
AC_DEFUN([AX_VLC_CONFIG_HELPER], [
  cat >> vlc-config.in << BLAH
EOF
64
65

modules=""
Sam Hocevar's avatar
Sam Hocevar committed
66
count=0
67

Sam Hocevar's avatar
Sam Hocevar committed
68
69
70
rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
# Autogenerated by bootstrap - DO NOT EDIT
EXTRA_DIST = LIST
Sam Hocevar's avatar
Sam Hocevar committed
71
72
SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
#DIST_SUBDIRS = \$(SUBDIRS)
Sam Hocevar's avatar
Sam Hocevar committed
73
EOF
74

Sam Hocevar's avatar
Sam Hocevar committed
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
for dir in `sed -ne 's,\(modules/.*\)/Makefile,\1,p' configure.ac`
do
  printf "."
  mf="${dir}/Modules.am"
  basedir="`echo ${dir} | cut -f2 -d/`"
  # automake will not recurse for make dist if we don't define SUBDIRS = .
  subdirs="`sed -ne 's,'${dir}'/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`"
  #parent=`echo ${dir} | sed -e 's@[^/]*@..@g'`
  #echo "  ${dir}/Makefile" >> m4/private.m4-tmp3
  rm -f ${dir}/Makefile.am && cat > ${dir}/Makefile.am << EOF

# Autogenerated by bootstrap - DO NOT EDIT - edit Modules.am instead

NULL =
libvlc_LIBRARIES =
noinst_LIBRARIES =
noinst_HEADERS =
EXTRA_DIST = Modules.am
BUILT_SOURCES =
Sam Hocevar's avatar
Sam Hocevar committed
94
95
SUBDIRS = ${subdirs}
#DIST_SUBDIRS = \$(SUBDIRS)
Sam Hocevar's avatar
Sam Hocevar committed
96
97
libvlcdir = \$(libdir)/vlc/${basedir}
include Modules.am
98
EOF
Sam Hocevar's avatar
Sam Hocevar committed
99
  for mod in `sed -n -e 's/^ *SOURCES_\([^ ]*\).*/\1/p' < ${mf}`
100
  do
Sam Hocevar's avatar
Sam Hocevar committed
101
    count="`expr ${count} + 1`"
102
103
104
105
106
107
    if grep '^SOURCES_'${mod}'.*=.*PRIVATE' < ${mf} >/dev/null 2>&1; then
        PRIVATE='#'; else
        PRIVATE=''; fi
    if grep '^nodist_SOURCES_'${mod}'' < ${mf} >/dev/null 2>&1; then
        NODIST=''; else
        NODIST='#'; fi
Sam Hocevar's avatar
Sam Hocevar committed
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#    cat >> m4/private.m4-tmp1 << EOF
#dnl  AM_CONDITIONAL(${mod}_p, test x\$${mod}_p = xyes)
#dnl  AM_CONDITIONAL(${mod}_b, test x\$${mod}_b = xyes)
#EOF
    cat >> Modules.am << EOF
${dir}/lib${mod}_plugin: ${dir}/lib${mod}_plugin\$(LIBEXT)
${dir}/lib${mod}_plugin\$(LIBEXT): include/vlc_symbols.h FORCE
	cd ${dir} && \$(MAKE) lib${mod}_plugin\$(LIBEXT)
${dir}/lib${mod}.a: include/vlc_symbols.h FORCE
	cd ${dir} && \$(MAKE) lib${mod}.a
${dir}/lib${mod}_pic.a: include/vlc_symbols.h FORCE
	cd ${dir} && \$(MAKE) lib${mod}_pic.a

EOF
    cat >> m4/private.m4-tmp4 << EOF
    ${mod}) list="\\\${list} ${dir}/lib${mod}" ;;
124
EOF
Sam Hocevar's avatar
Sam Hocevar committed
125
126
# Generation of modules/**/Makefile.am
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127
128
129
# - L_ is for LIBRARIES_, D_ for DATA_, B_ for BUILT_SOURCES_, F_ for LDFLAGS_,
#   S_ for SOURCES_, _p is for _plugin, _b is for _builtin. This is to reduce
#   the resulting file size.
Sam Hocevar's avatar
Sam Hocevar committed
130
131
132
# - *_CFLAGS, *_CXXFLAGS etc. because per-object CPPFLAGS does not seem to
#   work properly with any automake version I tested.
    cat >> ${dir}/Makefile.am << EOF
133
134
# The ${mod} plugin

Sam Hocevar's avatar
Sam Hocevar committed
135
136
137
all: all-${mod}

all-${mod}:
138
139
	if \$(VLC_CONFIG) --target plugin | grep "${dir}/lib${mod}_plugin" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_plugin\$(LIBEXT); fi
	if \$(VLC_CONFIG) --target builtin | grep "${dir}/lib${mod}\\.a" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}.a; fi
Sam Hocevar's avatar
Sam Hocevar committed
140
if BUILD_MOZILLA
141
	if \$(VLC_CONFIG) --target builtin pic | grep "${dir}/lib${mod}_pic\\.a" >/dev/null 2>&1 ; then \$(MAKE) \$(AM_MAKEFLAGS) lib${mod}_pic.a; fi
Sam Hocevar's avatar
Sam Hocevar committed
142
143
endif

144
if UNTRUE
Sam Hocevar's avatar
Sam Hocevar committed
145
146
147
148
149
150
151
152
153
154
155
L${count}p = lib${mod}_plugin.a
D${count}p = lib${mod}_plugin\$(LIBEXT)
L${count}b = lib${mod}.a
L${count}pic = lib${mod}_pic.a
EOF
    if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
B${count}p = \$(nodist_SOURCES_${mod})
B${count}b = \$(nodist_SOURCES_${mod})
EOF
    fi
    cat >> ${dir}/Makefile.am << EOF
156
157
endif

Sam Hocevar's avatar
Sam Hocevar committed
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
EOF
    if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
${PRIVATE}BUILT_SOURCES += \$(B${count}p) \$(B${count}b)
EOF
    fi
    cat >> ${dir}/Makefile.am << EOF
${PRIVATE}lib${mod}_plugin_a_SOURCES = \$(SOURCES_${mod})
EOF
    if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
${PRIVATE}nodist_lib${mod}_plugin_a_SOURCES = \$(nodist_SOURCES_${mod})
EOF
    fi
    cat >> ${dir}/Makefile.am << EOF
lib${mod}_plugin_a_CFLAGS = \`\$(VLC_CONFIG) --cflags plugin ${mod}\`
lib${mod}_plugin_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags plugin ${mod}\`
lib${mod}_plugin_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags plugin ${mod}\`

lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
EOF
    if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
nodist_lib${mod}_pic_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
EOF
    fi
    cat >> ${dir}/Makefile.am << EOF
lib${mod}_pic_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin pic ${mod}\`
lib${mod}_pic_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin pic ${mod}\`
lib${mod}_pic_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin pic ${mod}\`

lib${mod}_a_SOURCES = ${PRIVATE}\$(SOURCES_${mod})
EOF
    if [ "${NODIST}" != "#" ]; then cat >> ${dir}/Makefile.am << EOF
nodist_lib${mod}_a_SOURCES = ${PRIVATE}\$(nodist_SOURCES_${mod})
EOF
    fi
    cat >> ${dir}/Makefile.am << EOF
lib${mod}_a_CFLAGS = \`\$(VLC_CONFIG) --cflags builtin ${mod}\`
lib${mod}_a_CXXFLAGS = \`\$(VLC_CONFIG) --cxxflags builtin ${mod}\`
lib${mod}_a_OBJCFLAGS = \`\$(VLC_CONFIG) --objcflags builtin ${mod}\`

libvlc_LIBRARIES += \$(L${count}b) \$(L${count}pic)
lib${mod}_DATA = \$(D${count}p)
199
200

lib${mod}dir = \$(libdir)/vlc/${topdir}
Sam Hocevar's avatar
Sam Hocevar committed
201
202
203
204
205
206
207
${PRIVATE}noinst_LIBRARIES += \$(L${count}p)
${PRIVATE}lib${mod}_plugin\$(LIBEXT): \$(lib${mod}_plugin_a_OBJECTS)
${PRIVATE}	case \`\$(VLC_CONFIG) --linkage ${mod}\` in \\
${PRIVATE}	  c++) \$(CXXLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
${PRIVATE}	  objc) \$(OBJCLINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
${PRIVATE}	  c|*) \$(LINK) \$(lib${mod}_plugin_a_OBJECTS) \`\$(VLC_CONFIG) --libs plugin ${mod}\` ;; \\
${PRIVATE}	esac
208
209
210
211
212
213


EOF
  done
done

Sam Hocevar's avatar
Sam Hocevar committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
cat >> m4/private.m4-tmp1 << EOF
  AM_CONDITIONAL(UNTRUE, false)
])
EOF
cat m4/private.m4-tmp1 >> m4/private.m4 && rm -f m4/private.m4-tmp1
cat >> m4/private.m4-tmp2 << EOF
])
EOF
cat m4/private.m4-tmp2 >> m4/private.m4 && rm -f m4/private.m4-tmp2
cat >> m4/private.m4-tmp3 << EOF
])])
EOF
cat m4/private.m4-tmp3 >> m4/private.m4 && rm -f m4/private.m4-tmp3
cat >> m4/private.m4-tmp4 << EOF
BLAH
229
230
])
EOF
Sam Hocevar's avatar
Sam Hocevar committed
231
cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
232
233
234

echo "done."

235
###
236
###  classic bootstrap stuff
237
###
238
set -x
239
240

# remove autotools cruft
241
rm -f aclocal.m4 configure configure.ac.in config.log
242
243
244
245
246
247
248
249
# remove old autotools extra cruft
rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
# remove new autotools extra cruft
(cd autotools && rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh)
# remove libtool cruft
rm -f ltmain.sh libtool ltconfig
# remove gettext cruft
rm -f m4/oldgettext.m4 ABOUT-NLS
250
rm -Rf intl
251

252
# Check for gettext
Sam Hocevar's avatar
Sam Hocevar committed
253
if gettextize --version >/dev/null 2>&1; then
254
# Autopoint is available from 0.11.3, but we need 0.11.5
255
if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
Sam Hocevar's avatar
Sam Hocevar committed
256
        '>=' 0.11.5 >/dev/null 2>&1; then
257
  # We have gettext, and a recent version! Everything is cool.
258
  autopoint || exit 1
259
  GETTEXT=yes
260
else
261
  # User's gettext is too old. try to continue anyway.
262
  echo > ABOUT-NLS
263
  mkdir -p intl
264
  echo > intl/Makefile.am
Sam Hocevar's avatar
Sam Hocevar committed
265
  cat >> m4/private.m4 << EOF
266
267
268
269
dnl  User's gettext is too old, so this is a no-op
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])

EOF
270
271
272
  GETTEXT=old
fi;else
  # we don't have gettext. grmbl. try to continue anyway.
273
  echo > ABOUT-NLS
274
275
  mkdir -p intl
  echo > intl/Makefile.am
Sam Hocevar's avatar
Sam Hocevar committed
276
  cat >> m4/private.m4 << EOF
277
278
279
280
dnl  User does not have gettext, so this is a no-op
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])

EOF
281
  GETTEXT=no
282
fi
283

284
# Check for pkg-config
Sam Hocevar's avatar
Sam Hocevar committed
285
if pkg-config --version >/dev/null 2>&1; then
286
287
288
289
  # We have pkg-config, everything is cool.
  PKGCONFIG=yes
else
  # Not present, use a workaround.
Sam Hocevar's avatar
Sam Hocevar committed
290
  cat >> m4/private.m4 << EOF
291
292
293
294
dnl  User does not have pkg-config, so this is a no-op
AC_DEFUN([PKG_CHECK_MODULES], [])

EOF
295
296
297
  PKGCONFIG=no
fi

298
# Check for automake
299
amvers="none"
Sam Hocevar's avatar
Sam Hocevar committed
300
if automake-1.7 --version >/dev/null 2>&1; then
301
  amvers="-1.7"
Sam Hocevar's avatar
Sam Hocevar committed
302
303
304
305
  # If we also have 1.6, use it instead because it is faster
  if automake-1.6 --version >/dev/null 2>&1; then
    if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" ">" "1.6.1" > /dev/null 2>&1
    then amvers="-1.6"
306
307
    fi
  fi
Sam Hocevar's avatar
Sam Hocevar committed
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
elif automake-1.6 --version >/dev/null 2>&1; then
  amvers="-1.6"
  if expr "`automake-1.6 --version | sed -e '1s/[^0-9]*//' -e q`" "<=" "1.6.1" > /dev/null 2>&1
  then AUTOMAKESUCKS=yes
  fi
elif automake-1.5 --version >/dev/null 2>&1; then
  INSTALLSUCKS=yes
  amvers="-1.5"
elif automake --version > /dev/null 2>&1; then
  amvers=""
  case "`automake --version | sed -e '1s/[^0-9]*//' -e q`" in
    0|0.*|1|1.[01234]|1.[01234].*)
      amvers="none" ;;
    1.5|1.5.*)
      INSTALLSUCKS=yes ;;
    1.6|1.6.0|1.6.1)
      AUTOMAKESUCKS=yes ;;
  esac
326
327
fi

Sam Hocevar's avatar
Sam Hocevar committed
328
if test "${amvers}" = "none"; then
329
330
  set +x
  echo "you need automake version 1.5 or later"
331
  exit 1
332
fi
333

Sam Hocevar's avatar
Sam Hocevar committed
334
335
336
# Automake complains if this is not present
rm -f vlc-config.in && printf "" > vlc-config.in

337
# Do the rest
338
339
340
aclocal${amvers} -I m4 || exit 1
autoheader || exit 1

Sam Hocevar's avatar
Sam Hocevar committed
341
automake${amvers} --add-missing --copy
342

343
autoconf || exit 1
344
345

##
Sam Hocevar's avatar
Sam Hocevar committed
346
##  files which need to be regenerated
347
##
Sam Hocevar's avatar
Sam Hocevar committed
348
rm -f vlc-config.in vlc-config
349
350
351
rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
rm -f include/vlc_symbols.h
rm -f mozilla/vlcintf.h
352

353
##
354
##  Shut up
355
##
356
set +x
357

358
##
359
##  Tell the user about gettext, pkg-config and sed
360
##
Sam Hocevar's avatar
Sam Hocevar committed
361
case "${GETTEXT}" in
362
363
364
  yes)
  ;;
  no)
365
366
367
368
369
370
371
    cat << EOF

===========================================================
IMPORTANT NOTE: you do not have gettext installed on your
system. The vlc build will work, but you will not have
internationalization support. We suggest installing gettext.
EOF
372
373
  ;;
  old)
374
375
376
377
    cat << EOF

==========================================================
NOTE: you have an old version of gettext installed on your
378
379
system. The vlc build will work, but if your system does not
have libintl you will not have internationalization support.
380
We suggest upgrading to gettext 0.11.5 or later.
381
EOF
382
383
384
  ;;
esac

385
386
387
388
389
390
391
392
393
394
395
396
397
398
case "$PKGCONFIG" in
  yes)
  ;;
  no)
    cat << EOF

==============================================================
NOTE: you do not have the "pkg-config" utility on your system;
detection of the Gtk-2.0 and GNOME 2.0 libraries will not be
reliable.
EOF
  ;;
esac

399
400
401
402
case "$AUTOMAKESUCKS" in
  no)
  ;;
  yes)
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
    cat << EOF

=============================================================
IMPORTANT NOTE: your version of automake has a bug which will
prevent proper plugin compilation. Either compile VLC with
the --disable-plugins flag, or use a version of automake newer
than 1.6.1 (1.6.2 is OK, and so are the 1.5 series).
EOF
  ;;
esac

case "$INSTALLSUCKS" in
  no)
  ;;
  yes)
    cat << EOF

=============================================================
IMPORTANT NOTE: your version of automake has a bug which will
prevent proper installation. Do not use "make install" with this
version of automake, or use a version of automake newer than 1.5
(such as 1.6 or 1.7).
EOF
426
427
428
  ;;
esac