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