Fixed a couple of config.cache problems.
[wine] / tools / wineinstall
1 #!/bin/bash
2 # WINE Installation script
3
4 # Mar 31 1999 - Ove Kåven
5 #  First version
6 # Dec 9 1999 - Ove Kåven
7 #  require Xpm
8 # Feb 25 2000 - Ove Kåven
9 #  auto-add /usr/local/lib to /etc/ld.so.conf
10 # Mar 2 2000 - Ove Kåven
11 #  source rather than grep config.cache
12 #  use sourced config.cache to start ldconfig
13 #  reconfigure if config.cache doesn't exist
14
15 # defaults
16
17 sysconfdir=/usr/local/etc
18 DOCONF=auto
19 DOREG=yes
20
21 # startup...
22
23 echo "WINE Installer v0.2"
24 echo
25 if ! [ -f configure ]
26 then {
27   echo "You're running this from the wrong directory."
28   echo "Change to the Wine directory and try again."
29   exit 1
30 }
31 fi
32
33 # run the configure script, if necessary
34
35 if [ -f config.cache ] && [ -f Makefile ] && [ Makefile -nt configure ]
36 then {
37   echo "I see that WINE has already been configured, so I'll skip that."
38   # load configure results
39   . ./config.cache
40 }
41 else {
42   # we'll run with defaults (we need libwine.a later)
43   echo "Running configure..."
44   echo
45   if ! ./configure
46   then {
47     echo
48     echo "Configure failed, aborting install."
49     rm -f config.cache
50     exit 1
51   }
52   fi
53   # load configure results
54   . ./config.cache
55   # make sure X was found
56   eval "$ac_cv_have_x"
57   if [ "$have_x" != "yes" ]
58   then {
59     echo "Install the X development headers and try again."
60     rm -f config.cache
61     exit 1
62   }
63   elif [ "$ac_cv_header_X11_xpm_h" != "yes" ]
64   then {
65     echo "Install the Xpm development headers and try again."
66     rm -f config.cache
67     exit 1
68   }
69   fi
70 }
71 fi
72
73 # now do the compilation
74
75 if [ -f wine ] && [ wine -nt Makefile ]
76 then {
77   echo "Hmm, looks like WINE is already compiled. I'll skip that too, I guess."
78 }
79 else {
80   echo "Compiling WINE. Grab a lunch or two, rent a video, or whatever, in the meantime..."
81   echo
82   if ! { make depend && make; }
83   then {
84     echo
85     echo "Compilation failed, aborting install."
86     exit 1
87   }
88   fi
89   echo
90 }
91 fi
92
93 # and installation, if root
94
95 if [ `whoami` != 'root' ]
96 then {
97   echo "You aren't root, so I'll skip the make install."
98 }
99 else {
100   echo "Now installing binaries onto the system..."
101   echo
102   if ! make install
103   then {
104     echo
105     echo "Installation failed, aborting."
106     exit 1
107   }
108   fi
109   if [ -f /etc/ld.so.conf ] && ! grep -qs "/usr/local/lib" /etc/ld.so.conf
110   then {
111     echo
112     echo "/usr/local/lib didn't exist in your /etc/ld.so.conf, adding it now..."
113     echo /usr/local/lib >>/etc/ld.so.conf
114     echo "Re-running ldconfig..."
115     eval "$ac_cv_path_LDCONFIG"
116   }
117   fi
118 }
119 fi
120 echo
121
122 # now check whether we should generate wine.conf
123 if [ -z "$DOCONF" ]
124 then DOCONF=auto
125 fi
126
127 if [ "$DOCONF" = 'auto' ]
128 then {
129   # see if we already have a system wine.conf
130   if [ -f $sysconfdir/wine.conf ] || [ -f /etc/wine.conf ]
131   then DOCONF=no
132   fi
133 }
134 fi
135
136 if [ "$DOCONF" != 'no' ]
137 then {
138   if [ `whoami` != 'root' ]
139   then {
140     CONF=~/.winerc
141     if ! [ -f $CONF ]
142     then {
143       if [ "$DOCONF" != 'yes' ]
144       then {
145         echo "Since you aren't root, and there's no system wine.conf, I assume"
146         echo "you want a user-specific .winerc. Am I correct? (yes/no)"
147         while [ "$DOCONF" != 'yes' ] && [ "$DOCONF" != 'no' ]
148         do read DOCONF
149         done
150       }
151       fi
152       if [ "$DOCONF" = 'no' ]
153       then echo "Skipping generation of .winerc."
154       fi
155     }
156     fi
157   }
158   else {
159     CONF=$sysconfdir/wine.conf
160     mkdir -p $sysconfdir
161     DOCONF=yes
162   }
163   fi
164 }
165 fi
166
167 if [ "$DOCONF" = 'yes' ]
168 then {
169   echo "Now automatically generating $CONF for you..."
170   echo
171   tools/wineconf > $CONF
172   echo
173   echo "Done. You probably want to review the file, though."
174 }
175 fi
176 echo
177
178 # install default registry entries
179 if [ "$DOREG" = 'yes' ]
180 then {
181   echo "Compiling regapi..."
182   echo
183   (cd programs/regapi; make)
184   echo
185   echo "Installing default registry entries, please wait..."
186   echo
187   if ! programs/regapi/regapi setValue < winedefault.reg
188   then {
189     echo
190     echo "Registry install failed. Perhaps you weren't running X."
191     exit 1
192   }
193   fi
194   # FIXME: perhaps install registry to $sysconfdir/winesystem.reg and $sysconfdir/wineuser.reg?
195 }
196 fi
197 echo
198 echo "Installation complete for now. Good luck (this is still alpha software)."
199 echo "If you have problems with WINE, please read the documentation first."