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