]> git.sesse.net Git - vlc/blob - bootstrap
* ./bootstrap: fixed a shell error (replaced "if `foo`" with "if foo").
[vlc] / bootstrap
1 #! /bin/sh
2
3 ##  bootstrap.sh file for vlc, the VideoLAN Client
4 ##  $Id: bootstrap,v 1.9 2002/08/28 13:38:14 sam Exp $
5 ##
6 ##  Authors: Samuel Hocevar <sam@zoy.org>
7
8 ###
9 ###  get a sane environment
10 ###
11 export LANG=C
12
13 ###
14 ###  argument check
15 ###
16 do_po=no
17 while test $# -gt 0; do
18   case "$1" in
19     --update-po)
20       do_po=yes
21       ;;
22     *)
23       echo "unknown option $1"
24       ;;
25   esac
26   shift
27 done
28
29 ###
30 ###  classic stuff
31 ###
32 set -x
33 rm -f aclocal.m4 configure config.guess config.log config.sub ltmain.sh libtool ltconfig missing mkinstalldirs depcomp install-sh
34
35 # Check for gettext
36 if which gettextize >/dev/null 2>&1
37 then
38 if expr `gettextize --version | sed -e '1s/[^0-9]*//' -e q` \
39         '>' 0.11.3 >/dev/null 2>&1
40 then
41   # We have gettext, and a recent version! Everything is cool.
42   autopoint --force
43   rm -f m4/Makefile.am
44   echo 'EXTRA_DIST = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 lcmessage.m4 progtest.m4' > m4/Makefile.am
45   GETTEXT=yes
46 else
47   # What?! User is not using a recent version of gettext? We'll have to
48   # cheat a bit, then.
49   rm -f po/ChangeLog~
50   aclocaldir=`gettextize --copy --force | grep '^from the' | cut -f3 -d' '`
51   # Yuck!
52   test -f po/ChangeLog~ && mv po/ChangeLog~ po/ChangeLog
53   mkdir -p m4
54   # Yuck! - don't copy anything, it makes old autoconf barf.
55   #for file in codeset.m4 gettext.m4 glibc21.m4 iconv.m4 isc-posix.m4 \
56   #            lcmessage.m4 progtest.m4
57   #  do cp ${aclocaldir}/${file} m4/
58   #done
59   # Yuck!
60   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/gettext.m4
61   GETTEXT=old
62 fi;else
63   # we don't have gettext. grmbl. try to continue anyway.
64   mkdir -p m4
65   echo 'AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])' > m4/gettext.m4
66   echo 'AC_DEFUN([AM_GNU_GETTEXT], [])' >> m4/gettext.m4
67   GETTEXT=no
68 fi
69
70 `which automake-1.6 >/dev/null 2>&1` && amvers=1.6 || amvers=1.5
71 aclocal-${amvers} -I m4
72 autoheader
73 automake-${amvers} --foreign --add-missing --copy
74 autoconf
75
76 # nuahahahahaha !! overwriting Makefile.in with what *I* want!
77 cp Makefile.old Makefile.in
78
79 ##
80 ##  headers which need to be regenerated because of the VLC_EXPORT macro
81 ##
82 file=src/misc/modules_plugin.h
83 rm -f $file
84 sed -e 's#.*\$[I][d]:.*# * Automatically generated from '$file'.in by bootstrap.sh#' < $file.in > $file
85 echo '#define STORE_SYMBOLS( p_symbols ) \' >> $file
86 cat include/*.h | grep '^ *VLC_EXPORT.*;' | \
87        sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    (p_symbols)->\2_inner = \2; \\/' >> $file
88 echo '' >> $file
89
90 file=include/vlc_symbols.h
91 rm -f $file && touch $file
92 echo '/* DO NOT EDIT THIS FILE ! It was generated by bootstrap.sh */' >> $file
93 echo '' >> $file
94 echo 'struct module_symbols_t' >> $file
95 echo '{' >> $file
96 cat include/*.h | grep '^ *VLC_EXPORT.*;' | \
97        sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/    \1 (* \2_inner) \3;/' | sort >> $file
98 echo '};' >> $file
99 echo '' >> $file
100 echo '#ifdef __PLUGIN__' >> $file
101 cat include/*.h | grep '^ *VLC_EXPORT.*;' | \
102        sed -e 's/VLC_EXPORT( *\([^,]*\), *\([^,]*\), *\(.*\));.*/#   define \2 p_symbols->\2_inner/' | sort >> $file
103 echo '#endif /* __PLUGIN__ */' >> $file
104 echo '' >> $file
105
106
107 ##
108 ##  Glade sometimes sucks
109 ##
110 for file in gnome_interface.c gtk_interface.c
111 do
112 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
113 then
114     rm -f /tmp/$$.$file.bak
115     cat > /tmp/$$.$file.bak << EOF
116 /* This file was created automatically by glade and fixed by bootstrap.sh */
117
118 #include <vlc/vlc.h>
119 EOF
120     sed -e 1,7d \
121         -e 's#_("-:--:--")#"-:--:--"#' \
122         -e 's#_("---")#"---"#' \
123         -e 's#_("--")#"--"#' \
124         -e 's#_("/dev/dvd")#"/dev/dvd"#' \
125         -e 's#_(\("./."\))#\1#' \
126         < modules/gui/gtk/$file >> /tmp/$$.$file.bak
127     mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
128 fi
129 done
130
131 file=gtk_support.h
132 if grep "DO NOT EDIT THIS FILE" modules/gui/gtk/$file 2>&1 > /dev/null
133 then
134     rm -f /tmp/$$.$file.bak
135     sed -e 's/DO NOT EDIT THIS FILE.*/This file was created automatically by glade and fixed by bootstrap.sh/ ; s/#if.*ENABLE_NLS.*/#if defined( ENABLE_NLS ) \&\& defined ( HAVE_GETTEXT )/' < modules/gui/gtk/$file > /tmp/$$.$file.bak
136     mv -f /tmp/$$.$file.bak modules/gui/gtk/$file
137 fi
138
139 ##
140 ##  Shut up
141 ##
142 set +x
143
144 ##
145 ##  Update the potfiles because no one ever does it
146 ##
147 if test "$do_po" = "no"
148 then
149   echo "not updating potfiles. use --update-po to force doing it."
150 else
151   cd po
152   make update-po 2>&1 | grep '^[^:]*:$' | cut -f1 -d: | tr '\n' ' ' | sed 's/ $//'
153   cd ..
154 fi
155
156 ##
157 ##  Tell the user about gettext
158 ##
159 case "$GETTEXT" in
160   yes)
161   ;;
162   no)
163     echo ""
164     echo "==========================================================="
165     echo "IMPORTANT NOTE: you do not have gettext installed on your"
166     echo "system. The vlc build will work, but you will not have"
167     echo "internationalization support. We suggest installing gettext."
168   ;;
169   old)
170     echo ""
171     echo "=========================================================="
172     echo "NOTE: you have an old version of gettext installed on your"
173     echo "system. We suggest upgrading to gettext 0.11.3 or later."
174   ;;
175 esac
176