-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·501 lines (412 loc) · 14.6 KB
/
configure
File metadata and controls
executable file
·501 lines (412 loc) · 14.6 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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
#!/bin/bash
#
##
## Laxkit configure
##
#
# This creates these files:
# config.log
# laxkit.pc
# lax/version.h
# lax/configured.h
# Makefile-toinclude
#
# --help
# --prefix=/blah/blah
LAXKITVERSION=0.0.8.1
LAXKITCONFIGDIRBASE="~/.config/laxkit"
#LAXKITCONFIGDIR="$LAXKITCONFIGDIRBASE/$LAXKITVERSION"
PREFIX="/usr/local"
#---capabilities
#user provided:
EXTRA_CPPFLAGS=
#automatically generated:
EXTRA_CFLAGS=
EXTRA_LIBS=
OPTIONAL=
OPTIONALLIBS=
#USE_XLIB_RENDER (previously USEXLIB) to compile functions for the xlib rendering backend
USE_XLIB_RENDER="no"
USECAIRO="yes"
USEIMLIB="not build"
USEGRAPHICSMAGICK="build"
USEXINPUT2="yes"
USEGL="yes"
USESQLITE="yes"
HARFBUZZVERSION="2.0"
ONAMAC="no"
FORCE="no"
RELOCATABLE="no"
MAKE_LAXKIT_PC="yes"
LAXKIT_PC_LIBS=""
CONFIGCOMMAND="./configure $@"
#x11, or (unimplemented): qt, headless, wayland
PLATFORM="x11"
LAXKITBACKEND="cairo"
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 ""
echo " --help Show this stuff"
echo " --prefix=/where/to/install Defaults to $PREFIX"
echo " --configdir=/path/to/config Defaults to $LAXKITCONFIGDIRBASE/$LAXKITVERSION"
echo " --platform=x11 Only x11 is implemented. Todo: headless or wayland."
# echo " --disable-gl Do not build opengl components. Default is to built them."
echo " --disable-graphicsmagick Do not build GraphicsMagick components. Default is to $USEGRAPHICSMAGICK them."
echo " --enable-graphicsmagick Build GraphicsMagick components. Default is to $USEGRAPHICSMAGICK them."
# echo " --disable-cairo Do not build cairo components. Default is to build them."
# echo " --disable-xinput2 Use this option if you do not have at least Xorg 7.5 for MPX."
echo " --disable-sqlite If not disabled, sqlite is Used to get font tags in Fontmatrix database (if it exists)"
echo " --enable-imlib Build Imlib2 components. Default is to $USEIMLIB them."
echo " --disable-imlib Don't build Imlib2 components. Default is to $USEIMLIB them."
echo " --backend=cairo Only cairo is supported for now."
echo " --harfbuzz=2.0 What version of harfbuzz you are using. Preferably use 2.0 or later."
# echo " --onamac Include this if you are compiling on a Mac."
echo " --extra-cppflags Any extra compile flags, such as location of includes not"
echo " otherwise detected"
echo " --relocatable If present, do not configure with hardcoded paths. All resource paths"
echo " will be determined at runtime relative to the executable."
# echo " --make-pkgconfig Create a laxkit.pc file that pkg-config can understand."
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 ;;
# --make-pkgconfig)
# MAKE_LAXKIT_PC="yes"
# shift ;;
--relocatable)
RELOCATABLE="yes";
shift ;;
--extra-cppflags)
if [ -z $optarg ] ; then
optarg=$2
shift
fi
EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS $optarg"
shift ;;
--onamac)
ONAMAC="yes"
shift ;;
--disable-gl)
unset USEGL
shift;;
--disable-graphicsmagick)
unset USEGRAPHICSMAGICK
shift;;
--enable-graphicsmagick)
USEGRAPHICSMAGICK="yes"
shift;;
--enable-imlib)
USEIMLIB="yes"
shift;;
--disable-imlib)
unset USEIMLIB
shift;;
--disable-cairo)
unset USECAIRO
shift;;
--disable-xinput2)
unset USEXINPUT2
shift;;
--disable-sqlite)
unset USESQLITE
shift;;
--harfbuzz)
HARFBUZZVERSION=$optarg;
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 [ "$USEIMLIB" == "build" ] ; then USEIMLIB="yes"; elif [ "$USEIMLIB" != "yes" ] ; then unset USEIMLIB; fi
if [ "$USEGRAPHICSMAGICK" == "build" ] ; then USEGRAPHICSMAGICK="yes"; elif [ "$USEGRAPHICSMAGICK" != "yes" ] ; then unset USEGRAPHICSMAGICK; fi
EXTRA_CFLAGS="$EXTRA_CFLAGS $EXTRA_CPPFLAGS `pkg-config --cflags GraphicsMagick++`";
#if [ x$USEIMLIB$USECAIRO == x ] ;
if [ x$USECAIRO == x ] ;
#then echo "You must use at least one of Imlib or Cairo.";
then echo "You must use Cairo.";
exit 1;
fi
if [ x$LAXKITCONFIGDIR == x ] ; then
LAXKITCONFIGDIR="$LAXKITCONFIGDIRBASE/$LAXKITVERSION"
fi
# do check for required libraries:
## The stuff in NEED can be checked with pkg-config. Not all libraries
## can be checked this way! (notably cups, apparently)
NEED='x11 freetype2 harfbuzz'
if [ x$USEIMLIB != x ] ; then NEED="$NEED imlib2"; fi
if [ x$USECAIRO != x ] ; then NEED="$NEED cairo"; fi
if [ x$USEGRAPHICSMAGICK != x ] ; then NEED="$NEED GraphicsMagick++"; 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=''
if [ x$USESQLITE != x ] ; then OPTIONAL="$OPTIONAL sqlite3"; fi
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 try to check for their custom cups-config
echo -n Checking for cups......;
if [ ! `builtin type -p cups-config` ] ; then
echo "Can't find cups-config. You might 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
#if [[ $PLATFORM != "x11" && $PLATFORM != "mac" && $PLATFORM != "windows" ]] ;
#if [ $PLATFORM != "x11" -a $PLATFORM != "headless" -a $PLATFORM != "qt" ] ;
if [ $PLATFORM != "x11" ] ; then
echo "Unknown platform $PLATFORM!";
exit 1
# then PLATFORM="x11";
fi
#
# Set up extra libraries
#
if [ x$USEIMLIB != x ] ; then
EXTRA_LIBS="$EXTRA_LIBS `imlib2-config --libs`";
fi
if [ x$USEGRAPHICSMAGICK != x ] ; then
EXTRA_CFLAGS="$EXTRA_CFLAGS `pkg-config --cflags GraphicsMagick++`";
EXTRA_LIBS="$EXTRA_LIBS `pkg-config --libs GraphicsMagick++`";
LAXKIT_PC_LIBS="$LAXKIT_PC_LIBS GraphicsMagick++"
fi
if [ x$USEXLIB != x ] ; then
EXTRA_LIBS="$EXTRA_LIBS -lXft"
fi
#
# Make laxkit.pc
#
if [ $MAKE_LAXKIT_PC == "yes" ] ; then
echo "prefix=$PREFIX" > laxkit.pc
echo "exec_prefix=\${prefix}" >> laxkit.pc
echo "libdir=\${exec_prefix}/lib" >> laxkit.pc
echo "includedir=\${prefix}/include/laxkit/$LAXKITVERSION" >> laxkit.pc
echo "" >> laxkit.pc
echo "Name: laxkit" >> laxkit.pc
echo "Version: $LAXKITVERSION" >> laxkit.pc
echo "Description: C++ Window Library" >> laxkit.pc
echo "Requires: harfbuzz >= 2.0 fontconfig $OPTIONALLIBS $NEED" >> laxkit.pc
#echo "Libs: -L\${libdir} -llaxinterfaces -llaxkit -lXext -lXi -lXrandr -lcrypto -lzip" >> laxkit.pc
echo "Libs: -L\${libdir} -llaxkit -lXext -lXi -lXrandr -lcrypto -lzip" >> laxkit.pc
echo "Cflags: -I\${includedir}" >> laxkit.pc
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
##
echo "Generating lax/configured.h..."
FINALPREFIX=$PREFIX
if [ $RELOCATABLE == "yes" ] ; then FINALPREFIX=".."; fi
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
if [ $RELOCATABLE == "yes" ] ; then echo " //Configured paths are relative to the executable at runtime" >> lax/configured.h; fi
echo "#define LAX_INSTALL_PREFIX \"$FINALPREFIX\"" >> lax/configured.h
echo "#define LAX_SHARED_DIRECTORY \"$FINALPREFIX/share/laxkit/$LAXKITVERSION/\"" >> lax/configured.h
echo "#define LAX_CONFIG_DIRECTORY \"$LAXKITCONFIGDIR\"" >> lax/configured.h
echo "" >> lax/configured.h
if [ $PLATFORM == "x11" ] ; then echo "#define _LAX_PLATFORM_XLIB" >> lax/configured.h ; fi
if [ $PLATFORM == "qt" ] ; then echo "#define _LAX_PLATFORM_QT" >> lax/configured.h ; fi
if [ $PLATFORM == "headless" ] ; then echo "#define _LAX_PLATFORM_HEADLESS" >> lax/configured.h ; fi
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$USEGRAPHICSMAGICK != x ] ; then echo "#define LAX_USES_GRAPHICSMAGICK" >> 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
if [ $HARFBUZZVERSION \< "2.0" ] ; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DHARFBUZZ_BELOW_2_0"; fi
##
## 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 "EXTRA_LAX_CFLAGS=$EXTRA_CFLAGS" >> Makefile-toinclude
echo "EXTRA_LAX_LIBS=$EXTRA_LIBS" >> 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 "$CONFIGCOMMAND" > config.log
echo "" >> config.log
echo \
" Laxkit 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$USEGRAPHICSMAGICK != x ] ;
then echo " Use GraphicsMagick: yes" >> config.log;
else echo " Use GraphicsMagick: 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$USEIMLIB != x ] ;
then echo " Use Imlib2: yes" >> config.log;
else echo " Use Imlib2: 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 " Extra cppflags: $EXTRA_CPPFLAGS" >> config.log;
echo " Relocatable: $RELOCATABLE" >> config.log;
echo " Harfbuzz: $HARFBUZZVERSION" >> config.log;
echo " Default backend: $LAXKITBACKEND" >> config.log;
echo " Platform: $PLATFORM" >> config.log;
##
## Echo to console
##
echo $CONFIGCOMMAND
echo
echo " Laxkit 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$USEGRAPHICSMAGICK != x ] ;
then echo " Use GraphicsMagick: yes";
else echo " Use GraphicsMagick: no" ;
fi
if [ x$USECAIRO != x ] ;
then echo " Use Cairo: yes";
else echo " Use Cairo: no";
fi
if [ x$USEIMLIB != x ] ;
then echo " Use Imlib2: yes";
else echo " Use Imlib2: 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 " Extra cppflags: $EXTRA_CPPFLAGS"
echo " Relocatable: $RELOCATABLE"
echo " Harfbuzz: $HARFBUZZVERSION"
echo " Default backend: $LAXKITBACKEND"
echo " Platform: $PLATFORM"
echo
echo "Now type make to build.";