Release 941227
[wine] / Configure
1 #! /bin/sh
2 #
3 # Configure script for wine
4
5 : ${EDITOR:=vi}
6 : ${PAGER:=more}
7
8 WINELIB=''
9 SHORTNAMES=''
10 XPM=''
11 LANG=not_matching
12 NEWBUILD=''
13 ALLDEFINES=''
14
15 # Ask question 'str' and set 'var' to reply (defaulting to 'def' on CR)
16 prompt ()
17 {
18         str="$1"
19         var="$2"
20         def="$3"
21
22         eval $var='$def'
23         echo
24         echo -n "$str [$def]? "
25         input=`head -1`  #  When using read, user must double all backslashes
26         if [ -n "$input" ]
27         then
28                 eval $var='$input'
29         fi
30 }
31
32 echo -n 'Build Wine as emulator or library (E/L) [E]? '
33 read input
34 if [ "$input" = 'l' -o "$input" = 'L' ]
35 then
36         WINELIB='#define WINELIB -DWINELIB'
37         ALLDEFINES="$ALLDEFINES -DWINELIB"
38 fi
39
40 echo
41 echo -n 'Short filenames (Y/N) [N]? '
42 read input
43 if [ "$input" = 'y' -o "$input" = 'Y' ]
44 then
45         SHORTNAMES='#define ShortNames -DSHORTNAMES'
46         ALLDEFINES="$ALLDEFINES -DSHORTNAMES"
47 fi
48
49 echo
50 echo -n 'Use the XPM library (Y/N) [N]? '
51 read input
52 if [ "$input" = 'y' -o "$input" = 'Y' ]
53 then
54         XPM='#define USE_XPM'
55         ALLDEFINES="$ALLDEFINES -DUSE_XPM"
56 fi
57
58 LANGS=`echo En rc/sysres_*.rc | sed -e 's/rc\/sysres_//g' -e 's/\.rc//g' -e 's/ /\//g;'`
59 while   expr "$LANGS" : ".*$LANG" = 0 > /dev/null
60 do
61         prompt "Language ($LANGS)" LANG En
62         if      expr "$LANGS" : ".*$LANG" = 0 > /dev/null
63         then
64                 echo "\"$LANG\" is not a supported language."
65         fi
66 done
67 ALLDEFINES="$ALLDEFINES -ALANG\($LANG\)"
68
69 if [ "`(domainname)`" = 'amscons.com' ]
70 then
71         echo
72         echo -n 'New build program (Y/N) [N]? '
73         read input
74         if [ "$input" = 'y' -o "$input" = 'Y' ]
75         then
76                 NEWBUILD='#define NewBuild -DNEWBUILD'
77                 ALLDEFINES="$ALLDEFINES -DNEWBUILD"
78         fi
79 fi
80
81 prompt "Global configfile name" WINE_CONFIGFILE /usr/local/etc/wine.conf
82
83 if [ -r $WINE_CONFIGFILE ]
84 then
85         DEFAULT_ANS=N
86 else
87         DEFAULT_ANS=Y
88 fi
89
90 echo
91 echo -n "Do you want to make a config file now (Y/N) [$DEFAULT_ANS]? "
92 read input
93 if [ "$input" = '' ]
94 then
95         input="$DEFAULT_ANS"
96 fi
97 if [ "$input" = 'y' -o "$input" = 'Y' ]
98 then
99         if [ -r $WINE_CONFIGFILE ]
100         then
101                 echo "Backing up the old file to ${WINE_CONFIGFILE}.old."
102                 if cp $WINE_CONFIGFILE ${WINE_CONFIGFILE}.old
103                 then    :
104                 else
105                         echo "Error while creating backup file.  Fix it and run Configure again"
106                         exit 1
107                 fi
108         fi
109
110         CF_A=`mount | awk '/^\/dev\/fd/ {print $3;exit} END {print "/a"}'`
111         prompt "Which directory do you want to use as A:" CF_A $CF_A
112         CF_C=`awk '{if ($3=="msdos") {print $2;exit}} END {print "/c"}' /etc/fstab`
113         prompt "Which directory do you want to use as C:" CF_C $CF_C
114         prompt "Where is the Windows directory" CF_Windows 'c:\windows'
115         prompt "Where is the System directory" CF_System 'c:\windows\system'
116         if [ -r "$CF_C/autoexec.bat" ]
117         then
118                 CF_Temp=`tr A-Z a-z < "$CF_C/autoexec.batX" | sed -n 's/^ *set *temp= *\(c:.*[a-z]\).*/\1/p'`
119         fi
120         if [ -z "$CF_Temp" ]
121         then
122                 CF_Temp='c:\temp'
123         fi
124         prompt "Where should Windows apps store temp files" CF_Temp $CF_Temp
125         prompt "Which path should be used to find progs/DLL's" CF_Path "$CF_Windows;$CF_System"
126         prompt "Where is sysres.dll" CF_SystemResources `pwd`/sysres.dll
127         prompt "Where is COM1" CF_Com1 '/dev/cua0'
128         prompt "Where is COM2" CF_Com2 '/dev/cua1'
129         prompt "Where is LPT1" CF_Lpt1 '/dev/lp0'
130         prompt "Log messages to which file (CON = stdout)" CF_File 'CON'
131
132         echo
133         sed -n -e 's/^ *\"\(WM_[A-Z0-9]*\)\".*/\1/p' < misc/spy.c | \
134                 sort | pr -ta4w83 | sed '1 i\
135 Here is the list of messages:\
136 \
137 ' | $PAGER
138
139         prompt "Exclude which messages from the log" CF_Exclude 'WM_SIZE;WM_TIMER'
140
141         cat >  $WINE_CONFIGFILE << EOF
142 [drives]
143 A=$CF_A
144 C=$CF_C
145
146 [wine]
147 Windows=$CF_Windows
148 System=$CF_System
149 Temp=$CF_Temp
150 Path=$CF_Path
151 SystemResources=$CF_SystemResources
152
153 [fonts]
154 system=*-helvetica
155 mssansserif=*-helvetica
156 msserif=*-times
157 fixedsys=*-fixed
158 arial=*-helvetica
159 helv=*-helvetica
160 roman=*-times
161 default=*-*
162
163 [serialports]
164 Com1=$CF_Com1
165 Com2=$CF_Com2
166
167 [parallelports]
168 Lpt1=$CF_Lpt1
169
170 [spy]
171 File=$CF_File
172 Exclude=$CF_Exclude
173 EOF
174
175         echo
176         sed '1 i\
177 The config file '"$WINE_CONFIGFILE"' now looks like this:\
178 \
179 ' < $WINE_CONFIGFILE | $PAGER
180
181         echo
182         echo -n "Do you want to edit it using $EDITOR (Y/N) [N]? "
183         read input
184         if [ "$input" = 'y' -o "$input" = 'Y' ]
185         then
186                 $EDITOR $WINE_CONFIGFILE
187         fi
188 else
189         if [ ! -r $WINE_CONFIGFILE ]
190         then
191                 echo 'Ok, remember to make it yourself later.'
192         fi
193 fi
194
195 if grep -s seg_not_present /usr/include/linux/ldt.h 2> /dev/null
196 then
197         ALLDEFINES="$ALLDEFINES -DNEW_LDT_STRUCT"
198 fi
199
200 cat > autoconf.h << EOF
201 /* autoconf.h generated automatically.  Run Configure. */
202 $WINELIB
203 $SHORTNAMES
204 $XPM
205 $NEWBUILD
206 #define WINE_INI_GLOBAL "$WINE_CONFIGFILE"
207 #define AutoDefines $ALLDEFINES
208 EOF
209
210 echo
211 echo "Creating Makefiles.  This may take a while."
212 if xmkmf -a
213 then :
214 else    cat << EOF
215
216 WARNING:  The exit status of the command 'xmkmf -a' indicates an error.
217 Maybe the Wine directory is incomplete, or Imake (see 'man xmkmf imake')
218 is incorrectly configured?  In the latter case, it might be easiest to
219 reinstall X11 to get a new copy of Imake.
220 EOF
221 fi
222
223 if [ 0 -lt `find . -name "*.rej" -print | wc -l` ]
224 then
225         cat << EOF
226
227 WARNING:  You have some files named '*.rej', which usually indicates
228 rejected patch files.  Maybe you tried to upgrade Wine with 'patch',
229 and that some of the patches failed?  If something doesn't work, this
230 might be the reason.  See 'man patch' (especially the '-p' option).
231
232 List of "*.rej" files:
233
234 EOF
235         find . -name "*.rej" -print
236 fi
237
238 if [ -f ./Makefile ]
239 then
240         echo
241         echo "Configure finished.  Do 'make' to compile Wine."
242 else
243         echo
244         echo "*** There was a problem with 'imake': the main Makefile has not be created."
245 fi