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