forked from Laidout/laxkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·358 lines (305 loc) · 9.88 KB
/
configure
File metadata and controls
executable file
·358 lines (305 loc) · 9.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
#!/bin/bash
#
##
## Laxkit configure
##
#
#
# --help
# --prefix=/blah/blah
LAXKITVERSION=0.0.8.1
LAXKITCONFIGDIRBASE="~/.laxkit"
#LAXKITCONFIGDIR="$LAXKITCONFIGDIRBASE/$LAXKITVERSION"
PREFIX="/usr/local"
#---capabilities
EXTRAS=
OPTIONAL=
OPTIONALLIBS=
USEXLIB="yes"
USEIMLIB="yes"
USECAIRO="yes"
USEXINPUT2="yes"
USEGL="yes"
USESQLITE="yes"
LAXKITBACKEND="cairo"
ONAMAC="no"
PLATFORM="linux"
FORCE="no"
if [ ! -e /usr/include/X11/extensions/XInput2.h ] ; then unset USEXINPUT2; fi
##
## Parse options
##
while true ; do
ARG=$1;
if [ x$ARG == x ] ; then break; fi
option=`expr "x$ARG" : 'x\([^=]*\)=.*'`;
if [ x$option == x ] ; then
option="$ARG";
fi
optarg=`expr "x$ARG" : 'x[^=]*=\(.*\)'`;
#echo "option=$option, optarg=$optarg"
case "$option" in
-h | --help)
echo "Whizbang Laxkit configuration script options."
# echo "Please note that at least one of Imlib2 or Cairo must be used. Both"
# echo "are built by default."
echo ""
echo " --help Show this stuff"
echo " --prefix=/where/to/install Default /usr/local"
echo " --configdir=/path/to/config Default ~/.laxkit/(version)"
# echo " --disable-gl Do not build opengl components. Default is to built them."
echo " --disable-imlib Do not build Imlib2 components. Default is to built them."
echo " --disable-cairo Do not build cairo components. Default is to built them."
echo " --disable-xinput2 Use this option if you do not have at least Xorg 7.5 for MPX."
echo " --disable-sqlite Optional. Used to get font tags in Fontmatrix database (if it exists)"
echo " --backend=cairo Use xlib or cairo. cairo is more capable."
echo " --platform=linux Only linux is implemented. Someday mac or windows."
# echo " --onamac Include this if you are compiling on a Mac."
echo " --force Try to compile even when libraries are not detected by ./configure"
echo " --version=OtherVersionNum You may force Laxkit to compile with a different"
echo " version string."
echo ""
exit 1 ;;
--force)
FORCE="yes"
shift ;;
--onamac)
ONAMAC="yes"
shift ;;
--disable-gl)
unset USEGL
shift;;
--disable-imlib)
unset USEIMLIB
shift;;
--disable-cairo)
unset USECAIRO
shift;;
--disable-xinput2)
unset USEXINPUT2
shift;;
--disable-sqlite)
unset USESQLITE
shift;;
-p | --prefix)
if [ -z $optarg ] ; then
optarg=$2
shift
fi
PREFIX="$optarg"
#echo prefix $optarg ;
shift ;;
--configdir)
if [ -z $optarg ] ; then
optarg=$2
shift
fi
LAXKITCONFIGDIR="$optarg"
shift ;;
--backend | -b)
if [ -z $optarg ] ; then
optarg=$2
shift
fi
LAXKITBACKEND="$optarg"
#echo version $optarg ;
shift ;;
--platform | -P)
if [ -z $optarg ] ; then
optarg=$2
shift
fi
PLATFORM="$optarg"
#echo version $optarg ;
shift ;;
--version | -v)
if [ -z $optarg ] ; then
optarg=$2
shift
fi
LAXKITVERSION="$optarg"
#echo version $optarg ;
shift ;;
*) echo "Unrecognized option $option $optarg" ; exit 1 ;;
esac
done
#if [[ $PLATFORM != "linux" && $PLATFORM != "mac" && $PLATFORM != "windows" ]] ;
# PLATFORM="linux";
#fi;
PLATFORM="linux";
#if [ x$USEGL != x ] ; then EXTRAS="$EXTRAS -DLAX_USES_GL"; fi
#if [ x$USEIMLIB != x ] ; then EXTRAS="$EXTRAS -DLAX_USES_IMLIB"; fi
#if [ x$USECAIRO != x ] ; then EXTRAS="$EXTRAS -DLAX_USES_CAIRO"; fi
#if [ x$USEXINPUT2 != x ] ; then EXTRAS="$EXTRAS -DLAX_USES_XINPUT2"; fi
if [ x$USEIMLIB$USECAIRO == x ] ;
then echo "You must use at least one of Imlib or Cairo.";
exit 1;
fi
if [ x$LAXKITCONFIGDIR == x ] ; then
LAXKITCONFIGDIR="$LAXKITCONFIGDIRBASE/$LAXKITVERSION"
fi
LAXDIR="$PREFIX/include/lax"
# do check for required libraries:
# NEEDED libX11.so.6
# NEEDED libpng12.so.0
# NEEDED libcups.so.2
# NEEDED libImlib2.so.1
# NEEDED libfreetype.so.6
# NEEDED libz.so.1
# NEEDED libXext.so.6
## The stuff in NEED can be checked with pkg-config. Not all libraries
## can be checked this way! (notably cups, apparently)
#NEED='x11 cupsys freetype2 imlib2 xext'
NEED='x11 freetype2 harfbuzz'
if [ x$USEIMLIB != x ] ; then NEED="$NEED imlib2"; fi
if [ x$USECAIRO != x ] ; then NEED="$NEED cairo"; fi
NUM='1'
for NAME in $NEED; do
echo -n Checking for $NAME......;
if [ "`pkg-config --exists --print-errors --errors-to-stdout $NAME`"xxx != "xxx" ] ; then
echo "You need to install the development package of $NAME.";
NUM="";
else
echo "ok";
fi
done
#echo NUM=$NUM
OPTIONAL='sqlite3'
for NAME in $OPTIONAL; do
echo -n Checking for $NAME......;
if [ "`pkg-config --exists --print-errors --errors-to-stdout $NAME`"xxx != "xxx" ] ; then
if [ $NAME == 'sqlite3' ] ; then
echo "Didn't find $NAME. Install that to get access to Fontmatrix tags.";
else
echo "Couldn't find optional $NAME. Skipping.";
fi
else
OPTIONALLIBS="$OPTIONALLIBS $NAME"
echo "ok";
fi
done
## cups doesn't seem to have a pkg-config entry, so do this hackier check
echo -n Checking for cups......;
if [ ! -e /usr/include/cups ] ; then
echo "You need to install the development package of Cups.";
NUM="";
else echo "ok";
fi
echo
if [ "$NUM" != "1" -a $FORCE=="no" ]; then
echo "Too many problems to proceed! Use --force to override."
exit 1
fi
##
## generate lax/version.h
##
echo "Generating lax/version.h..."
echo " // ---- THIS FILE IS AUTOMATICALLY GENERATED -----" > lax/version.h
echo " // ---- BY ../configure -----" >> lax/version.h
echo "#ifndef _LAX_VERSION_H" >> lax/version.h
echo "#define _LAX_VERSION_H" >> lax/version.h
echo "" >> lax/version.h
echo "#define LAXKIT_VERSION \"$LAXKITVERSION\"" >> lax/version.h
echo "" >> lax/version.h
echo "#endif" >> lax/version.h
echo "" >> lax/version.h
##
## generate lax/configured.h by putting install_prefix where the code can access it!
##
echo "Generating lax/configured.h..."
echo " // ---- THIS FILE IS AUTOMATICALLY GENERATED -----" > lax/configured.h
echo " // ---- BY ../configure -----" >> lax/configured.h
echo "#ifndef _LAX_CONFIGURED_H" >> lax/configured.h
echo "#define _LAX_CONFIGURED_H" >> lax/configured.h
echo "" >> lax/configured.h
echo "#define LAX_INSTALL_PREFIX \"$PREFIX\"" >> lax/configured.h
echo "#define LAX_SHARED_DIRECTORY \"$PREFIX/share/laxkit/$LAXKITVERSION/\"" >> lax/configured.h
echo "#define LAX_CONFIG_DIRECTORY \"$LAXKITCONFIGDIR\"" >> lax/configured.h
echo "" >> lax/configured.h
echo "#define _LAX_PLATFORM_XLIB" >> lax/configured.h
echo "#define LAX_DEFAULT_BACKEND \"$LAXKITBACKEND\"" >> lax/configured.h
if [ x$USEGL != x ] ; then echo "#define LAX_USES_GL" >> lax/configured.h; fi
if [ x$USEXLIB != x ] ; then echo "#define LAX_USES_XLIB" >> lax/configured.h; fi
if [ x$USEXINPUT2 != x ] ; then echo "#define LAX_USES_XINPUT2" >> lax/configured.h; fi
if [ x$USEIMLIB != x ] ; then echo "#define LAX_USES_IMLIB" >> lax/configured.h; fi
if [ x$USECAIRO != x ] ; then echo "#define LAX_USES_CAIRO" >> lax/configured.h; fi
if [ x$USESQLITE != x ] ; then echo "#define LAX_USES_SQLITE" >> lax/configured.h; fi
echo "" >> lax/configured.h
echo "#endif" >> lax/configured.h
echo "" >> lax/configured.h
##
## generate Makefile-toinclude
##
echo "Generating ./Makefile-toinclude..."
echo " # ---- THIS FILE IS AUTOMATICALLY GENERATED -----" > Makefile-toinclude
echo " # ---- BY ./configure -----" >> Makefile-toinclude
echo "" >> Makefile-toinclude
echo "PREFIX=$PREFIX" >> Makefile-toinclude
echo "LAXKITVERSION=$LAXKITVERSION" >> Makefile-toinclude
echo "EXTRAS=$EXTRAS" >> Makefile-toinclude
echo "OPTIONALLIBS=$OPTIONALLIBS" >> Makefile-toinclude
if [ x$USESQLITE != x ] ; then echo "LAX_USES_SQLITE=yes" >> Makefile-toinclude; fi
echo "" >> Makefile-toinclude
##
## write out config.log
##
echo \
" Configuration Summary
" `date` "
----------------------------------
Laxkit version: $LAXKITVERSION
Lax Config dir: $LAXKITCONFIGDIR
Install here: $PREFIX
" >> config.log
if [ x$USEXINPUT2 != x ] ;
then echo " Use XInput2: yes" >> config.log;
else echo " Use XInput2: no" >> config.log;
fi
if [ x$USEIMLIB != x ] ;
then echo " Use Imlib2: yes" >> config.log;
else echo " Use Imlib2: no" >> config.log;
fi
if [ x$USECAIRO != x ] ;
then echo " Use Cairo: yes" >> config.log;
else echo " Use Cairo: no" >> config.log;
fi
if [ x$USEGL != x ] ;
then echo " Use GL: yes" >> config.log;
else echo " Use GL: no" >> config.log;
fi
if [ x$USESQLITE != x ] ;
then echo " Use Sqlite: yes" >> config.log;
else echo " Use Sqlite: no" >> config.log;
fi
echo " Default backend: $LAXKITBACKEND" >> config.log
#echo " Platform: $PLATFORM" >> config.log
echo
echo " Configuration Summary"
echo " " `date`
echo "----------------------------------"
echo " Laxkit version: $LAXKITVERSION"
echo " Lax Config dir: $LAXKITCONFIGDIR"
echo " Install here: $PREFIX"
if [ x$USEXINPUT2 != x ] ;
then echo " Use XInput2: yes";
else echo " Use XInput2: no";
fi
if [ x$USEIMLIB != x ] ;
then echo " Use Imlib2: yes";
else echo " Use Imlib2: no";
fi
if [ x$USECAIRO != x ] ;
then echo " Use Cairo: yes";
else echo " Use Cairo: no";
fi
if [ x$USEGL != x ] ;
then echo " Use GL: yes";
else echo " Use GL: no";
fi
if [ x$USESQLITE != x ] ;
then echo " Use Sqlite: yes";
else echo " Use Sqlite: no" ;
fi
echo " Default backend: $LAXKITBACKEND"
echo
echo "Now type make to build.";