-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure
executable file
·176 lines (154 loc) · 2.95 KB
/
configure
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
#!/bin/sh
# Swirc configure script
#
# SPDX-FileCopyrightText: Copyright 2016-2024 Markus Uhlin
# SPDX-License-Identifier: BSD-3-Clause
MAKE_DEF_FILE=options.mk
. "posixshell/check_etext.sh"
. "posixshell/check_strcasestr.sh"
. "posixshell/fix_cflags.sh"
. "posixshell/link_with_gnu_libidn.sh"
. "posixshell/link_with_gnu_libintl.sh"
. "posixshell/link_with_hunspell.sh"
. "posixshell/link_with_libiconv.sh"
. "posixshell/link_with_libnotify.sh"
. "posixshell/set_common.sh"
. "posixshell/os_BSD.sh"
. "posixshell/os_GNU.sh"
. "posixshell/os_LINUX.sh"
. "posixshell/os_LINUX_suncc.sh"
. "posixshell/os_MAC.sh"
. "posixshell/os_NETBSD.sh"
_sanitize_address=0
_sanitize_thread=0
_fuzz_mode=0
_with_libnotify=0
_without_libiconv=0
_without_libidn=0
_without_libintl=0
print_help () {
echo ""
echo "Configuration options:"
echo ""
echo " --with-libnotify Enable support for desktop notifications"
echo " --without-libiconv Build without GNU libiconv"
echo " --without-libidn Build without GNU libidn"
echo " --without-libintl No internationalization"
echo ""
if [ "$(whoami)" = "maxxe" ]; then
echo " --sanitize-address"
echo " --sanitize-thread"
echo " --fuzz-mode"
echo ""
echo "ASAN_OPTIONS=\"log_path=asan.log\""
echo "TSAN_OPTIONS=\"log_path=tsan.log\""
fi
}
for arg in "$@"; do
case "$arg" in
"--sanitize-address")
_sanitize_address=1
;;
"--sanitize-thread")
_sanitize_thread=1
;;
"--fuzz-mode")
_fuzz_mode=1
;;
"--help" | "-?" | "-h")
print_help
exit 0
;;
"--with-libnotify")
_with_libnotify=1
;;
"--without-libiconv")
_without_libiconv=1
;;
"--without-libidn")
_without_libidn=1
;;
"--without-libintl")
_without_libintl=1
;;
*)
;;
esac
done
cat <<EOF >$MAKE_DEF_FILE
E = @echo
Q = @
RM = @rm -f
SLASH_SYM = /
EOF
case "$(uname -s)" in
"Darwin")
os_MAC
;;
"FreeBSD" | "OpenBSD")
os_BSD
;;
"GNU")
os_GNU
;;
"Linux")
if [ "$1" = "suncc" ]; then
os_LINUX_suncc
else
os_LINUX
fi
fix_cflags
if [ "$(uname -m)" = "riscv64" ]; then
cat <<EOF >>$MAKE_DEF_FILE
LDLIBS += -latomic
EOF
fi
;;
"NetBSD")
os_NETBSD
;;
*)
echo "OS not supported!"
exit 1
;;
esac
check_etext
check_strcasestr
if [ ${_sanitize_address} -eq 1 ]; then
cat <<EOF >>$MAKE_DEF_FILE
CFLAGS += -fsanitize=address
CXXFLAGS += -fsanitize=address
EOF
fi
if [ ${_sanitize_thread} -eq 1 ]; then
cat <<EOF >>$MAKE_DEF_FILE
CFLAGS += -fsanitize=thread
CXXFLAGS += -fsanitize=thread
EOF
fi
if [ ${_fuzz_mode} -eq 1 ]; then
cat <<EOF >>$MAKE_DEF_FILE
CPPFLAGS += -DIRCFUZZ_MODE=1
EOF
fi
if [ ${_with_libnotify} -eq 1 ]; then
link_with_libnotify
fi
if [ ${_without_libiconv} -eq 0 ]; then
link_with_libiconv
fi
if [ ${_without_libidn} -eq 0 ]; then
link_with_gnu_libidn
fi
if [ ${_without_libintl} -eq 0 ]; then
link_with_gnu_libintl
# ${MAKE:-make} -Cpo clean
${MAKE:-make} -Cpo
fi
link_with_hunspell
if [ -f "$MAKE_DEF_FILE" ]; then
echo "configure: $MAKE_DEF_FILE successfully created!"
else
echo "configure: fatal error"
exit 1
fi