This repository has been archived by the owner on Nov 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathcompile.sh
747 lines (600 loc) · 19.7 KB
/
compile.sh
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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
#!/bin/sh
##########################################################################
# compile.sh - Unix/X11 configuration script
# $Date: 2007-09-20 23:16:57 $
# $Revision: 1.16 $
#
# This is a minimalist configuration script for GLFW, which is used to
# determine the availability of certain features.
#
# This script is not very nice at all (especially the Makefile generation
# is very ugly and hardcoded). Hopefully it will be cleaned up in the
# future, but for now it does a pretty good job.
##########################################################################
##########################################################################
# Check arguments
##########################################################################
silent=no
for arg in "$@"; do
{
case "$arg" in
# Silent?
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
esac;
}
done;
##########################################################################
# Misc.
##########################################################################
self=$0
# File descriptor usage:
# 0 standard input
# 1 file creation
# 2 errors and warnings
# 5 compiler messages saved in config.log
# 6 checking for... messages and results
exec 5>./config.log
if [ "x$silent" = xyes ]; then
exec 6>/dev/null
else
exec 6>&1
fi
echo "\
This file contains any messages produced by compilers while
running $self, to aid debugging if $self makes a mistake.
" 1>&5
##########################################################################
# Default compiler settings
##########################################################################
if [ "x$CC" = x ]; then
CC=cc
fi
# These will contain flags needed by both the GLFW library and programs
# They are also used by the compile and link tests below
# Note that CFLAGS and LFLAGS remain unmodified and are checked again
# before file generation
GLFW_CFLAGS="$CFLAGS"
GLFW_LFLAGS="$LFLAGS -lGL"
# These will contain flags needed by the GLFW library
GLFW_LIB_CFLAGS=
GLFW_LIB_LFLAGS=
# These will contain flags needed by programs using GLFW
GLFW_BIN_CFLAGS=
GLFW_BIN_LFLAGS=
# This will contain flags needed by the GLFW shared library
SOFLAGS=
##########################################################################
# Add system-specific flags
##########################################################################
echo -n "Checking what kind of system this is... " 1>&6
case "x`uname 2> /dev/null`" in
xLinux)
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_USE_LINUX_JOYSTICKS"
SOFLAGS="-shared -Wl,-soname,libglfw.so"
echo "Linux" 1>&6
;;
xDarwin)
SOFLAGS="-flat_namespace -undefined suppress"
echo "Mac OS X" 1>&6
;;
*)
SOFLAGS="-shared -soname libglfw.so"
echo "Generic Unix" 1>&6
;;
esac
##########################################################################
# Check for X11 library directory
##########################################################################
echo -n "Checking for X11 libraries location... " 1>&6
if [ -r "/usr/X11/lib" ]; then
GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11/lib"
GLFW_CFLAGS="-I/usr/X11/include $GLFW_CFLAGS"
echo "/usr/X11/lib" 1>&6
elif [ -r "/usr/X11R7/lib" ]; then
GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11R7/lib"
GLFW_CFLAGS="-I/usr/X11R7/include $GLFW_CFLAGS"
echo "/usr/X11R7/lib" 1>&6
elif [ -r "/usr/X11R6/lib" ]; then
GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11R6/lib"
GLFW_CFLAGS="-I/usr/X11R6/include $GLFW_CFLAGS"
echo "/usr/X11R6/lib" 1>&6
elif [ -r "/usr/X11R5/lib" ]; then
GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11R5/lib"
GLFW_CFLAGS="-I/usr/X11R5/include $GLFW_CFLAGS"
echo "/usr/X11R5/lib" 1>&6
elif [ -r "/opt/X11R6/lib" ]; then
# This location is used on QNX
GLFW_LFLAGS="$GLFW_LFLAGS -L/opt/X11R6/lib"
GLFW_CFLAGS="-I/opt/X11R6/include $GLFW_CFLAGS"
echo "/opt/X11R6/lib" 1>&6
elif [ -r "/usr/X/lib" ]; then
GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X/lib"
GLFW_CFLAGS="-I/usr/X/include $GLFW_CFLAGS"
echo "/usr/X/lib" 1>&6
else
# TODO: Detect and report X11R7 in /usr/lib
echo "unknown (assuming linker will find them)" 1>&6
fi
##########################################################################
# Compilation commands
##########################################################################
compile='$CC -c $GLFW_CFLAGS conftest.c 1>&5'
link='$CC -o conftest $GLFW_CFLAGS conftest.c $GLFW_LFLAGS 1>&5'
##########################################################################
# Check if we are using GNU C (or something claiming it is)
##########################################################################
echo -n "Checking whether we are using GNU C... " 1>&6
echo "$self: checking whether we are using GNU C" >&5
cat > conftest.c <<EOF
#ifdef __GNUC__
yes;
#endif
EOF
if { ac_try='$CC -E conftest.c'; { (eval echo $self: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
use_gcc=yes
else
use_gcc=no
fi
rm -f conftest*
echo "$use_gcc" 1>&6
##########################################################################
# Check for X11 RandR availability
##########################################################################
echo -n "Checking for X11 RandR support... " 1>&6
echo "$self: Checking for X11 RandR support" >&5
has_xrandr=no
cat > conftest.c <<EOF
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
int main() {; return 0;}
EOF
if { (eval echo $self: \"$compile\") 1>&5; (eval $compile) 2>&5; }; then
rm -rf conftest*
has_xrandr=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
rm -f conftest*
echo "$has_xrandr" 1>&6
if [ "x$has_xrandr" = xyes ]; then
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_XRANDR"
GLFW_LIB_LFLAGS="$GLFW_LIB_LFLAGS -lXrandr"
fi
##########################################################################
# Check for X11 VidMode availability
##########################################################################
if [ "x$has_xrandr" = xno ]; then
echo -n "Checking for X11 VidMode support... " 1>&6
echo "$self: Checking for X11 VidMode support" >&5
has_xf86vm=no
cat > conftest.c <<EOF
#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>
#if defined(__APPLE_CC__)
#error Not supported under Mac OS X
#endif
int main() {; return 0;}
EOF
if { (eval echo $self: \"$compile\") 1>&5; (eval $compile) 2>&5; }; then
rm -rf conftest*
has_xf86vm=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
rm -f conftest*
echo "$has_xf86vm" 1>&6
if [ "x$has_xf86vm" = xyes ]; then
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_XF86VIDMODE"
GLFW_LIB_LFLAGS="$GLFW_LIB_LFLAGS -lXxf86vm -lXext"
fi
fi
##########################################################################
# Check for pthread support
##########################################################################
echo -n "Checking for pthread support... " 1>&6
echo "$self: Checking for pthread support" >&5
has_pthread=no
cat > conftest.c <<EOF
#include <pthread.h>
int main() {pthread_t posixID; posixID=pthread_self(); return 0;}
EOF
# Save original values
CFLAGS_OLD="$GLFW_CFLAGS"
LFLAGS_OLD="$GLFW_LFLAGS"
# These will contain the extra flags, if any
CFLAGS_THREAD=
LFLAGS_THREAD=
# Try -pthread (most systems)
if [ "x$has_pthread" = xno ]; then
CFLAGS_THREAD="-pthread"
LFLAGS_THREAD="-pthread"
GLFW_CFLAGS="$CFLAGS_OLD $CFLAGS_THREAD"
GLFW_LFLAGS="$LFLAGS_OLD $LFLAGS_THREAD"
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_pthread=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
fi
# Try -lpthread
if [ "x$has_pthread" = xno ]; then
CFLAGS_THREAD="-D_REENTRANT"
LFLAGS_THREAD="-lpthread"
GLFW_CFLAGS="$CFLAGS_OLD $CFLAGS_THREAD"
GLFW_LFLAGS="$LFLAGS_OLD $LFLAGS_THREAD"
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_pthread=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
fi
# Try -lsocket (e.g. QNX)
if [ "x$has_pthread" = xno ]; then
CFLAGS_THREAD=
LFLAGS_THREAD="-lsocket"
GLFW_CFLAGS="$CFLAGS_OLD $CFLAGS_THREAD"
GLFW_LFLAGS="$LFLAGS_OLD $LFLAGS_THREAD"
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_pthread=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
fi
# Restore original values
GLFW_CFLAGS="$CFLAGS_OLD"
GLFW_LFLAGS="$LFLAGS_OLD"
echo "$has_pthread" 1>&6
if [ "x$has_pthread" = xyes ]; then
GLFW_CFLAGS="$GLFW_CFLAGS $CFLAGS_THREAD"
GLFW_LFLAGS="$GLFW_LFLAGS $LFLAGS_THREAD"
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_PTHREAD"
fi
##########################################################################
# Check for sched_yield support
##########################################################################
if [ "x$has_pthread" = xyes ]; then
echo -n "Checking for sched_yield... " 1>&6
echo "$self: Checking for sched_yield" >&5
has_sched_yield=no
LFLAGS_OLD="$GLFW_LFLAGS"
LFLAGS_YIELD=
cat > conftest.c <<EOF
#include <pthread.h>
int main() {sched_yield(); return 0;}
EOF
if { (eval echo $self: \"$compile\") 1>&5; (eval $compile) 2>&5; }; then
rm -f conftest*
has_sched_yield=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
if [ "x$has_sched_yield" = xno ]; then
LFLAGS_YIELD="-lrt"
GLFW_LFLAGS="$LFLAGS_OLD $LFLAGS_YIELD"
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -f conftest*
has_sched_yield=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
fi
GLFW_LFLAGS="$LFLAGS_OLD"
echo "$has_sched_yield" 1>&6
if [ "x$has_sched_yield" = xyes ]; then
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_SCHED_YIELD"
GLFW_LIB_LFLAGS="$GLFW_LIB_LFLAGS $LFLAGS_YIELD"
fi
fi
##########################################################################
# Check for clock_gettime support
##########################################################################
echo -n "Checking for clock_gettime... " 1>&6
echo "$self: Checking for clock_gettime" >&5
has_clock_gettime=no
LFLAGS_OLD="$GLFW_LFLAGS"
LFLAGS_CLOCK=
GLFW_LFLAGS="$LFLAGS_CLOCK"
cat > conftest.c <<EOF
#include <time.h>
#include <unistd.h>
int main() {
#if defined( CLOCK_MONOTONIC )
clock_gettime(0, 0);
#else
#error "clock_gettime support not detected"
#endif
return 0;}
EOF
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -f conftest*
has_clock_gettime=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
if [ "x$has_clock_gettime" = xno ]; then
LFLAGS_CLOCK="-lrt"
GLFW_LFLAGS="$LFLAGS_CLOCK"
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -f conftest*
has_clock_gettime=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
fi
GLFW_LFLAGS="$LFLAGS_OLD"
echo "$has_clock_gettime" 1>&6
if [ "x$has_clock_gettime" = xyes ]; then
GLFW_LIB_LFLAGS="$GLFW_LIB_LFLAGS $LFLAGS_CLOCK"
fi
##########################################################################
# Check for glXGetProcAddressXXX availability
##########################################################################
echo -n "Checking for glXGetProcAddress variants... " 1>&6
echo "$self: Checking for glXGetProcAddress variants" >&5
has_glXGetProcAddress=no
if [ "x$has_glXGetProcAddress" = xno ]; then
# Check for plain glXGetProcAddress
cat > conftest.c <<EOF
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <GL/gl.h>
int main() {void *ptr=(void*)glXGetProcAddress("glFun"); return 0;}
EOF
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_glXGetProcAddress=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
rm -f conftest*
if [ "x$has_glXGetProcAddress" = xyes ]; then
echo "glXGetProcAddress" 1>&6
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_GLXGETPROCADDRESS"
fi
fi
if [ "x$has_glXGetProcAddress" = xno ]; then
# Check for glXGetProcAddressARB
cat > conftest.c <<EOF
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <GL/gl.h>
int main() {void *ptr=(void*)glXGetProcAddressARB("glFun"); return 0;}
EOF
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_glXGetProcAddress=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
rm -f conftest*
if [ "x$has_glXGetProcAddress" = xyes ]; then
echo "glXGetProcAddressARB" 1>&6
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_GLXGETPROCADDRESSARB"
fi
fi
if [ "x$has_glXGetProcAddress" = xno ]; then
# Check for glXGetProcAddressEXT
cat > conftest.c <<EOF
#include <X11/Xlib.h>
#include <GL/glx.h>
#include <GL/gl.h>
int main() {void *ptr=(void*)glXGetProcAddressEXT("glFun"); return 0;}
EOF
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_glXGetProcAddress=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
rm -f conftest*
if [ "x$has_glXGetProcAddress" = xyes ]; then
echo "glXGetProcAddressEXT" 1>&6
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_GLXGETPROCADDRESSEXT"
fi
fi
if [ "x$has_glXGetProcAddress" = xno ]; then
echo "no" 1>&6
fi
##########################################################################
# Check for dlopen support if necessary
##########################################################################
if [ "x$has_glXGetProcAddress" = xno ]; then
echo -n "Checking for dlopen... " 1>&6
echo "$self: Checking for dlopen" >&5
has_dlopen=no
cat > conftest.c <<EOF
#include <dlfcn.h>
int main() {void *l=dlopen("libGL.so",RTLD_LAZY|RTLD_GLOBAL); return 0;}
EOF
# First try without -ldl
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_dlopen=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
# Now try with -ldl if the previous attempt failed
if [ "x$has_dlopen" = xno ]; then
LFLAGS_OLD="$GLFW_LFLAGS"
GLFW_LFLAGS="$GLFW_LFLAGS -ldl"
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_dlopen=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
GLFW_LFLAGS="$LFLAGS_OLD"
if [ "x$has_dlopen" = xyes ]; then
GLFW_LIB_LFLAGS="$GLFW_LIB_LFLAGS -ldl"
fi
fi
rm -f conftest*
echo "$has_dlopen" 1>&6
if [ "x$has_dlopen" = xyes ]; then
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_DLOPEN"
fi
fi
##########################################################################
# Check for sysconf support
##########################################################################
echo -n "Checking for sysconf... " 1>&6
echo "$self: Checking for sysconf" >&5
has_sysconf=no
cat > conftest.c <<EOF
#include <unistd.h>
#ifndef _SC_NPROCESSORS_ONLN
#ifndef _SC_NPROC_ONLN
#error Neither _SC_NPROCESSORS_ONLN nor _SC_NPROC_ONLN available
#endif
#endif
int main() {long x=sysconf(_SC_ARG_MAX); return 0; }
EOF
if { (eval echo $self: \"$link\") 1>&5; (eval $link) 2>&5; }; then
rm -rf conftest*
has_sysconf=yes
else
echo "$self: failed program was:" >&5
cat conftest.c >&5
fi
rm -f conftest*
echo "$has_sysconf" 1>&6
if [ "x$has_sysconf" = xyes ]; then
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_SYSCONF"
fi
##########################################################################
# Check for sysctl support
##########################################################################
echo -n "Checking for sysctl support... " 1>&6
echo "$self: Checking for sysctl support" >&5
has_sysctl=no
cat > conftest.c <<EOF
#include <sys/types.h>
#include <sys/sysctl.h>
#ifdef CTL_HW
#ifdef HW_NCPU
yes;
#endif
#endif
EOF
if { ac_try='$CC -E conftest.c'; { (eval echo $self: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
has_sysctl=yes
fi
rm -f conftest*
echo "$has_sysctl" 1>&6
if [ "x$has_sysctl" = xyes ]; then
GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_HAS_SYSCTL"
fi
##########################################################################
# Last chance to change the flags before file generation
##########################################################################
GLFW_LIB_CFLAGS="-c -I. -I.. $GLFW_LIB_CFLAGS"
GLFW_BIN_CFLAGS="-I../include $GLFW_BIN_CFLAGS"
if [ "x$CFLAGS" = x ]; then
if [ "x$use_gcc" = xyes ]; then
GLFW_CFLAGS="$GLFW_CFLAGS -O2 -Wall"
else
GLFW_CFLAGS="$GLFW_CFLAGS -O"
fi
fi
GLFW_LFLAGS="$GLFW_LFLAGS -lm"
GLFW_LIB_LFLAGS="$GLFW_LIB_LFLAGS -lX11"
GLFW_BIN_LFLAGS="-lGLU $GLFW_BIN_LFLAGS"
##########################################################################
# Create makefiles and pkg-config template file
##########################################################################
# ---------------------------------------------------------------------
# Create Makefile for GLFW library
# ---------------------------------------------------------------------
MKNAME='./lib/x11/Makefile.x11'
echo "Creating $MKNAME" 1>&6
echo "$self: Creating $MKNAME" >&5
cat > "$MKNAME" <<EOF
##########################################################################
# Automatically generated Makefile for GLFW
##########################################################################
CC = $CC
CFLAGS = $GLFW_LIB_CFLAGS $GLFW_CFLAGS
SOFLAGS = $SOFLAGS
LFLAGS = $GLFW_LIB_LFLAGS $GLFW_LFLAGS
EOF
cat './lib/x11/Makefile.x11.in' >>$MKNAME
# ---------------------------------------------------------------------
# Create Makefile for examples
# ---------------------------------------------------------------------
MKNAME='./examples/Makefile.x11'
echo "Creating $MKNAME" 1>&6
echo "$self: Creating $MKNAME" >&5
cat > "$MKNAME" <<EOF
##########################################################################
# Makefile for GLFW example programs on X11 (generated by compile.sh)
##########################################################################
CC = $CC
CFLAGS = $GLFW_BIN_CFLAGS $GLFW_CFLAGS
LIB = ../lib/x11/libglfw.a
SOLIB = ../lib/x11/libglfw.so
LFLAGS = \$(LIB) $GLFW_LIB_LFLAGS $GLFW_BIN_LFLAGS $GLFW_LFLAGS
SO_LFLAGS = \$(SOLIB) $GLFW_BIN_LFLAGS $GLFW_LFLAGS
EOF
cat './examples/Makefile.x11.in' >>$MKNAME
# ---------------------------------------------------------------------
# Create Makefile for test programs
# ---------------------------------------------------------------------
MKNAME='./tests/Makefile.x11'
echo "Creating $MKNAME" 1>&6
echo "$self: Creating $MKNAME" >&5
cat > "$MKNAME" <<EOF
##########################################################################
# Makefile for GLFW test programs on X11 (generated by compile.sh)
##########################################################################
CC = $CC
CFLAGS = $GLFW_BIN_CFLAGS $GLFW_CFLAGS
LIB = ../lib/x11/libglfw.a
SOLIB = ../lib/x11/libglfw.so
LFLAGS = \$(LIB) $GLFW_LIB_LFLAGS $GLFW_BIN_LFLAGS $GLFW_LFLAGS
SO_LFLAGS = \$(SOLIB) $GLFW_BIN_LFLAGS $GLFW_LFLAGS
EOF
cat './tests/Makefile.x11.in' >>$MKNAME
# ---------------------------------------------------------------------
# Create pkg-config template file (which is used to create libglfw.pc)
# ---------------------------------------------------------------------
MKNAME="./lib/x11/libglfw.pc.in"
echo "Creating $MKNAME" 1>&6
echo "$self: Creating $MKNAME" >&5
if [ "x$has_xrandr" = xyes ]; then
PKG_LIBS="${PKG_LIBS} xrandr"
fi
if [ "x$has_xf86vm" = xyes ]; then
PKG_LIBS="${PKG_LIBS} xxf86vm"
fi
cat > "$MKNAME" <<EOF
prefix=@PREFIX@
exec_prefix=\${prefix}
includedir=\${prefix}/include
libdir=\${exec_prefix}/lib
Name: GLFW
Description: A portable framework for OpenGL development
Version: 2.7.4
URL: http://www.glfw.org/
Requires.private: gl x11 $PKG_LIBS
Libs: -L\${libdir} -lglfw $LFLAGS_THREAD $LFLAGS_CLOCK
Cflags: -I\${includedir} $CFLAGS_THREAD
EOF