-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·125 lines (110 loc) · 3.48 KB
/
configure
File metadata and controls
executable file
·125 lines (110 loc) · 3.48 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
#!/bin/sh
# configure script for fable\
exec tclsh8.6 "$0" "$@"
# usage -- output usage info to the given channel.
proc usage { channel } {
puts $channel {
Usage: ../configure [OPTION]...
Options:
-h, --help display this help and exit
--prefix=PREFIX install files in PREFIX [/usr/local]
--enable-fble-app=[yes|no]
enable/disable build fble-app based programs requiring SDL/GL.
--disable-fble-app
don't build fble-app based programs requiring SDL/GL.
}
}
namespace eval "config" {
# The top level source directory.
# Inferred relative to the location of this configure script.
set srcdir [file dirname [info script]]
# The top level build directory.
# Inferred from the current directory.
set builddir "."
# The install prefix.
set prefix "/usr/local"
set enable_fble_app "yes"
while {[llength $::argv] > 0} {
set ::arg [lindex $::argv 0]
set ::argv [lrange $::argv 1 end]
switch -glob $::arg {
-h -
--help {
usage stdout
exit 0
}
--prefix {
if {[llength $::argv] == 0} {
puts stderr "configure: error: missing argument to --prefix"
exit 1
}
set prefix [file normalize [lindex $::argv 0]]
set ::argv [lrange $::argv 1 end]
}
--prefix=* {
set prefix [file normalize [string range $arg [string length "--prefix="] end]]
}
--enable-fble-app {
set enable_fble_app yes
}
--enable-fble-app=* {
set enable_fble_app [string range $arg [string length "--enable-fble-app="] end]
}
--disable-fble-app {
set enable_fble_app no
}
default {
puts stderr "configure: error: unrecognized option: `$arg'"
usage stderr
exit 1
}
}
}
# Install directories based on prefix.
set includedir $::config::prefix/include
set libdir $::config::prefix/lib
set bindir $::config::prefix/bin
set mandir $::config::prefix/man
set datadir $::config::prefix/share
set docdir $::config::prefix/share/doc
set ldflags ""
if {[string first "_NT" [exec uname -s]] != -1} {
# On Windows we need to increase the stack size at compile time, because
# it doesn't support changing the stack to unlimited at runtime.
# We pick 1GB stack as something that hopefully works on a variety of
# Windows platforms while still giving a large enough stack to hopefully
# appear unlimited in practice.
set ldflags "-Wl,--stack,[expr 1024 * 1024 * 1024]"
}
# SDL and OpenGL specific configuration.
if $enable_fble_app {
try {
set sdl_cflags [exec sdl2-config --cflags]
set sdl_libs [exec sdl2-config --libs]
} on error {} {
puts stderr "Unable to find SDL2."
puts stderr "Please install libsdl2-dev or use --disable-fble-app."
exit 1
}
set gl_cflags ""
set gl_libs "-lGL"
if {[string first "_NT" [exec uname -s]] != -1} {
# Windows uses -lopengl32 instead of -lGL.
set gl_libs "-lopengl32"
}
}
}
# Generate config.tcl and show the user the config settings.
puts "Configuration:"
set fout [open $::config::builddir/config.tcl "w"]
puts $fout "namespace eval \"config\" {"
foreach var [lsort [info var ::config::*]] {
set name [string range $var [string length "::config::"] end]
set value [subst $$var]
puts " $name=$value"
puts $fout " set $name \{$value\}"
}
puts $fout "}"
close $fout
# Generate the build.ninja file.
exec tclsh8.6 $::config::srcdir/build.tcl $::config::builddir/build.ninja