Release 941107
[wine] / Configure
1 #! /bin/sh
2 #
3 # Configure script for wine
4
5 : ${EDITOR:=vi}
6 : ${PAGER:=more}
7
8 ALLDEFINES=''
9
10 # Ask question 'str' and sets 'var' reply (defaulting to 'def' on CR)
11 prompt ()
12 {
13         str="$1"
14         var="$2"
15         def="$3"
16
17         eval $var='$def'
18         echo
19         echo -n "$str [$def]? "
20         input=`head -1`  #  When using read, user must double all backslashes
21         if [ -n "$input" ]
22         then
23                 eval $var='$input'
24         fi
25 }
26
27 echo -n 'Build Wine as emulator or library (E/L) [E]? '
28 read input
29 if [ "$input" = 'l' -o "$input" = 'L' ]
30 then
31         WINELIB='#define WINELIB -DWINELIB'
32         ALLDEFINES="$ALLDEFINES -DWINELIB"
33 else
34         WINELIB=''
35
36 #       Commented out until the processor emulator starts to work.
37 #
38 #       echo
39 #       echo -n 'Use processor emulator (*DOES*NOT*WORK*YET*) (Y/N) [N]? '
40 #       read input
41 #       if [ "$input" = 'y' -o "$input" = 'Y' ]
42 #       then
43 #               PROCEMU='#define PROCEMU'
44 #               ALLDEFINES="$ALLDEFINES -DPROCEMU"
45 #               echo
46 #               echo -n 'bochs directory [/usr/src/bochs]? '
47 #               read input
48 #               if [ "$input" = '' ]
49 #               then
50 #                       ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR=/usr/src/bochs"
51 #               else
52 #                       ALLDEFINES="$ALLDEFINES -DPROC_EMU_DIR="$input
53 #               fi
54 #       fi
55
56 fi
57
58 echo
59 echo -n 'Short filenames (Y/N) [N]? '
60 read input
61 if [ "$input" = 'y' -o "$input" = 'Y' ]
62 then
63         SHORTNAMES='#define ShortNames -DSHORTNAMES'
64         ALLDEFINES="$ALLDEFINES -DSHORTNAMES"
65 else
66         SHORTNAMES=''
67 fi
68
69 echo
70 echo -n 'Use the XPM library (Y/N) [N]? '
71 read input
72 if [ "$input" = 'y' -o "$input" = 'Y' ]
73 then
74         XPM='#define USE_XPM'
75         ALLDEFINES="$ALLDEFINES -DUSE_XPM"
76 else
77         XPM=''
78 fi
79
80 prompt "Global configfile name" WINE_CONFIGFILE /usr/local/etc/wine.conf
81
82 WINE_INI_GLOBAL='#define WINE_INI_GLOBAL "'$WINE_CONFIGFILE'"'
83
84 if [ -r $WINE_CONFIGFILE ]
85 then
86         DEFAULT_ANS=N
87 else
88         DEFAULT_ANS=Y
89 fi
90
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"
97 fi
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
108                 fi
109         fi
110
111         case `awk 'BEGIN {s=0} {if ($3=="msdos") s++} END {print s}' /etc/fstab` in
112         0)      CF_C=/c;;
113         1)      CF_C=`awk '{if ($3=="msdos") print $2}' /etc/fstab`;;
114         *)      CF_C=`awk '{if ($3=="msdos") {print $2;exit}}' /etc/fstab`;;
115         esac
116
117         prompt "Which directory do you want to use as A:" CF_A /a
118         prompt "Which directory do you want to use as C:" CF_C $CF_C
119         prompt "Where is the Windows directory" CF_Windows 'c:\windows'
120         prompt "Where is the System directory" CF_System 'c:\windows\system'
121         prompt "Where should Windows apps store temp files" CF_Temp 'c:\temp'
122         prompt "Which path should be used to find executables and DLL's" CF_Path 'c:\windows;c:\windows\system'
123         prompt "Where is sysres.dll" CF_SystemResources `pwd`/sysres.dll
124         prompt "Where is COM1" CF_Com1 '/dev/cua0'
125         prompt "Where is COM2" CF_Com2 '/dev/cua1'
126         prompt "Where is LPT1" CF_Lpt1 '/dev/lp0'
127         prompt "Log messages to which file (CON = stdout)" CF_File 'CON'
128
129         echo
130         sed -n -e 's/^ *\"\(WM_[A-Z0-9]*\)\".*/\1/p' < misc/spy.c | \
131                 sort | pr -ta4w83 | sed '1 i\
132 Here is the list of messages:\
133 \
134 ' | $PAGER
135
136         prompt "Exclude which messages from the log" CF_Exclude 'WM_SIZE;WM_TIMER'
137
138         echo
139         echo "The config file $WINE_CONFIGFILE now looks like this:"
140         tee $WINE_CONFIGFILE << EOF
141 [drives]
142 A=$CF_A
143 C=$CF_C
144
145 [wine]
146 Windows=$CF_Windows
147 System=$CF_System
148 Temp=$CF_Temp
149 Path=$CF_Path
150 SystemResources=$CF_SystemResources
151
152 [serialports]
153 Com1=$CF_Com1
154 Com2=$CF_Com2
155
156 [parallelports]
157 Lpt1=$CF_Lpt1
158
159 [spy]
160 File=$CF_File
161 Exclude=$CF_Exclude
162 EOF
163
164         echo
165         echo -n "Do you want to edit it using $EDITOR (Y/N) [N]? "
166         read input
167         if [ "$input" = 'y' -o "$input" = 'Y' ]
168         then
169                 $EDITOR $WINE_CONFIGFILE
170         fi
171 else
172         if [ ! -r $WINE_CONFIGFILE ]
173         then
174                 echo 'Ok, remember to make it yourself later.'
175         fi
176 fi
177
178 NEWBUILD=''
179 if [ "`(domainname)`" = 'amscons.com' ]
180 then
181     echo
182     echo -n 'New build program (Y/N) [N]? '
183     read input
184     if [ "$input" = 'y' -o "$input" = 'Y' ]
185     then
186         NEWBUILD='#define NewBuild -DNEWBUILD'
187         ALLDEFINES="$ALLDEFINES -DNEWBUILD"
188     fi
189 fi
190
191 NEWLINUXLDT=''
192 if grep -s seg_not_present /usr/include/linux/ldt.h 2> /dev/null
193 then
194         ALLDEFINES="$ALLDEFINES -DNEW_LDT_STRUCT"
195 fi
196
197 cat > autoconf.h << EOF
198 /* autoconf.h generated automatically.  Run Configure. */
199 $WINELIB
200 $SHORTNAMES
201 $XPM
202 $NEWBUILD
203 $WINE_INI_GLOBAL
204 $ENDIAN
205 $PROCEMUDIR
206 #define AutoDefines $ALLDEFINES
207 EOF
208
209 xmkmf -a
210
211 if [ 0 -lt `find . -name "*.rej" -print | wc -l` ]
212 then
213         cat << EOF
214
215 WARNING:  You have some files named "*.rej".  Rejected patch files?
216 Maybe you tried to upgrade Wine by diff-files, and that patch failed.
217 If something doesn't work, this might be the reason.  See "man patch".
218
219 List of "*.rej" files:
220
221 EOF
222         find . -name "*.rej" -print
223         echo
224 fi