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

3
##  bootstrap file for the VLC media player
4
##
5
## Copyright (C) 2005-2006 the VideoLAN team
6
##
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
7 8
##  Authors: Sam Hocevar <sam@zoy.org>
##           Rémi Denis-Courmont <rem # videolan # org>
9

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

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

25
set -e
26
set -x
27

28
##
29
## Check for various tools
30
##
31 32
AUTOMAKESUCKS=no
INSTALLSUCKS=no
33

34
ACLOCAL_ARGS="-I m4 ${ACLOCAL_ARGS}"
35

36
# Check for contrib directory
37
if test -d extras/contrib/bin; then
38
  export PATH="`pwd`/extras/contrib/bin:$PATH"
39 40 41
  if test -d extras/contrib/share/aclocal; then
    ACLOCAL_ARGS="${ACLOCAL_ARGS} -I extras/contrib/share/aclocal"
  fi
42 43 44 45 46 47 48
  if test ".`uname -s`" = ".Darwin"; then
    export LD_LIBRARY_PATH=./extras/contrib/lib:$LD_LIBRARY_PATH
    export DYLD_LIBRARY_PATH=./extras/contrib/lib:$DYLD_LIBRARY_PATH
  elif test ".`uname -s`" = ".BeOS"; then
    export LIBRARY_PATH=./extras/contrib/lib:$LIBRARY_PATH
    export BELIBRARIES=./extras/contrib/lib:$BELIBRARIES
  fi
49
elif test ".`uname -s`" = ".Darwin"; then
50 51 52 53 54 55 56 57 58 59 60
  set +x
  echo ""
  echo "ERR: Contribs haven't been built"
  echo "ERR: Please run:"
  echo "ERR: "
  echo "ERR:    'cd extras/contrib && ./bootstrap && make && cd ../..'"
  echo "ERR: "
  echo "ERR: Make sure fink has been disabled too."
  echo ""
  set -x
  exit 1
61 62
fi

63 64
# Check for autoconf
rm -f m4/autoconf260.m4
65
case "$(autoconf --version|head -n 1)" in
66 67 68 69 70 71 72 73 74 75 76
  *2.5[012345678]*)
    echo "Hey, your autoconf is quite old. Update it." >&2
    exit 1
    ;;

  *2.59*)
    echo "Enabling provisional autoconf 2.59 work-around. Update autoconf ASAP."
    cp -f extras/m4/autoconf260.m4 m4/
    ;;
esac

77
# Check for automake
78
amvers="no"
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
79
for v in "-1.10" "110" "-1.9" "19"; do
80 81
  if automake${v} --version >/dev/null 2>&1; then
    amsuff="${v}"
82
    amvers="`echo ${v} | sed -e 's/^-//'`"
83
    break
84
  fi
85
done
86

87 88 89
if test "${amvers}" = "no" && automake --version > /dev/null 2>&1; then
  amvers="`automake --version | sed -e '1s/[^0-9]*//' -e q`"
  amsuff=""
90 91
fi

92
case "${amvers}" in
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
93
  no|1.[012345678]|1.[0123456].*|1[0123456]|1.[0123456]-*)
94
    set +x
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
95
    echo "$0: you need automake version 1.9 or later"
96 97 98 99
    exit 1
    ;;
esac

100 101
# Check for libtool
libtoolize="no"
102
if test -x extras/contrib/bin/libtoolize; then
103 104
  libtoolize="extras/contrib/bin/libtoolize"
elif glibtoolize --version >/dev/null 2>&1; then
105 106 107 108 109 110 111 112
  libtoolize="glibtoolize"
elif libtoolize --version >/dev/null 2>&1; then
  libtoolize="libtoolize"
fi

if test "$libtoolize" = "no"; then
  set +x
  echo "$0: you need libtool"
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
  exit 1
fi

# Check for gettext
if gettextize --version >/dev/null 2>&1; then
# Autopoint is available from 0.11.3, but we need 0.11.5
if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
        '>=' 0.11.5 >/dev/null 2>&1; then
  # We have gettext, and a recent version! Everything is cool.
  autopoint=autopoint
  GETTEXT=yes
else
  # User's gettext is too old. try to continue anyway.
  autopoint=:
  GETTEXT=old
fi;else
129 130 131
  set +x
  echo "you need gettextize (package gettext-devel or gettext)"
  exit 1
132 133 134 135 136 137 138 139 140 141
fi

# Check for pkg-config
if pkg-config --version >/dev/null 2>&1; then
  # We have pkg-config, everything is cool.
  PKGCONFIG=yes
else
  PKGCONFIG=no
fi

142 143
aclocal=aclocal${amsuff}
automake=automake${amsuff}
144 145 146
autoconf=autoconf
autoheader=autoheader

147 148 149 150
##
## Generate the modules makefile, by parsing modules/**/Modules.am
##

151
set +x
152
echo "generating modules/**/Makefile.am and m4/private.m4"
153

Sam Hocevar's avatar
Sam Hocevar committed
154
# Prepare m4/private.m4
Sam Hocevar's avatar
Sam Hocevar committed
155
rm -f m4/private.m4 && cat > m4/private.m4 << EOF
156
dnl  Private VLC macros - generated by bootstrap
157 158

EOF
Gildas Bazin's avatar
 
Gildas Bazin committed
159 160

if [ "${PKGCONFIG}" = "no" ]; then cat >> m4/private.m4 << EOF
161 162
dnl  User does not have pkg-config, so assume package was not found
AC_DEFUN([PKG_CHECK_MODULES],[ifelse([\$4], , :, [\$4])])
Gildas Bazin's avatar
 
Gildas Bazin committed
163 164 165 166 167 168 169 170 171 172 173

EOF
fi

if [ "${GETTEXT}" != "yes" ]; then cat >> m4/private.m4 << EOF
dnl  User does not have gettext, so this is a no-op
AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])

EOF
fi

174
cat >> m4/private.m4 << EOF
Sam Hocevar's avatar
Sam Hocevar committed
175
dnl  Helper macro for vlc-config generation
Sam Hocevar's avatar
Sam Hocevar committed
176
AC_DEFUN([VLC_CONFIG_HELPER], [
Sam Hocevar's avatar
Sam Hocevar committed
177 178
  cat >> vlc-config.in << BLAH
EOF
179 180 181

modules=""

Sam Hocevar's avatar
Sam Hocevar committed
182 183 184
rm -f modules/Makefile.am && cat > modules/Makefile.am << EOF
# Autogenerated by bootstrap - DO NOT EDIT
EXTRA_DIST = LIST
185
dist_noinst_SCRIPTS = genmf
Sam Hocevar's avatar
Sam Hocevar committed
186
SUBDIRS = `sed -ne 's,modules/\([^/]*\)/Makefile,\1,p' configure.ac | xargs`
Sam Hocevar's avatar
Sam Hocevar committed
187

188
EOF
189

190
modules/genmf `sed -ne 's,modules/\(.*\)/Makefile,\1,p' configure.ac`
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
191

192
cat >> m4/private.m4 << EOF
Sam Hocevar's avatar
Sam Hocevar committed
193
BLAH
194 195
])
EOF
196

197
###
198
###  classic bootstrap stuff
199
###
200
set -x
201 202

# remove autotools cruft
203
rm -f aclocal.m4 configure config.log config.h config.h.in
204
rm -Rf autom4te*.cache
205 206 207
# remove old autotools extra cruft
rm -f config.guess config.sub missing mkinstalldirs compile depcomp install-sh
# remove new autotools extra cruft
Sam Hocevar's avatar
Sam Hocevar committed
208 209
rm -Rf autotools
mkdir autotools
210 211 212
# remove libtool cruft
rm -f ltmain.sh libtool ltconfig
# remove gettext cruft
213
rm -f ABOUT-NLS
214
rm -Rf intl
215
# remove vlc cruft
Sam Hocevar's avatar
Sam Hocevar committed
216
rm -f stamp-builtin stamp-h* mozilla/stamp-pic
217

218
# Automake complains if these are not present
Sam Hocevar's avatar
Sam Hocevar committed
219
rm -f vlc-config.in && printf "" > vlc-config.in
220 221 222 223 224
if [ "$GETTEXT" != "yes" ]; then
  test -d intl || mkdir intl
  printf "" > intl/Makefile.am
  printf "" > ABOUT-NLS
fi
Sam Hocevar's avatar
Sam Hocevar committed
225

226 227 228 229 230 231 232
# Libtoolize directory
${libtoolize} --copy --force
if test -f "ltmain.sh"; then
  echo "$0: working around a minor libtool issue"
  mv ltmain.sh autotools/
fi

233
# Do the rest
Sam Hocevar's avatar
Sam Hocevar committed
234
${autopoint} -f
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
235
rm -f po/Makevars.template
236
${aclocal} ${ACLOCAL_ARGS}
Sam Hocevar's avatar
Sam Hocevar committed
237 238
${autoconf}
${autoheader}
239
${automake} --add-missing --copy -Wall
240 241

##
Sam Hocevar's avatar
Sam Hocevar committed
242
##  files which need to be regenerated
243
##
Sam Hocevar's avatar
Sam Hocevar committed
244
rm -f vlc-config.in vlc-config
245
rm -f src/misc/modules_builtin.h
246

247
# Shut up
248
set +x
249

250
##
251
##  Tell the user about gettext, pkg-config and sed
252
##
253
if [ "${GETTEXT}" = "old" ]; then
254
  cat << EOF
255 256 257

==========================================================
NOTE: you have an old version of gettext installed on your
258 259
system. The vlc build will work, but if your system does not
have libintl you will not have internationalization support.
260
We suggest upgrading to gettext 0.11.5 or later.
261
EOF
262
fi
263

264
if [ "$PKGCONFIG" = "no" ]; then
265
  cat << EOF
266 267 268 269 270 271

==============================================================
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
272
fi
273