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