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

3
##  bootstrap file for the VLC media player
Sam Hocevar's avatar
Sam Hocevar committed
4
##  $Id: bootstrap,v 1.52 2003/06/27 13:50:07 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 71 72 73
rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
# Autogenerated by bootstrap - DO NOT EDIT
EXTRA_DIST = LIST
SUBDIRS = .
DIST_SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
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 94 95 96 97
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 =
SUBDIRS = .
DIST_SUBDIRS = ${subdirs}
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

135
if UNTRUE
Sam Hocevar's avatar
Sam Hocevar committed
136 137 138 139 140 141 142 143 144 145 146
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
147 148
endif

Sam Hocevar's avatar
Sam Hocevar committed
149 150 151 152 153 154 155 156 157 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
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)
190 191

lib${mod}dir = \$(libdir)/vlc/${topdir}
Sam Hocevar's avatar
Sam Hocevar committed
192 193 194 195 196 197 198
${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
199 200 201 202 203 204


EOF
  done
done

Sam Hocevar's avatar
Sam Hocevar committed
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
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
220 221
])
EOF
Sam Hocevar's avatar
Sam Hocevar committed
222
cat m4/private.m4-tmp4 >> m4/private.m4 && rm -f m4/private.m4-tmp4
223 224 225

echo "done."

226
###
227
###  classic bootstrap stuff
228
###
229
set -x
230 231

# remove autotools cruft
232
rm -f aclocal.m4 configure configure.ac.in config.log
233 234 235 236 237 238 239 240
# 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
241
rm -Rf intl
242

243
# Check for gettext
Sam Hocevar's avatar
Sam Hocevar committed
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` \
Sam Hocevar's avatar
Sam Hocevar committed
247
        '>=' 0.11.5 >/dev/null 2>&1; then
248
  # We have gettext, and a recent version! Everything is cool.
249
  autopoint || exit 1
250
  GETTEXT=yes
251
else
252
  # User's gettext is too old. try to continue anyway.
253
  echo > ABOUT-NLS
254
  mkdir -p intl
255
  echo > intl/Makefile.am
Sam Hocevar's avatar
Sam Hocevar committed
256
  cat >> m4/private.m4 << EOF
257 258 259 260
dnl  User's gettext is too old, so this is a no-op
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])

EOF
261 262 263
  GETTEXT=old
fi;else
  # we don't have gettext. grmbl. try to continue anyway.
264
  echo > ABOUT-NLS
265 266
  mkdir -p intl
  echo > intl/Makefile.am
Sam Hocevar's avatar
Sam Hocevar committed
267
  cat >> m4/private.m4 << EOF
268 269 270 271
dnl  User does not have gettext, so this is a no-op
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])

EOF
272
  GETTEXT=no
273
fi
274

275
# Check for pkg-config
Sam Hocevar's avatar
Sam Hocevar committed
276
if pkg-config --version >/dev/null 2>&1; then
277 278 279 280
  # We have pkg-config, everything is cool.
  PKGCONFIG=yes
else
  # Not present, use a workaround.
Sam Hocevar's avatar
Sam Hocevar committed
281
  cat >> m4/private.m4 << EOF
282 283 284 285
dnl  User does not have pkg-config, so this is a no-op
AC_DEFUN([PKG_CHECK_MODULES], [])

EOF
286 287 288
  PKGCONFIG=no
fi

289
# Check for automake
290
amvers="none"
Sam Hocevar's avatar
Sam Hocevar committed
291
if automake-1.7 --version >/dev/null 2>&1; then
292
  amvers="-1.7"
Sam Hocevar's avatar
Sam Hocevar committed
293 294 295 296
  # 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"
297 298
    fi
  fi
Sam Hocevar's avatar
Sam Hocevar committed
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316
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
317 318
fi

Sam Hocevar's avatar
Sam Hocevar committed
319
if test "${amvers}" = "none"; then
320 321
  set +x
  echo "you need automake version 1.5 or later"
322
  exit 1
323
fi
324

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

328
# Do the rest
329 330 331
aclocal${amvers} -I m4 || exit 1
autoheader || exit 1

Sam Hocevar's avatar
Sam Hocevar committed
332
automake${amvers} --add-missing --copy
333

334
autoconf || exit 1
335 336

##
Sam Hocevar's avatar
Sam Hocevar committed
337
##  files which need to be regenerated
338
##
Sam Hocevar's avatar
Sam Hocevar committed
339
rm -f vlc-config.in vlc-config
340 341 342
rm -f src/misc/modules_builtin.h src/misc/modules_plugin.h
rm -f include/vlc_symbols.h
rm -f mozilla/vlcintf.h
343

344
##
345
##  Shut up
346
##
347
set +x
348

349
##
350
##  Tell the user about gettext, pkg-config and sed
351
##
Sam Hocevar's avatar
Sam Hocevar committed
352
case "${GETTEXT}" in
353 354 355
  yes)
  ;;
  no)
356 357 358 359 360 361 362
    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
363 364
  ;;
  old)
365 366 367 368
    cat << EOF

==========================================================
NOTE: you have an old version of gettext installed on your
369 370
system. The vlc build will work, but if your system does not
have libintl you will not have internationalization support.
371
We suggest upgrading to gettext 0.11.5 or later.
372
EOF
373 374 375
  ;;
esac

376 377 378 379 380 381 382 383 384 385 386 387 388 389
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

390 391 392 393
case "$AUTOMAKESUCKS" in
  no)
  ;;
  yes)
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416
    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
417 418 419
  ;;
esac