Repository navigation
Expand file tree
/
Copy pathauto.def
More file actions
215 lines (189 loc) · 6.78 KB
/
Copy pathauto.def
File metadata and controls
215 lines (189 loc) · 6.78 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
# System autoconfiguration. Try: ./configure --help
use cc cc-lib
options {
with-openssl:path|auto|none
=> {Look for openssl in the given path, or auto or none}
with-zlib:path => {Look for zlib in the given path}
with-tcl:path => {Enable Tcl integration, with Tcl in the specified path}
internal-sqlite=1 => {Don't use the internal sqlite, use the system one}
static=0 => {Link a static executable}
lineedit=1 => {Disable line editing}
fossil-debug=0 => {Build with fossil debugging enabled}
json=0 => {Build with fossil JSON API enabled}
}
# sqlite wants these types if possible
cc-with {-includes {stdint.h inttypes.h}} {
cc-check-types uint32_t uint16_t int16_t uint8_t
}
# Use pread/pwrite system calls in place of seek + read/write if possible
define USE_PREAD [cc-check-functions pread]
# Find tclsh for the test suite. Can't yet use jimsh for this.
cc-check-progs tclsh
define EXTRA_CFLAGS ""
define EXTRA_LDFLAGS ""
define USE_SYSTEM_SQLITE ""
if {![opt-bool internal-sqlite]} {
proc find_internal_sqlite {} {
# On some systems (slackware), libsqlite3 requires -ldl to link. So
# search for the system SQLite once with -ldl, and once without. If
# the library can only be found with $extralibs set to -ldl, then
# the code below will append -ldl to LIBS.
#
foreach extralibs {{} {-ldl}} {
# Locate the system SQLite by searching for sqlite3_open(). Then check
# if sqlite3_wal_checkpoint() can be found as well. If we can find
# open() but not wal_checkpoint(), then the system SQLite is too old
# to link against fossil.
#
if {[cc-check-function-in-lib sqlite3_open sqlite3 $extralibs]} {
if {![cc-check-function-in-lib sqlite3_wal_checkpoint sqlite3 $extralibs]} {
user-error "system sqlite3 too old (require >= 3.7.0)"
}
# Success. Update symbols and return.
#
define USE_SYSTEM_SQLITE 1
define-append LIBS $extralibs
return
}
}
user-error "system sqlite3 not found"
}
find_internal_sqlite
}
if {[opt-bool fossil-debug]} {
define-append EXTRA_CFLAGS -DFOSSIL_DEBUG
}
if {[opt-bool json]} {
define-append EXTRA_CFLAGS -DFOSSIL_ENABLE_JSON
}
if {[opt-bool static]} {
# XXX: This will not work on all systems.
define-append EXTRA_LDFLAGS -static
}
# Check for zlib, using the given location if specified
set zlibpath [opt-val with-zlib]
if {$zlibpath ne ""} {
cc-with [list -cflags "-I$zlibpath -L$zlibpath"]
define-append EXTRA_CFLAGS -I$zlibpath
define-append EXTRA_LDFLAGS -L$zlibpath
}
if {![cc-check-includes zlib.h] || ![cc-check-function-in-lib inflateEnd z]} {
user-error "zlib not found please install it or specify the location with --with-zlib"
}
set tclpath [opt-val with-tcl]
if {$tclpath ne ""} {
# Note parse-tclconfig-sh is in autosetup/local.tcl
if {$tclpath eq "1"} {
# Use the system Tcl. Look in some likely places.
array set tclconfig [parse-tclconfig-sh /usr /usr/local /usr/share /opt/local]
set msg "on your system"
} else {
array set tclconfig [parse-tclconfig-sh $tclpath]
set msg "at $tclpath"
}
if {![info exists tclconfig(TCL_INCLUDE_SPEC)]} {
user-error "Cannot find Tcl $msg"
}
set cflags $tclconfig(TCL_INCLUDE_SPEC)
set libs "$tclconfig(TCL_LIB_SPEC) $tclconfig(TCL_LIBS)"
cc-with [list -cflags $cflags -libs $libs] {
if {![cc-check-functions Tcl_CreateInterp]} {
user-error "Cannot find a usable Tcl $msg"
}
}
set version $tclconfig(TCL_VERSION)$tclconfig(TCL_PATCH_LEVEL)
msg-result "Found Tcl $version at $tclconfig(TCL_PREFIX)"
define-append LIBS $libs
define-append EXTRA_CFLAGS $cflags
define-append EXTRA_LDFLAGS $tclconfig(TCL_LD_FLAGS)
define FOSSIL_ENABLE_TCL
}
# Helper for openssl checking
proc check-for-openssl {msg {cflags {}}} {
msg-checking "Checking for $msg..."
set rc 0
msg-quiet cc-with [list -cflags $cflags -libs {-lssl -lcrypto}] {
if {[cc-check-includes openssl/ssl.h] && [cc-check-functions SSL_new]} {
incr rc
}
}
if {$rc} {
msg-result "ok"
return 1
} else {
msg-result "no"
return 0
}
}
set ssldirs [opt-val with-openssl]
if {$ssldirs ne "none"} {
set found 0
if {$ssldirs in {auto ""}} {
catch {
set cflags [exec pkg-config openssl --cflags-only-I]
set ldflags [exec pkg-config openssl --libs-only-L]
set found [check-for-openssl "ssl via pkg-config" "$cflags $ldflags"]
} msg
if {!$found} {
set ssldirs "{} /usr/sfw /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
}
}
if {!$found} {
foreach dir $ssldirs {
if {$dir eq ""} {
set msg "system ssl"
set cflags ""
set ldflags ""
} else {
set msg "ssl in $dir"
set cflags "-I$dir/include"
set ldflags "-L$dir/lib"
}
if {[check-for-openssl $msg "$cflags $ldflags"]} {
incr found
break
}
}
}
if {$found} {
define FOSSIL_ENABLE_SSL
define-append EXTRA_CFLAGS $cflags
define-append EXTRA_LDFLAGS $ldflags
define-append LIBS -lssl -lcrypto
msg-result "HTTP support enabled"
# Silence OpenSSL deprecation warnings on Mac OS X 10.7.
if {[string match *-darwin* [get-define host]]} {
if {[cctest -cflags {-Wdeprecated-declarations}]} {
define-append EXTRA_CFLAGS -Wdeprecated-declarations
}
}
} else {
user-error "OpenSSL not found. Consider --with-openssl=none to disable HTTPS support"
}
}
if {[opt-bool lineedit]} {
# Need readline-compatible line editing
cc-with {-includes stdio.h} {
if {[cc-check-includes readline/readline.h] && [cc-check-function-in-lib readline readline]} {
msg-result "Using readline for line editing"
} elseif {[cc-check-includes editline/readline.h] && [cc-check-function-in-lib readline edit]} {
define-feature editline
msg-result "Using editline for line editing"
}
}
}
# Network functions require libraries on some systems
cc-check-function-in-lib gethostbyname nsl
if {![cc-check-function-in-lib socket {socket network}]} {
# Last resort, may be Windows
if {[string match *mingw* [get-define host]]} {
define-append LIBS -lwsock32
}
}
# Check for getpassphrase() for Solaris 10 where getpass() truncates to 10 chars
if {![cc-check-functions getpassphrase]} {
# Haiku needs this
cc-check-function-in-lib getpass bsd
}
make-template Makefile.in
make-config-header autoconfig.h -auto {USE_* FOSSIL_*}