Codebase list openfortivpn / 7b50d4da-46a0-424a-9960-fe2d2113e915/main
New upstream release. Debian Janitor 2 years ago
28 changed file(s) with 12634 addition(s) and 9395 deletion(s). Raw diff Collapse all Expand all
1212
1313 This high level changelog is usually updated when a release is tagged.
1414 On the master branch there may be changes that are not (yet) described here.
15
16 ### 1.17.1
17
18 * [-] fix regression: enable OpenSSL engines by default
19 * [-] fix typos found by codespell
20 * [-] fix LGTM alerts
1521
1622 ### 1.17.0
1723
5056 * [+] add git commit id in debug output
5157 * [-] do not use interface ip for routing on linux
5258 * [-] avoid extra hop on interface for default route
53 * [+] clean up, updates and improvments in the build system
59 * [+] clean up, updates and improvements in the build system
5460 * [+] increase the inbound HTTP buffer capacity when needed
5561 * [+] print domain search list to output
5662 * [+] add systemd service file
190196 * [+] Print clear text error messages of pppd upon failure
191197 * [~] Existing configuration file is not overwritten anymore at installation time
192198 * [~] Increase the accepted cookie size and align the error behavior according to RFCs
193 * [-] More gracefully handle unexcpected content of resolv.conf
199 * [-] More gracefully handle unexpected content of resolv.conf
194200 * [~] Dynamically allocate memory for split routes and thus support larger numbers of routes
195201
196202 ### 1.5.0
285291 * [+] Add support for client keys and certificates
286292 * [~] Extend the split VPN support with older FortiOS servers
287293 * [+] Add a config parser to handle received non-xml content
288 * [~] Allow ommitting the gateway for split routes
289 * [~] Allow ommitting DNS servers
294 * [~] Allow omitting the gateway for split routes
295 * [~] Allow omitting DNS servers
290296 * [-] Fix a memory leak in auth_get_config
291297 * [+] Support split routes
292298 * [+] Export the configuration of routes and gateway to environment
0 # Makefile.in generated by automake 1.16.4 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994-2021 Free Software Foundation, Inc.
4
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15
16 # http://mij.oltrelinux.com/devel/autoconf-automake/
17
18
19 VPATH = @srcdir@
20 am__is_gnu_make = { \
21 if test -z '$(MAKELEVEL)'; then \
22 false; \
23 elif test -n '$(MAKE_HOST)'; then \
24 true; \
25 elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
26 true; \
27 else \
28 false; \
29 fi; \
30 }
31 am__make_running_with_option = \
32 case $${target_option-} in \
33 ?) ;; \
34 *) echo "am__make_running_with_option: internal error: invalid" \
35 "target option '$${target_option-}' specified" >&2; \
36 exit 1;; \
37 esac; \
38 has_opt=no; \
39 sane_makeflags=$$MAKEFLAGS; \
40 if $(am__is_gnu_make); then \
41 sane_makeflags=$$MFLAGS; \
42 else \
43 case $$MAKEFLAGS in \
44 *\\[\ \ ]*) \
45 bs=\\; \
46 sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
47 | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
48 esac; \
49 fi; \
50 skip_next=no; \
51 strip_trailopt () \
52 { \
53 flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
54 }; \
55 for flg in $$sane_makeflags; do \
56 test $$skip_next = yes && { skip_next=no; continue; }; \
57 case $$flg in \
58 *=*|--*) continue;; \
59 -*I) strip_trailopt 'I'; skip_next=yes;; \
60 -*I?*) strip_trailopt 'I';; \
61 -*O) strip_trailopt 'O'; skip_next=yes;; \
62 -*O?*) strip_trailopt 'O';; \
63 -*l) strip_trailopt 'l'; skip_next=yes;; \
64 -*l?*) strip_trailopt 'l';; \
65 -[dEDm]) skip_next=yes;; \
66 -[JT]) skip_next=yes;; \
67 esac; \
68 case $$flg in \
69 *$$target_option*) has_opt=yes; break;; \
70 esac; \
71 done; \
72 test $$has_opt = yes
73 am__make_dryrun = (target_option=n; $(am__make_running_with_option))
74 am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
75 pkgdatadir = $(datadir)/@PACKAGE@
76 pkgincludedir = $(includedir)/@PACKAGE@
77 pkglibdir = $(libdir)/@PACKAGE@
78 pkglibexecdir = $(libexecdir)/@PACKAGE@
79 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
80 install_sh_DATA = $(install_sh) -c -m 644
81 install_sh_PROGRAM = $(install_sh) -c
82 install_sh_SCRIPT = $(install_sh) -c
83 INSTALL_HEADER = $(INSTALL_DATA)
84 transform = $(program_transform_name)
85 NORMAL_INSTALL = :
86 PRE_INSTALL = :
87 POST_INSTALL = :
88 NORMAL_UNINSTALL = :
89 PRE_UNINSTALL = :
90 POST_UNINSTALL = :
91 bin_PROGRAMS = openfortivpn$(EXEEXT)
92 @HAVE_SYSTEMD_TRUE@am__append_1 = clean-local-systemd
93 subdir = .
94 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
95 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
96 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
97 $(ACLOCAL_M4)
98 DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
99 $(am__configure_deps) $(am__DIST_COMMON)
100 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
101 configure.lineno config.status.lineno
102 mkinstalldirs = $(install_sh) -d
103 CONFIG_CLEAN_FILES =
104 CONFIG_CLEAN_VPATH_FILES =
105 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \
106 "$(DESTDIR)$(datadir)" "$(DESTDIR)$(systemdsystemunitdir)"
107 PROGRAMS = $(bin_PROGRAMS)
108 am__dirstamp = $(am__leading_dot)dirstamp
109 am_openfortivpn_OBJECTS = src/openfortivpn-config.$(OBJEXT) \
110 src/openfortivpn-hdlc.$(OBJEXT) \
111 src/openfortivpn-http.$(OBJEXT) src/openfortivpn-io.$(OBJEXT) \
112 src/openfortivpn-ipv4.$(OBJEXT) src/openfortivpn-log.$(OBJEXT) \
113 src/openfortivpn-tunnel.$(OBJEXT) \
114 src/openfortivpn-main.$(OBJEXT) src/openfortivpn-xml.$(OBJEXT) \
115 src/openfortivpn-userinput.$(OBJEXT) \
116 src/openfortivpn-openssl_hostname_validation.$(OBJEXT)
117 openfortivpn_OBJECTS = $(am_openfortivpn_OBJECTS)
118 am__DEPENDENCIES_1 =
119 openfortivpn_DEPENDENCIES = $(am__DEPENDENCIES_1) \
120 $(am__DEPENDENCIES_1)
121 openfortivpn_LINK = $(CCLD) $(openfortivpn_CFLAGS) $(CFLAGS) \
122 $(AM_LDFLAGS) $(LDFLAGS) -o $@
123 AM_V_P = $(am__v_P_@AM_V@)
124 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
125 am__v_P_0 = false
126 am__v_P_1 = :
127 AM_V_GEN = $(am__v_GEN_@AM_V@)
128 am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
129 am__v_GEN_0 = @echo " GEN " $@;
130 am__v_GEN_1 =
131 AM_V_at = $(am__v_at_@AM_V@)
132 am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
133 am__v_at_0 = @
134 am__v_at_1 =
135 DEFAULT_INCLUDES = -I.@am__isrc@
136 depcomp = $(SHELL) $(top_srcdir)/depcomp
137 am__maybe_remake_depfiles = depfiles
138 am__depfiles_remade = src/$(DEPDIR)/openfortivpn-config.Po \
139 src/$(DEPDIR)/openfortivpn-hdlc.Po \
140 src/$(DEPDIR)/openfortivpn-http.Po \
141 src/$(DEPDIR)/openfortivpn-io.Po \
142 src/$(DEPDIR)/openfortivpn-ipv4.Po \
143 src/$(DEPDIR)/openfortivpn-log.Po \
144 src/$(DEPDIR)/openfortivpn-main.Po \
145 src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Po \
146 src/$(DEPDIR)/openfortivpn-tunnel.Po \
147 src/$(DEPDIR)/openfortivpn-userinput.Po \
148 src/$(DEPDIR)/openfortivpn-xml.Po
149 am__mv = mv -f
150 AM_V_lt = $(am__v_lt_@AM_V@)
151 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
152 am__v_lt_0 = --silent
153 am__v_lt_1 =
154 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
155 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
156 AM_V_CC = $(am__v_CC_@AM_V@)
157 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
158 am__v_CC_0 = @echo " CC " $@;
159 am__v_CC_1 =
160 CCLD = $(CC)
161 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
162 AM_V_CCLD = $(am__v_CCLD_@AM_V@)
163 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
164 am__v_CCLD_0 = @echo " CCLD " $@;
165 am__v_CCLD_1 =
166 SOURCES = $(openfortivpn_SOURCES)
167 DIST_SOURCES = $(openfortivpn_SOURCES)
168 am__can_run_installinfo = \
169 case $$AM_UPDATE_INFO_DIR in \
170 n|no|NO) false;; \
171 *) (install-info --version) >/dev/null 2>&1;; \
172 esac
173 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
174 am__vpath_adj = case $$p in \
175 $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
176 *) f=$$p;; \
177 esac;
178 am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
179 am__install_max = 40
180 am__nobase_strip_setup = \
181 srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
182 am__nobase_strip = \
183 for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
184 am__nobase_list = $(am__nobase_strip_setup); \
185 for p in $$list; do echo "$$p $$p"; done | \
186 sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
187 $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
188 if (++n[$$2] == $(am__install_max)) \
189 { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
190 END { for (dir in files) print dir, files[dir] }'
191 am__base_list = \
192 sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
193 sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
194 am__uninstall_files_from_dir = { \
195 test -z "$$files" \
196 || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
197 || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
198 $(am__cd) "$$dir" && rm -f $$files; }; \
199 }
200 man1dir = $(mandir)/man1
201 NROFF = nroff
202 MANS = $(dist_man_MANS)
203 DATA = $(data_DATA) $(systemdsystemunit_DATA)
204 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
205 # Read a list of newline-separated strings from the standard input,
206 # and print each of them once, without duplicates. Input order is
207 # *not* preserved.
208 am__uniquify_input = $(AWK) '\
209 BEGIN { nonempty = 0; } \
210 { items[$$0] = 1; nonempty = 1; } \
211 END { if (nonempty) { for (i in items) print i; }; } \
212 '
213 # Make sure the list of sources is unique. This is necessary because,
214 # e.g., the same source file might be shared among _SOURCES variables
215 # for different programs/libraries.
216 am__define_uniq_tagged_files = \
217 list='$(am__tagged_files)'; \
218 unique=`for i in $$list; do \
219 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
220 done | $(am__uniquify_input)`
221 AM_RECURSIVE_TARGETS = cscope
222 am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in README.md \
223 compile depcomp install-sh missing
224 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
225 distdir = $(PACKAGE)-$(VERSION)
226 top_distdir = $(distdir)
227 am__remove_distdir = \
228 if test -d "$(distdir)"; then \
229 find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
230 && rm -rf "$(distdir)" \
231 || { sleep 5 && rm -rf "$(distdir)"; }; \
232 else :; fi
233 am__post_remove_distdir = $(am__remove_distdir)
234 DIST_ARCHIVES = $(distdir).tar.gz
235 GZIP_ENV = --best
236 DIST_TARGETS = dist-gzip
237 # Exists only to be overridden by the user if desired.
238 AM_DISTCHECK_DVI_TARGET = dvi
239 distuninstallcheck_listfiles = find . -type f -print
240 am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
241 | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
242 distcleancheck_listfiles = find . -type f -print
243 ACLOCAL = @ACLOCAL@
244 AMTAR = @AMTAR@
245 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
246 AUTOCONF = @AUTOCONF@
247 AUTOHEADER = @AUTOHEADER@
248 AUTOMAKE = @AUTOMAKE@
249 AWK = @AWK@
250 CC = @CC@
251 CCDEPMODE = @CCDEPMODE@
252 CFLAGS = @CFLAGS@
253 CPPFLAGS = @CPPFLAGS@
254 CSCOPE = @CSCOPE@
255 CTAGS = @CTAGS@
256 CYGPATH_W = @CYGPATH_W@
257 DEFS = @DEFS@
258 DEPDIR = @DEPDIR@
259 ECHO_C = @ECHO_C@
260 ECHO_N = @ECHO_N@
261 ECHO_T = @ECHO_T@
262 ETAGS = @ETAGS@
263 EXEEXT = @EXEEXT@
264 GIT = @GIT@
265 INSTALL = @INSTALL@
266 INSTALL_DATA = @INSTALL_DATA@
267 INSTALL_PROGRAM = @INSTALL_PROGRAM@
268 INSTALL_SCRIPT = @INSTALL_SCRIPT@
269 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
270 LDFLAGS = @LDFLAGS@
271 LIBOBJS = @LIBOBJS@
272 LIBS = @LIBS@
273 LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@
274 LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@
275 LTLIBOBJS = @LTLIBOBJS@
276 MAKEINFO = @MAKEINFO@
277 MKDIR_P = @MKDIR_P@
278 NETSTAT_PATH = @NETSTAT_PATH@
279 OBJEXT = @OBJEXT@
280 OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
281 OPENSSL_LIBS = @OPENSSL_LIBS@
282 PACKAGE = @PACKAGE@
283 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
284 PACKAGE_NAME = @PACKAGE_NAME@
285 PACKAGE_STRING = @PACKAGE_STRING@
286 PACKAGE_TARNAME = @PACKAGE_TARNAME@
287 PACKAGE_URL = @PACKAGE_URL@
288 PACKAGE_VERSION = @PACKAGE_VERSION@
289 PATH_SEPARATOR = @PATH_SEPARATOR@
290 PKG_CONFIG = @PKG_CONFIG@
291 PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
292 PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
293 PPP = @PPP@
294 PPPD = @PPPD@
295 PPP_PATH = @PPP_PATH@
296 RESOLVCONF_PATH = @RESOLVCONF_PATH@
297 REVISION = @REVISION@
298 SED = @SED@
299 SET_MAKE = @SET_MAKE@
300 SHELL = @SHELL@
301 STRIP = @STRIP@
302 VERSION = @VERSION@
303 abs_builddir = @abs_builddir@
304 abs_srcdir = @abs_srcdir@
305 abs_top_builddir = @abs_top_builddir@
306 abs_top_srcdir = @abs_top_srcdir@
307 ac_ct_CC = @ac_ct_CC@
308 am__include = @am__include@
309 am__leading_dot = @am__leading_dot@
310 am__quote = @am__quote@
311 am__tar = @am__tar@
312 am__untar = @am__untar@
313 bindir = @bindir@
314 build_alias = @build_alias@
315 builddir = @builddir@
316
317 # configuration file template
318 datadir = $(prefix)/share/@PACKAGE@
319 datarootdir = @datarootdir@
320 docdir = @docdir@
321 dvidir = @dvidir@
322 exec_prefix = @exec_prefix@
323 host_alias = @host_alias@
324 htmldir = @htmldir@
325 includedir = @includedir@
326 infodir = @infodir@
327 install_sh = @install_sh@
328 libdir = @libdir@
329 libexecdir = @libexecdir@
330 localedir = @localedir@
331 localstatedir = @localstatedir@
332 mandir = @mandir@
333 mkdir_p = @mkdir_p@
334 oldincludedir = @oldincludedir@
335 pdfdir = @pdfdir@
336 prefix = @prefix@
337 program_transform_name = @program_transform_name@
338 psdir = @psdir@
339 runstatedir = @runstatedir@
340 sbindir = @sbindir@
341 sharedstatedir = @sharedstatedir@
342 srcdir = @srcdir@
343 sysconfdir = @sysconfdir@
344 systemdsystemunitdir = @systemdsystemunitdir@
345 target_alias = @target_alias@
346 top_build_prefix = @top_build_prefix@
347 top_builddir = @top_builddir@
348 top_srcdir = @top_srcdir@
349 openfortivpn_SOURCES = src/config.c src/config.h src/hdlc.c src/hdlc.h \
350 src/http.c src/http.h src/io.c src/io.h src/ipv4.c \
351 src/ipv4.h src/log.c src/log.h src/tunnel.c \
352 src/tunnel.h src/main.c src/ssl.h src/xml.c \
353 src/xml.h src/userinput.c src/userinput.h \
354 src/openssl_hostname_validation.c \
355 src/openssl_hostname_validation.h
356
357 openfortivpn_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" \
358 -DPPP_PATH=\"@PPP_PATH@\" \
359 -DNETSTAT_PATH=\"@NETSTAT_PATH@\" \
360 -DRESOLVCONF_PATH=\"@RESOLVCONF_PATH@\" \
361 -DREVISION=\"@REVISION@\" \
362 $(OPENSSL_CFLAGS) $(LIBSYSTEMD_CFLAGS)
363
364 openfortivpn_CFLAGS = -Wall -pedantic
365 openfortivpn_LDADD = $(OPENSSL_LIBS) $(LIBSYSTEMD_LIBS)
366
367 # systemd service file
368
369 # man page
370 PATHFILES = lib/systemd/system/openfortivpn@.service \
371 doc/openfortivpn.1
372 CLEAN_LOCALS = clean-local-config $(am__append_1) clean-local-man
373 EXTRA_DIST = autogen.sh CHANGELOG.md LICENSE LICENSE.OpenSSL README.md \
374 $(data_DATA) $(PATHFILES:=.in)
375 DISTCHECK_CONFIGURE_FLAGS = \
376 CFLAGS=-Werror \
377 --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
378
379 data_DATA = etc/openfortivpn/config.template
380
381 # initial configuration file
382 confdir = $(sysconfdir)/@PACKAGE@
383 @HAVE_SYSTEMD_TRUE@systemdsystemunit_DATA = lib/systemd/system/openfortivpn@.service
384 dist_man_MANS = doc/openfortivpn.1
385 all: all-am
386
387 .SUFFIXES:
388 .SUFFIXES: .c .o .obj
389 am--refresh: Makefile
390 @:
391 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
392 @for dep in $?; do \
393 case '$(am__configure_deps)' in \
394 *$$dep*) \
395 echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
396 $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
397 && exit 0; \
398 exit 1;; \
399 esac; \
400 done; \
401 echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
402 $(am__cd) $(top_srcdir) && \
403 $(AUTOMAKE) --foreign Makefile
404 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
405 @case '$?' in \
406 *config.status*) \
407 echo ' $(SHELL) ./config.status'; \
408 $(SHELL) ./config.status;; \
409 *) \
410 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
411 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
412 esac;
413
414 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
415 $(SHELL) ./config.status --recheck
416
417 $(top_srcdir)/configure: $(am__configure_deps)
418 $(am__cd) $(srcdir) && $(AUTOCONF)
419 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
420 $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
421 $(am__aclocal_m4_deps):
422 install-binPROGRAMS: $(bin_PROGRAMS)
423 @$(NORMAL_INSTALL)
424 @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
425 if test -n "$$list"; then \
426 echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
427 $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
428 fi; \
429 for p in $$list; do echo "$$p $$p"; done | \
430 sed 's/$(EXEEXT)$$//' | \
431 while read p p1; do if test -f $$p \
432 ; then echo "$$p"; echo "$$p"; else :; fi; \
433 done | \
434 sed -e 'p;s,.*/,,;n;h' \
435 -e 's|.*|.|' \
436 -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
437 sed 'N;N;N;s,\n, ,g' | \
438 $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
439 { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
440 if ($$2 == $$4) files[d] = files[d] " " $$1; \
441 else { print "f", $$3 "/" $$4, $$1; } } \
442 END { for (d in files) print "f", d, files[d] }' | \
443 while read type dir files; do \
444 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
445 test -z "$$files" || { \
446 echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
447 $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
448 } \
449 ; done
450
451 uninstall-binPROGRAMS:
452 @$(NORMAL_UNINSTALL)
453 @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
454 files=`for p in $$list; do echo "$$p"; done | \
455 sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
456 -e 's/$$/$(EXEEXT)/' \
457 `; \
458 test -n "$$list" || exit 0; \
459 echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
460 cd "$(DESTDIR)$(bindir)" && rm -f $$files
461
462 clean-binPROGRAMS:
463 -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
464 src/$(am__dirstamp):
465 @$(MKDIR_P) src
466 @: > src/$(am__dirstamp)
467 src/$(DEPDIR)/$(am__dirstamp):
468 @$(MKDIR_P) src/$(DEPDIR)
469 @: > src/$(DEPDIR)/$(am__dirstamp)
470 src/openfortivpn-config.$(OBJEXT): src/$(am__dirstamp) \
471 src/$(DEPDIR)/$(am__dirstamp)
472 src/openfortivpn-hdlc.$(OBJEXT): src/$(am__dirstamp) \
473 src/$(DEPDIR)/$(am__dirstamp)
474 src/openfortivpn-http.$(OBJEXT): src/$(am__dirstamp) \
475 src/$(DEPDIR)/$(am__dirstamp)
476 src/openfortivpn-io.$(OBJEXT): src/$(am__dirstamp) \
477 src/$(DEPDIR)/$(am__dirstamp)
478 src/openfortivpn-ipv4.$(OBJEXT): src/$(am__dirstamp) \
479 src/$(DEPDIR)/$(am__dirstamp)
480 src/openfortivpn-log.$(OBJEXT): src/$(am__dirstamp) \
481 src/$(DEPDIR)/$(am__dirstamp)
482 src/openfortivpn-tunnel.$(OBJEXT): src/$(am__dirstamp) \
483 src/$(DEPDIR)/$(am__dirstamp)
484 src/openfortivpn-main.$(OBJEXT): src/$(am__dirstamp) \
485 src/$(DEPDIR)/$(am__dirstamp)
486 src/openfortivpn-xml.$(OBJEXT): src/$(am__dirstamp) \
487 src/$(DEPDIR)/$(am__dirstamp)
488 src/openfortivpn-userinput.$(OBJEXT): src/$(am__dirstamp) \
489 src/$(DEPDIR)/$(am__dirstamp)
490 src/openfortivpn-openssl_hostname_validation.$(OBJEXT): \
491 src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
492
493 openfortivpn$(EXEEXT): $(openfortivpn_OBJECTS) $(openfortivpn_DEPENDENCIES) $(EXTRA_openfortivpn_DEPENDENCIES)
494 @rm -f openfortivpn$(EXEEXT)
495 $(AM_V_CCLD)$(openfortivpn_LINK) $(openfortivpn_OBJECTS) $(openfortivpn_LDADD) $(LIBS)
496
497 mostlyclean-compile:
498 -rm -f *.$(OBJEXT)
499 -rm -f src/*.$(OBJEXT)
500
501 distclean-compile:
502 -rm -f *.tab.c
503
504 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-config.Po@am__quote@ # am--include-marker
505 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-hdlc.Po@am__quote@ # am--include-marker
506 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-http.Po@am__quote@ # am--include-marker
507 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-io.Po@am__quote@ # am--include-marker
508 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-ipv4.Po@am__quote@ # am--include-marker
509 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-log.Po@am__quote@ # am--include-marker
510 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-main.Po@am__quote@ # am--include-marker
511 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Po@am__quote@ # am--include-marker
512 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-tunnel.Po@am__quote@ # am--include-marker
513 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-userinput.Po@am__quote@ # am--include-marker
514 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/openfortivpn-xml.Po@am__quote@ # am--include-marker
515
516 $(am__depfiles_remade):
517 @$(MKDIR_P) $(@D)
518 @echo '# dummy' >$@-t && $(am__mv) $@-t $@
519
520 am--depfiles: $(am__depfiles_remade)
521
522 .c.o:
523 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
524 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
525 @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
526 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
527 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
528 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
529
530 .c.obj:
531 @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
532 @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
533 @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
534 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
535 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
536 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
537
538 src/openfortivpn-config.o: src/config.c
539 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-config.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-config.Tpo -c -o src/openfortivpn-config.o `test -f 'src/config.c' || echo '$(srcdir)/'`src/config.c
540 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-config.Tpo src/$(DEPDIR)/openfortivpn-config.Po
541 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/config.c' object='src/openfortivpn-config.o' libtool=no @AMDEPBACKSLASH@
542 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
543 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-config.o `test -f 'src/config.c' || echo '$(srcdir)/'`src/config.c
544
545 src/openfortivpn-config.obj: src/config.c
546 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-config.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-config.Tpo -c -o src/openfortivpn-config.obj `if test -f 'src/config.c'; then $(CYGPATH_W) 'src/config.c'; else $(CYGPATH_W) '$(srcdir)/src/config.c'; fi`
547 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-config.Tpo src/$(DEPDIR)/openfortivpn-config.Po
548 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/config.c' object='src/openfortivpn-config.obj' libtool=no @AMDEPBACKSLASH@
549 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
550 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-config.obj `if test -f 'src/config.c'; then $(CYGPATH_W) 'src/config.c'; else $(CYGPATH_W) '$(srcdir)/src/config.c'; fi`
551
552 src/openfortivpn-hdlc.o: src/hdlc.c
553 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-hdlc.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-hdlc.Tpo -c -o src/openfortivpn-hdlc.o `test -f 'src/hdlc.c' || echo '$(srcdir)/'`src/hdlc.c
554 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-hdlc.Tpo src/$(DEPDIR)/openfortivpn-hdlc.Po
555 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/hdlc.c' object='src/openfortivpn-hdlc.o' libtool=no @AMDEPBACKSLASH@
556 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
557 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-hdlc.o `test -f 'src/hdlc.c' || echo '$(srcdir)/'`src/hdlc.c
558
559 src/openfortivpn-hdlc.obj: src/hdlc.c
560 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-hdlc.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-hdlc.Tpo -c -o src/openfortivpn-hdlc.obj `if test -f 'src/hdlc.c'; then $(CYGPATH_W) 'src/hdlc.c'; else $(CYGPATH_W) '$(srcdir)/src/hdlc.c'; fi`
561 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-hdlc.Tpo src/$(DEPDIR)/openfortivpn-hdlc.Po
562 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/hdlc.c' object='src/openfortivpn-hdlc.obj' libtool=no @AMDEPBACKSLASH@
563 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
564 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-hdlc.obj `if test -f 'src/hdlc.c'; then $(CYGPATH_W) 'src/hdlc.c'; else $(CYGPATH_W) '$(srcdir)/src/hdlc.c'; fi`
565
566 src/openfortivpn-http.o: src/http.c
567 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-http.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-http.Tpo -c -o src/openfortivpn-http.o `test -f 'src/http.c' || echo '$(srcdir)/'`src/http.c
568 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-http.Tpo src/$(DEPDIR)/openfortivpn-http.Po
569 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/http.c' object='src/openfortivpn-http.o' libtool=no @AMDEPBACKSLASH@
570 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
571 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-http.o `test -f 'src/http.c' || echo '$(srcdir)/'`src/http.c
572
573 src/openfortivpn-http.obj: src/http.c
574 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-http.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-http.Tpo -c -o src/openfortivpn-http.obj `if test -f 'src/http.c'; then $(CYGPATH_W) 'src/http.c'; else $(CYGPATH_W) '$(srcdir)/src/http.c'; fi`
575 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-http.Tpo src/$(DEPDIR)/openfortivpn-http.Po
576 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/http.c' object='src/openfortivpn-http.obj' libtool=no @AMDEPBACKSLASH@
577 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
578 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-http.obj `if test -f 'src/http.c'; then $(CYGPATH_W) 'src/http.c'; else $(CYGPATH_W) '$(srcdir)/src/http.c'; fi`
579
580 src/openfortivpn-io.o: src/io.c
581 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-io.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-io.Tpo -c -o src/openfortivpn-io.o `test -f 'src/io.c' || echo '$(srcdir)/'`src/io.c
582 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-io.Tpo src/$(DEPDIR)/openfortivpn-io.Po
583 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/io.c' object='src/openfortivpn-io.o' libtool=no @AMDEPBACKSLASH@
584 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
585 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-io.o `test -f 'src/io.c' || echo '$(srcdir)/'`src/io.c
586
587 src/openfortivpn-io.obj: src/io.c
588 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-io.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-io.Tpo -c -o src/openfortivpn-io.obj `if test -f 'src/io.c'; then $(CYGPATH_W) 'src/io.c'; else $(CYGPATH_W) '$(srcdir)/src/io.c'; fi`
589 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-io.Tpo src/$(DEPDIR)/openfortivpn-io.Po
590 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/io.c' object='src/openfortivpn-io.obj' libtool=no @AMDEPBACKSLASH@
591 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
592 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-io.obj `if test -f 'src/io.c'; then $(CYGPATH_W) 'src/io.c'; else $(CYGPATH_W) '$(srcdir)/src/io.c'; fi`
593
594 src/openfortivpn-ipv4.o: src/ipv4.c
595 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-ipv4.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-ipv4.Tpo -c -o src/openfortivpn-ipv4.o `test -f 'src/ipv4.c' || echo '$(srcdir)/'`src/ipv4.c
596 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-ipv4.Tpo src/$(DEPDIR)/openfortivpn-ipv4.Po
597 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ipv4.c' object='src/openfortivpn-ipv4.o' libtool=no @AMDEPBACKSLASH@
598 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
599 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-ipv4.o `test -f 'src/ipv4.c' || echo '$(srcdir)/'`src/ipv4.c
600
601 src/openfortivpn-ipv4.obj: src/ipv4.c
602 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-ipv4.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-ipv4.Tpo -c -o src/openfortivpn-ipv4.obj `if test -f 'src/ipv4.c'; then $(CYGPATH_W) 'src/ipv4.c'; else $(CYGPATH_W) '$(srcdir)/src/ipv4.c'; fi`
603 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-ipv4.Tpo src/$(DEPDIR)/openfortivpn-ipv4.Po
604 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/ipv4.c' object='src/openfortivpn-ipv4.obj' libtool=no @AMDEPBACKSLASH@
605 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
606 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-ipv4.obj `if test -f 'src/ipv4.c'; then $(CYGPATH_W) 'src/ipv4.c'; else $(CYGPATH_W) '$(srcdir)/src/ipv4.c'; fi`
607
608 src/openfortivpn-log.o: src/log.c
609 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-log.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-log.Tpo -c -o src/openfortivpn-log.o `test -f 'src/log.c' || echo '$(srcdir)/'`src/log.c
610 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-log.Tpo src/$(DEPDIR)/openfortivpn-log.Po
611 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/log.c' object='src/openfortivpn-log.o' libtool=no @AMDEPBACKSLASH@
612 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
613 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-log.o `test -f 'src/log.c' || echo '$(srcdir)/'`src/log.c
614
615 src/openfortivpn-log.obj: src/log.c
616 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-log.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-log.Tpo -c -o src/openfortivpn-log.obj `if test -f 'src/log.c'; then $(CYGPATH_W) 'src/log.c'; else $(CYGPATH_W) '$(srcdir)/src/log.c'; fi`
617 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-log.Tpo src/$(DEPDIR)/openfortivpn-log.Po
618 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/log.c' object='src/openfortivpn-log.obj' libtool=no @AMDEPBACKSLASH@
619 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
620 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-log.obj `if test -f 'src/log.c'; then $(CYGPATH_W) 'src/log.c'; else $(CYGPATH_W) '$(srcdir)/src/log.c'; fi`
621
622 src/openfortivpn-tunnel.o: src/tunnel.c
623 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-tunnel.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-tunnel.Tpo -c -o src/openfortivpn-tunnel.o `test -f 'src/tunnel.c' || echo '$(srcdir)/'`src/tunnel.c
624 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-tunnel.Tpo src/$(DEPDIR)/openfortivpn-tunnel.Po
625 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/tunnel.c' object='src/openfortivpn-tunnel.o' libtool=no @AMDEPBACKSLASH@
626 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
627 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-tunnel.o `test -f 'src/tunnel.c' || echo '$(srcdir)/'`src/tunnel.c
628
629 src/openfortivpn-tunnel.obj: src/tunnel.c
630 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-tunnel.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-tunnel.Tpo -c -o src/openfortivpn-tunnel.obj `if test -f 'src/tunnel.c'; then $(CYGPATH_W) 'src/tunnel.c'; else $(CYGPATH_W) '$(srcdir)/src/tunnel.c'; fi`
631 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-tunnel.Tpo src/$(DEPDIR)/openfortivpn-tunnel.Po
632 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/tunnel.c' object='src/openfortivpn-tunnel.obj' libtool=no @AMDEPBACKSLASH@
633 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
634 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-tunnel.obj `if test -f 'src/tunnel.c'; then $(CYGPATH_W) 'src/tunnel.c'; else $(CYGPATH_W) '$(srcdir)/src/tunnel.c'; fi`
635
636 src/openfortivpn-main.o: src/main.c
637 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-main.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-main.Tpo -c -o src/openfortivpn-main.o `test -f 'src/main.c' || echo '$(srcdir)/'`src/main.c
638 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-main.Tpo src/$(DEPDIR)/openfortivpn-main.Po
639 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/main.c' object='src/openfortivpn-main.o' libtool=no @AMDEPBACKSLASH@
640 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
641 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-main.o `test -f 'src/main.c' || echo '$(srcdir)/'`src/main.c
642
643 src/openfortivpn-main.obj: src/main.c
644 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-main.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-main.Tpo -c -o src/openfortivpn-main.obj `if test -f 'src/main.c'; then $(CYGPATH_W) 'src/main.c'; else $(CYGPATH_W) '$(srcdir)/src/main.c'; fi`
645 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-main.Tpo src/$(DEPDIR)/openfortivpn-main.Po
646 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/main.c' object='src/openfortivpn-main.obj' libtool=no @AMDEPBACKSLASH@
647 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
648 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-main.obj `if test -f 'src/main.c'; then $(CYGPATH_W) 'src/main.c'; else $(CYGPATH_W) '$(srcdir)/src/main.c'; fi`
649
650 src/openfortivpn-xml.o: src/xml.c
651 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-xml.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-xml.Tpo -c -o src/openfortivpn-xml.o `test -f 'src/xml.c' || echo '$(srcdir)/'`src/xml.c
652 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-xml.Tpo src/$(DEPDIR)/openfortivpn-xml.Po
653 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/xml.c' object='src/openfortivpn-xml.o' libtool=no @AMDEPBACKSLASH@
654 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
655 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-xml.o `test -f 'src/xml.c' || echo '$(srcdir)/'`src/xml.c
656
657 src/openfortivpn-xml.obj: src/xml.c
658 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-xml.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-xml.Tpo -c -o src/openfortivpn-xml.obj `if test -f 'src/xml.c'; then $(CYGPATH_W) 'src/xml.c'; else $(CYGPATH_W) '$(srcdir)/src/xml.c'; fi`
659 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-xml.Tpo src/$(DEPDIR)/openfortivpn-xml.Po
660 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/xml.c' object='src/openfortivpn-xml.obj' libtool=no @AMDEPBACKSLASH@
661 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
662 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-xml.obj `if test -f 'src/xml.c'; then $(CYGPATH_W) 'src/xml.c'; else $(CYGPATH_W) '$(srcdir)/src/xml.c'; fi`
663
664 src/openfortivpn-userinput.o: src/userinput.c
665 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-userinput.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-userinput.Tpo -c -o src/openfortivpn-userinput.o `test -f 'src/userinput.c' || echo '$(srcdir)/'`src/userinput.c
666 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-userinput.Tpo src/$(DEPDIR)/openfortivpn-userinput.Po
667 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/userinput.c' object='src/openfortivpn-userinput.o' libtool=no @AMDEPBACKSLASH@
668 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
669 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-userinput.o `test -f 'src/userinput.c' || echo '$(srcdir)/'`src/userinput.c
670
671 src/openfortivpn-userinput.obj: src/userinput.c
672 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-userinput.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-userinput.Tpo -c -o src/openfortivpn-userinput.obj `if test -f 'src/userinput.c'; then $(CYGPATH_W) 'src/userinput.c'; else $(CYGPATH_W) '$(srcdir)/src/userinput.c'; fi`
673 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-userinput.Tpo src/$(DEPDIR)/openfortivpn-userinput.Po
674 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/userinput.c' object='src/openfortivpn-userinput.obj' libtool=no @AMDEPBACKSLASH@
675 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
676 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-userinput.obj `if test -f 'src/userinput.c'; then $(CYGPATH_W) 'src/userinput.c'; else $(CYGPATH_W) '$(srcdir)/src/userinput.c'; fi`
677
678 src/openfortivpn-openssl_hostname_validation.o: src/openssl_hostname_validation.c
679 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-openssl_hostname_validation.o -MD -MP -MF src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Tpo -c -o src/openfortivpn-openssl_hostname_validation.o `test -f 'src/openssl_hostname_validation.c' || echo '$(srcdir)/'`src/openssl_hostname_validation.c
680 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Tpo src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Po
681 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/openssl_hostname_validation.c' object='src/openfortivpn-openssl_hostname_validation.o' libtool=no @AMDEPBACKSLASH@
682 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
683 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-openssl_hostname_validation.o `test -f 'src/openssl_hostname_validation.c' || echo '$(srcdir)/'`src/openssl_hostname_validation.c
684
685 src/openfortivpn-openssl_hostname_validation.obj: src/openssl_hostname_validation.c
686 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -MT src/openfortivpn-openssl_hostname_validation.obj -MD -MP -MF src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Tpo -c -o src/openfortivpn-openssl_hostname_validation.obj `if test -f 'src/openssl_hostname_validation.c'; then $(CYGPATH_W) 'src/openssl_hostname_validation.c'; else $(CYGPATH_W) '$(srcdir)/src/openssl_hostname_validation.c'; fi`
687 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Tpo src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Po
688 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/openssl_hostname_validation.c' object='src/openfortivpn-openssl_hostname_validation.obj' libtool=no @AMDEPBACKSLASH@
689 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
690 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openfortivpn_CPPFLAGS) $(CPPFLAGS) $(openfortivpn_CFLAGS) $(CFLAGS) -c -o src/openfortivpn-openssl_hostname_validation.obj `if test -f 'src/openssl_hostname_validation.c'; then $(CYGPATH_W) 'src/openssl_hostname_validation.c'; else $(CYGPATH_W) '$(srcdir)/src/openssl_hostname_validation.c'; fi`
691 install-man1: $(dist_man_MANS)
692 @$(NORMAL_INSTALL)
693 @list1=''; \
694 list2='$(dist_man_MANS)'; \
695 test -n "$(man1dir)" \
696 && test -n "`echo $$list1$$list2`" \
697 || exit 0; \
698 echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
699 $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
700 { for i in $$list1; do echo "$$i"; done; \
701 if test -n "$$list2"; then \
702 for i in $$list2; do echo "$$i"; done \
703 | sed -n '/\.1[a-z]*$$/p'; \
704 fi; \
705 } | while read p; do \
706 if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
707 echo "$$d$$p"; echo "$$p"; \
708 done | \
709 sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
710 -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
711 sed 'N;N;s,\n, ,g' | { \
712 list=; while read file base inst; do \
713 if test "$$base" = "$$inst"; then list="$$list $$file"; else \
714 echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
715 $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
716 fi; \
717 done; \
718 for i in $$list; do echo "$$i"; done | $(am__base_list) | \
719 while read files; do \
720 test -z "$$files" || { \
721 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
722 $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
723 done; }
724
725 uninstall-man1:
726 @$(NORMAL_UNINSTALL)
727 @list=''; test -n "$(man1dir)" || exit 0; \
728 files=`{ for i in $$list; do echo "$$i"; done; \
729 l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
730 sed -n '/\.1[a-z]*$$/p'; \
731 } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
732 -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
733 dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
734 install-dataDATA: $(data_DATA)
735 @$(NORMAL_INSTALL)
736 @list='$(data_DATA)'; test -n "$(datadir)" || list=; \
737 if test -n "$$list"; then \
738 echo " $(MKDIR_P) '$(DESTDIR)$(datadir)'"; \
739 $(MKDIR_P) "$(DESTDIR)$(datadir)" || exit 1; \
740 fi; \
741 for p in $$list; do \
742 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
743 echo "$$d$$p"; \
744 done | $(am__base_list) | \
745 while read files; do \
746 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(datadir)'"; \
747 $(INSTALL_DATA) $$files "$(DESTDIR)$(datadir)" || exit $$?; \
748 done
749
750 uninstall-dataDATA:
751 @$(NORMAL_UNINSTALL)
752 @list='$(data_DATA)'; test -n "$(datadir)" || list=; \
753 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
754 dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir)
755 install-systemdsystemunitDATA: $(systemdsystemunit_DATA)
756 @$(NORMAL_INSTALL)
757 @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
758 if test -n "$$list"; then \
759 echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemunitdir)'"; \
760 $(MKDIR_P) "$(DESTDIR)$(systemdsystemunitdir)" || exit 1; \
761 fi; \
762 for p in $$list; do \
763 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
764 echo "$$d$$p"; \
765 done | $(am__base_list) | \
766 while read files; do \
767 echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdsystemunitdir)'"; \
768 $(INSTALL_DATA) $$files "$(DESTDIR)$(systemdsystemunitdir)" || exit $$?; \
769 done
770
771 uninstall-systemdsystemunitDATA:
772 @$(NORMAL_UNINSTALL)
773 @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \
774 files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
775 dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir)
776
777 ID: $(am__tagged_files)
778 $(am__define_uniq_tagged_files); mkid -fID $$unique
779 tags: tags-am
780 TAGS: tags
781
782 tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
783 set x; \
784 here=`pwd`; \
785 $(am__define_uniq_tagged_files); \
786 shift; \
787 if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
788 test -n "$$unique" || unique=$$empty_fix; \
789 if test $$# -gt 0; then \
790 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
791 "$$@" $$unique; \
792 else \
793 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
794 $$unique; \
795 fi; \
796 fi
797 ctags: ctags-am
798
799 CTAGS: ctags
800 ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
801 $(am__define_uniq_tagged_files); \
802 test -z "$(CTAGS_ARGS)$$unique" \
803 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
804 $$unique
805
806 GTAGS:
807 here=`$(am__cd) $(top_builddir) && pwd` \
808 && $(am__cd) $(top_srcdir) \
809 && gtags -i $(GTAGS_ARGS) "$$here"
810 cscope: cscope.files
811 test ! -s cscope.files \
812 || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
813 clean-cscope:
814 -rm -f cscope.files
815 cscope.files: clean-cscope cscopelist
816 cscopelist: cscopelist-am
817
818 cscopelist-am: $(am__tagged_files)
819 list='$(am__tagged_files)'; \
820 case "$(srcdir)" in \
821 [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
822 *) sdir=$(subdir)/$(srcdir) ;; \
823 esac; \
824 for i in $$list; do \
825 if test -f "$$i"; then \
826 echo "$(subdir)/$$i"; \
827 else \
828 echo "$$sdir/$$i"; \
829 fi; \
830 done >> $(top_builddir)/cscope.files
831
832 distclean-tags:
833 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
834 -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
835 distdir: $(BUILT_SOURCES)
836 $(MAKE) $(AM_MAKEFLAGS) distdir-am
837
838 distdir-am: $(DISTFILES)
839 $(am__remove_distdir)
840 test -d "$(distdir)" || mkdir "$(distdir)"
841 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
842 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
843 list='$(DISTFILES)'; \
844 dist_files=`for file in $$list; do echo $$file; done | \
845 sed -e "s|^$$srcdirstrip/||;t" \
846 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
847 case $$dist_files in \
848 */*) $(MKDIR_P) `echo "$$dist_files" | \
849 sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
850 sort -u` ;; \
851 esac; \
852 for file in $$dist_files; do \
853 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
854 if test -d $$d/$$file; then \
855 dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
856 if test -d "$(distdir)/$$file"; then \
857 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
858 fi; \
859 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
860 cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
861 find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
862 fi; \
863 cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
864 else \
865 test -f "$(distdir)/$$file" \
866 || cp -p $$d/$$file "$(distdir)/$$file" \
867 || exit 1; \
868 fi; \
869 done
870 -test -n "$(am__skip_mode_fix)" \
871 || find "$(distdir)" -type d ! -perm -755 \
872 -exec chmod u+rwx,go+rx {} \; -o \
873 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
874 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
875 ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
876 || chmod -R a+r "$(distdir)"
877 dist-gzip: distdir
878 tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
879 $(am__post_remove_distdir)
880
881 dist-bzip2: distdir
882 tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
883 $(am__post_remove_distdir)
884
885 dist-lzip: distdir
886 tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
887 $(am__post_remove_distdir)
888
889 dist-xz: distdir
890 tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
891 $(am__post_remove_distdir)
892
893 dist-zstd: distdir
894 tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
895 $(am__post_remove_distdir)
896
897 dist-tarZ: distdir
898 @echo WARNING: "Support for distribution archives compressed with" \
899 "legacy program 'compress' is deprecated." >&2
900 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
901 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
902 $(am__post_remove_distdir)
903
904 dist-shar: distdir
905 @echo WARNING: "Support for shar distribution archives is" \
906 "deprecated." >&2
907 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
908 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
909 $(am__post_remove_distdir)
910
911 dist-zip: distdir
912 -rm -f $(distdir).zip
913 zip -rq $(distdir).zip $(distdir)
914 $(am__post_remove_distdir)
915
916 dist dist-all:
917 $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
918 $(am__post_remove_distdir)
919
920 # This target untars the dist file and tries a VPATH configuration. Then
921 # it guarantees that the distribution is self-contained by making another
922 # tarfile.
923 distcheck: dist
924 case '$(DIST_ARCHIVES)' in \
925 *.tar.gz*) \
926 eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
927 *.tar.bz2*) \
928 bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
929 *.tar.lz*) \
930 lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
931 *.tar.xz*) \
932 xz -dc $(distdir).tar.xz | $(am__untar) ;;\
933 *.tar.Z*) \
934 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
935 *.shar.gz*) \
936 eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
937 *.zip*) \
938 unzip $(distdir).zip ;;\
939 *.tar.zst*) \
940 zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
941 esac
942 chmod -R a-w $(distdir)
943 chmod u+w $(distdir)
944 mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
945 chmod a-w $(distdir)
946 test -d $(distdir)/_build || exit 0; \
947 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
948 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
949 && am__cwd=`pwd` \
950 && $(am__cd) $(distdir)/_build/sub \
951 && ../../configure \
952 $(AM_DISTCHECK_CONFIGURE_FLAGS) \
953 $(DISTCHECK_CONFIGURE_FLAGS) \
954 --srcdir=../.. --prefix="$$dc_install_base" \
955 && $(MAKE) $(AM_MAKEFLAGS) \
956 && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
957 && $(MAKE) $(AM_MAKEFLAGS) check \
958 && $(MAKE) $(AM_MAKEFLAGS) install \
959 && $(MAKE) $(AM_MAKEFLAGS) installcheck \
960 && $(MAKE) $(AM_MAKEFLAGS) uninstall \
961 && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
962 distuninstallcheck \
963 && chmod -R a-w "$$dc_install_base" \
964 && ({ \
965 (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
966 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
967 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
968 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
969 distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
970 } || { rm -rf "$$dc_destdir"; exit 1; }) \
971 && rm -rf "$$dc_destdir" \
972 && $(MAKE) $(AM_MAKEFLAGS) dist \
973 && rm -rf $(DIST_ARCHIVES) \
974 && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
975 && cd "$$am__cwd" \
976 || exit 1
977 $(am__post_remove_distdir)
978 @(echo "$(distdir) archives ready for distribution: "; \
979 list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
980 sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
981 distuninstallcheck:
982 @test -n '$(distuninstallcheck_dir)' || { \
983 echo 'ERROR: trying to run $@ with an empty' \
984 '$$(distuninstallcheck_dir)' >&2; \
985 exit 1; \
986 }; \
987 $(am__cd) '$(distuninstallcheck_dir)' || { \
988 echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
989 exit 1; \
990 }; \
991 test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
992 || { echo "ERROR: files left after uninstall:" ; \
993 if test -n "$(DESTDIR)"; then \
994 echo " (check DESTDIR support)"; \
995 fi ; \
996 $(distuninstallcheck_listfiles) ; \
997 exit 1; } >&2
998 distcleancheck: distclean
999 @if test '$(srcdir)' = . ; then \
1000 echo "ERROR: distcleancheck can only run from a VPATH build" ; \
1001 exit 1 ; \
1002 fi
1003 @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
1004 || { echo "ERROR: files left in build directory after distclean:" ; \
1005 $(distcleancheck_listfiles) ; \
1006 exit 1; } >&2
1007 check-am: all-am
1008 check: check-am
1009 all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) all-local
1010 installdirs:
1011 for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(datadir)" "$(DESTDIR)$(systemdsystemunitdir)"; do \
1012 test -z "$$dir" || $(MKDIR_P) "$$dir"; \
1013 done
1014 install: install-am
1015 install-exec: install-exec-am
1016 install-data: install-data-am
1017 uninstall: uninstall-am
1018
1019 install-am: all-am
1020 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
1021
1022 installcheck: installcheck-am
1023 install-strip:
1024 if test -z '$(STRIP)'; then \
1025 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1026 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1027 install; \
1028 else \
1029 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
1030 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
1031 "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
1032 fi
1033 mostlyclean-generic:
1034
1035 clean-generic:
1036
1037 distclean-generic:
1038 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
1039 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
1040 -rm -f src/$(DEPDIR)/$(am__dirstamp)
1041 -rm -f src/$(am__dirstamp)
1042
1043 maintainer-clean-generic:
1044 @echo "This command is intended for maintainers to use"
1045 @echo "it deletes files that may require special tools to rebuild."
1046 clean: clean-am
1047
1048 clean-am: clean-binPROGRAMS clean-generic clean-local mostlyclean-am
1049
1050 distclean: distclean-am
1051 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
1052 -rm -f src/$(DEPDIR)/openfortivpn-config.Po
1053 -rm -f src/$(DEPDIR)/openfortivpn-hdlc.Po
1054 -rm -f src/$(DEPDIR)/openfortivpn-http.Po
1055 -rm -f src/$(DEPDIR)/openfortivpn-io.Po
1056 -rm -f src/$(DEPDIR)/openfortivpn-ipv4.Po
1057 -rm -f src/$(DEPDIR)/openfortivpn-log.Po
1058 -rm -f src/$(DEPDIR)/openfortivpn-main.Po
1059 -rm -f src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Po
1060 -rm -f src/$(DEPDIR)/openfortivpn-tunnel.Po
1061 -rm -f src/$(DEPDIR)/openfortivpn-userinput.Po
1062 -rm -f src/$(DEPDIR)/openfortivpn-xml.Po
1063 -rm -f Makefile
1064 distclean-am: clean-am distclean-compile distclean-generic \
1065 distclean-tags
1066
1067 dvi: dvi-am
1068
1069 dvi-am:
1070
1071 html: html-am
1072
1073 html-am:
1074
1075 info: info-am
1076
1077 info-am:
1078
1079 install-data-am: install-dataDATA install-man \
1080 install-systemdsystemunitDATA
1081 @$(NORMAL_INSTALL)
1082 $(MAKE) $(AM_MAKEFLAGS) install-data-hook
1083 install-dvi: install-dvi-am
1084
1085 install-dvi-am:
1086
1087 install-exec-am: install-binPROGRAMS
1088
1089 install-html: install-html-am
1090
1091 install-html-am:
1092
1093 install-info: install-info-am
1094
1095 install-info-am:
1096
1097 install-man: install-man1
1098
1099 install-pdf: install-pdf-am
1100
1101 install-pdf-am:
1102
1103 install-ps: install-ps-am
1104
1105 install-ps-am:
1106
1107 installcheck-am:
1108
1109 maintainer-clean: maintainer-clean-am
1110 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
1111 -rm -rf $(top_srcdir)/autom4te.cache
1112 -rm -f src/$(DEPDIR)/openfortivpn-config.Po
1113 -rm -f src/$(DEPDIR)/openfortivpn-hdlc.Po
1114 -rm -f src/$(DEPDIR)/openfortivpn-http.Po
1115 -rm -f src/$(DEPDIR)/openfortivpn-io.Po
1116 -rm -f src/$(DEPDIR)/openfortivpn-ipv4.Po
1117 -rm -f src/$(DEPDIR)/openfortivpn-log.Po
1118 -rm -f src/$(DEPDIR)/openfortivpn-main.Po
1119 -rm -f src/$(DEPDIR)/openfortivpn-openssl_hostname_validation.Po
1120 -rm -f src/$(DEPDIR)/openfortivpn-tunnel.Po
1121 -rm -f src/$(DEPDIR)/openfortivpn-userinput.Po
1122 -rm -f src/$(DEPDIR)/openfortivpn-xml.Po
1123 -rm -f Makefile
1124 maintainer-clean-am: distclean-am maintainer-clean-generic
1125
1126 mostlyclean: mostlyclean-am
1127
1128 mostlyclean-am: mostlyclean-compile mostlyclean-generic
1129
1130 pdf: pdf-am
1131
1132 pdf-am:
1133
1134 ps: ps-am
1135
1136 ps-am:
1137
1138 uninstall-am: uninstall-binPROGRAMS uninstall-dataDATA uninstall-man \
1139 uninstall-systemdsystemunitDATA
1140
1141 uninstall-man: uninstall-man1
1142
1143 .MAKE: install-am install-data-am install-strip
1144
1145 .PHONY: CTAGS GTAGS TAGS all all-am all-local am--depfiles am--refresh \
1146 check check-am clean clean-binPROGRAMS clean-cscope \
1147 clean-generic clean-local cscope cscopelist-am ctags ctags-am \
1148 dist dist-all dist-bzip2 dist-gzip dist-lzip dist-shar \
1149 dist-tarZ dist-xz dist-zip dist-zstd distcheck distclean \
1150 distclean-compile distclean-generic distclean-tags \
1151 distcleancheck distdir distuninstallcheck dvi dvi-am html \
1152 html-am info info-am install install-am install-binPROGRAMS \
1153 install-data install-data-am install-data-hook \
1154 install-dataDATA install-dvi install-dvi-am install-exec \
1155 install-exec-am install-html install-html-am install-info \
1156 install-info-am install-man install-man1 install-pdf \
1157 install-pdf-am install-ps install-ps-am install-strip \
1158 install-systemdsystemunitDATA installcheck installcheck-am \
1159 installdirs maintainer-clean maintainer-clean-generic \
1160 mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \
1161 ps ps-am tags tags-am uninstall uninstall-am \
1162 uninstall-binPROGRAMS uninstall-dataDATA uninstall-man \
1163 uninstall-man1 uninstall-systemdsystemunitDATA
1164
1165 .PRECIOUS: Makefile
1166
1167
1168 etc/openfortivpn/config: $(srcdir)/etc/openfortivpn/config.template
1169 @$(MKDIR_P) etc/openfortivpn
1170 $(AM_V_GEN)$(SED) -e '/^#/n;/^\s*$$/n;s/^/# /' $(srcdir)/etc/openfortivpn/config.template >$@
1171
1172 install-data-hook: etc/openfortivpn/config
1173 if ! test -f $(DESTDIR)$(confdir)/config ; then \
1174 $(MKDIR_P) $(DESTDIR)$(confdir) ; \
1175 $(INSTALL) -m 600 etc/openfortivpn/config \
1176 $(DESTDIR)$(confdir)/config ; \
1177 fi
1178
1179 clean-local-config:
1180 -rm -f $(top_builddir)/etc/openfortivpn/config
1181
1182 @HAVE_SYSTEMD_TRUE@lib/systemd/system/openfortivpn@.service: $(srcdir)/lib/systemd/system/openfortivpn@.service.in
1183 @HAVE_SYSTEMD_TRUE@ @$(MKDIR_P) lib/systemd/system
1184 @HAVE_SYSTEMD_TRUE@ $(AM_V_GEN)$(SED) -e 's|[@]BINDIR[@]|$(bindir)|g;s|[@]SYSCONFDIR[@]|$(sysconfdir)|g' $(srcdir)/lib/systemd/system/openfortivpn@.service.in >$@
1185
1186 @HAVE_SYSTEMD_TRUE@clean-local-systemd:
1187 @HAVE_SYSTEMD_TRUE@ -rm -f $(top_builddir)/lib/systemd/system/openfortivpn@.service
1188
1189 doc/openfortivpn.1: $(srcdir)/doc/openfortivpn.1.in
1190 @$(MKDIR_P) doc
1191 $(AM_V_GEN)$(SED) -e 's|[@]SYSCONFDIR[@]|$(sysconfdir)|g;s|[@]DATADIR[@]|$(datadir)|g' $(srcdir)/doc/openfortivpn.1.in >$@
1192
1193 clean-local-man:
1194 -rm -f $(top_builddir)/doc/openfortivpn.1
1195
1196 all-local: etc/openfortivpn/config
1197
1198 clean-local: $(CLEAN_LOCALS)
1199
1200 # Tell versions [3.59,3.63) of GNU make to not export all variables.
1201 # Otherwise a system limit (for SysV at least) may be exceeded.
1202 .NOEXPORT:
9494 * [Gentoo](https://packages.gentoo.org/packages/net-vpn/openfortivpn)
9595 * [NixOS](https://github.com/NixOS/nixpkgs/tree/master/pkgs/tools/networking/openfortivpn)
9696 * [Arch Linux](https://www.archlinux.org/packages/community/x86_64/openfortivpn)
97 * [Debian (testing)](https://packages.debian.org/buster/openfortivpn)
98 * [Ubuntu (bionic and later)](https://packages.ubuntu.com/search?keywords=openfortivpn) and [pre-bionic (ppa)](https://launchpad.net/~ar-lex/+archive/ubuntu/fortisslvpn)
97 * [Debian](https://packages.debian.org/stable/openfortivpn)
98 * [Ubuntu](https://packages.ubuntu.com/search?keywords=openfortivpn)
9999 * [Solus](https://dev.getsol.us/source/openfortivpn/)
100100
101101 On macOS both [Homebrew](https://formulae.brew.sh/formula/openfortivpn) and
0 # generated automatically by aclocal 1.16.4 -*- Autoconf -*-
1
2 # Copyright (C) 1996-2021 Free Software Foundation, Inc.
3
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 # PARTICULAR PURPOSE.
12
13 m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
14 m4_ifndef([AC_AUTOCONF_VERSION],
15 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16 m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
17 [m4_warning([this file was generated for autoconf 2.71.
18 You have another version of autoconf. It may work, but is not guaranteed to.
19 If you have problems, you may need to regenerate the build system entirely.
20 To do so, use the procedure documented by the package, typically 'autoreconf'.])])
21
22 # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
23 # serial 12 (pkg-config-0.29.2)
24
25 dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
26 dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
27 dnl
28 dnl This program is free software; you can redistribute it and/or modify
29 dnl it under the terms of the GNU General Public License as published by
30 dnl the Free Software Foundation; either version 2 of the License, or
31 dnl (at your option) any later version.
32 dnl
33 dnl This program is distributed in the hope that it will be useful, but
34 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
35 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
36 dnl General Public License for more details.
37 dnl
38 dnl You should have received a copy of the GNU General Public License
39 dnl along with this program; if not, write to the Free Software
40 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
41 dnl 02111-1307, USA.
42 dnl
43 dnl As a special exception to the GNU General Public License, if you
44 dnl distribute this file as part of a program that contains a
45 dnl configuration script generated by Autoconf, you may include it under
46 dnl the same distribution terms that you use for the rest of that
47 dnl program.
48
49 dnl PKG_PREREQ(MIN-VERSION)
50 dnl -----------------------
51 dnl Since: 0.29
52 dnl
53 dnl Verify that the version of the pkg-config macros are at least
54 dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
55 dnl installed version of pkg-config, this checks the developer's version
56 dnl of pkg.m4 when generating configure.
57 dnl
58 dnl To ensure that this macro is defined, also add:
59 dnl m4_ifndef([PKG_PREREQ],
60 dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
61 dnl
62 dnl See the "Since" comment for each macro you use to see what version
63 dnl of the macros you require.
64 m4_defun([PKG_PREREQ],
65 [m4_define([PKG_MACROS_VERSION], [0.29.2])
66 m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
67 [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
68 ])dnl PKG_PREREQ
69
70 dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
71 dnl ----------------------------------
72 dnl Since: 0.16
73 dnl
74 dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
75 dnl first found in the path. Checks that the version of pkg-config found
76 dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
77 dnl used since that's the first version where most current features of
78 dnl pkg-config existed.
79 AC_DEFUN([PKG_PROG_PKG_CONFIG],
80 [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
81 m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
82 m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
83 AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
84 AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
85 AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
86
87 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
88 AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
89 fi
90 if test -n "$PKG_CONFIG"; then
91 _pkg_min_version=m4_default([$1], [0.9.0])
92 AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
93 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
94 AC_MSG_RESULT([yes])
95 else
96 AC_MSG_RESULT([no])
97 PKG_CONFIG=""
98 fi
99 fi[]dnl
100 ])dnl PKG_PROG_PKG_CONFIG
101
102 dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
103 dnl -------------------------------------------------------------------
104 dnl Since: 0.18
105 dnl
106 dnl Check to see whether a particular set of modules exists. Similar to
107 dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
108 dnl
109 dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
110 dnl only at the first occurence in configure.ac, so if the first place
111 dnl it's called might be skipped (such as if it is within an "if", you
112 dnl have to call PKG_CHECK_EXISTS manually
113 AC_DEFUN([PKG_CHECK_EXISTS],
114 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
115 if test -n "$PKG_CONFIG" && \
116 AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
117 m4_default([$2], [:])
118 m4_ifvaln([$3], [else
119 $3])dnl
120 fi])
121
122 dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
123 dnl ---------------------------------------------
124 dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
125 dnl pkg_failed based on the result.
126 m4_define([_PKG_CONFIG],
127 [if test -n "$$1"; then
128 pkg_cv_[]$1="$$1"
129 elif test -n "$PKG_CONFIG"; then
130 PKG_CHECK_EXISTS([$3],
131 [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
132 test "x$?" != "x0" && pkg_failed=yes ],
133 [pkg_failed=yes])
134 else
135 pkg_failed=untried
136 fi[]dnl
137 ])dnl _PKG_CONFIG
138
139 dnl _PKG_SHORT_ERRORS_SUPPORTED
140 dnl ---------------------------
141 dnl Internal check to see if pkg-config supports short errors.
142 AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
143 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
144 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
145 _pkg_short_errors_supported=yes
146 else
147 _pkg_short_errors_supported=no
148 fi[]dnl
149 ])dnl _PKG_SHORT_ERRORS_SUPPORTED
150
151
152 dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
153 dnl [ACTION-IF-NOT-FOUND])
154 dnl --------------------------------------------------------------
155 dnl Since: 0.4.0
156 dnl
157 dnl Note that if there is a possibility the first call to
158 dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
159 dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
160 AC_DEFUN([PKG_CHECK_MODULES],
161 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
162 AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
163 AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
164
165 pkg_failed=no
166 AC_MSG_CHECKING([for $2])
167
168 _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
169 _PKG_CONFIG([$1][_LIBS], [libs], [$2])
170
171 m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
172 and $1[]_LIBS to avoid the need to call pkg-config.
173 See the pkg-config man page for more details.])
174
175 if test $pkg_failed = yes; then
176 AC_MSG_RESULT([no])
177 _PKG_SHORT_ERRORS_SUPPORTED
178 if test $_pkg_short_errors_supported = yes; then
179 $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
180 else
181 $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
182 fi
183 # Put the nasty error message in config.log where it belongs
184 echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
185
186 m4_default([$4], [AC_MSG_ERROR(
187 [Package requirements ($2) were not met:
188
189 $$1_PKG_ERRORS
190
191 Consider adjusting the PKG_CONFIG_PATH environment variable if you
192 installed software in a non-standard prefix.
193
194 _PKG_TEXT])[]dnl
195 ])
196 elif test $pkg_failed = untried; then
197 AC_MSG_RESULT([no])
198 m4_default([$4], [AC_MSG_FAILURE(
199 [The pkg-config script could not be found or is too old. Make sure it
200 is in your PATH or set the PKG_CONFIG environment variable to the full
201 path to pkg-config.
202
203 _PKG_TEXT
204
205 To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
206 ])
207 else
208 $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
209 $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
210 AC_MSG_RESULT([yes])
211 $3
212 fi[]dnl
213 ])dnl PKG_CHECK_MODULES
214
215
216 dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
217 dnl [ACTION-IF-NOT-FOUND])
218 dnl ---------------------------------------------------------------------
219 dnl Since: 0.29
220 dnl
221 dnl Checks for existence of MODULES and gathers its build flags with
222 dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
223 dnl and VARIABLE-PREFIX_LIBS from --libs.
224 dnl
225 dnl Note that if there is a possibility the first call to
226 dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
227 dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
228 dnl configure.ac.
229 AC_DEFUN([PKG_CHECK_MODULES_STATIC],
230 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
231 _save_PKG_CONFIG=$PKG_CONFIG
232 PKG_CONFIG="$PKG_CONFIG --static"
233 PKG_CHECK_MODULES($@)
234 PKG_CONFIG=$_save_PKG_CONFIG[]dnl
235 ])dnl PKG_CHECK_MODULES_STATIC
236
237
238 dnl PKG_INSTALLDIR([DIRECTORY])
239 dnl -------------------------
240 dnl Since: 0.27
241 dnl
242 dnl Substitutes the variable pkgconfigdir as the location where a module
243 dnl should install pkg-config .pc files. By default the directory is
244 dnl $libdir/pkgconfig, but the default can be changed by passing
245 dnl DIRECTORY. The user can override through the --with-pkgconfigdir
246 dnl parameter.
247 AC_DEFUN([PKG_INSTALLDIR],
248 [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
249 m4_pushdef([pkg_description],
250 [pkg-config installation directory @<:@]pkg_default[@:>@])
251 AC_ARG_WITH([pkgconfigdir],
252 [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
253 [with_pkgconfigdir=]pkg_default)
254 AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
255 m4_popdef([pkg_default])
256 m4_popdef([pkg_description])
257 ])dnl PKG_INSTALLDIR
258
259
260 dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
261 dnl --------------------------------
262 dnl Since: 0.27
263 dnl
264 dnl Substitutes the variable noarch_pkgconfigdir as the location where a
265 dnl module should install arch-independent pkg-config .pc files. By
266 dnl default the directory is $datadir/pkgconfig, but the default can be
267 dnl changed by passing DIRECTORY. The user can override through the
268 dnl --with-noarch-pkgconfigdir parameter.
269 AC_DEFUN([PKG_NOARCH_INSTALLDIR],
270 [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
271 m4_pushdef([pkg_description],
272 [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
273 AC_ARG_WITH([noarch-pkgconfigdir],
274 [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
275 [with_noarch_pkgconfigdir=]pkg_default)
276 AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
277 m4_popdef([pkg_default])
278 m4_popdef([pkg_description])
279 ])dnl PKG_NOARCH_INSTALLDIR
280
281
282 dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
283 dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
284 dnl -------------------------------------------
285 dnl Since: 0.28
286 dnl
287 dnl Retrieves the value of the pkg-config variable for the given module.
288 AC_DEFUN([PKG_CHECK_VAR],
289 [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
290 AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
291
292 _PKG_CONFIG([$1], [variable="][$3]["], [$2])
293 AS_VAR_COPY([$1], [pkg_cv_][$1])
294
295 AS_VAR_IF([$1], [""], [$5], [$4])dnl
296 ])dnl PKG_CHECK_VAR
297
298 # Copyright (C) 2002-2021 Free Software Foundation, Inc.
299 #
300 # This file is free software; the Free Software Foundation
301 # gives unlimited permission to copy and/or distribute it,
302 # with or without modifications, as long as this notice is preserved.
303
304 # AM_AUTOMAKE_VERSION(VERSION)
305 # ----------------------------
306 # Automake X.Y traces this macro to ensure aclocal.m4 has been
307 # generated from the m4 files accompanying Automake X.Y.
308 # (This private macro should not be called outside this file.)
309 AC_DEFUN([AM_AUTOMAKE_VERSION],
310 [am__api_version='1.16'
311 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
312 dnl require some minimum version. Point them to the right macro.
313 m4_if([$1], [1.16.4], [],
314 [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
315 ])
316
317 # _AM_AUTOCONF_VERSION(VERSION)
318 # -----------------------------
319 # aclocal traces this macro to find the Autoconf version.
320 # This is a private macro too. Using m4_define simplifies
321 # the logic in aclocal, which can simply ignore this definition.
322 m4_define([_AM_AUTOCONF_VERSION], [])
323
324 # AM_SET_CURRENT_AUTOMAKE_VERSION
325 # -------------------------------
326 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
327 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
328 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
329 [AM_AUTOMAKE_VERSION([1.16.4])dnl
330 m4_ifndef([AC_AUTOCONF_VERSION],
331 [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
332 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
333
334 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
335
336 # Copyright (C) 2001-2021 Free Software Foundation, Inc.
337 #
338 # This file is free software; the Free Software Foundation
339 # gives unlimited permission to copy and/or distribute it,
340 # with or without modifications, as long as this notice is preserved.
341
342 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
343 # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
344 # '$srcdir', '$srcdir/..', or '$srcdir/../..'.
345 #
346 # Of course, Automake must honor this variable whenever it calls a
347 # tool from the auxiliary directory. The problem is that $srcdir (and
348 # therefore $ac_aux_dir as well) can be either absolute or relative,
349 # depending on how configure is run. This is pretty annoying, since
350 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
351 # source directory, any form will work fine, but in subdirectories a
352 # relative path needs to be adjusted first.
353 #
354 # $ac_aux_dir/missing
355 # fails when called from a subdirectory if $ac_aux_dir is relative
356 # $top_srcdir/$ac_aux_dir/missing
357 # fails if $ac_aux_dir is absolute,
358 # fails when called from a subdirectory in a VPATH build with
359 # a relative $ac_aux_dir
360 #
361 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
362 # are both prefixed by $srcdir. In an in-source build this is usually
363 # harmless because $srcdir is '.', but things will broke when you
364 # start a VPATH build or use an absolute $srcdir.
365 #
366 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
367 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
368 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
369 # and then we would define $MISSING as
370 # MISSING="\${SHELL} $am_aux_dir/missing"
371 # This will work as long as MISSING is not called from configure, because
372 # unfortunately $(top_srcdir) has no meaning in configure.
373 # However there are other variables, like CC, which are often used in
374 # configure, and could therefore not use this "fixed" $ac_aux_dir.
375 #
376 # Another solution, used here, is to always expand $ac_aux_dir to an
377 # absolute PATH. The drawback is that using absolute paths prevent a
378 # configured tree to be moved without reconfiguration.
379
380 AC_DEFUN([AM_AUX_DIR_EXPAND],
381 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
382 # Expand $ac_aux_dir to an absolute path.
383 am_aux_dir=`cd "$ac_aux_dir" && pwd`
384 ])
385
386 # AM_CONDITIONAL -*- Autoconf -*-
387
388 # Copyright (C) 1997-2021 Free Software Foundation, Inc.
389 #
390 # This file is free software; the Free Software Foundation
391 # gives unlimited permission to copy and/or distribute it,
392 # with or without modifications, as long as this notice is preserved.
393
394 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
395 # -------------------------------------
396 # Define a conditional.
397 AC_DEFUN([AM_CONDITIONAL],
398 [AC_PREREQ([2.52])dnl
399 m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
400 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
401 AC_SUBST([$1_TRUE])dnl
402 AC_SUBST([$1_FALSE])dnl
403 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
404 _AM_SUBST_NOTMAKE([$1_FALSE])dnl
405 m4_define([_AM_COND_VALUE_$1], [$2])dnl
406 if $2; then
407 $1_TRUE=
408 $1_FALSE='#'
409 else
410 $1_TRUE='#'
411 $1_FALSE=
412 fi
413 AC_CONFIG_COMMANDS_PRE(
414 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
415 AC_MSG_ERROR([[conditional "$1" was never defined.
416 Usually this means the macro was only invoked conditionally.]])
417 fi])])
418
419 # Copyright (C) 1999-2021 Free Software Foundation, Inc.
420 #
421 # This file is free software; the Free Software Foundation
422 # gives unlimited permission to copy and/or distribute it,
423 # with or without modifications, as long as this notice is preserved.
424
425
426 # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
427 # written in clear, in which case automake, when reading aclocal.m4,
428 # will think it sees a *use*, and therefore will trigger all it's
429 # C support machinery. Also note that it means that autoscan, seeing
430 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
431
432
433 # _AM_DEPENDENCIES(NAME)
434 # ----------------------
435 # See how the compiler implements dependency checking.
436 # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
437 # We try a few techniques and use that to set a single cache variable.
438 #
439 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
440 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
441 # dependency, and given that the user is not expected to run this macro,
442 # just rely on AC_PROG_CC.
443 AC_DEFUN([_AM_DEPENDENCIES],
444 [AC_REQUIRE([AM_SET_DEPDIR])dnl
445 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
446 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
447 AC_REQUIRE([AM_DEP_TRACK])dnl
448
449 m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
450 [$1], [CXX], [depcc="$CXX" am_compiler_list=],
451 [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
452 [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
453 [$1], [UPC], [depcc="$UPC" am_compiler_list=],
454 [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
455 [depcc="$$1" am_compiler_list=])
456
457 AC_CACHE_CHECK([dependency style of $depcc],
458 [am_cv_$1_dependencies_compiler_type],
459 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
460 # We make a subdir and do the tests there. Otherwise we can end up
461 # making bogus files that we don't know about and never remove. For
462 # instance it was reported that on HP-UX the gcc test will end up
463 # making a dummy file named 'D' -- because '-MD' means "put the output
464 # in D".
465 rm -rf conftest.dir
466 mkdir conftest.dir
467 # Copy depcomp to subdir because otherwise we won't find it if we're
468 # using a relative directory.
469 cp "$am_depcomp" conftest.dir
470 cd conftest.dir
471 # We will build objects and dependencies in a subdirectory because
472 # it helps to detect inapplicable dependency modes. For instance
473 # both Tru64's cc and ICC support -MD to output dependencies as a
474 # side effect of compilation, but ICC will put the dependencies in
475 # the current directory while Tru64 will put them in the object
476 # directory.
477 mkdir sub
478
479 am_cv_$1_dependencies_compiler_type=none
480 if test "$am_compiler_list" = ""; then
481 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
482 fi
483 am__universal=false
484 m4_case([$1], [CC],
485 [case " $depcc " in #(
486 *\ -arch\ *\ -arch\ *) am__universal=true ;;
487 esac],
488 [CXX],
489 [case " $depcc " in #(
490 *\ -arch\ *\ -arch\ *) am__universal=true ;;
491 esac])
492
493 for depmode in $am_compiler_list; do
494 # Setup a source with many dependencies, because some compilers
495 # like to wrap large dependency lists on column 80 (with \), and
496 # we should not choose a depcomp mode which is confused by this.
497 #
498 # We need to recreate these files for each test, as the compiler may
499 # overwrite some of them when testing with obscure command lines.
500 # This happens at least with the AIX C compiler.
501 : > sub/conftest.c
502 for i in 1 2 3 4 5 6; do
503 echo '#include "conftst'$i'.h"' >> sub/conftest.c
504 # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
505 # Solaris 10 /bin/sh.
506 echo '/* dummy */' > sub/conftst$i.h
507 done
508 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
509
510 # We check with '-c' and '-o' for the sake of the "dashmstdout"
511 # mode. It turns out that the SunPro C++ compiler does not properly
512 # handle '-M -o', and we need to detect this. Also, some Intel
513 # versions had trouble with output in subdirs.
514 am__obj=sub/conftest.${OBJEXT-o}
515 am__minus_obj="-o $am__obj"
516 case $depmode in
517 gcc)
518 # This depmode causes a compiler race in universal mode.
519 test "$am__universal" = false || continue
520 ;;
521 nosideeffect)
522 # After this tag, mechanisms are not by side-effect, so they'll
523 # only be used when explicitly requested.
524 if test "x$enable_dependency_tracking" = xyes; then
525 continue
526 else
527 break
528 fi
529 ;;
530 msvc7 | msvc7msys | msvisualcpp | msvcmsys)
531 # This compiler won't grok '-c -o', but also, the minuso test has
532 # not run yet. These depmodes are late enough in the game, and
533 # so weak that their functioning should not be impacted.
534 am__obj=conftest.${OBJEXT-o}
535 am__minus_obj=
536 ;;
537 none) break ;;
538 esac
539 if depmode=$depmode \
540 source=sub/conftest.c object=$am__obj \
541 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
542 $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
543 >/dev/null 2>conftest.err &&
544 grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
545 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
546 grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
547 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
548 # icc doesn't choke on unknown options, it will just issue warnings
549 # or remarks (even with -Werror). So we grep stderr for any message
550 # that says an option was ignored or not supported.
551 # When given -MP, icc 7.0 and 7.1 complain thusly:
552 # icc: Command line warning: ignoring option '-M'; no argument required
553 # The diagnosis changed in icc 8.0:
554 # icc: Command line remark: option '-MP' not supported
555 if (grep 'ignoring option' conftest.err ||
556 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
557 am_cv_$1_dependencies_compiler_type=$depmode
558 break
559 fi
560 fi
561 done
562
563 cd ..
564 rm -rf conftest.dir
565 else
566 am_cv_$1_dependencies_compiler_type=none
567 fi
568 ])
569 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
570 AM_CONDITIONAL([am__fastdep$1], [
571 test "x$enable_dependency_tracking" != xno \
572 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
573 ])
574
575
576 # AM_SET_DEPDIR
577 # -------------
578 # Choose a directory name for dependency files.
579 # This macro is AC_REQUIREd in _AM_DEPENDENCIES.
580 AC_DEFUN([AM_SET_DEPDIR],
581 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
582 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
583 ])
584
585
586 # AM_DEP_TRACK
587 # ------------
588 AC_DEFUN([AM_DEP_TRACK],
589 [AC_ARG_ENABLE([dependency-tracking], [dnl
590 AS_HELP_STRING(
591 [--enable-dependency-tracking],
592 [do not reject slow dependency extractors])
593 AS_HELP_STRING(
594 [--disable-dependency-tracking],
595 [speeds up one-time build])])
596 if test "x$enable_dependency_tracking" != xno; then
597 am_depcomp="$ac_aux_dir/depcomp"
598 AMDEPBACKSLASH='\'
599 am__nodep='_no'
600 fi
601 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
602 AC_SUBST([AMDEPBACKSLASH])dnl
603 _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
604 AC_SUBST([am__nodep])dnl
605 _AM_SUBST_NOTMAKE([am__nodep])dnl
606 ])
607
608 # Generate code to set up dependency tracking. -*- Autoconf -*-
609
610 # Copyright (C) 1999-2021 Free Software Foundation, Inc.
611 #
612 # This file is free software; the Free Software Foundation
613 # gives unlimited permission to copy and/or distribute it,
614 # with or without modifications, as long as this notice is preserved.
615
616 # _AM_OUTPUT_DEPENDENCY_COMMANDS
617 # ------------------------------
618 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
619 [{
620 # Older Autoconf quotes --file arguments for eval, but not when files
621 # are listed without --file. Let's play safe and only enable the eval
622 # if we detect the quoting.
623 # TODO: see whether this extra hack can be removed once we start
624 # requiring Autoconf 2.70 or later.
625 AS_CASE([$CONFIG_FILES],
626 [*\'*], [eval set x "$CONFIG_FILES"],
627 [*], [set x $CONFIG_FILES])
628 shift
629 # Used to flag and report bootstrapping failures.
630 am_rc=0
631 for am_mf
632 do
633 # Strip MF so we end up with the name of the file.
634 am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
635 # Check whether this is an Automake generated Makefile which includes
636 # dependency-tracking related rules and includes.
637 # Grep'ing the whole file directly is not great: AIX grep has a line
638 # limit of 2048, but all sed's we know have understand at least 4000.
639 sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
640 || continue
641 am_dirpart=`AS_DIRNAME(["$am_mf"])`
642 am_filepart=`AS_BASENAME(["$am_mf"])`
643 AM_RUN_LOG([cd "$am_dirpart" \
644 && sed -e '/# am--include-marker/d' "$am_filepart" \
645 | $MAKE -f - am--depfiles]) || am_rc=$?
646 done
647 if test $am_rc -ne 0; then
648 AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
649 for automatic dependency tracking. If GNU make was not used, consider
650 re-running the configure script with MAKE="gmake" (or whatever is
651 necessary). You can also try re-running configure with the
652 '--disable-dependency-tracking' option to at least be able to build
653 the package (albeit without support for automatic dependency tracking).])
654 fi
655 AS_UNSET([am_dirpart])
656 AS_UNSET([am_filepart])
657 AS_UNSET([am_mf])
658 AS_UNSET([am_rc])
659 rm -f conftest-deps.mk
660 }
661 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
662
663
664 # AM_OUTPUT_DEPENDENCY_COMMANDS
665 # -----------------------------
666 # This macro should only be invoked once -- use via AC_REQUIRE.
667 #
668 # This code is only required when automatic dependency tracking is enabled.
669 # This creates each '.Po' and '.Plo' makefile fragment that we'll need in
670 # order to bootstrap the dependency handling code.
671 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
672 [AC_CONFIG_COMMANDS([depfiles],
673 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
674 [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
675
676 # Do all the work for Automake. -*- Autoconf -*-
677
678 # Copyright (C) 1996-2021 Free Software Foundation, Inc.
679 #
680 # This file is free software; the Free Software Foundation
681 # gives unlimited permission to copy and/or distribute it,
682 # with or without modifications, as long as this notice is preserved.
683
684 # This macro actually does too much. Some checks are only needed if
685 # your package does certain things. But this isn't really a big deal.
686
687 dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
688 m4_define([AC_PROG_CC],
689 m4_defn([AC_PROG_CC])
690 [_AM_PROG_CC_C_O
691 ])
692
693 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
694 # AM_INIT_AUTOMAKE([OPTIONS])
695 # -----------------------------------------------
696 # The call with PACKAGE and VERSION arguments is the old style
697 # call (pre autoconf-2.50), which is being phased out. PACKAGE
698 # and VERSION should now be passed to AC_INIT and removed from
699 # the call to AM_INIT_AUTOMAKE.
700 # We support both call styles for the transition. After
701 # the next Automake release, Autoconf can make the AC_INIT
702 # arguments mandatory, and then we can depend on a new Autoconf
703 # release and drop the old call support.
704 AC_DEFUN([AM_INIT_AUTOMAKE],
705 [AC_PREREQ([2.65])dnl
706 dnl Autoconf wants to disallow AM_ names. We explicitly allow
707 dnl the ones we care about.
708 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
709 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
710 AC_REQUIRE([AC_PROG_INSTALL])dnl
711 if test "`cd $srcdir && pwd`" != "`pwd`"; then
712 # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
713 # is not polluted with repeated "-I."
714 AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
715 # test to see if srcdir already configured
716 if test -f $srcdir/config.status; then
717 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
718 fi
719 fi
720
721 # test whether we have cygpath
722 if test -z "$CYGPATH_W"; then
723 if (cygpath --version) >/dev/null 2>/dev/null; then
724 CYGPATH_W='cygpath -w'
725 else
726 CYGPATH_W=echo
727 fi
728 fi
729 AC_SUBST([CYGPATH_W])
730
731 # Define the identity of the package.
732 dnl Distinguish between old-style and new-style calls.
733 m4_ifval([$2],
734 [AC_DIAGNOSE([obsolete],
735 [$0: two- and three-arguments forms are deprecated.])
736 m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
737 AC_SUBST([PACKAGE], [$1])dnl
738 AC_SUBST([VERSION], [$2])],
739 [_AM_SET_OPTIONS([$1])dnl
740 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
741 m4_if(
742 m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
743 [ok:ok],,
744 [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
745 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
746 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
747
748 _AM_IF_OPTION([no-define],,
749 [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
750 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
751
752 # Some tools Automake needs.
753 AC_REQUIRE([AM_SANITY_CHECK])dnl
754 AC_REQUIRE([AC_ARG_PROGRAM])dnl
755 AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
756 AM_MISSING_PROG([AUTOCONF], [autoconf])
757 AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
758 AM_MISSING_PROG([AUTOHEADER], [autoheader])
759 AM_MISSING_PROG([MAKEINFO], [makeinfo])
760 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
761 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
762 AC_REQUIRE([AC_PROG_MKDIR_P])dnl
763 # For better backward compatibility. To be removed once Automake 1.9.x
764 # dies out for good. For more background, see:
765 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
766 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
767 AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
768 # We need awk for the "check" target (and possibly the TAP driver). The
769 # system "awk" is bad on some platforms.
770 AC_REQUIRE([AC_PROG_AWK])dnl
771 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
772 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
773 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
774 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
775 [_AM_PROG_TAR([v7])])])
776 _AM_IF_OPTION([no-dependencies],,
777 [AC_PROVIDE_IFELSE([AC_PROG_CC],
778 [_AM_DEPENDENCIES([CC])],
779 [m4_define([AC_PROG_CC],
780 m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
781 AC_PROVIDE_IFELSE([AC_PROG_CXX],
782 [_AM_DEPENDENCIES([CXX])],
783 [m4_define([AC_PROG_CXX],
784 m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
785 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
786 [_AM_DEPENDENCIES([OBJC])],
787 [m4_define([AC_PROG_OBJC],
788 m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
789 AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
790 [_AM_DEPENDENCIES([OBJCXX])],
791 [m4_define([AC_PROG_OBJCXX],
792 m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
793 ])
794 # Variables for tags utilities; see am/tags.am
795 if test -z "$CTAGS"; then
796 CTAGS=ctags
797 fi
798 AC_SUBST([CTAGS])
799 if test -z "$ETAGS"; then
800 ETAGS=etags
801 fi
802 AC_SUBST([ETAGS])
803 if test -z "$CSCOPE"; then
804 CSCOPE=cscope
805 fi
806 AC_SUBST([CSCOPE])
807
808 AC_REQUIRE([AM_SILENT_RULES])dnl
809 dnl The testsuite driver may need to know about EXEEXT, so add the
810 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
811 dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
812 AC_CONFIG_COMMANDS_PRE(dnl
813 [m4_provide_if([_AM_COMPILER_EXEEXT],
814 [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
815
816 # POSIX will say in a future version that running "rm -f" with no argument
817 # is OK; and we want to be able to make that assumption in our Makefile
818 # recipes. So use an aggressive probe to check that the usage we want is
819 # actually supported "in the wild" to an acceptable degree.
820 # See automake bug#10828.
821 # To make any issue more visible, cause the running configure to be aborted
822 # by default if the 'rm' program in use doesn't match our expectations; the
823 # user can still override this though.
824 if rm -f && rm -fr && rm -rf; then : OK; else
825 cat >&2 <<'END'
826 Oops!
827
828 Your 'rm' program seems unable to run without file operands specified
829 on the command line, even when the '-f' option is present. This is contrary
830 to the behaviour of most rm programs out there, and not conforming with
831 the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
832
833 Please tell bug-automake@gnu.org about your system, including the value
834 of your $PATH and any error possibly output before this message. This
835 can help us improve future automake versions.
836
837 END
838 if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
839 echo 'Configuration will proceed anyway, since you have set the' >&2
840 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
841 echo >&2
842 else
843 cat >&2 <<'END'
844 Aborting the configuration process, to ensure you take notice of the issue.
845
846 You can download and install GNU coreutils to get an 'rm' implementation
847 that behaves properly: <https://www.gnu.org/software/coreutils/>.
848
849 If you want to complete the configuration process using your problematic
850 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
851 to "yes", and re-run configure.
852
853 END
854 AC_MSG_ERROR([Your 'rm' program is bad, sorry.])
855 fi
856 fi
857 dnl The trailing newline in this macro's definition is deliberate, for
858 dnl backward compatibility and to allow trailing 'dnl'-style comments
859 dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841.
860 ])
861
862 dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
863 dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
864 dnl mangled by Autoconf and run in a shell conditional statement.
865 m4_define([_AC_COMPILER_EXEEXT],
866 m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
867
868 # When config.status generates a header, we must update the stamp-h file.
869 # This file resides in the same directory as the config header
870 # that is generated. The stamp files are numbered to have different names.
871
872 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
873 # loop where config.status creates the headers, so we can generate
874 # our stamp files there.
875 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
876 [# Compute $1's index in $config_headers.
877 _am_arg=$1
878 _am_stamp_count=1
879 for _am_header in $config_headers :; do
880 case $_am_header in
881 $_am_arg | $_am_arg:* )
882 break ;;
883 * )
884 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
885 esac
886 done
887 echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
888
889 # Copyright (C) 2001-2021 Free Software Foundation, Inc.
890 #
891 # This file is free software; the Free Software Foundation
892 # gives unlimited permission to copy and/or distribute it,
893 # with or without modifications, as long as this notice is preserved.
894
895 # AM_PROG_INSTALL_SH
896 # ------------------
897 # Define $install_sh.
898 AC_DEFUN([AM_PROG_INSTALL_SH],
899 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
900 if test x"${install_sh+set}" != xset; then
901 case $am_aux_dir in
902 *\ * | *\ *)
903 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
904 *)
905 install_sh="\${SHELL} $am_aux_dir/install-sh"
906 esac
907 fi
908 AC_SUBST([install_sh])])
909
910 # Copyright (C) 2003-2021 Free Software Foundation, Inc.
911 #
912 # This file is free software; the Free Software Foundation
913 # gives unlimited permission to copy and/or distribute it,
914 # with or without modifications, as long as this notice is preserved.
915
916 # Check whether the underlying file-system supports filenames
917 # with a leading dot. For instance MS-DOS doesn't.
918 AC_DEFUN([AM_SET_LEADING_DOT],
919 [rm -rf .tst 2>/dev/null
920 mkdir .tst 2>/dev/null
921 if test -d .tst; then
922 am__leading_dot=.
923 else
924 am__leading_dot=_
925 fi
926 rmdir .tst 2>/dev/null
927 AC_SUBST([am__leading_dot])])
928
929 # Check to see how 'make' treats includes. -*- Autoconf -*-
930
931 # Copyright (C) 2001-2021 Free Software Foundation, Inc.
932 #
933 # This file is free software; the Free Software Foundation
934 # gives unlimited permission to copy and/or distribute it,
935 # with or without modifications, as long as this notice is preserved.
936
937 # AM_MAKE_INCLUDE()
938 # -----------------
939 # Check whether make has an 'include' directive that can support all
940 # the idioms we need for our automatic dependency tracking code.
941 AC_DEFUN([AM_MAKE_INCLUDE],
942 [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
943 cat > confinc.mk << 'END'
944 am__doit:
945 @echo this is the am__doit target >confinc.out
946 .PHONY: am__doit
947 END
948 am__include="#"
949 am__quote=
950 # BSD make does it like this.
951 echo '.include "confinc.mk" # ignored' > confmf.BSD
952 # Other make implementations (GNU, Solaris 10, AIX) do it like this.
953 echo 'include confinc.mk # ignored' > confmf.GNU
954 _am_result=no
955 for s in GNU BSD; do
956 AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
957 AS_CASE([$?:`cat confinc.out 2>/dev/null`],
958 ['0:this is the am__doit target'],
959 [AS_CASE([$s],
960 [BSD], [am__include='.include' am__quote='"'],
961 [am__include='include' am__quote=''])])
962 if test "$am__include" != "#"; then
963 _am_result="yes ($s style)"
964 break
965 fi
966 done
967 rm -f confinc.* confmf.*
968 AC_MSG_RESULT([${_am_result}])
969 AC_SUBST([am__include])])
970 AC_SUBST([am__quote])])
971
972 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
973
974 # Copyright (C) 1997-2021 Free Software Foundation, Inc.
975 #
976 # This file is free software; the Free Software Foundation
977 # gives unlimited permission to copy and/or distribute it,
978 # with or without modifications, as long as this notice is preserved.
979
980 # AM_MISSING_PROG(NAME, PROGRAM)
981 # ------------------------------
982 AC_DEFUN([AM_MISSING_PROG],
983 [AC_REQUIRE([AM_MISSING_HAS_RUN])
984 $1=${$1-"${am_missing_run}$2"}
985 AC_SUBST($1)])
986
987 # AM_MISSING_HAS_RUN
988 # ------------------
989 # Define MISSING if not defined so far and test if it is modern enough.
990 # If it is, set am_missing_run to use it, otherwise, to nothing.
991 AC_DEFUN([AM_MISSING_HAS_RUN],
992 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
993 AC_REQUIRE_AUX_FILE([missing])dnl
994 if test x"${MISSING+set}" != xset; then
995 MISSING="\${SHELL} '$am_aux_dir/missing'"
996 fi
997 # Use eval to expand $SHELL
998 if eval "$MISSING --is-lightweight"; then
999 am_missing_run="$MISSING "
1000 else
1001 am_missing_run=
1002 AC_MSG_WARN(['missing' script is too old or missing])
1003 fi
1004 ])
1005
1006 # Helper functions for option handling. -*- Autoconf -*-
1007
1008 # Copyright (C) 2001-2021 Free Software Foundation, Inc.
1009 #
1010 # This file is free software; the Free Software Foundation
1011 # gives unlimited permission to copy and/or distribute it,
1012 # with or without modifications, as long as this notice is preserved.
1013
1014 # _AM_MANGLE_OPTION(NAME)
1015 # -----------------------
1016 AC_DEFUN([_AM_MANGLE_OPTION],
1017 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
1018
1019 # _AM_SET_OPTION(NAME)
1020 # --------------------
1021 # Set option NAME. Presently that only means defining a flag for this option.
1022 AC_DEFUN([_AM_SET_OPTION],
1023 [m4_define(_AM_MANGLE_OPTION([$1]), [1])])
1024
1025 # _AM_SET_OPTIONS(OPTIONS)
1026 # ------------------------
1027 # OPTIONS is a space-separated list of Automake options.
1028 AC_DEFUN([_AM_SET_OPTIONS],
1029 [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
1030
1031 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
1032 # -------------------------------------------
1033 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
1034 AC_DEFUN([_AM_IF_OPTION],
1035 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
1036
1037 # Copyright (C) 1999-2021 Free Software Foundation, Inc.
1038 #
1039 # This file is free software; the Free Software Foundation
1040 # gives unlimited permission to copy and/or distribute it,
1041 # with or without modifications, as long as this notice is preserved.
1042
1043 # _AM_PROG_CC_C_O
1044 # ---------------
1045 # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC
1046 # to automatically call this.
1047 AC_DEFUN([_AM_PROG_CC_C_O],
1048 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
1049 AC_REQUIRE_AUX_FILE([compile])dnl
1050 AC_LANG_PUSH([C])dnl
1051 AC_CACHE_CHECK(
1052 [whether $CC understands -c and -o together],
1053 [am_cv_prog_cc_c_o],
1054 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
1055 # Make sure it works both with $CC and with simple cc.
1056 # Following AC_PROG_CC_C_O, we do the test twice because some
1057 # compilers refuse to overwrite an existing .o file with -o,
1058 # though they will create one.
1059 am_cv_prog_cc_c_o=yes
1060 for am_i in 1 2; do
1061 if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \
1062 && test -f conftest2.$ac_objext; then
1063 : OK
1064 else
1065 am_cv_prog_cc_c_o=no
1066 break
1067 fi
1068 done
1069 rm -f core conftest*
1070 unset am_i])
1071 if test "$am_cv_prog_cc_c_o" != yes; then
1072 # Losing compiler, so override with the script.
1073 # FIXME: It is wrong to rewrite CC.
1074 # But if we don't then we get into trouble of one sort or another.
1075 # A longer-term fix would be to have automake use am__CC in this case,
1076 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
1077 CC="$am_aux_dir/compile $CC"
1078 fi
1079 AC_LANG_POP([C])])
1080
1081 # For backward compatibility.
1082 AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
1083
1084 # Copyright (C) 2001-2021 Free Software Foundation, Inc.
1085 #
1086 # This file is free software; the Free Software Foundation
1087 # gives unlimited permission to copy and/or distribute it,
1088 # with or without modifications, as long as this notice is preserved.
1089
1090 # AM_RUN_LOG(COMMAND)
1091 # -------------------
1092 # Run COMMAND, save the exit status in ac_status, and log it.
1093 # (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
1094 AC_DEFUN([AM_RUN_LOG],
1095 [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
1096 ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
1097 ac_status=$?
1098 echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
1099 (exit $ac_status); }])
1100
1101 # Check to make sure that the build environment is sane. -*- Autoconf -*-
1102
1103 # Copyright (C) 1996-2021 Free Software Foundation, Inc.
1104 #
1105 # This file is free software; the Free Software Foundation
1106 # gives unlimited permission to copy and/or distribute it,
1107 # with or without modifications, as long as this notice is preserved.
1108
1109 # AM_SANITY_CHECK
1110 # ---------------
1111 AC_DEFUN([AM_SANITY_CHECK],
1112 [AC_MSG_CHECKING([whether build environment is sane])
1113 # Reject unsafe characters in $srcdir or the absolute working directory
1114 # name. Accept space and tab only in the latter.
1115 am_lf='
1116 '
1117 case `pwd` in
1118 *[[\\\"\#\$\&\'\`$am_lf]]*)
1119 AC_MSG_ERROR([unsafe absolute working directory name]);;
1120 esac
1121 case $srcdir in
1122 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
1123 AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
1124 esac
1125
1126 # Do 'set' in a subshell so we don't clobber the current shell's
1127 # arguments. Must try -L first in case configure is actually a
1128 # symlink; some systems play weird games with the mod time of symlinks
1129 # (eg FreeBSD returns the mod time of the symlink's containing
1130 # directory).
1131 if (
1132 am_has_slept=no
1133 for am_try in 1 2; do
1134 echo "timestamp, slept: $am_has_slept" > conftest.file
1135 set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
1136 if test "$[*]" = "X"; then
1137 # -L didn't work.
1138 set X `ls -t "$srcdir/configure" conftest.file`
1139 fi
1140 if test "$[*]" != "X $srcdir/configure conftest.file" \
1141 && test "$[*]" != "X conftest.file $srcdir/configure"; then
1142
1143 # If neither matched, then we have a broken ls. This can happen
1144 # if, for instance, CONFIG_SHELL is bash and it inherits a
1145 # broken ls alias from the environment. This has actually
1146 # happened. Such a system could not be considered "sane".
1147 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1148 alias in your environment])
1149 fi
1150 if test "$[2]" = conftest.file || test $am_try -eq 2; then
1151 break
1152 fi
1153 # Just in case.
1154 sleep 1
1155 am_has_slept=yes
1156 done
1157 test "$[2]" = conftest.file
1158 )
1159 then
1160 # Ok.
1161 :
1162 else
1163 AC_MSG_ERROR([newly created file is older than distributed files!
1164 Check your system clock])
1165 fi
1166 AC_MSG_RESULT([yes])
1167 # If we didn't sleep, we still need to ensure time stamps of config.status and
1168 # generated files are strictly newer.
1169 am_sleep_pid=
1170 if grep 'slept: no' conftest.file >/dev/null 2>&1; then
1171 ( sleep 1 ) &
1172 am_sleep_pid=$!
1173 fi
1174 AC_CONFIG_COMMANDS_PRE(
1175 [AC_MSG_CHECKING([that generated files are newer than configure])
1176 if test -n "$am_sleep_pid"; then
1177 # Hide warnings about reused PIDs.
1178 wait $am_sleep_pid 2>/dev/null
1179 fi
1180 AC_MSG_RESULT([done])])
1181 rm -f conftest.file
1182 ])
1183
1184 # Copyright (C) 2009-2021 Free Software Foundation, Inc.
1185 #
1186 # This file is free software; the Free Software Foundation
1187 # gives unlimited permission to copy and/or distribute it,
1188 # with or without modifications, as long as this notice is preserved.
1189
1190 # AM_SILENT_RULES([DEFAULT])
1191 # --------------------------
1192 # Enable less verbose build rules; with the default set to DEFAULT
1193 # ("yes" being less verbose, "no" or empty being verbose).
1194 AC_DEFUN([AM_SILENT_RULES],
1195 [AC_ARG_ENABLE([silent-rules], [dnl
1196 AS_HELP_STRING(
1197 [--enable-silent-rules],
1198 [less verbose build output (undo: "make V=1")])
1199 AS_HELP_STRING(
1200 [--disable-silent-rules],
1201 [verbose build output (undo: "make V=0")])dnl
1202 ])
1203 case $enable_silent_rules in @%:@ (((
1204 yes) AM_DEFAULT_VERBOSITY=0;;
1205 no) AM_DEFAULT_VERBOSITY=1;;
1206 *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
1207 esac
1208 dnl
1209 dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
1210 dnl do not support nested variable expansions.
1211 dnl See automake bug#9928 and bug#10237.
1212 am_make=${MAKE-make}
1213 AC_CACHE_CHECK([whether $am_make supports nested variables],
1214 [am_cv_make_support_nested_variables],
1215 [if AS_ECHO([['TRUE=$(BAR$(V))
1216 BAR0=false
1217 BAR1=true
1218 V=1
1219 am__doit:
1220 @$(TRUE)
1221 .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
1222 am_cv_make_support_nested_variables=yes
1223 else
1224 am_cv_make_support_nested_variables=no
1225 fi])
1226 if test $am_cv_make_support_nested_variables = yes; then
1227 dnl Using '$V' instead of '$(V)' breaks IRIX make.
1228 AM_V='$(V)'
1229 AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
1230 else
1231 AM_V=$AM_DEFAULT_VERBOSITY
1232 AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
1233 fi
1234 AC_SUBST([AM_V])dnl
1235 AM_SUBST_NOTMAKE([AM_V])dnl
1236 AC_SUBST([AM_DEFAULT_V])dnl
1237 AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
1238 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
1239 AM_BACKSLASH='\'
1240 AC_SUBST([AM_BACKSLASH])dnl
1241 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
1242 ])
1243
1244 # Copyright (C) 2001-2021 Free Software Foundation, Inc.
1245 #
1246 # This file is free software; the Free Software Foundation
1247 # gives unlimited permission to copy and/or distribute it,
1248 # with or without modifications, as long as this notice is preserved.
1249
1250 # AM_PROG_INSTALL_STRIP
1251 # ---------------------
1252 # One issue with vendor 'install' (even GNU) is that you can't
1253 # specify the program used to strip binaries. This is especially
1254 # annoying in cross-compiling environments, where the build's strip
1255 # is unlikely to handle the host's binaries.
1256 # Fortunately install-sh will honor a STRIPPROG variable, so we
1257 # always use install-sh in "make install-strip", and initialize
1258 # STRIPPROG with the value of the STRIP variable (set by the user).
1259 AC_DEFUN([AM_PROG_INSTALL_STRIP],
1260 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
1261 # Installed binaries are usually stripped using 'strip' when the user
1262 # run "make install-strip". However 'strip' might not be the right
1263 # tool to use in cross-compilation environments, therefore Automake
1264 # will honor the 'STRIP' environment variable to overrule this program.
1265 dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
1266 if test "$cross_compiling" != no; then
1267 AC_CHECK_TOOL([STRIP], [strip], :)
1268 fi
1269 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
1270 AC_SUBST([INSTALL_STRIP_PROGRAM])])
1271
1272 # Copyright (C) 2006-2021 Free Software Foundation, Inc.
1273 #
1274 # This file is free software; the Free Software Foundation
1275 # gives unlimited permission to copy and/or distribute it,
1276 # with or without modifications, as long as this notice is preserved.
1277
1278 # _AM_SUBST_NOTMAKE(VARIABLE)
1279 # ---------------------------
1280 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
1281 # This macro is traced by Automake.
1282 AC_DEFUN([_AM_SUBST_NOTMAKE])
1283
1284 # AM_SUBST_NOTMAKE(VARIABLE)
1285 # --------------------------
1286 # Public sister of _AM_SUBST_NOTMAKE.
1287 AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
1288
1289 # Check how to create a tarball. -*- Autoconf -*-
1290
1291 # Copyright (C) 2004-2021 Free Software Foundation, Inc.
1292 #
1293 # This file is free software; the Free Software Foundation
1294 # gives unlimited permission to copy and/or distribute it,
1295 # with or without modifications, as long as this notice is preserved.
1296
1297 # _AM_PROG_TAR(FORMAT)
1298 # --------------------
1299 # Check how to create a tarball in format FORMAT.
1300 # FORMAT should be one of 'v7', 'ustar', or 'pax'.
1301 #
1302 # Substitute a variable $(am__tar) that is a command
1303 # writing to stdout a FORMAT-tarball containing the directory
1304 # $tardir.
1305 # tardir=directory && $(am__tar) > result.tar
1306 #
1307 # Substitute a variable $(am__untar) that extract such
1308 # a tarball read from stdin.
1309 # $(am__untar) < result.tar
1310 #
1311 AC_DEFUN([_AM_PROG_TAR],
1312 [# Always define AMTAR for backward compatibility. Yes, it's still used
1313 # in the wild :-( We should find a proper way to deprecate it ...
1314 AC_SUBST([AMTAR], ['$${TAR-tar}'])
1315
1316 # We'll loop over all known methods to create a tar archive until one works.
1317 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
1318
1319 m4_if([$1], [v7],
1320 [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
1321
1322 [m4_case([$1],
1323 [ustar],
1324 [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
1325 # There is notably a 21 bits limit for the UID and the GID. In fact,
1326 # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
1327 # and bug#13588).
1328 am_max_uid=2097151 # 2^21 - 1
1329 am_max_gid=$am_max_uid
1330 # The $UID and $GID variables are not portable, so we need to resort
1331 # to the POSIX-mandated id(1) utility. Errors in the 'id' calls
1332 # below are definitely unexpected, so allow the users to see them
1333 # (that is, avoid stderr redirection).
1334 am_uid=`id -u || echo unknown`
1335 am_gid=`id -g || echo unknown`
1336 AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
1337 if test $am_uid -le $am_max_uid; then
1338 AC_MSG_RESULT([yes])
1339 else
1340 AC_MSG_RESULT([no])
1341 _am_tools=none
1342 fi
1343 AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])
1344 if test $am_gid -le $am_max_gid; then
1345 AC_MSG_RESULT([yes])
1346 else
1347 AC_MSG_RESULT([no])
1348 _am_tools=none
1349 fi],
1350
1351 [pax],
1352 [],
1353
1354 [m4_fatal([Unknown tar format])])
1355
1356 AC_MSG_CHECKING([how to create a $1 tar archive])
1357
1358 # Go ahead even if we have the value already cached. We do so because we
1359 # need to set the values for the 'am__tar' and 'am__untar' variables.
1360 _am_tools=${am_cv_prog_tar_$1-$_am_tools}
1361
1362 for _am_tool in $_am_tools; do
1363 case $_am_tool in
1364 gnutar)
1365 for _am_tar in tar gnutar gtar; do
1366 AM_RUN_LOG([$_am_tar --version]) && break
1367 done
1368 am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
1369 am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
1370 am__untar="$_am_tar -xf -"
1371 ;;
1372 plaintar)
1373 # Must skip GNU tar: if it does not support --format= it doesn't create
1374 # ustar tarball either.
1375 (tar --version) >/dev/null 2>&1 && continue
1376 am__tar='tar chf - "$$tardir"'
1377 am__tar_='tar chf - "$tardir"'
1378 am__untar='tar xf -'
1379 ;;
1380 pax)
1381 am__tar='pax -L -x $1 -w "$$tardir"'
1382 am__tar_='pax -L -x $1 -w "$tardir"'
1383 am__untar='pax -r'
1384 ;;
1385 cpio)
1386 am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
1387 am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
1388 am__untar='cpio -i -H $1 -d'
1389 ;;
1390 none)
1391 am__tar=false
1392 am__tar_=false
1393 am__untar=false
1394 ;;
1395 esac
1396
1397 # If the value was cached, stop now. We just wanted to have am__tar
1398 # and am__untar set.
1399 test -n "${am_cv_prog_tar_$1}" && break
1400
1401 # tar/untar a dummy directory, and stop if the command works.
1402 rm -rf conftest.dir
1403 mkdir conftest.dir
1404 echo GrepMe > conftest.dir/file
1405 AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
1406 rm -rf conftest.dir
1407 if test -s conftest.tar; then
1408 AM_RUN_LOG([$am__untar <conftest.tar])
1409 AM_RUN_LOG([cat conftest.dir/file])
1410 grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
1411 fi
1412 done
1413 rm -rf conftest.dir
1414
1415 AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
1416 AC_MSG_RESULT([$am_cv_prog_tar_$1])])
1417
1418 AC_SUBST([am__tar])
1419 AC_SUBST([am__untar])
1420 ]) # _AM_PROG_TAR
1421
0 #! /bin/sh
1 # Wrapper for compilers which do not understand '-c -o'.
2
3 scriptversion=2018-03-07.03; # UTC
4
5 # Copyright (C) 1999-2021 Free Software Foundation, Inc.
6 # Written by Tom Tromey <tromey@cygnus.com>.
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
25
26 # This file is maintained in Automake, please report
27 # bugs to <bug-automake@gnu.org> or send patches to
28 # <automake-patches@gnu.org>.
29
30 nl='
31 '
32
33 # We need space, tab and new line, in precisely that order. Quoting is
34 # there to prevent tools from complaining about whitespace usage.
35 IFS=" "" $nl"
36
37 file_conv=
38
39 # func_file_conv build_file lazy
40 # Convert a $build file to $host form and store it in $file
41 # Currently only supports Windows hosts. If the determined conversion
42 # type is listed in (the comma separated) LAZY, no conversion will
43 # take place.
44 func_file_conv ()
45 {
46 file=$1
47 case $file in
48 / | /[!/]*) # absolute file, and not a UNC file
49 if test -z "$file_conv"; then
50 # lazily determine how to convert abs files
51 case `uname -s` in
52 MINGW*)
53 file_conv=mingw
54 ;;
55 CYGWIN* | MSYS*)
56 file_conv=cygwin
57 ;;
58 *)
59 file_conv=wine
60 ;;
61 esac
62 fi
63 case $file_conv/,$2, in
64 *,$file_conv,*)
65 ;;
66 mingw/*)
67 file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
68 ;;
69 cygwin/* | msys/*)
70 file=`cygpath -m "$file" || echo "$file"`
71 ;;
72 wine/*)
73 file=`winepath -w "$file" || echo "$file"`
74 ;;
75 esac
76 ;;
77 esac
78 }
79
80 # func_cl_dashL linkdir
81 # Make cl look for libraries in LINKDIR
82 func_cl_dashL ()
83 {
84 func_file_conv "$1"
85 if test -z "$lib_path"; then
86 lib_path=$file
87 else
88 lib_path="$lib_path;$file"
89 fi
90 linker_opts="$linker_opts -LIBPATH:$file"
91 }
92
93 # func_cl_dashl library
94 # Do a library search-path lookup for cl
95 func_cl_dashl ()
96 {
97 lib=$1
98 found=no
99 save_IFS=$IFS
100 IFS=';'
101 for dir in $lib_path $LIB
102 do
103 IFS=$save_IFS
104 if $shared && test -f "$dir/$lib.dll.lib"; then
105 found=yes
106 lib=$dir/$lib.dll.lib
107 break
108 fi
109 if test -f "$dir/$lib.lib"; then
110 found=yes
111 lib=$dir/$lib.lib
112 break
113 fi
114 if test -f "$dir/lib$lib.a"; then
115 found=yes
116 lib=$dir/lib$lib.a
117 break
118 fi
119 done
120 IFS=$save_IFS
121
122 if test "$found" != yes; then
123 lib=$lib.lib
124 fi
125 }
126
127 # func_cl_wrapper cl arg...
128 # Adjust compile command to suit cl
129 func_cl_wrapper ()
130 {
131 # Assume a capable shell
132 lib_path=
133 shared=:
134 linker_opts=
135 for arg
136 do
137 if test -n "$eat"; then
138 eat=
139 else
140 case $1 in
141 -o)
142 # configure might choose to run compile as 'compile cc -o foo foo.c'.
143 eat=1
144 case $2 in
145 *.o | *.[oO][bB][jJ])
146 func_file_conv "$2"
147 set x "$@" -Fo"$file"
148 shift
149 ;;
150 *)
151 func_file_conv "$2"
152 set x "$@" -Fe"$file"
153 shift
154 ;;
155 esac
156 ;;
157 -I)
158 eat=1
159 func_file_conv "$2" mingw
160 set x "$@" -I"$file"
161 shift
162 ;;
163 -I*)
164 func_file_conv "${1#-I}" mingw
165 set x "$@" -I"$file"
166 shift
167 ;;
168 -l)
169 eat=1
170 func_cl_dashl "$2"
171 set x "$@" "$lib"
172 shift
173 ;;
174 -l*)
175 func_cl_dashl "${1#-l}"
176 set x "$@" "$lib"
177 shift
178 ;;
179 -L)
180 eat=1
181 func_cl_dashL "$2"
182 ;;
183 -L*)
184 func_cl_dashL "${1#-L}"
185 ;;
186 -static)
187 shared=false
188 ;;
189 -Wl,*)
190 arg=${1#-Wl,}
191 save_ifs="$IFS"; IFS=','
192 for flag in $arg; do
193 IFS="$save_ifs"
194 linker_opts="$linker_opts $flag"
195 done
196 IFS="$save_ifs"
197 ;;
198 -Xlinker)
199 eat=1
200 linker_opts="$linker_opts $2"
201 ;;
202 -*)
203 set x "$@" "$1"
204 shift
205 ;;
206 *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
207 func_file_conv "$1"
208 set x "$@" -Tp"$file"
209 shift
210 ;;
211 *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
212 func_file_conv "$1" mingw
213 set x "$@" "$file"
214 shift
215 ;;
216 *)
217 set x "$@" "$1"
218 shift
219 ;;
220 esac
221 fi
222 shift
223 done
224 if test -n "$linker_opts"; then
225 linker_opts="-link$linker_opts"
226 fi
227 exec "$@" $linker_opts
228 exit 1
229 }
230
231 eat=
232
233 case $1 in
234 '')
235 echo "$0: No command. Try '$0 --help' for more information." 1>&2
236 exit 1;
237 ;;
238 -h | --h*)
239 cat <<\EOF
240 Usage: compile [--help] [--version] PROGRAM [ARGS]
241
242 Wrapper for compilers which do not understand '-c -o'.
243 Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
244 arguments, and rename the output as expected.
245
246 If you are trying to build a whole package this is not the
247 right script to run: please start by reading the file 'INSTALL'.
248
249 Report bugs to <bug-automake@gnu.org>.
250 EOF
251 exit $?
252 ;;
253 -v | --v*)
254 echo "compile $scriptversion"
255 exit $?
256 ;;
257 cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
258 icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
259 func_cl_wrapper "$@" # Doesn't return...
260 ;;
261 esac
262
263 ofile=
264 cfile=
265
266 for arg
267 do
268 if test -n "$eat"; then
269 eat=
270 else
271 case $1 in
272 -o)
273 # configure might choose to run compile as 'compile cc -o foo foo.c'.
274 # So we strip '-o arg' only if arg is an object.
275 eat=1
276 case $2 in
277 *.o | *.obj)
278 ofile=$2
279 ;;
280 *)
281 set x "$@" -o "$2"
282 shift
283 ;;
284 esac
285 ;;
286 *.c)
287 cfile=$1
288 set x "$@" "$1"
289 shift
290 ;;
291 *)
292 set x "$@" "$1"
293 shift
294 ;;
295 esac
296 fi
297 shift
298 done
299
300 if test -z "$ofile" || test -z "$cfile"; then
301 # If no '-o' option was seen then we might have been invoked from a
302 # pattern rule where we don't need one. That is ok -- this is a
303 # normal compilation that the losing compiler can handle. If no
304 # '.c' file was seen then we are probably linking. That is also
305 # ok.
306 exec "$@"
307 fi
308
309 # Name of file we expect compiler to create.
310 cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
311
312 # Create the lock directory.
313 # Note: use '[/\\:.-]' here to ensure that we don't use the same name
314 # that we are using for the .o file. Also, base the name on the expected
315 # object file name, since that is what matters with a parallel build.
316 lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
317 while true; do
318 if mkdir "$lockdir" >/dev/null 2>&1; then
319 break
320 fi
321 sleep 1
322 done
323 # FIXME: race condition here if user kills between mkdir and trap.
324 trap "rmdir '$lockdir'; exit 1" 1 2 15
325
326 # Run the compile.
327 "$@"
328 ret=$?
329
330 if test -f "$cofile"; then
331 test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
332 elif test -f "${cofile}bj"; then
333 test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
334 fi
335
336 rmdir "$lockdir"
337 exit $ret
338
339 # Local Variables:
340 # mode: shell-script
341 # sh-indentation: 2
342 # eval: (add-hook 'before-save-hook 'time-stamp)
343 # time-stamp-start: "scriptversion="
344 # time-stamp-format: "%:y-%02m-%02d.%02H"
345 # time-stamp-time-zone: "UTC0"
346 # time-stamp-end: "; # UTC"
347 # End:
0 #! /bin/sh
1 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.71 for openfortivpn 1.17.1.
3 #
4 #
5 # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation,
6 # Inc.
7 #
8 #
9 # This configure script is free software; the Free Software Foundation
10 # gives unlimited permission to copy, distribute and modify it.
11 ## -------------------- ##
12 ## M4sh Initialization. ##
13 ## -------------------- ##
14
15 # Be more Bourne compatible
16 DUALCASE=1; export DUALCASE # for MKS sh
17 as_nop=:
18 if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
19 then :
20 emulate sh
21 NULLCMD=:
22 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
23 # is contrary to our usage. Disable this feature.
24 alias -g '${1+"$@"}'='"$@"'
25 setopt NO_GLOB_SUBST
26 else $as_nop
27 case `(set -o) 2>/dev/null` in #(
28 *posix*) :
29 set -o posix ;; #(
30 *) :
31 ;;
32 esac
33 fi
34
35
36
37 # Reset variables that may have inherited troublesome values from
38 # the environment.
39
40 # IFS needs to be set, to space, tab, and newline, in precisely that order.
41 # (If _AS_PATH_WALK were called with IFS unset, it would have the
42 # side effect of setting IFS to empty, thus disabling word splitting.)
43 # Quoting is to prevent editors from complaining about space-tab.
44 as_nl='
45 '
46 export as_nl
47 IFS=" "" $as_nl"
48
49 PS1='$ '
50 PS2='> '
51 PS4='+ '
52
53 # Ensure predictable behavior from utilities with locale-dependent output.
54 LC_ALL=C
55 export LC_ALL
56 LANGUAGE=C
57 export LANGUAGE
58
59 # We cannot yet rely on "unset" to work, but we need these variables
60 # to be unset--not just set to an empty or harmless value--now, to
61 # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
62 # also avoids known problems related to "unset" and subshell syntax
63 # in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
64 for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
65 do eval test \${$as_var+y} \
66 && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
67 done
68
69 # Ensure that fds 0, 1, and 2 are open.
70 if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
71 if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
72 if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
73
74 # The user is always right.
75 if ${PATH_SEPARATOR+false} :; then
76 PATH_SEPARATOR=:
77 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
78 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
79 PATH_SEPARATOR=';'
80 }
81 fi
82
83
84 # Find who we are. Look in the path if we contain no directory separator.
85 as_myself=
86 case $0 in #((
87 *[\\/]* ) as_myself=$0 ;;
88 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
89 for as_dir in $PATH
90 do
91 IFS=$as_save_IFS
92 case $as_dir in #(((
93 '') as_dir=./ ;;
94 */) ;;
95 *) as_dir=$as_dir/ ;;
96 esac
97 test -r "$as_dir$0" && as_myself=$as_dir$0 && break
98 done
99 IFS=$as_save_IFS
100
101 ;;
102 esac
103 # We did not find ourselves, most probably we were run as `sh COMMAND'
104 # in which case we are not to be found in the path.
105 if test "x$as_myself" = x; then
106 as_myself=$0
107 fi
108 if test ! -f "$as_myself"; then
109 printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
110 exit 1
111 fi
112
113
114 # Use a proper internal environment variable to ensure we don't fall
115 # into an infinite loop, continuously re-executing ourselves.
116 if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
117 _as_can_reexec=no; export _as_can_reexec;
118 # We cannot yet assume a decent shell, so we have to provide a
119 # neutralization value for shells without unset; and this also
120 # works around shells that cannot unset nonexistent variables.
121 # Preserve -v and -x to the replacement shell.
122 BASH_ENV=/dev/null
123 ENV=/dev/null
124 (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
125 case $- in # ((((
126 *v*x* | *x*v* ) as_opts=-vx ;;
127 *v* ) as_opts=-v ;;
128 *x* ) as_opts=-x ;;
129 * ) as_opts= ;;
130 esac
131 exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
132 # Admittedly, this is quite paranoid, since all the known shells bail
133 # out after a failed `exec'.
134 printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
135 exit 255
136 fi
137 # We don't want this to propagate to other subprocesses.
138 { _as_can_reexec=; unset _as_can_reexec;}
139 if test "x$CONFIG_SHELL" = x; then
140 as_bourne_compatible="as_nop=:
141 if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
142 then :
143 emulate sh
144 NULLCMD=:
145 # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
146 # is contrary to our usage. Disable this feature.
147 alias -g '\${1+\"\$@\"}'='\"\$@\"'
148 setopt NO_GLOB_SUBST
149 else \$as_nop
150 case \`(set -o) 2>/dev/null\` in #(
151 *posix*) :
152 set -o posix ;; #(
153 *) :
154 ;;
155 esac
156 fi
157 "
158 as_required="as_fn_return () { (exit \$1); }
159 as_fn_success () { as_fn_return 0; }
160 as_fn_failure () { as_fn_return 1; }
161 as_fn_ret_success () { return 0; }
162 as_fn_ret_failure () { return 1; }
163
164 exitcode=0
165 as_fn_success || { exitcode=1; echo as_fn_success failed.; }
166 as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
167 as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
168 as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
169 if ( set x; as_fn_ret_success y && test x = \"\$1\" )
170 then :
171
172 else \$as_nop
173 exitcode=1; echo positional parameters were not saved.
174 fi
175 test x\$exitcode = x0 || exit 1
176 blah=\$(echo \$(echo blah))
177 test x\"\$blah\" = xblah || exit 1
178 test -x / || exit 1"
179 as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
180 as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
181 eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
182 test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
183 test \$(( 1 + 1 )) = 2 || exit 1"
184 if (eval "$as_required") 2>/dev/null
185 then :
186 as_have_required=yes
187 else $as_nop
188 as_have_required=no
189 fi
190 if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null
191 then :
192
193 else $as_nop
194 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
195 as_found=false
196 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
197 do
198 IFS=$as_save_IFS
199 case $as_dir in #(((
200 '') as_dir=./ ;;
201 */) ;;
202 *) as_dir=$as_dir/ ;;
203 esac
204 as_found=:
205 case $as_dir in #(
206 /*)
207 for as_base in sh bash ksh sh5; do
208 # Try only shells that exist, to save several forks.
209 as_shell=$as_dir$as_base
210 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
211 as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null
212 then :
213 CONFIG_SHELL=$as_shell as_have_required=yes
214 if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null
215 then :
216 break 2
217 fi
218 fi
219 done;;
220 esac
221 as_found=false
222 done
223 IFS=$as_save_IFS
224 if $as_found
225 then :
226
227 else $as_nop
228 if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
229 as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null
230 then :
231 CONFIG_SHELL=$SHELL as_have_required=yes
232 fi
233 fi
234
235
236 if test "x$CONFIG_SHELL" != x
237 then :
238 export CONFIG_SHELL
239 # We cannot yet assume a decent shell, so we have to provide a
240 # neutralization value for shells without unset; and this also
241 # works around shells that cannot unset nonexistent variables.
242 # Preserve -v and -x to the replacement shell.
243 BASH_ENV=/dev/null
244 ENV=/dev/null
245 (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
246 case $- in # ((((
247 *v*x* | *x*v* ) as_opts=-vx ;;
248 *v* ) as_opts=-v ;;
249 *x* ) as_opts=-x ;;
250 * ) as_opts= ;;
251 esac
252 exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
253 # Admittedly, this is quite paranoid, since all the known shells bail
254 # out after a failed `exec'.
255 printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2
256 exit 255
257 fi
258
259 if test x$as_have_required = xno
260 then :
261 printf "%s\n" "$0: This script requires a shell more modern than all"
262 printf "%s\n" "$0: the shells that I found on your system."
263 if test ${ZSH_VERSION+y} ; then
264 printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should"
265 printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later."
266 else
267 printf "%s\n" "$0: Please tell bug-autoconf@gnu.org about your system,
268 $0: including any error possibly output before this
269 $0: message. Then install a modern shell, or manually run
270 $0: the script under such a shell if you do have one."
271 fi
272 exit 1
273 fi
274 fi
275 fi
276 SHELL=${CONFIG_SHELL-/bin/sh}
277 export SHELL
278 # Unset more variables known to interfere with behavior of common tools.
279 CLICOLOR_FORCE= GREP_OPTIONS=
280 unset CLICOLOR_FORCE GREP_OPTIONS
281
282 ## --------------------- ##
283 ## M4sh Shell Functions. ##
284 ## --------------------- ##
285 # as_fn_unset VAR
286 # ---------------
287 # Portably unset VAR.
288 as_fn_unset ()
289 {
290 { eval $1=; unset $1;}
291 }
292 as_unset=as_fn_unset
293
294
295 # as_fn_set_status STATUS
296 # -----------------------
297 # Set $? to STATUS, without forking.
298 as_fn_set_status ()
299 {
300 return $1
301 } # as_fn_set_status
302
303 # as_fn_exit STATUS
304 # -----------------
305 # Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
306 as_fn_exit ()
307 {
308 set +e
309 as_fn_set_status $1
310 exit $1
311 } # as_fn_exit
312 # as_fn_nop
313 # ---------
314 # Do nothing but, unlike ":", preserve the value of $?.
315 as_fn_nop ()
316 {
317 return $?
318 }
319 as_nop=as_fn_nop
320
321 # as_fn_mkdir_p
322 # -------------
323 # Create "$as_dir" as a directory, including parents if necessary.
324 as_fn_mkdir_p ()
325 {
326
327 case $as_dir in #(
328 -*) as_dir=./$as_dir;;
329 esac
330 test -d "$as_dir" || eval $as_mkdir_p || {
331 as_dirs=
332 while :; do
333 case $as_dir in #(
334 *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
335 *) as_qdir=$as_dir;;
336 esac
337 as_dirs="'$as_qdir' $as_dirs"
338 as_dir=`$as_dirname -- "$as_dir" ||
339 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
340 X"$as_dir" : 'X\(//\)[^/]' \| \
341 X"$as_dir" : 'X\(//\)$' \| \
342 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
343 printf "%s\n" X"$as_dir" |
344 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
345 s//\1/
346 q
347 }
348 /^X\(\/\/\)[^/].*/{
349 s//\1/
350 q
351 }
352 /^X\(\/\/\)$/{
353 s//\1/
354 q
355 }
356 /^X\(\/\).*/{
357 s//\1/
358 q
359 }
360 s/.*/./; q'`
361 test -d "$as_dir" && break
362 done
363 test -z "$as_dirs" || eval "mkdir $as_dirs"
364 } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
365
366
367 } # as_fn_mkdir_p
368
369 # as_fn_executable_p FILE
370 # -----------------------
371 # Test if FILE is an executable regular file.
372 as_fn_executable_p ()
373 {
374 test -f "$1" && test -x "$1"
375 } # as_fn_executable_p
376 # as_fn_append VAR VALUE
377 # ----------------------
378 # Append the text in VALUE to the end of the definition contained in VAR. Take
379 # advantage of any shell optimizations that allow amortized linear growth over
380 # repeated appends, instead of the typical quadratic growth present in naive
381 # implementations.
382 if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
383 then :
384 eval 'as_fn_append ()
385 {
386 eval $1+=\$2
387 }'
388 else $as_nop
389 as_fn_append ()
390 {
391 eval $1=\$$1\$2
392 }
393 fi # as_fn_append
394
395 # as_fn_arith ARG...
396 # ------------------
397 # Perform arithmetic evaluation on the ARGs, and store the result in the
398 # global $as_val. Take advantage of shells that can avoid forks. The arguments
399 # must be portable across $(()) and expr.
400 if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
401 then :
402 eval 'as_fn_arith ()
403 {
404 as_val=$(( $* ))
405 }'
406 else $as_nop
407 as_fn_arith ()
408 {
409 as_val=`expr "$@" || test $? -eq 1`
410 }
411 fi # as_fn_arith
412
413 # as_fn_nop
414 # ---------
415 # Do nothing but, unlike ":", preserve the value of $?.
416 as_fn_nop ()
417 {
418 return $?
419 }
420 as_nop=as_fn_nop
421
422 # as_fn_error STATUS ERROR [LINENO LOG_FD]
423 # ----------------------------------------
424 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
425 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
426 # script with STATUS, using 1 if that was 0.
427 as_fn_error ()
428 {
429 as_status=$1; test $as_status -eq 0 && as_status=1
430 if test "$4"; then
431 as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
432 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
433 fi
434 printf "%s\n" "$as_me: error: $2" >&2
435 as_fn_exit $as_status
436 } # as_fn_error
437
438 if expr a : '\(a\)' >/dev/null 2>&1 &&
439 test "X`expr 00001 : '.*\(...\)'`" = X001; then
440 as_expr=expr
441 else
442 as_expr=false
443 fi
444
445 if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
446 as_basename=basename
447 else
448 as_basename=false
449 fi
450
451 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
452 as_dirname=dirname
453 else
454 as_dirname=false
455 fi
456
457 as_me=`$as_basename -- "$0" ||
458 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
459 X"$0" : 'X\(//\)$' \| \
460 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
461 printf "%s\n" X/"$0" |
462 sed '/^.*\/\([^/][^/]*\)\/*$/{
463 s//\1/
464 q
465 }
466 /^X\/\(\/\/\)$/{
467 s//\1/
468 q
469 }
470 /^X\/\(\/\).*/{
471 s//\1/
472 q
473 }
474 s/.*/./; q'`
475
476 # Avoid depending upon Character Ranges.
477 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
478 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
479 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
480 as_cr_digits='0123456789'
481 as_cr_alnum=$as_cr_Letters$as_cr_digits
482
483
484 as_lineno_1=$LINENO as_lineno_1a=$LINENO
485 as_lineno_2=$LINENO as_lineno_2a=$LINENO
486 eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
487 test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
488 # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
489 sed -n '
490 p
491 /[$]LINENO/=
492 ' <$as_myself |
493 sed '
494 s/[$]LINENO.*/&-/
495 t lineno
496 b
497 :lineno
498 N
499 :loop
500 s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
501 t loop
502 s/-\n.*//
503 ' >$as_me.lineno &&
504 chmod +x "$as_me.lineno" ||
505 { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
506
507 # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
508 # already done that, so ensure we don't try to do so again and fall
509 # in an infinite loop. This has already happened in practice.
510 _as_can_reexec=no; export _as_can_reexec
511 # Don't try to exec as it changes $[0], causing all sort of problems
512 # (the dirname of $[0] is not the place where we might find the
513 # original and so on. Autoconf is especially sensitive to this).
514 . "./$as_me.lineno"
515 # Exit status is that of the last command.
516 exit
517 }
518
519
520 # Determine whether it's possible to make 'echo' print without a newline.
521 # These variables are no longer used directly by Autoconf, but are AC_SUBSTed
522 # for compatibility with existing Makefiles.
523 ECHO_C= ECHO_N= ECHO_T=
524 case `echo -n x` in #(((((
525 -n*)
526 case `echo 'xy\c'` in
527 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
528 xy) ECHO_C='\c';;
529 *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
530 ECHO_T=' ';;
531 esac;;
532 *)
533 ECHO_N='-n';;
534 esac
535
536 # For backward compatibility with old third-party macros, we provide
537 # the shell variables $as_echo and $as_echo_n. New code should use
538 # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
539 as_echo='printf %s\n'
540 as_echo_n='printf %s'
541
542
543 rm -f conf$$ conf$$.exe conf$$.file
544 if test -d conf$$.dir; then
545 rm -f conf$$.dir/conf$$.file
546 else
547 rm -f conf$$.dir
548 mkdir conf$$.dir 2>/dev/null
549 fi
550 if (echo >conf$$.file) 2>/dev/null; then
551 if ln -s conf$$.file conf$$ 2>/dev/null; then
552 as_ln_s='ln -s'
553 # ... but there are two gotchas:
554 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
555 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
556 # In both cases, we have to default to `cp -pR'.
557 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
558 as_ln_s='cp -pR'
559 elif ln conf$$.file conf$$ 2>/dev/null; then
560 as_ln_s=ln
561 else
562 as_ln_s='cp -pR'
563 fi
564 else
565 as_ln_s='cp -pR'
566 fi
567 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
568 rmdir conf$$.dir 2>/dev/null
569
570 if mkdir -p . 2>/dev/null; then
571 as_mkdir_p='mkdir -p "$as_dir"'
572 else
573 test -d ./-p && rmdir ./-p
574 as_mkdir_p=false
575 fi
576
577 as_test_x='test -x'
578 as_executable_p=as_fn_executable_p
579
580 # Sed expression to map a string onto a valid CPP name.
581 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
582
583 # Sed expression to map a string onto a valid variable name.
584 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
585
586
587 test -n "$DJDIR" || exec 7<&0 </dev/null
588 exec 6>&1
589
590 # Name of the host.
591 # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
592 # so uname gets run too.
593 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
594
595 #
596 # Initializations.
597 #
598 ac_default_prefix=/usr/local
599 ac_clean_files=
600 ac_config_libobj_dir=.
601 LIBOBJS=
602 cross_compiling=no
603 subdirs=
604 MFLAGS=
605 MAKEFLAGS=
606
607 # Identity of this package.
608 PACKAGE_NAME='openfortivpn'
609 PACKAGE_TARNAME='openfortivpn'
610 PACKAGE_VERSION='1.17.1'
611 PACKAGE_STRING='openfortivpn 1.17.1'
612 PACKAGE_BUGREPORT=''
613 PACKAGE_URL=''
614
615 ac_unique_file="src/main.c"
616 # Factoring default headers for most tests.
617 ac_includes_default="\
618 #include <stddef.h>
619 #ifdef HAVE_STDIO_H
620 # include <stdio.h>
621 #endif
622 #ifdef HAVE_STDLIB_H
623 # include <stdlib.h>
624 #endif
625 #ifdef HAVE_STRING_H
626 # include <string.h>
627 #endif
628 #ifdef HAVE_INTTYPES_H
629 # include <inttypes.h>
630 #endif
631 #ifdef HAVE_STDINT_H
632 # include <stdint.h>
633 #endif
634 #ifdef HAVE_STRINGS_H
635 # include <strings.h>
636 #endif
637 #ifdef HAVE_SYS_TYPES_H
638 # include <sys/types.h>
639 #endif
640 #ifdef HAVE_SYS_STAT_H
641 # include <sys/stat.h>
642 #endif
643 #ifdef HAVE_UNISTD_H
644 # include <unistd.h>
645 #endif"
646
647 ac_header_c_list=
648 ac_subst_vars='am__EXEEXT_FALSE
649 am__EXEEXT_TRUE
650 LTLIBOBJS
651 LIBOBJS
652 HAVE_SYSTEMD_FALSE
653 HAVE_SYSTEMD_TRUE
654 systemdsystemunitdir
655 RESOLVCONF_PATH
656 NETSTAT_PATH
657 PPP_PATH
658 PPPD
659 PPP
660 LIBSYSTEMD_LIBS
661 LIBSYSTEMD_CFLAGS
662 OPENSSL_LIBS
663 OPENSSL_CFLAGS
664 REVISION
665 GIT
666 PKG_CONFIG_LIBDIR
667 PKG_CONFIG_PATH
668 PKG_CONFIG
669 SED
670 am__fastdepCC_FALSE
671 am__fastdepCC_TRUE
672 CCDEPMODE
673 am__nodep
674 AMDEPBACKSLASH
675 AMDEP_FALSE
676 AMDEP_TRUE
677 am__include
678 DEPDIR
679 OBJEXT
680 EXEEXT
681 ac_ct_CC
682 CPPFLAGS
683 LDFLAGS
684 CFLAGS
685 CC
686 AM_BACKSLASH
687 AM_DEFAULT_VERBOSITY
688 AM_DEFAULT_V
689 AM_V
690 CSCOPE
691 ETAGS
692 CTAGS
693 am__untar
694 am__tar
695 AMTAR
696 am__leading_dot
697 SET_MAKE
698 AWK
699 mkdir_p
700 MKDIR_P
701 INSTALL_STRIP_PROGRAM
702 STRIP
703 install_sh
704 MAKEINFO
705 AUTOHEADER
706 AUTOMAKE
707 AUTOCONF
708 ACLOCAL
709 VERSION
710 PACKAGE
711 CYGPATH_W
712 am__isrc
713 INSTALL_DATA
714 INSTALL_SCRIPT
715 INSTALL_PROGRAM
716 target_alias
717 host_alias
718 build_alias
719 LIBS
720 ECHO_T
721 ECHO_N
722 ECHO_C
723 DEFS
724 mandir
725 localedir
726 libdir
727 psdir
728 pdfdir
729 dvidir
730 htmldir
731 infodir
732 docdir
733 oldincludedir
734 includedir
735 runstatedir
736 localstatedir
737 sharedstatedir
738 sysconfdir
739 datadir
740 datarootdir
741 libexecdir
742 sbindir
743 bindir
744 program_transform_name
745 prefix
746 exec_prefix
747 PACKAGE_URL
748 PACKAGE_BUGREPORT
749 PACKAGE_STRING
750 PACKAGE_VERSION
751 PACKAGE_TARNAME
752 PACKAGE_NAME
753 PATH_SEPARATOR
754 SHELL
755 am__quote'
756 ac_subst_files=''
757 ac_user_opts='
758 enable_option_checking
759 enable_silent_rules
760 enable_dependency_tracking
761 with_rt_dst
762 with_netstat
763 with_pppd
764 with_ppp
765 enable_proc
766 with_resolvconf
767 enable_resolvconf
768 with_systemdsystemunitdir
769 enable_obsolete
770 '
771 ac_precious_vars='build_alias
772 host_alias
773 target_alias
774 CC
775 CFLAGS
776 LDFLAGS
777 LIBS
778 CPPFLAGS
779 PKG_CONFIG
780 PKG_CONFIG_PATH
781 PKG_CONFIG_LIBDIR
782 OPENSSL_CFLAGS
783 OPENSSL_LIBS
784 LIBSYSTEMD_CFLAGS
785 LIBSYSTEMD_LIBS'
786
787
788 # Initialize some variables set by options.
789 ac_init_help=
790 ac_init_version=false
791 ac_unrecognized_opts=
792 ac_unrecognized_sep=
793 # The variables have the same names as the options, with
794 # dashes changed to underlines.
795 cache_file=/dev/null
796 exec_prefix=NONE
797 no_create=
798 no_recursion=
799 prefix=NONE
800 program_prefix=NONE
801 program_suffix=NONE
802 program_transform_name=s,x,x,
803 silent=
804 site=
805 srcdir=
806 verbose=
807 x_includes=NONE
808 x_libraries=NONE
809
810 # Installation directory options.
811 # These are left unexpanded so users can "make install exec_prefix=/foo"
812 # and all the variables that are supposed to be based on exec_prefix
813 # by default will actually change.
814 # Use braces instead of parens because sh, perl, etc. also accept them.
815 # (The list follows the same order as the GNU Coding Standards.)
816 bindir='${exec_prefix}/bin'
817 sbindir='${exec_prefix}/sbin'
818 libexecdir='${exec_prefix}/libexec'
819 datarootdir='${prefix}/share'
820 datadir='${datarootdir}'
821 sysconfdir='${prefix}/etc'
822 sharedstatedir='${prefix}/com'
823 localstatedir='${prefix}/var'
824 runstatedir='${localstatedir}/run'
825 includedir='${prefix}/include'
826 oldincludedir='/usr/include'
827 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
828 infodir='${datarootdir}/info'
829 htmldir='${docdir}'
830 dvidir='${docdir}'
831 pdfdir='${docdir}'
832 psdir='${docdir}'
833 libdir='${exec_prefix}/lib'
834 localedir='${datarootdir}/locale'
835 mandir='${datarootdir}/man'
836
837 ac_prev=
838 ac_dashdash=
839 for ac_option
840 do
841 # If the previous option needs an argument, assign it.
842 if test -n "$ac_prev"; then
843 eval $ac_prev=\$ac_option
844 ac_prev=
845 continue
846 fi
847
848 case $ac_option in
849 *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
850 *=) ac_optarg= ;;
851 *) ac_optarg=yes ;;
852 esac
853
854 case $ac_dashdash$ac_option in
855 --)
856 ac_dashdash=yes ;;
857
858 -bindir | --bindir | --bindi | --bind | --bin | --bi)
859 ac_prev=bindir ;;
860 -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
861 bindir=$ac_optarg ;;
862
863 -build | --build | --buil | --bui | --bu)
864 ac_prev=build_alias ;;
865 -build=* | --build=* | --buil=* | --bui=* | --bu=*)
866 build_alias=$ac_optarg ;;
867
868 -cache-file | --cache-file | --cache-fil | --cache-fi \
869 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
870 ac_prev=cache_file ;;
871 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
872 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
873 cache_file=$ac_optarg ;;
874
875 --config-cache | -C)
876 cache_file=config.cache ;;
877
878 -datadir | --datadir | --datadi | --datad)
879 ac_prev=datadir ;;
880 -datadir=* | --datadir=* | --datadi=* | --datad=*)
881 datadir=$ac_optarg ;;
882
883 -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
884 | --dataroo | --dataro | --datar)
885 ac_prev=datarootdir ;;
886 -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
887 | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
888 datarootdir=$ac_optarg ;;
889
890 -disable-* | --disable-*)
891 ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
892 # Reject names that are not valid shell variable names.
893 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
894 as_fn_error $? "invalid feature name: \`$ac_useropt'"
895 ac_useropt_orig=$ac_useropt
896 ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
897 case $ac_user_opts in
898 *"
899 "enable_$ac_useropt"
900 "*) ;;
901 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
902 ac_unrecognized_sep=', ';;
903 esac
904 eval enable_$ac_useropt=no ;;
905
906 -docdir | --docdir | --docdi | --doc | --do)
907 ac_prev=docdir ;;
908 -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
909 docdir=$ac_optarg ;;
910
911 -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
912 ac_prev=dvidir ;;
913 -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
914 dvidir=$ac_optarg ;;
915
916 -enable-* | --enable-*)
917 ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
918 # Reject names that are not valid shell variable names.
919 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
920 as_fn_error $? "invalid feature name: \`$ac_useropt'"
921 ac_useropt_orig=$ac_useropt
922 ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
923 case $ac_user_opts in
924 *"
925 "enable_$ac_useropt"
926 "*) ;;
927 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
928 ac_unrecognized_sep=', ';;
929 esac
930 eval enable_$ac_useropt=\$ac_optarg ;;
931
932 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
933 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
934 | --exec | --exe | --ex)
935 ac_prev=exec_prefix ;;
936 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
937 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
938 | --exec=* | --exe=* | --ex=*)
939 exec_prefix=$ac_optarg ;;
940
941 -gas | --gas | --ga | --g)
942 # Obsolete; use --with-gas.
943 with_gas=yes ;;
944
945 -help | --help | --hel | --he | -h)
946 ac_init_help=long ;;
947 -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
948 ac_init_help=recursive ;;
949 -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
950 ac_init_help=short ;;
951
952 -host | --host | --hos | --ho)
953 ac_prev=host_alias ;;
954 -host=* | --host=* | --hos=* | --ho=*)
955 host_alias=$ac_optarg ;;
956
957 -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
958 ac_prev=htmldir ;;
959 -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
960 | --ht=*)
961 htmldir=$ac_optarg ;;
962
963 -includedir | --includedir | --includedi | --included | --include \
964 | --includ | --inclu | --incl | --inc)
965 ac_prev=includedir ;;
966 -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
967 | --includ=* | --inclu=* | --incl=* | --inc=*)
968 includedir=$ac_optarg ;;
969
970 -infodir | --infodir | --infodi | --infod | --info | --inf)
971 ac_prev=infodir ;;
972 -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
973 infodir=$ac_optarg ;;
974
975 -libdir | --libdir | --libdi | --libd)
976 ac_prev=libdir ;;
977 -libdir=* | --libdir=* | --libdi=* | --libd=*)
978 libdir=$ac_optarg ;;
979
980 -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
981 | --libexe | --libex | --libe)
982 ac_prev=libexecdir ;;
983 -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
984 | --libexe=* | --libex=* | --libe=*)
985 libexecdir=$ac_optarg ;;
986
987 -localedir | --localedir | --localedi | --localed | --locale)
988 ac_prev=localedir ;;
989 -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
990 localedir=$ac_optarg ;;
991
992 -localstatedir | --localstatedir | --localstatedi | --localstated \
993 | --localstate | --localstat | --localsta | --localst | --locals)
994 ac_prev=localstatedir ;;
995 -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
996 | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
997 localstatedir=$ac_optarg ;;
998
999 -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
1000 ac_prev=mandir ;;
1001 -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
1002 mandir=$ac_optarg ;;
1003
1004 -nfp | --nfp | --nf)
1005 # Obsolete; use --without-fp.
1006 with_fp=no ;;
1007
1008 -no-create | --no-create | --no-creat | --no-crea | --no-cre \
1009 | --no-cr | --no-c | -n)
1010 no_create=yes ;;
1011
1012 -no-recursion | --no-recursion | --no-recursio | --no-recursi \
1013 | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
1014 no_recursion=yes ;;
1015
1016 -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
1017 | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
1018 | --oldin | --oldi | --old | --ol | --o)
1019 ac_prev=oldincludedir ;;
1020 -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
1021 | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
1022 | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
1023 oldincludedir=$ac_optarg ;;
1024
1025 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
1026 ac_prev=prefix ;;
1027 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
1028 prefix=$ac_optarg ;;
1029
1030 -program-prefix | --program-prefix | --program-prefi | --program-pref \
1031 | --program-pre | --program-pr | --program-p)
1032 ac_prev=program_prefix ;;
1033 -program-prefix=* | --program-prefix=* | --program-prefi=* \
1034 | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
1035 program_prefix=$ac_optarg ;;
1036
1037 -program-suffix | --program-suffix | --program-suffi | --program-suff \
1038 | --program-suf | --program-su | --program-s)
1039 ac_prev=program_suffix ;;
1040 -program-suffix=* | --program-suffix=* | --program-suffi=* \
1041 | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
1042 program_suffix=$ac_optarg ;;
1043
1044 -program-transform-name | --program-transform-name \
1045 | --program-transform-nam | --program-transform-na \
1046 | --program-transform-n | --program-transform- \
1047 | --program-transform | --program-transfor \
1048 | --program-transfo | --program-transf \
1049 | --program-trans | --program-tran \
1050 | --progr-tra | --program-tr | --program-t)
1051 ac_prev=program_transform_name ;;
1052 -program-transform-name=* | --program-transform-name=* \
1053 | --program-transform-nam=* | --program-transform-na=* \
1054 | --program-transform-n=* | --program-transform-=* \
1055 | --program-transform=* | --program-transfor=* \
1056 | --program-transfo=* | --program-transf=* \
1057 | --program-trans=* | --program-tran=* \
1058 | --progr-tra=* | --program-tr=* | --program-t=*)
1059 program_transform_name=$ac_optarg ;;
1060
1061 -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
1062 ac_prev=pdfdir ;;
1063 -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
1064 pdfdir=$ac_optarg ;;
1065
1066 -psdir | --psdir | --psdi | --psd | --ps)
1067 ac_prev=psdir ;;
1068 -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
1069 psdir=$ac_optarg ;;
1070
1071 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
1072 | -silent | --silent | --silen | --sile | --sil)
1073 silent=yes ;;
1074
1075 -runstatedir | --runstatedir | --runstatedi | --runstated \
1076 | --runstate | --runstat | --runsta | --runst | --runs \
1077 | --run | --ru | --r)
1078 ac_prev=runstatedir ;;
1079 -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
1080 | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
1081 | --run=* | --ru=* | --r=*)
1082 runstatedir=$ac_optarg ;;
1083
1084 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
1085 ac_prev=sbindir ;;
1086 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
1087 | --sbi=* | --sb=*)
1088 sbindir=$ac_optarg ;;
1089
1090 -sharedstatedir | --sharedstatedir | --sharedstatedi \
1091 | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
1092 | --sharedst | --shareds | --shared | --share | --shar \
1093 | --sha | --sh)
1094 ac_prev=sharedstatedir ;;
1095 -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
1096 | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
1097 | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
1098 | --sha=* | --sh=*)
1099 sharedstatedir=$ac_optarg ;;
1100
1101 -site | --site | --sit)
1102 ac_prev=site ;;
1103 -site=* | --site=* | --sit=*)
1104 site=$ac_optarg ;;
1105
1106 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
1107 ac_prev=srcdir ;;
1108 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
1109 srcdir=$ac_optarg ;;
1110
1111 -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
1112 | --syscon | --sysco | --sysc | --sys | --sy)
1113 ac_prev=sysconfdir ;;
1114 -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
1115 | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
1116 sysconfdir=$ac_optarg ;;
1117
1118 -target | --target | --targe | --targ | --tar | --ta | --t)
1119 ac_prev=target_alias ;;
1120 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
1121 target_alias=$ac_optarg ;;
1122
1123 -v | -verbose | --verbose | --verbos | --verbo | --verb)
1124 verbose=yes ;;
1125
1126 -version | --version | --versio | --versi | --vers | -V)
1127 ac_init_version=: ;;
1128
1129 -with-* | --with-*)
1130 ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
1131 # Reject names that are not valid shell variable names.
1132 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
1133 as_fn_error $? "invalid package name: \`$ac_useropt'"
1134 ac_useropt_orig=$ac_useropt
1135 ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
1136 case $ac_user_opts in
1137 *"
1138 "with_$ac_useropt"
1139 "*) ;;
1140 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
1141 ac_unrecognized_sep=', ';;
1142 esac
1143 eval with_$ac_useropt=\$ac_optarg ;;
1144
1145 -without-* | --without-*)
1146 ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
1147 # Reject names that are not valid shell variable names.
1148 expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
1149 as_fn_error $? "invalid package name: \`$ac_useropt'"
1150 ac_useropt_orig=$ac_useropt
1151 ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'`
1152 case $ac_user_opts in
1153 *"
1154 "with_$ac_useropt"
1155 "*) ;;
1156 *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
1157 ac_unrecognized_sep=', ';;
1158 esac
1159 eval with_$ac_useropt=no ;;
1160
1161 --x)
1162 # Obsolete; use --with-x.
1163 with_x=yes ;;
1164
1165 -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
1166 | --x-incl | --x-inc | --x-in | --x-i)
1167 ac_prev=x_includes ;;
1168 -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
1169 | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
1170 x_includes=$ac_optarg ;;
1171
1172 -x-libraries | --x-libraries | --x-librarie | --x-librari \
1173 | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
1174 ac_prev=x_libraries ;;
1175 -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
1176 | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
1177 x_libraries=$ac_optarg ;;
1178
1179 -*) as_fn_error $? "unrecognized option: \`$ac_option'
1180 Try \`$0 --help' for more information"
1181 ;;
1182
1183 *=*)
1184 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
1185 # Reject names that are not valid shell variable names.
1186 case $ac_envvar in #(
1187 '' | [0-9]* | *[!_$as_cr_alnum]* )
1188 as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
1189 esac
1190 eval $ac_envvar=\$ac_optarg
1191 export $ac_envvar ;;
1192
1193 *)
1194 # FIXME: should be removed in autoconf 3.0.
1195 printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2
1196 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
1197 printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2
1198 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
1199 ;;
1200
1201 esac
1202 done
1203
1204 if test -n "$ac_prev"; then
1205 ac_option=--`echo $ac_prev | sed 's/_/-/g'`
1206 as_fn_error $? "missing argument to $ac_option"
1207 fi
1208
1209 if test -n "$ac_unrecognized_opts"; then
1210 case $enable_option_checking in
1211 no) ;;
1212 fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
1213 *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
1214 esac
1215 fi
1216
1217 # Check all directory arguments for consistency.
1218 for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
1219 datadir sysconfdir sharedstatedir localstatedir includedir \
1220 oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
1221 libdir localedir mandir runstatedir
1222 do
1223 eval ac_val=\$$ac_var
1224 # Remove trailing slashes.
1225 case $ac_val in
1226 */ )
1227 ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
1228 eval $ac_var=\$ac_val;;
1229 esac
1230 # Be sure to have absolute directory names.
1231 case $ac_val in
1232 [\\/$]* | ?:[\\/]* ) continue;;
1233 NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
1234 esac
1235 as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
1236 done
1237
1238 # There might be people who depend on the old broken behavior: `$host'
1239 # used to hold the argument of --host etc.
1240 # FIXME: To remove some day.
1241 build=$build_alias
1242 host=$host_alias
1243 target=$target_alias
1244
1245 # FIXME: To remove some day.
1246 if test "x$host_alias" != x; then
1247 if test "x$build_alias" = x; then
1248 cross_compiling=maybe
1249 elif test "x$build_alias" != "x$host_alias"; then
1250 cross_compiling=yes
1251 fi
1252 fi
1253
1254 ac_tool_prefix=
1255 test -n "$host_alias" && ac_tool_prefix=$host_alias-
1256
1257 test "$silent" = yes && exec 6>/dev/null
1258
1259
1260 ac_pwd=`pwd` && test -n "$ac_pwd" &&
1261 ac_ls_di=`ls -di .` &&
1262 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
1263 as_fn_error $? "working directory cannot be determined"
1264 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
1265 as_fn_error $? "pwd does not report name of working directory"
1266
1267
1268 # Find the source files, if location was not specified.
1269 if test -z "$srcdir"; then
1270 ac_srcdir_defaulted=yes
1271 # Try the directory containing this script, then the parent directory.
1272 ac_confdir=`$as_dirname -- "$as_myself" ||
1273 $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
1274 X"$as_myself" : 'X\(//\)[^/]' \| \
1275 X"$as_myself" : 'X\(//\)$' \| \
1276 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
1277 printf "%s\n" X"$as_myself" |
1278 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
1279 s//\1/
1280 q
1281 }
1282 /^X\(\/\/\)[^/].*/{
1283 s//\1/
1284 q
1285 }
1286 /^X\(\/\/\)$/{
1287 s//\1/
1288 q
1289 }
1290 /^X\(\/\).*/{
1291 s//\1/
1292 q
1293 }
1294 s/.*/./; q'`
1295 srcdir=$ac_confdir
1296 if test ! -r "$srcdir/$ac_unique_file"; then
1297 srcdir=..
1298 fi
1299 else
1300 ac_srcdir_defaulted=no
1301 fi
1302 if test ! -r "$srcdir/$ac_unique_file"; then
1303 test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
1304 as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
1305 fi
1306 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
1307 ac_abs_confdir=`(
1308 cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
1309 pwd)`
1310 # When building in place, set srcdir=.
1311 if test "$ac_abs_confdir" = "$ac_pwd"; then
1312 srcdir=.
1313 fi
1314 # Remove unnecessary trailing slashes from srcdir.
1315 # Double slashes in file names in object file debugging info
1316 # mess up M-x gdb in Emacs.
1317 case $srcdir in
1318 */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
1319 esac
1320 for ac_var in $ac_precious_vars; do
1321 eval ac_env_${ac_var}_set=\${${ac_var}+set}
1322 eval ac_env_${ac_var}_value=\$${ac_var}
1323 eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
1324 eval ac_cv_env_${ac_var}_value=\$${ac_var}
1325 done
1326
1327 #
1328 # Report the --help message.
1329 #
1330 if test "$ac_init_help" = "long"; then
1331 # Omit some internal or obsolete options to make the list less imposing.
1332 # This message is too long to be a string in the A/UX 3.1 sh.
1333 cat <<_ACEOF
1334 \`configure' configures openfortivpn 1.17.1 to adapt to many kinds of systems.
1335
1336 Usage: $0 [OPTION]... [VAR=VALUE]...
1337
1338 To assign environment variables (e.g., CC, CFLAGS...), specify them as
1339 VAR=VALUE. See below for descriptions of some of the useful variables.
1340
1341 Defaults for the options are specified in brackets.
1342
1343 Configuration:
1344 -h, --help display this help and exit
1345 --help=short display options specific to this package
1346 --help=recursive display the short help of all the included packages
1347 -V, --version display version information and exit
1348 -q, --quiet, --silent do not print \`checking ...' messages
1349 --cache-file=FILE cache test results in FILE [disabled]
1350 -C, --config-cache alias for \`--cache-file=config.cache'
1351 -n, --no-create do not create output files
1352 --srcdir=DIR find the sources in DIR [configure dir or \`..']
1353
1354 Installation directories:
1355 --prefix=PREFIX install architecture-independent files in PREFIX
1356 [$ac_default_prefix]
1357 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
1358 [PREFIX]
1359
1360 By default, \`make install' will install all the files in
1361 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
1362 an installation prefix other than \`$ac_default_prefix' using \`--prefix',
1363 for instance \`--prefix=\$HOME'.
1364
1365 For better control, use the options below.
1366
1367 Fine tuning of the installation directories:
1368 --bindir=DIR user executables [EPREFIX/bin]
1369 --sbindir=DIR system admin executables [EPREFIX/sbin]
1370 --libexecdir=DIR program executables [EPREFIX/libexec]
1371 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
1372 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
1373 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
1374 --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
1375 --libdir=DIR object code libraries [EPREFIX/lib]
1376 --includedir=DIR C header files [PREFIX/include]
1377 --oldincludedir=DIR C header files for non-gcc [/usr/include]
1378 --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
1379 --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
1380 --infodir=DIR info documentation [DATAROOTDIR/info]
1381 --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
1382 --mandir=DIR man documentation [DATAROOTDIR/man]
1383 --docdir=DIR documentation root [DATAROOTDIR/doc/openfortivpn]
1384 --htmldir=DIR html documentation [DOCDIR]
1385 --dvidir=DIR dvi documentation [DOCDIR]
1386 --pdfdir=DIR pdf documentation [DOCDIR]
1387 --psdir=DIR ps documentation [DOCDIR]
1388 _ACEOF
1389
1390 cat <<\_ACEOF
1391
1392 Program names:
1393 --program-prefix=PREFIX prepend PREFIX to installed program names
1394 --program-suffix=SUFFIX append SUFFIX to installed program names
1395 --program-transform-name=PROGRAM run sed PROGRAM on installed program names
1396 _ACEOF
1397 fi
1398
1399 if test -n "$ac_init_help"; then
1400 case $ac_init_help in
1401 short | recursive ) echo "Configuration of openfortivpn 1.17.1:";;
1402 esac
1403 cat <<\_ACEOF
1404
1405 Optional Features:
1406 --disable-option-checking ignore unrecognized --enable/--with options
1407 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
1408 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
1409 --enable-silent-rules less verbose build output (undo: "make V=1")
1410 --disable-silent-rules verbose build output (undo: "make V=0")
1411 --enable-dependency-tracking
1412 do not reject slow dependency extractors
1413 --disable-dependency-tracking
1414 speeds up one-time build
1415 --enable-proc enable route manipulations directly via
1416 /proc/net/route when cross-compiling, use
1417 --disable-proc for the opposite
1418 --enable-resolvconf Enable usage of resolvconf at runtime by default.
1419 Use --disable-resolvconf for the opposite, note that
1420 resolvconf support will still be compilled in, but
1421 disabled if not explicitly enabled at runtime.
1422 --enable-obsolete enable support for FortiOS 4
1423
1424 Optional Packages:
1425 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
1426 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
1427 --with-rt_dst disable rtentry with rt_dst testing (for linux
1428 target when cross compile)
1429 --with-netstat set the path to the netstat executable on MacOSX or
1430 FreeBSD
1431 --with-pppd set the path to the pppd daemon executable
1432 --with-ppp set the path to the ppp userspace client on FreeBSD
1433 --with-resolvconf Set the path to the resolvconf executable. Set this
1434 to "DISABLED" to fully disable resolvconf support.
1435 In that case it will not be compiled in and
1436 therefore be unavailable at runtime.
1437 --with-systemdsystemunitdir=DIR
1438 directory for systemd service files
1439
1440 Some influential environment variables:
1441 CC C compiler command
1442 CFLAGS C compiler flags
1443 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
1444 nonstandard directory <lib dir>
1445 LIBS libraries to pass to the linker, e.g. -l<library>
1446 CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
1447 you have headers in a nonstandard directory <include dir>
1448 PKG_CONFIG path to pkg-config utility
1449 PKG_CONFIG_PATH
1450 directories to add to pkg-config's search path
1451 PKG_CONFIG_LIBDIR
1452 path overriding pkg-config's built-in search path
1453 OPENSSL_CFLAGS
1454 C compiler flags for OPENSSL, overriding pkg-config
1455 OPENSSL_LIBS
1456 linker flags for OPENSSL, overriding pkg-config
1457 LIBSYSTEMD_CFLAGS
1458 C compiler flags for LIBSYSTEMD, overriding pkg-config
1459 LIBSYSTEMD_LIBS
1460 linker flags for LIBSYSTEMD, overriding pkg-config
1461
1462 Use these variables to override the choices made by `configure' or to help
1463 it to find libraries and programs with nonstandard names/locations.
1464
1465 Report bugs to the package provider.
1466 _ACEOF
1467 ac_status=$?
1468 fi
1469
1470 if test "$ac_init_help" = "recursive"; then
1471 # If there are subdirs, report their specific --help.
1472 for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
1473 test -d "$ac_dir" ||
1474 { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
1475 continue
1476 ac_builddir=.
1477
1478 case "$ac_dir" in
1479 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
1480 *)
1481 ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
1482 # A ".." for each directory in $ac_dir_suffix.
1483 ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
1484 case $ac_top_builddir_sub in
1485 "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
1486 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
1487 esac ;;
1488 esac
1489 ac_abs_top_builddir=$ac_pwd
1490 ac_abs_builddir=$ac_pwd$ac_dir_suffix
1491 # for backward compatibility:
1492 ac_top_builddir=$ac_top_build_prefix
1493
1494 case $srcdir in
1495 .) # We are building in place.
1496 ac_srcdir=.
1497 ac_top_srcdir=$ac_top_builddir_sub
1498 ac_abs_top_srcdir=$ac_pwd ;;
1499 [\\/]* | ?:[\\/]* ) # Absolute name.
1500 ac_srcdir=$srcdir$ac_dir_suffix;
1501 ac_top_srcdir=$srcdir
1502 ac_abs_top_srcdir=$srcdir ;;
1503 *) # Relative name.
1504 ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
1505 ac_top_srcdir=$ac_top_build_prefix$srcdir
1506 ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
1507 esac
1508 ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
1509
1510 cd "$ac_dir" || { ac_status=$?; continue; }
1511 # Check for configure.gnu first; this name is used for a wrapper for
1512 # Metaconfig's "Configure" on case-insensitive file systems.
1513 if test -f "$ac_srcdir/configure.gnu"; then
1514 echo &&
1515 $SHELL "$ac_srcdir/configure.gnu" --help=recursive
1516 elif test -f "$ac_srcdir/configure"; then
1517 echo &&
1518 $SHELL "$ac_srcdir/configure" --help=recursive
1519 else
1520 printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2
1521 fi || ac_status=$?
1522 cd "$ac_pwd" || { ac_status=$?; break; }
1523 done
1524 fi
1525
1526 test -n "$ac_init_help" && exit $ac_status
1527 if $ac_init_version; then
1528 cat <<\_ACEOF
1529 openfortivpn configure 1.17.1
1530 generated by GNU Autoconf 2.71
1531
1532 Copyright (C) 2021 Free Software Foundation, Inc.
1533 This configure script is free software; the Free Software Foundation
1534 gives unlimited permission to copy, distribute and modify it.
1535 _ACEOF
1536 exit
1537 fi
1538
1539 ## ------------------------ ##
1540 ## Autoconf initialization. ##
1541 ## ------------------------ ##
1542
1543 # ac_fn_c_try_compile LINENO
1544 # --------------------------
1545 # Try to compile conftest.$ac_ext, and return whether this succeeded.
1546 ac_fn_c_try_compile ()
1547 {
1548 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1549 rm -f conftest.$ac_objext conftest.beam
1550 if { { ac_try="$ac_compile"
1551 case "(($ac_try" in
1552 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1553 *) ac_try_echo=$ac_try;;
1554 esac
1555 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1556 printf "%s\n" "$ac_try_echo"; } >&5
1557 (eval "$ac_compile") 2>conftest.err
1558 ac_status=$?
1559 if test -s conftest.err; then
1560 grep -v '^ *+' conftest.err >conftest.er1
1561 cat conftest.er1 >&5
1562 mv -f conftest.er1 conftest.err
1563 fi
1564 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1565 test $ac_status = 0; } && {
1566 test -z "$ac_c_werror_flag" ||
1567 test ! -s conftest.err
1568 } && test -s conftest.$ac_objext
1569 then :
1570 ac_retval=0
1571 else $as_nop
1572 printf "%s\n" "$as_me: failed program was:" >&5
1573 sed 's/^/| /' conftest.$ac_ext >&5
1574
1575 ac_retval=1
1576 fi
1577 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1578 as_fn_set_status $ac_retval
1579
1580 } # ac_fn_c_try_compile
1581
1582 # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
1583 # -------------------------------------------------------
1584 # Tests whether HEADER exists and can be compiled using the include files in
1585 # INCLUDES, setting the cache variable VAR accordingly.
1586 ac_fn_c_check_header_compile ()
1587 {
1588 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1589 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1590 printf %s "checking for $2... " >&6; }
1591 if eval test \${$3+y}
1592 then :
1593 printf %s "(cached) " >&6
1594 else $as_nop
1595 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1596 /* end confdefs.h. */
1597 $4
1598 #include <$2>
1599 _ACEOF
1600 if ac_fn_c_try_compile "$LINENO"
1601 then :
1602 eval "$3=yes"
1603 else $as_nop
1604 eval "$3=no"
1605 fi
1606 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
1607 fi
1608 eval ac_res=\$$3
1609 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1610 printf "%s\n" "$ac_res" >&6; }
1611 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1612
1613 } # ac_fn_c_check_header_compile
1614
1615 # ac_fn_c_try_link LINENO
1616 # -----------------------
1617 # Try to link conftest.$ac_ext, and return whether this succeeded.
1618 ac_fn_c_try_link ()
1619 {
1620 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1621 rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext
1622 if { { ac_try="$ac_link"
1623 case "(($ac_try" in
1624 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
1625 *) ac_try_echo=$ac_try;;
1626 esac
1627 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
1628 printf "%s\n" "$ac_try_echo"; } >&5
1629 (eval "$ac_link") 2>conftest.err
1630 ac_status=$?
1631 if test -s conftest.err; then
1632 grep -v '^ *+' conftest.err >conftest.er1
1633 cat conftest.er1 >&5
1634 mv -f conftest.er1 conftest.err
1635 fi
1636 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
1637 test $ac_status = 0; } && {
1638 test -z "$ac_c_werror_flag" ||
1639 test ! -s conftest.err
1640 } && test -s conftest$ac_exeext && {
1641 test "$cross_compiling" = yes ||
1642 test -x conftest$ac_exeext
1643 }
1644 then :
1645 ac_retval=0
1646 else $as_nop
1647 printf "%s\n" "$as_me: failed program was:" >&5
1648 sed 's/^/| /' conftest.$ac_ext >&5
1649
1650 ac_retval=1
1651 fi
1652 # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
1653 # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
1654 # interfere with the next link command; also delete a directory that is
1655 # left behind by Apple's compiler. We do this before executing the actions.
1656 rm -rf conftest.dSYM conftest_ipa8_conftest.oo
1657 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1658 as_fn_set_status $ac_retval
1659
1660 } # ac_fn_c_try_link
1661
1662 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
1663 # -------------------------------------------
1664 # Tests whether TYPE exists after having included INCLUDES, setting cache
1665 # variable VAR accordingly.
1666 ac_fn_c_check_type ()
1667 {
1668 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1669 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1670 printf %s "checking for $2... " >&6; }
1671 if eval test \${$3+y}
1672 then :
1673 printf %s "(cached) " >&6
1674 else $as_nop
1675 eval "$3=no"
1676 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1677 /* end confdefs.h. */
1678 $4
1679 int
1680 main (void)
1681 {
1682 if (sizeof ($2))
1683 return 0;
1684 ;
1685 return 0;
1686 }
1687 _ACEOF
1688 if ac_fn_c_try_compile "$LINENO"
1689 then :
1690 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1691 /* end confdefs.h. */
1692 $4
1693 int
1694 main (void)
1695 {
1696 if (sizeof (($2)))
1697 return 0;
1698 ;
1699 return 0;
1700 }
1701 _ACEOF
1702 if ac_fn_c_try_compile "$LINENO"
1703 then :
1704
1705 else $as_nop
1706 eval "$3=yes"
1707 fi
1708 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
1709 fi
1710 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
1711 fi
1712 eval ac_res=\$$3
1713 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1714 printf "%s\n" "$ac_res" >&6; }
1715 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1716
1717 } # ac_fn_c_check_type
1718
1719 # ac_fn_c_find_uintX_t LINENO BITS VAR
1720 # ------------------------------------
1721 # Finds an unsigned integer type with width BITS, setting cache variable VAR
1722 # accordingly.
1723 ac_fn_c_find_uintX_t ()
1724 {
1725 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1726 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
1727 printf %s "checking for uint$2_t... " >&6; }
1728 if eval test \${$3+y}
1729 then :
1730 printf %s "(cached) " >&6
1731 else $as_nop
1732 eval "$3=no"
1733 # Order is important - never check a type that is potentially smaller
1734 # than half of the expected target width.
1735 for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
1736 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
1737 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1738 /* end confdefs.h. */
1739 $ac_includes_default
1740 int
1741 main (void)
1742 {
1743 static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
1744 test_array [0] = 0;
1745 return test_array [0];
1746
1747 ;
1748 return 0;
1749 }
1750 _ACEOF
1751 if ac_fn_c_try_compile "$LINENO"
1752 then :
1753 case $ac_type in #(
1754 uint$2_t) :
1755 eval "$3=yes" ;; #(
1756 *) :
1757 eval "$3=\$ac_type" ;;
1758 esac
1759 fi
1760 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
1761 if eval test \"x\$"$3"\" = x"no"
1762 then :
1763
1764 else $as_nop
1765 break
1766 fi
1767 done
1768 fi
1769 eval ac_res=\$$3
1770 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1771 printf "%s\n" "$ac_res" >&6; }
1772 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1773
1774 } # ac_fn_c_find_uintX_t
1775
1776 # ac_fn_c_check_func LINENO FUNC VAR
1777 # ----------------------------------
1778 # Tests whether FUNC exists, setting the cache variable VAR accordingly
1779 ac_fn_c_check_func ()
1780 {
1781 as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
1782 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
1783 printf %s "checking for $2... " >&6; }
1784 if eval test \${$3+y}
1785 then :
1786 printf %s "(cached) " >&6
1787 else $as_nop
1788 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1789 /* end confdefs.h. */
1790 /* Define $2 to an innocuous variant, in case <limits.h> declares $2.
1791 For example, HP-UX 11i <limits.h> declares gettimeofday. */
1792 #define $2 innocuous_$2
1793
1794 /* System header to define __stub macros and hopefully few prototypes,
1795 which can conflict with char $2 (); below. */
1796
1797 #include <limits.h>
1798 #undef $2
1799
1800 /* Override any GCC internal prototype to avoid an error.
1801 Use char because int might match the return type of a GCC
1802 builtin and then its argument prototype would still apply. */
1803 #ifdef __cplusplus
1804 extern "C"
1805 #endif
1806 char $2 ();
1807 /* The GNU C library defines this for functions which it implements
1808 to always fail with ENOSYS. Some functions are actually named
1809 something starting with __ and the normal name is an alias. */
1810 #if defined __stub_$2 || defined __stub___$2
1811 choke me
1812 #endif
1813
1814 int
1815 main (void)
1816 {
1817 return $2 ();
1818 ;
1819 return 0;
1820 }
1821 _ACEOF
1822 if ac_fn_c_try_link "$LINENO"
1823 then :
1824 eval "$3=yes"
1825 else $as_nop
1826 eval "$3=no"
1827 fi
1828 rm -f core conftest.err conftest.$ac_objext conftest.beam \
1829 conftest$ac_exeext conftest.$ac_ext
1830 fi
1831 eval ac_res=\$$3
1832 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
1833 printf "%s\n" "$ac_res" >&6; }
1834 eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
1835
1836 } # ac_fn_c_check_func
1837 ac_configure_args_raw=
1838 for ac_arg
1839 do
1840 case $ac_arg in
1841 *\'*)
1842 ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
1843 esac
1844 as_fn_append ac_configure_args_raw " '$ac_arg'"
1845 done
1846
1847 case $ac_configure_args_raw in
1848 *$as_nl*)
1849 ac_safe_unquote= ;;
1850 *)
1851 ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab.
1852 ac_unsafe_a="$ac_unsafe_z#~"
1853 ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g"
1854 ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;;
1855 esac
1856
1857 cat >config.log <<_ACEOF
1858 This file contains any messages produced by compilers while
1859 running configure, to aid debugging if configure makes a mistake.
1860
1861 It was created by openfortivpn $as_me 1.17.1, which was
1862 generated by GNU Autoconf 2.71. Invocation command line was
1863
1864 $ $0$ac_configure_args_raw
1865
1866 _ACEOF
1867 exec 5>>config.log
1868 {
1869 cat <<_ASUNAME
1870 ## --------- ##
1871 ## Platform. ##
1872 ## --------- ##
1873
1874 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
1875 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1876 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1877 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1878 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1879
1880 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
1881 /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
1882
1883 /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
1884 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
1885 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1886 /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
1887 /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
1888 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
1889 /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
1890
1891 _ASUNAME
1892
1893 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1894 for as_dir in $PATH
1895 do
1896 IFS=$as_save_IFS
1897 case $as_dir in #(((
1898 '') as_dir=./ ;;
1899 */) ;;
1900 *) as_dir=$as_dir/ ;;
1901 esac
1902 printf "%s\n" "PATH: $as_dir"
1903 done
1904 IFS=$as_save_IFS
1905
1906 } >&5
1907
1908 cat >&5 <<_ACEOF
1909
1910
1911 ## ----------- ##
1912 ## Core tests. ##
1913 ## ----------- ##
1914
1915 _ACEOF
1916
1917
1918 # Keep a trace of the command line.
1919 # Strip out --no-create and --no-recursion so they do not pile up.
1920 # Strip out --silent because we don't want to record it for future runs.
1921 # Also quote any args containing shell meta-characters.
1922 # Make two passes to allow for proper duplicate-argument suppression.
1923 ac_configure_args=
1924 ac_configure_args0=
1925 ac_configure_args1=
1926 ac_must_keep_next=false
1927 for ac_pass in 1 2
1928 do
1929 for ac_arg
1930 do
1931 case $ac_arg in
1932 -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
1933 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
1934 | -silent | --silent | --silen | --sile | --sil)
1935 continue ;;
1936 *\'*)
1937 ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
1938 esac
1939 case $ac_pass in
1940 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
1941 2)
1942 as_fn_append ac_configure_args1 " '$ac_arg'"
1943 if test $ac_must_keep_next = true; then
1944 ac_must_keep_next=false # Got value, back to normal.
1945 else
1946 case $ac_arg in
1947 *=* | --config-cache | -C | -disable-* | --disable-* \
1948 | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
1949 | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
1950 | -with-* | --with-* | -without-* | --without-* | --x)
1951 case "$ac_configure_args0 " in
1952 "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
1953 esac
1954 ;;
1955 -* ) ac_must_keep_next=true ;;
1956 esac
1957 fi
1958 as_fn_append ac_configure_args " '$ac_arg'"
1959 ;;
1960 esac
1961 done
1962 done
1963 { ac_configure_args0=; unset ac_configure_args0;}
1964 { ac_configure_args1=; unset ac_configure_args1;}
1965
1966 # When interrupted or exit'd, cleanup temporary files, and complete
1967 # config.log. We remove comments because anyway the quotes in there
1968 # would cause problems or look ugly.
1969 # WARNING: Use '\'' to represent an apostrophe within the trap.
1970 # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
1971 trap 'exit_status=$?
1972 # Sanitize IFS.
1973 IFS=" "" $as_nl"
1974 # Save into config.log some information that might help in debugging.
1975 {
1976 echo
1977
1978 printf "%s\n" "## ---------------- ##
1979 ## Cache variables. ##
1980 ## ---------------- ##"
1981 echo
1982 # The following way of writing the cache mishandles newlines in values,
1983 (
1984 for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
1985 eval ac_val=\$$ac_var
1986 case $ac_val in #(
1987 *${as_nl}*)
1988 case $ac_var in #(
1989 *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
1990 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
1991 esac
1992 case $ac_var in #(
1993 _ | IFS | as_nl) ;; #(
1994 BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
1995 *) { eval $ac_var=; unset $ac_var;} ;;
1996 esac ;;
1997 esac
1998 done
1999 (set) 2>&1 |
2000 case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
2001 *${as_nl}ac_space=\ *)
2002 sed -n \
2003 "s/'\''/'\''\\\\'\'''\''/g;
2004 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
2005 ;; #(
2006 *)
2007 sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
2008 ;;
2009 esac |
2010 sort
2011 )
2012 echo
2013
2014 printf "%s\n" "## ----------------- ##
2015 ## Output variables. ##
2016 ## ----------------- ##"
2017 echo
2018 for ac_var in $ac_subst_vars
2019 do
2020 eval ac_val=\$$ac_var
2021 case $ac_val in
2022 *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
2023 esac
2024 printf "%s\n" "$ac_var='\''$ac_val'\''"
2025 done | sort
2026 echo
2027
2028 if test -n "$ac_subst_files"; then
2029 printf "%s\n" "## ------------------- ##
2030 ## File substitutions. ##
2031 ## ------------------- ##"
2032 echo
2033 for ac_var in $ac_subst_files
2034 do
2035 eval ac_val=\$$ac_var
2036 case $ac_val in
2037 *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
2038 esac
2039 printf "%s\n" "$ac_var='\''$ac_val'\''"
2040 done | sort
2041 echo
2042 fi
2043
2044 if test -s confdefs.h; then
2045 printf "%s\n" "## ----------- ##
2046 ## confdefs.h. ##
2047 ## ----------- ##"
2048 echo
2049 cat confdefs.h
2050 echo
2051 fi
2052 test "$ac_signal" != 0 &&
2053 printf "%s\n" "$as_me: caught signal $ac_signal"
2054 printf "%s\n" "$as_me: exit $exit_status"
2055 } >&5
2056 rm -f core *.core core.conftest.* &&
2057 rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
2058 exit $exit_status
2059 ' 0
2060 for ac_signal in 1 2 13 15; do
2061 trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
2062 done
2063 ac_signal=0
2064
2065 # confdefs.h avoids OS command line length limits that DEFS can exceed.
2066 rm -f -r conftest* confdefs.h
2067
2068 printf "%s\n" "/* confdefs.h */" > confdefs.h
2069
2070 # Predefined preprocessor variables.
2071
2072 printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h
2073
2074 printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h
2075
2076 printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h
2077
2078 printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h
2079
2080 printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h
2081
2082 printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h
2083
2084
2085 # Let the site file select an alternate cache file if it wants to.
2086 # Prefer an explicitly selected file to automatically selected ones.
2087 if test -n "$CONFIG_SITE"; then
2088 ac_site_files="$CONFIG_SITE"
2089 elif test "x$prefix" != xNONE; then
2090 ac_site_files="$prefix/share/config.site $prefix/etc/config.site"
2091 else
2092 ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
2093 fi
2094
2095 for ac_site_file in $ac_site_files
2096 do
2097 case $ac_site_file in #(
2098 */*) :
2099 ;; #(
2100 *) :
2101 ac_site_file=./$ac_site_file ;;
2102 esac
2103 if test -f "$ac_site_file" && test -r "$ac_site_file"; then
2104 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
2105 printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;}
2106 sed 's/^/| /' "$ac_site_file" >&5
2107 . "$ac_site_file" \
2108 || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2109 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
2110 as_fn_error $? "failed to load site script $ac_site_file
2111 See \`config.log' for more details" "$LINENO" 5; }
2112 fi
2113 done
2114
2115 if test -r "$cache_file"; then
2116 # Some versions of bash will fail to source /dev/null (special files
2117 # actually), so we avoid doing that. DJGPP emulates it as a regular file.
2118 if test /dev/null != "$cache_file" && test -f "$cache_file"; then
2119 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
2120 printf "%s\n" "$as_me: loading cache $cache_file" >&6;}
2121 case $cache_file in
2122 [\\/]* | ?:[\\/]* ) . "$cache_file";;
2123 *) . "./$cache_file";;
2124 esac
2125 fi
2126 else
2127 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
2128 printf "%s\n" "$as_me: creating cache $cache_file" >&6;}
2129 >$cache_file
2130 fi
2131
2132 # Test code for whether the C compiler supports C89 (global declarations)
2133 ac_c_conftest_c89_globals='
2134 /* Does the compiler advertise C89 conformance?
2135 Do not test the value of __STDC__, because some compilers set it to 0
2136 while being otherwise adequately conformant. */
2137 #if !defined __STDC__
2138 # error "Compiler does not advertise C89 conformance"
2139 #endif
2140
2141 #include <stddef.h>
2142 #include <stdarg.h>
2143 struct stat;
2144 /* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */
2145 struct buf { int x; };
2146 struct buf * (*rcsopen) (struct buf *, struct stat *, int);
2147 static char *e (p, i)
2148 char **p;
2149 int i;
2150 {
2151 return p[i];
2152 }
2153 static char *f (char * (*g) (char **, int), char **p, ...)
2154 {
2155 char *s;
2156 va_list v;
2157 va_start (v,p);
2158 s = g (p, va_arg (v,int));
2159 va_end (v);
2160 return s;
2161 }
2162
2163 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
2164 function prototypes and stuff, but not \xHH hex character constants.
2165 These do not provoke an error unfortunately, instead are silently treated
2166 as an "x". The following induces an error, until -std is added to get
2167 proper ANSI mode. Curiously \x00 != x always comes out true, for an
2168 array size at least. It is necessary to write \x00 == 0 to get something
2169 that is true only with -std. */
2170 int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1];
2171
2172 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
2173 inside strings and character constants. */
2174 #define FOO(x) '\''x'\''
2175 int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1];
2176
2177 int test (int i, double x);
2178 struct s1 {int (*f) (int a);};
2179 struct s2 {int (*f) (double a);};
2180 int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int),
2181 int, int);'
2182
2183 # Test code for whether the C compiler supports C89 (body of main).
2184 ac_c_conftest_c89_main='
2185 ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]);
2186 '
2187
2188 # Test code for whether the C compiler supports C99 (global declarations)
2189 ac_c_conftest_c99_globals='
2190 // Does the compiler advertise C99 conformance?
2191 #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
2192 # error "Compiler does not advertise C99 conformance"
2193 #endif
2194
2195 #include <stdbool.h>
2196 extern int puts (const char *);
2197 extern int printf (const char *, ...);
2198 extern int dprintf (int, const char *, ...);
2199 extern void *malloc (size_t);
2200
2201 // Check varargs macros. These examples are taken from C99 6.10.3.5.
2202 // dprintf is used instead of fprintf to avoid needing to declare
2203 // FILE and stderr.
2204 #define debug(...) dprintf (2, __VA_ARGS__)
2205 #define showlist(...) puts (#__VA_ARGS__)
2206 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
2207 static void
2208 test_varargs_macros (void)
2209 {
2210 int x = 1234;
2211 int y = 5678;
2212 debug ("Flag");
2213 debug ("X = %d\n", x);
2214 showlist (The first, second, and third items.);
2215 report (x>y, "x is %d but y is %d", x, y);
2216 }
2217
2218 // Check long long types.
2219 #define BIG64 18446744073709551615ull
2220 #define BIG32 4294967295ul
2221 #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
2222 #if !BIG_OK
2223 #error "your preprocessor is broken"
2224 #endif
2225 #if BIG_OK
2226 #else
2227 #error "your preprocessor is broken"
2228 #endif
2229 static long long int bignum = -9223372036854775807LL;
2230 static unsigned long long int ubignum = BIG64;
2231
2232 struct incomplete_array
2233 {
2234 int datasize;
2235 double data[];
2236 };
2237
2238 struct named_init {
2239 int number;
2240 const wchar_t *name;
2241 double average;
2242 };
2243
2244 typedef const char *ccp;
2245
2246 static inline int
2247 test_restrict (ccp restrict text)
2248 {
2249 // See if C++-style comments work.
2250 // Iterate through items via the restricted pointer.
2251 // Also check for declarations in for loops.
2252 for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i)
2253 continue;
2254 return 0;
2255 }
2256
2257 // Check varargs and va_copy.
2258 static bool
2259 test_varargs (const char *format, ...)
2260 {
2261 va_list args;
2262 va_start (args, format);
2263 va_list args_copy;
2264 va_copy (args_copy, args);
2265
2266 const char *str = "";
2267 int number = 0;
2268 float fnumber = 0;
2269
2270 while (*format)
2271 {
2272 switch (*format++)
2273 {
2274 case '\''s'\'': // string
2275 str = va_arg (args_copy, const char *);
2276 break;
2277 case '\''d'\'': // int
2278 number = va_arg (args_copy, int);
2279 break;
2280 case '\''f'\'': // float
2281 fnumber = va_arg (args_copy, double);
2282 break;
2283 default:
2284 break;
2285 }
2286 }
2287 va_end (args_copy);
2288 va_end (args);
2289
2290 return *str && number && fnumber;
2291 }
2292 '
2293
2294 # Test code for whether the C compiler supports C99 (body of main).
2295 ac_c_conftest_c99_main='
2296 // Check bool.
2297 _Bool success = false;
2298 success |= (argc != 0);
2299
2300 // Check restrict.
2301 if (test_restrict ("String literal") == 0)
2302 success = true;
2303 char *restrict newvar = "Another string";
2304
2305 // Check varargs.
2306 success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234);
2307 test_varargs_macros ();
2308
2309 // Check flexible array members.
2310 struct incomplete_array *ia =
2311 malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
2312 ia->datasize = 10;
2313 for (int i = 0; i < ia->datasize; ++i)
2314 ia->data[i] = i * 1.234;
2315
2316 // Check named initializers.
2317 struct named_init ni = {
2318 .number = 34,
2319 .name = L"Test wide string",
2320 .average = 543.34343,
2321 };
2322
2323 ni.number = 58;
2324
2325 int dynamic_array[ni.number];
2326 dynamic_array[0] = argv[0][0];
2327 dynamic_array[ni.number - 1] = 543;
2328
2329 // work around unused variable warnings
2330 ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\''
2331 || dynamic_array[ni.number - 1] != 543);
2332 '
2333
2334 # Test code for whether the C compiler supports C11 (global declarations)
2335 ac_c_conftest_c11_globals='
2336 // Does the compiler advertise C11 conformance?
2337 #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
2338 # error "Compiler does not advertise C11 conformance"
2339 #endif
2340
2341 // Check _Alignas.
2342 char _Alignas (double) aligned_as_double;
2343 char _Alignas (0) no_special_alignment;
2344 extern char aligned_as_int;
2345 char _Alignas (0) _Alignas (int) aligned_as_int;
2346
2347 // Check _Alignof.
2348 enum
2349 {
2350 int_alignment = _Alignof (int),
2351 int_array_alignment = _Alignof (int[100]),
2352 char_alignment = _Alignof (char)
2353 };
2354 _Static_assert (0 < -_Alignof (int), "_Alignof is signed");
2355
2356 // Check _Noreturn.
2357 int _Noreturn does_not_return (void) { for (;;) continue; }
2358
2359 // Check _Static_assert.
2360 struct test_static_assert
2361 {
2362 int x;
2363 _Static_assert (sizeof (int) <= sizeof (long int),
2364 "_Static_assert does not work in struct");
2365 long int y;
2366 };
2367
2368 // Check UTF-8 literals.
2369 #define u8 syntax error!
2370 char const utf8_literal[] = u8"happens to be ASCII" "another string";
2371
2372 // Check duplicate typedefs.
2373 typedef long *long_ptr;
2374 typedef long int *long_ptr;
2375 typedef long_ptr long_ptr;
2376
2377 // Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1.
2378 struct anonymous
2379 {
2380 union {
2381 struct { int i; int j; };
2382 struct { int k; long int l; } w;
2383 };
2384 int m;
2385 } v1;
2386 '
2387
2388 # Test code for whether the C compiler supports C11 (body of main).
2389 ac_c_conftest_c11_main='
2390 _Static_assert ((offsetof (struct anonymous, i)
2391 == offsetof (struct anonymous, w.k)),
2392 "Anonymous union alignment botch");
2393 v1.i = 2;
2394 v1.w.k = 5;
2395 ok |= v1.i != 5;
2396 '
2397
2398 # Test code for whether the C compiler supports C11 (complete).
2399 ac_c_conftest_c11_program="${ac_c_conftest_c89_globals}
2400 ${ac_c_conftest_c99_globals}
2401 ${ac_c_conftest_c11_globals}
2402
2403 int
2404 main (int argc, char **argv)
2405 {
2406 int ok = 0;
2407 ${ac_c_conftest_c89_main}
2408 ${ac_c_conftest_c99_main}
2409 ${ac_c_conftest_c11_main}
2410 return ok;
2411 }
2412 "
2413
2414 # Test code for whether the C compiler supports C99 (complete).
2415 ac_c_conftest_c99_program="${ac_c_conftest_c89_globals}
2416 ${ac_c_conftest_c99_globals}
2417
2418 int
2419 main (int argc, char **argv)
2420 {
2421 int ok = 0;
2422 ${ac_c_conftest_c89_main}
2423 ${ac_c_conftest_c99_main}
2424 return ok;
2425 }
2426 "
2427
2428 # Test code for whether the C compiler supports C89 (complete).
2429 ac_c_conftest_c89_program="${ac_c_conftest_c89_globals}
2430
2431 int
2432 main (int argc, char **argv)
2433 {
2434 int ok = 0;
2435 ${ac_c_conftest_c89_main}
2436 return ok;
2437 }
2438 "
2439
2440 as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H"
2441 as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H"
2442 as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H"
2443 as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H"
2444 as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H"
2445 as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H"
2446 as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H"
2447 as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H"
2448 as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H"
2449 as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H"
2450 as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H"
2451
2452 # Auxiliary files required by this configure script.
2453 ac_aux_files="compile missing install-sh"
2454
2455 # Locations in which to look for auxiliary files.
2456 ac_aux_dir_candidates="${srcdir}${PATH_SEPARATOR}${srcdir}/..${PATH_SEPARATOR}${srcdir}/../.."
2457
2458 # Search for a directory containing all of the required auxiliary files,
2459 # $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates.
2460 # If we don't find one directory that contains all the files we need,
2461 # we report the set of missing files from the *first* directory in
2462 # $ac_aux_dir_candidates and give up.
2463 ac_missing_aux_files=""
2464 ac_first_candidate=:
2465 printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5
2466 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2467 as_found=false
2468 for as_dir in $ac_aux_dir_candidates
2469 do
2470 IFS=$as_save_IFS
2471 case $as_dir in #(((
2472 '') as_dir=./ ;;
2473 */) ;;
2474 *) as_dir=$as_dir/ ;;
2475 esac
2476 as_found=:
2477
2478 printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5
2479 ac_aux_dir_found=yes
2480 ac_install_sh=
2481 for ac_aux in $ac_aux_files
2482 do
2483 # As a special case, if "install-sh" is required, that requirement
2484 # can be satisfied by any of "install-sh", "install.sh", or "shtool",
2485 # and $ac_install_sh is set appropriately for whichever one is found.
2486 if test x"$ac_aux" = x"install-sh"
2487 then
2488 if test -f "${as_dir}install-sh"; then
2489 printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5
2490 ac_install_sh="${as_dir}install-sh -c"
2491 elif test -f "${as_dir}install.sh"; then
2492 printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5
2493 ac_install_sh="${as_dir}install.sh -c"
2494 elif test -f "${as_dir}shtool"; then
2495 printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5
2496 ac_install_sh="${as_dir}shtool install -c"
2497 else
2498 ac_aux_dir_found=no
2499 if $ac_first_candidate; then
2500 ac_missing_aux_files="${ac_missing_aux_files} install-sh"
2501 else
2502 break
2503 fi
2504 fi
2505 else
2506 if test -f "${as_dir}${ac_aux}"; then
2507 printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5
2508 else
2509 ac_aux_dir_found=no
2510 if $ac_first_candidate; then
2511 ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}"
2512 else
2513 break
2514 fi
2515 fi
2516 fi
2517 done
2518 if test "$ac_aux_dir_found" = yes; then
2519 ac_aux_dir="$as_dir"
2520 break
2521 fi
2522 ac_first_candidate=false
2523
2524 as_found=false
2525 done
2526 IFS=$as_save_IFS
2527 if $as_found
2528 then :
2529
2530 else $as_nop
2531 as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5
2532 fi
2533
2534
2535 # These three variables are undocumented and unsupported,
2536 # and are intended to be withdrawn in a future Autoconf release.
2537 # They can cause serious problems if a builder's source tree is in a directory
2538 # whose full name contains unusual characters.
2539 if test -f "${ac_aux_dir}config.guess"; then
2540 ac_config_guess="$SHELL ${ac_aux_dir}config.guess"
2541 fi
2542 if test -f "${ac_aux_dir}config.sub"; then
2543 ac_config_sub="$SHELL ${ac_aux_dir}config.sub"
2544 fi
2545 if test -f "$ac_aux_dir/configure"; then
2546 ac_configure="$SHELL ${ac_aux_dir}configure"
2547 fi
2548
2549 # Check that the precious variables saved in the cache have kept the same
2550 # value.
2551 ac_cache_corrupted=false
2552 for ac_var in $ac_precious_vars; do
2553 eval ac_old_set=\$ac_cv_env_${ac_var}_set
2554 eval ac_new_set=\$ac_env_${ac_var}_set
2555 eval ac_old_val=\$ac_cv_env_${ac_var}_value
2556 eval ac_new_val=\$ac_env_${ac_var}_value
2557 case $ac_old_set,$ac_new_set in
2558 set,)
2559 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
2560 printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
2561 ac_cache_corrupted=: ;;
2562 ,set)
2563 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
2564 printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
2565 ac_cache_corrupted=: ;;
2566 ,);;
2567 *)
2568 if test "x$ac_old_val" != "x$ac_new_val"; then
2569 # differences in whitespace do not lead to failure.
2570 ac_old_val_w=`echo x $ac_old_val`
2571 ac_new_val_w=`echo x $ac_new_val`
2572 if test "$ac_old_val_w" != "$ac_new_val_w"; then
2573 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
2574 printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
2575 ac_cache_corrupted=:
2576 else
2577 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
2578 printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
2579 eval $ac_var=\$ac_old_val
2580 fi
2581 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
2582 printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;}
2583 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
2584 printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;}
2585 fi;;
2586 esac
2587 # Pass precious variables to config.status.
2588 if test "$ac_new_set" = set; then
2589 case $ac_new_val in
2590 *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
2591 *) ac_arg=$ac_var=$ac_new_val ;;
2592 esac
2593 case " $ac_configure_args " in
2594 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
2595 *) as_fn_append ac_configure_args " '$ac_arg'" ;;
2596 esac
2597 fi
2598 done
2599 if $ac_cache_corrupted; then
2600 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
2601 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
2602 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
2603 printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;}
2604 as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file'
2605 and start over" "$LINENO" 5
2606 fi
2607 ## -------------------- ##
2608 ## Main body of script. ##
2609 ## -------------------- ##
2610
2611 ac_ext=c
2612 ac_cpp='$CPP $CPPFLAGS'
2613 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2614 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
2615 ac_compiler_gnu=$ac_cv_c_compiler_gnu
2616
2617
2618
2619 am__api_version='1.16'
2620
2621
2622
2623 # Find a good install program. We prefer a C program (faster),
2624 # so one script is as good as another. But avoid the broken or
2625 # incompatible versions:
2626 # SysV /etc/install, /usr/sbin/install
2627 # SunOS /usr/etc/install
2628 # IRIX /sbin/install
2629 # AIX /bin/install
2630 # AmigaOS /C/install, which installs bootblocks on floppy discs
2631 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
2632 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
2633 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
2634 # OS/2's system install, which has a completely different semantic
2635 # ./install, which can be erroneously created by make from ./install.sh.
2636 # Reject install programs that cannot install multiple files.
2637 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
2638 printf %s "checking for a BSD-compatible install... " >&6; }
2639 if test -z "$INSTALL"; then
2640 if test ${ac_cv_path_install+y}
2641 then :
2642 printf %s "(cached) " >&6
2643 else $as_nop
2644 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2645 for as_dir in $PATH
2646 do
2647 IFS=$as_save_IFS
2648 case $as_dir in #(((
2649 '') as_dir=./ ;;
2650 */) ;;
2651 *) as_dir=$as_dir/ ;;
2652 esac
2653 # Account for fact that we put trailing slashes in our PATH walk.
2654 case $as_dir in #((
2655 ./ | /[cC]/* | \
2656 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
2657 ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
2658 /usr/ucb/* ) ;;
2659 *)
2660 # OSF1 and SCO ODT 3.0 have their own names for install.
2661 # Don't use installbsd from OSF since it installs stuff as root
2662 # by default.
2663 for ac_prog in ginstall scoinst install; do
2664 for ac_exec_ext in '' $ac_executable_extensions; do
2665 if as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext"; then
2666 if test $ac_prog = install &&
2667 grep dspmsg "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
2668 # AIX install. It has an incompatible calling convention.
2669 :
2670 elif test $ac_prog = install &&
2671 grep pwplus "$as_dir$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
2672 # program-specific install script used by HP pwplus--don't use.
2673 :
2674 else
2675 rm -rf conftest.one conftest.two conftest.dir
2676 echo one > conftest.one
2677 echo two > conftest.two
2678 mkdir conftest.dir
2679 if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" &&
2680 test -s conftest.one && test -s conftest.two &&
2681 test -s conftest.dir/conftest.one &&
2682 test -s conftest.dir/conftest.two
2683 then
2684 ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c"
2685 break 3
2686 fi
2687 fi
2688 fi
2689 done
2690 done
2691 ;;
2692 esac
2693
2694 done
2695 IFS=$as_save_IFS
2696
2697 rm -rf conftest.one conftest.two conftest.dir
2698
2699 fi
2700 if test ${ac_cv_path_install+y}; then
2701 INSTALL=$ac_cv_path_install
2702 else
2703 # As a last resort, use the slow shell script. Don't cache a
2704 # value for INSTALL within a source directory, because that will
2705 # break other packages using the cache if that directory is
2706 # removed, or if the value is a relative name.
2707 INSTALL=$ac_install_sh
2708 fi
2709 fi
2710 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
2711 printf "%s\n" "$INSTALL" >&6; }
2712
2713 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
2714 # It thinks the first close brace ends the variable substitution.
2715 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
2716
2717 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
2718
2719 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
2720
2721 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
2722 printf %s "checking whether build environment is sane... " >&6; }
2723 # Reject unsafe characters in $srcdir or the absolute working directory
2724 # name. Accept space and tab only in the latter.
2725 am_lf='
2726 '
2727 case `pwd` in
2728 *[\\\"\#\$\&\'\`$am_lf]*)
2729 as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
2730 esac
2731 case $srcdir in
2732 *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
2733 as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
2734 esac
2735
2736 # Do 'set' in a subshell so we don't clobber the current shell's
2737 # arguments. Must try -L first in case configure is actually a
2738 # symlink; some systems play weird games with the mod time of symlinks
2739 # (eg FreeBSD returns the mod time of the symlink's containing
2740 # directory).
2741 if (
2742 am_has_slept=no
2743 for am_try in 1 2; do
2744 echo "timestamp, slept: $am_has_slept" > conftest.file
2745 set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
2746 if test "$*" = "X"; then
2747 # -L didn't work.
2748 set X `ls -t "$srcdir/configure" conftest.file`
2749 fi
2750 if test "$*" != "X $srcdir/configure conftest.file" \
2751 && test "$*" != "X conftest.file $srcdir/configure"; then
2752
2753 # If neither matched, then we have a broken ls. This can happen
2754 # if, for instance, CONFIG_SHELL is bash and it inherits a
2755 # broken ls alias from the environment. This has actually
2756 # happened. Such a system could not be considered "sane".
2757 as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
2758 alias in your environment" "$LINENO" 5
2759 fi
2760 if test "$2" = conftest.file || test $am_try -eq 2; then
2761 break
2762 fi
2763 # Just in case.
2764 sleep 1
2765 am_has_slept=yes
2766 done
2767 test "$2" = conftest.file
2768 )
2769 then
2770 # Ok.
2771 :
2772 else
2773 as_fn_error $? "newly created file is older than distributed files!
2774 Check your system clock" "$LINENO" 5
2775 fi
2776 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
2777 printf "%s\n" "yes" >&6; }
2778 # If we didn't sleep, we still need to ensure time stamps of config.status and
2779 # generated files are strictly newer.
2780 am_sleep_pid=
2781 if grep 'slept: no' conftest.file >/dev/null 2>&1; then
2782 ( sleep 1 ) &
2783 am_sleep_pid=$!
2784 fi
2785
2786 rm -f conftest.file
2787
2788 test "$program_prefix" != NONE &&
2789 program_transform_name="s&^&$program_prefix&;$program_transform_name"
2790 # Use a double $ so make ignores it.
2791 test "$program_suffix" != NONE &&
2792 program_transform_name="s&\$&$program_suffix&;$program_transform_name"
2793 # Double any \ or $.
2794 # By default was `s,x,x', remove it if useless.
2795 ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
2796 program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"`
2797
2798
2799 # Expand $ac_aux_dir to an absolute path.
2800 am_aux_dir=`cd "$ac_aux_dir" && pwd`
2801
2802
2803 if test x"${MISSING+set}" != xset; then
2804 MISSING="\${SHELL} '$am_aux_dir/missing'"
2805 fi
2806 # Use eval to expand $SHELL
2807 if eval "$MISSING --is-lightweight"; then
2808 am_missing_run="$MISSING "
2809 else
2810 am_missing_run=
2811 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
2812 printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
2813 fi
2814
2815 if test x"${install_sh+set}" != xset; then
2816 case $am_aux_dir in
2817 *\ * | *\ *)
2818 install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
2819 *)
2820 install_sh="\${SHELL} $am_aux_dir/install-sh"
2821 esac
2822 fi
2823
2824 # Installed binaries are usually stripped using 'strip' when the user
2825 # run "make install-strip". However 'strip' might not be the right
2826 # tool to use in cross-compilation environments, therefore Automake
2827 # will honor the 'STRIP' environment variable to overrule this program.
2828 if test "$cross_compiling" != no; then
2829 if test -n "$ac_tool_prefix"; then
2830 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
2831 set dummy ${ac_tool_prefix}strip; ac_word=$2
2832 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2833 printf %s "checking for $ac_word... " >&6; }
2834 if test ${ac_cv_prog_STRIP+y}
2835 then :
2836 printf %s "(cached) " >&6
2837 else $as_nop
2838 if test -n "$STRIP"; then
2839 ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
2840 else
2841 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2842 for as_dir in $PATH
2843 do
2844 IFS=$as_save_IFS
2845 case $as_dir in #(((
2846 '') as_dir=./ ;;
2847 */) ;;
2848 *) as_dir=$as_dir/ ;;
2849 esac
2850 for ac_exec_ext in '' $ac_executable_extensions; do
2851 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
2852 ac_cv_prog_STRIP="${ac_tool_prefix}strip"
2853 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
2854 break 2
2855 fi
2856 done
2857 done
2858 IFS=$as_save_IFS
2859
2860 fi
2861 fi
2862 STRIP=$ac_cv_prog_STRIP
2863 if test -n "$STRIP"; then
2864 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
2865 printf "%s\n" "$STRIP" >&6; }
2866 else
2867 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
2868 printf "%s\n" "no" >&6; }
2869 fi
2870
2871
2872 fi
2873 if test -z "$ac_cv_prog_STRIP"; then
2874 ac_ct_STRIP=$STRIP
2875 # Extract the first word of "strip", so it can be a program name with args.
2876 set dummy strip; ac_word=$2
2877 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2878 printf %s "checking for $ac_word... " >&6; }
2879 if test ${ac_cv_prog_ac_ct_STRIP+y}
2880 then :
2881 printf %s "(cached) " >&6
2882 else $as_nop
2883 if test -n "$ac_ct_STRIP"; then
2884 ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
2885 else
2886 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2887 for as_dir in $PATH
2888 do
2889 IFS=$as_save_IFS
2890 case $as_dir in #(((
2891 '') as_dir=./ ;;
2892 */) ;;
2893 *) as_dir=$as_dir/ ;;
2894 esac
2895 for ac_exec_ext in '' $ac_executable_extensions; do
2896 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
2897 ac_cv_prog_ac_ct_STRIP="strip"
2898 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
2899 break 2
2900 fi
2901 done
2902 done
2903 IFS=$as_save_IFS
2904
2905 fi
2906 fi
2907 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
2908 if test -n "$ac_ct_STRIP"; then
2909 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
2910 printf "%s\n" "$ac_ct_STRIP" >&6; }
2911 else
2912 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
2913 printf "%s\n" "no" >&6; }
2914 fi
2915
2916 if test "x$ac_ct_STRIP" = x; then
2917 STRIP=":"
2918 else
2919 case $cross_compiling:$ac_tool_warned in
2920 yes:)
2921 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
2922 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
2923 ac_tool_warned=yes ;;
2924 esac
2925 STRIP=$ac_ct_STRIP
2926 fi
2927 else
2928 STRIP="$ac_cv_prog_STRIP"
2929 fi
2930
2931 fi
2932 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
2933
2934
2935 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5
2936 printf %s "checking for a race-free mkdir -p... " >&6; }
2937 if test -z "$MKDIR_P"; then
2938 if test ${ac_cv_path_mkdir+y}
2939 then :
2940 printf %s "(cached) " >&6
2941 else $as_nop
2942 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2943 for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
2944 do
2945 IFS=$as_save_IFS
2946 case $as_dir in #(((
2947 '') as_dir=./ ;;
2948 */) ;;
2949 *) as_dir=$as_dir/ ;;
2950 esac
2951 for ac_prog in mkdir gmkdir; do
2952 for ac_exec_ext in '' $ac_executable_extensions; do
2953 as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue
2954 case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #(
2955 'mkdir ('*'coreutils) '* | \
2956 'BusyBox '* | \
2957 'mkdir (fileutils) '4.1*)
2958 ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext
2959 break 3;;
2960 esac
2961 done
2962 done
2963 done
2964 IFS=$as_save_IFS
2965
2966 fi
2967
2968 test -d ./--version && rmdir ./--version
2969 if test ${ac_cv_path_mkdir+y}; then
2970 MKDIR_P="$ac_cv_path_mkdir -p"
2971 else
2972 # As a last resort, use the slow shell script. Don't cache a
2973 # value for MKDIR_P within a source directory, because that will
2974 # break other packages using the cache if that directory is
2975 # removed, or if the value is a relative name.
2976 MKDIR_P="$ac_install_sh -d"
2977 fi
2978 fi
2979 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
2980 printf "%s\n" "$MKDIR_P" >&6; }
2981
2982 for ac_prog in gawk mawk nawk awk
2983 do
2984 # Extract the first word of "$ac_prog", so it can be a program name with args.
2985 set dummy $ac_prog; ac_word=$2
2986 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
2987 printf %s "checking for $ac_word... " >&6; }
2988 if test ${ac_cv_prog_AWK+y}
2989 then :
2990 printf %s "(cached) " >&6
2991 else $as_nop
2992 if test -n "$AWK"; then
2993 ac_cv_prog_AWK="$AWK" # Let the user override the test.
2994 else
2995 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2996 for as_dir in $PATH
2997 do
2998 IFS=$as_save_IFS
2999 case $as_dir in #(((
3000 '') as_dir=./ ;;
3001 */) ;;
3002 *) as_dir=$as_dir/ ;;
3003 esac
3004 for ac_exec_ext in '' $ac_executable_extensions; do
3005 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3006 ac_cv_prog_AWK="$ac_prog"
3007 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3008 break 2
3009 fi
3010 done
3011 done
3012 IFS=$as_save_IFS
3013
3014 fi
3015 fi
3016 AWK=$ac_cv_prog_AWK
3017 if test -n "$AWK"; then
3018 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
3019 printf "%s\n" "$AWK" >&6; }
3020 else
3021 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3022 printf "%s\n" "no" >&6; }
3023 fi
3024
3025
3026 test -n "$AWK" && break
3027 done
3028
3029 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
3030 printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
3031 set x ${MAKE-make}
3032 ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
3033 if eval test \${ac_cv_prog_make_${ac_make}_set+y}
3034 then :
3035 printf %s "(cached) " >&6
3036 else $as_nop
3037 cat >conftest.make <<\_ACEOF
3038 SHELL = /bin/sh
3039 all:
3040 @echo '@@@%%%=$(MAKE)=@@@%%%'
3041 _ACEOF
3042 # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
3043 case `${MAKE-make} -f conftest.make 2>/dev/null` in
3044 *@@@%%%=?*=@@@%%%*)
3045 eval ac_cv_prog_make_${ac_make}_set=yes;;
3046 *)
3047 eval ac_cv_prog_make_${ac_make}_set=no;;
3048 esac
3049 rm -f conftest.make
3050 fi
3051 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
3052 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
3053 printf "%s\n" "yes" >&6; }
3054 SET_MAKE=
3055 else
3056 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3057 printf "%s\n" "no" >&6; }
3058 SET_MAKE="MAKE=${MAKE-make}"
3059 fi
3060
3061 rm -rf .tst 2>/dev/null
3062 mkdir .tst 2>/dev/null
3063 if test -d .tst; then
3064 am__leading_dot=.
3065 else
3066 am__leading_dot=_
3067 fi
3068 rmdir .tst 2>/dev/null
3069
3070 # Check whether --enable-silent-rules was given.
3071 if test ${enable_silent_rules+y}
3072 then :
3073 enableval=$enable_silent_rules;
3074 fi
3075
3076 case $enable_silent_rules in # (((
3077 yes) AM_DEFAULT_VERBOSITY=0;;
3078 no) AM_DEFAULT_VERBOSITY=1;;
3079 *) AM_DEFAULT_VERBOSITY=1;;
3080 esac
3081 am_make=${MAKE-make}
3082 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
3083 printf %s "checking whether $am_make supports nested variables... " >&6; }
3084 if test ${am_cv_make_support_nested_variables+y}
3085 then :
3086 printf %s "(cached) " >&6
3087 else $as_nop
3088 if printf "%s\n" 'TRUE=$(BAR$(V))
3089 BAR0=false
3090 BAR1=true
3091 V=1
3092 am__doit:
3093 @$(TRUE)
3094 .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
3095 am_cv_make_support_nested_variables=yes
3096 else
3097 am_cv_make_support_nested_variables=no
3098 fi
3099 fi
3100 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
3101 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; }
3102 if test $am_cv_make_support_nested_variables = yes; then
3103 AM_V='$(V)'
3104 AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
3105 else
3106 AM_V=$AM_DEFAULT_VERBOSITY
3107 AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
3108 fi
3109 AM_BACKSLASH='\'
3110
3111 if test "`cd $srcdir && pwd`" != "`pwd`"; then
3112 # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
3113 # is not polluted with repeated "-I."
3114 am__isrc=' -I$(srcdir)'
3115 # test to see if srcdir already configured
3116 if test -f $srcdir/config.status; then
3117 as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
3118 fi
3119 fi
3120
3121 # test whether we have cygpath
3122 if test -z "$CYGPATH_W"; then
3123 if (cygpath --version) >/dev/null 2>/dev/null; then
3124 CYGPATH_W='cygpath -w'
3125 else
3126 CYGPATH_W=echo
3127 fi
3128 fi
3129
3130
3131 # Define the identity of the package.
3132 PACKAGE='openfortivpn'
3133 VERSION='1.17.1'
3134
3135
3136 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
3137
3138
3139 printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h
3140
3141 # Some tools Automake needs.
3142
3143 ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
3144
3145
3146 AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
3147
3148
3149 AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
3150
3151
3152 AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
3153
3154
3155 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
3156
3157 # For better backward compatibility. To be removed once Automake 1.9.x
3158 # dies out for good. For more background, see:
3159 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
3160 # <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
3161 mkdir_p='$(MKDIR_P)'
3162
3163 # We need awk for the "check" target (and possibly the TAP driver). The
3164 # system "awk" is bad on some platforms.
3165 # Always define AMTAR for backward compatibility. Yes, it's still used
3166 # in the wild :-( We should find a proper way to deprecate it ...
3167 AMTAR='$${TAR-tar}'
3168
3169
3170 # We'll loop over all known methods to create a tar archive until one works.
3171 _am_tools='gnutar pax cpio none'
3172
3173 am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
3174
3175
3176
3177
3178
3179 # Variables for tags utilities; see am/tags.am
3180 if test -z "$CTAGS"; then
3181 CTAGS=ctags
3182 fi
3183
3184 if test -z "$ETAGS"; then
3185 ETAGS=etags
3186 fi
3187
3188 if test -z "$CSCOPE"; then
3189 CSCOPE=cscope
3190 fi
3191
3192
3193
3194 # POSIX will say in a future version that running "rm -f" with no argument
3195 # is OK; and we want to be able to make that assumption in our Makefile
3196 # recipes. So use an aggressive probe to check that the usage we want is
3197 # actually supported "in the wild" to an acceptable degree.
3198 # See automake bug#10828.
3199 # To make any issue more visible, cause the running configure to be aborted
3200 # by default if the 'rm' program in use doesn't match our expectations; the
3201 # user can still override this though.
3202 if rm -f && rm -fr && rm -rf; then : OK; else
3203 cat >&2 <<'END'
3204 Oops!
3205
3206 Your 'rm' program seems unable to run without file operands specified
3207 on the command line, even when the '-f' option is present. This is contrary
3208 to the behaviour of most rm programs out there, and not conforming with
3209 the upcoming POSIX standard: <http://austingroupbugs.net/view.php?id=542>
3210
3211 Please tell bug-automake@gnu.org about your system, including the value
3212 of your $PATH and any error possibly output before this message. This
3213 can help us improve future automake versions.
3214
3215 END
3216 if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then
3217 echo 'Configuration will proceed anyway, since you have set the' >&2
3218 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2
3219 echo >&2
3220 else
3221 cat >&2 <<'END'
3222 Aborting the configuration process, to ensure you take notice of the issue.
3223
3224 You can download and install GNU coreutils to get an 'rm' implementation
3225 that behaves properly: <https://www.gnu.org/software/coreutils/>.
3226
3227 If you want to complete the configuration process using your problematic
3228 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
3229 to "yes", and re-run configure.
3230
3231 END
3232 as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5
3233 fi
3234 fi
3235
3236
3237 # Checks for programs.
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247 ac_ext=c
3248 ac_cpp='$CPP $CPPFLAGS'
3249 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3250 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3251 ac_compiler_gnu=$ac_cv_c_compiler_gnu
3252 if test -n "$ac_tool_prefix"; then
3253 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
3254 set dummy ${ac_tool_prefix}gcc; ac_word=$2
3255 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3256 printf %s "checking for $ac_word... " >&6; }
3257 if test ${ac_cv_prog_CC+y}
3258 then :
3259 printf %s "(cached) " >&6
3260 else $as_nop
3261 if test -n "$CC"; then
3262 ac_cv_prog_CC="$CC" # Let the user override the test.
3263 else
3264 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3265 for as_dir in $PATH
3266 do
3267 IFS=$as_save_IFS
3268 case $as_dir in #(((
3269 '') as_dir=./ ;;
3270 */) ;;
3271 *) as_dir=$as_dir/ ;;
3272 esac
3273 for ac_exec_ext in '' $ac_executable_extensions; do
3274 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3275 ac_cv_prog_CC="${ac_tool_prefix}gcc"
3276 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3277 break 2
3278 fi
3279 done
3280 done
3281 IFS=$as_save_IFS
3282
3283 fi
3284 fi
3285 CC=$ac_cv_prog_CC
3286 if test -n "$CC"; then
3287 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
3288 printf "%s\n" "$CC" >&6; }
3289 else
3290 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3291 printf "%s\n" "no" >&6; }
3292 fi
3293
3294
3295 fi
3296 if test -z "$ac_cv_prog_CC"; then
3297 ac_ct_CC=$CC
3298 # Extract the first word of "gcc", so it can be a program name with args.
3299 set dummy gcc; ac_word=$2
3300 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3301 printf %s "checking for $ac_word... " >&6; }
3302 if test ${ac_cv_prog_ac_ct_CC+y}
3303 then :
3304 printf %s "(cached) " >&6
3305 else $as_nop
3306 if test -n "$ac_ct_CC"; then
3307 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
3308 else
3309 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3310 for as_dir in $PATH
3311 do
3312 IFS=$as_save_IFS
3313 case $as_dir in #(((
3314 '') as_dir=./ ;;
3315 */) ;;
3316 *) as_dir=$as_dir/ ;;
3317 esac
3318 for ac_exec_ext in '' $ac_executable_extensions; do
3319 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3320 ac_cv_prog_ac_ct_CC="gcc"
3321 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3322 break 2
3323 fi
3324 done
3325 done
3326 IFS=$as_save_IFS
3327
3328 fi
3329 fi
3330 ac_ct_CC=$ac_cv_prog_ac_ct_CC
3331 if test -n "$ac_ct_CC"; then
3332 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
3333 printf "%s\n" "$ac_ct_CC" >&6; }
3334 else
3335 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3336 printf "%s\n" "no" >&6; }
3337 fi
3338
3339 if test "x$ac_ct_CC" = x; then
3340 CC=""
3341 else
3342 case $cross_compiling:$ac_tool_warned in
3343 yes:)
3344 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
3345 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
3346 ac_tool_warned=yes ;;
3347 esac
3348 CC=$ac_ct_CC
3349 fi
3350 else
3351 CC="$ac_cv_prog_CC"
3352 fi
3353
3354 if test -z "$CC"; then
3355 if test -n "$ac_tool_prefix"; then
3356 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
3357 set dummy ${ac_tool_prefix}cc; ac_word=$2
3358 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3359 printf %s "checking for $ac_word... " >&6; }
3360 if test ${ac_cv_prog_CC+y}
3361 then :
3362 printf %s "(cached) " >&6
3363 else $as_nop
3364 if test -n "$CC"; then
3365 ac_cv_prog_CC="$CC" # Let the user override the test.
3366 else
3367 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3368 for as_dir in $PATH
3369 do
3370 IFS=$as_save_IFS
3371 case $as_dir in #(((
3372 '') as_dir=./ ;;
3373 */) ;;
3374 *) as_dir=$as_dir/ ;;
3375 esac
3376 for ac_exec_ext in '' $ac_executable_extensions; do
3377 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3378 ac_cv_prog_CC="${ac_tool_prefix}cc"
3379 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3380 break 2
3381 fi
3382 done
3383 done
3384 IFS=$as_save_IFS
3385
3386 fi
3387 fi
3388 CC=$ac_cv_prog_CC
3389 if test -n "$CC"; then
3390 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
3391 printf "%s\n" "$CC" >&6; }
3392 else
3393 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3394 printf "%s\n" "no" >&6; }
3395 fi
3396
3397
3398 fi
3399 fi
3400 if test -z "$CC"; then
3401 # Extract the first word of "cc", so it can be a program name with args.
3402 set dummy cc; ac_word=$2
3403 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3404 printf %s "checking for $ac_word... " >&6; }
3405 if test ${ac_cv_prog_CC+y}
3406 then :
3407 printf %s "(cached) " >&6
3408 else $as_nop
3409 if test -n "$CC"; then
3410 ac_cv_prog_CC="$CC" # Let the user override the test.
3411 else
3412 ac_prog_rejected=no
3413 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3414 for as_dir in $PATH
3415 do
3416 IFS=$as_save_IFS
3417 case $as_dir in #(((
3418 '') as_dir=./ ;;
3419 */) ;;
3420 *) as_dir=$as_dir/ ;;
3421 esac
3422 for ac_exec_ext in '' $ac_executable_extensions; do
3423 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3424 if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
3425 ac_prog_rejected=yes
3426 continue
3427 fi
3428 ac_cv_prog_CC="cc"
3429 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3430 break 2
3431 fi
3432 done
3433 done
3434 IFS=$as_save_IFS
3435
3436 if test $ac_prog_rejected = yes; then
3437 # We found a bogon in the path, so make sure we never use it.
3438 set dummy $ac_cv_prog_CC
3439 shift
3440 if test $# != 0; then
3441 # We chose a different compiler from the bogus one.
3442 # However, it has the same basename, so the bogon will be chosen
3443 # first if we set CC to just the basename; use the full file name.
3444 shift
3445 ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@"
3446 fi
3447 fi
3448 fi
3449 fi
3450 CC=$ac_cv_prog_CC
3451 if test -n "$CC"; then
3452 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
3453 printf "%s\n" "$CC" >&6; }
3454 else
3455 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3456 printf "%s\n" "no" >&6; }
3457 fi
3458
3459
3460 fi
3461 if test -z "$CC"; then
3462 if test -n "$ac_tool_prefix"; then
3463 for ac_prog in cl.exe
3464 do
3465 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
3466 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
3467 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3468 printf %s "checking for $ac_word... " >&6; }
3469 if test ${ac_cv_prog_CC+y}
3470 then :
3471 printf %s "(cached) " >&6
3472 else $as_nop
3473 if test -n "$CC"; then
3474 ac_cv_prog_CC="$CC" # Let the user override the test.
3475 else
3476 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3477 for as_dir in $PATH
3478 do
3479 IFS=$as_save_IFS
3480 case $as_dir in #(((
3481 '') as_dir=./ ;;
3482 */) ;;
3483 *) as_dir=$as_dir/ ;;
3484 esac
3485 for ac_exec_ext in '' $ac_executable_extensions; do
3486 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3487 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
3488 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3489 break 2
3490 fi
3491 done
3492 done
3493 IFS=$as_save_IFS
3494
3495 fi
3496 fi
3497 CC=$ac_cv_prog_CC
3498 if test -n "$CC"; then
3499 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
3500 printf "%s\n" "$CC" >&6; }
3501 else
3502 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3503 printf "%s\n" "no" >&6; }
3504 fi
3505
3506
3507 test -n "$CC" && break
3508 done
3509 fi
3510 if test -z "$CC"; then
3511 ac_ct_CC=$CC
3512 for ac_prog in cl.exe
3513 do
3514 # Extract the first word of "$ac_prog", so it can be a program name with args.
3515 set dummy $ac_prog; ac_word=$2
3516 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3517 printf %s "checking for $ac_word... " >&6; }
3518 if test ${ac_cv_prog_ac_ct_CC+y}
3519 then :
3520 printf %s "(cached) " >&6
3521 else $as_nop
3522 if test -n "$ac_ct_CC"; then
3523 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
3524 else
3525 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3526 for as_dir in $PATH
3527 do
3528 IFS=$as_save_IFS
3529 case $as_dir in #(((
3530 '') as_dir=./ ;;
3531 */) ;;
3532 *) as_dir=$as_dir/ ;;
3533 esac
3534 for ac_exec_ext in '' $ac_executable_extensions; do
3535 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3536 ac_cv_prog_ac_ct_CC="$ac_prog"
3537 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3538 break 2
3539 fi
3540 done
3541 done
3542 IFS=$as_save_IFS
3543
3544 fi
3545 fi
3546 ac_ct_CC=$ac_cv_prog_ac_ct_CC
3547 if test -n "$ac_ct_CC"; then
3548 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
3549 printf "%s\n" "$ac_ct_CC" >&6; }
3550 else
3551 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3552 printf "%s\n" "no" >&6; }
3553 fi
3554
3555
3556 test -n "$ac_ct_CC" && break
3557 done
3558
3559 if test "x$ac_ct_CC" = x; then
3560 CC=""
3561 else
3562 case $cross_compiling:$ac_tool_warned in
3563 yes:)
3564 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
3565 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
3566 ac_tool_warned=yes ;;
3567 esac
3568 CC=$ac_ct_CC
3569 fi
3570 fi
3571
3572 fi
3573 if test -z "$CC"; then
3574 if test -n "$ac_tool_prefix"; then
3575 # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args.
3576 set dummy ${ac_tool_prefix}clang; ac_word=$2
3577 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3578 printf %s "checking for $ac_word... " >&6; }
3579 if test ${ac_cv_prog_CC+y}
3580 then :
3581 printf %s "(cached) " >&6
3582 else $as_nop
3583 if test -n "$CC"; then
3584 ac_cv_prog_CC="$CC" # Let the user override the test.
3585 else
3586 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3587 for as_dir in $PATH
3588 do
3589 IFS=$as_save_IFS
3590 case $as_dir in #(((
3591 '') as_dir=./ ;;
3592 */) ;;
3593 *) as_dir=$as_dir/ ;;
3594 esac
3595 for ac_exec_ext in '' $ac_executable_extensions; do
3596 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3597 ac_cv_prog_CC="${ac_tool_prefix}clang"
3598 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3599 break 2
3600 fi
3601 done
3602 done
3603 IFS=$as_save_IFS
3604
3605 fi
3606 fi
3607 CC=$ac_cv_prog_CC
3608 if test -n "$CC"; then
3609 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
3610 printf "%s\n" "$CC" >&6; }
3611 else
3612 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3613 printf "%s\n" "no" >&6; }
3614 fi
3615
3616
3617 fi
3618 if test -z "$ac_cv_prog_CC"; then
3619 ac_ct_CC=$CC
3620 # Extract the first word of "clang", so it can be a program name with args.
3621 set dummy clang; ac_word=$2
3622 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
3623 printf %s "checking for $ac_word... " >&6; }
3624 if test ${ac_cv_prog_ac_ct_CC+y}
3625 then :
3626 printf %s "(cached) " >&6
3627 else $as_nop
3628 if test -n "$ac_ct_CC"; then
3629 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
3630 else
3631 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3632 for as_dir in $PATH
3633 do
3634 IFS=$as_save_IFS
3635 case $as_dir in #(((
3636 '') as_dir=./ ;;
3637 */) ;;
3638 *) as_dir=$as_dir/ ;;
3639 esac
3640 for ac_exec_ext in '' $ac_executable_extensions; do
3641 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
3642 ac_cv_prog_ac_ct_CC="clang"
3643 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
3644 break 2
3645 fi
3646 done
3647 done
3648 IFS=$as_save_IFS
3649
3650 fi
3651 fi
3652 ac_ct_CC=$ac_cv_prog_ac_ct_CC
3653 if test -n "$ac_ct_CC"; then
3654 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
3655 printf "%s\n" "$ac_ct_CC" >&6; }
3656 else
3657 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3658 printf "%s\n" "no" >&6; }
3659 fi
3660
3661 if test "x$ac_ct_CC" = x; then
3662 CC=""
3663 else
3664 case $cross_compiling:$ac_tool_warned in
3665 yes:)
3666 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
3667 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
3668 ac_tool_warned=yes ;;
3669 esac
3670 CC=$ac_ct_CC
3671 fi
3672 else
3673 CC="$ac_cv_prog_CC"
3674 fi
3675
3676 fi
3677
3678
3679 test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3680 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
3681 as_fn_error $? "no acceptable C compiler found in \$PATH
3682 See \`config.log' for more details" "$LINENO" 5; }
3683
3684 # Provide some information about the compiler.
3685 printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
3686 set X $ac_compile
3687 ac_compiler=$2
3688 for ac_option in --version -v -V -qversion -version; do
3689 { { ac_try="$ac_compiler $ac_option >&5"
3690 case "(($ac_try" in
3691 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3692 *) ac_try_echo=$ac_try;;
3693 esac
3694 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3695 printf "%s\n" "$ac_try_echo"; } >&5
3696 (eval "$ac_compiler $ac_option >&5") 2>conftest.err
3697 ac_status=$?
3698 if test -s conftest.err; then
3699 sed '10a\
3700 ... rest of stderr output deleted ...
3701 10q' conftest.err >conftest.er1
3702 cat conftest.er1 >&5
3703 fi
3704 rm -f conftest.er1 conftest.err
3705 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3706 test $ac_status = 0; }
3707 done
3708
3709 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3710 /* end confdefs.h. */
3711
3712 int
3713 main (void)
3714 {
3715
3716 ;
3717 return 0;
3718 }
3719 _ACEOF
3720 ac_clean_files_save=$ac_clean_files
3721 ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
3722 # Try to create an executable without -o first, disregard a.out.
3723 # It will help us diagnose broken compilers, and finding out an intuition
3724 # of exeext.
3725 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
3726 printf %s "checking whether the C compiler works... " >&6; }
3727 ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
3728
3729 # The possible output files:
3730 ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
3731
3732 ac_rmfiles=
3733 for ac_file in $ac_files
3734 do
3735 case $ac_file in
3736 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
3737 * ) ac_rmfiles="$ac_rmfiles $ac_file";;
3738 esac
3739 done
3740 rm -f $ac_rmfiles
3741
3742 if { { ac_try="$ac_link_default"
3743 case "(($ac_try" in
3744 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3745 *) ac_try_echo=$ac_try;;
3746 esac
3747 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3748 printf "%s\n" "$ac_try_echo"; } >&5
3749 (eval "$ac_link_default") 2>&5
3750 ac_status=$?
3751 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3752 test $ac_status = 0; }
3753 then :
3754 # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
3755 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
3756 # in a Makefile. We should not override ac_cv_exeext if it was cached,
3757 # so that the user can short-circuit this test for compilers unknown to
3758 # Autoconf.
3759 for ac_file in $ac_files ''
3760 do
3761 test -f "$ac_file" || continue
3762 case $ac_file in
3763 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
3764 ;;
3765 [ab].out )
3766 # We found the default executable, but exeext='' is most
3767 # certainly right.
3768 break;;
3769 *.* )
3770 if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no;
3771 then :; else
3772 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
3773 fi
3774 # We set ac_cv_exeext here because the later test for it is not
3775 # safe: cross compilers may not add the suffix if given an `-o'
3776 # argument, so we may need to know it at that point already.
3777 # Even if this section looks crufty: it has the advantage of
3778 # actually working.
3779 break;;
3780 * )
3781 break;;
3782 esac
3783 done
3784 test "$ac_cv_exeext" = no && ac_cv_exeext=
3785
3786 else $as_nop
3787 ac_file=''
3788 fi
3789 if test -z "$ac_file"
3790 then :
3791 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
3792 printf "%s\n" "no" >&6; }
3793 printf "%s\n" "$as_me: failed program was:" >&5
3794 sed 's/^/| /' conftest.$ac_ext >&5
3795
3796 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3797 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
3798 as_fn_error 77 "C compiler cannot create executables
3799 See \`config.log' for more details" "$LINENO" 5; }
3800 else $as_nop
3801 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
3802 printf "%s\n" "yes" >&6; }
3803 fi
3804 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
3805 printf %s "checking for C compiler default output file name... " >&6; }
3806 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
3807 printf "%s\n" "$ac_file" >&6; }
3808 ac_exeext=$ac_cv_exeext
3809
3810 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
3811 ac_clean_files=$ac_clean_files_save
3812 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
3813 printf %s "checking for suffix of executables... " >&6; }
3814 if { { ac_try="$ac_link"
3815 case "(($ac_try" in
3816 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3817 *) ac_try_echo=$ac_try;;
3818 esac
3819 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3820 printf "%s\n" "$ac_try_echo"; } >&5
3821 (eval "$ac_link") 2>&5
3822 ac_status=$?
3823 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3824 test $ac_status = 0; }
3825 then :
3826 # If both `conftest.exe' and `conftest' are `present' (well, observable)
3827 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
3828 # work properly (i.e., refer to `conftest.exe'), while it won't with
3829 # `rm'.
3830 for ac_file in conftest.exe conftest conftest.*; do
3831 test -f "$ac_file" || continue
3832 case $ac_file in
3833 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
3834 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
3835 break;;
3836 * ) break;;
3837 esac
3838 done
3839 else $as_nop
3840 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3841 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
3842 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
3843 See \`config.log' for more details" "$LINENO" 5; }
3844 fi
3845 rm -f conftest conftest$ac_cv_exeext
3846 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
3847 printf "%s\n" "$ac_cv_exeext" >&6; }
3848
3849 rm -f conftest.$ac_ext
3850 EXEEXT=$ac_cv_exeext
3851 ac_exeext=$EXEEXT
3852 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3853 /* end confdefs.h. */
3854 #include <stdio.h>
3855 int
3856 main (void)
3857 {
3858 FILE *f = fopen ("conftest.out", "w");
3859 return ferror (f) || fclose (f) != 0;
3860
3861 ;
3862 return 0;
3863 }
3864 _ACEOF
3865 ac_clean_files="$ac_clean_files conftest.out"
3866 # Check that the compiler produces executables we can run. If not, either
3867 # the compiler is broken, or we cross compile.
3868 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
3869 printf %s "checking whether we are cross compiling... " >&6; }
3870 if test "$cross_compiling" != yes; then
3871 { { ac_try="$ac_link"
3872 case "(($ac_try" in
3873 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3874 *) ac_try_echo=$ac_try;;
3875 esac
3876 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3877 printf "%s\n" "$ac_try_echo"; } >&5
3878 (eval "$ac_link") 2>&5
3879 ac_status=$?
3880 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3881 test $ac_status = 0; }
3882 if { ac_try='./conftest$ac_cv_exeext'
3883 { { case "(($ac_try" in
3884 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3885 *) ac_try_echo=$ac_try;;
3886 esac
3887 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3888 printf "%s\n" "$ac_try_echo"; } >&5
3889 (eval "$ac_try") 2>&5
3890 ac_status=$?
3891 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3892 test $ac_status = 0; }; }; then
3893 cross_compiling=no
3894 else
3895 if test "$cross_compiling" = maybe; then
3896 cross_compiling=yes
3897 else
3898 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3899 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
3900 as_fn_error 77 "cannot run C compiled programs.
3901 If you meant to cross compile, use \`--host'.
3902 See \`config.log' for more details" "$LINENO" 5; }
3903 fi
3904 fi
3905 fi
3906 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
3907 printf "%s\n" "$cross_compiling" >&6; }
3908
3909 rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
3910 ac_clean_files=$ac_clean_files_save
3911 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
3912 printf %s "checking for suffix of object files... " >&6; }
3913 if test ${ac_cv_objext+y}
3914 then :
3915 printf %s "(cached) " >&6
3916 else $as_nop
3917 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3918 /* end confdefs.h. */
3919
3920 int
3921 main (void)
3922 {
3923
3924 ;
3925 return 0;
3926 }
3927 _ACEOF
3928 rm -f conftest.o conftest.obj
3929 if { { ac_try="$ac_compile"
3930 case "(($ac_try" in
3931 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
3932 *) ac_try_echo=$ac_try;;
3933 esac
3934 eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
3935 printf "%s\n" "$ac_try_echo"; } >&5
3936 (eval "$ac_compile") 2>&5
3937 ac_status=$?
3938 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
3939 test $ac_status = 0; }
3940 then :
3941 for ac_file in conftest.o conftest.obj conftest.*; do
3942 test -f "$ac_file" || continue;
3943 case $ac_file in
3944 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
3945 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
3946 break;;
3947 esac
3948 done
3949 else $as_nop
3950 printf "%s\n" "$as_me: failed program was:" >&5
3951 sed 's/^/| /' conftest.$ac_ext >&5
3952
3953 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
3954 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
3955 as_fn_error $? "cannot compute suffix of object files: cannot compile
3956 See \`config.log' for more details" "$LINENO" 5; }
3957 fi
3958 rm -f conftest.$ac_cv_objext conftest.$ac_ext
3959 fi
3960 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
3961 printf "%s\n" "$ac_cv_objext" >&6; }
3962 OBJEXT=$ac_cv_objext
3963 ac_objext=$OBJEXT
3964 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5
3965 printf %s "checking whether the compiler supports GNU C... " >&6; }
3966 if test ${ac_cv_c_compiler_gnu+y}
3967 then :
3968 printf %s "(cached) " >&6
3969 else $as_nop
3970 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3971 /* end confdefs.h. */
3972
3973 int
3974 main (void)
3975 {
3976 #ifndef __GNUC__
3977 choke me
3978 #endif
3979
3980 ;
3981 return 0;
3982 }
3983 _ACEOF
3984 if ac_fn_c_try_compile "$LINENO"
3985 then :
3986 ac_compiler_gnu=yes
3987 else $as_nop
3988 ac_compiler_gnu=no
3989 fi
3990 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
3991 ac_cv_c_compiler_gnu=$ac_compiler_gnu
3992
3993 fi
3994 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
3995 printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; }
3996 ac_compiler_gnu=$ac_cv_c_compiler_gnu
3997
3998 if test $ac_compiler_gnu = yes; then
3999 GCC=yes
4000 else
4001 GCC=
4002 fi
4003 ac_test_CFLAGS=${CFLAGS+y}
4004 ac_save_CFLAGS=$CFLAGS
4005 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
4006 printf %s "checking whether $CC accepts -g... " >&6; }
4007 if test ${ac_cv_prog_cc_g+y}
4008 then :
4009 printf %s "(cached) " >&6
4010 else $as_nop
4011 ac_save_c_werror_flag=$ac_c_werror_flag
4012 ac_c_werror_flag=yes
4013 ac_cv_prog_cc_g=no
4014 CFLAGS="-g"
4015 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4016 /* end confdefs.h. */
4017
4018 int
4019 main (void)
4020 {
4021
4022 ;
4023 return 0;
4024 }
4025 _ACEOF
4026 if ac_fn_c_try_compile "$LINENO"
4027 then :
4028 ac_cv_prog_cc_g=yes
4029 else $as_nop
4030 CFLAGS=""
4031 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4032 /* end confdefs.h. */
4033
4034 int
4035 main (void)
4036 {
4037
4038 ;
4039 return 0;
4040 }
4041 _ACEOF
4042 if ac_fn_c_try_compile "$LINENO"
4043 then :
4044
4045 else $as_nop
4046 ac_c_werror_flag=$ac_save_c_werror_flag
4047 CFLAGS="-g"
4048 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4049 /* end confdefs.h. */
4050
4051 int
4052 main (void)
4053 {
4054
4055 ;
4056 return 0;
4057 }
4058 _ACEOF
4059 if ac_fn_c_try_compile "$LINENO"
4060 then :
4061 ac_cv_prog_cc_g=yes
4062 fi
4063 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
4064 fi
4065 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
4066 fi
4067 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
4068 ac_c_werror_flag=$ac_save_c_werror_flag
4069 fi
4070 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
4071 printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
4072 if test $ac_test_CFLAGS; then
4073 CFLAGS=$ac_save_CFLAGS
4074 elif test $ac_cv_prog_cc_g = yes; then
4075 if test "$GCC" = yes; then
4076 CFLAGS="-g -O2"
4077 else
4078 CFLAGS="-g"
4079 fi
4080 else
4081 if test "$GCC" = yes; then
4082 CFLAGS="-O2"
4083 else
4084 CFLAGS=
4085 fi
4086 fi
4087 ac_prog_cc_stdc=no
4088 if test x$ac_prog_cc_stdc = xno
4089 then :
4090 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5
4091 printf %s "checking for $CC option to enable C11 features... " >&6; }
4092 if test ${ac_cv_prog_cc_c11+y}
4093 then :
4094 printf %s "(cached) " >&6
4095 else $as_nop
4096 ac_cv_prog_cc_c11=no
4097 ac_save_CC=$CC
4098 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4099 /* end confdefs.h. */
4100 $ac_c_conftest_c11_program
4101 _ACEOF
4102 for ac_arg in '' -std=gnu11
4103 do
4104 CC="$ac_save_CC $ac_arg"
4105 if ac_fn_c_try_compile "$LINENO"
4106 then :
4107 ac_cv_prog_cc_c11=$ac_arg
4108 fi
4109 rm -f core conftest.err conftest.$ac_objext conftest.beam
4110 test "x$ac_cv_prog_cc_c11" != "xno" && break
4111 done
4112 rm -f conftest.$ac_ext
4113 CC=$ac_save_CC
4114 fi
4115
4116 if test "x$ac_cv_prog_cc_c11" = xno
4117 then :
4118 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
4119 printf "%s\n" "unsupported" >&6; }
4120 else $as_nop
4121 if test "x$ac_cv_prog_cc_c11" = x
4122 then :
4123 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
4124 printf "%s\n" "none needed" >&6; }
4125 else $as_nop
4126 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5
4127 printf "%s\n" "$ac_cv_prog_cc_c11" >&6; }
4128 CC="$CC $ac_cv_prog_cc_c11"
4129 fi
4130 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11
4131 ac_prog_cc_stdc=c11
4132 fi
4133 fi
4134 if test x$ac_prog_cc_stdc = xno
4135 then :
4136 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5
4137 printf %s "checking for $CC option to enable C99 features... " >&6; }
4138 if test ${ac_cv_prog_cc_c99+y}
4139 then :
4140 printf %s "(cached) " >&6
4141 else $as_nop
4142 ac_cv_prog_cc_c99=no
4143 ac_save_CC=$CC
4144 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4145 /* end confdefs.h. */
4146 $ac_c_conftest_c99_program
4147 _ACEOF
4148 for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99=
4149 do
4150 CC="$ac_save_CC $ac_arg"
4151 if ac_fn_c_try_compile "$LINENO"
4152 then :
4153 ac_cv_prog_cc_c99=$ac_arg
4154 fi
4155 rm -f core conftest.err conftest.$ac_objext conftest.beam
4156 test "x$ac_cv_prog_cc_c99" != "xno" && break
4157 done
4158 rm -f conftest.$ac_ext
4159 CC=$ac_save_CC
4160 fi
4161
4162 if test "x$ac_cv_prog_cc_c99" = xno
4163 then :
4164 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
4165 printf "%s\n" "unsupported" >&6; }
4166 else $as_nop
4167 if test "x$ac_cv_prog_cc_c99" = x
4168 then :
4169 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
4170 printf "%s\n" "none needed" >&6; }
4171 else $as_nop
4172 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
4173 printf "%s\n" "$ac_cv_prog_cc_c99" >&6; }
4174 CC="$CC $ac_cv_prog_cc_c99"
4175 fi
4176 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
4177 ac_prog_cc_stdc=c99
4178 fi
4179 fi
4180 if test x$ac_prog_cc_stdc = xno
4181 then :
4182 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5
4183 printf %s "checking for $CC option to enable C89 features... " >&6; }
4184 if test ${ac_cv_prog_cc_c89+y}
4185 then :
4186 printf %s "(cached) " >&6
4187 else $as_nop
4188 ac_cv_prog_cc_c89=no
4189 ac_save_CC=$CC
4190 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4191 /* end confdefs.h. */
4192 $ac_c_conftest_c89_program
4193 _ACEOF
4194 for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
4195 do
4196 CC="$ac_save_CC $ac_arg"
4197 if ac_fn_c_try_compile "$LINENO"
4198 then :
4199 ac_cv_prog_cc_c89=$ac_arg
4200 fi
4201 rm -f core conftest.err conftest.$ac_objext conftest.beam
4202 test "x$ac_cv_prog_cc_c89" != "xno" && break
4203 done
4204 rm -f conftest.$ac_ext
4205 CC=$ac_save_CC
4206 fi
4207
4208 if test "x$ac_cv_prog_cc_c89" = xno
4209 then :
4210 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
4211 printf "%s\n" "unsupported" >&6; }
4212 else $as_nop
4213 if test "x$ac_cv_prog_cc_c89" = x
4214 then :
4215 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
4216 printf "%s\n" "none needed" >&6; }
4217 else $as_nop
4218 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
4219 printf "%s\n" "$ac_cv_prog_cc_c89" >&6; }
4220 CC="$CC $ac_cv_prog_cc_c89"
4221 fi
4222 ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
4223 ac_prog_cc_stdc=c89
4224 fi
4225 fi
4226
4227 ac_ext=c
4228 ac_cpp='$CPP $CPPFLAGS'
4229 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4230 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4231 ac_compiler_gnu=$ac_cv_c_compiler_gnu
4232
4233
4234 ac_ext=c
4235 ac_cpp='$CPP $CPPFLAGS'
4236 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4237 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4238 ac_compiler_gnu=$ac_cv_c_compiler_gnu
4239 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5
4240 printf %s "checking whether $CC understands -c and -o together... " >&6; }
4241 if test ${am_cv_prog_cc_c_o+y}
4242 then :
4243 printf %s "(cached) " >&6
4244 else $as_nop
4245 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4246 /* end confdefs.h. */
4247
4248 int
4249 main (void)
4250 {
4251
4252 ;
4253 return 0;
4254 }
4255 _ACEOF
4256 # Make sure it works both with $CC and with simple cc.
4257 # Following AC_PROG_CC_C_O, we do the test twice because some
4258 # compilers refuse to overwrite an existing .o file with -o,
4259 # though they will create one.
4260 am_cv_prog_cc_c_o=yes
4261 for am_i in 1 2; do
4262 if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5
4263 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5
4264 ac_status=$?
4265 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4266 (exit $ac_status); } \
4267 && test -f conftest2.$ac_objext; then
4268 : OK
4269 else
4270 am_cv_prog_cc_c_o=no
4271 break
4272 fi
4273 done
4274 rm -f core conftest*
4275 unset am_i
4276 fi
4277 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5
4278 printf "%s\n" "$am_cv_prog_cc_c_o" >&6; }
4279 if test "$am_cv_prog_cc_c_o" != yes; then
4280 # Losing compiler, so override with the script.
4281 # FIXME: It is wrong to rewrite CC.
4282 # But if we don't then we get into trouble of one sort or another.
4283 # A longer-term fix would be to have automake use am__CC in this case,
4284 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
4285 CC="$am_aux_dir/compile $CC"
4286 fi
4287 ac_ext=c
4288 ac_cpp='$CPP $CPPFLAGS'
4289 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
4290 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
4291 ac_compiler_gnu=$ac_cv_c_compiler_gnu
4292
4293 DEPDIR="${am__leading_dot}deps"
4294
4295 ac_config_commands="$ac_config_commands depfiles"
4296
4297 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
4298 printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; }
4299 cat > confinc.mk << 'END'
4300 am__doit:
4301 @echo this is the am__doit target >confinc.out
4302 .PHONY: am__doit
4303 END
4304 am__include="#"
4305 am__quote=
4306 # BSD make does it like this.
4307 echo '.include "confinc.mk" # ignored' > confmf.BSD
4308 # Other make implementations (GNU, Solaris 10, AIX) do it like this.
4309 echo 'include confinc.mk # ignored' > confmf.GNU
4310 _am_result=no
4311 for s in GNU BSD; do
4312 { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
4313 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
4314 ac_status=$?
4315 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4316 (exit $ac_status); }
4317 case $?:`cat confinc.out 2>/dev/null` in #(
4318 '0:this is the am__doit target') :
4319 case $s in #(
4320 BSD) :
4321 am__include='.include' am__quote='"' ;; #(
4322 *) :
4323 am__include='include' am__quote='' ;;
4324 esac ;; #(
4325 *) :
4326 ;;
4327 esac
4328 if test "$am__include" != "#"; then
4329 _am_result="yes ($s style)"
4330 break
4331 fi
4332 done
4333 rm -f confinc.* confmf.*
4334 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
4335 printf "%s\n" "${_am_result}" >&6; }
4336
4337 # Check whether --enable-dependency-tracking was given.
4338 if test ${enable_dependency_tracking+y}
4339 then :
4340 enableval=$enable_dependency_tracking;
4341 fi
4342
4343 if test "x$enable_dependency_tracking" != xno; then
4344 am_depcomp="$ac_aux_dir/depcomp"
4345 AMDEPBACKSLASH='\'
4346 am__nodep='_no'
4347 fi
4348 if test "x$enable_dependency_tracking" != xno; then
4349 AMDEP_TRUE=
4350 AMDEP_FALSE='#'
4351 else
4352 AMDEP_TRUE='#'
4353 AMDEP_FALSE=
4354 fi
4355
4356
4357
4358 depcc="$CC" am_compiler_list=
4359
4360 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
4361 printf %s "checking dependency style of $depcc... " >&6; }
4362 if test ${am_cv_CC_dependencies_compiler_type+y}
4363 then :
4364 printf %s "(cached) " >&6
4365 else $as_nop
4366 if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
4367 # We make a subdir and do the tests there. Otherwise we can end up
4368 # making bogus files that we don't know about and never remove. For
4369 # instance it was reported that on HP-UX the gcc test will end up
4370 # making a dummy file named 'D' -- because '-MD' means "put the output
4371 # in D".
4372 rm -rf conftest.dir
4373 mkdir conftest.dir
4374 # Copy depcomp to subdir because otherwise we won't find it if we're
4375 # using a relative directory.
4376 cp "$am_depcomp" conftest.dir
4377 cd conftest.dir
4378 # We will build objects and dependencies in a subdirectory because
4379 # it helps to detect inapplicable dependency modes. For instance
4380 # both Tru64's cc and ICC support -MD to output dependencies as a
4381 # side effect of compilation, but ICC will put the dependencies in
4382 # the current directory while Tru64 will put them in the object
4383 # directory.
4384 mkdir sub
4385
4386 am_cv_CC_dependencies_compiler_type=none
4387 if test "$am_compiler_list" = ""; then
4388 am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
4389 fi
4390 am__universal=false
4391 case " $depcc " in #(
4392 *\ -arch\ *\ -arch\ *) am__universal=true ;;
4393 esac
4394
4395 for depmode in $am_compiler_list; do
4396 # Setup a source with many dependencies, because some compilers
4397 # like to wrap large dependency lists on column 80 (with \), and
4398 # we should not choose a depcomp mode which is confused by this.
4399 #
4400 # We need to recreate these files for each test, as the compiler may
4401 # overwrite some of them when testing with obscure command lines.
4402 # This happens at least with the AIX C compiler.
4403 : > sub/conftest.c
4404 for i in 1 2 3 4 5 6; do
4405 echo '#include "conftst'$i'.h"' >> sub/conftest.c
4406 # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
4407 # Solaris 10 /bin/sh.
4408 echo '/* dummy */' > sub/conftst$i.h
4409 done
4410 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
4411
4412 # We check with '-c' and '-o' for the sake of the "dashmstdout"
4413 # mode. It turns out that the SunPro C++ compiler does not properly
4414 # handle '-M -o', and we need to detect this. Also, some Intel
4415 # versions had trouble with output in subdirs.
4416 am__obj=sub/conftest.${OBJEXT-o}
4417 am__minus_obj="-o $am__obj"
4418 case $depmode in
4419 gcc)
4420 # This depmode causes a compiler race in universal mode.
4421 test "$am__universal" = false || continue
4422 ;;
4423 nosideeffect)
4424 # After this tag, mechanisms are not by side-effect, so they'll
4425 # only be used when explicitly requested.
4426 if test "x$enable_dependency_tracking" = xyes; then
4427 continue
4428 else
4429 break
4430 fi
4431 ;;
4432 msvc7 | msvc7msys | msvisualcpp | msvcmsys)
4433 # This compiler won't grok '-c -o', but also, the minuso test has
4434 # not run yet. These depmodes are late enough in the game, and
4435 # so weak that their functioning should not be impacted.
4436 am__obj=conftest.${OBJEXT-o}
4437 am__minus_obj=
4438 ;;
4439 none) break ;;
4440 esac
4441 if depmode=$depmode \
4442 source=sub/conftest.c object=$am__obj \
4443 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
4444 $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
4445 >/dev/null 2>conftest.err &&
4446 grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
4447 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
4448 grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
4449 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
4450 # icc doesn't choke on unknown options, it will just issue warnings
4451 # or remarks (even with -Werror). So we grep stderr for any message
4452 # that says an option was ignored or not supported.
4453 # When given -MP, icc 7.0 and 7.1 complain thusly:
4454 # icc: Command line warning: ignoring option '-M'; no argument required
4455 # The diagnosis changed in icc 8.0:
4456 # icc: Command line remark: option '-MP' not supported
4457 if (grep 'ignoring option' conftest.err ||
4458 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
4459 am_cv_CC_dependencies_compiler_type=$depmode
4460 break
4461 fi
4462 fi
4463 done
4464
4465 cd ..
4466 rm -rf conftest.dir
4467 else
4468 am_cv_CC_dependencies_compiler_type=none
4469 fi
4470
4471 fi
4472 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
4473 printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; }
4474 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
4475
4476 if
4477 test "x$enable_dependency_tracking" != xno \
4478 && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
4479 am__fastdepCC_TRUE=
4480 am__fastdepCC_FALSE='#'
4481 else
4482 am__fastdepCC_TRUE='#'
4483 am__fastdepCC_FALSE=
4484 fi
4485
4486
4487
4488
4489 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
4490 printf %s "checking for a sed that does not truncate output... " >&6; }
4491 if test ${ac_cv_path_SED+y}
4492 then :
4493 printf %s "(cached) " >&6
4494 else $as_nop
4495 ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
4496 for ac_i in 1 2 3 4 5 6 7; do
4497 ac_script="$ac_script$as_nl$ac_script"
4498 done
4499 echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
4500 { ac_script=; unset ac_script;}
4501 if test -z "$SED"; then
4502 ac_path_SED_found=false
4503 # Loop through the user's path and test for each of PROGNAME-LIST
4504 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4505 for as_dir in $PATH
4506 do
4507 IFS=$as_save_IFS
4508 case $as_dir in #(((
4509 '') as_dir=./ ;;
4510 */) ;;
4511 *) as_dir=$as_dir/ ;;
4512 esac
4513 for ac_prog in sed gsed
4514 do
4515 for ac_exec_ext in '' $ac_executable_extensions; do
4516 ac_path_SED="$as_dir$ac_prog$ac_exec_ext"
4517 as_fn_executable_p "$ac_path_SED" || continue
4518 # Check for GNU ac_path_SED and select it if it is found.
4519 # Check for GNU $ac_path_SED
4520 case `"$ac_path_SED" --version 2>&1` in
4521 *GNU*)
4522 ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
4523 *)
4524 ac_count=0
4525 printf %s 0123456789 >"conftest.in"
4526 while :
4527 do
4528 cat "conftest.in" "conftest.in" >"conftest.tmp"
4529 mv "conftest.tmp" "conftest.in"
4530 cp "conftest.in" "conftest.nl"
4531 printf "%s\n" '' >> "conftest.nl"
4532 "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
4533 diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
4534 as_fn_arith $ac_count + 1 && ac_count=$as_val
4535 if test $ac_count -gt ${ac_path_SED_max-0}; then
4536 # Best one so far, save it but keep looking for a better one
4537 ac_cv_path_SED="$ac_path_SED"
4538 ac_path_SED_max=$ac_count
4539 fi
4540 # 10*(2^10) chars as input seems more than enough
4541 test $ac_count -gt 10 && break
4542 done
4543 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
4544 esac
4545
4546 $ac_path_SED_found && break 3
4547 done
4548 done
4549 done
4550 IFS=$as_save_IFS
4551 if test -z "$ac_cv_path_SED"; then
4552 as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
4553 fi
4554 else
4555 ac_cv_path_SED=$SED
4556 fi
4557
4558 fi
4559 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
4560 printf "%s\n" "$ac_cv_path_SED" >&6; }
4561 SED="$ac_cv_path_SED"
4562 rm -f conftest.sed
4563
4564
4565
4566 ac_header= ac_cache=
4567 for ac_item in $ac_header_c_list
4568 do
4569 if test $ac_cache; then
4570 ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default"
4571 if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then
4572 printf "%s\n" "#define $ac_item 1" >> confdefs.h
4573 fi
4574 ac_header= ac_cache=
4575 elif test $ac_header; then
4576 ac_cache=$ac_item
4577 else
4578 ac_header=$ac_item
4579 fi
4580 done
4581
4582
4583
4584
4585
4586
4587
4588
4589 if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes
4590 then :
4591
4592 printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h
4593
4594 fi
4595
4596
4597
4598
4599
4600
4601 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
4602 printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; }
4603 if test ${ac_cv_safe_to_define___extensions__+y}
4604 then :
4605 printf %s "(cached) " >&6
4606 else $as_nop
4607 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4608 /* end confdefs.h. */
4609
4610 # define __EXTENSIONS__ 1
4611 $ac_includes_default
4612 int
4613 main (void)
4614 {
4615
4616 ;
4617 return 0;
4618 }
4619 _ACEOF
4620 if ac_fn_c_try_compile "$LINENO"
4621 then :
4622 ac_cv_safe_to_define___extensions__=yes
4623 else $as_nop
4624 ac_cv_safe_to_define___extensions__=no
4625 fi
4626 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
4627 fi
4628 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
4629 printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; }
4630
4631 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5
4632 printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; }
4633 if test ${ac_cv_should_define__xopen_source+y}
4634 then :
4635 printf %s "(cached) " >&6
4636 else $as_nop
4637 ac_cv_should_define__xopen_source=no
4638 if test $ac_cv_header_wchar_h = yes
4639 then :
4640 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4641 /* end confdefs.h. */
4642
4643 #include <wchar.h>
4644 mbstate_t x;
4645 int
4646 main (void)
4647 {
4648
4649 ;
4650 return 0;
4651 }
4652 _ACEOF
4653 if ac_fn_c_try_compile "$LINENO"
4654 then :
4655
4656 else $as_nop
4657 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
4658 /* end confdefs.h. */
4659
4660 #define _XOPEN_SOURCE 500
4661 #include <wchar.h>
4662 mbstate_t x;
4663 int
4664 main (void)
4665 {
4666
4667 ;
4668 return 0;
4669 }
4670 _ACEOF
4671 if ac_fn_c_try_compile "$LINENO"
4672 then :
4673 ac_cv_should_define__xopen_source=yes
4674 fi
4675 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
4676 fi
4677 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
4678 fi
4679 fi
4680 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5
4681 printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; }
4682
4683 printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h
4684
4685 printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h
4686
4687 printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h
4688
4689 printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h
4690
4691 printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h
4692
4693 printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h
4694
4695 printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
4696
4697 printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h
4698
4699 printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h
4700
4701 printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h
4702
4703 printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h
4704
4705 printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h
4706
4707 printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h
4708
4709 printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h
4710
4711 printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h
4712
4713 if test $ac_cv_header_minix_config_h = yes
4714 then :
4715 MINIX=yes
4716 printf "%s\n" "#define _MINIX 1" >>confdefs.h
4717
4718 printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h
4719
4720 printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h
4721
4722 else $as_nop
4723 MINIX=
4724 fi
4725 if test $ac_cv_safe_to_define___extensions__ = yes
4726 then :
4727 printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h
4728
4729 fi
4730 if test $ac_cv_should_define__xopen_source = yes
4731 then :
4732 printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h
4733
4734 fi
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744 if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
4745 if test -n "$ac_tool_prefix"; then
4746 # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
4747 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
4748 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4749 printf %s "checking for $ac_word... " >&6; }
4750 if test ${ac_cv_path_PKG_CONFIG+y}
4751 then :
4752 printf %s "(cached) " >&6
4753 else $as_nop
4754 case $PKG_CONFIG in
4755 [\\/]* | ?:[\\/]*)
4756 ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
4757 ;;
4758 *)
4759 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4760 for as_dir in $PATH
4761 do
4762 IFS=$as_save_IFS
4763 case $as_dir in #(((
4764 '') as_dir=./ ;;
4765 */) ;;
4766 *) as_dir=$as_dir/ ;;
4767 esac
4768 for ac_exec_ext in '' $ac_executable_extensions; do
4769 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
4770 ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
4771 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
4772 break 2
4773 fi
4774 done
4775 done
4776 IFS=$as_save_IFS
4777
4778 ;;
4779 esac
4780 fi
4781 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
4782 if test -n "$PKG_CONFIG"; then
4783 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
4784 printf "%s\n" "$PKG_CONFIG" >&6; }
4785 else
4786 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
4787 printf "%s\n" "no" >&6; }
4788 fi
4789
4790
4791 fi
4792 if test -z "$ac_cv_path_PKG_CONFIG"; then
4793 ac_pt_PKG_CONFIG=$PKG_CONFIG
4794 # Extract the first word of "pkg-config", so it can be a program name with args.
4795 set dummy pkg-config; ac_word=$2
4796 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4797 printf %s "checking for $ac_word... " >&6; }
4798 if test ${ac_cv_path_ac_pt_PKG_CONFIG+y}
4799 then :
4800 printf %s "(cached) " >&6
4801 else $as_nop
4802 case $ac_pt_PKG_CONFIG in
4803 [\\/]* | ?:[\\/]*)
4804 ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
4805 ;;
4806 *)
4807 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4808 for as_dir in $PATH
4809 do
4810 IFS=$as_save_IFS
4811 case $as_dir in #(((
4812 '') as_dir=./ ;;
4813 */) ;;
4814 *) as_dir=$as_dir/ ;;
4815 esac
4816 for ac_exec_ext in '' $ac_executable_extensions; do
4817 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
4818 ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext"
4819 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
4820 break 2
4821 fi
4822 done
4823 done
4824 IFS=$as_save_IFS
4825
4826 ;;
4827 esac
4828 fi
4829 ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
4830 if test -n "$ac_pt_PKG_CONFIG"; then
4831 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
4832 printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; }
4833 else
4834 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
4835 printf "%s\n" "no" >&6; }
4836 fi
4837
4838 if test "x$ac_pt_PKG_CONFIG" = x; then
4839 PKG_CONFIG=""
4840 else
4841 case $cross_compiling:$ac_tool_warned in
4842 yes:)
4843 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
4844 printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
4845 ac_tool_warned=yes ;;
4846 esac
4847 PKG_CONFIG=$ac_pt_PKG_CONFIG
4848 fi
4849 else
4850 PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
4851 fi
4852
4853 fi
4854 if test -n "$PKG_CONFIG"; then
4855 _pkg_min_version=0.9.0
4856 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
4857 printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; }
4858 if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
4859 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
4860 printf "%s\n" "yes" >&6; }
4861 else
4862 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
4863 printf "%s\n" "no" >&6; }
4864 PKG_CONFIG=""
4865 fi
4866 fi
4867
4868 REVISION=""
4869 if test -d .git
4870 then :
4871
4872 # Extract the first word of "git", so it can be a program name with args.
4873 set dummy git; ac_word=$2
4874 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
4875 printf %s "checking for $ac_word... " >&6; }
4876 if test ${ac_cv_path_GIT+y}
4877 then :
4878 printf %s "(cached) " >&6
4879 else $as_nop
4880 case $GIT in
4881 [\\/]* | ?:[\\/]*)
4882 ac_cv_path_GIT="$GIT" # Let the user override the test with a path.
4883 ;;
4884 *)
4885 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4886 as_dummy=""$PATH:/sbin:/usr/sbin""
4887 for as_dir in $as_dummy
4888 do
4889 IFS=$as_save_IFS
4890 case $as_dir in #(((
4891 '') as_dir=./ ;;
4892 */) ;;
4893 *) as_dir=$as_dir/ ;;
4894 esac
4895 for ac_exec_ext in '' $ac_executable_extensions; do
4896 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
4897 ac_cv_path_GIT="$as_dir$ac_word$ac_exec_ext"
4898 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
4899 break 2
4900 fi
4901 done
4902 done
4903 IFS=$as_save_IFS
4904
4905 test -z "$ac_cv_path_GIT" && ac_cv_path_GIT=""""
4906 ;;
4907 esac
4908 fi
4909 GIT=$ac_cv_path_GIT
4910 if test -n "$GIT"; then
4911 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
4912 printf "%s\n" "$GIT" >&6; }
4913 else
4914 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
4915 printf "%s\n" "no" >&6; }
4916 fi
4917
4918
4919 if test "x$GIT" != "x"
4920 then :
4921
4922 REVISION=`$GIT describe --tags | sed -e 's/-/+git/;y/-/./'`
4923
4924 fi
4925
4926 fi
4927 if test "x$REVISION" = "x"
4928 then :
4929
4930 REVISION="unavailable"
4931
4932 fi
4933
4934
4935
4936 # Check whether --enable-silent-rules was given.
4937 if test ${enable_silent_rules+y}
4938 then :
4939 enableval=$enable_silent_rules;
4940 fi
4941
4942 case $enable_silent_rules in # (((
4943 yes) AM_DEFAULT_VERBOSITY=0;;
4944 no) AM_DEFAULT_VERBOSITY=1;;
4945 *) AM_DEFAULT_VERBOSITY=0;;
4946 esac
4947 am_make=${MAKE-make}
4948 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5
4949 printf %s "checking whether $am_make supports nested variables... " >&6; }
4950 if test ${am_cv_make_support_nested_variables+y}
4951 then :
4952 printf %s "(cached) " >&6
4953 else $as_nop
4954 if printf "%s\n" 'TRUE=$(BAR$(V))
4955 BAR0=false
4956 BAR1=true
4957 V=1
4958 am__doit:
4959 @$(TRUE)
4960 .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then
4961 am_cv_make_support_nested_variables=yes
4962 else
4963 am_cv_make_support_nested_variables=no
4964 fi
4965 fi
4966 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5
4967 printf "%s\n" "$am_cv_make_support_nested_variables" >&6; }
4968 if test $am_cv_make_support_nested_variables = yes; then
4969 AM_V='$(V)'
4970 AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
4971 else
4972 AM_V=$AM_DEFAULT_VERBOSITY
4973 AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
4974 fi
4975 AM_BACKSLASH='\'
4976
4977
4978 # Checks for libraries.
4979
4980 pkg_failed=no
4981 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libssl >= 0.9.8 libcrypto >= 0.9.8" >&5
4982 printf %s "checking for libssl >= 0.9.8 libcrypto >= 0.9.8... " >&6; }
4983
4984 if test -n "$OPENSSL_CFLAGS"; then
4985 pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS"
4986 elif test -n "$PKG_CONFIG"; then
4987 if test -n "$PKG_CONFIG" && \
4988 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssl >= 0.9.8 libcrypto >= 0.9.8\""; } >&5
4989 ($PKG_CONFIG --exists --print-errors "libssl >= 0.9.8 libcrypto >= 0.9.8") 2>&5
4990 ac_status=$?
4991 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
4992 test $ac_status = 0; }; then
4993 pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "libssl >= 0.9.8 libcrypto >= 0.9.8" 2>/dev/null`
4994 test "x$?" != "x0" && pkg_failed=yes
4995 else
4996 pkg_failed=yes
4997 fi
4998 else
4999 pkg_failed=untried
5000 fi
5001 if test -n "$OPENSSL_LIBS"; then
5002 pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS"
5003 elif test -n "$PKG_CONFIG"; then
5004 if test -n "$PKG_CONFIG" && \
5005 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssl >= 0.9.8 libcrypto >= 0.9.8\""; } >&5
5006 ($PKG_CONFIG --exists --print-errors "libssl >= 0.9.8 libcrypto >= 0.9.8") 2>&5
5007 ac_status=$?
5008 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
5009 test $ac_status = 0; }; then
5010 pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "libssl >= 0.9.8 libcrypto >= 0.9.8" 2>/dev/null`
5011 test "x$?" != "x0" && pkg_failed=yes
5012 else
5013 pkg_failed=yes
5014 fi
5015 else
5016 pkg_failed=untried
5017 fi
5018
5019
5020
5021 if test $pkg_failed = yes; then
5022 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5023 printf "%s\n" "no" >&6; }
5024
5025 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
5026 _pkg_short_errors_supported=yes
5027 else
5028 _pkg_short_errors_supported=no
5029 fi
5030 if test $_pkg_short_errors_supported = yes; then
5031 OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libssl >= 0.9.8 libcrypto >= 0.9.8" 2>&1`
5032 else
5033 OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libssl >= 0.9.8 libcrypto >= 0.9.8" 2>&1`
5034 fi
5035 # Put the nasty error message in config.log where it belongs
5036 echo "$OPENSSL_PKG_ERRORS" >&5
5037
5038 as_fn_error $? "Cannot find OpenSSL 0.9.8 or higher." "$LINENO" 5
5039 elif test $pkg_failed = untried; then
5040 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5041 printf "%s\n" "no" >&6; }
5042 as_fn_error $? "Cannot find OpenSSL 0.9.8 or higher." "$LINENO" 5
5043 else
5044 OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS
5045 OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS
5046 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
5047 printf "%s\n" "yes" >&6; }
5048
5049 fi
5050 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
5051 printf %s "checking for pthread_create in -lpthread... " >&6; }
5052 if test ${ac_cv_lib_pthread_pthread_create+y}
5053 then :
5054 printf %s "(cached) " >&6
5055 else $as_nop
5056 ac_check_lib_save_LIBS=$LIBS
5057 LIBS="-lpthread $LIBS"
5058 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5059 /* end confdefs.h. */
5060
5061 /* Override any GCC internal prototype to avoid an error.
5062 Use char because int might match the return type of a GCC
5063 builtin and then its argument prototype would still apply. */
5064 char pthread_create ();
5065 int
5066 main (void)
5067 {
5068 return pthread_create ();
5069 ;
5070 return 0;
5071 }
5072 _ACEOF
5073 if ac_fn_c_try_link "$LINENO"
5074 then :
5075 ac_cv_lib_pthread_pthread_create=yes
5076 else $as_nop
5077 ac_cv_lib_pthread_pthread_create=no
5078 fi
5079 rm -f core conftest.err conftest.$ac_objext conftest.beam \
5080 conftest$ac_exeext conftest.$ac_ext
5081 LIBS=$ac_check_lib_save_LIBS
5082 fi
5083 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
5084 printf "%s\n" "$ac_cv_lib_pthread_pthread_create" >&6; }
5085 if test "x$ac_cv_lib_pthread_pthread_create" = xyes
5086 then :
5087 printf "%s\n" "#define HAVE_LIBPTHREAD 1" >>confdefs.h
5088
5089 LIBS="-lpthread $LIBS"
5090
5091 else $as_nop
5092 as_fn_error $? "Cannot find libpthread." "$LINENO" 5
5093 fi
5094
5095 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for forkpty in -lutil" >&5
5096 printf %s "checking for forkpty in -lutil... " >&6; }
5097 if test ${ac_cv_lib_util_forkpty+y}
5098 then :
5099 printf %s "(cached) " >&6
5100 else $as_nop
5101 ac_check_lib_save_LIBS=$LIBS
5102 LIBS="-lutil $LIBS"
5103 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5104 /* end confdefs.h. */
5105
5106 /* Override any GCC internal prototype to avoid an error.
5107 Use char because int might match the return type of a GCC
5108 builtin and then its argument prototype would still apply. */
5109 char forkpty ();
5110 int
5111 main (void)
5112 {
5113 return forkpty ();
5114 ;
5115 return 0;
5116 }
5117 _ACEOF
5118 if ac_fn_c_try_link "$LINENO"
5119 then :
5120 ac_cv_lib_util_forkpty=yes
5121 else $as_nop
5122 ac_cv_lib_util_forkpty=no
5123 fi
5124 rm -f core conftest.err conftest.$ac_objext conftest.beam \
5125 conftest$ac_exeext conftest.$ac_ext
5126 LIBS=$ac_check_lib_save_LIBS
5127 fi
5128 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_forkpty" >&5
5129 printf "%s\n" "$ac_cv_lib_util_forkpty" >&6; }
5130 if test "x$ac_cv_lib_util_forkpty" = xyes
5131 then :
5132 printf "%s\n" "#define HAVE_LIBUTIL 1" >>confdefs.h
5133
5134 LIBS="-lutil $LIBS"
5135
5136 else $as_nop
5137 as_fn_error $? "Cannot find libutil." "$LINENO" 5
5138 fi
5139
5140
5141 pkg_failed=no
5142 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libsystemd" >&5
5143 printf %s "checking for libsystemd... " >&6; }
5144
5145 if test -n "$LIBSYSTEMD_CFLAGS"; then
5146 pkg_cv_LIBSYSTEMD_CFLAGS="$LIBSYSTEMD_CFLAGS"
5147 elif test -n "$PKG_CONFIG"; then
5148 if test -n "$PKG_CONFIG" && \
5149 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5
5150 ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5
5151 ac_status=$?
5152 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
5153 test $ac_status = 0; }; then
5154 pkg_cv_LIBSYSTEMD_CFLAGS=`$PKG_CONFIG --cflags "libsystemd" 2>/dev/null`
5155 test "x$?" != "x0" && pkg_failed=yes
5156 else
5157 pkg_failed=yes
5158 fi
5159 else
5160 pkg_failed=untried
5161 fi
5162 if test -n "$LIBSYSTEMD_LIBS"; then
5163 pkg_cv_LIBSYSTEMD_LIBS="$LIBSYSTEMD_LIBS"
5164 elif test -n "$PKG_CONFIG"; then
5165 if test -n "$PKG_CONFIG" && \
5166 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsystemd\""; } >&5
5167 ($PKG_CONFIG --exists --print-errors "libsystemd") 2>&5
5168 ac_status=$?
5169 printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
5170 test $ac_status = 0; }; then
5171 pkg_cv_LIBSYSTEMD_LIBS=`$PKG_CONFIG --libs "libsystemd" 2>/dev/null`
5172 test "x$?" != "x0" && pkg_failed=yes
5173 else
5174 pkg_failed=yes
5175 fi
5176 else
5177 pkg_failed=untried
5178 fi
5179
5180
5181
5182 if test $pkg_failed = yes; then
5183 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5184 printf "%s\n" "no" >&6; }
5185
5186 if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
5187 _pkg_short_errors_supported=yes
5188 else
5189 _pkg_short_errors_supported=no
5190 fi
5191 if test $_pkg_short_errors_supported = yes; then
5192 LIBSYSTEMD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsystemd" 2>&1`
5193 else
5194 LIBSYSTEMD_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsystemd" 2>&1`
5195 fi
5196 # Put the nasty error message in config.log where it belongs
5197 echo "$LIBSYSTEMD_PKG_ERRORS" >&5
5198
5199 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libsystemd not present" >&5
5200 printf "%s\n" "libsystemd not present" >&6; }
5201 elif test $pkg_failed = untried; then
5202 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5203 printf "%s\n" "no" >&6; }
5204 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: libsystemd not present" >&5
5205 printf "%s\n" "libsystemd not present" >&6; }
5206 else
5207 LIBSYSTEMD_CFLAGS=$pkg_cv_LIBSYSTEMD_CFLAGS
5208 LIBSYSTEMD_LIBS=$pkg_cv_LIBSYSTEMD_LIBS
5209 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
5210 printf "%s\n" "yes" >&6; }
5211 printf "%s\n" "#define HAVE_SYSTEMD 1" >>confdefs.h
5212
5213 fi
5214
5215 # we assume presence of the following C standard headers
5216 # and omit them in the following header checks
5217 #
5218 # assert.h
5219 # ctype.h
5220 # errno.h
5221 # limits.h
5222 # signal.h
5223 # stdarg.h
5224 # stddef.h
5225 # stdint.h
5226 # stdio.h
5227 # stdlib.h
5228 # string.h
5229
5230 # Checks for required header files.
5231 for ac_header in arpa/inet.h fcntl.h getopt.h ifaddrs.h netdb.h net/if.h netinet/in.h netinet/tcp.h pthread.h strings.h sys/ioctl.h syslog.h sys/socket.h sys/stat.h sys/types.h sys/wait.h termios.h unistd.h
5232 do :
5233 as_ac_Header=`printf "%s\n" "ac_cv_header_$ac_header" | $as_tr_sh`
5234 ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
5235 if eval test \"x\$"$as_ac_Header"\" = x"yes"
5236 then :
5237 cat >>confdefs.h <<_ACEOF
5238 #define `printf "%s\n" "HAVE_$ac_header" | $as_tr_cpp` 1
5239 _ACEOF
5240
5241 else $as_nop
5242 as_fn_error $? "Required header not found" "$LINENO" 5
5243 fi
5244
5245 done
5246
5247 # Checks for header files with prerequisites of other headers.
5248 for ac_header in net/route.h
5249 do :
5250 ac_fn_c_check_header_compile "$LINENO" "net/route.h" "ac_cv_header_net_route_h" "#include <net/if.h>
5251 "
5252 if test "x$ac_cv_header_net_route_h" = xyes
5253 then :
5254 printf "%s\n" "#define HAVE_NET_ROUTE_H 1" >>confdefs.h
5255
5256 else $as_nop
5257 as_fn_error $? "Required header not found" "$LINENO" 5
5258 fi
5259
5260 done
5261
5262 # Checks for optional header files.
5263 ac_fn_c_check_header_compile "$LINENO" "libutil.h" "ac_cv_header_libutil_h" "$ac_includes_default"
5264 if test "x$ac_cv_header_libutil_h" = xyes
5265 then :
5266 printf "%s\n" "#define HAVE_LIBUTIL_H 1" >>confdefs.h
5267
5268 fi
5269 ac_fn_c_check_header_compile "$LINENO" "mach/mach.h" "ac_cv_header_mach_mach_h" "$ac_includes_default"
5270 if test "x$ac_cv_header_mach_mach_h" = xyes
5271 then :
5272 printf "%s\n" "#define HAVE_MACH_MACH_H 1" >>confdefs.h
5273
5274 fi
5275 ac_fn_c_check_header_compile "$LINENO" "pty.h" "ac_cv_header_pty_h" "$ac_includes_default"
5276 if test "x$ac_cv_header_pty_h" = xyes
5277 then :
5278 printf "%s\n" "#define HAVE_PTY_H 1" >>confdefs.h
5279
5280 fi
5281 ac_fn_c_check_header_compile "$LINENO" "semaphore.h" "ac_cv_header_semaphore_h" "$ac_includes_default"
5282 if test "x$ac_cv_header_semaphore_h" = xyes
5283 then :
5284 printf "%s\n" "#define HAVE_SEMAPHORE_H 1" >>confdefs.h
5285
5286 fi
5287 ac_fn_c_check_header_compile "$LINENO" "util.h" "ac_cv_header_util_h" "$ac_includes_default"
5288 if test "x$ac_cv_header_util_h" = xyes
5289 then :
5290 printf "%s\n" "#define HAVE_UTIL_H 1" >>confdefs.h
5291
5292 fi
5293
5294
5295 # Checks for optional header files with prerequisites of other headers.
5296 ac_fn_c_check_header_compile "$LINENO" "net/if_var.h" "ac_cv_header_net_if_var_h" "#include <net/if.h>
5297 "
5298 if test "x$ac_cv_header_net_if_var_h" = xyes
5299 then :
5300 printf "%s\n" "#define HAVE_NET_IF_VAR_H 1" >>confdefs.h
5301
5302 fi
5303
5304
5305 # Checks for typedefs, structures, and compiler characteristics.
5306 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
5307 printf %s "checking for an ANSI C-conforming const... " >&6; }
5308 if test ${ac_cv_c_const+y}
5309 then :
5310 printf %s "(cached) " >&6
5311 else $as_nop
5312 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5313 /* end confdefs.h. */
5314
5315 int
5316 main (void)
5317 {
5318
5319 #ifndef __cplusplus
5320 /* Ultrix mips cc rejects this sort of thing. */
5321 typedef int charset[2];
5322 const charset cs = { 0, 0 };
5323 /* SunOS 4.1.1 cc rejects this. */
5324 char const *const *pcpcc;
5325 char **ppc;
5326 /* NEC SVR4.0.2 mips cc rejects this. */
5327 struct point {int x, y;};
5328 static struct point const zero = {0,0};
5329 /* IBM XL C 1.02.0.0 rejects this.
5330 It does not let you subtract one const X* pointer from another in
5331 an arm of an if-expression whose if-part is not a constant
5332 expression */
5333 const char *g = "string";
5334 pcpcc = &g + (g ? g-g : 0);
5335 /* HPUX 7.0 cc rejects these. */
5336 ++pcpcc;
5337 ppc = (char**) pcpcc;
5338 pcpcc = (char const *const *) ppc;
5339 { /* SCO 3.2v4 cc rejects this sort of thing. */
5340 char tx;
5341 char *t = &tx;
5342 char const *s = 0 ? (char *) 0 : (char const *) 0;
5343
5344 *t++ = 0;
5345 if (s) return 0;
5346 }
5347 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
5348 int x[] = {25, 17};
5349 const int *foo = &x[0];
5350 ++foo;
5351 }
5352 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
5353 typedef const int *iptr;
5354 iptr p = 0;
5355 ++p;
5356 }
5357 { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying
5358 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
5359 struct s { int j; const int *ap[3]; } bx;
5360 struct s *b = &bx; b->j = 5;
5361 }
5362 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
5363 const int foo = 10;
5364 if (!foo) return 0;
5365 }
5366 return !cs[0] && !zero.x;
5367 #endif
5368
5369 ;
5370 return 0;
5371 }
5372 _ACEOF
5373 if ac_fn_c_try_compile "$LINENO"
5374 then :
5375 ac_cv_c_const=yes
5376 else $as_nop
5377 ac_cv_c_const=no
5378 fi
5379 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
5380 fi
5381 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
5382 printf "%s\n" "$ac_cv_c_const" >&6; }
5383 if test $ac_cv_c_const = no; then
5384
5385 printf "%s\n" "#define const /**/" >>confdefs.h
5386
5387 fi
5388
5389 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
5390 printf %s "checking for inline... " >&6; }
5391 if test ${ac_cv_c_inline+y}
5392 then :
5393 printf %s "(cached) " >&6
5394 else $as_nop
5395 ac_cv_c_inline=no
5396 for ac_kw in inline __inline__ __inline; do
5397 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5398 /* end confdefs.h. */
5399 #ifndef __cplusplus
5400 typedef int foo_t;
5401 static $ac_kw foo_t static_foo (void) {return 0; }
5402 $ac_kw foo_t foo (void) {return 0; }
5403 #endif
5404
5405 _ACEOF
5406 if ac_fn_c_try_compile "$LINENO"
5407 then :
5408 ac_cv_c_inline=$ac_kw
5409 fi
5410 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
5411 test "$ac_cv_c_inline" != no && break
5412 done
5413
5414 fi
5415 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
5416 printf "%s\n" "$ac_cv_c_inline" >&6; }
5417
5418 case $ac_cv_c_inline in
5419 inline | yes) ;;
5420 *)
5421 case $ac_cv_c_inline in
5422 no) ac_val=;;
5423 *) ac_val=$ac_cv_c_inline;;
5424 esac
5425 cat >>confdefs.h <<_ACEOF
5426 #ifndef __cplusplus
5427 #define inline $ac_val
5428 #endif
5429 _ACEOF
5430 ;;
5431 esac
5432
5433 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
5434 printf %s "checking for working volatile... " >&6; }
5435 if test ${ac_cv_c_volatile+y}
5436 then :
5437 printf %s "(cached) " >&6
5438 else $as_nop
5439 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5440 /* end confdefs.h. */
5441
5442 int
5443 main (void)
5444 {
5445
5446 volatile int x;
5447 int * volatile y = (int *) 0;
5448 return !x && !y;
5449 ;
5450 return 0;
5451 }
5452 _ACEOF
5453 if ac_fn_c_try_compile "$LINENO"
5454 then :
5455 ac_cv_c_volatile=yes
5456 else $as_nop
5457 ac_cv_c_volatile=no
5458 fi
5459 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
5460 fi
5461 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
5462 printf "%s\n" "$ac_cv_c_volatile" >&6; }
5463 if test $ac_cv_c_volatile = no; then
5464
5465 printf "%s\n" "#define volatile /**/" >>confdefs.h
5466
5467 fi
5468
5469 ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
5470 if test "x$ac_cv_type_off_t" = xyes
5471 then :
5472
5473 else $as_nop
5474
5475 printf "%s\n" "#define off_t long int" >>confdefs.h
5476
5477 fi
5478
5479
5480 ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default
5481 "
5482 if test "x$ac_cv_type_pid_t" = xyes
5483 then :
5484
5485 else $as_nop
5486 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5487 /* end confdefs.h. */
5488
5489 #if defined _WIN64 && !defined __CYGWIN__
5490 LLP64
5491 #endif
5492
5493 int
5494 main (void)
5495 {
5496
5497 ;
5498 return 0;
5499 }
5500
5501 _ACEOF
5502 if ac_fn_c_try_compile "$LINENO"
5503 then :
5504 ac_pid_type='int'
5505 else $as_nop
5506 ac_pid_type='__int64'
5507 fi
5508 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
5509
5510 printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h
5511
5512
5513 fi
5514
5515
5516 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
5517 if test "x$ac_cv_type_size_t" = xyes
5518 then :
5519
5520 else $as_nop
5521
5522 printf "%s\n" "#define size_t unsigned int" >>confdefs.h
5523
5524 fi
5525
5526 ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
5527 if test "x$ac_cv_type_ssize_t" = xyes
5528 then :
5529
5530 else $as_nop
5531
5532 printf "%s\n" "#define ssize_t int" >>confdefs.h
5533
5534 fi
5535
5536 ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
5537 case $ac_cv_c_uint16_t in #(
5538 no|yes) ;; #(
5539 *)
5540
5541
5542 printf "%s\n" "#define uint16_t $ac_cv_c_uint16_t" >>confdefs.h
5543 ;;
5544 esac
5545
5546 ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
5547 case $ac_cv_c_uint32_t in #(
5548 no|yes) ;; #(
5549 *)
5550
5551 printf "%s\n" "#define _UINT32_T 1" >>confdefs.h
5552
5553
5554 printf "%s\n" "#define uint32_t $ac_cv_c_uint32_t" >>confdefs.h
5555 ;;
5556 esac
5557
5558 ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
5559 case $ac_cv_c_uint8_t in #(
5560 no|yes) ;; #(
5561 *)
5562
5563 printf "%s\n" "#define _UINT8_T 1" >>confdefs.h
5564
5565
5566 printf "%s\n" "#define uint8_t $ac_cv_c_uint8_t" >>confdefs.h
5567 ;;
5568 esac
5569
5570 ac_fn_c_check_type "$LINENO" "struct termios" "ac_cv_type_struct_termios" "#include <termios.h>
5571 "
5572 if test "x$ac_cv_type_struct_termios" = xyes
5573 then :
5574
5575 printf "%s\n" "#define HAVE_STRUCT_TERMIOS 1" >>confdefs.h
5576
5577
5578 fi
5579
5580
5581 # Checks for library functions.
5582
5583 for ac_func in access close connect execv _exit fcntl fileno forkpty freeaddrinfo freeifaddrs gai_strerror getaddrinfo geteuid getifaddrs getopt_long htons inet_addr inet_ntoa ioctl isatty memmem ntohs open openlog pclose popen pthread_cancel pthread_cond_init pthread_cond_signal pthread_cond_wait pthread_create pthread_join pthread_mutexattr_init pthread_mutex_destroy pthread_mutex_init pthread_mutex_lock pthread_mutex_unlock pthread_self pthread_sigmask read select sem_destroy sem_init sem_post sem_wait setenv setsockopt sigaddset sigemptyset sleep socket strcasecmp strdup strncasecmp strsignal strtok_r syslog tcgetattr tcsetattr usleep vsyslog waitpid write
5584 do :
5585 as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh`
5586 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
5587 if eval test \"x\$"$as_ac_var"\" = x"yes"
5588 then :
5589 cat >>confdefs.h <<_ACEOF
5590 #define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1
5591 _ACEOF
5592
5593 else $as_nop
5594 as_fn_error $? "Required function not found" "$LINENO" 5
5595 fi
5596
5597 done
5598
5599 # Checks for optional functions.
5600 ac_fn_c_check_func "$LINENO" "pthread_mutexattr_setrobust" "ac_cv_func_pthread_mutexattr_setrobust"
5601 if test "x$ac_cv_func_pthread_mutexattr_setrobust" = xyes
5602 then :
5603 printf "%s\n" "#define HAVE_PTHREAD_MUTEXATTR_SETROBUST 1" >>confdefs.h
5604
5605 fi
5606
5607 # Use PKG_CHECK_MODULES compiler/linker flags
5608 save_openssl_CPPFLAGS="${CPPFLAGS}"
5609 save_openssl_LIBS="${LIBS}"
5610 CPPFLAGS="${OPENSSL_CFLAGS} ${CPPFLAGS}"
5611 LIBS="${OPENSSL_LIBS} ${LIBS}"
5612 ac_fn_c_check_func "$LINENO" "X509_check_host" "ac_cv_func_X509_check_host"
5613 if test "x$ac_cv_func_X509_check_host" = xyes
5614 then :
5615 printf "%s\n" "#define HAVE_X509_CHECK_HOST 1" >>confdefs.h
5616
5617 fi
5618
5619 CPPFLAGS="${save_openssl_CPPFLAGS}"
5620 LIBS="${save_openssl_LIBS}"
5621
5622 # Specialised checks for particular features.
5623 # When cross compile, don't run the tests.
5624
5625 # Check whether --with-rt_dst was given.
5626 if test ${with_rt_dst+y}
5627 then :
5628 withval=$with_rt_dst; if test "x$with_rt_dst" = "xyes"
5629 then :
5630
5631 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_RT_ENTRY_WITH_RT_DST... 1" >&5
5632 printf "%s\n" "$as_me: HAVE_RT_ENTRY_WITH_RT_DST... 1" >&6;}
5633 printf "%s\n" "#define HAVE_RT_ENTRY_WITH_RT_DST 1" >>confdefs.h
5634
5635
5636 fi
5637
5638 fi
5639
5640 if test "x$with_rt_dst" = "x"
5641 then :
5642
5643 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether rtentry is available and has rt_dst" >&5
5644 printf %s "checking whether rtentry is available and has rt_dst... " >&6; }
5645 ac_ext=c
5646 ac_cpp='$CPP $CPPFLAGS'
5647 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
5648 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
5649 ac_compiler_gnu=$ac_cv_c_compiler_gnu
5650
5651 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5652 /* end confdefs.h. */
5653
5654 #include <sys/types.h>
5655 #include <sys/socket.h>
5656 #include <net/route.h>
5657 static inline struct sockaddr_in *cast_addr(struct sockaddr *addr)
5658 {
5659 return (struct sockaddr_in *) addr;
5660 }
5661
5662 int
5663 main (void)
5664 {
5665
5666 struct rtentry route;
5667 cast_addr(&(&route)->rt_dst)->sin_family = AF_INET;
5668
5669 ;
5670 return 0;
5671 }
5672 _ACEOF
5673 if ac_fn_c_try_compile "$LINENO"
5674 then :
5675
5676 printf "%s\n" "#define HAVE_RT_ENTRY_WITH_RT_DST 1" >>confdefs.h
5677
5678 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
5679 printf "%s\n" "yes" >&6; }
5680
5681 else $as_nop
5682 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5683 printf "%s\n" "no" >&6; }
5684 fi
5685 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
5686
5687 fi
5688
5689 NETSTAT_PATH=""
5690 PPP_PATH=""
5691 RESOLVCONF_PATH=""
5692
5693 # prepare possibility to override default locations
5694
5695 # Check whether --with-netstat was given.
5696 if test ${with_netstat+y}
5697 then :
5698 withval=$with_netstat; NETSTAT_PATH="$withval"
5699
5700 fi
5701
5702 # this is for the pppd daemon executable
5703
5704 # Check whether --with-pppd was given.
5705 if test ${with_pppd+y}
5706 then :
5707 withval=$with_pppd; if test ! "x$with_pppd" = "xno" -a ! "x$with_pppd" = "xyes"
5708 then :
5709
5710 PPP_PATH="$withval"
5711 with_pppd="yes"
5712 with_ppp="no"
5713
5714 fi
5715
5716 fi
5717
5718 # and this is for the ppp user space client on FreeBSD
5719
5720 # Check whether --with-ppp was given.
5721 if test ${with_ppp+y}
5722 then :
5723 withval=$with_ppp; if test ! "x$with_ppp" = "xno" -a ! "x$with_ppp" = "xyes"
5724 then :
5725
5726 PPP_PATH="$withval"
5727 with_ppp="yes"
5728 with_pppd="no"
5729
5730 fi
5731
5732 fi
5733
5734
5735 # override for /proc/net/route detection
5736 # Check whether --enable-proc was given.
5737 if test ${enable_proc+y}
5738 then :
5739 enableval=$enable_proc;
5740 fi
5741
5742
5743 # check for netstat if not cross-compiling
5744 if test "x$enable_proc" = "x"
5745 then :
5746
5747 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /proc/net/route" >&5
5748 printf %s "checking for /proc/net/route... " >&6; }
5749 if test ${ac_cv_file__proc_net_route+y}
5750 then :
5751 printf %s "(cached) " >&6
5752 else $as_nop
5753 test "$cross_compiling" = yes &&
5754 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
5755 if test -r "/proc/net/route"; then
5756 ac_cv_file__proc_net_route=yes
5757 else
5758 ac_cv_file__proc_net_route=no
5759 fi
5760 fi
5761 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__proc_net_route" >&5
5762 printf "%s\n" "$ac_cv_file__proc_net_route" >&6; }
5763 if test "x$ac_cv_file__proc_net_route" = xyes
5764 then :
5765
5766 if test "x$enable_proc" = "x"
5767 then :
5768
5769 enable_proc="yes"
5770
5771 fi
5772
5773 else $as_nop
5774
5775 if test "x$NETSTAT_PATH" = "x"
5776 then :
5777
5778 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /usr/sbin/netstat" >&5
5779 printf %s "checking for /usr/sbin/netstat... " >&6; }
5780 if test ${ac_cv_file__usr_sbin_netstat+y}
5781 then :
5782 printf %s "(cached) " >&6
5783 else $as_nop
5784 test "$cross_compiling" = yes &&
5785 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
5786 if test -r "/usr/sbin/netstat"; then
5787 ac_cv_file__usr_sbin_netstat=yes
5788 else
5789 ac_cv_file__usr_sbin_netstat=no
5790 fi
5791 fi
5792 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_sbin_netstat" >&5
5793 printf "%s\n" "$ac_cv_file__usr_sbin_netstat" >&6; }
5794 if test "x$ac_cv_file__usr_sbin_netstat" = xyes
5795 then :
5796
5797 NETSTAT_PATH="/usr/sbin/netstat"
5798
5799 else $as_nop
5800
5801 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for /usr/bin/netstat" >&5
5802 printf %s "checking for /usr/bin/netstat... " >&6; }
5803 if test ${ac_cv_file__usr_bin_netstat+y}
5804 then :
5805 printf %s "(cached) " >&6
5806 else $as_nop
5807 test "$cross_compiling" = yes &&
5808 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
5809 if test -r "/usr/bin/netstat"; then
5810 ac_cv_file__usr_bin_netstat=yes
5811 else
5812 ac_cv_file__usr_bin_netstat=no
5813 fi
5814 fi
5815 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_bin_netstat" >&5
5816 printf "%s\n" "$ac_cv_file__usr_bin_netstat" >&6; }
5817 if test "x$ac_cv_file__usr_bin_netstat" = xyes
5818 then :
5819
5820 NETSTAT_PATH="/usr/bin/netstat"
5821
5822 fi
5823
5824
5825 fi
5826
5827
5828 fi
5829
5830 fi
5831
5832
5833 fi
5834
5835 # check for ppp if not specified
5836 # Extract the first word of "ppp", so it can be a program name with args.
5837 set dummy ppp; ac_word=$2
5838 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
5839 printf %s "checking for $ac_word... " >&6; }
5840 if test ${ac_cv_path_PPP+y}
5841 then :
5842 printf %s "(cached) " >&6
5843 else $as_nop
5844 case $PPP in
5845 [\\/]* | ?:[\\/]*)
5846 ac_cv_path_PPP="$PPP" # Let the user override the test with a path.
5847 ;;
5848 *)
5849 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5850 as_dummy=""$PATH:/sbin:/usr/sbin""
5851 for as_dir in $as_dummy
5852 do
5853 IFS=$as_save_IFS
5854 case $as_dir in #(((
5855 '') as_dir=./ ;;
5856 */) ;;
5857 *) as_dir=$as_dir/ ;;
5858 esac
5859 for ac_exec_ext in '' $ac_executable_extensions; do
5860 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
5861 ac_cv_path_PPP="$as_dir$ac_word$ac_exec_ext"
5862 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
5863 break 2
5864 fi
5865 done
5866 done
5867 IFS=$as_save_IFS
5868
5869 test -z "$ac_cv_path_PPP" && ac_cv_path_PPP="/usr/sbin/ppp"
5870 ;;
5871 esac
5872 fi
5873 PPP=$ac_cv_path_PPP
5874 if test -n "$PPP"; then
5875 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PPP" >&5
5876 printf "%s\n" "$PPP" >&6; }
5877 else
5878 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5879 printf "%s\n" "no" >&6; }
5880 fi
5881
5882
5883 if test "x$PPP_PATH" = "x"
5884 then :
5885
5886 as_ac_File=`printf "%s\n" "ac_cv_file_$PPP" | $as_tr_sh`
5887 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $PPP" >&5
5888 printf %s "checking for $PPP... " >&6; }
5889 if eval test \${$as_ac_File+y}
5890 then :
5891 printf %s "(cached) " >&6
5892 else $as_nop
5893 test "$cross_compiling" = yes &&
5894 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
5895 if test -r "$PPP"; then
5896 eval "$as_ac_File=yes"
5897 else
5898 eval "$as_ac_File=no"
5899 fi
5900 fi
5901 eval ac_res=\$$as_ac_File
5902 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
5903 printf "%s\n" "$ac_res" >&6; }
5904 if eval test \"x\$"$as_ac_File"\" = x"yes"
5905 then :
5906
5907 if test "x$PPP_PATH" = "x"
5908 then :
5909
5910 PPP_PATH="$PPP"
5911
5912 fi
5913 if test "x$with_ppp" = "x"
5914 then :
5915
5916 with_ppp="yes"
5917
5918 fi
5919
5920 fi
5921
5922
5923 fi
5924 # check for pppd if not specified
5925 # Extract the first word of "pppd", so it can be a program name with args.
5926 set dummy pppd; ac_word=$2
5927 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
5928 printf %s "checking for $ac_word... " >&6; }
5929 if test ${ac_cv_path_PPPD+y}
5930 then :
5931 printf %s "(cached) " >&6
5932 else $as_nop
5933 case $PPPD in
5934 [\\/]* | ?:[\\/]*)
5935 ac_cv_path_PPPD="$PPPD" # Let the user override the test with a path.
5936 ;;
5937 *)
5938 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
5939 as_dummy=""$PATH:/sbin:/usr/sbin""
5940 for as_dir in $as_dummy
5941 do
5942 IFS=$as_save_IFS
5943 case $as_dir in #(((
5944 '') as_dir=./ ;;
5945 */) ;;
5946 *) as_dir=$as_dir/ ;;
5947 esac
5948 for ac_exec_ext in '' $ac_executable_extensions; do
5949 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
5950 ac_cv_path_PPPD="$as_dir$ac_word$ac_exec_ext"
5951 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
5952 break 2
5953 fi
5954 done
5955 done
5956 IFS=$as_save_IFS
5957
5958 test -z "$ac_cv_path_PPPD" && ac_cv_path_PPPD="/usr/sbin/pppd"
5959 ;;
5960 esac
5961 fi
5962 PPPD=$ac_cv_path_PPPD
5963 if test -n "$PPPD"; then
5964 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PPPD" >&5
5965 printf "%s\n" "$PPPD" >&6; }
5966 else
5967 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
5968 printf "%s\n" "no" >&6; }
5969 fi
5970
5971
5972 if test "x$PPP_PATH" = "x"
5973 then :
5974
5975 as_ac_File=`printf "%s\n" "ac_cv_file_$PPPD" | $as_tr_sh`
5976 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $PPPD" >&5
5977 printf %s "checking for $PPPD... " >&6; }
5978 if eval test \${$as_ac_File+y}
5979 then :
5980 printf %s "(cached) " >&6
5981 else $as_nop
5982 test "$cross_compiling" = yes &&
5983 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
5984 if test -r "$PPPD"; then
5985 eval "$as_ac_File=yes"
5986 else
5987 eval "$as_ac_File=no"
5988 fi
5989 fi
5990 eval ac_res=\$$as_ac_File
5991 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
5992 printf "%s\n" "$ac_res" >&6; }
5993 if eval test \"x\$"$as_ac_File"\" = x"yes"
5994 then :
5995
5996 if test "x$PPP_PATH" = "x"
5997 then :
5998
5999 PPP_PATH="$PPPD"
6000
6001 fi
6002 if test "x$with_pppd" = "x"
6003 then :
6004
6005 with_pppd="yes"
6006
6007 fi
6008
6009 fi
6010
6011
6012 fi
6013 # when neither ppp nor pppd are enabled fall back to a sensible choice for the platform
6014 if test "x$with_ppp" = "x" -a "x$with_pppd" = "x"
6015 then :
6016
6017 if test "x$(uname)" = "xFreeBSD"
6018 then :
6019
6020 with_ppp="yes"
6021 PPP_PATH="/usr/sbin/ppp"
6022
6023 else $as_nop
6024
6025 with_pppd="yes"
6026 PPP_PATH="/usr/sbin/pppd"
6027
6028 fi
6029
6030 fi
6031 # when both are enabled, give pppd the higher priority (we can only use one of them)
6032 if test "x$with_ppp" = "xyes" -a "x$with_pppd" = "xyes"
6033 then :
6034
6035 with_ppp="no"
6036
6037 fi
6038 # replace empty settings with "no"
6039 if test "x$with_pppd" = "x"
6040 then :
6041
6042 with_pppd="no"
6043
6044 fi
6045 if test "x$with_ppp" = "x"
6046 then :
6047
6048 with_ppp="no"
6049
6050 fi
6051
6052 if test "x$with_ppp" = "xyes"
6053 then :
6054
6055 printf "%s\n" "#define HAVE_USR_SBIN_PPP 1" >>confdefs.h
6056
6057 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_USR_SBIN_PPP... 1" >&5
6058 printf "%s\n" "$as_me: HAVE_USR_SBIN_PPP... 1" >&6;}
6059
6060 else $as_nop
6061
6062 printf "%s\n" "#define HAVE_USR_SBIN_PPP 0" >>confdefs.h
6063
6064 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_USR_SBIN_PPP... 0" >&5
6065 printf "%s\n" "$as_me: HAVE_USR_SBIN_PPP... 0" >&6;}
6066
6067 fi
6068 if test "x$with_pppd" = "xyes"
6069 then :
6070
6071 printf "%s\n" "#define HAVE_USR_SBIN_PPPD 1" >>confdefs.h
6072
6073 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_USR_SBIN_PPPD... 1" >&5
6074 printf "%s\n" "$as_me: HAVE_USR_SBIN_PPPD... 1" >&6;}
6075
6076 else $as_nop
6077
6078 printf "%s\n" "#define HAVE_USR_SBIN_PPPD 0" >>confdefs.h
6079
6080 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_USR_SBIN_PPPD... 0" >&5
6081 printf "%s\n" "$as_me: HAVE_USR_SBIN_PPPD... 0" >&6;}
6082
6083 fi
6084 if test "x$enable_proc" = "xyes"
6085 then :
6086
6087 printf "%s\n" "#define HAVE_PROC_NET_ROUTE 1" >>confdefs.h
6088
6089 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_PROC_NET_ROUTE... 1" >&5
6090 printf "%s\n" "$as_me: HAVE_PROC_NET_ROUTE... 1" >&6;}
6091
6092 else $as_nop
6093
6094 printf "%s\n" "#define HAVE_PROC_NET_ROUTE 0" >>confdefs.h
6095
6096 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_PROC_NET_ROUTE... 0" >&5
6097 printf "%s\n" "$as_me: HAVE_PROC_NET_ROUTE... 0" >&6;}
6098
6099 fi
6100
6101
6102 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: PPP_PATH... $PPP_PATH" >&5
6103 printf "%s\n" "$as_me: PPP_PATH... $PPP_PATH" >&6;}
6104
6105
6106 if test "x$NETSTAT_PATH" != "x"
6107 then :
6108
6109 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: NETSTAT_PATH... $NETSTAT_PATH" >&5
6110 printf "%s\n" "$as_me: NETSTAT_PATH... $NETSTAT_PATH" >&6;}
6111
6112 fi
6113
6114 # use resolvconf if present
6115 # Extract the first word of "resolvconf", so it can be a program name with args.
6116 set dummy resolvconf; ac_word=$2
6117 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
6118 printf %s "checking for $ac_word... " >&6; }
6119 if test ${ac_cv_path_RESOLVCONF_PATH+y}
6120 then :
6121 printf %s "(cached) " >&6
6122 else $as_nop
6123 case $RESOLVCONF_PATH in
6124 [\\/]* | ?:[\\/]*)
6125 ac_cv_path_RESOLVCONF_PATH="$RESOLVCONF_PATH" # Let the user override the test with a path.
6126 ;;
6127 *)
6128 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6129 as_dummy=""$PATH:/sbin:/usr/sbin""
6130 for as_dir in $as_dummy
6131 do
6132 IFS=$as_save_IFS
6133 case $as_dir in #(((
6134 '') as_dir=./ ;;
6135 */) ;;
6136 *) as_dir=$as_dir/ ;;
6137 esac
6138 for ac_exec_ext in '' $ac_executable_extensions; do
6139 if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
6140 ac_cv_path_RESOLVCONF_PATH="$as_dir$ac_word$ac_exec_ext"
6141 printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
6142 break 2
6143 fi
6144 done
6145 done
6146 IFS=$as_save_IFS
6147
6148 test -z "$ac_cv_path_RESOLVCONF_PATH" && ac_cv_path_RESOLVCONF_PATH="DISABLED"
6149 ;;
6150 esac
6151 fi
6152 RESOLVCONF_PATH=$ac_cv_path_RESOLVCONF_PATH
6153 if test -n "$RESOLVCONF_PATH"; then
6154 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RESOLVCONF_PATH" >&5
6155 printf "%s\n" "$RESOLVCONF_PATH" >&6; }
6156 else
6157 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
6158 printf "%s\n" "no" >&6; }
6159 fi
6160
6161
6162
6163 # allow override at configure time
6164
6165 # Check whether --with-resolvconf was given.
6166 if test ${with_resolvconf+y}
6167 then :
6168 withval=$with_resolvconf; RESOLVCONF_PATH="$withval"
6169
6170 fi
6171
6172
6173
6174 if test "x$RESOLVCONF_PATH" != "x"
6175 then :
6176
6177 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: RESOLVCONF_PATH... $RESOLVCONF_PATH" >&5
6178 printf "%s\n" "$as_me: RESOLVCONF_PATH... $RESOLVCONF_PATH" >&6;}
6179
6180 fi
6181 if test "x$RESOLVCONF_PATH" = "xDISABLED"
6182 then :
6183
6184 printf "%s\n" "#define HAVE_RESOLVCONF 0" >>confdefs.h
6185
6186 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_RESOLVCONF... 0" >&5
6187 printf "%s\n" "$as_me: HAVE_RESOLVCONF... 0" >&6;}
6188
6189 else $as_nop
6190
6191 printf "%s\n" "#define HAVE_RESOLVCONF 1" >>confdefs.h
6192
6193 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_RESOLVCONF... 1" >&5
6194 printf "%s\n" "$as_me: HAVE_RESOLVCONF... 1" >&6;}
6195
6196 fi
6197
6198 # the default for the --use-resolvconf runtime command line option
6199 # Check whether --enable-resolvconf was given.
6200 if test ${enable_resolvconf+y}
6201 then :
6202 enableval=$enable_resolvconf;
6203 fi
6204
6205
6206 # Determine how resolvconf works at build-time if it is installed:
6207 # * openresolv supports option -l that lists active configurations and returns 0
6208 # * resolvconf in Ubuntu/Debian does not support listing but returns 99
6209 # if invoked without parameters
6210 # * skip resolvectl which does not work as expected when invoked as resolveconf
6211 if test "x$enable_resolvconf" = "x" -a "x$RESOLVCONF_PATH" != "xDISABLED"
6212 then :
6213
6214 as_ac_File=`printf "%s\n" "ac_cv_file_$RESOLVCONF_PATH" | $as_tr_sh`
6215 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $RESOLVCONF_PATH" >&5
6216 printf %s "checking for $RESOLVCONF_PATH... " >&6; }
6217 if eval test \${$as_ac_File+y}
6218 then :
6219 printf %s "(cached) " >&6
6220 else $as_nop
6221 test "$cross_compiling" = yes &&
6222 as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
6223 if test -r "$RESOLVCONF_PATH"; then
6224 eval "$as_ac_File=yes"
6225 else
6226 eval "$as_ac_File=no"
6227 fi
6228 fi
6229 eval ac_res=\$$as_ac_File
6230 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
6231 printf "%s\n" "$ac_res" >&6; }
6232 if eval test \"x\$"$as_ac_File"\" = x"yes"
6233 then :
6234
6235 if $RESOLVCONF_PATH -l >/dev/null 2>/dev/null
6236 then :
6237
6238 enable_resolvconf="yes"
6239
6240 else $as_nop
6241
6242 if $RESOLVCONF_PATH >/dev/null 2>/dev/null ; test $? -eq 99
6243 then :
6244
6245 enable_resolvconf="yes"
6246
6247 else $as_nop
6248
6249 enable_resolvconf="no"
6250
6251 fi
6252
6253 fi
6254
6255 else $as_nop
6256
6257 enable_resolvconf="no"
6258
6259 fi
6260
6261
6262 fi
6263
6264 if test "x$enable_resolvconf" = "xyes"
6265 then :
6266
6267 printf "%s\n" "#define USE_RESOLVCONF 1" >>confdefs.h
6268
6269 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: USE_RESOLVCONF... 1" >&5
6270 printf "%s\n" "$as_me: USE_RESOLVCONF... 1" >&6;}
6271
6272 else $as_nop
6273
6274 printf "%s\n" "#define USE_RESOLVCONF 0" >>confdefs.h
6275
6276 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: USE_RESOLVCONF... 0" >&5
6277 printf "%s\n" "$as_me: USE_RESOLVCONF... 0" >&6;}
6278
6279 fi
6280
6281 # install systemd service file
6282
6283 # Check whether --with-systemdsystemunitdir was given.
6284 if test ${with_systemdsystemunitdir+y}
6285 then :
6286 withval=$with_systemdsystemunitdir;
6287 else $as_nop
6288 with_systemdsystemunitdir=auto
6289 fi
6290
6291 if test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"
6292 then :
6293
6294 def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
6295
6296 if test "x$def_systemdsystemunitdir" = "x"
6297 then :
6298 if test "x$with_systemdsystemunitdir" = "xyes"
6299 then :
6300 as_fn_error $? "systemd support requested but pkg-config unable to query systemd package" "$LINENO" 5
6301 fi
6302 with_systemdsystemunitdir=no
6303 else $as_nop
6304 with_systemdsystemunitdir="$def_systemdsystemunitdir"
6305 fi
6306 fi
6307 if test "x$with_systemdsystemunitdir" != "xno"
6308 then :
6309 systemdsystemunitdir=$with_systemdsystemunitdir
6310
6311 fi
6312 if test "x$with_systemdsystemunitdir" != "xno"; then
6313 HAVE_SYSTEMD_TRUE=
6314 HAVE_SYSTEMD_FALSE='#'
6315 else
6316 HAVE_SYSTEMD_TRUE='#'
6317 HAVE_SYSTEMD_FALSE=
6318 fi
6319
6320
6321 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
6322 /* end confdefs.h. */
6323
6324 #include <sys/types.h>
6325 #include <sys/socket.h>
6326 int main(int argc, char **argv){
6327 int ret, handle;
6328 handle = socket(AF_INET, SOCK_STREAM, 0);
6329 ret = setsockopt(handle, SOL_SOCKET, SO_BINDTODEVICE,"lo",3);
6330 }
6331
6332 _ACEOF
6333 if ac_fn_c_try_compile "$LINENO"
6334 then :
6335
6336 printf "%s\n" "#define HAVE_SO_BINDTODEVICE 1" >>confdefs.h
6337
6338 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_SO_BINDTODEVICE... 1" >&5
6339 printf "%s\n" "$as_me: HAVE_SO_BINDTODEVICE... 1" >&6;}
6340
6341 else $as_nop
6342
6343 printf "%s\n" "#define HAVE_SO_BINDTODEVICE 0" >>confdefs.h
6344
6345 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: HAVE_SO_BINDTODEVICE... 0" >&5
6346 printf "%s\n" "$as_me: HAVE_SO_BINDTODEVICE... 0" >&6;}
6347
6348 fi
6349 rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
6350
6351
6352 # prepare to get rid of obsolete code (FortiOS 4)
6353 # Check whether --enable-obsolete was given.
6354 if test ${enable_obsolete+y}
6355 then :
6356 enableval=$enable_obsolete;
6357 else $as_nop
6358 enable_obsolete=no
6359 fi
6360
6361 case "$enable_obsolete" in #(
6362 yes) :
6363 ;; #(
6364 no) :
6365 ;; #(
6366 *) :
6367 as_fn_error $? "unknown option '$enable_obsolete' for --enable-obsolete" "$LINENO" 5 ;;
6368 esac
6369 if test "x$enable_obsolete" = "xyes"
6370 then :
6371 printf "%s\n" "#define SUPPORT_OBSOLETE_CODE 1" >>confdefs.h
6372
6373 fi
6374
6375
6376 ac_config_commands="$ac_config_commands timestamp"
6377
6378 ac_config_files="$ac_config_files Makefile"
6379
6380 cat >confcache <<\_ACEOF
6381 # This file is a shell script that caches the results of configure
6382 # tests run on this system so they can be shared between configure
6383 # scripts and configure runs, see configure's option --config-cache.
6384 # It is not useful on other systems. If it contains results you don't
6385 # want to keep, you may remove or edit it.
6386 #
6387 # config.status only pays attention to the cache file if you give it
6388 # the --recheck option to rerun configure.
6389 #
6390 # `ac_cv_env_foo' variables (set or unset) will be overridden when
6391 # loading this file, other *unset* `ac_cv_foo' will be assigned the
6392 # following values.
6393
6394 _ACEOF
6395
6396 # The following way of writing the cache mishandles newlines in values,
6397 # but we know of no workaround that is simple, portable, and efficient.
6398 # So, we kill variables containing newlines.
6399 # Ultrix sh set writes to stderr and can't be redirected directly,
6400 # and sets the high bit in the cache file unless we assign to the vars.
6401 (
6402 for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
6403 eval ac_val=\$$ac_var
6404 case $ac_val in #(
6405 *${as_nl}*)
6406 case $ac_var in #(
6407 *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
6408 printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
6409 esac
6410 case $ac_var in #(
6411 _ | IFS | as_nl) ;; #(
6412 BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
6413 *) { eval $ac_var=; unset $ac_var;} ;;
6414 esac ;;
6415 esac
6416 done
6417
6418 (set) 2>&1 |
6419 case $as_nl`(ac_space=' '; set) 2>&1` in #(
6420 *${as_nl}ac_space=\ *)
6421 # `set' does not quote correctly, so add quotes: double-quote
6422 # substitution turns \\\\ into \\, and sed turns \\ into \.
6423 sed -n \
6424 "s/'/'\\\\''/g;
6425 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
6426 ;; #(
6427 *)
6428 # `set' quotes correctly as required by POSIX, so do not add quotes.
6429 sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
6430 ;;
6431 esac |
6432 sort
6433 ) |
6434 sed '
6435 /^ac_cv_env_/b end
6436 t clear
6437 :clear
6438 s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/
6439 t end
6440 s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
6441 :end' >>confcache
6442 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
6443 if test -w "$cache_file"; then
6444 if test "x$cache_file" != "x/dev/null"; then
6445 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
6446 printf "%s\n" "$as_me: updating cache $cache_file" >&6;}
6447 if test ! -f "$cache_file" || test -h "$cache_file"; then
6448 cat confcache >"$cache_file"
6449 else
6450 case $cache_file in #(
6451 */* | ?:*)
6452 mv -f confcache "$cache_file"$$ &&
6453 mv -f "$cache_file"$$ "$cache_file" ;; #(
6454 *)
6455 mv -f confcache "$cache_file" ;;
6456 esac
6457 fi
6458 fi
6459 else
6460 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
6461 printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;}
6462 fi
6463 fi
6464 rm -f confcache
6465
6466 test "x$prefix" = xNONE && prefix=$ac_default_prefix
6467 # Let make expand exec_prefix.
6468 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
6469
6470 # Transform confdefs.h into DEFS.
6471 # Protect against shell expansion while executing Makefile rules.
6472 # Protect against Makefile macro expansion.
6473 #
6474 # If the first sed substitution is executed (which looks for macros that
6475 # take arguments), then branch to the quote section. Otherwise,
6476 # look for a macro that doesn't take arguments.
6477 ac_script='
6478 :mline
6479 /\\$/{
6480 N
6481 s,\\\n,,
6482 b mline
6483 }
6484 t clear
6485 :clear
6486 s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
6487 t quote
6488 s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
6489 t quote
6490 b any
6491 :quote
6492 s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
6493 s/\[/\\&/g
6494 s/\]/\\&/g
6495 s/\$/$$/g
6496 H
6497 :any
6498 ${
6499 g
6500 s/^\n//
6501 s/\n/ /g
6502 p
6503 }
6504 '
6505 DEFS=`sed -n "$ac_script" confdefs.h`
6506
6507
6508 ac_libobjs=
6509 ac_ltlibobjs=
6510 U=
6511 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
6512 # 1. Remove the extension, and $U if already installed.
6513 ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
6514 ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"`
6515 # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
6516 # will be set to the directory where LIBOBJS objects are built.
6517 as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
6518 as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
6519 done
6520 LIBOBJS=$ac_libobjs
6521
6522 LTLIBOBJS=$ac_ltlibobjs
6523
6524
6525 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
6526 printf %s "checking that generated files are newer than configure... " >&6; }
6527 if test -n "$am_sleep_pid"; then
6528 # Hide warnings about reused PIDs.
6529 wait $am_sleep_pid 2>/dev/null
6530 fi
6531 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5
6532 printf "%s\n" "done" >&6; }
6533 if test -n "$EXEEXT"; then
6534 am__EXEEXT_TRUE=
6535 am__EXEEXT_FALSE='#'
6536 else
6537 am__EXEEXT_TRUE='#'
6538 am__EXEEXT_FALSE=
6539 fi
6540
6541 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
6542 as_fn_error $? "conditional \"AMDEP\" was never defined.
6543 Usually this means the macro was only invoked conditionally." "$LINENO" 5
6544 fi
6545 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
6546 as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
6547 Usually this means the macro was only invoked conditionally." "$LINENO" 5
6548 fi
6549 if test -z "${HAVE_SYSTEMD_TRUE}" && test -z "${HAVE_SYSTEMD_FALSE}"; then
6550 as_fn_error $? "conditional \"HAVE_SYSTEMD\" was never defined.
6551 Usually this means the macro was only invoked conditionally." "$LINENO" 5
6552 fi
6553
6554 : "${CONFIG_STATUS=./config.status}"
6555 ac_write_fail=0
6556 ac_clean_files_save=$ac_clean_files
6557 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
6558 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
6559 printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;}
6560 as_write_fail=0
6561 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
6562 #! $SHELL
6563 # Generated by $as_me.
6564 # Run this file to recreate the current configuration.
6565 # Compiler output produced by configure, useful for debugging
6566 # configure, is in config.log if it exists.
6567
6568 debug=false
6569 ac_cs_recheck=false
6570 ac_cs_silent=false
6571
6572 SHELL=\${CONFIG_SHELL-$SHELL}
6573 export SHELL
6574 _ASEOF
6575 cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
6576 ## -------------------- ##
6577 ## M4sh Initialization. ##
6578 ## -------------------- ##
6579
6580 # Be more Bourne compatible
6581 DUALCASE=1; export DUALCASE # for MKS sh
6582 as_nop=:
6583 if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1
6584 then :
6585 emulate sh
6586 NULLCMD=:
6587 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
6588 # is contrary to our usage. Disable this feature.
6589 alias -g '${1+"$@"}'='"$@"'
6590 setopt NO_GLOB_SUBST
6591 else $as_nop
6592 case `(set -o) 2>/dev/null` in #(
6593 *posix*) :
6594 set -o posix ;; #(
6595 *) :
6596 ;;
6597 esac
6598 fi
6599
6600
6601
6602 # Reset variables that may have inherited troublesome values from
6603 # the environment.
6604
6605 # IFS needs to be set, to space, tab, and newline, in precisely that order.
6606 # (If _AS_PATH_WALK were called with IFS unset, it would have the
6607 # side effect of setting IFS to empty, thus disabling word splitting.)
6608 # Quoting is to prevent editors from complaining about space-tab.
6609 as_nl='
6610 '
6611 export as_nl
6612 IFS=" "" $as_nl"
6613
6614 PS1='$ '
6615 PS2='> '
6616 PS4='+ '
6617
6618 # Ensure predictable behavior from utilities with locale-dependent output.
6619 LC_ALL=C
6620 export LC_ALL
6621 LANGUAGE=C
6622 export LANGUAGE
6623
6624 # We cannot yet rely on "unset" to work, but we need these variables
6625 # to be unset--not just set to an empty or harmless value--now, to
6626 # avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct
6627 # also avoids known problems related to "unset" and subshell syntax
6628 # in other old shells (e.g. bash 2.01 and pdksh 5.2.14).
6629 for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH
6630 do eval test \${$as_var+y} \
6631 && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
6632 done
6633
6634 # Ensure that fds 0, 1, and 2 are open.
6635 if (exec 3>&0) 2>/dev/null; then :; else exec 0</dev/null; fi
6636 if (exec 3>&1) 2>/dev/null; then :; else exec 1>/dev/null; fi
6637 if (exec 3>&2) ; then :; else exec 2>/dev/null; fi
6638
6639 # The user is always right.
6640 if ${PATH_SEPARATOR+false} :; then
6641 PATH_SEPARATOR=:
6642 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
6643 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
6644 PATH_SEPARATOR=';'
6645 }
6646 fi
6647
6648
6649 # Find who we are. Look in the path if we contain no directory separator.
6650 as_myself=
6651 case $0 in #((
6652 *[\\/]* ) as_myself=$0 ;;
6653 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
6654 for as_dir in $PATH
6655 do
6656 IFS=$as_save_IFS
6657 case $as_dir in #(((
6658 '') as_dir=./ ;;
6659 */) ;;
6660 *) as_dir=$as_dir/ ;;
6661 esac
6662 test -r "$as_dir$0" && as_myself=$as_dir$0 && break
6663 done
6664 IFS=$as_save_IFS
6665
6666 ;;
6667 esac
6668 # We did not find ourselves, most probably we were run as `sh COMMAND'
6669 # in which case we are not to be found in the path.
6670 if test "x$as_myself" = x; then
6671 as_myself=$0
6672 fi
6673 if test ! -f "$as_myself"; then
6674 printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
6675 exit 1
6676 fi
6677
6678
6679
6680 # as_fn_error STATUS ERROR [LINENO LOG_FD]
6681 # ----------------------------------------
6682 # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
6683 # provided, also output the error to LOG_FD, referencing LINENO. Then exit the
6684 # script with STATUS, using 1 if that was 0.
6685 as_fn_error ()
6686 {
6687 as_status=$1; test $as_status -eq 0 && as_status=1
6688 if test "$4"; then
6689 as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
6690 printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
6691 fi
6692 printf "%s\n" "$as_me: error: $2" >&2
6693 as_fn_exit $as_status
6694 } # as_fn_error
6695
6696
6697
6698 # as_fn_set_status STATUS
6699 # -----------------------
6700 # Set $? to STATUS, without forking.
6701 as_fn_set_status ()
6702 {
6703 return $1
6704 } # as_fn_set_status
6705
6706 # as_fn_exit STATUS
6707 # -----------------
6708 # Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
6709 as_fn_exit ()
6710 {
6711 set +e
6712 as_fn_set_status $1
6713 exit $1
6714 } # as_fn_exit
6715
6716 # as_fn_unset VAR
6717 # ---------------
6718 # Portably unset VAR.
6719 as_fn_unset ()
6720 {
6721 { eval $1=; unset $1;}
6722 }
6723 as_unset=as_fn_unset
6724
6725 # as_fn_append VAR VALUE
6726 # ----------------------
6727 # Append the text in VALUE to the end of the definition contained in VAR. Take
6728 # advantage of any shell optimizations that allow amortized linear growth over
6729 # repeated appends, instead of the typical quadratic growth present in naive
6730 # implementations.
6731 if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null
6732 then :
6733 eval 'as_fn_append ()
6734 {
6735 eval $1+=\$2
6736 }'
6737 else $as_nop
6738 as_fn_append ()
6739 {
6740 eval $1=\$$1\$2
6741 }
6742 fi # as_fn_append
6743
6744 # as_fn_arith ARG...
6745 # ------------------
6746 # Perform arithmetic evaluation on the ARGs, and store the result in the
6747 # global $as_val. Take advantage of shells that can avoid forks. The arguments
6748 # must be portable across $(()) and expr.
6749 if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null
6750 then :
6751 eval 'as_fn_arith ()
6752 {
6753 as_val=$(( $* ))
6754 }'
6755 else $as_nop
6756 as_fn_arith ()
6757 {
6758 as_val=`expr "$@" || test $? -eq 1`
6759 }
6760 fi # as_fn_arith
6761
6762
6763 if expr a : '\(a\)' >/dev/null 2>&1 &&
6764 test "X`expr 00001 : '.*\(...\)'`" = X001; then
6765 as_expr=expr
6766 else
6767 as_expr=false
6768 fi
6769
6770 if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
6771 as_basename=basename
6772 else
6773 as_basename=false
6774 fi
6775
6776 if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
6777 as_dirname=dirname
6778 else
6779 as_dirname=false
6780 fi
6781
6782 as_me=`$as_basename -- "$0" ||
6783 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
6784 X"$0" : 'X\(//\)$' \| \
6785 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
6786 printf "%s\n" X/"$0" |
6787 sed '/^.*\/\([^/][^/]*\)\/*$/{
6788 s//\1/
6789 q
6790 }
6791 /^X\/\(\/\/\)$/{
6792 s//\1/
6793 q
6794 }
6795 /^X\/\(\/\).*/{
6796 s//\1/
6797 q
6798 }
6799 s/.*/./; q'`
6800
6801 # Avoid depending upon Character Ranges.
6802 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
6803 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
6804 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
6805 as_cr_digits='0123456789'
6806 as_cr_alnum=$as_cr_Letters$as_cr_digits
6807
6808
6809 # Determine whether it's possible to make 'echo' print without a newline.
6810 # These variables are no longer used directly by Autoconf, but are AC_SUBSTed
6811 # for compatibility with existing Makefiles.
6812 ECHO_C= ECHO_N= ECHO_T=
6813 case `echo -n x` in #(((((
6814 -n*)
6815 case `echo 'xy\c'` in
6816 *c*) ECHO_T=' ';; # ECHO_T is single tab character.
6817 xy) ECHO_C='\c';;
6818 *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
6819 ECHO_T=' ';;
6820 esac;;
6821 *)
6822 ECHO_N='-n';;
6823 esac
6824
6825 # For backward compatibility with old third-party macros, we provide
6826 # the shell variables $as_echo and $as_echo_n. New code should use
6827 # AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively.
6828 as_echo='printf %s\n'
6829 as_echo_n='printf %s'
6830
6831 rm -f conf$$ conf$$.exe conf$$.file
6832 if test -d conf$$.dir; then
6833 rm -f conf$$.dir/conf$$.file
6834 else
6835 rm -f conf$$.dir
6836 mkdir conf$$.dir 2>/dev/null
6837 fi
6838 if (echo >conf$$.file) 2>/dev/null; then
6839 if ln -s conf$$.file conf$$ 2>/dev/null; then
6840 as_ln_s='ln -s'
6841 # ... but there are two gotchas:
6842 # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
6843 # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
6844 # In both cases, we have to default to `cp -pR'.
6845 ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
6846 as_ln_s='cp -pR'
6847 elif ln conf$$.file conf$$ 2>/dev/null; then
6848 as_ln_s=ln
6849 else
6850 as_ln_s='cp -pR'
6851 fi
6852 else
6853 as_ln_s='cp -pR'
6854 fi
6855 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
6856 rmdir conf$$.dir 2>/dev/null
6857
6858
6859 # as_fn_mkdir_p
6860 # -------------
6861 # Create "$as_dir" as a directory, including parents if necessary.
6862 as_fn_mkdir_p ()
6863 {
6864
6865 case $as_dir in #(
6866 -*) as_dir=./$as_dir;;
6867 esac
6868 test -d "$as_dir" || eval $as_mkdir_p || {
6869 as_dirs=
6870 while :; do
6871 case $as_dir in #(
6872 *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
6873 *) as_qdir=$as_dir;;
6874 esac
6875 as_dirs="'$as_qdir' $as_dirs"
6876 as_dir=`$as_dirname -- "$as_dir" ||
6877 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
6878 X"$as_dir" : 'X\(//\)[^/]' \| \
6879 X"$as_dir" : 'X\(//\)$' \| \
6880 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
6881 printf "%s\n" X"$as_dir" |
6882 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
6883 s//\1/
6884 q
6885 }
6886 /^X\(\/\/\)[^/].*/{
6887 s//\1/
6888 q
6889 }
6890 /^X\(\/\/\)$/{
6891 s//\1/
6892 q
6893 }
6894 /^X\(\/\).*/{
6895 s//\1/
6896 q
6897 }
6898 s/.*/./; q'`
6899 test -d "$as_dir" && break
6900 done
6901 test -z "$as_dirs" || eval "mkdir $as_dirs"
6902 } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
6903
6904
6905 } # as_fn_mkdir_p
6906 if mkdir -p . 2>/dev/null; then
6907 as_mkdir_p='mkdir -p "$as_dir"'
6908 else
6909 test -d ./-p && rmdir ./-p
6910 as_mkdir_p=false
6911 fi
6912
6913
6914 # as_fn_executable_p FILE
6915 # -----------------------
6916 # Test if FILE is an executable regular file.
6917 as_fn_executable_p ()
6918 {
6919 test -f "$1" && test -x "$1"
6920 } # as_fn_executable_p
6921 as_test_x='test -x'
6922 as_executable_p=as_fn_executable_p
6923
6924 # Sed expression to map a string onto a valid CPP name.
6925 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
6926
6927 # Sed expression to map a string onto a valid variable name.
6928 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
6929
6930
6931 exec 6>&1
6932 ## ----------------------------------- ##
6933 ## Main body of $CONFIG_STATUS script. ##
6934 ## ----------------------------------- ##
6935 _ASEOF
6936 test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
6937
6938 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6939 # Save the log message, to keep $0 and so on meaningful, and to
6940 # report actual input values of CONFIG_FILES etc. instead of their
6941 # values after options handling.
6942 ac_log="
6943 This file was extended by openfortivpn $as_me 1.17.1, which was
6944 generated by GNU Autoconf 2.71. Invocation command line was
6945
6946 CONFIG_FILES = $CONFIG_FILES
6947 CONFIG_HEADERS = $CONFIG_HEADERS
6948 CONFIG_LINKS = $CONFIG_LINKS
6949 CONFIG_COMMANDS = $CONFIG_COMMANDS
6950 $ $0 $@
6951
6952 on `(hostname || uname -n) 2>/dev/null | sed 1q`
6953 "
6954
6955 _ACEOF
6956
6957 case $ac_config_files in *"
6958 "*) set x $ac_config_files; shift; ac_config_files=$*;;
6959 esac
6960
6961
6962
6963 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
6964 # Files that config.status was made for.
6965 config_files="$ac_config_files"
6966 config_commands="$ac_config_commands"
6967
6968 _ACEOF
6969
6970 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
6971 ac_cs_usage="\
6972 \`$as_me' instantiates files and other configuration actions
6973 from templates according to the current configuration. Unless the files
6974 and actions are specified as TAGs, all are instantiated by default.
6975
6976 Usage: $0 [OPTION]... [TAG]...
6977
6978 -h, --help print this help, then exit
6979 -V, --version print version number and configuration settings, then exit
6980 --config print configuration, then exit
6981 -q, --quiet, --silent
6982 do not print progress messages
6983 -d, --debug don't remove temporary files
6984 --recheck update $as_me by reconfiguring in the same conditions
6985 --file=FILE[:TEMPLATE]
6986 instantiate the configuration file FILE
6987
6988 Configuration files:
6989 $config_files
6990
6991 Configuration commands:
6992 $config_commands
6993
6994 Report bugs to the package provider."
6995
6996 _ACEOF
6997 ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`
6998 ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"`
6999 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
7000 ac_cs_config='$ac_cs_config_escaped'
7001 ac_cs_version="\\
7002 openfortivpn config.status 1.17.1
7003 configured by $0, generated by GNU Autoconf 2.71,
7004 with options \\"\$ac_cs_config\\"
7005
7006 Copyright (C) 2021 Free Software Foundation, Inc.
7007 This config.status script is free software; the Free Software Foundation
7008 gives unlimited permission to copy, distribute and modify it."
7009
7010 ac_pwd='$ac_pwd'
7011 srcdir='$srcdir'
7012 INSTALL='$INSTALL'
7013 MKDIR_P='$MKDIR_P'
7014 AWK='$AWK'
7015 test -n "\$AWK" || AWK=awk
7016 _ACEOF
7017
7018 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
7019 # The default lists apply if the user does not specify any file.
7020 ac_need_defaults=:
7021 while test $# != 0
7022 do
7023 case $1 in
7024 --*=?*)
7025 ac_option=`expr "X$1" : 'X\([^=]*\)='`
7026 ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
7027 ac_shift=:
7028 ;;
7029 --*=)
7030 ac_option=`expr "X$1" : 'X\([^=]*\)='`
7031 ac_optarg=
7032 ac_shift=:
7033 ;;
7034 *)
7035 ac_option=$1
7036 ac_optarg=$2
7037 ac_shift=shift
7038 ;;
7039 esac
7040
7041 case $ac_option in
7042 # Handling of the options.
7043 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
7044 ac_cs_recheck=: ;;
7045 --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
7046 printf "%s\n" "$ac_cs_version"; exit ;;
7047 --config | --confi | --conf | --con | --co | --c )
7048 printf "%s\n" "$ac_cs_config"; exit ;;
7049 --debug | --debu | --deb | --de | --d | -d )
7050 debug=: ;;
7051 --file | --fil | --fi | --f )
7052 $ac_shift
7053 case $ac_optarg in
7054 *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
7055 '') as_fn_error $? "missing file argument" ;;
7056 esac
7057 as_fn_append CONFIG_FILES " '$ac_optarg'"
7058 ac_need_defaults=false;;
7059 --he | --h | --help | --hel | -h )
7060 printf "%s\n" "$ac_cs_usage"; exit ;;
7061 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
7062 | -silent | --silent | --silen | --sile | --sil | --si | --s)
7063 ac_cs_silent=: ;;
7064
7065 # This is an error.
7066 -*) as_fn_error $? "unrecognized option: \`$1'
7067 Try \`$0 --help' for more information." ;;
7068
7069 *) as_fn_append ac_config_targets " $1"
7070 ac_need_defaults=false ;;
7071
7072 esac
7073 shift
7074 done
7075
7076 ac_configure_extra_args=
7077
7078 if $ac_cs_silent; then
7079 exec 6>/dev/null
7080 ac_configure_extra_args="$ac_configure_extra_args --silent"
7081 fi
7082
7083 _ACEOF
7084 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
7085 if \$ac_cs_recheck; then
7086 set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
7087 shift
7088 \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6
7089 CONFIG_SHELL='$SHELL'
7090 export CONFIG_SHELL
7091 exec "\$@"
7092 fi
7093
7094 _ACEOF
7095 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
7096 exec 5>>config.log
7097 {
7098 echo
7099 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
7100 ## Running $as_me. ##
7101 _ASBOX
7102 printf "%s\n" "$ac_log"
7103 } >&5
7104
7105 _ACEOF
7106 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
7107 #
7108 # INIT-COMMANDS
7109 #
7110 AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
7111
7112 _ACEOF
7113
7114 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
7115
7116 # Handling of arguments.
7117 for ac_config_target in $ac_config_targets
7118 do
7119 case $ac_config_target in
7120 "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
7121 "timestamp") CONFIG_COMMANDS="$CONFIG_COMMANDS timestamp" ;;
7122 "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
7123
7124 *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
7125 esac
7126 done
7127
7128
7129 # If the user did not use the arguments to specify the items to instantiate,
7130 # then the envvar interface is used. Set only those that are not.
7131 # We use the long form for the default assignment because of an extremely
7132 # bizarre bug on SunOS 4.1.3.
7133 if $ac_need_defaults; then
7134 test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files
7135 test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands
7136 fi
7137
7138 # Have a temporary directory for convenience. Make it in the build tree
7139 # simply because there is no reason against having it here, and in addition,
7140 # creating and moving files from /tmp can sometimes cause problems.
7141 # Hook for its removal unless debugging.
7142 # Note that there is a small window in which the directory will not be cleaned:
7143 # after its creation but before its name has been assigned to `$tmp'.
7144 $debug ||
7145 {
7146 tmp= ac_tmp=
7147 trap 'exit_status=$?
7148 : "${ac_tmp:=$tmp}"
7149 { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
7150 ' 0
7151 trap 'as_fn_exit 1' 1 2 13 15
7152 }
7153 # Create a (secure) tmp directory for tmp files.
7154
7155 {
7156 tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
7157 test -d "$tmp"
7158 } ||
7159 {
7160 tmp=./conf$$-$RANDOM
7161 (umask 077 && mkdir "$tmp")
7162 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
7163 ac_tmp=$tmp
7164
7165 # Set up the scripts for CONFIG_FILES section.
7166 # No need to generate them if there are no CONFIG_FILES.
7167 # This happens for instance with `./config.status config.h'.
7168 if test -n "$CONFIG_FILES"; then
7169
7170
7171 ac_cr=`echo X | tr X '\015'`
7172 # On cygwin, bash can eat \r inside `` if the user requested igncr.
7173 # But we know of no other shell where ac_cr would be empty at this
7174 # point, so we can use a bashism as a fallback.
7175 if test "x$ac_cr" = x; then
7176 eval ac_cr=\$\'\\r\'
7177 fi
7178 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
7179 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
7180 ac_cs_awk_cr='\\r'
7181 else
7182 ac_cs_awk_cr=$ac_cr
7183 fi
7184
7185 echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
7186 _ACEOF
7187
7188
7189 {
7190 echo "cat >conf$$subs.awk <<_ACEOF" &&
7191 echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
7192 echo "_ACEOF"
7193 } >conf$$subs.sh ||
7194 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
7195 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
7196 ac_delim='%!_!# '
7197 for ac_last_try in false false false false false :; do
7198 . ./conf$$subs.sh ||
7199 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
7200
7201 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
7202 if test $ac_delim_n = $ac_delim_num; then
7203 break
7204 elif $ac_last_try; then
7205 as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
7206 else
7207 ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
7208 fi
7209 done
7210 rm -f conf$$subs.sh
7211
7212 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
7213 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
7214 _ACEOF
7215 sed -n '
7216 h
7217 s/^/S["/; s/!.*/"]=/
7218 p
7219 g
7220 s/^[^!]*!//
7221 :repl
7222 t repl
7223 s/'"$ac_delim"'$//
7224 t delim
7225 :nl
7226 h
7227 s/\(.\{148\}\)..*/\1/
7228 t more1
7229 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
7230 p
7231 n
7232 b repl
7233 :more1
7234 s/["\\]/\\&/g; s/^/"/; s/$/"\\/
7235 p
7236 g
7237 s/.\{148\}//
7238 t nl
7239 :delim
7240 h
7241 s/\(.\{148\}\)..*/\1/
7242 t more2
7243 s/["\\]/\\&/g; s/^/"/; s/$/"/
7244 p
7245 b
7246 :more2
7247 s/["\\]/\\&/g; s/^/"/; s/$/"\\/
7248 p
7249 g
7250 s/.\{148\}//
7251 t delim
7252 ' <conf$$subs.awk | sed '
7253 /^[^""]/{
7254 N
7255 s/\n//
7256 }
7257 ' >>$CONFIG_STATUS || ac_write_fail=1
7258 rm -f conf$$subs.awk
7259 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
7260 _ACAWK
7261 cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
7262 for (key in S) S_is_set[key] = 1
7263 FS = ""
7264
7265 }
7266 {
7267 line = $ 0
7268 nfields = split(line, field, "@")
7269 substed = 0
7270 len = length(field[1])
7271 for (i = 2; i < nfields; i++) {
7272 key = field[i]
7273 keylen = length(key)
7274 if (S_is_set[key]) {
7275 value = S[key]
7276 line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
7277 len += length(value) + length(field[++i])
7278 substed = 1
7279 } else
7280 len += 1 + keylen
7281 }
7282
7283 print line
7284 }
7285
7286 _ACAWK
7287 _ACEOF
7288 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
7289 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
7290 sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
7291 else
7292 cat
7293 fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
7294 || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
7295 _ACEOF
7296
7297 # VPATH may cause trouble with some makes, so we remove sole $(srcdir),
7298 # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
7299 # trailing colons and then remove the whole line if VPATH becomes empty
7300 # (actually we leave an empty line to preserve line numbers).
7301 if test "x$srcdir" = x.; then
7302 ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
7303 h
7304 s///
7305 s/^/:/
7306 s/[ ]*$/:/
7307 s/:\$(srcdir):/:/g
7308 s/:\${srcdir}:/:/g
7309 s/:@srcdir@:/:/g
7310 s/^:*//
7311 s/:*$//
7312 x
7313 s/\(=[ ]*\).*/\1/
7314 G
7315 s/\n//
7316 s/^[^=]*=[ ]*$//
7317 }'
7318 fi
7319
7320 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
7321 fi # test -n "$CONFIG_FILES"
7322
7323
7324 eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS"
7325 shift
7326 for ac_tag
7327 do
7328 case $ac_tag in
7329 :[FHLC]) ac_mode=$ac_tag; continue;;
7330 esac
7331 case $ac_mode$ac_tag in
7332 :[FHL]*:*);;
7333 :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
7334 :[FH]-) ac_tag=-:-;;
7335 :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
7336 esac
7337 ac_save_IFS=$IFS
7338 IFS=:
7339 set x $ac_tag
7340 IFS=$ac_save_IFS
7341 shift
7342 ac_file=$1
7343 shift
7344
7345 case $ac_mode in
7346 :L) ac_source=$1;;
7347 :[FH])
7348 ac_file_inputs=
7349 for ac_f
7350 do
7351 case $ac_f in
7352 -) ac_f="$ac_tmp/stdin";;
7353 *) # Look for the file first in the build tree, then in the source tree
7354 # (if the path is not absolute). The absolute path cannot be DOS-style,
7355 # because $ac_f cannot contain `:'.
7356 test -f "$ac_f" ||
7357 case $ac_f in
7358 [\\/$]*) false;;
7359 *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
7360 esac ||
7361 as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
7362 esac
7363 case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
7364 as_fn_append ac_file_inputs " '$ac_f'"
7365 done
7366
7367 # Let's still pretend it is `configure' which instantiates (i.e., don't
7368 # use $as_me), people would be surprised to read:
7369 # /* config.h. Generated by config.status. */
7370 configure_input='Generated from '`
7371 printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
7372 `' by configure.'
7373 if test x"$ac_file" != x-; then
7374 configure_input="$ac_file. $configure_input"
7375 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
7376 printf "%s\n" "$as_me: creating $ac_file" >&6;}
7377 fi
7378 # Neutralize special characters interpreted by sed in replacement strings.
7379 case $configure_input in #(
7380 *\&* | *\|* | *\\* )
7381 ac_sed_conf_input=`printf "%s\n" "$configure_input" |
7382 sed 's/[\\\\&|]/\\\\&/g'`;; #(
7383 *) ac_sed_conf_input=$configure_input;;
7384 esac
7385
7386 case $ac_tag in
7387 *:-:* | *:-) cat >"$ac_tmp/stdin" \
7388 || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
7389 esac
7390 ;;
7391 esac
7392
7393 ac_dir=`$as_dirname -- "$ac_file" ||
7394 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
7395 X"$ac_file" : 'X\(//\)[^/]' \| \
7396 X"$ac_file" : 'X\(//\)$' \| \
7397 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
7398 printf "%s\n" X"$ac_file" |
7399 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
7400 s//\1/
7401 q
7402 }
7403 /^X\(\/\/\)[^/].*/{
7404 s//\1/
7405 q
7406 }
7407 /^X\(\/\/\)$/{
7408 s//\1/
7409 q
7410 }
7411 /^X\(\/\).*/{
7412 s//\1/
7413 q
7414 }
7415 s/.*/./; q'`
7416 as_dir="$ac_dir"; as_fn_mkdir_p
7417 ac_builddir=.
7418
7419 case "$ac_dir" in
7420 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
7421 *)
7422 ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'`
7423 # A ".." for each directory in $ac_dir_suffix.
7424 ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
7425 case $ac_top_builddir_sub in
7426 "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
7427 *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
7428 esac ;;
7429 esac
7430 ac_abs_top_builddir=$ac_pwd
7431 ac_abs_builddir=$ac_pwd$ac_dir_suffix
7432 # for backward compatibility:
7433 ac_top_builddir=$ac_top_build_prefix
7434
7435 case $srcdir in
7436 .) # We are building in place.
7437 ac_srcdir=.
7438 ac_top_srcdir=$ac_top_builddir_sub
7439 ac_abs_top_srcdir=$ac_pwd ;;
7440 [\\/]* | ?:[\\/]* ) # Absolute name.
7441 ac_srcdir=$srcdir$ac_dir_suffix;
7442 ac_top_srcdir=$srcdir
7443 ac_abs_top_srcdir=$srcdir ;;
7444 *) # Relative name.
7445 ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
7446 ac_top_srcdir=$ac_top_build_prefix$srcdir
7447 ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
7448 esac
7449 ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
7450
7451
7452 case $ac_mode in
7453 :F)
7454 #
7455 # CONFIG_FILE
7456 #
7457
7458 case $INSTALL in
7459 [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
7460 *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
7461 esac
7462 ac_MKDIR_P=$MKDIR_P
7463 case $MKDIR_P in
7464 [\\/$]* | ?:[\\/]* ) ;;
7465 */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
7466 esac
7467 _ACEOF
7468
7469 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
7470 # If the template does not know about datarootdir, expand it.
7471 # FIXME: This hack should be removed a few years after 2.60.
7472 ac_datarootdir_hack=; ac_datarootdir_seen=
7473 ac_sed_dataroot='
7474 /datarootdir/ {
7475 p
7476 q
7477 }
7478 /@datadir@/p
7479 /@docdir@/p
7480 /@infodir@/p
7481 /@localedir@/p
7482 /@mandir@/p'
7483 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
7484 *datarootdir*) ac_datarootdir_seen=yes;;
7485 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
7486 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
7487 printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
7488 _ACEOF
7489 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
7490 ac_datarootdir_hack='
7491 s&@datadir@&$datadir&g
7492 s&@docdir@&$docdir&g
7493 s&@infodir@&$infodir&g
7494 s&@localedir@&$localedir&g
7495 s&@mandir@&$mandir&g
7496 s&\\\${datarootdir}&$datarootdir&g' ;;
7497 esac
7498 _ACEOF
7499
7500 # Neutralize VPATH when `$srcdir' = `.'.
7501 # Shell code in configure.ac might set extrasub.
7502 # FIXME: do we really want to maintain this feature?
7503 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
7504 ac_sed_extra="$ac_vpsub
7505 $extrasub
7506 _ACEOF
7507 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
7508 :t
7509 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
7510 s|@configure_input@|$ac_sed_conf_input|;t t
7511 s&@top_builddir@&$ac_top_builddir_sub&;t t
7512 s&@top_build_prefix@&$ac_top_build_prefix&;t t
7513 s&@srcdir@&$ac_srcdir&;t t
7514 s&@abs_srcdir@&$ac_abs_srcdir&;t t
7515 s&@top_srcdir@&$ac_top_srcdir&;t t
7516 s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
7517 s&@builddir@&$ac_builddir&;t t
7518 s&@abs_builddir@&$ac_abs_builddir&;t t
7519 s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
7520 s&@INSTALL@&$ac_INSTALL&;t t
7521 s&@MKDIR_P@&$ac_MKDIR_P&;t t
7522 $ac_datarootdir_hack
7523 "
7524 eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
7525 >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
7526
7527 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
7528 { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
7529 { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
7530 "$ac_tmp/out"`; test -z "$ac_out"; } &&
7531 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
7532 which seems to be undefined. Please make sure it is defined" >&5
7533 printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
7534 which seems to be undefined. Please make sure it is defined" >&2;}
7535
7536 rm -f "$ac_tmp/stdin"
7537 case $ac_file in
7538 -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
7539 *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
7540 esac \
7541 || as_fn_error $? "could not create $ac_file" "$LINENO" 5
7542 ;;
7543
7544
7545 :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
7546 printf "%s\n" "$as_me: executing $ac_file commands" >&6;}
7547 ;;
7548 esac
7549
7550
7551 case $ac_file$ac_mode in
7552 "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
7553 # Older Autoconf quotes --file arguments for eval, but not when files
7554 # are listed without --file. Let's play safe and only enable the eval
7555 # if we detect the quoting.
7556 # TODO: see whether this extra hack can be removed once we start
7557 # requiring Autoconf 2.70 or later.
7558 case $CONFIG_FILES in #(
7559 *\'*) :
7560 eval set x "$CONFIG_FILES" ;; #(
7561 *) :
7562 set x $CONFIG_FILES ;; #(
7563 *) :
7564 ;;
7565 esac
7566 shift
7567 # Used to flag and report bootstrapping failures.
7568 am_rc=0
7569 for am_mf
7570 do
7571 # Strip MF so we end up with the name of the file.
7572 am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'`
7573 # Check whether this is an Automake generated Makefile which includes
7574 # dependency-tracking related rules and includes.
7575 # Grep'ing the whole file directly is not great: AIX grep has a line
7576 # limit of 2048, but all sed's we know have understand at least 4000.
7577 sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
7578 || continue
7579 am_dirpart=`$as_dirname -- "$am_mf" ||
7580 $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
7581 X"$am_mf" : 'X\(//\)[^/]' \| \
7582 X"$am_mf" : 'X\(//\)$' \| \
7583 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
7584 printf "%s\n" X"$am_mf" |
7585 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
7586 s//\1/
7587 q
7588 }
7589 /^X\(\/\/\)[^/].*/{
7590 s//\1/
7591 q
7592 }
7593 /^X\(\/\/\)$/{
7594 s//\1/
7595 q
7596 }
7597 /^X\(\/\).*/{
7598 s//\1/
7599 q
7600 }
7601 s/.*/./; q'`
7602 am_filepart=`$as_basename -- "$am_mf" ||
7603 $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
7604 X"$am_mf" : 'X\(//\)$' \| \
7605 X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
7606 printf "%s\n" X/"$am_mf" |
7607 sed '/^.*\/\([^/][^/]*\)\/*$/{
7608 s//\1/
7609 q
7610 }
7611 /^X\/\(\/\/\)$/{
7612 s//\1/
7613 q
7614 }
7615 /^X\/\(\/\).*/{
7616 s//\1/
7617 q
7618 }
7619 s/.*/./; q'`
7620 { echo "$as_me:$LINENO: cd "$am_dirpart" \
7621 && sed -e '/# am--include-marker/d' "$am_filepart" \
7622 | $MAKE -f - am--depfiles" >&5
7623 (cd "$am_dirpart" \
7624 && sed -e '/# am--include-marker/d' "$am_filepart" \
7625 | $MAKE -f - am--depfiles) >&5 2>&5
7626 ac_status=$?
7627 echo "$as_me:$LINENO: \$? = $ac_status" >&5
7628 (exit $ac_status); } || am_rc=$?
7629 done
7630 if test $am_rc -ne 0; then
7631 { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
7632 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
7633 as_fn_error $? "Something went wrong bootstrapping makefile fragments
7634 for automatic dependency tracking. If GNU make was not used, consider
7635 re-running the configure script with MAKE=\"gmake\" (or whatever is
7636 necessary). You can also try re-running configure with the
7637 '--disable-dependency-tracking' option to at least be able to build
7638 the package (albeit without support for automatic dependency tracking).
7639 See \`config.log' for more details" "$LINENO" 5; }
7640 fi
7641 { am_dirpart=; unset am_dirpart;}
7642 { am_filepart=; unset am_filepart;}
7643 { am_mf=; unset am_mf;}
7644 { am_rc=; unset am_rc;}
7645 rm -f conftest-deps.mk
7646 }
7647 ;;
7648 "timestamp":C) touch src/.dirstamp ;;
7649
7650 esac
7651 done # for ac_tag
7652
7653
7654 as_fn_exit 0
7655 _ACEOF
7656 ac_clean_files=$ac_clean_files_save
7657
7658 test $ac_write_fail = 0 ||
7659 as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
7660
7661
7662 # configure is writing to config.log, and then calls config.status.
7663 # config.status does its own redirection, appending to config.log.
7664 # Unfortunately, on DOS this fails, as config.log is still kept open
7665 # by configure, so config.status won't be able to write to it; its
7666 # output is simply discarded. So we exec the FD to /dev/null,
7667 # effectively closing config.log, so it can be properly (re)opened and
7668 # appended to by config.status. When coming back to configure, we
7669 # need to make the FD available again.
7670 if test "$no_create" != yes; then
7671 ac_cs_success=:
7672 ac_config_status_args=
7673 test "$silent" = yes &&
7674 ac_config_status_args="$ac_config_status_args --quiet"
7675 exec 5>/dev/null
7676 $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
7677 exec 5>>config.log
7678 # Use ||, not &&, to avoid exiting from the if with $? = 1, which
7679 # would make configure fail if this is the last instruction.
7680 $ac_cs_success || as_fn_exit 1
7681 fi
7682 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
7683 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
7684 printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
7685 fi
7686
7687
11 # Process this file with autoconf to produce a configure script.
22
33 AC_PREREQ([2.63])
4 AC_INIT([openfortivpn], [1.17.0])
4 AC_INIT([openfortivpn], [1.17.1])
55 AC_CONFIG_SRCDIR([src/main.c])
66 AM_INIT_AUTOMAKE([foreign subdir-objects])
77
371371 AS_HELP_STRING([--enable-resolvconf],
372372 [Enable usage of resolvconf at runtime by default. \
373373 Use --disable-resolvconf for the opposite, note that \
374 resolvconf support will still be compliled in, but \
374 resolvconf support will still be compilled in, but \
375375 disabled if not explicitly enabled at runtime.]))
376376
377377 # Determine how resolvconf works at build-time if it is installed:
0 openfortivpn (1.17.1-1) UNRELEASED; urgency=low
1
2 * New upstream release.
3
4 -- Debian Janitor <janitor@jelmer.uk> Wed, 22 Sep 2021 10:22:03 -0000
5
06 openfortivpn (1.17.0-1) unstable; urgency=medium
17
28 * New upstream release.
0 #! /bin/sh
1 # depcomp - compile a program generating dependencies as side-effects
2
3 scriptversion=2018-03-07.03; # UTC
4
5 # Copyright (C) 1999-2021 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
20 # As a special exception to the GNU General Public License, if you
21 # distribute this file as part of a program that contains a
22 # configuration script generated by Autoconf, you may include it under
23 # the same distribution terms that you use for the rest of that program.
24
25 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
26
27 case $1 in
28 '')
29 echo "$0: No command. Try '$0 --help' for more information." 1>&2
30 exit 1;
31 ;;
32 -h | --h*)
33 cat <<\EOF
34 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
35
36 Run PROGRAMS ARGS to compile a file, generating dependencies
37 as side-effects.
38
39 Environment variables:
40 depmode Dependency tracking mode.
41 source Source file read by 'PROGRAMS ARGS'.
42 object Object file output by 'PROGRAMS ARGS'.
43 DEPDIR directory where to store dependencies.
44 depfile Dependency file to output.
45 tmpdepfile Temporary file to use when outputting dependencies.
46 libtool Whether libtool is used (yes/no).
47
48 Report bugs to <bug-automake@gnu.org>.
49 EOF
50 exit $?
51 ;;
52 -v | --v*)
53 echo "depcomp $scriptversion"
54 exit $?
55 ;;
56 esac
57
58 # Get the directory component of the given path, and save it in the
59 # global variables '$dir'. Note that this directory component will
60 # be either empty or ending with a '/' character. This is deliberate.
61 set_dir_from ()
62 {
63 case $1 in
64 */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
65 *) dir=;;
66 esac
67 }
68
69 # Get the suffix-stripped basename of the given path, and save it the
70 # global variable '$base'.
71 set_base_from ()
72 {
73 base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
74 }
75
76 # If no dependency file was actually created by the compiler invocation,
77 # we still have to create a dummy depfile, to avoid errors with the
78 # Makefile "include basename.Plo" scheme.
79 make_dummy_depfile ()
80 {
81 echo "#dummy" > "$depfile"
82 }
83
84 # Factor out some common post-processing of the generated depfile.
85 # Requires the auxiliary global variable '$tmpdepfile' to be set.
86 aix_post_process_depfile ()
87 {
88 # If the compiler actually managed to produce a dependency file,
89 # post-process it.
90 if test -f "$tmpdepfile"; then
91 # Each line is of the form 'foo.o: dependency.h'.
92 # Do two passes, one to just change these to
93 # $object: dependency.h
94 # and one to simply output
95 # dependency.h:
96 # which is needed to avoid the deleted-header problem.
97 { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
98 sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
99 } > "$depfile"
100 rm -f "$tmpdepfile"
101 else
102 make_dummy_depfile
103 fi
104 }
105
106 # A tabulation character.
107 tab=' '
108 # A newline character.
109 nl='
110 '
111 # Character ranges might be problematic outside the C locale.
112 # These definitions help.
113 upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
114 lower=abcdefghijklmnopqrstuvwxyz
115 digits=0123456789
116 alpha=${upper}${lower}
117
118 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
119 echo "depcomp: Variables source, object and depmode must be set" 1>&2
120 exit 1
121 fi
122
123 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
124 depfile=${depfile-`echo "$object" |
125 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
126 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
127
128 rm -f "$tmpdepfile"
129
130 # Avoid interferences from the environment.
131 gccflag= dashmflag=
132
133 # Some modes work just like other modes, but use different flags. We
134 # parameterize here, but still list the modes in the big case below,
135 # to make depend.m4 easier to write. Note that we *cannot* use a case
136 # here, because this file can only contain one case statement.
137 if test "$depmode" = hp; then
138 # HP compiler uses -M and no extra arg.
139 gccflag=-M
140 depmode=gcc
141 fi
142
143 if test "$depmode" = dashXmstdout; then
144 # This is just like dashmstdout with a different argument.
145 dashmflag=-xM
146 depmode=dashmstdout
147 fi
148
149 cygpath_u="cygpath -u -f -"
150 if test "$depmode" = msvcmsys; then
151 # This is just like msvisualcpp but w/o cygpath translation.
152 # Just convert the backslash-escaped backslashes to single forward
153 # slashes to satisfy depend.m4
154 cygpath_u='sed s,\\\\,/,g'
155 depmode=msvisualcpp
156 fi
157
158 if test "$depmode" = msvc7msys; then
159 # This is just like msvc7 but w/o cygpath translation.
160 # Just convert the backslash-escaped backslashes to single forward
161 # slashes to satisfy depend.m4
162 cygpath_u='sed s,\\\\,/,g'
163 depmode=msvc7
164 fi
165
166 if test "$depmode" = xlc; then
167 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
168 gccflag=-qmakedep=gcc,-MF
169 depmode=gcc
170 fi
171
172 case "$depmode" in
173 gcc3)
174 ## gcc 3 implements dependency tracking that does exactly what
175 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
176 ## it if -MD -MP comes after the -MF stuff. Hmm.
177 ## Unfortunately, FreeBSD c89 acceptance of flags depends upon
178 ## the command line argument order; so add the flags where they
179 ## appear in depend2.am. Note that the slowdown incurred here
180 ## affects only configure: in makefiles, %FASTDEP% shortcuts this.
181 for arg
182 do
183 case $arg in
184 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
185 *) set fnord "$@" "$arg" ;;
186 esac
187 shift # fnord
188 shift # $arg
189 done
190 "$@"
191 stat=$?
192 if test $stat -ne 0; then
193 rm -f "$tmpdepfile"
194 exit $stat
195 fi
196 mv "$tmpdepfile" "$depfile"
197 ;;
198
199 gcc)
200 ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
201 ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
202 ## (see the conditional assignment to $gccflag above).
203 ## There are various ways to get dependency output from gcc. Here's
204 ## why we pick this rather obscure method:
205 ## - Don't want to use -MD because we'd like the dependencies to end
206 ## up in a subdir. Having to rename by hand is ugly.
207 ## (We might end up doing this anyway to support other compilers.)
208 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
209 ## -MM, not -M (despite what the docs say). Also, it might not be
210 ## supported by the other compilers which use the 'gcc' depmode.
211 ## - Using -M directly means running the compiler twice (even worse
212 ## than renaming).
213 if test -z "$gccflag"; then
214 gccflag=-MD,
215 fi
216 "$@" -Wp,"$gccflag$tmpdepfile"
217 stat=$?
218 if test $stat -ne 0; then
219 rm -f "$tmpdepfile"
220 exit $stat
221 fi
222 rm -f "$depfile"
223 echo "$object : \\" > "$depfile"
224 # The second -e expression handles DOS-style file names with drive
225 # letters.
226 sed -e 's/^[^:]*: / /' \
227 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
228 ## This next piece of magic avoids the "deleted header file" problem.
229 ## The problem is that when a header file which appears in a .P file
230 ## is deleted, the dependency causes make to die (because there is
231 ## typically no way to rebuild the header). We avoid this by adding
232 ## dummy dependencies for each header file. Too bad gcc doesn't do
233 ## this for us directly.
234 ## Some versions of gcc put a space before the ':'. On the theory
235 ## that the space means something, we add a space to the output as
236 ## well. hp depmode also adds that space, but also prefixes the VPATH
237 ## to the object. Take care to not repeat it in the output.
238 ## Some versions of the HPUX 10.20 sed can't process this invocation
239 ## correctly. Breaking it into two sed invocations is a workaround.
240 tr ' ' "$nl" < "$tmpdepfile" \
241 | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
242 | sed -e 's/$/ :/' >> "$depfile"
243 rm -f "$tmpdepfile"
244 ;;
245
246 hp)
247 # This case exists only to let depend.m4 do its work. It works by
248 # looking at the text of this script. This case will never be run,
249 # since it is checked for above.
250 exit 1
251 ;;
252
253 sgi)
254 if test "$libtool" = yes; then
255 "$@" "-Wp,-MDupdate,$tmpdepfile"
256 else
257 "$@" -MDupdate "$tmpdepfile"
258 fi
259 stat=$?
260 if test $stat -ne 0; then
261 rm -f "$tmpdepfile"
262 exit $stat
263 fi
264 rm -f "$depfile"
265
266 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
267 echo "$object : \\" > "$depfile"
268 # Clip off the initial element (the dependent). Don't try to be
269 # clever and replace this with sed code, as IRIX sed won't handle
270 # lines with more than a fixed number of characters (4096 in
271 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
272 # the IRIX cc adds comments like '#:fec' to the end of the
273 # dependency line.
274 tr ' ' "$nl" < "$tmpdepfile" \
275 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
276 | tr "$nl" ' ' >> "$depfile"
277 echo >> "$depfile"
278 # The second pass generates a dummy entry for each header file.
279 tr ' ' "$nl" < "$tmpdepfile" \
280 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
281 >> "$depfile"
282 else
283 make_dummy_depfile
284 fi
285 rm -f "$tmpdepfile"
286 ;;
287
288 xlc)
289 # This case exists only to let depend.m4 do its work. It works by
290 # looking at the text of this script. This case will never be run,
291 # since it is checked for above.
292 exit 1
293 ;;
294
295 aix)
296 # The C for AIX Compiler uses -M and outputs the dependencies
297 # in a .u file. In older versions, this file always lives in the
298 # current directory. Also, the AIX compiler puts '$object:' at the
299 # start of each line; $object doesn't have directory information.
300 # Version 6 uses the directory in both cases.
301 set_dir_from "$object"
302 set_base_from "$object"
303 if test "$libtool" = yes; then
304 tmpdepfile1=$dir$base.u
305 tmpdepfile2=$base.u
306 tmpdepfile3=$dir.libs/$base.u
307 "$@" -Wc,-M
308 else
309 tmpdepfile1=$dir$base.u
310 tmpdepfile2=$dir$base.u
311 tmpdepfile3=$dir$base.u
312 "$@" -M
313 fi
314 stat=$?
315 if test $stat -ne 0; then
316 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
317 exit $stat
318 fi
319
320 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
321 do
322 test -f "$tmpdepfile" && break
323 done
324 aix_post_process_depfile
325 ;;
326
327 tcc)
328 # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
329 # FIXME: That version still under development at the moment of writing.
330 # Make that this statement remains true also for stable, released
331 # versions.
332 # It will wrap lines (doesn't matter whether long or short) with a
333 # trailing '\', as in:
334 #
335 # foo.o : \
336 # foo.c \
337 # foo.h \
338 #
339 # It will put a trailing '\' even on the last line, and will use leading
340 # spaces rather than leading tabs (at least since its commit 0394caf7
341 # "Emit spaces for -MD").
342 "$@" -MD -MF "$tmpdepfile"
343 stat=$?
344 if test $stat -ne 0; then
345 rm -f "$tmpdepfile"
346 exit $stat
347 fi
348 rm -f "$depfile"
349 # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
350 # We have to change lines of the first kind to '$object: \'.
351 sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
352 # And for each line of the second kind, we have to emit a 'dep.h:'
353 # dummy dependency, to avoid the deleted-header problem.
354 sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
355 rm -f "$tmpdepfile"
356 ;;
357
358 ## The order of this option in the case statement is important, since the
359 ## shell code in configure will try each of these formats in the order
360 ## listed in this file. A plain '-MD' option would be understood by many
361 ## compilers, so we must ensure this comes after the gcc and icc options.
362 pgcc)
363 # Portland's C compiler understands '-MD'.
364 # Will always output deps to 'file.d' where file is the root name of the
365 # source file under compilation, even if file resides in a subdirectory.
366 # The object file name does not affect the name of the '.d' file.
367 # pgcc 10.2 will output
368 # foo.o: sub/foo.c sub/foo.h
369 # and will wrap long lines using '\' :
370 # foo.o: sub/foo.c ... \
371 # sub/foo.h ... \
372 # ...
373 set_dir_from "$object"
374 # Use the source, not the object, to determine the base name, since
375 # that's sadly what pgcc will do too.
376 set_base_from "$source"
377 tmpdepfile=$base.d
378
379 # For projects that build the same source file twice into different object
380 # files, the pgcc approach of using the *source* file root name can cause
381 # problems in parallel builds. Use a locking strategy to avoid stomping on
382 # the same $tmpdepfile.
383 lockdir=$base.d-lock
384 trap "
385 echo '$0: caught signal, cleaning up...' >&2
386 rmdir '$lockdir'
387 exit 1
388 " 1 2 13 15
389 numtries=100
390 i=$numtries
391 while test $i -gt 0; do
392 # mkdir is a portable test-and-set.
393 if mkdir "$lockdir" 2>/dev/null; then
394 # This process acquired the lock.
395 "$@" -MD
396 stat=$?
397 # Release the lock.
398 rmdir "$lockdir"
399 break
400 else
401 # If the lock is being held by a different process, wait
402 # until the winning process is done or we timeout.
403 while test -d "$lockdir" && test $i -gt 0; do
404 sleep 1
405 i=`expr $i - 1`
406 done
407 fi
408 i=`expr $i - 1`
409 done
410 trap - 1 2 13 15
411 if test $i -le 0; then
412 echo "$0: failed to acquire lock after $numtries attempts" >&2
413 echo "$0: check lockdir '$lockdir'" >&2
414 exit 1
415 fi
416
417 if test $stat -ne 0; then
418 rm -f "$tmpdepfile"
419 exit $stat
420 fi
421 rm -f "$depfile"
422 # Each line is of the form `foo.o: dependent.h',
423 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
424 # Do two passes, one to just change these to
425 # `$object: dependent.h' and one to simply `dependent.h:'.
426 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
427 # Some versions of the HPUX 10.20 sed can't process this invocation
428 # correctly. Breaking it into two sed invocations is a workaround.
429 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
430 | sed -e 's/$/ :/' >> "$depfile"
431 rm -f "$tmpdepfile"
432 ;;
433
434 hp2)
435 # The "hp" stanza above does not work with aCC (C++) and HP's ia64
436 # compilers, which have integrated preprocessors. The correct option
437 # to use with these is +Maked; it writes dependencies to a file named
438 # 'foo.d', which lands next to the object file, wherever that
439 # happens to be.
440 # Much of this is similar to the tru64 case; see comments there.
441 set_dir_from "$object"
442 set_base_from "$object"
443 if test "$libtool" = yes; then
444 tmpdepfile1=$dir$base.d
445 tmpdepfile2=$dir.libs/$base.d
446 "$@" -Wc,+Maked
447 else
448 tmpdepfile1=$dir$base.d
449 tmpdepfile2=$dir$base.d
450 "$@" +Maked
451 fi
452 stat=$?
453 if test $stat -ne 0; then
454 rm -f "$tmpdepfile1" "$tmpdepfile2"
455 exit $stat
456 fi
457
458 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
459 do
460 test -f "$tmpdepfile" && break
461 done
462 if test -f "$tmpdepfile"; then
463 sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
464 # Add 'dependent.h:' lines.
465 sed -ne '2,${
466 s/^ *//
467 s/ \\*$//
468 s/$/:/
469 p
470 }' "$tmpdepfile" >> "$depfile"
471 else
472 make_dummy_depfile
473 fi
474 rm -f "$tmpdepfile" "$tmpdepfile2"
475 ;;
476
477 tru64)
478 # The Tru64 compiler uses -MD to generate dependencies as a side
479 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
480 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
481 # dependencies in 'foo.d' instead, so we check for that too.
482 # Subdirectories are respected.
483 set_dir_from "$object"
484 set_base_from "$object"
485
486 if test "$libtool" = yes; then
487 # Libtool generates 2 separate objects for the 2 libraries. These
488 # two compilations output dependencies in $dir.libs/$base.o.d and
489 # in $dir$base.o.d. We have to check for both files, because
490 # one of the two compilations can be disabled. We should prefer
491 # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
492 # automatically cleaned when .libs/ is deleted, while ignoring
493 # the former would cause a distcleancheck panic.
494 tmpdepfile1=$dir$base.o.d # libtool 1.5
495 tmpdepfile2=$dir.libs/$base.o.d # Likewise.
496 tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
497 "$@" -Wc,-MD
498 else
499 tmpdepfile1=$dir$base.d
500 tmpdepfile2=$dir$base.d
501 tmpdepfile3=$dir$base.d
502 "$@" -MD
503 fi
504
505 stat=$?
506 if test $stat -ne 0; then
507 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
508 exit $stat
509 fi
510
511 for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
512 do
513 test -f "$tmpdepfile" && break
514 done
515 # Same post-processing that is required for AIX mode.
516 aix_post_process_depfile
517 ;;
518
519 msvc7)
520 if test "$libtool" = yes; then
521 showIncludes=-Wc,-showIncludes
522 else
523 showIncludes=-showIncludes
524 fi
525 "$@" $showIncludes > "$tmpdepfile"
526 stat=$?
527 grep -v '^Note: including file: ' "$tmpdepfile"
528 if test $stat -ne 0; then
529 rm -f "$tmpdepfile"
530 exit $stat
531 fi
532 rm -f "$depfile"
533 echo "$object : \\" > "$depfile"
534 # The first sed program below extracts the file names and escapes
535 # backslashes for cygpath. The second sed program outputs the file
536 # name when reading, but also accumulates all include files in the
537 # hold buffer in order to output them again at the end. This only
538 # works with sed implementations that can handle large buffers.
539 sed < "$tmpdepfile" -n '
540 /^Note: including file: *\(.*\)/ {
541 s//\1/
542 s/\\/\\\\/g
543 p
544 }' | $cygpath_u | sort -u | sed -n '
545 s/ /\\ /g
546 s/\(.*\)/'"$tab"'\1 \\/p
547 s/.\(.*\) \\/\1:/
548 H
549 $ {
550 s/.*/'"$tab"'/
551 G
552 p
553 }' >> "$depfile"
554 echo >> "$depfile" # make sure the fragment doesn't end with a backslash
555 rm -f "$tmpdepfile"
556 ;;
557
558 msvc7msys)
559 # This case exists only to let depend.m4 do its work. It works by
560 # looking at the text of this script. This case will never be run,
561 # since it is checked for above.
562 exit 1
563 ;;
564
565 #nosideeffect)
566 # This comment above is used by automake to tell side-effect
567 # dependency tracking mechanisms from slower ones.
568
569 dashmstdout)
570 # Important note: in order to support this mode, a compiler *must*
571 # always write the preprocessed file to stdout, regardless of -o.
572 "$@" || exit $?
573
574 # Remove the call to Libtool.
575 if test "$libtool" = yes; then
576 while test "X$1" != 'X--mode=compile'; do
577 shift
578 done
579 shift
580 fi
581
582 # Remove '-o $object'.
583 IFS=" "
584 for arg
585 do
586 case $arg in
587 -o)
588 shift
589 ;;
590 $object)
591 shift
592 ;;
593 *)
594 set fnord "$@" "$arg"
595 shift # fnord
596 shift # $arg
597 ;;
598 esac
599 done
600
601 test -z "$dashmflag" && dashmflag=-M
602 # Require at least two characters before searching for ':'
603 # in the target name. This is to cope with DOS-style filenames:
604 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
605 "$@" $dashmflag |
606 sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
607 rm -f "$depfile"
608 cat < "$tmpdepfile" > "$depfile"
609 # Some versions of the HPUX 10.20 sed can't process this sed invocation
610 # correctly. Breaking it into two sed invocations is a workaround.
611 tr ' ' "$nl" < "$tmpdepfile" \
612 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
613 | sed -e 's/$/ :/' >> "$depfile"
614 rm -f "$tmpdepfile"
615 ;;
616
617 dashXmstdout)
618 # This case only exists to satisfy depend.m4. It is never actually
619 # run, as this mode is specially recognized in the preamble.
620 exit 1
621 ;;
622
623 makedepend)
624 "$@" || exit $?
625 # Remove any Libtool call
626 if test "$libtool" = yes; then
627 while test "X$1" != 'X--mode=compile'; do
628 shift
629 done
630 shift
631 fi
632 # X makedepend
633 shift
634 cleared=no eat=no
635 for arg
636 do
637 case $cleared in
638 no)
639 set ""; shift
640 cleared=yes ;;
641 esac
642 if test $eat = yes; then
643 eat=no
644 continue
645 fi
646 case "$arg" in
647 -D*|-I*)
648 set fnord "$@" "$arg"; shift ;;
649 # Strip any option that makedepend may not understand. Remove
650 # the object too, otherwise makedepend will parse it as a source file.
651 -arch)
652 eat=yes ;;
653 -*|$object)
654 ;;
655 *)
656 set fnord "$@" "$arg"; shift ;;
657 esac
658 done
659 obj_suffix=`echo "$object" | sed 's/^.*\././'`
660 touch "$tmpdepfile"
661 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
662 rm -f "$depfile"
663 # makedepend may prepend the VPATH from the source file name to the object.
664 # No need to regex-escape $object, excess matching of '.' is harmless.
665 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
666 # Some versions of the HPUX 10.20 sed can't process the last invocation
667 # correctly. Breaking it into two sed invocations is a workaround.
668 sed '1,2d' "$tmpdepfile" \
669 | tr ' ' "$nl" \
670 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
671 | sed -e 's/$/ :/' >> "$depfile"
672 rm -f "$tmpdepfile" "$tmpdepfile".bak
673 ;;
674
675 cpp)
676 # Important note: in order to support this mode, a compiler *must*
677 # always write the preprocessed file to stdout.
678 "$@" || exit $?
679
680 # Remove the call to Libtool.
681 if test "$libtool" = yes; then
682 while test "X$1" != 'X--mode=compile'; do
683 shift
684 done
685 shift
686 fi
687
688 # Remove '-o $object'.
689 IFS=" "
690 for arg
691 do
692 case $arg in
693 -o)
694 shift
695 ;;
696 $object)
697 shift
698 ;;
699 *)
700 set fnord "$@" "$arg"
701 shift # fnord
702 shift # $arg
703 ;;
704 esac
705 done
706
707 "$@" -E \
708 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
709 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
710 | sed '$ s: \\$::' > "$tmpdepfile"
711 rm -f "$depfile"
712 echo "$object : \\" > "$depfile"
713 cat < "$tmpdepfile" >> "$depfile"
714 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
715 rm -f "$tmpdepfile"
716 ;;
717
718 msvisualcpp)
719 # Important note: in order to support this mode, a compiler *must*
720 # always write the preprocessed file to stdout.
721 "$@" || exit $?
722
723 # Remove the call to Libtool.
724 if test "$libtool" = yes; then
725 while test "X$1" != 'X--mode=compile'; do
726 shift
727 done
728 shift
729 fi
730
731 IFS=" "
732 for arg
733 do
734 case "$arg" in
735 -o)
736 shift
737 ;;
738 $object)
739 shift
740 ;;
741 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
742 set fnord "$@"
743 shift
744 shift
745 ;;
746 *)
747 set fnord "$@" "$arg"
748 shift
749 shift
750 ;;
751 esac
752 done
753 "$@" -E 2>/dev/null |
754 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
755 rm -f "$depfile"
756 echo "$object : \\" > "$depfile"
757 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
758 echo "$tab" >> "$depfile"
759 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
760 rm -f "$tmpdepfile"
761 ;;
762
763 msvcmsys)
764 # This case exists only to let depend.m4 do its work. It works by
765 # looking at the text of this script. This case will never be run,
766 # since it is checked for above.
767 exit 1
768 ;;
769
770 none)
771 exec "$@"
772 ;;
773
774 *)
775 echo "Unknown depmode $depmode" 1>&2
776 exit 1
777 ;;
778 esac
779
780 exit 0
781
782 # Local Variables:
783 # mode: shell-script
784 # sh-indentation: 2
785 # eval: (add-hook 'before-save-hook 'time-stamp)
786 # time-stamp-start: "scriptversion="
787 # time-stamp-format: "%:y-%02m-%02d.%02H"
788 # time-stamp-time-zone: "UTC0"
789 # time-stamp-end: "; # UTC"
790 # End:
0 .TH OPENFORTIVPN 1 "May 4, 2020" ""
1
2 .SH NAME
3 openfortivpn \- Client for PPP+SSL VPN tunnel services
4
5 .SH SYNOPSIS
6 .B openfortivpn
7 [\fI<host>\fR[:\fI<port>\fR]]
8 [\fB\-u\fR \fI<user>\fR]
9 [\fB\-p\fR \fI<pass>\fR]
10 [\fB\-\-pinentry=\fI<name>\fR]
11 [\fB\-\-otp=\fI<otp>\fR]
12 [\fB\-\-otp\-prompt=\fI<prompt>\fR]
13 [\fB\-\-otp\-delay=\fI<delay>\fR]
14 [\fB\-\-no\-ftm\-push\fR]
15 [\fB\-\-realm=\fI<realm>\fR]
16 [\fB\-\-ifname=\fI<interface>\fR]
17 [\fB\-\-set\-routes=<bool>\fR]
18 [\fB\-\-no\-routes\fR]
19 [\fB\-\-set\-dns=<bool>\fR]
20 [\fB\-\-no\-dns\fR]
21 [\fB\-\-half\-internet\-routes=<bool>\fR]
22 [\fB\-\-ca\-file=\fI<file>\fR]
23 [\fB\-\-user\-cert=\fI<file>\fR]
24 [\fB\-\-user-cert=\fIpkcs11:\fR]
25 [\fB\-\-user\-key=\fI<file>\fR]
26 [\fB\-\-use\-syslog\fR]
27 [\fB\-\-trusted\-cert=\fI<digest>\fR]
28 [\fB\-\-insecure\-ssl\fR]
29 [\fB\-\-cipher\-list=\fI<ciphers>\fR]
30 [\fB\-\-min\-tls=\fI<version>\fR]
31 [\fB\-\-seclevel\-1\fR]
32 [\fB\-\-pppd\-use\-peerdns=<bool>\fR]
33 [\fB\-\-pppd\-no\-peerdns\fR]
34 [\fB\-\-pppd\-log=\fI<file>\fR]
35 [\fB\-\-pppd\-plugin=\fI<file>\fR]
36 [\fB\-\-pppd\-ipparam=\fI<string>\fR]
37 [\fB\-\-pppd\-ifname=\fI<string>\fR]
38 [\fB\-\-pppd\-call=\fI<name>\fR]
39 [\fB\-\-ppp\-system=\fI<string>\fR]
40 [\fB\-\-use\-resolvconf=\fI<bool>\fR]
41 [\fB\-\-persistent=\fI<interval>\fR]
42 [\fB\-c\fR \fI<file>\fR]
43 [\fB\-v|\-q\fR]
44 .br
45 .B openfortivpn
46 \-\-help
47 .br
48 .B openfortivpn
49 \-\-version
50
51 .SH DESCRIPTION
52 .B openfortivpn
53 connects to a VPN by setting up a tunnel to the gateway at
54 \fI<host>\fR:\fI<port>\fR.
55
56 .SH OPTIONS
57 .TP
58 \fB\-\-help\fR
59 Show the help message and exit.
60 .TP
61 \fB\-\-version\fR
62 Show version and exit.
63 .TP
64 \fB\-c \fI<file>\fR, \fB\-\-config=\fI<file>\fR
65 Specify a custom configuration file (default: /usr/local/etc/openfortivpn/config).
66 .TP
67 \fB\-u \fI<user>\fR, \fB\-\-username=\fI<user>\fR
68 VPN account username.
69 .TP
70 \fB\-p \fI<pass>\fR, \fB\-\-password=\fI<pass>\fR
71 VPN account password in plain text.
72 For a secure alternative, use pinentry or let openfortivpn prompt for the password.
73 .TP
74 \fB\-\-pinentry=\fI<name>\fR
75 The pinentry program to use. Allows supplying the password in a secure manner.
76 For example: pinentry-gnome3 on Linux, or pinentry-mac on macOS.
77 .TP
78 \fB\-o \fI<otp>\fR, \fB\-\-otp=\fI<otp>\fR
79 One-Time-Password.
80 .TP
81 \fB\-\-otp\-prompt=\fI<prompt>\fR
82 Search for the OTP password prompt starting with the string \fI<prompt>\fR.
83 .TP
84 \fB\-\-otp\-delay\=\fI<delay>\fR
85 Set the amount of time to wait before sending the One-Time-Password.
86 The delay time must be specified in seconds, where 0 means
87 no wait (this is the default).
88 .TP
89 \fB\-\-no\-ftm\-push\fR
90 Do not use FTM push if the server provides the option.
91 The server may be configured to allow two factor authentication through a
92 push notification to the mobile application. If this option is provided,
93 authentication based on OTP will be used instead.
94 .TP
95 \fB\-\-realm=\fI<realm>\fR
96 Connect to the specified authentication realm. Defaults to empty, which
97 is usually what you want.
98 .TP
99 \fB\-\-ifname=\fI<interface>\fR
100 Bind the connection to the specified network interface.
101 .TP
102 \fB\-\-set\-routes=\fI<bool>\fR, \fB\-\-no-routes\fR
103 Set if openfortivpn should try to configure IP routes through the VPN when
104 tunnel is up. If used multiple times, the last one takes priority.
105
106 \fB\-\-no\-routes\fR is the same as \fB\-\-set-routes=\fI0\fR.
107 .TP
108 \fB\-\-half\-internet\-routes=\fI<bool>\fR
109 Set if openfortivpn should add two 0.0.0.0/1 and 128.0.0.0/1 routes with
110 higher priority instead of replacing the default route.
111 .TP
112 \fB\-\-set\-dns=\fI<bool>\fR, \fB\-\-no\-dns\fR
113 Set if openfortivpn should add DNS name servers in /etc/resolv.conf when
114 tunnel is up. Also a dns\-suffix may be received from the peer and added
115 to /etc/resolv.conf in the turn of adding the name servers.
116 resolvconf is instructed to do the update of the resolv.conf file
117 if it is installed and \-\-use\-resolvconf is activated, otherwise openfortivpn
118 prepends its changes to the existing content of the resolv.conf file.
119 Note that there may be other mechanisms to update /etc/resolv.conf,
120 e.g., \fB\-\-pppd\-use\-peerdns\fR in conjunction with an ip-up-script,
121 which may require that openfortivpn is called with \fB\-\-no\-dns\fR.
122 \fB\-\-no\-dns\fR is the same as \fB\-\-set\-dns=\fI0\fR.
123 .TP
124 \fB\-\-use\-resolvconf=\fI<bool>\fR
125 Set if openfortivpn should use resolvconf to add DNS name servers
126 in /etc/resolv.conf. If it is set to false, the builtin fallback
127 mechanism is used even if resolvconf is available.
128 .TP
129 \fB\-\-ca\-file=\fI<file>\fR
130 Use specified PEM-encoded certificate bundle instead of system-wide store to
131 verify the gateway certificate.
132 .TP
133 \fB\-\-user\-cert=\fI<file>\fR
134 Use specified PEM-encoded certificate if the server requires authentication
135 with a certificate.
136 .TP
137 \fB\-\-user-cert=\fIpkcs11:\fR
138 Use at least the string pkcs11: for using a smartcard. It takes the full
139 or a partial PKCS11-URI (p11tool --list-token-urls)
140
141 --user-cert = pkcs11:
142
143 --user-cert = pkcs11:token=someuser
144
145 --user-cert = pkcs11:model=PKCS%2315%20emulated;manufacturer=piv_II;serial=012345678;token=someuser
146
147 \fBThis feature requires the OpenSSL PKCS engine!
148 .TP
149 \fB\-\-user\-key=\fI<file>\fR
150 Use specified PEM-encoded key if the server requires authentication with
151 a certificate.
152 .TP
153 \fB\-\-pem-passphrase=\fI<pass>\fR
154 Pass phrase for the PEM-encoded key.
155 .TP
156 \fB\-\-use\-syslog\fR
157 Log to syslog instead of terminal.
158 .TP
159 \fB\-\-trusted\-cert=\fI<digest>\fR
160 Trust a given gateway. If classical SSL certificate validation fails, the
161 gateway certificate will be matched against this value. \fI<digest>\fR is the
162 X509 certificate's sha256 sum. The certificate has to be encoded in DER form.
163 This option can be used multiple times to trust several certificates.
164 .TP
165 \fB\-\-insecure\-ssl\fR
166 Do not disable insecure SSL protocols/ciphers.
167 If your server requires a specific cipher, consider using \fB\-\-cipher\-list\fR
168 instead.
169 .TP
170 \fB\-\-cipher\-list=\fI<ciphers>\fR
171 OpenSSL ciphers to use. If default does not work, you can try alternatives
172 such as HIGH:!MD5:!RC4 or as suggested by the Cipher: line in the output of
173 \fBopenssl\fP(1) (e.g. AES256-GCM-SHA384):
174
175 $ openssl s_client -connect \fI<host:port>\fR
176
177 (default: HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4)
178
179 \fBApplies to TLS v1.2 or lower only, not to be used with TLS v1.3 ciphers.\fR
180 .TP
181 \fB\-\-min\-tls=\fI<version>\fR
182 Use minimum TLS version instead of system default. Valid values are 1.0,
183 1.1, 1.2, 1.3.
184 .TP
185 \fB\-\-seclevel\-1\fR
186 If \fB\-\-cipher-list\fR is not specified, add @SECLEVEL=1 to the list of
187 ciphers. This lowers limits on dh key.
188
189 \fBApplies to TLS v1.2 or lower only.\fR
190 .TP
191 \fB\-\-use\-peer\-dns=\fI<bool>\fR, \fB\-\-pppd\-no\-peerdns\fR
192 Whether to ask peer ppp server for DNS server addresses and let pppd
193 rewrite /etc/resolv.conf. There is no mechanism to tell the dns\-suffix
194 to pppd. If the DNS server addresses are requested,
195 also \fB\-\-set\-dns=\fI1\fR may race with the mechanisms in pppd.
196
197 \fB\-\-pppd\-no\-peerdns\fR is the same as \fB\-\-pppd\-use\-peerdns=\fI0\fR.
198 .TP
199 \fB\-\-pppd\-log=\fI<file>\fR
200 Set pppd in debug mode and save its logs into \fI<file>\fR.
201 .TP
202 \fB\-\-pppd\-plugin=\fI<file>\fR
203 Use specified pppd plugin instead of configuring the resolver and routes
204 directly.
205 .TP
206 \fB\-\-pppd\-ipparam=\fI<string>\fR
207 Provides an extra parameter to the ip\-up, ip\-pre\-up and ip\-down scripts. See man
208 .BR pppd(8)
209 for further details
210 .TP
211 \fB\-\-pppd\-ifname=\fI<string>\fR
212 Set the ppp interface name. Only if supported by pppd. Patched versions of pppd
213 implement this option but may not be available on your platform.
214 .TP
215 \fB\-\-pppd\-call=\fI<name>\fR
216 Drop usual arguments from pppd command line and add `call <name>' instead.
217 This can be useful on Debian and Ubuntu, where unprivileged users in
218 group `dip' can invoke `pppd call <name>' to make pppd read and apply
219 options from /etc/ppp/peers/<name> (including privileged ones).
220 .TP
221 \fB\-\-ppp\-system=\fI<string>\fR
222 Only available if compiled for ppp user space client (e.g. on FreeBSD).
223 Connect to the specified system as defined in /etc/ppp/ppp.conf
224 .TP
225 \fB\-\-persistent\=\fI<interval>\fR
226 Run the VPN persistently in an endless loop and try to reconnect forever.
227 The reconnect interval may be specified in seconds, where 0 means
228 no reconnect is done (this is the default).
229 .TP
230 \fB\-v\fR
231 Increase verbosity. Can be used multiple times to be even more verbose.
232 .TP
233 \fB\-q\fR
234 Decrease verbosity. Can be used multiple times to be even less verbose.
235
236 .SH ENVIRONMENT and proxy support
237 .B openfortivpn
238 can be run behind an HTTP proxy that supports the HTTP connect command.
239 It checks if one of the environment variables
240 .B https_proxy HTTPS_PROXY all_proxy ALL_PROXY
241 is set which are supposed to contain a string of the format
242 .br
243 .B http://[host]:[port]
244 .br
245 where
246 .B [host]
247 is the ip or the fully qualified host name of the proxy server
248 .B [port]
249 is the TCP port number where the proxy is listening for
250 incoming connections. If one of these variables is defined,
251 .B openfortivpn
252 tries to first establish a TCP connection to this proxy (plain HTTP, not encrypted),
253 and then makes a request to connect to the VPN host as given on the command line
254 or in the configuration file. The proxy is supposed to forward any subsequent packets
255 transparently to the VPN host, so that the TLS layer of the connection effectively
256 is established between the client and the VPN host, and the proxy just acts as a
257 forwarding instance on the lower level of the TCP connection.
258
259 The following environment variables are set by
260 .B openfortivpn
261 and
262 .BR pppd(8)
263 or its scripts can obtain information this way:
264 .br
265 VPN_GATEWAY the ip of the gateway host
266 .br
267 and for each route three variables are set up, where an integer number
268 is appended to the variable names, denoting the number of the current route:
269 .br
270 VPN_ROUTE_DEST_... the destination network of the route
271 .br
272 VPN_ROUTE_MASK_... the network mask for this route
273 .br
274 VPN_ROUTE_GATEWAY_... the gateway for the current route entry
275
276 If not compiled for pppd the pppd options and features that rely on them are not
277 available. On FreeBSD \fB\-\-ppp\-system\fR is available instead.
278
279 .SH CONFIGURATION
280 Options can be taken from a configuration file. Options passed in the command
281 line will override those from the configuration file, though. The default
282 configuration file is /usr/local/etc/openfortivpn/config, but this can be set
283 using the \fB\-c\fR option.
284 An empty template for the configuration file is installed to
285 /usr/local/share/openfortivpn/config.template
286
287 .TP
288 A configuration file looks like:
289 # this is a comment
290 .br
291 host = vpn\-gateway
292 .br
293 port = 443
294 .br
295 username = foo
296 .br
297 # Password in plain text.
298 .br
299 # For a secure alternative, use pinentry or let openfortivpn prompt for the password.
300 .br
301 # password = bar
302 .br
303 # The pinentry program to use. Allows supplying the password in a secure manner.
304 .br
305 # pinentry = pinentry-mac
306 .br
307 # realm = some-realm
308 .br
309 # useful for a gui that passes a configuration file to openfortivpn
310 .br
311 # otp = 123456
312 .br
313 # otp\-delay = 0
314 .br
315 # otp\-prompt = Please
316 .br
317 # This would disable FTM push notification support, and use OTP instead
318 .br
319 # no\-ftm\-push = 1
320 .br
321 user\-cert = /usr/local/etc/openfortivpn/user\-cert.pem
322 .br
323 # user\-cert = pkcs1: # use smartcard as client certificate
324 .br
325 user\-key = /usr/local/etc/openfortivpn/user\-key.pem
326 .br
327 pem\-passphrase = baz
328 .br
329 # the sha256 digest of the trusted host certs obtained by
330 .br
331 # openssl dgst -sha256 server\-cert.crt:
332 .br
333 trusted\-cert = certificatedigest4daa8c5fe6c...
334 .br
335 trusted\-cert = othercertificatedigest6631bf...
336 .br
337 # This would specify a ca bundle instead of system-wide store
338 .br
339 # ca\-file = /usr/local/etc/openfortivpn/ca\-bundle.pem
340 .br
341 set\-dns = 0
342 .br
343 use\-resolvconf = 1
344 .br
345 set\-routes = 1
346 .br
347 half\-internet\-routes = 0
348 .br
349 pppd\-use\-peerdns = 1
350 .br
351 # alternatively, use a specific pppd plugin instead
352 .br
353 # pppd\-plugin = /usr/lib/pppd/default/some\-plugin.so
354 .br
355 # for debugging pppd write logs here
356 .br
357 # pppd\-log = /var/log/pppd.log
358 .br
359 # pass ppp interface name to pppd (if supported by a patched pppd)
360 .br
361 # pppd\-ifname = ppp1
362 .br
363 # pass an ipparam string to pppd, e.g. the device name (a similar use case)
364 .br
365 # pppd\-ipparam = 'device=$DEVICE'
366 .br
367 # instruct pppd to call a script instead of passing arguments (if pppd supports it)
368 .br
369 # pppd\-call = script
370 .br
371 # use\-syslog = 0
372 .br
373 insecure\-ssl = 0
374 .br
375 cipher\-list = HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4
376 .br
377 persistent = 0
378 .br
379 seclevel-1 = 0
380
381 .SH SEE ALSO
382
383 The \fBopenfortivpn\fR home page
384 (\fIhttps://github.com/adrienverge/openfortivpn\fR)
385 provides a short introduction in the \fBREADME\fR file and additional
386 information under the \fBWiki\fR tab.
+0
-11
etc/ppp/ip-down.local.example less more
0 #!/bin/bash
1
2 case "$PPP_IPPARAM" in
3 openfortivpn*)
4 rconf=/etc/resolv.conf
5 [[ -f $rconf.openfortivpn ]] && cp -pv $rconf.openfortivpn $rconf
6 exit 0
7 ;;
8 esac 2>&1 | logger -p daemon.debug -i -t "$0"
9
10 true
+0
-22
etc/ppp/ip-up.local.example less more
0 #!/bin/bash
1
2 case "$PPP_IPPARAM" in
3 openfortivpn*)
4 rconf=/etc/resolv.conf
5 routes=$(echo $PPP_IPPARAM | tr , ' ')
6 for r in $routes; do
7 [[ $r = "openfortivpn" ]] && continue
8 com="ip route add ${r%/*} via ${r##*/}"
9 echo $com
10 $com
11 done
12 cp -pv $rconf $rconf.openfortivpn
13 if [[ "$DNS1" ]]; then
14 echo nameserver $DNS1 > $rconf
15 [[ "$DNS2" ]] && [[ "$DNS1" != "$DNS2" ]] && echo nameserver $DNS2 >> $rconf
16 fi
17 exit 0
18 ;;
19 esac 2>&1 | logger -p daemon.debug -i -t "$0"
20
21 true
+0
-12
etc/ppp/peers/openfortivpn less more
0 38400
1 :192.0.2.1
2 noipdefault
3 noaccomp
4 noauth
5 default-asyncmap
6 nopcomp
7 receive-all
8 nodefaultroute
9 nodetach
10 lcp-max-configure 40
11 mru 1354
+0
-12
etc/ppp/ppp.conf.example less more
0 # Example configuration for a ppp client
1 # for more examples see
2 # https://github.com/freebsd/freebsd-base-graphics/blob/master/share/examples/ppp/ppp.conf.sample
3
4 vpn-client:
5 set dial
6 set speed 38400
7 set mru 1354
8 set login
9 set timeout 0
10 disable deflate pred1
11 deny deflate pred1
0 #!/bin/sh
1 # install - install a program, script, or datafile
2
3 scriptversion=2020-11-14.01; # UTC
4
5 # This originates from X11R5 (mit/util/scripts/install.sh), which was
6 # later released in X11R6 (xc/config/util/install.sh) with the
7 # following copyright and license.
8 #
9 # Copyright (C) 1994 X Consortium
10 #
11 # Permission is hereby granted, free of charge, to any person obtaining a copy
12 # of this software and associated documentation files (the "Software"), to
13 # deal in the Software without restriction, including without limitation the
14 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15 # sell copies of the Software, and to permit persons to whom the Software is
16 # furnished to do so, subject to the following conditions:
17 #
18 # The above copyright notice and this permission notice shall be included in
19 # all copies or substantial portions of the Software.
20 #
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
25 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
26 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #
28 # Except as contained in this notice, the name of the X Consortium shall not
29 # be used in advertising or otherwise to promote the sale, use or other deal-
30 # ings in this Software without prior written authorization from the X Consor-
31 # tium.
32 #
33 #
34 # FSF changes to this file are in the public domain.
35 #
36 # Calling this script install-sh is preferred over install.sh, to prevent
37 # 'make' implicit rules from creating a file called install from it
38 # when there is no Makefile.
39 #
40 # This script is compatible with the BSD install script, but was written
41 # from scratch.
42
43 tab=' '
44 nl='
45 '
46 IFS=" $tab$nl"
47
48 # Set DOITPROG to "echo" to test this script.
49
50 doit=${DOITPROG-}
51 doit_exec=${doit:-exec}
52
53 # Put in absolute file names if you don't have them in your path;
54 # or use environment vars.
55
56 chgrpprog=${CHGRPPROG-chgrp}
57 chmodprog=${CHMODPROG-chmod}
58 chownprog=${CHOWNPROG-chown}
59 cmpprog=${CMPPROG-cmp}
60 cpprog=${CPPROG-cp}
61 mkdirprog=${MKDIRPROG-mkdir}
62 mvprog=${MVPROG-mv}
63 rmprog=${RMPROG-rm}
64 stripprog=${STRIPPROG-strip}
65
66 posix_mkdir=
67
68 # Desired mode of installed file.
69 mode=0755
70
71 # Create dirs (including intermediate dirs) using mode 755.
72 # This is like GNU 'install' as of coreutils 8.32 (2020).
73 mkdir_umask=22
74
75 backupsuffix=
76 chgrpcmd=
77 chmodcmd=$chmodprog
78 chowncmd=
79 mvcmd=$mvprog
80 rmcmd="$rmprog -f"
81 stripcmd=
82
83 src=
84 dst=
85 dir_arg=
86 dst_arg=
87
88 copy_on_change=false
89 is_target_a_directory=possibly
90
91 usage="\
92 Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
93 or: $0 [OPTION]... SRCFILES... DIRECTORY
94 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
95 or: $0 [OPTION]... -d DIRECTORIES...
96
97 In the 1st form, copy SRCFILE to DSTFILE.
98 In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
99 In the 4th, create DIRECTORIES.
100
101 Options:
102 --help display this help and exit.
103 --version display version info and exit.
104
105 -c (ignored)
106 -C install only if different (preserve data modification time)
107 -d create directories instead of installing files.
108 -g GROUP $chgrpprog installed files to GROUP.
109 -m MODE $chmodprog installed files to MODE.
110 -o USER $chownprog installed files to USER.
111 -p pass -p to $cpprog.
112 -s $stripprog installed files.
113 -S SUFFIX attempt to back up existing files, with suffix SUFFIX.
114 -t DIRECTORY install into DIRECTORY.
115 -T report an error if DSTFILE is a directory.
116
117 Environment variables override the default commands:
118 CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
119 RMPROG STRIPPROG
120
121 By default, rm is invoked with -f; when overridden with RMPROG,
122 it's up to you to specify -f if you want it.
123
124 If -S is not specified, no backups are attempted.
125
126 Email bug reports to bug-automake@gnu.org.
127 Automake home page: https://www.gnu.org/software/automake/
128 "
129
130 while test $# -ne 0; do
131 case $1 in
132 -c) ;;
133
134 -C) copy_on_change=true;;
135
136 -d) dir_arg=true;;
137
138 -g) chgrpcmd="$chgrpprog $2"
139 shift;;
140
141 --help) echo "$usage"; exit $?;;
142
143 -m) mode=$2
144 case $mode in
145 *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
146 echo "$0: invalid mode: $mode" >&2
147 exit 1;;
148 esac
149 shift;;
150
151 -o) chowncmd="$chownprog $2"
152 shift;;
153
154 -p) cpprog="$cpprog -p";;
155
156 -s) stripcmd=$stripprog;;
157
158 -S) backupsuffix="$2"
159 shift;;
160
161 -t)
162 is_target_a_directory=always
163 dst_arg=$2
164 # Protect names problematic for 'test' and other utilities.
165 case $dst_arg in
166 -* | [=\(\)!]) dst_arg=./$dst_arg;;
167 esac
168 shift;;
169
170 -T) is_target_a_directory=never;;
171
172 --version) echo "$0 $scriptversion"; exit $?;;
173
174 --) shift
175 break;;
176
177 -*) echo "$0: invalid option: $1" >&2
178 exit 1;;
179
180 *) break;;
181 esac
182 shift
183 done
184
185 # We allow the use of options -d and -T together, by making -d
186 # take the precedence; this is for compatibility with GNU install.
187
188 if test -n "$dir_arg"; then
189 if test -n "$dst_arg"; then
190 echo "$0: target directory not allowed when installing a directory." >&2
191 exit 1
192 fi
193 fi
194
195 if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
196 # When -d is used, all remaining arguments are directories to create.
197 # When -t is used, the destination is already specified.
198 # Otherwise, the last argument is the destination. Remove it from $@.
199 for arg
200 do
201 if test -n "$dst_arg"; then
202 # $@ is not empty: it contains at least $arg.
203 set fnord "$@" "$dst_arg"
204 shift # fnord
205 fi
206 shift # arg
207 dst_arg=$arg
208 # Protect names problematic for 'test' and other utilities.
209 case $dst_arg in
210 -* | [=\(\)!]) dst_arg=./$dst_arg;;
211 esac
212 done
213 fi
214
215 if test $# -eq 0; then
216 if test -z "$dir_arg"; then
217 echo "$0: no input file specified." >&2
218 exit 1
219 fi
220 # It's OK to call 'install-sh -d' without argument.
221 # This can happen when creating conditional directories.
222 exit 0
223 fi
224
225 if test -z "$dir_arg"; then
226 if test $# -gt 1 || test "$is_target_a_directory" = always; then
227 if test ! -d "$dst_arg"; then
228 echo "$0: $dst_arg: Is not a directory." >&2
229 exit 1
230 fi
231 fi
232 fi
233
234 if test -z "$dir_arg"; then
235 do_exit='(exit $ret); exit $ret'
236 trap "ret=129; $do_exit" 1
237 trap "ret=130; $do_exit" 2
238 trap "ret=141; $do_exit" 13
239 trap "ret=143; $do_exit" 15
240
241 # Set umask so as not to create temps with too-generous modes.
242 # However, 'strip' requires both read and write access to temps.
243 case $mode in
244 # Optimize common cases.
245 *644) cp_umask=133;;
246 *755) cp_umask=22;;
247
248 *[0-7])
249 if test -z "$stripcmd"; then
250 u_plus_rw=
251 else
252 u_plus_rw='% 200'
253 fi
254 cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
255 *)
256 if test -z "$stripcmd"; then
257 u_plus_rw=
258 else
259 u_plus_rw=,u+rw
260 fi
261 cp_umask=$mode$u_plus_rw;;
262 esac
263 fi
264
265 for src
266 do
267 # Protect names problematic for 'test' and other utilities.
268 case $src in
269 -* | [=\(\)!]) src=./$src;;
270 esac
271
272 if test -n "$dir_arg"; then
273 dst=$src
274 dstdir=$dst
275 test -d "$dstdir"
276 dstdir_status=$?
277 # Don't chown directories that already exist.
278 if test $dstdir_status = 0; then
279 chowncmd=""
280 fi
281 else
282
283 # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
284 # might cause directories to be created, which would be especially bad
285 # if $src (and thus $dsttmp) contains '*'.
286 if test ! -f "$src" && test ! -d "$src"; then
287 echo "$0: $src does not exist." >&2
288 exit 1
289 fi
290
291 if test -z "$dst_arg"; then
292 echo "$0: no destination specified." >&2
293 exit 1
294 fi
295 dst=$dst_arg
296
297 # If destination is a directory, append the input filename.
298 if test -d "$dst"; then
299 if test "$is_target_a_directory" = never; then
300 echo "$0: $dst_arg: Is a directory" >&2
301 exit 1
302 fi
303 dstdir=$dst
304 dstbase=`basename "$src"`
305 case $dst in
306 */) dst=$dst$dstbase;;
307 *) dst=$dst/$dstbase;;
308 esac
309 dstdir_status=0
310 else
311 dstdir=`dirname "$dst"`
312 test -d "$dstdir"
313 dstdir_status=$?
314 fi
315 fi
316
317 case $dstdir in
318 */) dstdirslash=$dstdir;;
319 *) dstdirslash=$dstdir/;;
320 esac
321
322 obsolete_mkdir_used=false
323
324 if test $dstdir_status != 0; then
325 case $posix_mkdir in
326 '')
327 # With -d, create the new directory with the user-specified mode.
328 # Otherwise, rely on $mkdir_umask.
329 if test -n "$dir_arg"; then
330 mkdir_mode=-m$mode
331 else
332 mkdir_mode=
333 fi
334
335 posix_mkdir=false
336 # The $RANDOM variable is not portable (e.g., dash). Use it
337 # here however when possible just to lower collision chance.
338 tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
339
340 trap '
341 ret=$?
342 rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null
343 exit $ret
344 ' 0
345
346 # Because "mkdir -p" follows existing symlinks and we likely work
347 # directly in world-writeable /tmp, make sure that the '$tmpdir'
348 # directory is successfully created first before we actually test
349 # 'mkdir -p'.
350 if (umask $mkdir_umask &&
351 $mkdirprog $mkdir_mode "$tmpdir" &&
352 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
353 then
354 if test -z "$dir_arg" || {
355 # Check for POSIX incompatibilities with -m.
356 # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
357 # other-writable bit of parent directory when it shouldn't.
358 # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
359 test_tmpdir="$tmpdir/a"
360 ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
361 case $ls_ld_tmpdir in
362 d????-?r-*) different_mode=700;;
363 d????-?--*) different_mode=755;;
364 *) false;;
365 esac &&
366 $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
367 ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
368 test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
369 }
370 }
371 then posix_mkdir=:
372 fi
373 rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
374 else
375 # Remove any dirs left behind by ancient mkdir implementations.
376 rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
377 fi
378 trap '' 0;;
379 esac
380
381 if
382 $posix_mkdir && (
383 umask $mkdir_umask &&
384 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
385 )
386 then :
387 else
388
389 # mkdir does not conform to POSIX,
390 # or it failed possibly due to a race condition. Create the
391 # directory the slow way, step by step, checking for races as we go.
392
393 case $dstdir in
394 /*) prefix='/';;
395 [-=\(\)!]*) prefix='./';;
396 *) prefix='';;
397 esac
398
399 oIFS=$IFS
400 IFS=/
401 set -f
402 set fnord $dstdir
403 shift
404 set +f
405 IFS=$oIFS
406
407 prefixes=
408
409 for d
410 do
411 test X"$d" = X && continue
412
413 prefix=$prefix$d
414 if test -d "$prefix"; then
415 prefixes=
416 else
417 if $posix_mkdir; then
418 (umask $mkdir_umask &&
419 $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
420 # Don't fail if two instances are running concurrently.
421 test -d "$prefix" || exit 1
422 else
423 case $prefix in
424 *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
425 *) qprefix=$prefix;;
426 esac
427 prefixes="$prefixes '$qprefix'"
428 fi
429 fi
430 prefix=$prefix/
431 done
432
433 if test -n "$prefixes"; then
434 # Don't fail if two instances are running concurrently.
435 (umask $mkdir_umask &&
436 eval "\$doit_exec \$mkdirprog $prefixes") ||
437 test -d "$dstdir" || exit 1
438 obsolete_mkdir_used=true
439 fi
440 fi
441 fi
442
443 if test -n "$dir_arg"; then
444 { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
445 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
446 { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
447 test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
448 else
449
450 # Make a couple of temp file names in the proper directory.
451 dsttmp=${dstdirslash}_inst.$$_
452 rmtmp=${dstdirslash}_rm.$$_
453
454 # Trap to clean up those temp files at exit.
455 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
456
457 # Copy the file name to the temp name.
458 (umask $cp_umask &&
459 { test -z "$stripcmd" || {
460 # Create $dsttmp read-write so that cp doesn't create it read-only,
461 # which would cause strip to fail.
462 if test -z "$doit"; then
463 : >"$dsttmp" # No need to fork-exec 'touch'.
464 else
465 $doit touch "$dsttmp"
466 fi
467 }
468 } &&
469 $doit_exec $cpprog "$src" "$dsttmp") &&
470
471 # and set any options; do chmod last to preserve setuid bits.
472 #
473 # If any of these fail, we abort the whole thing. If we want to
474 # ignore errors from any of these, just make sure not to ignore
475 # errors from the above "$doit $cpprog $src $dsttmp" command.
476 #
477 { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
478 { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
479 { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
480 { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
481
482 # If -C, don't bother to copy if it wouldn't change the file.
483 if $copy_on_change &&
484 old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
485 new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
486 set -f &&
487 set X $old && old=:$2:$4:$5:$6 &&
488 set X $new && new=:$2:$4:$5:$6 &&
489 set +f &&
490 test "$old" = "$new" &&
491 $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
492 then
493 rm -f "$dsttmp"
494 else
495 # If $backupsuffix is set, and the file being installed
496 # already exists, attempt a backup. Don't worry if it fails,
497 # e.g., if mv doesn't support -f.
498 if test -n "$backupsuffix" && test -f "$dst"; then
499 $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null
500 fi
501
502 # Rename the file to the real destination.
503 $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
504
505 # The rename failed, perhaps because mv can't rename something else
506 # to itself, or perhaps because mv is so ancient that it does not
507 # support -f.
508 {
509 # Now remove or move aside any old file at destination location.
510 # We try this two ways since rm can't unlink itself on some
511 # systems and the destination file might be busy for other
512 # reasons. In this case, the final cleanup might fail but the new
513 # file should still install successfully.
514 {
515 test ! -f "$dst" ||
516 $doit $rmcmd "$dst" 2>/dev/null ||
517 { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
518 { $doit $rmcmd "$rmtmp" 2>/dev/null; :; }
519 } ||
520 { echo "$0: cannot unlink or rename $dst" >&2
521 (exit 1); exit 1
522 }
523 } &&
524
525 # Now rename the file to the real destination.
526 $doit $mvcmd "$dsttmp" "$dst"
527 }
528 fi || exit 1
529
530 trap '' 0
531 fi
532 done
533
534 # Local variables:
535 # eval: (add-hook 'before-save-hook 'time-stamp)
536 # time-stamp-start: "scriptversion="
537 # time-stamp-format: "%:y-%02m-%02d.%02H"
538 # time-stamp-time-zone: "UTC0"
539 # time-stamp-end: "; # UTC"
540 # End:
0 #! /bin/sh
1 # Common wrapper for a few potentially missing GNU programs.
2
3 scriptversion=2018-03-07.03; # UTC
4
5 # Copyright (C) 1996-2021 Free Software Foundation, Inc.
6 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
7
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2, or (at your option)
11 # any later version.
12
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20
21 # As a special exception to the GNU General Public License, if you
22 # distribute this file as part of a program that contains a
23 # configuration script generated by Autoconf, you may include it under
24 # the same distribution terms that you use for the rest of that program.
25
26 if test $# -eq 0; then
27 echo 1>&2 "Try '$0 --help' for more information"
28 exit 1
29 fi
30
31 case $1 in
32
33 --is-lightweight)
34 # Used by our autoconf macros to check whether the available missing
35 # script is modern enough.
36 exit 0
37 ;;
38
39 --run)
40 # Back-compat with the calling convention used by older automake.
41 shift
42 ;;
43
44 -h|--h|--he|--hel|--help)
45 echo "\
46 $0 [OPTION]... PROGRAM [ARGUMENT]...
47
48 Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
49 to PROGRAM being missing or too old.
50
51 Options:
52 -h, --help display this help and exit
53 -v, --version output version information and exit
54
55 Supported PROGRAM values:
56 aclocal autoconf autoheader autom4te automake makeinfo
57 bison yacc flex lex help2man
58
59 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
60 'g' are ignored when checking the name.
61
62 Send bug reports to <bug-automake@gnu.org>."
63 exit $?
64 ;;
65
66 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
67 echo "missing $scriptversion (GNU Automake)"
68 exit $?
69 ;;
70
71 -*)
72 echo 1>&2 "$0: unknown '$1' option"
73 echo 1>&2 "Try '$0 --help' for more information"
74 exit 1
75 ;;
76
77 esac
78
79 # Run the given program, remember its exit status.
80 "$@"; st=$?
81
82 # If it succeeded, we are done.
83 test $st -eq 0 && exit 0
84
85 # Also exit now if we it failed (or wasn't found), and '--version' was
86 # passed; such an option is passed most likely to detect whether the
87 # program is present and works.
88 case $2 in --version|--help) exit $st;; esac
89
90 # Exit code 63 means version mismatch. This often happens when the user
91 # tries to use an ancient version of a tool on a file that requires a
92 # minimum version.
93 if test $st -eq 63; then
94 msg="probably too old"
95 elif test $st -eq 127; then
96 # Program was missing.
97 msg="missing on your system"
98 else
99 # Program was found and executed, but failed. Give up.
100 exit $st
101 fi
102
103 perl_URL=https://www.perl.org/
104 flex_URL=https://github.com/westes/flex
105 gnu_software_URL=https://www.gnu.org/software
106
107 program_details ()
108 {
109 case $1 in
110 aclocal|automake)
111 echo "The '$1' program is part of the GNU Automake package:"
112 echo "<$gnu_software_URL/automake>"
113 echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
114 echo "<$gnu_software_URL/autoconf>"
115 echo "<$gnu_software_URL/m4/>"
116 echo "<$perl_URL>"
117 ;;
118 autoconf|autom4te|autoheader)
119 echo "The '$1' program is part of the GNU Autoconf package:"
120 echo "<$gnu_software_URL/autoconf/>"
121 echo "It also requires GNU m4 and Perl in order to run:"
122 echo "<$gnu_software_URL/m4/>"
123 echo "<$perl_URL>"
124 ;;
125 esac
126 }
127
128 give_advice ()
129 {
130 # Normalize program name to check for.
131 normalized_program=`echo "$1" | sed '
132 s/^gnu-//; t
133 s/^gnu//; t
134 s/^g//; t'`
135
136 printf '%s\n' "'$1' is $msg."
137
138 configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
139 case $normalized_program in
140 autoconf*)
141 echo "You should only need it if you modified 'configure.ac',"
142 echo "or m4 files included by it."
143 program_details 'autoconf'
144 ;;
145 autoheader*)
146 echo "You should only need it if you modified 'acconfig.h' or"
147 echo "$configure_deps."
148 program_details 'autoheader'
149 ;;
150 automake*)
151 echo "You should only need it if you modified 'Makefile.am' or"
152 echo "$configure_deps."
153 program_details 'automake'
154 ;;
155 aclocal*)
156 echo "You should only need it if you modified 'acinclude.m4' or"
157 echo "$configure_deps."
158 program_details 'aclocal'
159 ;;
160 autom4te*)
161 echo "You might have modified some maintainer files that require"
162 echo "the 'autom4te' program to be rebuilt."
163 program_details 'autom4te'
164 ;;
165 bison*|yacc*)
166 echo "You should only need it if you modified a '.y' file."
167 echo "You may want to install the GNU Bison package:"
168 echo "<$gnu_software_URL/bison/>"
169 ;;
170 lex*|flex*)
171 echo "You should only need it if you modified a '.l' file."
172 echo "You may want to install the Fast Lexical Analyzer package:"
173 echo "<$flex_URL>"
174 ;;
175 help2man*)
176 echo "You should only need it if you modified a dependency" \
177 "of a man page."
178 echo "You may want to install the GNU Help2man package:"
179 echo "<$gnu_software_URL/help2man/>"
180 ;;
181 makeinfo*)
182 echo "You should only need it if you modified a '.texi' file, or"
183 echo "any other file indirectly affecting the aspect of the manual."
184 echo "You might want to install the Texinfo package:"
185 echo "<$gnu_software_URL/texinfo/>"
186 echo "The spurious makeinfo call might also be the consequence of"
187 echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
188 echo "want to install GNU make:"
189 echo "<$gnu_software_URL/make/>"
190 ;;
191 *)
192 echo "You might have modified some files without having the proper"
193 echo "tools for further handling them. Check the 'README' file, it"
194 echo "often tells you about the needed prerequisites for installing"
195 echo "this package. You may also peek at any GNU archive site, in"
196 echo "case some other package contains this missing '$1' program."
197 ;;
198 esac
199 }
200
201 give_advice "$1" | sed -e '1s/^/WARNING: /' \
202 -e '2,$s/^/ /' >&2
203
204 # Propagate the correct exit status (expected to be 127 for a program
205 # not found, 63 for a program that failed due to version mismatch).
206 exit $st
207
208 # Local variables:
209 # eval: (add-hook 'before-save-hook 'time-stamp)
210 # time-stamp-start: "scriptversion="
211 # time-stamp-format: "%:y-%02m-%02d.%02H"
212 # time-stamp-time-zone: "UTC0"
213 # time-stamp-end: "; # UTC"
214 # End:
461461 break;
462462 }
463463
464 total = (header[0] << 8) | header[1];
465 magic = (header[2] << 8) | header[3];
466 size = (header[4] << 8) | header[5];
467 if (magic != 0x5050 || total != 6 + size || size == 0 || size >= 0xffff) {
464 total = (uint16_t)(header[0]) << 8 | header[1];
465 magic = (uint16_t)(header[2]) << 8 | header[3];
466 size = (uint16_t)(header[4]) << 8 | header[5];
467 if (magic != 0x5050 || total < 7 || total - 6 != size) {
468468 log_error("Received bad header from gateway:\n");
469469 debug_bad_packet(tunnel, header);
470470 break;
142142 * - the routing table is to some extent trusted input,
143143 * - it's not that large,
144144 * - and the loop in strtok_r increments the pointer in each
145 * interation until it reaches the area where we have ensured
145 * iteration until it reaches the area where we have ensured
146146 * that there is a delimiting '\0' character by proper
147147 * initialization. We ensure this also when growing the buffer.
148148 */
3434 #endif
3535
3636 #include <openssl/err.h>
37 #ifdef OPENSSL_ENGINE
37 #ifndef OPENSSL_NO_ENGINE
3838 #include <openssl/engine.h>
3939 #endif
4040 #include <openssl/ui.h>
446446 */
447447 log_debug("waitpid: %s exit status code %d\n",
448448 PPP_DAEMON, exit_status);
449 if (exit_status >= ARRAY_SIZE(ppp_message) || exit_status < 0) {
449 if (exit_status >= ARRAY_SIZE(ppp_message)) {
450450 log_error("%s: Returned an unknown exit status code: %d\n",
451451 PPP_DAEMON, exit_status);
452452 } else {
510510 }
511511
512512 for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
513 if ((
513 if (
514514 #if HAVE_USR_SBIN_PPPD
515 (tunnel->config->pppd_ifname
516 && strstr(ifa->ifa_name, tunnel->config->pppd_ifname)
517 != NULL)
518 || strstr(ifa->ifa_name, "ppp") != NULL
515 ((tunnel->config->pppd_ifname &&
516 strstr(ifa->ifa_name, tunnel->config->pppd_ifname) != NULL) ||
517 strstr(ifa->ifa_name, "ppp") != NULL) &&
519518 #endif
520519 #if HAVE_USR_SBIN_PPP
521 strstr(ifa->ifa_name, "tun") != NULL
522 #endif
523 ) && ifa->ifa_flags & IFF_UP) {
524 if (&(ifa->ifa_addr->sa_family) != NULL
525 && ifa->ifa_addr->sa_family == AF_INET) {
520 strstr(ifa->ifa_name, "tun") != NULL &&
521 #endif
522 ifa->ifa_flags & IFF_UP) {
523 if (ifa->ifa_addr && ifa->ifa_addr->sa_family == AF_INET) {
526524 struct in_addr if_ip_addr =
527525 cast_addr(ifa->ifa_addr)->sin_addr;
528526
11161114 #endif
11171115
11181116 /* Use engine for PIV if user-cert config starts with pkcs11 URI: */
1119 #ifdef OPENSSL_ENGINE
1117 #ifndef OPENSSL_NO_ENGINE
11201118 if (tunnel->config->use_engine > 0) {
11211119 ENGINE *e;
11221120
12051203 goto err_ssl_context;
12061204 }
12071205 }
1208 #ifdef OPENSSL_ENGINE
1209 }
1210 #endif /* PKCS11-engine */
1206 #ifndef OPENSSL_NO_ENGINE
1207 }
1208 #endif
12111209
12121210 tunnel->ssl_handle = SSL_new(tunnel->ssl_context);
12131211 if (tunnel->ssl_handle == NULL) {
+0
-7516
tests/ci/checkpatch/checkpatch.pl less more
0 #!/usr/bin/env perl
1 # SPDX-License-Identifier: GPL-2.0
2 #
3 # (c) 2001, Dave Jones. (the file handling bit)
4 # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
5 # (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
6 # (c) 2008-2010 Andy Whitcroft <apw@canonical.com>
7 # (c) 2010-2018 Joe Perches <joe@perches.com>
8
9 use strict;
10 use warnings;
11 use POSIX;
12 use File::Basename;
13 use Cwd 'abs_path';
14 use Term::ANSIColor qw(:constants);
15 use Encode qw(decode encode);
16
17 my $P = $0;
18 my $D = dirname(abs_path($P));
19
20 my $V = '0.32';
21
22 use Getopt::Long qw(:config no_auto_abbrev);
23
24 my $quiet = 0;
25 my $verbose = 0;
26 my %verbose_messages = ();
27 my %verbose_emitted = ();
28 my $tree = 1;
29 my $chk_signoff = 1;
30 my $chk_patch = 1;
31 my $tst_only;
32 my $emacs = 0;
33 my $terse = 0;
34 my $showfile = 0;
35 my $file = 0;
36 my $git = 0;
37 my %git_commits = ();
38 my $check = 0;
39 my $check_orig = 0;
40 my $summary = 1;
41 my $mailback = 0;
42 my $summary_file = 0;
43 my $show_types = 0;
44 my $list_types = 0;
45 my $fix = 0;
46 my $fix_inplace = 0;
47 my $root;
48 my $gitroot = $ENV{'GIT_DIR'};
49 $gitroot = ".git" if !defined($gitroot);
50 my %debug;
51 my %camelcase = ();
52 my %use_type = ();
53 my @use = ();
54 my %ignore_type = ();
55 my @ignore = ();
56 my $help = 0;
57 my $configuration_file = ".checkpatch.conf";
58 my $max_line_length = 100;
59 my $ignore_perl_version = 0;
60 my $minimum_perl_version = 5.10.0;
61 my $min_conf_desc_length = 4;
62 my $spelling_file = "$D/spelling.txt";
63 my $codespell = 0;
64 my $codespellfile = "/usr/share/codespell/dictionary.txt";
65 my $conststructsfile = "$D/const_structs.checkpatch";
66 my $docsfile = "$D/../Documentation/dev-tools/checkpatch.rst";
67 my $typedefsfile;
68 my $color = "auto";
69 my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE
70 # git output parsing needs US English output, so first set backtick child process LANGUAGE
71 my $git_command ='export LANGUAGE=en_US.UTF-8; git';
72 my $tabsize = 8;
73 my ${CONFIG_} = "CONFIG_";
74
75 sub help {
76 my ($exitcode) = @_;
77
78 print << "EOM";
79 Usage: $P [OPTION]... [FILE]...
80 Version: $V
81
82 Options:
83 -q, --quiet quiet
84 -v, --verbose verbose mode
85 --no-tree run without a kernel tree
86 --no-signoff do not check for 'Signed-off-by' line
87 --patch treat FILE as patchfile (default)
88 --emacs emacs compile window format
89 --terse one line per report
90 --showfile emit diffed file position, not input file position
91 -g, --git treat FILE as a single commit or git revision range
92 single git commit with:
93 <rev>
94 <rev>^
95 <rev>~n
96 multiple git commits with:
97 <rev1>..<rev2>
98 <rev1>...<rev2>
99 <rev>-<count>
100 git merges are ignored
101 -f, --file treat FILE as regular source file
102 --subjective, --strict enable more subjective tests
103 --list-types list the possible message types
104 --types TYPE(,TYPE2...) show only these comma separated message types
105 --ignore TYPE(,TYPE2...) ignore various comma separated message types
106 --show-types show the specific message type in the output
107 --max-line-length=n set the maximum line length, (default $max_line_length)
108 if exceeded, warn on patches
109 requires --strict for use with --file
110 --min-conf-desc-length=n set the min description length, if shorter, warn
111 --tab-size=n set the number of spaces for tab (default $tabsize)
112 --root=PATH PATH to the kernel tree root
113 --no-summary suppress the per-file summary
114 --mailback only produce a report in case of warnings/errors
115 --summary-file include the filename in summary
116 --debug KEY=[0|1] turn on/off debugging of KEY, where KEY is one of
117 'values', 'possible', 'type', and 'attr' (default
118 is all off)
119 --test-only=WORD report only warnings/errors containing WORD
120 literally
121 --fix EXPERIMENTAL - may create horrible results
122 If correctable single-line errors exist, create
123 "<inputfile>.EXPERIMENTAL-checkpatch-fixes"
124 with potential errors corrected to the preferred
125 checkpatch style
126 --fix-inplace EXPERIMENTAL - may create horrible results
127 Is the same as --fix, but overwrites the input
128 file. It's your fault if there's no backup or git
129 --ignore-perl-version override checking of perl version. expect
130 runtime errors.
131 --codespell Use the codespell dictionary for spelling/typos
132 (default:/usr/share/codespell/dictionary.txt)
133 --codespellfile Use this codespell dictionary
134 --typedefsfile Read additional types from this file
135 --color[=WHEN] Use colors 'always', 'never', or only when output
136 is a terminal ('auto'). Default is 'auto'.
137 --kconfig-prefix=WORD use WORD as a prefix for Kconfig symbols (default
138 ${CONFIG_})
139 -h, --help, --version display this help and exit
140
141 When FILE is - read standard input.
142 EOM
143
144 exit($exitcode);
145 }
146
147 sub uniq {
148 my %seen;
149 return grep { !$seen{$_}++ } @_;
150 }
151
152 sub list_types {
153 my ($exitcode) = @_;
154
155 my $count = 0;
156
157 local $/ = undef;
158
159 open(my $script, '<', abs_path($P)) or
160 die "$P: Can't read '$P' $!\n";
161
162 my $text = <$script>;
163 close($script);
164
165 my %types = ();
166 # Also catch when type or level is passed through a variable
167 while ($text =~ /(?:(\bCHK|\bWARN|\bERROR|&\{\$msg_level})\s*\(|\$msg_type\s*=)\s*"([^"]+)"/g) {
168 if (defined($1)) {
169 if (exists($types{$2})) {
170 $types{$2} .= ",$1" if ($types{$2} ne $1);
171 } else {
172 $types{$2} = $1;
173 }
174 } else {
175 $types{$2} = "UNDETERMINED";
176 }
177 }
178
179 print("#\tMessage type\n\n");
180 if ($color) {
181 print(" ( Color coding: ");
182 print(RED . "ERROR" . RESET);
183 print(" | ");
184 print(YELLOW . "WARNING" . RESET);
185 print(" | ");
186 print(GREEN . "CHECK" . RESET);
187 print(" | ");
188 print("Multiple levels / Undetermined");
189 print(" )\n\n");
190 }
191
192 foreach my $type (sort keys %types) {
193 my $orig_type = $type;
194 if ($color) {
195 my $level = $types{$type};
196 if ($level eq "ERROR") {
197 $type = RED . $type . RESET;
198 } elsif ($level eq "WARN") {
199 $type = YELLOW . $type . RESET;
200 } elsif ($level eq "CHK") {
201 $type = GREEN . $type . RESET;
202 }
203 }
204 print(++$count . "\t" . $type . "\n");
205 if ($verbose && exists($verbose_messages{$orig_type})) {
206 my $message = $verbose_messages{$orig_type};
207 $message =~ s/\n/\n\t/g;
208 print("\t" . $message . "\n\n");
209 }
210 }
211
212 exit($exitcode);
213 }
214
215 my $conf = which_conf($configuration_file);
216 if (-f $conf) {
217 my @conf_args;
218 open(my $conffile, '<', "$conf")
219 or warn "$P: Can't find a readable $configuration_file file $!\n";
220
221 while (<$conffile>) {
222 my $line = $_;
223
224 $line =~ s/\s*\n?$//g;
225 $line =~ s/^\s*//g;
226 $line =~ s/\s+/ /g;
227
228 next if ($line =~ m/^\s*#/);
229 next if ($line =~ m/^\s*$/);
230
231 my @words = split(" ", $line);
232 foreach my $word (@words) {
233 last if ($word =~ m/^#/);
234 push (@conf_args, $word);
235 }
236 }
237 close($conffile);
238 unshift(@ARGV, @conf_args) if @conf_args;
239 }
240
241 sub load_docs {
242 open(my $docs, '<', "$docsfile")
243 or warn "$P: Can't read the documentation file $docsfile $!\n";
244
245 my $type = '';
246 my $desc = '';
247 my $in_desc = 0;
248
249 while (<$docs>) {
250 chomp;
251 my $line = $_;
252 $line =~ s/\s+$//;
253
254 if ($line =~ /^\s*\*\*(.+)\*\*$/) {
255 if ($desc ne '') {
256 $verbose_messages{$type} = trim($desc);
257 }
258 $type = $1;
259 $desc = '';
260 $in_desc = 1;
261 } elsif ($in_desc) {
262 if ($line =~ /^(?:\s{4,}|$)/) {
263 $line =~ s/^\s{4}//;
264 $desc .= $line;
265 $desc .= "\n";
266 } else {
267 $verbose_messages{$type} = trim($desc);
268 $type = '';
269 $desc = '';
270 $in_desc = 0;
271 }
272 }
273 }
274
275 if ($desc ne '') {
276 $verbose_messages{$type} = trim($desc);
277 }
278 close($docs);
279 }
280
281 # Perl's Getopt::Long allows options to take optional arguments after a space.
282 # Prevent --color by itself from consuming other arguments
283 foreach (@ARGV) {
284 if ($_ eq "--color" || $_ eq "-color") {
285 $_ = "--color=$color";
286 }
287 }
288
289 GetOptions(
290 'q|quiet+' => \$quiet,
291 'v|verbose!' => \$verbose,
292 'tree!' => \$tree,
293 'signoff!' => \$chk_signoff,
294 'patch!' => \$chk_patch,
295 'emacs!' => \$emacs,
296 'terse!' => \$terse,
297 'showfile!' => \$showfile,
298 'f|file!' => \$file,
299 'g|git!' => \$git,
300 'subjective!' => \$check,
301 'strict!' => \$check,
302 'ignore=s' => \@ignore,
303 'types=s' => \@use,
304 'show-types!' => \$show_types,
305 'list-types!' => \$list_types,
306 'max-line-length=i' => \$max_line_length,
307 'min-conf-desc-length=i' => \$min_conf_desc_length,
308 'tab-size=i' => \$tabsize,
309 'root=s' => \$root,
310 'summary!' => \$summary,
311 'mailback!' => \$mailback,
312 'summary-file!' => \$summary_file,
313 'fix!' => \$fix,
314 'fix-inplace!' => \$fix_inplace,
315 'ignore-perl-version!' => \$ignore_perl_version,
316 'debug=s' => \%debug,
317 'test-only=s' => \$tst_only,
318 'codespell!' => \$codespell,
319 'codespellfile=s' => \$codespellfile,
320 'typedefsfile=s' => \$typedefsfile,
321 'color=s' => \$color,
322 'no-color' => \$color, #keep old behaviors of -nocolor
323 'nocolor' => \$color, #keep old behaviors of -nocolor
324 'kconfig-prefix=s' => \${CONFIG_},
325 'h|help' => \$help,
326 'version' => \$help
327 ) or help(1);
328
329 help(0) if ($help);
330
331 die "$P: --git cannot be used with --file or --fix\n" if ($git && ($file || $fix));
332 die "$P: --verbose cannot be used with --terse\n" if ($verbose && $terse);
333
334 if ($color =~ /^[01]$/) {
335 $color = !$color;
336 } elsif ($color =~ /^always$/i) {
337 $color = 1;
338 } elsif ($color =~ /^never$/i) {
339 $color = 0;
340 } elsif ($color =~ /^auto$/i) {
341 $color = (-t STDOUT);
342 } else {
343 die "$P: Invalid color mode: $color\n";
344 }
345
346 load_docs() if ($verbose);
347 list_types(0) if ($list_types);
348
349 $fix = 1 if ($fix_inplace);
350 $check_orig = $check;
351
352 my $exit = 0;
353
354 my $perl_version_ok = 1;
355 if ($^V && $^V lt $minimum_perl_version) {
356 $perl_version_ok = 0;
357 printf "$P: requires at least perl version %vd\n", $minimum_perl_version;
358 exit(1) if (!$ignore_perl_version);
359 }
360
361 #if no filenames are given, push '-' to read patch from stdin
362 if ($#ARGV < 0) {
363 push(@ARGV, '-');
364 }
365
366 # skip TAB size 1 to avoid additional checks on $tabsize - 1
367 die "$P: Invalid TAB size: $tabsize\n" if ($tabsize < 2);
368
369 sub hash_save_array_words {
370 my ($hashRef, $arrayRef) = @_;
371
372 my @array = split(/,/, join(',', @$arrayRef));
373 foreach my $word (@array) {
374 $word =~ s/\s*\n?$//g;
375 $word =~ s/^\s*//g;
376 $word =~ s/\s+/ /g;
377 $word =~ tr/[a-z]/[A-Z]/;
378
379 next if ($word =~ m/^\s*#/);
380 next if ($word =~ m/^\s*$/);
381
382 $hashRef->{$word}++;
383 }
384 }
385
386 sub hash_show_words {
387 my ($hashRef, $prefix) = @_;
388
389 if (keys %$hashRef) {
390 print "\nNOTE: $prefix message types:";
391 foreach my $word (sort keys %$hashRef) {
392 print " $word";
393 }
394 print "\n";
395 }
396 }
397
398 hash_save_array_words(\%ignore_type, \@ignore);
399 hash_save_array_words(\%use_type, \@use);
400
401 my $dbg_values = 0;
402 my $dbg_possible = 0;
403 my $dbg_type = 0;
404 my $dbg_attr = 0;
405 for my $key (keys %debug) {
406 ## no critic
407 eval "\${dbg_$key} = '$debug{$key}';";
408 die "$@" if ($@);
409 }
410
411 my $rpt_cleaners = 0;
412
413 if ($terse) {
414 $emacs = 1;
415 $quiet++;
416 }
417
418 if ($tree) {
419 if (defined $root) {
420 if (!top_of_kernel_tree($root)) {
421 die "$P: $root: --root does not point at a valid tree\n";
422 }
423 } else {
424 if (top_of_kernel_tree('.')) {
425 $root = '.';
426 } elsif ($0 =~ m@(.*)/scripts/[^/]*$@ &&
427 top_of_kernel_tree($1)) {
428 $root = $1;
429 }
430 }
431
432 if (!defined $root) {
433 print "Must be run from the top-level dir. of a kernel tree\n";
434 exit(2);
435 }
436 }
437
438 my $emitted_corrupt = 0;
439
440 our $Ident = qr{
441 [A-Za-z_][A-Za-z\d_]*
442 (?:\s*\#\#\s*[A-Za-z_][A-Za-z\d_]*)*
443 }x;
444 our $Storage = qr{extern|static|asmlinkage};
445 our $Sparse = qr{
446 __user|
447 __kernel|
448 __force|
449 __iomem|
450 __must_check|
451 __kprobes|
452 __ref|
453 __refconst|
454 __refdata|
455 __rcu|
456 __private
457 }x;
458 our $InitAttributePrefix = qr{__(?:mem|cpu|dev|net_|)};
459 our $InitAttributeData = qr{$InitAttributePrefix(?:initdata\b)};
460 our $InitAttributeConst = qr{$InitAttributePrefix(?:initconst\b)};
461 our $InitAttributeInit = qr{$InitAttributePrefix(?:init\b)};
462 our $InitAttribute = qr{$InitAttributeData|$InitAttributeConst|$InitAttributeInit};
463
464 # Notes to $Attribute:
465 # We need \b after 'init' otherwise 'initconst' will cause a false positive in a check
466 our $Attribute = qr{
467 const|
468 volatile|
469 __percpu|
470 __nocast|
471 __safe|
472 __bitwise|
473 __packed__|
474 __packed2__|
475 __naked|
476 __maybe_unused|
477 __always_unused|
478 __noreturn|
479 __used|
480 __cold|
481 __pure|
482 __noclone|
483 __deprecated|
484 __read_mostly|
485 __ro_after_init|
486 __kprobes|
487 $InitAttribute|
488 ____cacheline_aligned|
489 ____cacheline_aligned_in_smp|
490 ____cacheline_internodealigned_in_smp|
491 __weak
492 }x;
493 our $Modifier;
494 our $Inline = qr{inline|__always_inline|noinline|__inline|__inline__};
495 our $Member = qr{->$Ident|\.$Ident|\[[^]]*\]};
496 our $Lval = qr{$Ident(?:$Member)*};
497
498 our $Int_type = qr{(?i)llu|ull|ll|lu|ul|l|u};
499 our $Binary = qr{(?i)0b[01]+$Int_type?};
500 our $Hex = qr{(?i)0x[0-9a-f]+$Int_type?};
501 our $Int = qr{[0-9]+$Int_type?};
502 our $Octal = qr{0[0-7]+$Int_type?};
503 our $String = qr{"[X\t]*"};
504 our $Float_hex = qr{(?i)0x[0-9a-f]+p-?[0-9]+[fl]?};
505 our $Float_dec = qr{(?i)(?:[0-9]+\.[0-9]*|[0-9]*\.[0-9]+)(?:e-?[0-9]+)?[fl]?};
506 our $Float_int = qr{(?i)[0-9]+e-?[0-9]+[fl]?};
507 our $Float = qr{$Float_hex|$Float_dec|$Float_int};
508 our $Constant = qr{$Float|$Binary|$Octal|$Hex|$Int};
509 our $Assignment = qr{\*\=|/=|%=|\+=|-=|<<=|>>=|&=|\^=|\|=|=};
510 our $Compare = qr{<=|>=|==|!=|<|(?<!-)>};
511 our $Arithmetic = qr{\+|-|\*|\/|%};
512 our $Operators = qr{
513 <=|>=|==|!=|
514 =>|->|<<|>>|<|>|!|~|
515 &&|\|\||,|\^|\+\+|--|&|\||$Arithmetic
516 }x;
517
518 our $c90_Keywords = qr{do|for|while|if|else|return|goto|continue|switch|default|case|break}x;
519
520 our $BasicType;
521 our $NonptrType;
522 our $NonptrTypeMisordered;
523 our $NonptrTypeWithAttr;
524 our $Type;
525 our $TypeMisordered;
526 our $Declare;
527 our $DeclareMisordered;
528
529 our $NON_ASCII_UTF8 = qr{
530 [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
531 | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
532 | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
533 | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
534 | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
535 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
536 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
537 }x;
538
539 our $UTF8 = qr{
540 [\x09\x0A\x0D\x20-\x7E] # ASCII
541 | $NON_ASCII_UTF8
542 }x;
543
544 our $typeC99Typedefs = qr{(?:__)?(?:[us]_?)?int_?(?:8|16|32|64)_t};
545 our $typeOtherOSTypedefs = qr{(?x:
546 u_(?:char|short|int|long) | # bsd
547 u(?:nchar|short|int|long) # sysv
548 )};
549 our $typeKernelTypedefs = qr{(?x:
550 (?:__)?(?:u|s|be|le)(?:8|16|32|64)|
551 atomic_t
552 )};
553 our $typeTypedefs = qr{(?x:
554 $typeC99Typedefs\b|
555 $typeOtherOSTypedefs\b|
556 $typeKernelTypedefs\b
557 )};
558
559 our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b};
560
561 our $logFunctions = qr{(?x:
562 printk(?:_ratelimited|_once|_deferred_once|_deferred|)|
563 (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
564 TP_printk|
565 WARN(?:_RATELIMIT|_ONCE|)|
566 panic|
567 MODULE_[A-Z_]+|
568 seq_vprintf|seq_printf|seq_puts
569 )};
570
571 our $allocFunctions = qr{(?x:
572 (?:(?:devm_)?
573 (?:kv|k|v)[czm]alloc(?:_array)?(?:_node)? |
574 kstrdup(?:_const)? |
575 kmemdup(?:_nul)?) |
576 (?:\w+)?alloc_skb(?:_ip_align)? |
577 # dev_alloc_skb/netdev_alloc_skb, et al
578 dma_alloc_coherent
579 )};
580
581 our $signature_tags = qr{(?xi:
582 Signed-off-by:|
583 Co-developed-by:|
584 Acked-by:|
585 Tested-by:|
586 Reviewed-by:|
587 Reported-by:|
588 Suggested-by:|
589 To:|
590 Cc:
591 )};
592
593 our $tracing_logging_tags = qr{(?xi:
594 [=-]*> |
595 <[=-]* |
596 \[ |
597 \] |
598 start |
599 called |
600 entered |
601 entry |
602 enter |
603 in |
604 inside |
605 here |
606 begin |
607 exit |
608 end |
609 done |
610 leave |
611 completed |
612 out |
613 return |
614 [\.\!:\s]*
615 )};
616
617 sub edit_distance_min {
618 my (@arr) = @_;
619 my $len = scalar @arr;
620 if ((scalar @arr) < 1) {
621 # if underflow, return
622 return;
623 }
624 my $min = $arr[0];
625 for my $i (0 .. ($len-1)) {
626 if ($arr[$i] < $min) {
627 $min = $arr[$i];
628 }
629 }
630 return $min;
631 }
632
633 sub get_edit_distance {
634 my ($str1, $str2) = @_;
635 $str1 = lc($str1);
636 $str2 = lc($str2);
637 $str1 =~ s/-//g;
638 $str2 =~ s/-//g;
639 my $len1 = length($str1);
640 my $len2 = length($str2);
641 # two dimensional array storing minimum edit distance
642 my @distance;
643 for my $i (0 .. $len1) {
644 for my $j (0 .. $len2) {
645 if ($i == 0) {
646 $distance[$i][$j] = $j;
647 } elsif ($j == 0) {
648 $distance[$i][$j] = $i;
649 } elsif (substr($str1, $i-1, 1) eq substr($str2, $j-1, 1)) {
650 $distance[$i][$j] = $distance[$i - 1][$j - 1];
651 } else {
652 my $dist1 = $distance[$i][$j - 1]; #insert distance
653 my $dist2 = $distance[$i - 1][$j]; # remove
654 my $dist3 = $distance[$i - 1][$j - 1]; #replace
655 $distance[$i][$j] = 1 + edit_distance_min($dist1, $dist2, $dist3);
656 }
657 }
658 }
659 return $distance[$len1][$len2];
660 }
661
662 sub find_standard_signature {
663 my ($sign_off) = @_;
664 my @standard_signature_tags = (
665 'Signed-off-by:', 'Co-developed-by:', 'Acked-by:', 'Tested-by:',
666 'Reviewed-by:', 'Reported-by:', 'Suggested-by:'
667 );
668 foreach my $signature (@standard_signature_tags) {
669 return $signature if (get_edit_distance($sign_off, $signature) <= 2);
670 }
671
672 return "";
673 }
674
675 our @typeListMisordered = (
676 qr{char\s+(?:un)?signed},
677 qr{int\s+(?:(?:un)?signed\s+)?short\s},
678 qr{int\s+short(?:\s+(?:un)?signed)},
679 qr{short\s+int(?:\s+(?:un)?signed)},
680 qr{(?:un)?signed\s+int\s+short},
681 qr{short\s+(?:un)?signed},
682 qr{long\s+int\s+(?:un)?signed},
683 qr{int\s+long\s+(?:un)?signed},
684 qr{long\s+(?:un)?signed\s+int},
685 qr{int\s+(?:un)?signed\s+long},
686 qr{int\s+(?:un)?signed},
687 qr{int\s+long\s+long\s+(?:un)?signed},
688 qr{long\s+long\s+int\s+(?:un)?signed},
689 qr{long\s+long\s+(?:un)?signed\s+int},
690 qr{long\s+long\s+(?:un)?signed},
691 qr{long\s+(?:un)?signed},
692 );
693
694 our @typeList = (
695 qr{void},
696 qr{(?:(?:un)?signed\s+)?char},
697 qr{(?:(?:un)?signed\s+)?short\s+int},
698 qr{(?:(?:un)?signed\s+)?short},
699 qr{(?:(?:un)?signed\s+)?int},
700 qr{(?:(?:un)?signed\s+)?long\s+int},
701 qr{(?:(?:un)?signed\s+)?long\s+long\s+int},
702 qr{(?:(?:un)?signed\s+)?long\s+long},
703 qr{(?:(?:un)?signed\s+)?long},
704 qr{(?:un)?signed},
705 qr{float},
706 qr{double},
707 qr{bool},
708 qr{struct\s+$Ident},
709 qr{union\s+$Ident},
710 qr{enum\s+$Ident},
711 qr{${Ident}_t},
712 qr{${Ident}_handler},
713 qr{${Ident}_handler_fn},
714 @typeListMisordered,
715 );
716
717 our $C90_int_types = qr{(?x:
718 long\s+long\s+int\s+(?:un)?signed|
719 long\s+long\s+(?:un)?signed\s+int|
720 long\s+long\s+(?:un)?signed|
721 (?:(?:un)?signed\s+)?long\s+long\s+int|
722 (?:(?:un)?signed\s+)?long\s+long|
723 int\s+long\s+long\s+(?:un)?signed|
724 int\s+(?:(?:un)?signed\s+)?long\s+long|
725
726 long\s+int\s+(?:un)?signed|
727 long\s+(?:un)?signed\s+int|
728 long\s+(?:un)?signed|
729 (?:(?:un)?signed\s+)?long\s+int|
730 (?:(?:un)?signed\s+)?long|
731 int\s+long\s+(?:un)?signed|
732 int\s+(?:(?:un)?signed\s+)?long|
733
734 int\s+(?:un)?signed|
735 (?:(?:un)?signed\s+)?int
736 )};
737
738 our @typeListFile = ();
739 our @typeListWithAttr = (
740 @typeList,
741 qr{struct\s+$InitAttribute\s+$Ident},
742 qr{union\s+$InitAttribute\s+$Ident},
743 );
744
745 our @modifierList = (
746 qr{fastcall},
747 );
748 our @modifierListFile = ();
749
750 our @mode_permission_funcs = (
751 ["module_param", 3],
752 ["module_param_(?:array|named|string)", 4],
753 ["module_param_array_named", 5],
754 ["debugfs_create_(?:file|u8|u16|u32|u64|x8|x16|x32|x64|size_t|atomic_t|bool|blob|regset32|u32_array)", 2],
755 ["proc_create(?:_data|)", 2],
756 ["(?:CLASS|DEVICE|SENSOR|SENSOR_DEVICE|IIO_DEVICE)_ATTR", 2],
757 ["IIO_DEV_ATTR_[A-Z_]+", 1],
758 ["SENSOR_(?:DEVICE_|)ATTR_2", 2],
759 ["SENSOR_TEMPLATE(?:_2|)", 3],
760 ["__ATTR", 2],
761 );
762
763 my $word_pattern = '\b[A-Z]?[a-z]{2,}\b';
764
765 #Create a search pattern for all these functions to speed up a loop below
766 our $mode_perms_search = "";
767 foreach my $entry (@mode_permission_funcs) {
768 $mode_perms_search .= '|' if ($mode_perms_search ne "");
769 $mode_perms_search .= $entry->[0];
770 }
771 $mode_perms_search = "(?:${mode_perms_search})";
772
773 our %deprecated_apis = (
774 "synchronize_rcu_bh" => "synchronize_rcu",
775 "synchronize_rcu_bh_expedited" => "synchronize_rcu_expedited",
776 "call_rcu_bh" => "call_rcu",
777 "rcu_barrier_bh" => "rcu_barrier",
778 "synchronize_sched" => "synchronize_rcu",
779 "synchronize_sched_expedited" => "synchronize_rcu_expedited",
780 "call_rcu_sched" => "call_rcu",
781 "rcu_barrier_sched" => "rcu_barrier",
782 "get_state_synchronize_sched" => "get_state_synchronize_rcu",
783 "cond_synchronize_sched" => "cond_synchronize_rcu",
784 );
785
786 #Create a search pattern for all these strings to speed up a loop below
787 our $deprecated_apis_search = "";
788 foreach my $entry (keys %deprecated_apis) {
789 $deprecated_apis_search .= '|' if ($deprecated_apis_search ne "");
790 $deprecated_apis_search .= $entry;
791 }
792 $deprecated_apis_search = "(?:${deprecated_apis_search})";
793
794 our $mode_perms_world_writable = qr{
795 S_IWUGO |
796 S_IWOTH |
797 S_IRWXUGO |
798 S_IALLUGO |
799 0[0-7][0-7][2367]
800 }x;
801
802 our %mode_permission_string_types = (
803 "S_IRWXU" => 0700,
804 "S_IRUSR" => 0400,
805 "S_IWUSR" => 0200,
806 "S_IXUSR" => 0100,
807 "S_IRWXG" => 0070,
808 "S_IRGRP" => 0040,
809 "S_IWGRP" => 0020,
810 "S_IXGRP" => 0010,
811 "S_IRWXO" => 0007,
812 "S_IROTH" => 0004,
813 "S_IWOTH" => 0002,
814 "S_IXOTH" => 0001,
815 "S_IRWXUGO" => 0777,
816 "S_IRUGO" => 0444,
817 "S_IWUGO" => 0222,
818 "S_IXUGO" => 0111,
819 );
820
821 #Create a search pattern for all these strings to speed up a loop below
822 our $mode_perms_string_search = "";
823 foreach my $entry (keys %mode_permission_string_types) {
824 $mode_perms_string_search .= '|' if ($mode_perms_string_search ne "");
825 $mode_perms_string_search .= $entry;
826 }
827 our $single_mode_perms_string_search = "(?:${mode_perms_string_search})";
828 our $multi_mode_perms_string_search = qr{
829 ${single_mode_perms_string_search}
830 (?:\s*\|\s*${single_mode_perms_string_search})*
831 }x;
832
833 sub perms_to_octal {
834 my ($string) = @_;
835
836 return trim($string) if ($string =~ /^\s*0[0-7]{3,3}\s*$/);
837
838 my $val = "";
839 my $oval = "";
840 my $to = 0;
841 my $curpos = 0;
842 my $lastpos = 0;
843 while ($string =~ /\b(($single_mode_perms_string_search)\b(?:\s*\|\s*)?\s*)/g) {
844 $curpos = pos($string);
845 my $match = $2;
846 my $omatch = $1;
847 last if ($lastpos > 0 && ($curpos - length($omatch) != $lastpos));
848 $lastpos = $curpos;
849 $to |= $mode_permission_string_types{$match};
850 $val .= '\s*\|\s*' if ($val ne "");
851 $val .= $match;
852 $oval .= $omatch;
853 }
854 $oval =~ s/^\s*\|\s*//;
855 $oval =~ s/\s*\|\s*$//;
856 return sprintf("%04o", $to);
857 }
858
859 our $allowed_asm_includes = qr{(?x:
860 irq|
861 memory|
862 time|
863 reboot
864 )};
865 # memory.h: ARM has a custom one
866
867 # Load common spelling mistakes and build regular expression list.
868 my $misspellings;
869 my %spelling_fix;
870
871 if (open(my $spelling, '<', $spelling_file)) {
872 while (<$spelling>) {
873 my $line = $_;
874
875 $line =~ s/\s*\n?$//g;
876 $line =~ s/^\s*//g;
877
878 next if ($line =~ m/^\s*#/);
879 next if ($line =~ m/^\s*$/);
880
881 my ($suspect, $fix) = split(/\|\|/, $line);
882
883 $spelling_fix{$suspect} = $fix;
884 }
885 close($spelling);
886 } else {
887 warn "No typos will be found - file '$spelling_file': $!\n";
888 }
889
890 if ($codespell) {
891 if (open(my $spelling, '<', $codespellfile)) {
892 while (<$spelling>) {
893 my $line = $_;
894
895 $line =~ s/\s*\n?$//g;
896 $line =~ s/^\s*//g;
897
898 next if ($line =~ m/^\s*#/);
899 next if ($line =~ m/^\s*$/);
900 next if ($line =~ m/, disabled/i);
901
902 $line =~ s/,.*$//;
903
904 my ($suspect, $fix) = split(/->/, $line);
905
906 $spelling_fix{$suspect} = $fix;
907 }
908 close($spelling);
909 } else {
910 warn "No codespell typos will be found - file '$codespellfile': $!\n";
911 }
912 }
913
914 $misspellings = join("|", sort keys %spelling_fix) if keys %spelling_fix;
915
916 sub read_words {
917 my ($wordsRef, $file) = @_;
918
919 if (open(my $words, '<', $file)) {
920 while (<$words>) {
921 my $line = $_;
922
923 $line =~ s/\s*\n?$//g;
924 $line =~ s/^\s*//g;
925
926 next if ($line =~ m/^\s*#/);
927 next if ($line =~ m/^\s*$/);
928 if ($line =~ /\s/) {
929 print("$file: '$line' invalid - ignored\n");
930 next;
931 }
932
933 $$wordsRef .= '|' if (defined $$wordsRef);
934 $$wordsRef .= $line;
935 }
936 close($file);
937 return 1;
938 }
939
940 return 0;
941 }
942
943 my $const_structs;
944 if (show_type("CONST_STRUCT")) {
945 read_words(\$const_structs, $conststructsfile)
946 or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
947 }
948
949 if (defined($typedefsfile)) {
950 my $typeOtherTypedefs;
951 read_words(\$typeOtherTypedefs, $typedefsfile)
952 or warn "No additional types will be considered - file '$typedefsfile': $!\n";
953 $typeTypedefs .= '|' . $typeOtherTypedefs if (defined $typeOtherTypedefs);
954 }
955
956 sub build_types {
957 my $mods = "(?x: \n" . join("|\n ", (@modifierList, @modifierListFile)) . "\n)";
958 my $all = "(?x: \n" . join("|\n ", (@typeList, @typeListFile)) . "\n)";
959 my $Misordered = "(?x: \n" . join("|\n ", @typeListMisordered) . "\n)";
960 my $allWithAttr = "(?x: \n" . join("|\n ", @typeListWithAttr) . "\n)";
961 $Modifier = qr{(?:$Attribute|$Sparse|$mods)};
962 $BasicType = qr{
963 (?:$typeTypedefs\b)|
964 (?:${all}\b)
965 }x;
966 $NonptrType = qr{
967 (?:$Modifier\s+|const\s+)*
968 (?:
969 (?:typeof|__typeof__)\s*\([^\)]*\)|
970 (?:$typeTypedefs\b)|
971 (?:${all}\b)
972 )
973 (?:\s+$Modifier|\s+const)*
974 }x;
975 $NonptrTypeMisordered = qr{
976 (?:$Modifier\s+|const\s+)*
977 (?:
978 (?:${Misordered}\b)
979 )
980 (?:\s+$Modifier|\s+const)*
981 }x;
982 $NonptrTypeWithAttr = qr{
983 (?:$Modifier\s+|const\s+)*
984 (?:
985 (?:typeof|__typeof__)\s*\([^\)]*\)|
986 (?:$typeTypedefs\b)|
987 (?:${allWithAttr}\b)
988 )
989 (?:\s+$Modifier|\s+const)*
990 }x;
991 $Type = qr{
992 $NonptrType
993 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
994 (?:\s+$Inline|\s+$Modifier)*
995 }x;
996 $TypeMisordered = qr{
997 $NonptrTypeMisordered
998 (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+){0,4}
999 (?:\s+$Inline|\s+$Modifier)*
1000 }x;
1001 $Declare = qr{(?:$Storage\s+(?:$Inline\s+)?)?$Type};
1002 $DeclareMisordered = qr{(?:$Storage\s+(?:$Inline\s+)?)?$TypeMisordered};
1003 }
1004 build_types();
1005
1006 our $Typecast = qr{\s*(\(\s*$NonptrType\s*\)){0,1}\s*};
1007
1008 # Using $balanced_parens, $LvalOrFunc, or $FuncArg
1009 # requires at least perl version v5.10.0
1010 # Any use must be runtime checked with $^V
1011
1012 our $balanced_parens = qr/(\((?:[^\(\)]++|(?-1))*\))/;
1013 our $LvalOrFunc = qr{((?:[\&\*]\s*)?$Lval)\s*($balanced_parens{0,1})\s*};
1014 our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant|$String)};
1015
1016 our $declaration_macros = qr{(?x:
1017 (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
1018 (?:$Storage\s+)?[HLP]?LIST_HEAD\s*\(|
1019 (?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(
1020 )};
1021
1022 our %allow_repeated_words = (
1023 add => '',
1024 added => '',
1025 bad => '',
1026 be => '',
1027 );
1028
1029 sub deparenthesize {
1030 my ($string) = @_;
1031 return "" if (!defined($string));
1032
1033 while ($string =~ /^\s*\(.*\)\s*$/) {
1034 $string =~ s@^\s*\(\s*@@;
1035 $string =~ s@\s*\)\s*$@@;
1036 }
1037
1038 $string =~ s@\s+@ @g;
1039
1040 return $string;
1041 }
1042
1043 sub seed_camelcase_file {
1044 my ($file) = @_;
1045
1046 return if (!(-f $file));
1047
1048 local $/;
1049
1050 open(my $include_file, '<', "$file")
1051 or warn "$P: Can't read '$file' $!\n";
1052 my $text = <$include_file>;
1053 close($include_file);
1054
1055 my @lines = split('\n', $text);
1056
1057 foreach my $line (@lines) {
1058 next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/);
1059 if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) {
1060 $camelcase{$1} = 1;
1061 } elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) {
1062 $camelcase{$1} = 1;
1063 } elsif ($line =~ /^\s*(?:union|struct|enum)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[;\{]/) {
1064 $camelcase{$1} = 1;
1065 }
1066 }
1067 }
1068
1069 our %maintained_status = ();
1070
1071 sub is_maintained_obsolete {
1072 my ($filename) = @_;
1073
1074 return 0 if (!$tree || !(-e "$root/scripts/get_maintainer.pl"));
1075
1076 if (!exists($maintained_status{$filename})) {
1077 $maintained_status{$filename} = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`;
1078 }
1079
1080 return $maintained_status{$filename} =~ /obsolete/i;
1081 }
1082
1083 sub is_SPDX_License_valid {
1084 my ($license) = @_;
1085
1086 return 1 if (!$tree || which("python3") eq "" || !(-x "$root/scripts/spdxcheck.py") || !(-e "$gitroot"));
1087
1088 my $root_path = abs_path($root);
1089 my $status = `cd "$root_path"; echo "$license" | scripts/spdxcheck.py -`;
1090 return 0 if ($status ne "");
1091 return 1;
1092 }
1093
1094 my $camelcase_seeded = 0;
1095 sub seed_camelcase_includes {
1096 return if ($camelcase_seeded);
1097
1098 my $files;
1099 my $camelcase_cache = "";
1100 my @include_files = ();
1101
1102 $camelcase_seeded = 1;
1103
1104 if (-e "$gitroot") {
1105 my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`;
1106 chomp $git_last_include_commit;
1107 $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
1108 } else {
1109 my $last_mod_date = 0;
1110 $files = `find $root/include -name "*.h"`;
1111 @include_files = split('\n', $files);
1112 foreach my $file (@include_files) {
1113 my $date = POSIX::strftime("%Y%m%d%H%M",
1114 localtime((stat $file)[9]));
1115 $last_mod_date = $date if ($last_mod_date < $date);
1116 }
1117 $camelcase_cache = ".checkpatch-camelcase.date.$last_mod_date";
1118 }
1119
1120 if ($camelcase_cache ne "" && -f $camelcase_cache) {
1121 open(my $camelcase_file, '<', "$camelcase_cache")
1122 or warn "$P: Can't read '$camelcase_cache' $!\n";
1123 while (<$camelcase_file>) {
1124 chomp;
1125 $camelcase{$_} = 1;
1126 }
1127 close($camelcase_file);
1128
1129 return;
1130 }
1131
1132 if (-e "$gitroot") {
1133 $files = `${git_command} ls-files "include/*.h"`;
1134 @include_files = split('\n', $files);
1135 }
1136
1137 foreach my $file (@include_files) {
1138 seed_camelcase_file($file);
1139 }
1140
1141 if ($camelcase_cache ne "") {
1142 unlink glob ".checkpatch-camelcase.*";
1143 open(my $camelcase_file, '>', "$camelcase_cache")
1144 or warn "$P: Can't write '$camelcase_cache' $!\n";
1145 foreach (sort { lc($a) cmp lc($b) } keys(%camelcase)) {
1146 print $camelcase_file ("$_\n");
1147 }
1148 close($camelcase_file);
1149 }
1150 }
1151
1152 sub git_is_single_file {
1153 my ($filename) = @_;
1154
1155 return 0 if ((which("git") eq "") || !(-e "$gitroot"));
1156
1157 my $output = `${git_command} ls-files -- $filename 2>/dev/null`;
1158 my $count = $output =~ tr/\n//;
1159 return $count eq 1 && $output =~ m{^${filename}$};
1160 }
1161
1162 sub git_commit_info {
1163 my ($commit, $id, $desc) = @_;
1164
1165 return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));
1166
1167 my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
1168 $output =~ s/^\s*//gm;
1169 my @lines = split("\n", $output);
1170
1171 return ($id, $desc) if ($#lines < 0);
1172
1173 if ($lines[0] =~ /^error: short SHA1 $commit is ambiguous/) {
1174 # Maybe one day convert this block of bash into something that returns
1175 # all matching commit ids, but it's very slow...
1176 #
1177 # echo "checking commits $1..."
1178 # git rev-list --remotes | grep -i "^$1" |
1179 # while read line ; do
1180 # git log --format='%H %s' -1 $line |
1181 # echo "commit $(cut -c 1-12,41-)"
1182 # done
1183 } elsif ($lines[0] =~ /^fatal: ambiguous argument '$commit': unknown revision or path not in the working tree\./) {
1184 $id = undef;
1185 } else {
1186 $id = substr($lines[0], 0, 12);
1187 $desc = substr($lines[0], 41);
1188 }
1189
1190 return ($id, $desc);
1191 }
1192
1193 $chk_signoff = 0 if ($file);
1194
1195 my @rawlines = ();
1196 my @lines = ();
1197 my @fixed = ();
1198 my @fixed_inserted = ();
1199 my @fixed_deleted = ();
1200 my $fixlinenr = -1;
1201
1202 # If input is git commits, extract all commits from the commit expressions.
1203 # For example, HEAD-3 means we need check 'HEAD, HEAD~1, HEAD~2'.
1204 die "$P: No git repository found\n" if ($git && !-e "$gitroot");
1205
1206 if ($git) {
1207 my @commits = ();
1208 foreach my $commit_expr (@ARGV) {
1209 my $git_range;
1210 if ($commit_expr =~ m/^(.*)-(\d+)$/) {
1211 $git_range = "-$2 $1";
1212 } elsif ($commit_expr =~ m/\.\./) {
1213 $git_range = "$commit_expr";
1214 } else {
1215 $git_range = "-1 $commit_expr";
1216 }
1217 my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
1218 foreach my $line (split(/\n/, $lines)) {
1219 $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
1220 next if (!defined($1) || !defined($2));
1221 my $sha1 = $1;
1222 my $subject = $2;
1223 unshift(@commits, $sha1);
1224 $git_commits{$sha1} = $subject;
1225 }
1226 }
1227 die "$P: no git commits after extraction!\n" if (@commits == 0);
1228 @ARGV = @commits;
1229 }
1230
1231 my $vname;
1232 $allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"};
1233 for my $filename (@ARGV) {
1234 my $FILE;
1235 my $is_git_file = git_is_single_file($filename);
1236 my $oldfile = $file;
1237 $file = 1 if ($is_git_file);
1238 if ($git) {
1239 open($FILE, '-|', "git format-patch -M --stdout -1 $filename") ||
1240 die "$P: $filename: git format-patch failed - $!\n";
1241 } elsif ($file) {
1242 open($FILE, '-|', "diff -u /dev/null $filename") ||
1243 die "$P: $filename: diff failed - $!\n";
1244 } elsif ($filename eq '-') {
1245 open($FILE, '<&STDIN');
1246 } else {
1247 open($FILE, '<', "$filename") ||
1248 die "$P: $filename: open failed - $!\n";
1249 }
1250 if ($filename eq '-') {
1251 $vname = 'Your patch';
1252 } elsif ($git) {
1253 $vname = "Commit " . substr($filename, 0, 12) . ' ("' . $git_commits{$filename} . '")';
1254 } else {
1255 $vname = $filename;
1256 }
1257 while (<$FILE>) {
1258 chomp;
1259 push(@rawlines, $_);
1260 $vname = qq("$1") if ($filename eq '-' && $_ =~ m/^Subject:\s+(.+)/i);
1261 }
1262 close($FILE);
1263
1264 if ($#ARGV > 0 && $quiet == 0) {
1265 print '-' x length($vname) . "\n";
1266 print "$vname\n";
1267 print '-' x length($vname) . "\n";
1268 }
1269
1270 if (!process($filename)) {
1271 $exit = 1;
1272 }
1273 @rawlines = ();
1274 @lines = ();
1275 @fixed = ();
1276 @fixed_inserted = ();
1277 @fixed_deleted = ();
1278 $fixlinenr = -1;
1279 @modifierListFile = ();
1280 @typeListFile = ();
1281 build_types();
1282 $file = $oldfile if ($is_git_file);
1283 }
1284
1285 if (!$quiet) {
1286 hash_show_words(\%use_type, "Used");
1287 hash_show_words(\%ignore_type, "Ignored");
1288
1289 if (!$perl_version_ok) {
1290 print << "EOM"
1291
1292 NOTE: perl $^V is not modern enough to detect all possible issues.
1293 An upgrade to at least perl $minimum_perl_version is suggested.
1294 EOM
1295 }
1296 if ($exit) {
1297 print << "EOM"
1298
1299 NOTE: If any of the errors are false positives, please report
1300 them to the maintainer, see CHECKPATCH in MAINTAINERS.
1301 EOM
1302 }
1303 }
1304
1305 exit($exit);
1306
1307 sub top_of_kernel_tree {
1308 my ($root) = @_;
1309
1310 my @tree_check = (
1311 "COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile",
1312 "README", "Documentation", "arch", "include", "drivers",
1313 "fs", "init", "ipc", "kernel", "lib", "scripts",
1314 );
1315
1316 foreach my $check (@tree_check) {
1317 if (! -e $root . '/' . $check) {
1318 return 0;
1319 }
1320 }
1321 return 1;
1322 }
1323
1324 sub parse_email {
1325 my ($formatted_email) = @_;
1326
1327 my $name = "";
1328 my $quoted = "";
1329 my $name_comment = "";
1330 my $address = "";
1331 my $comment = "";
1332
1333 if ($formatted_email =~ /^(.*)<(\S+\@\S+)>(.*)$/) {
1334 $name = $1;
1335 $address = $2;
1336 $comment = $3 if defined $3;
1337 } elsif ($formatted_email =~ /^\s*<(\S+\@\S+)>(.*)$/) {
1338 $address = $1;
1339 $comment = $2 if defined $2;
1340 } elsif ($formatted_email =~ /(\S+\@\S+)(.*)$/) {
1341 $address = $1;
1342 $comment = $2 if defined $2;
1343 $formatted_email =~ s/\Q$address\E.*$//;
1344 $name = $formatted_email;
1345 $name = trim($name);
1346 $name =~ s/^\"|\"$//g;
1347 # If there's a name left after stripping spaces and
1348 # leading quotes, and the address doesn't have both
1349 # leading and trailing angle brackets, the address
1350 # is invalid. ie:
1351 # "joe smith joe@smith.com" bad
1352 # "joe smith <joe@smith.com" bad
1353 if ($name ne "" && $address !~ /^<[^>]+>$/) {
1354 $name = "";
1355 $address = "";
1356 $comment = "";
1357 }
1358 }
1359
1360 # Extract comments from names excluding quoted parts
1361 # "John D. (Doe)" - Do not extract
1362 if ($name =~ s/\"(.+)\"//) {
1363 $quoted = $1;
1364 }
1365 while ($name =~ s/\s*($balanced_parens)\s*/ /) {
1366 $name_comment .= trim($1);
1367 }
1368 $name =~ s/^[ \"]+|[ \"]+$//g;
1369 $name = trim("$quoted $name");
1370
1371 $address = trim($address);
1372 $address =~ s/^\<|\>$//g;
1373 $comment = trim($comment);
1374
1375 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
1376 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1377 $name = "\"$name\"";
1378 }
1379
1380 return ($name, $name_comment, $address, $comment);
1381 }
1382
1383 sub format_email {
1384 my ($name, $name_comment, $address, $comment) = @_;
1385
1386 my $formatted_email;
1387
1388 $name =~ s/^[ \"]+|[ \"]+$//g;
1389 $address = trim($address);
1390 $address =~ s/(?:\.|\,|\")+$//; ##trailing commas, dots or quotes
1391
1392 if ($name =~ /[^\w \-]/i) { ##has "must quote" chars
1393 $name =~ s/(?<!\\)"/\\"/g; ##escape quotes
1394 $name = "\"$name\"";
1395 }
1396
1397 $name_comment = trim($name_comment);
1398 $name_comment = " $name_comment" if ($name_comment ne "");
1399 $comment = trim($comment);
1400 $comment = " $comment" if ($comment ne "");
1401
1402 if ("$name" eq "") {
1403 $formatted_email = "$address";
1404 } else {
1405 $formatted_email = "$name$name_comment <$address>";
1406 }
1407 $formatted_email .= "$comment";
1408 return $formatted_email;
1409 }
1410
1411 sub reformat_email {
1412 my ($email) = @_;
1413
1414 my ($email_name, $name_comment, $email_address, $comment) = parse_email($email);
1415 return format_email($email_name, $name_comment, $email_address, $comment);
1416 }
1417
1418 sub same_email_addresses {
1419 my ($email1, $email2) = @_;
1420
1421 my ($email1_name, $name1_comment, $email1_address, $comment1) = parse_email($email1);
1422 my ($email2_name, $name2_comment, $email2_address, $comment2) = parse_email($email2);
1423
1424 return $email1_name eq $email2_name &&
1425 $email1_address eq $email2_address &&
1426 $name1_comment eq $name2_comment &&
1427 $comment1 eq $comment2;
1428 }
1429
1430 sub which {
1431 my ($bin) = @_;
1432
1433 foreach my $path (split(/:/, $ENV{PATH})) {
1434 if (-e "$path/$bin") {
1435 return "$path/$bin";
1436 }
1437 }
1438
1439 return "";
1440 }
1441
1442 sub which_conf {
1443 my ($conf) = @_;
1444
1445 foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) {
1446 if (-e "$path/$conf") {
1447 return "$path/$conf";
1448 }
1449 }
1450
1451 return "";
1452 }
1453
1454 sub expand_tabs {
1455 my ($str) = @_;
1456
1457 my $res = '';
1458 my $n = 0;
1459 for my $c (split(//, $str)) {
1460 if ($c eq "\t") {
1461 $res .= ' ';
1462 $n++;
1463 for (; ($n % $tabsize) != 0; $n++) {
1464 $res .= ' ';
1465 }
1466 next;
1467 }
1468 $res .= $c;
1469 $n++;
1470 }
1471
1472 return $res;
1473 }
1474 sub copy_spacing {
1475 (my $res = shift) =~ tr/\t/ /c;
1476 return $res;
1477 }
1478
1479 sub line_stats {
1480 my ($line) = @_;
1481
1482 # Drop the diff line leader and expand tabs
1483 $line =~ s/^.//;
1484 $line = expand_tabs($line);
1485
1486 # Pick the indent from the front of the line.
1487 my ($white) = ($line =~ /^(\s*)/);
1488
1489 return (length($line), length($white));
1490 }
1491
1492 my $sanitise_quote = '';
1493
1494 sub sanitise_line_reset {
1495 my ($in_comment) = @_;
1496
1497 if ($in_comment) {
1498 $sanitise_quote = '*/';
1499 } else {
1500 $sanitise_quote = '';
1501 }
1502 }
1503 sub sanitise_line {
1504 my ($line) = @_;
1505
1506 my $res = '';
1507 my $l = '';
1508
1509 my $qlen = 0;
1510 my $off = 0;
1511 my $c;
1512
1513 # Always copy over the diff marker.
1514 $res = substr($line, 0, 1);
1515
1516 for ($off = 1; $off < length($line); $off++) {
1517 $c = substr($line, $off, 1);
1518
1519 # Comments we are whacking completely including the begin
1520 # and end, all to $;.
1521 if ($sanitise_quote eq '' && substr($line, $off, 2) eq '/*') {
1522 $sanitise_quote = '*/';
1523
1524 substr($res, $off, 2, "$;$;");
1525 $off++;
1526 next;
1527 }
1528 if ($sanitise_quote eq '*/' && substr($line, $off, 2) eq '*/') {
1529 $sanitise_quote = '';
1530 substr($res, $off, 2, "$;$;");
1531 $off++;
1532 next;
1533 }
1534 if ($sanitise_quote eq '' && substr($line, $off, 2) eq '//') {
1535 $sanitise_quote = '//';
1536
1537 substr($res, $off, 2, $sanitise_quote);
1538 $off++;
1539 next;
1540 }
1541
1542 # A \ in a string means ignore the next character.
1543 if (($sanitise_quote eq "'" || $sanitise_quote eq '"') &&
1544 $c eq "\\") {
1545 substr($res, $off, 2, 'XX');
1546 $off++;
1547 next;
1548 }
1549 # Regular quotes.
1550 if ($c eq "'" || $c eq '"') {
1551 if ($sanitise_quote eq '') {
1552 $sanitise_quote = $c;
1553
1554 substr($res, $off, 1, $c);
1555 next;
1556 } elsif ($sanitise_quote eq $c) {
1557 $sanitise_quote = '';
1558 }
1559 }
1560
1561 #print "c<$c> SQ<$sanitise_quote>\n";
1562 if ($off != 0 && $sanitise_quote eq '*/' && $c ne "\t") {
1563 substr($res, $off, 1, $;);
1564 } elsif ($off != 0 && $sanitise_quote eq '//' && $c ne "\t") {
1565 substr($res, $off, 1, $;);
1566 } elsif ($off != 0 && $sanitise_quote && $c ne "\t") {
1567 substr($res, $off, 1, 'X');
1568 } else {
1569 substr($res, $off, 1, $c);
1570 }
1571 }
1572
1573 if ($sanitise_quote eq '//') {
1574 $sanitise_quote = '';
1575 }
1576
1577 # The pathname on a #include may be surrounded by '<' and '>'.
1578 if ($res =~ /^.\s*\#\s*include\s+\<(.*)\>/) {
1579 my $clean = 'X' x length($1);
1580 $res =~ s@\<.*\>@<$clean>@;
1581
1582 # The whole of a #error is a string.
1583 } elsif ($res =~ /^.\s*\#\s*(?:error|warning)\s+(.*)\b/) {
1584 my $clean = 'X' x length($1);
1585 $res =~ s@(\#\s*(?:error|warning)\s+).*@$1$clean@;
1586 }
1587
1588 if ($allow_c99_comments && $res =~ m@(//.*$)@) {
1589 my $match = $1;
1590 $res =~ s/\Q$match\E/"$;" x length($match)/e;
1591 }
1592
1593 return $res;
1594 }
1595
1596 sub get_quoted_string {
1597 my ($line, $rawline) = @_;
1598
1599 return "" if (!defined($line) || !defined($rawline));
1600 return "" if ($line !~ m/($String)/g);
1601 return substr($rawline, $-[0], $+[0] - $-[0]);
1602 }
1603
1604 sub ctx_statement_block {
1605 my ($linenr, $remain, $off) = @_;
1606 my $line = $linenr - 1;
1607 my $blk = '';
1608 my $soff = $off;
1609 my $coff = $off - 1;
1610 my $coff_set = 0;
1611
1612 my $loff = 0;
1613
1614 my $type = '';
1615 my $level = 0;
1616 my @stack = ();
1617 my $p;
1618 my $c;
1619 my $len = 0;
1620
1621 my $remainder;
1622 while (1) {
1623 @stack = (['', 0]) if ($#stack == -1);
1624
1625 #warn "CSB: blk<$blk> remain<$remain>\n";
1626 # If we are about to drop off the end, pull in more
1627 # context.
1628 if ($off >= $len) {
1629 for (; $remain > 0; $line++) {
1630 last if (!defined $lines[$line]);
1631 next if ($lines[$line] =~ /^-/);
1632 $remain--;
1633 $loff = $len;
1634 $blk .= $lines[$line] . "\n";
1635 $len = length($blk);
1636 $line++;
1637 last;
1638 }
1639 # Bail if there is no further context.
1640 #warn "CSB: blk<$blk> off<$off> len<$len>\n";
1641 if ($off >= $len) {
1642 last;
1643 }
1644 if ($level == 0 && substr($blk, $off) =~ /^.\s*#\s*define/) {
1645 $level++;
1646 $type = '#';
1647 }
1648 }
1649 $p = $c;
1650 $c = substr($blk, $off, 1);
1651 $remainder = substr($blk, $off);
1652
1653 #warn "CSB: c<$c> type<$type> level<$level> remainder<$remainder> coff_set<$coff_set>\n";
1654
1655 # Handle nested #if/#else.
1656 if ($remainder =~ /^#\s*(?:ifndef|ifdef|if)\s/) {
1657 push(@stack, [ $type, $level ]);
1658 } elsif ($remainder =~ /^#\s*(?:else|elif)\b/) {
1659 ($type, $level) = @{$stack[$#stack - 1]};
1660 } elsif ($remainder =~ /^#\s*endif\b/) {
1661 ($type, $level) = @{pop(@stack)};
1662 }
1663
1664 # Statement ends at the ';' or a close '}' at the
1665 # outermost level.
1666 if ($level == 0 && $c eq ';') {
1667 last;
1668 }
1669
1670 # An else is really a conditional as long as its not else if
1671 if ($level == 0 && $coff_set == 0 &&
1672 (!defined($p) || $p =~ /(?:\s|\}|\+)/) &&
1673 $remainder =~ /^(else)(?:\s|{)/ &&
1674 $remainder !~ /^else\s+if\b/) {
1675 $coff = $off + length($1) - 1;
1676 $coff_set = 1;
1677 #warn "CSB: mark coff<$coff> soff<$soff> 1<$1>\n";
1678 #warn "[" . substr($blk, $soff, $coff - $soff + 1) . "]\n";
1679 }
1680
1681 if (($type eq '' || $type eq '(') && $c eq '(') {
1682 $level++;
1683 $type = '(';
1684 }
1685 if ($type eq '(' && $c eq ')') {
1686 $level--;
1687 $type = ($level != 0)? '(' : '';
1688
1689 if ($level == 0 && $coff < $soff) {
1690 $coff = $off;
1691 $coff_set = 1;
1692 #warn "CSB: mark coff<$coff>\n";
1693 }
1694 }
1695 if (($type eq '' || $type eq '{') && $c eq '{') {
1696 $level++;
1697 $type = '{';
1698 }
1699 if ($type eq '{' && $c eq '}') {
1700 $level--;
1701 $type = ($level != 0)? '{' : '';
1702
1703 if ($level == 0) {
1704 if (substr($blk, $off + 1, 1) eq ';') {
1705 $off++;
1706 }
1707 last;
1708 }
1709 }
1710 # Preprocessor commands end at the newline unless escaped.
1711 if ($type eq '#' && $c eq "\n" && $p ne "\\") {
1712 $level--;
1713 $type = '';
1714 $off++;
1715 last;
1716 }
1717 $off++;
1718 }
1719 # We are truly at the end, so shuffle to the next line.
1720 if ($off == $len) {
1721 $loff = $len + 1;
1722 $line++;
1723 $remain--;
1724 }
1725
1726 my $statement = substr($blk, $soff, $off - $soff + 1);
1727 my $condition = substr($blk, $soff, $coff - $soff + 1);
1728
1729 #warn "STATEMENT<$statement>\n";
1730 #warn "CONDITION<$condition>\n";
1731
1732 #print "coff<$coff> soff<$off> loff<$loff>\n";
1733
1734 return ($statement, $condition,
1735 $line, $remain + 1, $off - $loff + 1, $level);
1736 }
1737
1738 sub statement_lines {
1739 my ($stmt) = @_;
1740
1741 # Strip the diff line prefixes and rip blank lines at start and end.
1742 $stmt =~ s/(^|\n)./$1/g;
1743 $stmt =~ s/^\s*//;
1744 $stmt =~ s/\s*$//;
1745
1746 my @stmt_lines = ($stmt =~ /\n/g);
1747
1748 return $#stmt_lines + 2;
1749 }
1750
1751 sub statement_rawlines {
1752 my ($stmt) = @_;
1753
1754 my @stmt_lines = ($stmt =~ /\n/g);
1755
1756 return $#stmt_lines + 2;
1757 }
1758
1759 sub statement_block_size {
1760 my ($stmt) = @_;
1761
1762 $stmt =~ s/(^|\n)./$1/g;
1763 $stmt =~ s/^\s*{//;
1764 $stmt =~ s/}\s*$//;
1765 $stmt =~ s/^\s*//;
1766 $stmt =~ s/\s*$//;
1767
1768 my @stmt_lines = ($stmt =~ /\n/g);
1769 my @stmt_statements = ($stmt =~ /;/g);
1770
1771 my $stmt_lines = $#stmt_lines + 2;
1772 my $stmt_statements = $#stmt_statements + 1;
1773
1774 if ($stmt_lines > $stmt_statements) {
1775 return $stmt_lines;
1776 } else {
1777 return $stmt_statements;
1778 }
1779 }
1780
1781 sub ctx_statement_full {
1782 my ($linenr, $remain, $off) = @_;
1783 my ($statement, $condition, $level);
1784
1785 my (@chunks);
1786
1787 # Grab the first conditional/block pair.
1788 ($statement, $condition, $linenr, $remain, $off, $level) =
1789 ctx_statement_block($linenr, $remain, $off);
1790 #print "F: c<$condition> s<$statement> remain<$remain>\n";
1791 push(@chunks, [ $condition, $statement ]);
1792 if (!($remain > 0 && $condition =~ /^\s*(?:\n[+-])?\s*(?:if|else|do)\b/s)) {
1793 return ($level, $linenr, @chunks);
1794 }
1795
1796 # Pull in the following conditional/block pairs and see if they
1797 # could continue the statement.
1798 for (;;) {
1799 ($statement, $condition, $linenr, $remain, $off, $level) =
1800 ctx_statement_block($linenr, $remain, $off);
1801 #print "C: c<$condition> s<$statement> remain<$remain>\n";
1802 last if (!($remain > 0 && $condition =~ /^(?:\s*\n[+-])*\s*(?:else|do)\b/s));
1803 #print "C: push\n";
1804 push(@chunks, [ $condition, $statement ]);
1805 }
1806
1807 return ($level, $linenr, @chunks);
1808 }
1809
1810 sub ctx_block_get {
1811 my ($linenr, $remain, $outer, $open, $close, $off) = @_;
1812 my $line;
1813 my $start = $linenr - 1;
1814 my $blk = '';
1815 my @o;
1816 my @c;
1817 my @res = ();
1818
1819 my $level = 0;
1820 my @stack = ($level);
1821 for ($line = $start; $remain > 0; $line++) {
1822 next if ($rawlines[$line] =~ /^-/);
1823 $remain--;
1824
1825 $blk .= $rawlines[$line];
1826
1827 # Handle nested #if/#else.
1828 if ($lines[$line] =~ /^.\s*#\s*(?:ifndef|ifdef|if)\s/) {
1829 push(@stack, $level);
1830 } elsif ($lines[$line] =~ /^.\s*#\s*(?:else|elif)\b/) {
1831 $level = $stack[$#stack - 1];
1832 } elsif ($lines[$line] =~ /^.\s*#\s*endif\b/) {
1833 $level = pop(@stack);
1834 }
1835
1836 foreach my $c (split(//, $lines[$line])) {
1837 ##print "C<$c>L<$level><$open$close>O<$off>\n";
1838 if ($off > 0) {
1839 $off--;
1840 next;
1841 }
1842
1843 if ($c eq $close && $level > 0) {
1844 $level--;
1845 last if ($level == 0);
1846 } elsif ($c eq $open) {
1847 $level++;
1848 }
1849 }
1850
1851 if (!$outer || $level <= 1) {
1852 push(@res, $rawlines[$line]);
1853 }
1854
1855 last if ($level == 0);
1856 }
1857
1858 return ($level, @res);
1859 }
1860 sub ctx_block_outer {
1861 my ($linenr, $remain) = @_;
1862
1863 my ($level, @r) = ctx_block_get($linenr, $remain, 1, '{', '}', 0);
1864 return @r;
1865 }
1866 sub ctx_block {
1867 my ($linenr, $remain) = @_;
1868
1869 my ($level, @r) = ctx_block_get($linenr, $remain, 0, '{', '}', 0);
1870 return @r;
1871 }
1872 sub ctx_statement {
1873 my ($linenr, $remain, $off) = @_;
1874
1875 my ($level, @r) = ctx_block_get($linenr, $remain, 0, '(', ')', $off);
1876 return @r;
1877 }
1878 sub ctx_block_level {
1879 my ($linenr, $remain) = @_;
1880
1881 return ctx_block_get($linenr, $remain, 0, '{', '}', 0);
1882 }
1883 sub ctx_statement_level {
1884 my ($linenr, $remain, $off) = @_;
1885
1886 return ctx_block_get($linenr, $remain, 0, '(', ')', $off);
1887 }
1888
1889 sub ctx_locate_comment {
1890 my ($first_line, $end_line) = @_;
1891
1892 # If c99 comment on the current line, or the line before or after
1893 my ($current_comment) = ($rawlines[$end_line - 1] =~ m@^\+.*(//.*$)@);
1894 return $current_comment if (defined $current_comment);
1895 ($current_comment) = ($rawlines[$end_line - 2] =~ m@^[\+ ].*(//.*$)@);
1896 return $current_comment if (defined $current_comment);
1897 ($current_comment) = ($rawlines[$end_line] =~ m@^[\+ ].*(//.*$)@);
1898 return $current_comment if (defined $current_comment);
1899
1900 # Catch a comment on the end of the line itself.
1901 ($current_comment) = ($rawlines[$end_line - 1] =~ m@.*(/\*.*\*/)\s*(?:\\\s*)?$@);
1902 return $current_comment if (defined $current_comment);
1903
1904 # Look through the context and try and figure out if there is a
1905 # comment.
1906 my $in_comment = 0;
1907 $current_comment = '';
1908 for (my $linenr = $first_line; $linenr < $end_line; $linenr++) {
1909 my $line = $rawlines[$linenr - 1];
1910 #warn " $line\n";
1911 if ($linenr == $first_line and $line =~ m@^.\s*\*@) {
1912 $in_comment = 1;
1913 }
1914 if ($line =~ m@/\*@) {
1915 $in_comment = 1;
1916 }
1917 if (!$in_comment && $current_comment ne '') {
1918 $current_comment = '';
1919 }
1920 $current_comment .= $line . "\n" if ($in_comment);
1921 if ($line =~ m@\*/@) {
1922 $in_comment = 0;
1923 }
1924 }
1925
1926 chomp($current_comment);
1927 return($current_comment);
1928 }
1929 sub ctx_has_comment {
1930 my ($first_line, $end_line) = @_;
1931 my $cmt = ctx_locate_comment($first_line, $end_line);
1932
1933 ##print "LINE: $rawlines[$end_line - 1 ]\n";
1934 ##print "CMMT: $cmt\n";
1935
1936 return ($cmt ne '');
1937 }
1938
1939 sub raw_line {
1940 my ($linenr, $cnt) = @_;
1941
1942 my $offset = $linenr - 1;
1943 $cnt++;
1944
1945 my $line;
1946 while ($cnt) {
1947 $line = $rawlines[$offset++];
1948 next if (defined($line) && $line =~ /^-/);
1949 $cnt--;
1950 }
1951
1952 return $line;
1953 }
1954
1955 sub get_stat_real {
1956 my ($linenr, $lc) = @_;
1957
1958 my $stat_real = raw_line($linenr, 0);
1959 for (my $count = $linenr + 1; $count <= $lc; $count++) {
1960 $stat_real = $stat_real . "\n" . raw_line($count, 0);
1961 }
1962
1963 return $stat_real;
1964 }
1965
1966 sub get_stat_here {
1967 my ($linenr, $cnt, $here) = @_;
1968
1969 my $herectx = $here . "\n";
1970 for (my $n = 0; $n < $cnt; $n++) {
1971 $herectx .= raw_line($linenr, $n) . "\n";
1972 }
1973
1974 return $herectx;
1975 }
1976
1977 sub cat_vet {
1978 my ($vet) = @_;
1979 my ($res, $coded);
1980
1981 $res = '';
1982 while ($vet =~ /([^[:cntrl:]]*)([[:cntrl:]]|$)/g) {
1983 $res .= $1;
1984 if ($2 ne '') {
1985 $coded = sprintf("^%c", unpack('C', $2) + 64);
1986 $res .= $coded;
1987 }
1988 }
1989 $res =~ s/$/\$/;
1990
1991 return $res;
1992 }
1993
1994 my $av_preprocessor = 0;
1995 my $av_pending;
1996 my @av_paren_type;
1997 my $av_pend_colon;
1998
1999 sub annotate_reset {
2000 $av_preprocessor = 0;
2001 $av_pending = '_';
2002 @av_paren_type = ('E');
2003 $av_pend_colon = 'O';
2004 }
2005
2006 sub annotate_values {
2007 my ($stream, $type) = @_;
2008
2009 my $res;
2010 my $var = '_' x length($stream);
2011 my $cur = $stream;
2012
2013 print "$stream\n" if ($dbg_values > 1);
2014
2015 while (length($cur)) {
2016 @av_paren_type = ('E') if ($#av_paren_type < 0);
2017 print " <" . join('', @av_paren_type) .
2018 "> <$type> <$av_pending>" if ($dbg_values > 1);
2019 if ($cur =~ /^(\s+)/o) {
2020 print "WS($1)\n" if ($dbg_values > 1);
2021 if ($1 =~ /\n/ && $av_preprocessor) {
2022 $type = pop(@av_paren_type);
2023 $av_preprocessor = 0;
2024 }
2025
2026 } elsif ($cur =~ /^(\(\s*$Type\s*)\)/ && $av_pending eq '_') {
2027 print "CAST($1)\n" if ($dbg_values > 1);
2028 push(@av_paren_type, $type);
2029 $type = 'c';
2030
2031 } elsif ($cur =~ /^($Type)\s*(?:$Ident|,|\)|\(|\s*$)/) {
2032 print "DECLARE($1)\n" if ($dbg_values > 1);
2033 $type = 'T';
2034
2035 } elsif ($cur =~ /^($Modifier)\s*/) {
2036 print "MODIFIER($1)\n" if ($dbg_values > 1);
2037 $type = 'T';
2038
2039 } elsif ($cur =~ /^(\#\s*define\s*$Ident)(\(?)/o) {
2040 print "DEFINE($1,$2)\n" if ($dbg_values > 1);
2041 $av_preprocessor = 1;
2042 push(@av_paren_type, $type);
2043 if ($2 ne '') {
2044 $av_pending = 'N';
2045 }
2046 $type = 'E';
2047
2048 } elsif ($cur =~ /^(\#\s*(?:undef\s*$Ident|include\b))/o) {
2049 print "UNDEF($1)\n" if ($dbg_values > 1);
2050 $av_preprocessor = 1;
2051 push(@av_paren_type, $type);
2052
2053 } elsif ($cur =~ /^(\#\s*(?:ifdef|ifndef|if))/o) {
2054 print "PRE_START($1)\n" if ($dbg_values > 1);
2055 $av_preprocessor = 1;
2056
2057 push(@av_paren_type, $type);
2058 push(@av_paren_type, $type);
2059 $type = 'E';
2060
2061 } elsif ($cur =~ /^(\#\s*(?:else|elif))/o) {
2062 print "PRE_RESTART($1)\n" if ($dbg_values > 1);
2063 $av_preprocessor = 1;
2064
2065 push(@av_paren_type, $av_paren_type[$#av_paren_type]);
2066
2067 $type = 'E';
2068
2069 } elsif ($cur =~ /^(\#\s*(?:endif))/o) {
2070 print "PRE_END($1)\n" if ($dbg_values > 1);
2071
2072 $av_preprocessor = 1;
2073
2074 # Assume all arms of the conditional end as this
2075 # one does, and continue as if the #endif was not here.
2076 pop(@av_paren_type);
2077 push(@av_paren_type, $type);
2078 $type = 'E';
2079
2080 } elsif ($cur =~ /^(\\\n)/o) {
2081 print "PRECONT($1)\n" if ($dbg_values > 1);
2082
2083 } elsif ($cur =~ /^(__attribute__)\s*\(?/o) {
2084 print "ATTR($1)\n" if ($dbg_values > 1);
2085 $av_pending = $type;
2086 $type = 'N';
2087
2088 } elsif ($cur =~ /^(sizeof)\s*(\()?/o) {
2089 print "SIZEOF($1)\n" if ($dbg_values > 1);
2090 if (defined $2) {
2091 $av_pending = 'V';
2092 }
2093 $type = 'N';
2094
2095 } elsif ($cur =~ /^(if|while|for)\b/o) {
2096 print "COND($1)\n" if ($dbg_values > 1);
2097 $av_pending = 'E';
2098 $type = 'N';
2099
2100 } elsif ($cur =~/^(case)/o) {
2101 print "CASE($1)\n" if ($dbg_values > 1);
2102 $av_pend_colon = 'C';
2103 $type = 'N';
2104
2105 } elsif ($cur =~/^(return|else|goto|typeof|__typeof__)\b/o) {
2106 print "KEYWORD($1)\n" if ($dbg_values > 1);
2107 $type = 'N';
2108
2109 } elsif ($cur =~ /^(\()/o) {
2110 print "PAREN('$1')\n" if ($dbg_values > 1);
2111 push(@av_paren_type, $av_pending);
2112 $av_pending = '_';
2113 $type = 'N';
2114
2115 } elsif ($cur =~ /^(\))/o) {
2116 my $new_type = pop(@av_paren_type);
2117 if ($new_type ne '_') {
2118 $type = $new_type;
2119 print "PAREN('$1') -> $type\n"
2120 if ($dbg_values > 1);
2121 } else {
2122 print "PAREN('$1')\n" if ($dbg_values > 1);
2123 }
2124
2125 } elsif ($cur =~ /^($Ident)\s*\(/o) {
2126 print "FUNC($1)\n" if ($dbg_values > 1);
2127 $type = 'V';
2128 $av_pending = 'V';
2129
2130 } elsif ($cur =~ /^($Ident\s*):(?:\s*\d+\s*(,|=|;))?/) {
2131 if (defined $2 && $type eq 'C' || $type eq 'T') {
2132 $av_pend_colon = 'B';
2133 } elsif ($type eq 'E') {
2134 $av_pend_colon = 'L';
2135 }
2136 print "IDENT_COLON($1,$type>$av_pend_colon)\n" if ($dbg_values > 1);
2137 $type = 'V';
2138
2139 } elsif ($cur =~ /^($Ident|$Constant)/o) {
2140 print "IDENT($1)\n" if ($dbg_values > 1);
2141 $type = 'V';
2142
2143 } elsif ($cur =~ /^($Assignment)/o) {
2144 print "ASSIGN($1)\n" if ($dbg_values > 1);
2145 $type = 'N';
2146
2147 } elsif ($cur =~/^(;|{|})/) {
2148 print "END($1)\n" if ($dbg_values > 1);
2149 $type = 'E';
2150 $av_pend_colon = 'O';
2151
2152 } elsif ($cur =~/^(,)/) {
2153 print "COMMA($1)\n" if ($dbg_values > 1);
2154 $type = 'C';
2155
2156 } elsif ($cur =~ /^(\?)/o) {
2157 print "QUESTION($1)\n" if ($dbg_values > 1);
2158 $type = 'N';
2159
2160 } elsif ($cur =~ /^(:)/o) {
2161 print "COLON($1,$av_pend_colon)\n" if ($dbg_values > 1);
2162
2163 substr($var, length($res), 1, $av_pend_colon);
2164 if ($av_pend_colon eq 'C' || $av_pend_colon eq 'L') {
2165 $type = 'E';
2166 } else {
2167 $type = 'N';
2168 }
2169 $av_pend_colon = 'O';
2170
2171 } elsif ($cur =~ /^(\[)/o) {
2172 print "CLOSE($1)\n" if ($dbg_values > 1);
2173 $type = 'N';
2174
2175 } elsif ($cur =~ /^(-(?![->])|\+(?!\+)|\*|\&\&|\&)/o) {
2176 my $variant;
2177
2178 print "OPV($1)\n" if ($dbg_values > 1);
2179 if ($type eq 'V') {
2180 $variant = 'B';
2181 } else {
2182 $variant = 'U';
2183 }
2184
2185 substr($var, length($res), 1, $variant);
2186 $type = 'N';
2187
2188 } elsif ($cur =~ /^($Operators)/o) {
2189 print "OP($1)\n" if ($dbg_values > 1);
2190 if ($1 ne '++' && $1 ne '--') {
2191 $type = 'N';
2192 }
2193
2194 } elsif ($cur =~ /(^.)/o) {
2195 print "C($1)\n" if ($dbg_values > 1);
2196 }
2197 if (defined $1) {
2198 $cur = substr($cur, length($1));
2199 $res .= $type x length($1);
2200 }
2201 }
2202
2203 return ($res, $var);
2204 }
2205
2206 sub possible {
2207 my ($possible, $line) = @_;
2208 my $notPermitted = qr{(?:
2209 ^(?:
2210 $Modifier|
2211 $Storage|
2212 $Type|
2213 DEFINE_\S+
2214 )$|
2215 ^(?:
2216 goto|
2217 return|
2218 case|
2219 else|
2220 asm|__asm__|
2221 do|
2222 \#|
2223 \#\#|
2224 )(?:\s|$)|
2225 ^(?:typedef|struct|enum)\b
2226 )}x;
2227 warn "CHECK<$possible> ($line)\n" if ($dbg_possible > 2);
2228 if ($possible !~ $notPermitted) {
2229 # Check for modifiers.
2230 $possible =~ s/\s*$Storage\s*//g;
2231 $possible =~ s/\s*$Sparse\s*//g;
2232 if ($possible =~ /^\s*$/) {
2233
2234 } elsif ($possible =~ /\s/) {
2235 $possible =~ s/\s*$Type\s*//g;
2236 for my $modifier (split(' ', $possible)) {
2237 if ($modifier !~ $notPermitted) {
2238 warn "MODIFIER: $modifier ($possible) ($line)\n" if ($dbg_possible);
2239 push(@modifierListFile, $modifier);
2240 }
2241 }
2242
2243 } else {
2244 warn "POSSIBLE: $possible ($line)\n" if ($dbg_possible);
2245 push(@typeListFile, $possible);
2246 }
2247 build_types();
2248 } else {
2249 warn "NOTPOSS: $possible ($line)\n" if ($dbg_possible > 1);
2250 }
2251 }
2252
2253 my $prefix = '';
2254
2255 sub show_type {
2256 my ($type) = @_;
2257
2258 $type =~ tr/[a-z]/[A-Z]/;
2259
2260 return defined $use_type{$type} if (scalar keys %use_type > 0);
2261
2262 return !defined $ignore_type{$type};
2263 }
2264
2265 sub report {
2266 my ($level, $type, $msg) = @_;
2267
2268 if (!show_type($type) ||
2269 (defined $tst_only && $msg !~ /\Q$tst_only\E/)) {
2270 return 0;
2271 }
2272 my $output = '';
2273 if ($color) {
2274 if ($level eq 'ERROR') {
2275 $output .= RED;
2276 } elsif ($level eq 'WARNING') {
2277 $output .= YELLOW;
2278 } else {
2279 $output .= GREEN;
2280 }
2281 }
2282 $output .= $prefix . $level . ':';
2283 if ($show_types) {
2284 $output .= BLUE if ($color);
2285 $output .= "$type:";
2286 }
2287 $output .= RESET if ($color);
2288 $output .= ' ' . $msg . "\n";
2289
2290 if ($showfile) {
2291 my @lines = split("\n", $output, -1);
2292 splice(@lines, 1, 1);
2293 $output = join("\n", @lines);
2294 }
2295
2296 if ($terse) {
2297 $output = (split('\n', $output))[0] . "\n";
2298 }
2299
2300 if ($verbose && exists($verbose_messages{$type}) &&
2301 !exists($verbose_emitted{$type})) {
2302 $output .= $verbose_messages{$type} . "\n\n";
2303 $verbose_emitted{$type} = 1;
2304 }
2305
2306 push(our @report, $output);
2307
2308 return 1;
2309 }
2310
2311 sub report_dump {
2312 our @report;
2313 }
2314
2315 sub fixup_current_range {
2316 my ($lineRef, $offset, $length) = @_;
2317
2318 if ($$lineRef =~ /^\@\@ -\d+,\d+ \+(\d+),(\d+) \@\@/) {
2319 my $o = $1;
2320 my $l = $2;
2321 my $no = $o + $offset;
2322 my $nl = $l + $length;
2323 $$lineRef =~ s/\+$o,$l \@\@/\+$no,$nl \@\@/;
2324 }
2325 }
2326
2327 sub fix_inserted_deleted_lines {
2328 my ($linesRef, $insertedRef, $deletedRef) = @_;
2329
2330 my $range_last_linenr = 0;
2331 my $delta_offset = 0;
2332
2333 my $old_linenr = 0;
2334 my $new_linenr = 0;
2335
2336 my $next_insert = 0;
2337 my $next_delete = 0;
2338
2339 my @lines = ();
2340
2341 my $inserted = @{$insertedRef}[$next_insert++];
2342 my $deleted = @{$deletedRef}[$next_delete++];
2343
2344 foreach my $old_line (@{$linesRef}) {
2345 my $save_line = 1;
2346 my $line = $old_line; #don't modify the array
2347 if ($line =~ /^(?:\+\+\+|\-\-\-)\s+\S+/) { #new filename
2348 $delta_offset = 0;
2349 } elsif ($line =~ /^\@\@ -\d+,\d+ \+\d+,\d+ \@\@/) { #new hunk
2350 $range_last_linenr = $new_linenr;
2351 fixup_current_range(\$line, $delta_offset, 0);
2352 }
2353
2354 while (defined($deleted) && ${$deleted}{'LINENR'} == $old_linenr) {
2355 $deleted = @{$deletedRef}[$next_delete++];
2356 $save_line = 0;
2357 fixup_current_range(\$lines[$range_last_linenr], $delta_offset--, -1);
2358 }
2359
2360 while (defined($inserted) && ${$inserted}{'LINENR'} == $old_linenr) {
2361 push(@lines, ${$inserted}{'LINE'});
2362 $inserted = @{$insertedRef}[$next_insert++];
2363 $new_linenr++;
2364 fixup_current_range(\$lines[$range_last_linenr], $delta_offset++, 1);
2365 }
2366
2367 if ($save_line) {
2368 push(@lines, $line);
2369 $new_linenr++;
2370 }
2371
2372 $old_linenr++;
2373 }
2374
2375 return @lines;
2376 }
2377
2378 sub fix_insert_line {
2379 my ($linenr, $line) = @_;
2380
2381 my $inserted = {
2382 LINENR => $linenr,
2383 LINE => $line,
2384 };
2385 push(@fixed_inserted, $inserted);
2386 }
2387
2388 sub fix_delete_line {
2389 my ($linenr, $line) = @_;
2390
2391 my $deleted = {
2392 LINENR => $linenr,
2393 LINE => $line,
2394 };
2395
2396 push(@fixed_deleted, $deleted);
2397 }
2398
2399 sub ERROR {
2400 my ($type, $msg) = @_;
2401
2402 if (report("ERROR", $type, $msg)) {
2403 our $clean = 0;
2404 our $cnt_error++;
2405 return 1;
2406 }
2407 return 0;
2408 }
2409 sub WARN {
2410 my ($type, $msg) = @_;
2411
2412 if (report("WARNING", $type, $msg)) {
2413 our $clean = 0;
2414 our $cnt_warn++;
2415 return 1;
2416 }
2417 return 0;
2418 }
2419 sub CHK {
2420 my ($type, $msg) = @_;
2421
2422 if ($check && report("CHECK", $type, $msg)) {
2423 our $clean = 0;
2424 our $cnt_chk++;
2425 return 1;
2426 }
2427 return 0;
2428 }
2429
2430 sub check_absolute_file {
2431 my ($absolute, $herecurr) = @_;
2432 my $file = $absolute;
2433
2434 ##print "absolute<$absolute>\n";
2435
2436 # See if any suffix of this path is a path within the tree.
2437 while ($file =~ s@^[^/]*/@@) {
2438 if (-f "$root/$file") {
2439 ##print "file<$file>\n";
2440 last;
2441 }
2442 }
2443 if (! -f _) {
2444 return 0;
2445 }
2446
2447 # It is, so see if the prefix is acceptable.
2448 my $prefix = $absolute;
2449 substr($prefix, -length($file)) = '';
2450
2451 ##print "prefix<$prefix>\n";
2452 if ($prefix ne ".../") {
2453 WARN("USE_RELATIVE_PATH",
2454 "use relative pathname instead of absolute in changelog text\n" . $herecurr);
2455 }
2456 }
2457
2458 sub trim {
2459 my ($string) = @_;
2460
2461 $string =~ s/^\s+|\s+$//g;
2462
2463 return $string;
2464 }
2465
2466 sub ltrim {
2467 my ($string) = @_;
2468
2469 $string =~ s/^\s+//;
2470
2471 return $string;
2472 }
2473
2474 sub rtrim {
2475 my ($string) = @_;
2476
2477 $string =~ s/\s+$//;
2478
2479 return $string;
2480 }
2481
2482 sub string_find_replace {
2483 my ($string, $find, $replace) = @_;
2484
2485 $string =~ s/$find/$replace/g;
2486
2487 return $string;
2488 }
2489
2490 sub tabify {
2491 my ($leading) = @_;
2492
2493 my $source_indent = $tabsize;
2494 my $max_spaces_before_tab = $source_indent - 1;
2495 my $spaces_to_tab = " " x $source_indent;
2496
2497 #convert leading spaces to tabs
2498 1 while $leading =~ s@^([\t]*)$spaces_to_tab@$1\t@g;
2499 #Remove spaces before a tab
2500 1 while $leading =~ s@^([\t]*)( {1,$max_spaces_before_tab})\t@$1\t@g;
2501
2502 return "$leading";
2503 }
2504
2505 sub pos_last_openparen {
2506 my ($line) = @_;
2507
2508 my $pos = 0;
2509
2510 my $opens = $line =~ tr/\(/\(/;
2511 my $closes = $line =~ tr/\)/\)/;
2512
2513 my $last_openparen = 0;
2514
2515 if (($opens == 0) || ($closes >= $opens)) {
2516 return -1;
2517 }
2518
2519 my $len = length($line);
2520
2521 for ($pos = 0; $pos < $len; $pos++) {
2522 my $string = substr($line, $pos);
2523 if ($string =~ /^($FuncArg|$balanced_parens)/) {
2524 $pos += length($1) - 1;
2525 } elsif (substr($line, $pos, 1) eq '(') {
2526 $last_openparen = $pos;
2527 } elsif (index($string, '(') == -1) {
2528 last;
2529 }
2530 }
2531
2532 return length(expand_tabs(substr($line, 0, $last_openparen))) + 1;
2533 }
2534
2535 sub get_raw_comment {
2536 my ($line, $rawline) = @_;
2537 my $comment = '';
2538
2539 for my $i (0 .. (length($line) - 1)) {
2540 if (substr($line, $i, 1) eq "$;") {
2541 $comment .= substr($rawline, $i, 1);
2542 }
2543 }
2544
2545 return $comment;
2546 }
2547
2548 sub exclude_global_initialisers {
2549 my ($realfile) = @_;
2550
2551 # Do not check for BPF programs (tools/testing/selftests/bpf/progs/*.c, samples/bpf/*_kern.c, *.bpf.c).
2552 return $realfile =~ m@^tools/testing/selftests/bpf/progs/.*\.c$@ ||
2553 $realfile =~ m@^samples/bpf/.*_kern\.c$@ ||
2554 $realfile =~ m@/bpf/.*\.bpf\.c$@;
2555 }
2556
2557 sub process {
2558 my $filename = shift;
2559
2560 my $linenr=0;
2561 my $prevline="";
2562 my $prevrawline="";
2563 my $stashline="";
2564 my $stashrawline="";
2565
2566 my $length;
2567 my $indent;
2568 my $previndent=0;
2569 my $stashindent=0;
2570
2571 our $clean = 1;
2572 my $signoff = 0;
2573 my $author = '';
2574 my $authorsignoff = 0;
2575 my $author_sob = '';
2576 my $is_patch = 0;
2577 my $is_binding_patch = -1;
2578 my $in_header_lines = $file ? 0 : 1;
2579 my $in_commit_log = 0; #Scanning lines before patch
2580 my $has_patch_separator = 0; #Found a --- line
2581 my $has_commit_log = 0; #Encountered lines before patch
2582 my $commit_log_lines = 0; #Number of commit log lines
2583 my $commit_log_possible_stack_dump = 0;
2584 my $commit_log_long_line = 0;
2585 my $commit_log_has_diff = 0;
2586 my $reported_maintainer_file = 0;
2587 my $non_utf8_charset = 0;
2588
2589 my $last_blank_line = 0;
2590 my $last_coalesced_string_linenr = -1;
2591
2592 our @report = ();
2593 our $cnt_lines = 0;
2594 our $cnt_error = 0;
2595 our $cnt_warn = 0;
2596 our $cnt_chk = 0;
2597
2598 # Trace the real file/line as we go.
2599 my $realfile = '';
2600 my $realline = 0;
2601 my $realcnt = 0;
2602 my $here = '';
2603 my $context_function; #undef'd unless there's a known function
2604 my $in_comment = 0;
2605 my $comment_edge = 0;
2606 my $first_line = 0;
2607 my $p1_prefix = '';
2608
2609 my $prev_values = 'E';
2610
2611 # suppression flags
2612 my %suppress_ifbraces;
2613 my %suppress_whiletrailers;
2614 my %suppress_export;
2615 my $suppress_statement = 0;
2616
2617 my %signatures = ();
2618
2619 # Pre-scan the patch sanitizing the lines.
2620 # Pre-scan the patch looking for any __setup documentation.
2621 #
2622 my @setup_docs = ();
2623 my $setup_docs = 0;
2624
2625 my $camelcase_file_seeded = 0;
2626
2627 my $checklicenseline = 1;
2628
2629 sanitise_line_reset();
2630 my $line;
2631 foreach my $rawline (@rawlines) {
2632 $linenr++;
2633 $line = $rawline;
2634
2635 push(@fixed, $rawline) if ($fix);
2636
2637 if ($rawline=~/^\+\+\+\s+(\S+)/) {
2638 $setup_docs = 0;
2639 if ($1 =~ m@Documentation/admin-guide/kernel-parameters.txt$@) {
2640 $setup_docs = 1;
2641 }
2642 #next;
2643 }
2644 if ($rawline =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@/) {
2645 $realline=$1-1;
2646 if (defined $2) {
2647 $realcnt=$3+1;
2648 } else {
2649 $realcnt=1+1;
2650 }
2651 $in_comment = 0;
2652
2653 # Guestimate if this is a continuing comment. Run
2654 # the context looking for a comment "edge". If this
2655 # edge is a close comment then we must be in a comment
2656 # at context start.
2657 my $edge;
2658 my $cnt = $realcnt;
2659 for (my $ln = $linenr + 1; $cnt > 0; $ln++) {
2660 next if (defined $rawlines[$ln - 1] &&
2661 $rawlines[$ln - 1] =~ /^-/);
2662 $cnt--;
2663 #print "RAW<$rawlines[$ln - 1]>\n";
2664 last if (!defined $rawlines[$ln - 1]);
2665 if ($rawlines[$ln - 1] =~ m@(/\*|\*/)@ &&
2666 $rawlines[$ln - 1] !~ m@"[^"]*(?:/\*|\*/)[^"]*"@) {
2667 ($edge) = $1;
2668 last;
2669 }
2670 }
2671 if (defined $edge && $edge eq '*/') {
2672 $in_comment = 1;
2673 }
2674
2675 # Guestimate if this is a continuing comment. If this
2676 # is the start of a diff block and this line starts
2677 # ' *' then it is very likely a comment.
2678 if (!defined $edge &&
2679 $rawlines[$linenr] =~ m@^.\s*(?:\*\*+| \*)(?:\s|$)@)
2680 {
2681 $in_comment = 1;
2682 }
2683
2684 ##print "COMMENT:$in_comment edge<$edge> $rawline\n";
2685 sanitise_line_reset($in_comment);
2686
2687 } elsif ($realcnt && $rawline =~ /^(?:\+| |$)/) {
2688 # Standardise the strings and chars within the input to
2689 # simplify matching -- only bother with positive lines.
2690 $line = sanitise_line($rawline);
2691 }
2692 push(@lines, $line);
2693
2694 if ($realcnt > 1) {
2695 $realcnt-- if ($line =~ /^(?:\+| |$)/);
2696 } else {
2697 $realcnt = 0;
2698 }
2699
2700 #print "==>$rawline\n";
2701 #print "-->$line\n";
2702
2703 if ($setup_docs && $line =~ /^\+/) {
2704 push(@setup_docs, $line);
2705 }
2706 }
2707
2708 $prefix = '';
2709
2710 $realcnt = 0;
2711 $linenr = 0;
2712 $fixlinenr = -1;
2713 foreach my $line (@lines) {
2714 $linenr++;
2715 $fixlinenr++;
2716 my $sline = $line; #copy of $line
2717 $sline =~ s/$;/ /g; #with comments as spaces
2718
2719 my $rawline = $rawlines[$linenr - 1];
2720 my $raw_comment = get_raw_comment($line, $rawline);
2721
2722 # check if it's a mode change, rename or start of a patch
2723 if (!$in_commit_log &&
2724 ($line =~ /^ mode change [0-7]+ => [0-7]+ \S+\s*$/ ||
2725 ($line =~ /^rename (?:from|to) \S+\s*$/ ||
2726 $line =~ /^diff --git a\/[\w\/\.\_\-]+ b\/\S+\s*$/))) {
2727 $is_patch = 1;
2728 }
2729
2730 #extract the line range in the file after the patch is applied
2731 if (!$in_commit_log &&
2732 $line =~ /^\@\@ -\d+(?:,\d+)? \+(\d+)(,(\d+))? \@\@(.*)/) {
2733 my $context = $4;
2734 $is_patch = 1;
2735 $first_line = $linenr + 1;
2736 $realline=$1-1;
2737 if (defined $2) {
2738 $realcnt=$3+1;
2739 } else {
2740 $realcnt=1+1;
2741 }
2742 annotate_reset();
2743 $prev_values = 'E';
2744
2745 %suppress_ifbraces = ();
2746 %suppress_whiletrailers = ();
2747 %suppress_export = ();
2748 $suppress_statement = 0;
2749 if ($context =~ /\b(\w+)\s*\(/) {
2750 $context_function = $1;
2751 } else {
2752 undef $context_function;
2753 }
2754 next;
2755
2756 # track the line number as we move through the hunk, note that
2757 # new versions of GNU diff omit the leading space on completely
2758 # blank context lines so we need to count that too.
2759 } elsif ($line =~ /^( |\+|$)/) {
2760 $realline++;
2761 $realcnt-- if ($realcnt != 0);
2762
2763 # Measure the line length and indent.
2764 ($length, $indent) = line_stats($rawline);
2765
2766 # Track the previous line.
2767 ($prevline, $stashline) = ($stashline, $line);
2768 ($previndent, $stashindent) = ($stashindent, $indent);
2769 ($prevrawline, $stashrawline) = ($stashrawline, $rawline);
2770
2771 #warn "line<$line>\n";
2772
2773 } elsif ($realcnt == 1) {
2774 $realcnt--;
2775 }
2776
2777 my $hunk_line = ($realcnt != 0);
2778
2779 $here = "#$linenr: " if (!$file);
2780 $here = "#$realline: " if ($file);
2781
2782 my $found_file = 0;
2783 # extract the filename as it passes
2784 if ($line =~ /^diff --git.*?(\S+)$/) {
2785 $realfile = $1;
2786 $realfile =~ s@^([^/]*)/@@ if (!$file);
2787 $in_commit_log = 0;
2788 $found_file = 1;
2789 } elsif ($line =~ /^\+\+\+\s+(\S+)/) {
2790 $realfile = $1;
2791 $realfile =~ s@^([^/]*)/@@ if (!$file);
2792 $in_commit_log = 0;
2793
2794 $p1_prefix = $1;
2795 if (!$file && $tree && $p1_prefix ne '' &&
2796 -e "$root/$p1_prefix") {
2797 WARN("PATCH_PREFIX",
2798 "patch prefix '$p1_prefix' exists, appears to be a -p0 patch\n");
2799 }
2800
2801 if ($realfile =~ m@^include/asm/@) {
2802 ERROR("MODIFIED_INCLUDE_ASM",
2803 "do not modify files in include/asm, change architecture specific files in include/asm-<architecture>\n" . "$here$rawline\n");
2804 }
2805 $found_file = 1;
2806 }
2807
2808 #make up the handle for any error we report on this line
2809 if ($showfile) {
2810 $prefix = "$realfile:$realline: "
2811 } elsif ($emacs) {
2812 if ($file) {
2813 $prefix = "$filename:$realline: ";
2814 } else {
2815 $prefix = "$filename:$linenr: ";
2816 }
2817 }
2818
2819 if ($found_file) {
2820 if (is_maintained_obsolete($realfile)) {
2821 WARN("OBSOLETE",
2822 "$realfile is marked as 'obsolete' in the MAINTAINERS hierarchy. No unnecessary modifications please.\n");
2823 }
2824 if ($realfile =~ m@^(?:drivers/net/|net/|drivers/staging/)@) {
2825 $check = 1;
2826 } else {
2827 $check = $check_orig;
2828 }
2829 $checklicenseline = 1;
2830
2831 if ($realfile !~ /^MAINTAINERS/) {
2832 my $last_binding_patch = $is_binding_patch;
2833
2834 $is_binding_patch = () = $realfile =~ m@^(?:Documentation/devicetree/|include/dt-bindings/)@;
2835
2836 if (($last_binding_patch != -1) &&
2837 ($last_binding_patch ^ $is_binding_patch)) {
2838 WARN("DT_SPLIT_BINDING_PATCH",
2839 "DT binding docs and includes should be a separate patch. See: Documentation/devicetree/bindings/submitting-patches.rst\n");
2840 }
2841 }
2842
2843 next;
2844 }
2845
2846 $here .= "FILE: $realfile:$realline:" if ($realcnt != 0);
2847
2848 my $hereline = "$here\n$rawline\n";
2849 my $herecurr = "$here\n$rawline\n";
2850 my $hereprev = "$here\n$prevrawline\n$rawline\n";
2851
2852 $cnt_lines++ if ($realcnt != 0);
2853
2854 # Verify the existence of a commit log if appropriate
2855 # 2 is used because a $signature is counted in $commit_log_lines
2856 if ($in_commit_log) {
2857 if ($line !~ /^\s*$/) {
2858 $commit_log_lines++; #could be a $signature
2859 }
2860 } elsif ($has_commit_log && $commit_log_lines < 2) {
2861 WARN("COMMIT_MESSAGE",
2862 "Missing commit description - Add an appropriate one\n");
2863 $commit_log_lines = 2; #warn only once
2864 }
2865
2866 # Check if the commit log has what seems like a diff which can confuse patch
2867 if ($in_commit_log && !$commit_log_has_diff &&
2868 (($line =~ m@^\s+diff\b.*a/([\w/]+)@ &&
2869 $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) ||
2870 $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
2871 $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
2872 ERROR("DIFF_IN_COMMIT_MSG",
2873 "Avoid using diff content in the commit message - patch(1) might not work\n" . $herecurr);
2874 $commit_log_has_diff = 1;
2875 }
2876
2877 # Check for incorrect file permissions
2878 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
2879 my $permhere = $here . "FILE: $realfile\n";
2880 if ($realfile !~ m@scripts/@ &&
2881 $realfile !~ /\.(py|pl|awk|sh)$/) {
2882 ERROR("EXECUTE_PERMISSIONS",
2883 "do not set execute permissions for source files\n" . $permhere);
2884 }
2885 }
2886
2887 # Check the patch for a From:
2888 if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
2889 $author = $1;
2890 my $curline = $linenr;
2891 while(defined($rawlines[$curline]) && ($rawlines[$curline++] =~ /^[ \t]\s*(.*)/)) {
2892 $author .= $1;
2893 }
2894 $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
2895 $author =~ s/"//g;
2896 $author = reformat_email($author);
2897 }
2898
2899 # Check the patch for a signoff:
2900 if ($line =~ /^\s*signed-off-by:\s*(.*)/i) {
2901 $signoff++;
2902 $in_commit_log = 0;
2903 if ($author ne '' && $authorsignoff != 1) {
2904 if (same_email_addresses($1, $author)) {
2905 $authorsignoff = 1;
2906 } else {
2907 my $ctx = $1;
2908 my ($email_name, $email_comment, $email_address, $comment1) = parse_email($ctx);
2909 my ($author_name, $author_comment, $author_address, $comment2) = parse_email($author);
2910
2911 if ($email_address eq $author_address && $email_name eq $author_name) {
2912 $author_sob = $ctx;
2913 $authorsignoff = 2;
2914 } elsif ($email_address eq $author_address) {
2915 $author_sob = $ctx;
2916 $authorsignoff = 3;
2917 } elsif ($email_name eq $author_name) {
2918 $author_sob = $ctx;
2919 $authorsignoff = 4;
2920
2921 my $address1 = $email_address;
2922 my $address2 = $author_address;
2923
2924 if ($address1 =~ /(\S+)\+\S+(\@.*)/) {
2925 $address1 = "$1$2";
2926 }
2927 if ($address2 =~ /(\S+)\+\S+(\@.*)/) {
2928 $address2 = "$1$2";
2929 }
2930 if ($address1 eq $address2) {
2931 $authorsignoff = 5;
2932 }
2933 }
2934 }
2935 }
2936 }
2937
2938 # Check for patch separator
2939 if ($line =~ /^---$/) {
2940 $has_patch_separator = 1;
2941 $in_commit_log = 0;
2942 }
2943
2944 # Check if MAINTAINERS is being updated. If so, there's probably no need to
2945 # emit the "does MAINTAINERS need updating?" message on file add/move/delete
2946 if ($line =~ /^\s*MAINTAINERS\s*\|/) {
2947 $reported_maintainer_file = 1;
2948 }
2949
2950 # Check signature styles
2951 if (!$in_header_lines &&
2952 $line =~ /^(\s*)([a-z0-9_-]+by:|$signature_tags)(\s*)(.*)/i) {
2953 my $space_before = $1;
2954 my $sign_off = $2;
2955 my $space_after = $3;
2956 my $email = $4;
2957 my $ucfirst_sign_off = ucfirst(lc($sign_off));
2958
2959 if ($sign_off !~ /$signature_tags/) {
2960 my $suggested_signature = find_standard_signature($sign_off);
2961 if ($suggested_signature eq "") {
2962 WARN("BAD_SIGN_OFF",
2963 "Non-standard signature: $sign_off\n" . $herecurr);
2964 } else {
2965 if (WARN("BAD_SIGN_OFF",
2966 "Non-standard signature: '$sign_off' - perhaps '$suggested_signature'?\n" . $herecurr) &&
2967 $fix) {
2968 $fixed[$fixlinenr] =~ s/$sign_off/$suggested_signature/;
2969 }
2970 }
2971 }
2972 if (defined $space_before && $space_before ne "") {
2973 if (WARN("BAD_SIGN_OFF",
2974 "Do not use whitespace before $ucfirst_sign_off\n" . $herecurr) &&
2975 $fix) {
2976 $fixed[$fixlinenr] =
2977 "$ucfirst_sign_off $email";
2978 }
2979 }
2980 if ($sign_off =~ /-by:$/i && $sign_off ne $ucfirst_sign_off) {
2981 if (WARN("BAD_SIGN_OFF",
2982 "'$ucfirst_sign_off' is the preferred signature form\n" . $herecurr) &&
2983 $fix) {
2984 $fixed[$fixlinenr] =
2985 "$ucfirst_sign_off $email";
2986 }
2987
2988 }
2989 if (!defined $space_after || $space_after ne " ") {
2990 if (WARN("BAD_SIGN_OFF",
2991 "Use a single space after $ucfirst_sign_off\n" . $herecurr) &&
2992 $fix) {
2993 $fixed[$fixlinenr] =
2994 "$ucfirst_sign_off $email";
2995 }
2996 }
2997
2998 my ($email_name, $name_comment, $email_address, $comment) = parse_email($email);
2999 my $suggested_email = format_email(($email_name, $name_comment, $email_address, $comment));
3000 if ($suggested_email eq "") {
3001 ERROR("BAD_SIGN_OFF",
3002 "Unrecognized email address: '$email'\n" . $herecurr);
3003 } else {
3004 my $dequoted = $suggested_email;
3005 $dequoted =~ s/^"//;
3006 $dequoted =~ s/" </ </;
3007 # Don't force email to have quotes
3008 # Allow just an angle bracketed address
3009 if (!same_email_addresses($email, $suggested_email)) {
3010 if (WARN("BAD_SIGN_OFF",
3011 "email address '$email' might be better as '$suggested_email'\n" . $herecurr) &&
3012 $fix) {
3013 $fixed[$fixlinenr] =~ s/\Q$email\E/$suggested_email/;
3014 }
3015 }
3016
3017 # Address part shouldn't have comments
3018 my $stripped_address = $email_address;
3019 $stripped_address =~ s/\([^\(\)]*\)//g;
3020 if ($email_address ne $stripped_address) {
3021 if (WARN("BAD_SIGN_OFF",
3022 "address part of email should not have comments: '$email_address'\n" . $herecurr) &&
3023 $fix) {
3024 $fixed[$fixlinenr] =~ s/\Q$email_address\E/$stripped_address/;
3025 }
3026 }
3027
3028 # Only one name comment should be allowed
3029 my $comment_count = () = $name_comment =~ /\([^\)]+\)/g;
3030 if ($comment_count > 1) {
3031 WARN("BAD_SIGN_OFF",
3032 "Use a single name comment in email: '$email'\n" . $herecurr);
3033 }
3034
3035
3036 # stable@vger.kernel.org or stable@kernel.org shouldn't
3037 # have an email name. In addition comments should strictly
3038 # begin with a #
3039 if ($email =~ /^.*stable\@(?:vger\.)?kernel\.org/i) {
3040 if (($comment ne "" && $comment !~ /^#.+/) ||
3041 ($email_name ne "")) {
3042 my $cur_name = $email_name;
3043 my $new_comment = $comment;
3044 $cur_name =~ s/[a-zA-Z\s\-\"]+//g;
3045
3046 # Remove brackets enclosing comment text
3047 # and # from start of comments to get comment text
3048 $new_comment =~ s/^\((.*)\)$/$1/;
3049 $new_comment =~ s/^\[(.*)\]$/$1/;
3050 $new_comment =~ s/^[\s\#]+|\s+$//g;
3051
3052 $new_comment = trim("$new_comment $cur_name") if ($cur_name ne $new_comment);
3053 $new_comment = " # $new_comment" if ($new_comment ne "");
3054 my $new_email = "$email_address$new_comment";
3055
3056 if (WARN("BAD_STABLE_ADDRESS_STYLE",
3057 "Invalid email format for stable: '$email', prefer '$new_email'\n" . $herecurr) &&
3058 $fix) {
3059 $fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
3060 }
3061 }
3062 } elsif ($comment ne "" && $comment !~ /^(?:#.+|\(.+\))$/) {
3063 my $new_comment = $comment;
3064
3065 # Extract comment text from within brackets or
3066 # c89 style /*...*/ comments
3067 $new_comment =~ s/^\[(.*)\]$/$1/;
3068 $new_comment =~ s/^\/\*(.*)\*\/$/$1/;
3069
3070 $new_comment = trim($new_comment);
3071 $new_comment =~ s/^[^\w]$//; # Single lettered comment with non word character is usually a typo
3072 $new_comment = "($new_comment)" if ($new_comment ne "");
3073 my $new_email = format_email($email_name, $name_comment, $email_address, $new_comment);
3074
3075 if (WARN("BAD_SIGN_OFF",
3076 "Unexpected content after email: '$email', should be: '$new_email'\n" . $herecurr) &&
3077 $fix) {
3078 $fixed[$fixlinenr] =~ s/\Q$email\E/$new_email/;
3079 }
3080 }
3081 }
3082
3083 # Check for duplicate signatures
3084 my $sig_nospace = $line;
3085 $sig_nospace =~ s/\s//g;
3086 $sig_nospace = lc($sig_nospace);
3087 if (defined $signatures{$sig_nospace}) {
3088 WARN("BAD_SIGN_OFF",
3089 "Duplicate signature\n" . $herecurr);
3090 } else {
3091 $signatures{$sig_nospace} = 1;
3092 }
3093
3094 # Check Co-developed-by: immediately followed by Signed-off-by: with same name and email
3095 if ($sign_off =~ /^co-developed-by:$/i) {
3096 if ($email eq $author) {
3097 WARN("BAD_SIGN_OFF",
3098 "Co-developed-by: should not be used to attribute nominal patch author '$author'\n" . "$here\n" . $rawline);
3099 }
3100 if (!defined $lines[$linenr]) {
3101 WARN("BAD_SIGN_OFF",
3102 "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline);
3103 } elsif ($rawlines[$linenr] !~ /^\s*signed-off-by:\s*(.*)/i) {
3104 WARN("BAD_SIGN_OFF",
3105 "Co-developed-by: must be immediately followed by Signed-off-by:\n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);
3106 } elsif ($1 ne $email) {
3107 WARN("BAD_SIGN_OFF",
3108 "Co-developed-by and Signed-off-by: name/email do not match \n" . "$here\n" . $rawline . "\n" .$rawlines[$linenr]);
3109 }
3110 }
3111 }
3112
3113 # Check email subject for common tools that don't need to be mentioned
3114 if ($in_header_lines &&
3115 $line =~ /^Subject:.*\b(?:checkpatch|sparse|smatch)\b[^:]/i) {
3116 WARN("EMAIL_SUBJECT",
3117 "A patch subject line should describe the change not the tool that found it\n" . $herecurr);
3118 }
3119
3120 # Check for Gerrit Change-Ids not in any patch context
3121 if ($realfile eq '' && !$has_patch_separator && $line =~ /^\s*change-id:/i) {
3122 if (ERROR("GERRIT_CHANGE_ID",
3123 "Remove Gerrit Change-Id's before submitting upstream\n" . $herecurr) &&
3124 $fix) {
3125 fix_delete_line($fixlinenr, $rawline);
3126 }
3127 }
3128
3129 # Check if the commit log is in a possible stack dump
3130 if ($in_commit_log && !$commit_log_possible_stack_dump &&
3131 ($line =~ /^\s*(?:WARNING:|BUG:)/ ||
3132 $line =~ /^\s*\[\s*\d+\.\d{6,6}\s*\]/ ||
3133 # timestamp
3134 $line =~ /^\s*\[\<[0-9a-fA-F]{8,}\>\]/) ||
3135 $line =~ /^(?:\s+\w+:\s+[0-9a-fA-F]+){3,3}/ ||
3136 $line =~ /^\s*\#\d+\s*\[[0-9a-fA-F]+\]\s*\w+ at [0-9a-fA-F]+/) {
3137 # stack dump address styles
3138 $commit_log_possible_stack_dump = 1;
3139 }
3140
3141 # Check for line lengths > 75 in commit log, warn once
3142 if ($in_commit_log && !$commit_log_long_line &&
3143 length($line) > 75 &&
3144 !($line =~ /^\s*[a-zA-Z0-9_\/\.]+\s+\|\s+\d+/ ||
3145 # file delta changes
3146 $line =~ /^\s*(?:[\w\.\-]+\/)++[\w\.\-]+:/ ||
3147 # filename then :
3148 $line =~ /^\s*(?:Fixes:|Link:|$signature_tags)/i ||
3149 # A Fixes: or Link: line or signature tag line
3150 $commit_log_possible_stack_dump)) {
3151 WARN("COMMIT_LOG_LONG_LINE",
3152 "Possible unwrapped commit description (prefer a maximum 75 chars per line)\n" . $herecurr);
3153 $commit_log_long_line = 1;
3154 }
3155
3156 # Reset possible stack dump if a blank line is found
3157 if ($in_commit_log && $commit_log_possible_stack_dump &&
3158 $line =~ /^\s*$/) {
3159 $commit_log_possible_stack_dump = 0;
3160 }
3161
3162 # Check for lines starting with a #
3163 if ($in_commit_log && $line =~ /^#/) {
3164 if (WARN("COMMIT_COMMENT_SYMBOL",
3165 "Commit log lines starting with '#' are dropped by git as comments\n" . $herecurr) &&
3166 $fix) {
3167 $fixed[$fixlinenr] =~ s/^/ /;
3168 }
3169 }
3170
3171 # Check for git id commit length and improperly formed commit descriptions
3172 if ($in_commit_log && !$commit_log_possible_stack_dump &&
3173 $line !~ /^\s*(?:Link|Patchwork|http|https|BugLink|base-commit):/i &&
3174 $line !~ /^This reverts commit [0-9a-f]{7,40}/ &&
3175 ($line =~ /\bcommit\s+[0-9a-f]{5,}\b/i ||
3176 ($line =~ /(?:\s|^)[0-9a-f]{12,40}(?:[\s"'\(\[]|$)/i &&
3177 $line !~ /[\<\[][0-9a-f]{12,40}[\>\]]/i &&
3178 $line !~ /\bfixes:\s*[0-9a-f]{12,40}/i))) {
3179 my $init_char = "c";
3180 my $orig_commit = "";
3181 my $short = 1;
3182 my $long = 0;
3183 my $case = 1;
3184 my $space = 1;
3185 my $hasdesc = 0;
3186 my $hasparens = 0;
3187 my $id = '0123456789ab';
3188 my $orig_desc = "commit description";
3189 my $description = "";
3190
3191 if ($line =~ /\b(c)ommit\s+([0-9a-f]{5,})\b/i) {
3192 $init_char = $1;
3193 $orig_commit = lc($2);
3194 } elsif ($line =~ /\b([0-9a-f]{12,40})\b/i) {
3195 $orig_commit = lc($1);
3196 }
3197
3198 $short = 0 if ($line =~ /\bcommit\s+[0-9a-f]{12,40}/i);
3199 $long = 1 if ($line =~ /\bcommit\s+[0-9a-f]{41,}/i);
3200 $space = 0 if ($line =~ /\bcommit [0-9a-f]/i);
3201 $case = 0 if ($line =~ /\b[Cc]ommit\s+[0-9a-f]{5,40}[^A-F]/);
3202 if ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)"\)/i) {
3203 $orig_desc = $1;
3204 $hasparens = 1;
3205 } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s*$/i &&
3206 defined $rawlines[$linenr] &&
3207 $rawlines[$linenr] =~ /^\s*\("([^"]+)"\)/) {
3208 $orig_desc = $1;
3209 $hasparens = 1;
3210 } elsif ($line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("[^"]+$/i &&
3211 defined $rawlines[$linenr] &&
3212 $rawlines[$linenr] =~ /^\s*[^"]+"\)/) {
3213 $line =~ /\bcommit\s+[0-9a-f]{5,}\s+\("([^"]+)$/i;
3214 $orig_desc = $1;
3215 $rawlines[$linenr] =~ /^\s*([^"]+)"\)/;
3216 $orig_desc .= " " . $1;
3217 $hasparens = 1;
3218 }
3219
3220 ($id, $description) = git_commit_info($orig_commit,
3221 $id, $orig_desc);
3222
3223 if (defined($id) &&
3224 ($short || $long || $space || $case || ($orig_desc ne $description) || !$hasparens)) {
3225 ERROR("GIT_COMMIT_ID",
3226 "Please use git commit description style 'commit <12+ chars of sha1> (\"<title line>\")' - ie: '${init_char}ommit $id (\"$description\")'\n" . $herecurr);
3227 }
3228 }
3229
3230 # Check for added, moved or deleted files
3231 if (!$reported_maintainer_file && !$in_commit_log &&
3232 ($line =~ /^(?:new|deleted) file mode\s*\d+\s*$/ ||
3233 $line =~ /^rename (?:from|to) [\w\/\.\-]+\s*$/ ||
3234 ($line =~ /\{\s*([\w\/\.\-]*)\s*\=\>\s*([\w\/\.\-]*)\s*\}/ &&
3235 (defined($1) || defined($2))))) {
3236 $is_patch = 1;
3237 $reported_maintainer_file = 1;
3238 WARN("FILE_PATH_CHANGES",
3239 "added, moved or deleted file(s), does MAINTAINERS need updating?\n" . $herecurr);
3240 }
3241
3242 # Check for adding new DT bindings not in schema format
3243 if (!$in_commit_log &&
3244 ($line =~ /^new file mode\s*\d+\s*$/) &&
3245 ($realfile =~ m@^Documentation/devicetree/bindings/.*\.txt$@)) {
3246 WARN("DT_SCHEMA_BINDING_PATCH",
3247 "DT bindings should be in DT schema format. See: Documentation/devicetree/bindings/writing-schema.rst\n");
3248 }
3249
3250 # Check for wrappage within a valid hunk of the file
3251 if ($realcnt != 0 && $line !~ m{^(?:\+|-| |\\ No newline|$)}) {
3252 ERROR("CORRUPTED_PATCH",
3253 "patch seems to be corrupt (line wrapped?)\n" .
3254 $herecurr) if (!$emitted_corrupt++);
3255 }
3256
3257 # UTF-8 regex found at http://www.w3.org/International/questions/qa-forms-utf-8.en.php
3258 if (($realfile =~ /^$/ || $line =~ /^\+/) &&
3259 $rawline !~ m/^$UTF8*$/) {
3260 my ($utf8_prefix) = ($rawline =~ /^($UTF8*)/);
3261
3262 my $blank = copy_spacing($rawline);
3263 my $ptr = substr($blank, 0, length($utf8_prefix)) . "^";
3264 my $hereptr = "$hereline$ptr\n";
3265
3266 CHK("INVALID_UTF8",
3267 "Invalid UTF-8, patch and commit message should be encoded in UTF-8\n" . $hereptr);
3268 }
3269
3270 # Check if it's the start of a commit log
3271 # (not a header line and we haven't seen the patch filename)
3272 if ($in_header_lines && $realfile =~ /^$/ &&
3273 !($rawline =~ /^\s+(?:\S|$)/ ||
3274 $rawline =~ /^(?:commit\b|from\b|[\w-]+:)/i)) {
3275 $in_header_lines = 0;
3276 $in_commit_log = 1;
3277 $has_commit_log = 1;
3278 }
3279
3280 # Check if there is UTF-8 in a commit log when a mail header has explicitly
3281 # declined it, i.e defined some charset where it is missing.
3282 if ($in_header_lines &&
3283 $rawline =~ /^Content-Type:.+charset="(.+)".*$/ &&
3284 $1 !~ /utf-8/i) {
3285 $non_utf8_charset = 1;
3286 }
3287
3288 if ($in_commit_log && $non_utf8_charset && $realfile =~ /^$/ &&
3289 $rawline =~ /$NON_ASCII_UTF8/) {
3290 WARN("UTF8_BEFORE_PATCH",
3291 "8-bit UTF-8 used in possible commit log\n" . $herecurr);
3292 }
3293
3294 # Check for absolute kernel paths in commit message
3295 if ($tree && $in_commit_log) {
3296 while ($line =~ m{(?:^|\s)(/\S*)}g) {
3297 my $file = $1;
3298
3299 if ($file =~ m{^(.*?)(?::\d+)+:?$} &&
3300 check_absolute_file($1, $herecurr)) {
3301 #
3302 } else {
3303 check_absolute_file($file, $herecurr);
3304 }
3305 }
3306 }
3307
3308 # Check for various typo / spelling mistakes
3309 if (defined($misspellings) &&
3310 ($in_commit_log || $line =~ /^(?:\+|Subject:)/i)) {
3311 while ($rawline =~ /(?:^|[^\w\-'`])($misspellings)(?:[^\w\-'`]|$)/gi) {
3312 my $typo = $1;
3313 my $blank = copy_spacing($rawline);
3314 my $ptr = substr($blank, 0, $-[1]) . "^" x length($typo);
3315 my $hereptr = "$hereline$ptr\n";
3316 my $typo_fix = $spelling_fix{lc($typo)};
3317 $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
3318 $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
3319 my $msg_level = \&WARN;
3320 $msg_level = \&CHK if ($file);
3321 if (&{$msg_level}("TYPO_SPELLING",
3322 "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $hereptr) &&
3323 $fix) {
3324 $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
3325 }
3326 }
3327 }
3328
3329 # check for invalid commit id
3330 if ($in_commit_log && $line =~ /(^fixes:|\bcommit)\s+([0-9a-f]{6,40})\b/i) {
3331 my $id;
3332 my $description;
3333 ($id, $description) = git_commit_info($2, undef, undef);
3334 if (!defined($id)) {
3335 WARN("UNKNOWN_COMMIT_ID",
3336 "Unknown commit id '$2', maybe rebased or not pulled?\n" . $herecurr);
3337 }
3338 }
3339
3340 # check for repeated words separated by a single space
3341 # avoid false positive from list command eg, '-rw-r--r-- 1 root root'
3342 if (($rawline =~ /^\+/ || $in_commit_log) &&
3343 $rawline !~ /[bcCdDlMnpPs\?-][rwxsStT-]{9}/) {
3344 pos($rawline) = 1 if (!$in_commit_log);
3345 while ($rawline =~ /\b($word_pattern) (?=($word_pattern))/g) {
3346
3347 my $first = $1;
3348 my $second = $2;
3349 my $start_pos = $-[1];
3350 my $end_pos = $+[2];
3351 if ($first =~ /(?:struct|union|enum)/) {
3352 pos($rawline) += length($first) + length($second) + 1;
3353 next;
3354 }
3355
3356 next if (lc($first) ne lc($second));
3357 next if ($first eq 'long');
3358
3359 # check for character before and after the word matches
3360 my $start_char = '';
3361 my $end_char = '';
3362 $start_char = substr($rawline, $start_pos - 1, 1) if ($start_pos > ($in_commit_log ? 0 : 1));
3363 $end_char = substr($rawline, $end_pos, 1) if ($end_pos < length($rawline));
3364
3365 next if ($start_char =~ /^\S$/);
3366 next if (index(" \t.,;?!", $end_char) == -1);
3367
3368 # avoid repeating hex occurrences like 'ff ff fe 09 ...'
3369 if ($first =~ /\b[0-9a-f]{2,}\b/i) {
3370 next if (!exists($allow_repeated_words{lc($first)}));
3371 }
3372
3373 if (WARN("REPEATED_WORD",
3374 "Possible repeated word: '$first'\n" . $herecurr) &&
3375 $fix) {
3376 $fixed[$fixlinenr] =~ s/\b$first $second\b/$first/;
3377 }
3378 }
3379
3380 # if it's a repeated word on consecutive lines in a comment block
3381 if ($prevline =~ /$;+\s*$/ &&
3382 $prevrawline =~ /($word_pattern)\s*$/) {
3383 my $last_word = $1;
3384 if ($rawline =~ /^\+\s*\*\s*$last_word /) {
3385 if (WARN("REPEATED_WORD",
3386 "Possible repeated word: '$last_word'\n" . $hereprev) &&
3387 $fix) {
3388 $fixed[$fixlinenr] =~ s/(\+\s*\*\s*)$last_word /$1/;
3389 }
3390 }
3391 }
3392 }
3393
3394 # ignore non-hunk lines and lines being removed
3395 next if (!$hunk_line || $line =~ /^-/);
3396
3397 #trailing whitespace
3398 if ($line =~ /^\+.*\015/) {
3399 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
3400 if (ERROR("DOS_LINE_ENDINGS",
3401 "DOS line endings\n" . $herevet) &&
3402 $fix) {
3403 $fixed[$fixlinenr] =~ s/[\s\015]+$//;
3404 }
3405 } elsif ($rawline =~ /^\+.*\S\s+$/ || $rawline =~ /^\+\s+$/) {
3406 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
3407 if (ERROR("TRAILING_WHITESPACE",
3408 "trailing whitespace\n" . $herevet) &&
3409 $fix) {
3410 $fixed[$fixlinenr] =~ s/\s+$//;
3411 }
3412
3413 $rpt_cleaners = 1;
3414 }
3415
3416 # Check for FSF mailing addresses.
3417 if ($rawline =~ /\bwrite to the Free/i ||
3418 $rawline =~ /\b675\s+Mass\s+Ave/i ||
3419 $rawline =~ /\b59\s+Temple\s+Pl/i ||
3420 $rawline =~ /\b51\s+Franklin\s+St/i) {
3421 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
3422 my $msg_level = \&ERROR;
3423 $msg_level = \&CHK if ($file);
3424 &{$msg_level}("FSF_MAILING_ADDRESS",
3425 "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet)
3426 }
3427
3428 # check for Kconfig help text having a real description
3429 # Only applies when adding the entry originally, after that we do not have
3430 # sufficient context to determine whether it is indeed long enough.
3431 if ($realfile =~ /Kconfig/ &&
3432 # 'choice' is usually the last thing on the line (though
3433 # Kconfig supports named choices), so use a word boundary
3434 # (\b) rather than a whitespace character (\s)
3435 $line =~ /^\+\s*(?:config|menuconfig|choice)\b/) {
3436 my $length = 0;
3437 my $cnt = $realcnt;
3438 my $ln = $linenr + 1;
3439 my $f;
3440 my $is_start = 0;
3441 my $is_end = 0;
3442 for (; $cnt > 0 && defined $lines[$ln - 1]; $ln++) {
3443 $f = $lines[$ln - 1];
3444 $cnt-- if ($lines[$ln - 1] !~ /^-/);
3445 $is_end = $lines[$ln - 1] =~ /^\+/;
3446
3447 next if ($f =~ /^-/);
3448 last if (!$file && $f =~ /^\@\@/);
3449
3450 if ($lines[$ln - 1] =~ /^\+\s*(?:bool|tristate|prompt)\s*["']/) {
3451 $is_start = 1;
3452 } elsif ($lines[$ln - 1] =~ /^\+\s*(?:---)?help(?:---)?$/) {
3453 $length = -1;
3454 }
3455
3456 $f =~ s/^.//;
3457 $f =~ s/#.*//;
3458 $f =~ s/^\s+//;
3459 next if ($f =~ /^$/);
3460
3461 # This only checks context lines in the patch
3462 # and so hopefully shouldn't trigger false
3463 # positives, even though some of these are
3464 # common words in help texts
3465 if ($f =~ /^\s*(?:config|menuconfig|choice|endchoice|
3466 if|endif|menu|endmenu|source)\b/x) {
3467 $is_end = 1;
3468 last;
3469 }
3470 $length++;
3471 }
3472 if ($is_start && $is_end && $length < $min_conf_desc_length) {
3473 WARN("CONFIG_DESCRIPTION",
3474 "please write a paragraph that describes the config symbol fully\n" . $herecurr);
3475 }
3476 #print "is_start<$is_start> is_end<$is_end> length<$length>\n";
3477 }
3478
3479 # check MAINTAINERS entries
3480 if ($realfile =~ /^MAINTAINERS$/) {
3481 # check MAINTAINERS entries for the right form
3482 if ($rawline =~ /^\+[A-Z]:/ &&
3483 $rawline !~ /^\+[A-Z]:\t\S/) {
3484 if (WARN("MAINTAINERS_STYLE",
3485 "MAINTAINERS entries use one tab after TYPE:\n" . $herecurr) &&
3486 $fix) {
3487 $fixed[$fixlinenr] =~ s/^(\+[A-Z]):\s*/$1:\t/;
3488 }
3489 }
3490 # check MAINTAINERS entries for the right ordering too
3491 my $preferred_order = 'MRLSWQBCPTFXNK';
3492 if ($rawline =~ /^\+[A-Z]:/ &&
3493 $prevrawline =~ /^[\+ ][A-Z]:/) {
3494 $rawline =~ /^\+([A-Z]):\s*(.*)/;
3495 my $cur = $1;
3496 my $curval = $2;
3497 $prevrawline =~ /^[\+ ]([A-Z]):\s*(.*)/;
3498 my $prev = $1;
3499 my $prevval = $2;
3500 my $curindex = index($preferred_order, $cur);
3501 my $previndex = index($preferred_order, $prev);
3502 if ($curindex < 0) {
3503 WARN("MAINTAINERS_STYLE",
3504 "Unknown MAINTAINERS entry type: '$cur'\n" . $herecurr);
3505 } else {
3506 if ($previndex >= 0 && $curindex < $previndex) {
3507 WARN("MAINTAINERS_STYLE",
3508 "Misordered MAINTAINERS entry - list '$cur:' before '$prev:'\n" . $hereprev);
3509 } elsif ((($prev eq 'F' && $cur eq 'F') ||
3510 ($prev eq 'X' && $cur eq 'X')) &&
3511 ($prevval cmp $curval) > 0) {
3512 WARN("MAINTAINERS_STYLE",
3513 "Misordered MAINTAINERS entry - list file patterns in alphabetic order\n" . $hereprev);
3514 }
3515 }
3516 }
3517 }
3518
3519 if (($realfile =~ /Makefile.*/ || $realfile =~ /Kbuild.*/) &&
3520 ($line =~ /\+(EXTRA_[A-Z]+FLAGS).*/)) {
3521 my $flag = $1;
3522 my $replacement = {
3523 'EXTRA_AFLAGS' => 'asflags-y',
3524 'EXTRA_CFLAGS' => 'ccflags-y',
3525 'EXTRA_CPPFLAGS' => 'cppflags-y',
3526 'EXTRA_LDFLAGS' => 'ldflags-y',
3527 };
3528
3529 WARN("DEPRECATED_VARIABLE",
3530 "Use of $flag is deprecated, please use \`$replacement->{$flag} instead.\n" . $herecurr) if ($replacement->{$flag});
3531 }
3532
3533 # check for DT compatible documentation
3534 if (defined $root &&
3535 (($realfile =~ /\.dtsi?$/ && $line =~ /^\+\s*compatible\s*=\s*\"/) ||
3536 ($realfile =~ /\.[ch]$/ && $line =~ /^\+.*\.compatible\s*=\s*\"/))) {
3537
3538 my @compats = $rawline =~ /\"([a-zA-Z0-9\-\,\.\+_]+)\"/g;
3539
3540 my $dt_path = $root . "/Documentation/devicetree/bindings/";
3541 my $vp_file = $dt_path . "vendor-prefixes.yaml";
3542
3543 foreach my $compat (@compats) {
3544 my $compat2 = $compat;
3545 $compat2 =~ s/\,[a-zA-Z0-9]*\-/\,<\.\*>\-/;
3546 my $compat3 = $compat;
3547 $compat3 =~ s/\,([a-z]*)[0-9]*\-/\,$1<\.\*>\-/;
3548 `grep -Erq "$compat|$compat2|$compat3" $dt_path`;
3549 if ( $? >> 8 ) {
3550 WARN("UNDOCUMENTED_DT_STRING",
3551 "DT compatible string \"$compat\" appears un-documented -- check $dt_path\n" . $herecurr);
3552 }
3553
3554 next if $compat !~ /^([a-zA-Z0-9\-]+)\,/;
3555 my $vendor = $1;
3556 `grep -Eq "\\"\\^\Q$vendor\E,\\.\\*\\":" $vp_file`;
3557 if ( $? >> 8 ) {
3558 WARN("UNDOCUMENTED_DT_STRING",
3559 "DT compatible string vendor \"$vendor\" appears un-documented -- check $vp_file\n" . $herecurr);
3560 }
3561 }
3562 }
3563
3564 # check for using SPDX license tag at beginning of files
3565 if ($realline == $checklicenseline) {
3566 if ($rawline =~ /^[ \+]\s*\#\!\s*\//) {
3567 $checklicenseline = 2;
3568 } elsif ($rawline =~ /^\+/) {
3569 my $comment = "";
3570 if ($realfile =~ /\.(h|s|S)$/) {
3571 $comment = '/*';
3572 } elsif ($realfile =~ /\.(c|dts|dtsi)$/) {
3573 $comment = '//';
3574 } elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc|yaml)$/) {
3575 $comment = '#';
3576 } elsif ($realfile =~ /\.rst$/) {
3577 $comment = '..';
3578 }
3579
3580 # check SPDX comment style for .[chsS] files
3581 if ($realfile =~ /\.[chsS]$/ &&
3582 $rawline =~ /SPDX-License-Identifier:/ &&
3583 $rawline !~ m@^\+\s*\Q$comment\E\s*@) {
3584 WARN("SPDX_LICENSE_TAG",
3585 "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr);
3586 }
3587
3588 if ($comment !~ /^$/ &&
3589 $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) {
3590 WARN("SPDX_LICENSE_TAG",
3591 "Missing or malformed SPDX-License-Identifier tag in line $checklicenseline\n" . $herecurr);
3592 } elsif ($rawline =~ /(SPDX-License-Identifier: .*)/) {
3593 my $spdx_license = $1;
3594 if (!is_SPDX_License_valid($spdx_license)) {
3595 WARN("SPDX_LICENSE_TAG",
3596 "'$spdx_license' is not supported in LICENSES/...\n" . $herecurr);
3597 }
3598 if ($realfile =~ m@^Documentation/devicetree/bindings/@ &&
3599 not $spdx_license =~ /GPL-2\.0.*BSD-2-Clause/) {
3600 my $msg_level = \&WARN;
3601 $msg_level = \&CHK if ($file);
3602 if (&{$msg_level}("SPDX_LICENSE_TAG",
3603
3604 "DT binding documents should be licensed (GPL-2.0-only OR BSD-2-Clause)\n" . $herecurr) &&
3605 $fix) {
3606 $fixed[$fixlinenr] =~ s/SPDX-License-Identifier: .*/SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)/;
3607 }
3608 }
3609 }
3610 }
3611 }
3612
3613 # check for embedded filenames
3614 if ($rawline =~ /^\+.*\Q$realfile\E/) {
3615 WARN("EMBEDDED_FILENAME",
3616 "It's generally not useful to have the filename in the file\n" . $herecurr);
3617 }
3618
3619 # check we are in a valid source file if not then ignore this hunk
3620 next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/);
3621
3622 # check for using SPDX-License-Identifier on the wrong line number
3623 if ($realline != $checklicenseline &&
3624 $rawline =~ /\bSPDX-License-Identifier:/ &&
3625 substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) {
3626 WARN("SPDX_LICENSE_TAG",
3627 "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr);
3628 }
3629
3630 # line length limit (with some exclusions)
3631 #
3632 # There are a few types of lines that may extend beyond $max_line_length:
3633 # logging functions like pr_info that end in a string
3634 # lines with a single string
3635 # #defines that are a single string
3636 # lines with an RFC3986 like URL
3637 #
3638 # There are 3 different line length message types:
3639 # LONG_LINE_COMMENT a comment starts before but extends beyond $max_line_length
3640 # LONG_LINE_STRING a string starts before but extends beyond $max_line_length
3641 # LONG_LINE all other lines longer than $max_line_length
3642 #
3643 # if LONG_LINE is ignored, the other 2 types are also ignored
3644 #
3645
3646 if ($line =~ /^\+/ && $length > $max_line_length) {
3647 my $msg_type = "LONG_LINE";
3648
3649 # Check the allowed long line types first
3650
3651 # logging functions that end in a string that starts
3652 # before $max_line_length
3653 if ($line =~ /^\+\s*$logFunctions\s*\(\s*(?:(?:KERN_\S+\s*|[^"]*))?($String\s*(?:|,|\)\s*;)\s*)$/ &&
3654 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3655 $msg_type = "";
3656
3657 # lines with only strings (w/ possible termination)
3658 # #defines with only strings
3659 } elsif ($line =~ /^\+\s*$String\s*(?:\s*|,|\)\s*;)\s*$/ ||
3660 $line =~ /^\+\s*#\s*define\s+\w+\s+$String$/) {
3661 $msg_type = "";
3662
3663 # More special cases
3664 } elsif ($line =~ /^\+.*\bEFI_GUID\s*\(/ ||
3665 $line =~ /^\+\s*(?:\w+)?\s*DEFINE_PER_CPU/) {
3666 $msg_type = "";
3667
3668 # URL ($rawline is used in case the URL is in a comment)
3669 } elsif ($rawline =~ /^\+.*\b[a-z][\w\.\+\-]*:\/\/\S+/i) {
3670 $msg_type = "";
3671
3672 # Otherwise set the alternate message types
3673
3674 # a comment starts before $max_line_length
3675 } elsif ($line =~ /($;[\s$;]*)$/ &&
3676 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3677 $msg_type = "LONG_LINE_COMMENT"
3678
3679 # a quoted string starts before $max_line_length
3680 } elsif ($sline =~ /\s*($String(?:\s*(?:\\|,\s*|\)\s*;\s*))?)$/ &&
3681 length(expand_tabs(substr($line, 1, length($line) - length($1) - 1))) <= $max_line_length) {
3682 $msg_type = "LONG_LINE_STRING"
3683 }
3684
3685 if ($msg_type ne "" &&
3686 (show_type("LONG_LINE") || show_type($msg_type))) {
3687 my $msg_level = \&WARN;
3688 $msg_level = \&CHK if ($file);
3689 &{$msg_level}($msg_type,
3690 "line length of $length exceeds $max_line_length columns\n" . $herecurr);
3691 }
3692 }
3693
3694 # check for adding lines without a newline.
3695 if ($line =~ /^\+/ && defined $lines[$linenr] && $lines[$linenr] =~ /^\\ No newline at end of file/) {
3696 if (WARN("MISSING_EOF_NEWLINE",
3697 "adding a line without newline at end of file\n" . $herecurr) &&
3698 $fix) {
3699 fix_delete_line($fixlinenr+1, "No newline at end of file");
3700 }
3701 }
3702
3703 # check for .L prefix local symbols in .S files
3704 if ($realfile =~ /\.S$/ &&
3705 $line =~ /^\+\s*(?:[A-Z]+_)?SYM_[A-Z]+_(?:START|END)(?:_[A-Z_]+)?\s*\(\s*\.L/) {
3706 WARN("AVOID_L_PREFIX",
3707 "Avoid using '.L' prefixed local symbol names for denoting a range of code via 'SYM_*_START/END' annotations; see Documentation/asm-annotations.rst\n" . $herecurr);
3708 }
3709
3710 # check we are in a valid source file C or perl if not then ignore this hunk
3711 next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/);
3712
3713 # at the beginning of a line any tabs must come first and anything
3714 # more than $tabsize must use tabs.
3715 if ($rawline =~ /^\+\s* \t\s*\S/ ||
3716 $rawline =~ /^\+\s* \s*/) {
3717 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
3718 $rpt_cleaners = 1;
3719 if (ERROR("CODE_INDENT",
3720 "code indent should use tabs where possible\n" . $herevet) &&
3721 $fix) {
3722 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
3723 }
3724 }
3725
3726 # check for space before tabs.
3727 if ($rawline =~ /^\+/ && $rawline =~ / \t/) {
3728 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
3729 if (WARN("SPACE_BEFORE_TAB",
3730 "please, no space before tabs\n" . $herevet) &&
3731 $fix) {
3732 while ($fixed[$fixlinenr] =~
3733 s/(^\+.*) {$tabsize,$tabsize}\t/$1\t\t/) {}
3734 while ($fixed[$fixlinenr] =~
3735 s/(^\+.*) +\t/$1\t/) {}
3736 }
3737 }
3738
3739 # check for assignments on the start of a line
3740 if ($sline =~ /^\+\s+($Assignment)[^=]/) {
3741 my $operator = $1;
3742 if (CHK("ASSIGNMENT_CONTINUATIONS",
3743 "Assignment operator '$1' should be on the previous line\n" . $hereprev) &&
3744 $fix && $prevrawline =~ /^\+/) {
3745 # add assignment operator to the previous line, remove from current line
3746 $fixed[$fixlinenr - 1] .= " $operator";
3747 $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
3748 }
3749 }
3750
3751 # check for && or || at the start of a line
3752 if ($rawline =~ /^\+\s*(&&|\|\|)/) {
3753 my $operator = $1;
3754 if (CHK("LOGICAL_CONTINUATIONS",
3755 "Logical continuations should be on the previous line\n" . $hereprev) &&
3756 $fix && $prevrawline =~ /^\+/) {
3757 # insert logical operator at last non-comment, non-whitepsace char on previous line
3758 $prevline =~ /[\s$;]*$/;
3759 my $line_end = substr($prevrawline, $-[0]);
3760 $fixed[$fixlinenr - 1] =~ s/\Q$line_end\E$/ $operator$line_end/;
3761 $fixed[$fixlinenr] =~ s/\Q$operator\E\s*//;
3762 }
3763 }
3764
3765 # check indentation starts on a tab stop
3766 if ($perl_version_ok &&
3767 $sline =~ /^\+\t+( +)(?:$c90_Keywords\b|\{\s*$|\}\s*(?:else\b|while\b|\s*$)|$Declare\s*$Ident\s*[;=])/) {
3768 my $indent = length($1);
3769 if ($indent % $tabsize) {
3770 if (WARN("TABSTOP",
3771 "Statements should start on a tabstop\n" . $herecurr) &&
3772 $fix) {
3773 $fixed[$fixlinenr] =~ s@(^\+\t+) +@$1 . "\t" x ($indent/$tabsize)@e;
3774 }
3775 }
3776 }
3777
3778 # check multi-line statement indentation matches previous line
3779 if ($perl_version_ok &&
3780 $prevline =~ /^\+([ \t]*)((?:$c90_Keywords(?:\s+if)\s*)|(?:$Declare\s*)?(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*|(?:\*\s*)*$Lval\s*=\s*$Ident\s*)\(.*(\&\&|\|\||,)\s*$/) {
3781 $prevline =~ /^\+(\t*)(.*)$/;
3782 my $oldindent = $1;
3783 my $rest = $2;
3784
3785 my $pos = pos_last_openparen($rest);
3786 if ($pos >= 0) {
3787 $line =~ /^(\+| )([ \t]*)/;
3788 my $newindent = $2;
3789
3790 my $goodtabindent = $oldindent .
3791 "\t" x ($pos / $tabsize) .
3792 " " x ($pos % $tabsize);
3793 my $goodspaceindent = $oldindent . " " x $pos;
3794
3795 if ($newindent ne $goodtabindent &&
3796 $newindent ne $goodspaceindent) {
3797
3798 if (CHK("PARENTHESIS_ALIGNMENT",
3799 "Alignment should match open parenthesis\n" . $hereprev) &&
3800 $fix && $line =~ /^\+/) {
3801 $fixed[$fixlinenr] =~
3802 s/^\+[ \t]*/\+$goodtabindent/;
3803 }
3804 }
3805 }
3806 }
3807
3808 # check for space after cast like "(int) foo" or "(struct foo) bar"
3809 # avoid checking a few false positives:
3810 # "sizeof(<type>)" or "__alignof__(<type>)"
3811 # function pointer declarations like "(*foo)(int) = bar;"
3812 # structure definitions like "(struct foo) { 0 };"
3813 # multiline macros that define functions
3814 # known attributes or the __attribute__ keyword
3815 if ($line =~ /^\+(.*)\(\s*$Type\s*\)([ \t]++)((?![={]|\\$|$Attribute|__attribute__))/ &&
3816 (!defined($1) || $1 !~ /\b(?:sizeof|__alignof__)\s*$/)) {
3817 if (CHK("SPACING",
3818 "No space is necessary after a cast\n" . $herecurr) &&
3819 $fix) {
3820 $fixed[$fixlinenr] =~
3821 s/(\(\s*$Type\s*\))[ \t]+/$1/;
3822 }
3823 }
3824
3825 # Block comment styles
3826 # Networking with an initial /*
3827 if ($realfile =~ m@^(drivers/net/|net/)@ &&
3828 $prevrawline =~ /^\+[ \t]*\/\*[ \t]*$/ &&
3829 $rawline =~ /^\+[ \t]*\*/ &&
3830 $realline > 3) { # Do not warn about the initial copyright comment block after SPDX-License-Identifier
3831 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
3832 "networking block comments don't use an empty /* line, use /* Comment...\n" . $hereprev);
3833 }
3834
3835 # Block comments use * on subsequent lines
3836 if ($prevline =~ /$;[ \t]*$/ && #ends in comment
3837 $prevrawline =~ /^\+.*?\/\*/ && #starting /*
3838 $prevrawline !~ /\*\/[ \t]*$/ && #no trailing */
3839 $rawline =~ /^\+/ && #line is new
3840 $rawline !~ /^\+[ \t]*\*/) { #no leading *
3841 WARN("BLOCK_COMMENT_STYLE",
3842 "Block comments use * on subsequent lines\n" . $hereprev);
3843 }
3844
3845 # Block comments use */ on trailing lines
3846 if ($rawline !~ m@^\+[ \t]*\*/[ \t]*$@ && #trailing */
3847 $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/
3848 $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ && #trailing **/
3849 $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) { #non blank */
3850 WARN("BLOCK_COMMENT_STYLE",
3851 "Block comments use a trailing */ on a separate line\n" . $herecurr);
3852 }
3853
3854 # Block comment * alignment
3855 if ($prevline =~ /$;[ \t]*$/ && #ends in comment
3856 $line =~ /^\+[ \t]*$;/ && #leading comment
3857 $rawline =~ /^\+[ \t]*\*/ && #leading *
3858 (($prevrawline =~ /^\+.*?\/\*/ && #leading /*
3859 $prevrawline !~ /\*\/[ \t]*$/) || #no trailing */
3860 $prevrawline =~ /^\+[ \t]*\*/)) { #leading *
3861 my $oldindent;
3862 $prevrawline =~ m@^\+([ \t]*/?)\*@;
3863 if (defined($1)) {
3864 $oldindent = expand_tabs($1);
3865 } else {
3866 $prevrawline =~ m@^\+(.*/?)\*@;
3867 $oldindent = expand_tabs($1);
3868 }
3869 $rawline =~ m@^\+([ \t]*)\*@;
3870 my $newindent = $1;
3871 $newindent = expand_tabs($newindent);
3872 if (length($oldindent) ne length($newindent)) {
3873 WARN("BLOCK_COMMENT_STYLE",
3874 "Block comments should align the * on each line\n" . $hereprev);
3875 }
3876 }
3877
3878 # check for missing blank lines after struct/union declarations
3879 # with exceptions for various attributes and macros
3880 if ($prevline =~ /^[\+ ]};?\s*$/ &&
3881 $line =~ /^\+/ &&
3882 !($line =~ /^\+\s*$/ ||
3883 $line =~ /^\+\s*EXPORT_SYMBOL/ ||
3884 $line =~ /^\+\s*MODULE_/i ||
3885 $line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
3886 $line =~ /^\+[a-z_]*init/ ||
3887 $line =~ /^\+\s*(?:static\s+)?[A-Z_]*ATTR/ ||
3888 $line =~ /^\+\s*DECLARE/ ||
3889 $line =~ /^\+\s*builtin_[\w_]*driver/ ||
3890 $line =~ /^\+\s*__setup/)) {
3891 if (CHK("LINE_SPACING",
3892 "Please use a blank line after function/struct/union/enum declarations\n" . $hereprev) &&
3893 $fix) {
3894 fix_insert_line($fixlinenr, "\+");
3895 }
3896 }
3897
3898 # check for multiple consecutive blank lines
3899 if ($prevline =~ /^[\+ ]\s*$/ &&
3900 $line =~ /^\+\s*$/ &&
3901 $last_blank_line != ($linenr - 1)) {
3902 if (CHK("LINE_SPACING",
3903 "Please don't use multiple blank lines\n" . $hereprev) &&
3904 $fix) {
3905 fix_delete_line($fixlinenr, $rawline);
3906 }
3907
3908 $last_blank_line = $linenr;
3909 }
3910
3911 # check for missing blank lines after declarations
3912 # (declarations must have the same indentation and not be at the start of line)
3913 if (($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/) {
3914 # use temporaries
3915 my $sl = $sline;
3916 my $pl = $prevline;
3917 # remove $Attribute/$Sparse uses to simplify comparisons
3918 $sl =~ s/\b(?:$Attribute|$Sparse)\b//g;
3919 $pl =~ s/\b(?:$Attribute|$Sparse)\b//g;
3920 if (($pl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
3921 # function pointer declarations
3922 $pl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
3923 # foo bar; where foo is some local typedef or #define
3924 $pl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
3925 # known declaration macros
3926 $pl =~ /^\+\s+$declaration_macros/) &&
3927 # for "else if" which can look like "$Ident $Ident"
3928 !($pl =~ /^\+\s+$c90_Keywords\b/ ||
3929 # other possible extensions of declaration lines
3930 $pl =~ /(?:$Compare|$Assignment|$Operators)\s*$/ ||
3931 # not starting a section or a macro "\" extended line
3932 $pl =~ /(?:\{\s*|\\)$/) &&
3933 # looks like a declaration
3934 !($sl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
3935 # function pointer declarations
3936 $sl =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
3937 # foo bar; where foo is some local typedef or #define
3938 $sl =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
3939 # known declaration macros
3940 $sl =~ /^\+\s+$declaration_macros/ ||
3941 # start of struct or union or enum
3942 $sl =~ /^\+\s+(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
3943 # start or end of block or continuation of declaration
3944 $sl =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
3945 # bitfield continuation
3946 $sl =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
3947 # other possible extensions of declaration lines
3948 $sl =~ /^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/)) {
3949 if (WARN("LINE_SPACING",
3950 "Missing a blank line after declarations\n" . $hereprev) &&
3951 $fix) {
3952 fix_insert_line($fixlinenr, "\+");
3953 }
3954 }
3955 }
3956
3957 # check for spaces at the beginning of a line.
3958 # Exceptions:
3959 # 1) within comments
3960 # 2) indented preprocessor commands
3961 # 3) hanging labels
3962 if ($rawline =~ /^\+ / && $line !~ /^\+ *(?:$;|#|$Ident:)/) {
3963 my $herevet = "$here\n" . cat_vet($rawline) . "\n";
3964 if (WARN("LEADING_SPACE",
3965 "please, no spaces at the start of a line\n" . $herevet) &&
3966 $fix) {
3967 $fixed[$fixlinenr] =~ s/^\+([ \t]+)/"\+" . tabify($1)/e;
3968 }
3969 }
3970
3971 # check we are in a valid C source file if not then ignore this hunk
3972 next if ($realfile !~ /\.(h|c)$/);
3973
3974 # check for unusual line ending [ or (
3975 if ($line =~ /^\+.*([\[\(])\s*$/) {
3976 CHK("OPEN_ENDED_LINE",
3977 "Lines should not end with a '$1'\n" . $herecurr);
3978 }
3979
3980 # check if this appears to be the start function declaration, save the name
3981 if ($sline =~ /^\+\{\s*$/ &&
3982 $prevline =~ /^\+(?:(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*)?($Ident)\(/) {
3983 $context_function = $1;
3984 }
3985
3986 # check if this appears to be the end of function declaration
3987 if ($sline =~ /^\+\}\s*$/) {
3988 undef $context_function;
3989 }
3990
3991 # check indentation of any line with a bare else
3992 # (but not if it is a multiple line "if (foo) return bar; else return baz;")
3993 # if the previous line is a break or return and is indented 1 tab more...
3994 if ($sline =~ /^\+([\t]+)(?:}[ \t]*)?else(?:[ \t]*{)?\s*$/) {
3995 my $tabs = length($1) + 1;
3996 if ($prevline =~ /^\+\t{$tabs,$tabs}break\b/ ||
3997 ($prevline =~ /^\+\t{$tabs,$tabs}return\b/ &&
3998 defined $lines[$linenr] &&
3999 $lines[$linenr] !~ /^[ \+]\t{$tabs,$tabs}return/)) {
4000 WARN("UNNECESSARY_ELSE",
4001 "else is not generally useful after a break or return\n" . $hereprev);
4002 }
4003 }
4004
4005 # check indentation of a line with a break;
4006 # if the previous line is a goto, return or break
4007 # and is indented the same # of tabs
4008 if ($sline =~ /^\+([\t]+)break\s*;\s*$/) {
4009 my $tabs = $1;
4010 if ($prevline =~ /^\+$tabs(goto|return|break)\b/) {
4011 if (WARN("UNNECESSARY_BREAK",
4012 "break is not useful after a $1\n" . $hereprev) &&
4013 $fix) {
4014 fix_delete_line($fixlinenr, $rawline);
4015 }
4016 }
4017 }
4018
4019 # check for RCS/CVS revision markers
4020 if ($rawline =~ /^\+.*\$(Revision|Log|Id)(?:\$|)/) {
4021 WARN("CVS_KEYWORD",
4022 "CVS style keyword markers, these will _not_ be updated\n". $herecurr);
4023 }
4024
4025 # check for old HOTPLUG __dev<foo> section markings
4026 if ($line =~ /\b(__dev(init|exit)(data|const|))\b/) {
4027 WARN("HOTPLUG_SECTION",
4028 "Using $1 is unnecessary\n" . $herecurr);
4029 }
4030
4031 # Check for potential 'bare' types
4032 my ($stat, $cond, $line_nr_next, $remain_next, $off_next,
4033 $realline_next);
4034 #print "LINE<$line>\n";
4035 if ($linenr > $suppress_statement &&
4036 $realcnt && $sline =~ /.\s*\S/) {
4037 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
4038 ctx_statement_block($linenr, $realcnt, 0);
4039 $stat =~ s/\n./\n /g;
4040 $cond =~ s/\n./\n /g;
4041
4042 #print "linenr<$linenr> <$stat>\n";
4043 # If this statement has no statement boundaries within
4044 # it there is no point in retrying a statement scan
4045 # until we hit end of it.
4046 my $frag = $stat; $frag =~ s/;+\s*$//;
4047 if ($frag !~ /(?:{|;)/) {
4048 #print "skip<$line_nr_next>\n";
4049 $suppress_statement = $line_nr_next;
4050 }
4051
4052 # Find the real next line.
4053 $realline_next = $line_nr_next;
4054 if (defined $realline_next &&
4055 (!defined $lines[$realline_next - 1] ||
4056 substr($lines[$realline_next - 1], $off_next) =~ /^\s*$/)) {
4057 $realline_next++;
4058 }
4059
4060 my $s = $stat;
4061 $s =~ s/{.*$//s;
4062
4063 # Ignore goto labels.
4064 if ($s =~ /$Ident:\*$/s) {
4065
4066 # Ignore functions being called
4067 } elsif ($s =~ /^.\s*$Ident\s*\(/s) {
4068
4069 } elsif ($s =~ /^.\s*else\b/s) {
4070
4071 # declarations always start with types
4072 } elsif ($prev_values eq 'E' && $s =~ /^.\s*(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?((?:\s*$Ident)+?)\b(?:\s+$Sparse)?\s*\**\s*(?:$Ident|\(\*[^\)]*\))(?:\s*$Modifier)?\s*(?:;|=|,|\()/s) {
4073 my $type = $1;
4074 $type =~ s/\s+/ /g;
4075 possible($type, "A:" . $s);
4076
4077 # definitions in global scope can only start with types
4078 } elsif ($s =~ /^.(?:$Storage\s+)?(?:$Inline\s+)?(?:const\s+)?($Ident)\b\s*(?!:)/s) {
4079 possible($1, "B:" . $s);
4080 }
4081
4082 # any (foo ... *) is a pointer cast, and foo is a type
4083 while ($s =~ /\(($Ident)(?:\s+$Sparse)*[\s\*]+\s*\)/sg) {
4084 possible($1, "C:" . $s);
4085 }
4086
4087 # Check for any sort of function declaration.
4088 # int foo(something bar, other baz);
4089 # void (*store_gdt)(x86_descr_ptr *);
4090 if ($prev_values eq 'E' && $s =~ /^(.(?:typedef\s*)?(?:(?:$Storage|$Inline)\s*)*\s*$Type\s*(?:\b$Ident|\(\*\s*$Ident\))\s*)\(/s) {
4091 my ($name_len) = length($1);
4092
4093 my $ctx = $s;
4094 substr($ctx, 0, $name_len + 1, '');
4095 $ctx =~ s/\)[^\)]*$//;
4096
4097 for my $arg (split(/\s*,\s*/, $ctx)) {
4098 if ($arg =~ /^(?:const\s+)?($Ident)(?:\s+$Sparse)*\s*\**\s*(:?\b$Ident)?$/s || $arg =~ /^($Ident)$/s) {
4099
4100 possible($1, "D:" . $s);
4101 }
4102 }
4103 }
4104
4105 }
4106
4107 #
4108 # Checks which may be anchored in the context.
4109 #
4110
4111 # Check for switch () and associated case and default
4112 # statements should be at the same indent.
4113 if ($line=~/\bswitch\s*\(.*\)/) {
4114 my $err = '';
4115 my $sep = '';
4116 my @ctx = ctx_block_outer($linenr, $realcnt);
4117 shift(@ctx);
4118 for my $ctx (@ctx) {
4119 my ($clen, $cindent) = line_stats($ctx);
4120 if ($ctx =~ /^\+\s*(case\s+|default:)/ &&
4121 $indent != $cindent) {
4122 $err .= "$sep$ctx\n";
4123 $sep = '';
4124 } else {
4125 $sep = "[...]\n";
4126 }
4127 }
4128 if ($err ne '') {
4129 ERROR("SWITCH_CASE_INDENT_LEVEL",
4130 "switch and case should be at the same indent\n$hereline$err");
4131 }
4132 }
4133
4134 # if/while/etc brace do not go on next line, unless defining a do while loop,
4135 # or if that brace on the next line is for something else
4136 if ($line =~ /(.*)\b((?:if|while|for|switch|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|do\b|else\b)/ && $line !~ /^.\s*\#/) {
4137 my $pre_ctx = "$1$2";
4138
4139 my ($level, @ctx) = ctx_statement_level($linenr, $realcnt, 0);
4140
4141 if ($line =~ /^\+\t{6,}/) {
4142 WARN("DEEP_INDENTATION",
4143 "Too many leading tabs - consider code refactoring\n" . $herecurr);
4144 }
4145
4146 my $ctx_cnt = $realcnt - $#ctx - 1;
4147 my $ctx = join("\n", @ctx);
4148
4149 my $ctx_ln = $linenr;
4150 my $ctx_skip = $realcnt;
4151
4152 while ($ctx_skip > $ctx_cnt || ($ctx_skip == $ctx_cnt &&
4153 defined $lines[$ctx_ln - 1] &&
4154 $lines[$ctx_ln - 1] =~ /^-/)) {
4155 ##print "SKIP<$ctx_skip> CNT<$ctx_cnt>\n";
4156 $ctx_skip-- if (!defined $lines[$ctx_ln - 1] || $lines[$ctx_ln - 1] !~ /^-/);
4157 $ctx_ln++;
4158 }
4159
4160 #print "realcnt<$realcnt> ctx_cnt<$ctx_cnt>\n";
4161 #print "pre<$pre_ctx>\nline<$line>\nctx<$ctx>\nnext<$lines[$ctx_ln - 1]>\n";
4162
4163 if ($ctx !~ /{\s*/ && defined($lines[$ctx_ln - 1]) && $lines[$ctx_ln - 1] =~ /^\+\s*{/) {
4164 ERROR("OPEN_BRACE",
4165 "that open brace { should be on the previous line\n" .
4166 "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
4167 }
4168 if ($level == 0 && $pre_ctx !~ /}\s*while\s*\($/ &&
4169 $ctx =~ /\)\s*\;\s*$/ &&
4170 defined $lines[$ctx_ln - 1])
4171 {
4172 my ($nlength, $nindent) = line_stats($lines[$ctx_ln - 1]);
4173 if ($nindent > $indent) {
4174 WARN("TRAILING_SEMICOLON",
4175 "trailing semicolon indicates no statements, indent implies otherwise\n" .
4176 "$here\n$ctx\n$rawlines[$ctx_ln - 1]\n");
4177 }
4178 }
4179 }
4180
4181 # Check relative indent for conditionals and blocks.
4182 if ($line =~ /\b(?:(?:if|while|for|(?:[a-z_]+|)for_each[a-z_]+)\s*\(|(?:do|else)\b)/ && $line !~ /^.\s*#/ && $line !~ /\}\s*while\s*/) {
4183 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
4184 ctx_statement_block($linenr, $realcnt, 0)
4185 if (!defined $stat);
4186 my ($s, $c) = ($stat, $cond);
4187
4188 substr($s, 0, length($c), '');
4189
4190 # remove inline comments
4191 $s =~ s/$;/ /g;
4192 $c =~ s/$;/ /g;
4193
4194 # Find out how long the conditional actually is.
4195 my @newlines = ($c =~ /\n/gs);
4196 my $cond_lines = 1 + $#newlines;
4197
4198 # Make sure we remove the line prefixes as we have
4199 # none on the first line, and are going to readd them
4200 # where necessary.
4201 $s =~ s/\n./\n/gs;
4202 while ($s =~ /\n\s+\\\n/) {
4203 $cond_lines += $s =~ s/\n\s+\\\n/\n/g;
4204 }
4205
4206 # We want to check the first line inside the block
4207 # starting at the end of the conditional, so remove:
4208 # 1) any blank line termination
4209 # 2) any opening brace { on end of the line
4210 # 3) any do (...) {
4211 my $continuation = 0;
4212 my $check = 0;
4213 $s =~ s/^.*\bdo\b//;
4214 $s =~ s/^\s*{//;
4215 if ($s =~ s/^\s*\\//) {
4216 $continuation = 1;
4217 }
4218 if ($s =~ s/^\s*?\n//) {
4219 $check = 1;
4220 $cond_lines++;
4221 }
4222
4223 # Also ignore a loop construct at the end of a
4224 # preprocessor statement.
4225 if (($prevline =~ /^.\s*#\s*define\s/ ||
4226 $prevline =~ /\\\s*$/) && $continuation == 0) {
4227 $check = 0;
4228 }
4229
4230 my $cond_ptr = -1;
4231 $continuation = 0;
4232 while ($cond_ptr != $cond_lines) {
4233 $cond_ptr = $cond_lines;
4234
4235 # If we see an #else/#elif then the code
4236 # is not linear.
4237 if ($s =~ /^\s*\#\s*(?:else|elif)/) {
4238 $check = 0;
4239 }
4240
4241 # Ignore:
4242 # 1) blank lines, they should be at 0,
4243 # 2) preprocessor lines, and
4244 # 3) labels.
4245 if ($continuation ||
4246 $s =~ /^\s*?\n/ ||
4247 $s =~ /^\s*#\s*?/ ||
4248 $s =~ /^\s*$Ident\s*:/) {
4249 $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0;
4250 if ($s =~ s/^.*?\n//) {
4251 $cond_lines++;
4252 }
4253 }
4254 }
4255
4256 my (undef, $sindent) = line_stats("+" . $s);
4257 my $stat_real = raw_line($linenr, $cond_lines);
4258
4259 # Check if either of these lines are modified, else
4260 # this is not this patch's fault.
4261 if (!defined($stat_real) ||
4262 $stat !~ /^\+/ && $stat_real !~ /^\+/) {
4263 $check = 0;
4264 }
4265 if (defined($stat_real) && $cond_lines > 1) {
4266 $stat_real = "[...]\n$stat_real";
4267 }
4268
4269 #print "line<$line> prevline<$prevline> indent<$indent> sindent<$sindent> check<$check> continuation<$continuation> s<$s> cond_lines<$cond_lines> stat_real<$stat_real> stat<$stat>\n";
4270
4271 if ($check && $s ne '' &&
4272 (($sindent % $tabsize) != 0 ||
4273 ($sindent < $indent) ||
4274 ($sindent == $indent &&
4275 ($s !~ /^\s*(?:\}|\{|else\b)/)) ||
4276 ($sindent > $indent + $tabsize))) {
4277 WARN("SUSPECT_CODE_INDENT",
4278 "suspect code indent for conditional statements ($indent, $sindent)\n" . $herecurr . "$stat_real\n");
4279 }
4280 }
4281
4282 # Track the 'values' across context and added lines.
4283 my $opline = $line; $opline =~ s/^./ /;
4284 my ($curr_values, $curr_vars) =
4285 annotate_values($opline . "\n", $prev_values);
4286 $curr_values = $prev_values . $curr_values;
4287 if ($dbg_values) {
4288 my $outline = $opline; $outline =~ s/\t/ /g;
4289 print "$linenr > .$outline\n";
4290 print "$linenr > $curr_values\n";
4291 print "$linenr > $curr_vars\n";
4292 }
4293 $prev_values = substr($curr_values, -1);
4294
4295 #ignore lines not being added
4296 next if ($line =~ /^[^\+]/);
4297
4298 # check for self assignments used to avoid compiler warnings
4299 # e.g.: int foo = foo, *bar = NULL;
4300 # struct foo bar = *(&(bar));
4301 if ($line =~ /^\+\s*(?:$Declare)?([A-Za-z_][A-Za-z\d_]*)\s*=/) {
4302 my $var = $1;
4303 if ($line =~ /^\+\s*(?:$Declare)?$var\s*=\s*(?:$var|\*\s*\(?\s*&\s*\(?\s*$var\s*\)?\s*\)?)\s*[;,]/) {
4304 WARN("SELF_ASSIGNMENT",
4305 "Do not use self-assignments to avoid compiler warnings\n" . $herecurr);
4306 }
4307 }
4308
4309 # check for dereferences that span multiple lines
4310 if ($prevline =~ /^\+.*$Lval\s*(?:\.|->)\s*$/ &&
4311 $line =~ /^\+\s*(?!\#\s*(?!define\s+|if))\s*$Lval/) {
4312 $prevline =~ /($Lval\s*(?:\.|->))\s*$/;
4313 my $ref = $1;
4314 $line =~ /^.\s*($Lval)/;
4315 $ref .= $1;
4316 $ref =~ s/\s//g;
4317 WARN("MULTILINE_DEREFERENCE",
4318 "Avoid multiple line dereference - prefer '$ref'\n" . $hereprev);
4319 }
4320
4321 # check for declarations of signed or unsigned without int
4322 while ($line =~ m{\b($Declare)\s*(?!char\b|short\b|int\b|long\b)\s*($Ident)?\s*[=,;\[\)\(]}g) {
4323 my $type = $1;
4324 my $var = $2;
4325 $var = "" if (!defined $var);
4326 if ($type =~ /^(?:(?:$Storage|$Inline|$Attribute)\s+)*((?:un)?signed)((?:\s*\*)*)\s*$/) {
4327 my $sign = $1;
4328 my $pointer = $2;
4329
4330 $pointer = "" if (!defined $pointer);
4331
4332 if (WARN("UNSPECIFIED_INT",
4333 "Prefer '" . trim($sign) . " int" . rtrim($pointer) . "' to bare use of '$sign" . rtrim($pointer) . "'\n" . $herecurr) &&
4334 $fix) {
4335 my $decl = trim($sign) . " int ";
4336 my $comp_pointer = $pointer;
4337 $comp_pointer =~ s/\s//g;
4338 $decl .= $comp_pointer;
4339 $decl = rtrim($decl) if ($var eq "");
4340 $fixed[$fixlinenr] =~ s@\b$sign\s*\Q$pointer\E\s*$var\b@$decl$var@;
4341 }
4342 }
4343 }
4344
4345 # TEST: allow direct testing of the type matcher.
4346 if ($dbg_type) {
4347 if ($line =~ /^.\s*$Declare\s*$/) {
4348 ERROR("TEST_TYPE",
4349 "TEST: is type\n" . $herecurr);
4350 } elsif ($dbg_type > 1 && $line =~ /^.+($Declare)/) {
4351 ERROR("TEST_NOT_TYPE",
4352 "TEST: is not type ($1 is)\n". $herecurr);
4353 }
4354 next;
4355 }
4356 # TEST: allow direct testing of the attribute matcher.
4357 if ($dbg_attr) {
4358 if ($line =~ /^.\s*$Modifier\s*$/) {
4359 ERROR("TEST_ATTR",
4360 "TEST: is attr\n" . $herecurr);
4361 } elsif ($dbg_attr > 1 && $line =~ /^.+($Modifier)/) {
4362 ERROR("TEST_NOT_ATTR",
4363 "TEST: is not attr ($1 is)\n". $herecurr);
4364 }
4365 next;
4366 }
4367
4368 # check for initialisation to aggregates open brace on the next line
4369 if ($line =~ /^.\s*{/ &&
4370 $prevline =~ /(?:^|[^=])=\s*$/) {
4371 if (ERROR("OPEN_BRACE",
4372 "that open brace { should be on the previous line\n" . $hereprev) &&
4373 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
4374 fix_delete_line($fixlinenr - 1, $prevrawline);
4375 fix_delete_line($fixlinenr, $rawline);
4376 my $fixedline = $prevrawline;
4377 $fixedline =~ s/\s*=\s*$/ = {/;
4378 fix_insert_line($fixlinenr, $fixedline);
4379 $fixedline = $line;
4380 $fixedline =~ s/^(.\s*)\{\s*/$1/;
4381 fix_insert_line($fixlinenr, $fixedline);
4382 }
4383 }
4384
4385 #
4386 # Checks which are anchored on the added line.
4387 #
4388
4389 # check for malformed paths in #include statements (uses RAW line)
4390 if ($rawline =~ m{^.\s*\#\s*include\s+[<"](.*)[">]}) {
4391 my $path = $1;
4392 if ($path =~ m{//}) {
4393 ERROR("MALFORMED_INCLUDE",
4394 "malformed #include filename\n" . $herecurr);
4395 }
4396 if ($path =~ "^uapi/" && $realfile =~ m@\binclude/uapi/@) {
4397 ERROR("UAPI_INCLUDE",
4398 "No #include in ...include/uapi/... should use a uapi/ path prefix\n" . $herecurr);
4399 }
4400 }
4401
4402 # no C99 // comments
4403 if ($line =~ m{//}) {
4404 if (ERROR("C99_COMMENTS",
4405 "do not use C99 // comments\n" . $herecurr) &&
4406 $fix) {
4407 my $line = $fixed[$fixlinenr];
4408 if ($line =~ /\/\/(.*)$/) {
4409 my $comment = trim($1);
4410 $fixed[$fixlinenr] =~ s@\/\/(.*)$@/\* $comment \*/@;
4411 }
4412 }
4413 }
4414 # Remove C99 comments.
4415 $line =~ s@//.*@@;
4416 $opline =~ s@//.*@@;
4417
4418 # EXPORT_SYMBOL should immediately follow the thing it is exporting, consider
4419 # the whole statement.
4420 #print "APW <$lines[$realline_next - 1]>\n";
4421 if (defined $realline_next &&
4422 exists $lines[$realline_next - 1] &&
4423 !defined $suppress_export{$realline_next} &&
4424 ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
4425 # Handle definitions which produce identifiers with
4426 # a prefix:
4427 # XXX(foo);
4428 # EXPORT_SYMBOL(something_foo);
4429 my $name = $1;
4430 if ($stat =~ /^(?:.\s*}\s*\n)?.([A-Z_]+)\s*\(\s*($Ident)/ &&
4431 $name =~ /^${Ident}_$2/) {
4432 #print "FOO C name<$name>\n";
4433 $suppress_export{$realline_next} = 1;
4434
4435 } elsif ($stat !~ /(?:
4436 \n.}\s*$|
4437 ^.DEFINE_$Ident\(\Q$name\E\)|
4438 ^.DECLARE_$Ident\(\Q$name\E\)|
4439 ^.LIST_HEAD\(\Q$name\E\)|
4440 ^.(?:$Storage\s+)?$Type\s*\(\s*\*\s*\Q$name\E\s*\)\s*\(|
4441 \b\Q$name\E(?:\s+$Attribute)*\s*(?:;|=|\[|\()
4442 )/x) {
4443 #print "FOO A<$lines[$realline_next - 1]> stat<$stat> name<$name>\n";
4444 $suppress_export{$realline_next} = 2;
4445 } else {
4446 $suppress_export{$realline_next} = 1;
4447 }
4448 }
4449 if (!defined $suppress_export{$linenr} &&
4450 $prevline =~ /^.\s*$/ &&
4451 ($line =~ /EXPORT_SYMBOL.*\((.*)\)/)) {
4452 #print "FOO B <$lines[$linenr - 1]>\n";
4453 $suppress_export{$linenr} = 2;
4454 }
4455 if (defined $suppress_export{$linenr} &&
4456 $suppress_export{$linenr} == 2) {
4457 WARN("EXPORT_SYMBOL",
4458 "EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
4459 }
4460
4461 # check for global initialisers.
4462 if ($line =~ /^\+$Type\s*$Ident(?:\s+$Modifier)*\s*=\s*($zero_initializer)\s*;/ &&
4463 !exclude_global_initialisers($realfile)) {
4464 if (ERROR("GLOBAL_INITIALISERS",
4465 "do not initialise globals to $1\n" . $herecurr) &&
4466 $fix) {
4467 $fixed[$fixlinenr] =~ s/(^.$Type\s*$Ident(?:\s+$Modifier)*)\s*=\s*$zero_initializer\s*;/$1;/;
4468 }
4469 }
4470 # check for static initialisers.
4471 if ($line =~ /^\+.*\bstatic\s.*=\s*($zero_initializer)\s*;/) {
4472 if (ERROR("INITIALISED_STATIC",
4473 "do not initialise statics to $1\n" .
4474 $herecurr) &&
4475 $fix) {
4476 $fixed[$fixlinenr] =~ s/(\bstatic\s.*?)\s*=\s*$zero_initializer\s*;/$1;/;
4477 }
4478 }
4479
4480 # check for misordered declarations of char/short/int/long with signed/unsigned
4481 while ($sline =~ m{(\b$TypeMisordered\b)}g) {
4482 my $tmp = trim($1);
4483 WARN("MISORDERED_TYPE",
4484 "type '$tmp' should be specified in [[un]signed] [short|int|long|long long] order\n" . $herecurr);
4485 }
4486
4487 # check for unnecessary <signed> int declarations of short/long/long long
4488 while ($sline =~ m{\b($TypeMisordered(\s*\*)*|$C90_int_types)\b}g) {
4489 my $type = trim($1);
4490 next if ($type !~ /\bint\b/);
4491 next if ($type !~ /\b(?:short|long\s+long|long)\b/);
4492 my $new_type = $type;
4493 $new_type =~ s/\b\s*int\s*\b/ /;
4494 $new_type =~ s/\b\s*(?:un)?signed\b\s*/ /;
4495 $new_type =~ s/^const\s+//;
4496 $new_type = "unsigned $new_type" if ($type =~ /\bunsigned\b/);
4497 $new_type = "const $new_type" if ($type =~ /^const\b/);
4498 $new_type =~ s/\s+/ /g;
4499 $new_type = trim($new_type);
4500 if (WARN("UNNECESSARY_INT",
4501 "Prefer '$new_type' over '$type' as the int is unnecessary\n" . $herecurr) &&
4502 $fix) {
4503 $fixed[$fixlinenr] =~ s/\b\Q$type\E\b/$new_type/;
4504 }
4505 }
4506
4507 # check for static const char * arrays.
4508 if ($line =~ /\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*/) {
4509 WARN("STATIC_CONST_CHAR_ARRAY",
4510 "static const char * array should probably be static const char * const\n" .
4511 $herecurr);
4512 }
4513
4514 # check for initialized const char arrays that should be static const
4515 if ($line =~ /^\+\s*const\s+(char|unsigned\s+char|_*u8|(?:[us]_)?int8_t)\s+\w+\s*\[\s*(?:\w+\s*)?\]\s*=\s*"/) {
4516 if (WARN("STATIC_CONST_CHAR_ARRAY",
4517 "const array should probably be static const\n" . $herecurr) &&
4518 $fix) {
4519 $fixed[$fixlinenr] =~ s/(^.\s*)const\b/${1}static const/;
4520 }
4521 }
4522
4523 # check for static char foo[] = "bar" declarations.
4524 if ($line =~ /\bstatic\s+char\s+(\w+)\s*\[\s*\]\s*=\s*"/) {
4525 WARN("STATIC_CONST_CHAR_ARRAY",
4526 "static char array declaration should probably be static const char\n" .
4527 $herecurr);
4528 }
4529
4530 # check for const <foo> const where <foo> is not a pointer or array type
4531 if ($sline =~ /\bconst\s+($BasicType)\s+const\b/) {
4532 my $found = $1;
4533 if ($sline =~ /\bconst\s+\Q$found\E\s+const\b\s*\*/) {
4534 WARN("CONST_CONST",
4535 "'const $found const *' should probably be 'const $found * const'\n" . $herecurr);
4536 } elsif ($sline !~ /\bconst\s+\Q$found\E\s+const\s+\w+\s*\[/) {
4537 WARN("CONST_CONST",
4538 "'const $found const' should probably be 'const $found'\n" . $herecurr);
4539 }
4540 }
4541
4542 # check for const static or static <non ptr type> const declarations
4543 # prefer 'static const <foo>' over 'const static <foo>' and 'static <foo> const'
4544 if ($sline =~ /^\+\s*const\s+static\s+($Type)\b/ ||
4545 $sline =~ /^\+\s*static\s+($BasicType)\s+const\b/) {
4546 if (WARN("STATIC_CONST",
4547 "Move const after static - use 'static const $1'\n" . $herecurr) &&
4548 $fix) {
4549 $fixed[$fixlinenr] =~ s/\bconst\s+static\b/static const/;
4550 $fixed[$fixlinenr] =~ s/\bstatic\s+($BasicType)\s+const\b/static const $1/;
4551 }
4552 }
4553
4554 # check for non-global char *foo[] = {"bar", ...} declarations.
4555 if ($line =~ /^.\s+(?:static\s+|const\s+)?char\s+\*\s*\w+\s*\[\s*\]\s*=\s*\{/) {
4556 WARN("STATIC_CONST_CHAR_ARRAY",
4557 "char * array declaration might be better as static const\n" .
4558 $herecurr);
4559 }
4560
4561 # check for sizeof(foo)/sizeof(foo[0]) that could be ARRAY_SIZE(foo)
4562 if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) {
4563 my $array = $1;
4564 if ($line =~ m@\b(sizeof\s*\(\s*\Q$array\E\s*\)\s*/\s*sizeof\s*\(\s*\Q$array\E\s*\[\s*0\s*\]\s*\))@) {
4565 my $array_div = $1;
4566 if (WARN("ARRAY_SIZE",
4567 "Prefer ARRAY_SIZE($array)\n" . $herecurr) &&
4568 $fix) {
4569 $fixed[$fixlinenr] =~ s/\Q$array_div\E/ARRAY_SIZE($array)/;
4570 }
4571 }
4572 }
4573
4574 # check for function declarations without arguments like "int foo()"
4575 if ($line =~ /(\b$Type\s*$Ident)\s*\(\s*\)/) {
4576 if (ERROR("FUNCTION_WITHOUT_ARGS",
4577 "Bad function definition - $1() should probably be $1(void)\n" . $herecurr) &&
4578 $fix) {
4579 $fixed[$fixlinenr] =~ s/(\b($Type)\s+($Ident))\s*\(\s*\)/$2 $3(void)/;
4580 }
4581 }
4582
4583 # check for new typedefs, only function parameters and sparse annotations
4584 # make sense.
4585 if ($line =~ /\btypedef\s/ &&
4586 $line !~ /\btypedef\s+$Type\s*\(\s*\*?$Ident\s*\)\s*\(/ &&
4587 $line !~ /\btypedef\s+$Type\s+$Ident\s*\(/ &&
4588 $line !~ /\b$typeTypedefs\b/ &&
4589 $line !~ /\b__bitwise\b/) {
4590 WARN("NEW_TYPEDEFS",
4591 "do not add new typedefs\n" . $herecurr);
4592 }
4593
4594 # * goes on variable not on type
4595 # (char*[ const])
4596 while ($line =~ m{(\($NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)\))}g) {
4597 #print "AA<$1>\n";
4598 my ($ident, $from, $to) = ($1, $2, $2);
4599
4600 # Should start with a space.
4601 $to =~ s/^(\S)/ $1/;
4602 # Should not end with a space.
4603 $to =~ s/\s+$//;
4604 # '*'s should not have spaces between.
4605 while ($to =~ s/\*\s+\*/\*\*/) {
4606 }
4607
4608 ## print "1: from<$from> to<$to> ident<$ident>\n";
4609 if ($from ne $to) {
4610 if (ERROR("POINTER_LOCATION",
4611 "\"(foo$from)\" should be \"(foo$to)\"\n" . $herecurr) &&
4612 $fix) {
4613 my $sub_from = $ident;
4614 my $sub_to = $ident;
4615 $sub_to =~ s/\Q$from\E/$to/;
4616 $fixed[$fixlinenr] =~
4617 s@\Q$sub_from\E@$sub_to@;
4618 }
4619 }
4620 }
4621 while ($line =~ m{(\b$NonptrType(\s*(?:$Modifier\b\s*|\*\s*)+)($Ident))}g) {
4622 #print "BB<$1>\n";
4623 my ($match, $from, $to, $ident) = ($1, $2, $2, $3);
4624
4625 # Should start with a space.
4626 $to =~ s/^(\S)/ $1/;
4627 # Should not end with a space.
4628 $to =~ s/\s+$//;
4629 # '*'s should not have spaces between.
4630 while ($to =~ s/\*\s+\*/\*\*/) {
4631 }
4632 # Modifiers should have spaces.
4633 $to =~ s/(\b$Modifier$)/$1 /;
4634
4635 ## print "2: from<$from> to<$to> ident<$ident>\n";
4636 if ($from ne $to && $ident !~ /^$Modifier$/) {
4637 if (ERROR("POINTER_LOCATION",
4638 "\"foo${from}bar\" should be \"foo${to}bar\"\n" . $herecurr) &&
4639 $fix) {
4640
4641 my $sub_from = $match;
4642 my $sub_to = $match;
4643 $sub_to =~ s/\Q$from\E/$to/;
4644 $fixed[$fixlinenr] =~
4645 s@\Q$sub_from\E@$sub_to@;
4646 }
4647 }
4648 }
4649
4650 # avoid BUG() or BUG_ON()
4651 if ($line =~ /\b(?:BUG|BUG_ON)\b/) {
4652 my $msg_level = \&WARN;
4653 $msg_level = \&CHK if ($file);
4654 &{$msg_level}("AVOID_BUG",
4655 "Avoid crashing the kernel - try using WARN_ON & recovery code rather than BUG() or BUG_ON()\n" . $herecurr);
4656 }
4657
4658 # avoid LINUX_VERSION_CODE
4659 if ($line =~ /\bLINUX_VERSION_CODE\b/) {
4660 WARN("LINUX_VERSION_CODE",
4661 "LINUX_VERSION_CODE should be avoided, code should be for the version to which it is merged\n" . $herecurr);
4662 }
4663
4664 # check for uses of printk_ratelimit
4665 if ($line =~ /\bprintk_ratelimit\s*\(/) {
4666 WARN("PRINTK_RATELIMITED",
4667 "Prefer printk_ratelimited or pr_<level>_ratelimited to printk_ratelimit\n" . $herecurr);
4668 }
4669
4670 # printk should use KERN_* levels
4671 if ($line =~ /\bprintk\s*\(\s*(?!KERN_[A-Z]+\b)/) {
4672 WARN("PRINTK_WITHOUT_KERN_LEVEL",
4673 "printk() should include KERN_<LEVEL> facility level\n" . $herecurr);
4674 }
4675
4676 # prefer variants of (subsystem|netdev|dev|pr)_<level> to printk(KERN_<LEVEL>
4677 if ($line =~ /\b(printk(_once|_ratelimited)?)\s*\(\s*KERN_([A-Z]+)/) {
4678 my $printk = $1;
4679 my $modifier = $2;
4680 my $orig = $3;
4681 $modifier = "" if (!defined($modifier));
4682 my $level = lc($orig);
4683 $level = "warn" if ($level eq "warning");
4684 my $level2 = $level;
4685 $level2 = "dbg" if ($level eq "debug");
4686 $level .= $modifier;
4687 $level2 .= $modifier;
4688 WARN("PREFER_PR_LEVEL",
4689 "Prefer [subsystem eg: netdev]_$level2([subsystem]dev, ... then dev_$level2(dev, ... then pr_$level(... to $printk(KERN_$orig ...\n" . $herecurr);
4690 }
4691
4692 # prefer dev_<level> to dev_printk(KERN_<LEVEL>
4693 if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
4694 my $orig = $1;
4695 my $level = lc($orig);
4696 $level = "warn" if ($level eq "warning");
4697 $level = "dbg" if ($level eq "debug");
4698 WARN("PREFER_DEV_LEVEL",
4699 "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
4700 }
4701
4702 # trace_printk should not be used in production code.
4703 if ($line =~ /\b(trace_printk|trace_puts|ftrace_vprintk)\s*\(/) {
4704 WARN("TRACE_PRINTK",
4705 "Do not use $1() in production code (this can be ignored if built only with a debug config option)\n" . $herecurr);
4706 }
4707
4708 # ENOSYS means "bad syscall nr" and nothing else. This will have a small
4709 # number of false positives, but assembly files are not checked, so at
4710 # least the arch entry code will not trigger this warning.
4711 if ($line =~ /\bENOSYS\b/) {
4712 WARN("ENOSYS",
4713 "ENOSYS means 'invalid syscall nr' and nothing else\n" . $herecurr);
4714 }
4715
4716 # ENOTSUPP is not a standard error code and should be avoided in new patches.
4717 # Folks usually mean EOPNOTSUPP (also called ENOTSUP), when they type ENOTSUPP.
4718 # Similarly to ENOSYS warning a small number of false positives is expected.
4719 if (!$file && $line =~ /\bENOTSUPP\b/) {
4720 if (WARN("ENOTSUPP",
4721 "ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP\n" . $herecurr) &&
4722 $fix) {
4723 $fixed[$fixlinenr] =~ s/\bENOTSUPP\b/EOPNOTSUPP/;
4724 }
4725 }
4726
4727 # function brace can't be on same line, except for #defines of do while,
4728 # or if closed on same line
4729 if ($perl_version_ok &&
4730 $sline =~ /$Type\s*$Ident\s*$balanced_parens\s*\{/ &&
4731 $sline !~ /\#\s*define\b.*do\s*\{/ &&
4732 $sline !~ /}/) {
4733 if (ERROR("OPEN_BRACE",
4734 "open brace '{' following function definitions go on the next line\n" . $herecurr) &&
4735 $fix) {
4736 fix_delete_line($fixlinenr, $rawline);
4737 my $fixed_line = $rawline;
4738 $fixed_line =~ /(^..*$Type\s*$Ident\(.*\)\s*)\{(.*)$/;
4739 my $line1 = $1;
4740 my $line2 = $2;
4741 fix_insert_line($fixlinenr, ltrim($line1));
4742 fix_insert_line($fixlinenr, "\+{");
4743 if ($line2 !~ /^\s*$/) {
4744 fix_insert_line($fixlinenr, "\+\t" . trim($line2));
4745 }
4746 }
4747 }
4748
4749 # open braces for enum, union and struct go on the same line.
4750 if ($line =~ /^.\s*{/ &&
4751 $prevline =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident)?\s*$/) {
4752 if (ERROR("OPEN_BRACE",
4753 "open brace '{' following $1 go on the same line\n" . $hereprev) &&
4754 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
4755 fix_delete_line($fixlinenr - 1, $prevrawline);
4756 fix_delete_line($fixlinenr, $rawline);
4757 my $fixedline = rtrim($prevrawline) . " {";
4758 fix_insert_line($fixlinenr, $fixedline);
4759 $fixedline = $rawline;
4760 $fixedline =~ s/^(.\s*)\{\s*/$1\t/;
4761 if ($fixedline !~ /^\+\s*$/) {
4762 fix_insert_line($fixlinenr, $fixedline);
4763 }
4764 }
4765 }
4766
4767 # missing space after union, struct or enum definition
4768 if ($line =~ /^.\s*(?:typedef\s+)?(enum|union|struct)(?:\s+$Ident){1,2}[=\{]/) {
4769 if (WARN("SPACING",
4770 "missing space after $1 definition\n" . $herecurr) &&
4771 $fix) {
4772 $fixed[$fixlinenr] =~
4773 s/^(.\s*(?:typedef\s+)?(?:enum|union|struct)(?:\s+$Ident){1,2})([=\{])/$1 $2/;
4774 }
4775 }
4776
4777 # Function pointer declarations
4778 # check spacing between type, funcptr, and args
4779 # canonical declaration is "type (*funcptr)(args...)"
4780 if ($line =~ /^.\s*($Declare)\((\s*)\*(\s*)($Ident)(\s*)\)(\s*)\(/) {
4781 my $declare = $1;
4782 my $pre_pointer_space = $2;
4783 my $post_pointer_space = $3;
4784 my $funcname = $4;
4785 my $post_funcname_space = $5;
4786 my $pre_args_space = $6;
4787
4788 # the $Declare variable will capture all spaces after the type
4789 # so check it for a missing trailing missing space but pointer return types
4790 # don't need a space so don't warn for those.
4791 my $post_declare_space = "";
4792 if ($declare =~ /(\s+)$/) {
4793 $post_declare_space = $1;
4794 $declare = rtrim($declare);
4795 }
4796 if ($declare !~ /\*$/ && $post_declare_space =~ /^$/) {
4797 WARN("SPACING",
4798 "missing space after return type\n" . $herecurr);
4799 $post_declare_space = " ";
4800 }
4801
4802 # unnecessary space "type (*funcptr)(args...)"
4803 # This test is not currently implemented because these declarations are
4804 # equivalent to
4805 # int foo(int bar, ...)
4806 # and this is form shouldn't/doesn't generate a checkpatch warning.
4807 #
4808 # elsif ($declare =~ /\s{2,}$/) {
4809 # WARN("SPACING",
4810 # "Multiple spaces after return type\n" . $herecurr);
4811 # }
4812
4813 # unnecessary space "type ( *funcptr)(args...)"
4814 if (defined $pre_pointer_space &&
4815 $pre_pointer_space =~ /^\s/) {
4816 WARN("SPACING",
4817 "Unnecessary space after function pointer open parenthesis\n" . $herecurr);
4818 }
4819
4820 # unnecessary space "type (* funcptr)(args...)"
4821 if (defined $post_pointer_space &&
4822 $post_pointer_space =~ /^\s/) {
4823 WARN("SPACING",
4824 "Unnecessary space before function pointer name\n" . $herecurr);
4825 }
4826
4827 # unnecessary space "type (*funcptr )(args...)"
4828 if (defined $post_funcname_space &&
4829 $post_funcname_space =~ /^\s/) {
4830 WARN("SPACING",
4831 "Unnecessary space after function pointer name\n" . $herecurr);
4832 }
4833
4834 # unnecessary space "type (*funcptr) (args...)"
4835 if (defined $pre_args_space &&
4836 $pre_args_space =~ /^\s/) {
4837 WARN("SPACING",
4838 "Unnecessary space before function pointer arguments\n" . $herecurr);
4839 }
4840
4841 if (show_type("SPACING") && $fix) {
4842 $fixed[$fixlinenr] =~
4843 s/^(.\s*)$Declare\s*\(\s*\*\s*$Ident\s*\)\s*\(/$1 . $declare . $post_declare_space . '(*' . $funcname . ')('/ex;
4844 }
4845 }
4846
4847 # check for spacing round square brackets; allowed:
4848 # 1. with a type on the left -- int [] a;
4849 # 2. at the beginning of a line for slice initialisers -- [0...10] = 5,
4850 # 3. inside a curly brace -- = { [0...10] = 5 }
4851 while ($line =~ /(.*?\s)\[/g) {
4852 my ($where, $prefix) = ($-[1], $1);
4853 if ($prefix !~ /$Type\s+$/ &&
4854 ($where != 0 || $prefix !~ /^.\s+$/) &&
4855 $prefix !~ /[{,:]\s+$/) {
4856 if (ERROR("BRACKET_SPACE",
4857 "space prohibited before open square bracket '['\n" . $herecurr) &&
4858 $fix) {
4859 $fixed[$fixlinenr] =~
4860 s/^(\+.*?)\s+\[/$1\[/;
4861 }
4862 }
4863 }
4864
4865 # check for spaces between functions and their parentheses.
4866 while ($line =~ /($Ident)\s+\(/g) {
4867 my $name = $1;
4868 my $ctx_before = substr($line, 0, $-[1]);
4869 my $ctx = "$ctx_before$name";
4870
4871 # Ignore those directives where spaces _are_ permitted.
4872 if ($name =~ /^(?:
4873 if|for|while|switch|return|case|
4874 volatile|__volatile__|
4875 __attribute__|format|__extension__|
4876 asm|__asm__)$/x)
4877 {
4878 # cpp #define statements have non-optional spaces, ie
4879 # if there is a space between the name and the open
4880 # parenthesis it is simply not a parameter group.
4881 } elsif ($ctx_before =~ /^.\s*\#\s*define\s*$/) {
4882
4883 # cpp #elif statement condition may start with a (
4884 } elsif ($ctx =~ /^.\s*\#\s*elif\s*$/) {
4885
4886 # If this whole things ends with a type its most
4887 # likely a typedef for a function.
4888 } elsif ($ctx =~ /$Type$/) {
4889
4890 } else {
4891 if (WARN("SPACING",
4892 "space prohibited between function name and open parenthesis '('\n" . $herecurr) &&
4893 $fix) {
4894 $fixed[$fixlinenr] =~
4895 s/\b$name\s+\(/$name\(/;
4896 }
4897 }
4898 }
4899
4900 # Check operator spacing.
4901 if (!($line=~/\#\s*include/)) {
4902 my $fixed_line = "";
4903 my $line_fixed = 0;
4904
4905 my $ops = qr{
4906 <<=|>>=|<=|>=|==|!=|
4907 \+=|-=|\*=|\/=|%=|\^=|\|=|&=|
4908 =>|->|<<|>>|<|>|=|!|~|
4909 &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%|
4910 \?:|\?|:
4911 }x;
4912 my @elements = split(/($ops|;)/, $opline);
4913
4914 ## print("element count: <" . $#elements . ">\n");
4915 ## foreach my $el (@elements) {
4916 ## print("el: <$el>\n");
4917 ## }
4918
4919 my @fix_elements = ();
4920 my $off = 0;
4921
4922 foreach my $el (@elements) {
4923 push(@fix_elements, substr($rawline, $off, length($el)));
4924 $off += length($el);
4925 }
4926
4927 $off = 0;
4928
4929 my $blank = copy_spacing($opline);
4930 my $last_after = -1;
4931
4932 for (my $n = 0; $n < $#elements; $n += 2) {
4933
4934 my $good = $fix_elements[$n] . $fix_elements[$n + 1];
4935
4936 ## print("n: <$n> good: <$good>\n");
4937
4938 $off += length($elements[$n]);
4939
4940 # Pick up the preceding and succeeding characters.
4941 my $ca = substr($opline, 0, $off);
4942 my $cc = '';
4943 if (length($opline) >= ($off + length($elements[$n + 1]))) {
4944 $cc = substr($opline, $off + length($elements[$n + 1]));
4945 }
4946 my $cb = "$ca$;$cc";
4947
4948 my $a = '';
4949 $a = 'V' if ($elements[$n] ne '');
4950 $a = 'W' if ($elements[$n] =~ /\s$/);
4951 $a = 'C' if ($elements[$n] =~ /$;$/);
4952 $a = 'B' if ($elements[$n] =~ /(\[|\()$/);
4953 $a = 'O' if ($elements[$n] eq '');
4954 $a = 'E' if ($ca =~ /^\s*$/);
4955
4956 my $op = $elements[$n + 1];
4957
4958 my $c = '';
4959 if (defined $elements[$n + 2]) {
4960 $c = 'V' if ($elements[$n + 2] ne '');
4961 $c = 'W' if ($elements[$n + 2] =~ /^\s/);
4962 $c = 'C' if ($elements[$n + 2] =~ /^$;/);
4963 $c = 'B' if ($elements[$n + 2] =~ /^(\)|\]|;)/);
4964 $c = 'O' if ($elements[$n + 2] eq '');
4965 $c = 'E' if ($elements[$n + 2] =~ /^\s*\\$/);
4966 } else {
4967 $c = 'E';
4968 }
4969
4970 my $ctx = "${a}x${c}";
4971
4972 my $at = "(ctx:$ctx)";
4973
4974 my $ptr = substr($blank, 0, $off) . "^";
4975 my $hereptr = "$hereline$ptr\n";
4976
4977 # Pull out the value of this operator.
4978 my $op_type = substr($curr_values, $off + 1, 1);
4979
4980 # Get the full operator variant.
4981 my $opv = $op . substr($curr_vars, $off, 1);
4982
4983 # Ignore operators passed as parameters.
4984 if ($op_type ne 'V' &&
4985 $ca =~ /\s$/ && $cc =~ /^\s*[,\)]/) {
4986
4987 # # Ignore comments
4988 # } elsif ($op =~ /^$;+$/) {
4989
4990 # ; should have either the end of line or a space or \ after it
4991 } elsif ($op eq ';') {
4992 if ($ctx !~ /.x[WEBC]/ &&
4993 $cc !~ /^\\/ && $cc !~ /^;/) {
4994 if (ERROR("SPACING",
4995 "space required after that '$op' $at\n" . $hereptr)) {
4996 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
4997 $line_fixed = 1;
4998 }
4999 }
5000
5001 # // is a comment
5002 } elsif ($op eq '//') {
5003
5004 # : when part of a bitfield
5005 } elsif ($opv eq ':B') {
5006 # skip the bitfield test for now
5007
5008 # No spaces for:
5009 # ->
5010 } elsif ($op eq '->') {
5011 if ($ctx =~ /Wx.|.xW/) {
5012 if (ERROR("SPACING",
5013 "spaces prohibited around that '$op' $at\n" . $hereptr)) {
5014 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
5015 if (defined $fix_elements[$n + 2]) {
5016 $fix_elements[$n + 2] =~ s/^\s+//;
5017 }
5018 $line_fixed = 1;
5019 }
5020 }
5021
5022 # , must not have a space before and must have a space on the right.
5023 } elsif ($op eq ',') {
5024 my $rtrim_before = 0;
5025 my $space_after = 0;
5026 if ($ctx =~ /Wx./) {
5027 if (ERROR("SPACING",
5028 "space prohibited before that '$op' $at\n" . $hereptr)) {
5029 $line_fixed = 1;
5030 $rtrim_before = 1;
5031 }
5032 }
5033 if ($ctx !~ /.x[WEC]/ && $cc !~ /^}/) {
5034 if (ERROR("SPACING",
5035 "space required after that '$op' $at\n" . $hereptr)) {
5036 $line_fixed = 1;
5037 $last_after = $n;
5038 $space_after = 1;
5039 }
5040 }
5041 if ($rtrim_before || $space_after) {
5042 if ($rtrim_before) {
5043 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
5044 } else {
5045 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]);
5046 }
5047 if ($space_after) {
5048 $good .= " ";
5049 }
5050 }
5051
5052 # '*' as part of a type definition -- reported already.
5053 } elsif ($opv eq '*_') {
5054 #warn "'*' is part of type\n";
5055
5056 # unary operators should have a space before and
5057 # none after. May be left adjacent to another
5058 # unary operator, or a cast
5059 } elsif ($op eq '!' || $op eq '~' ||
5060 $opv eq '*U' || $opv eq '-U' ||
5061 $opv eq '&U' || $opv eq '&&U') {
5062 if ($ctx !~ /[WEBC]x./ && $ca !~ /(?:\)|!|~|\*|-|\&|\||\+\+|\-\-|\{)$/) {
5063 if (ERROR("SPACING",
5064 "space required before that '$op' $at\n" . $hereptr)) {
5065 if ($n != $last_after + 2) {
5066 $good = $fix_elements[$n] . " " . ltrim($fix_elements[$n + 1]);
5067 $line_fixed = 1;
5068 }
5069 }
5070 }
5071 if ($op eq '*' && $cc =~/\s*$Modifier\b/) {
5072 # A unary '*' may be const
5073
5074 } elsif ($ctx =~ /.xW/) {
5075 if (ERROR("SPACING",
5076 "space prohibited after that '$op' $at\n" . $hereptr)) {
5077 $good = $fix_elements[$n] . rtrim($fix_elements[$n + 1]);
5078 if (defined $fix_elements[$n + 2]) {
5079 $fix_elements[$n + 2] =~ s/^\s+//;
5080 }
5081 $line_fixed = 1;
5082 }
5083 }
5084
5085 # unary ++ and unary -- are allowed no space on one side.
5086 } elsif ($op eq '++' or $op eq '--') {
5087 if ($ctx !~ /[WEOBC]x[^W]/ && $ctx !~ /[^W]x[WOBEC]/) {
5088 if (ERROR("SPACING",
5089 "space required one side of that '$op' $at\n" . $hereptr)) {
5090 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]) . " ";
5091 $line_fixed = 1;
5092 }
5093 }
5094 if ($ctx =~ /Wx[BE]/ ||
5095 ($ctx =~ /Wx./ && $cc =~ /^;/)) {
5096 if (ERROR("SPACING",
5097 "space prohibited before that '$op' $at\n" . $hereptr)) {
5098 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
5099 $line_fixed = 1;
5100 }
5101 }
5102 if ($ctx =~ /ExW/) {
5103 if (ERROR("SPACING",
5104 "space prohibited after that '$op' $at\n" . $hereptr)) {
5105 $good = $fix_elements[$n] . trim($fix_elements[$n + 1]);
5106 if (defined $fix_elements[$n + 2]) {
5107 $fix_elements[$n + 2] =~ s/^\s+//;
5108 }
5109 $line_fixed = 1;
5110 }
5111 }
5112
5113 # << and >> may either have or not have spaces both sides
5114 } elsif ($op eq '<<' or $op eq '>>' or
5115 $op eq '&' or $op eq '^' or $op eq '|' or
5116 $op eq '+' or $op eq '-' or
5117 $op eq '*' or $op eq '/' or
5118 $op eq '%')
5119 {
5120 if ($check) {
5121 if (defined $fix_elements[$n + 2] && $ctx !~ /[EW]x[EW]/) {
5122 if (CHK("SPACING",
5123 "spaces preferred around that '$op' $at\n" . $hereptr)) {
5124 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
5125 $fix_elements[$n + 2] =~ s/^\s+//;
5126 $line_fixed = 1;
5127 }
5128 } elsif (!defined $fix_elements[$n + 2] && $ctx !~ /Wx[OE]/) {
5129 if (CHK("SPACING",
5130 "space preferred before that '$op' $at\n" . $hereptr)) {
5131 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]);
5132 $line_fixed = 1;
5133 }
5134 }
5135 } elsif ($ctx =~ /Wx[^WCE]|[^WCE]xW/) {
5136 if (ERROR("SPACING",
5137 "need consistent spacing around '$op' $at\n" . $hereptr)) {
5138 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
5139 if (defined $fix_elements[$n + 2]) {
5140 $fix_elements[$n + 2] =~ s/^\s+//;
5141 }
5142 $line_fixed = 1;
5143 }
5144 }
5145
5146 # A colon needs no spaces before when it is
5147 # terminating a case value or a label.
5148 } elsif ($opv eq ':C' || $opv eq ':L') {
5149 if ($ctx =~ /Wx./ and $realfile !~ m@.*\.lds\.h$@) {
5150 if (ERROR("SPACING",
5151 "space prohibited before that '$op' $at\n" . $hereptr)) {
5152 $good = rtrim($fix_elements[$n]) . trim($fix_elements[$n + 1]);
5153 $line_fixed = 1;
5154 }
5155 }
5156
5157 # All the others need spaces both sides.
5158 } elsif ($ctx !~ /[EWC]x[CWE]/) {
5159 my $ok = 0;
5160
5161 # Ignore email addresses <foo@bar>
5162 if (($op eq '<' &&
5163 $cc =~ /^\S+\@\S+>/) ||
5164 ($op eq '>' &&
5165 $ca =~ /<\S+\@\S+$/))
5166 {
5167 $ok = 1;
5168 }
5169
5170 # for asm volatile statements
5171 # ignore a colon with another
5172 # colon immediately before or after
5173 if (($op eq ':') &&
5174 ($ca =~ /:$/ || $cc =~ /^:/)) {
5175 $ok = 1;
5176 }
5177
5178 # messages are ERROR, but ?: are CHK
5179 if ($ok == 0) {
5180 my $msg_level = \&ERROR;
5181 $msg_level = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/);
5182
5183 if (&{$msg_level}("SPACING",
5184 "spaces required around that '$op' $at\n" . $hereptr)) {
5185 $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " ";
5186 if (defined $fix_elements[$n + 2]) {
5187 $fix_elements[$n + 2] =~ s/^\s+//;
5188 }
5189 $line_fixed = 1;
5190 }
5191 }
5192 }
5193 $off += length($elements[$n + 1]);
5194
5195 ## print("n: <$n> GOOD: <$good>\n");
5196
5197 $fixed_line = $fixed_line . $good;
5198 }
5199
5200 if (($#elements % 2) == 0) {
5201 $fixed_line = $fixed_line . $fix_elements[$#elements];
5202 }
5203
5204 if ($fix && $line_fixed && $fixed_line ne $fixed[$fixlinenr]) {
5205 $fixed[$fixlinenr] = $fixed_line;
5206 }
5207
5208
5209 }
5210
5211 # check for whitespace before a non-naked semicolon
5212 if ($line =~ /^\+.*\S\s+;\s*$/) {
5213 if (WARN("SPACING",
5214 "space prohibited before semicolon\n" . $herecurr) &&
5215 $fix) {
5216 1 while $fixed[$fixlinenr] =~
5217 s/^(\+.*\S)\s+;/$1;/;
5218 }
5219 }
5220
5221 # check for multiple assignments
5222 if ($line =~ /^.\s*$Lval\s*=\s*$Lval\s*=(?!=)/) {
5223 CHK("MULTIPLE_ASSIGNMENTS",
5224 "multiple assignments should be avoided\n" . $herecurr);
5225 }
5226
5227 ## # check for multiple declarations, allowing for a function declaration
5228 ## # continuation.
5229 ## if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
5230 ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
5231 ##
5232 ## # Remove any bracketed sections to ensure we do not
5233 ## # falsely report the parameters of functions.
5234 ## my $ln = $line;
5235 ## while ($ln =~ s/\([^\(\)]*\)//g) {
5236 ## }
5237 ## if ($ln =~ /,/) {
5238 ## WARN("MULTIPLE_DECLARATION",
5239 ## "declaring multiple variables together should be avoided\n" . $herecurr);
5240 ## }
5241 ## }
5242
5243 #need space before brace following if, while, etc
5244 if (($line =~ /\(.*\)\{/ && $line !~ /\($Type\)\{/) ||
5245 $line =~ /\b(?:else|do)\{/) {
5246 if (ERROR("SPACING",
5247 "space required before the open brace '{'\n" . $herecurr) &&
5248 $fix) {
5249 $fixed[$fixlinenr] =~ s/^(\+.*(?:do|else|\)))\{/$1 {/;
5250 }
5251 }
5252
5253 ## # check for blank lines before declarations
5254 ## if ($line =~ /^.\t+$Type\s+$Ident(?:\s*=.*)?;/ &&
5255 ## $prevrawline =~ /^.\s*$/) {
5256 ## WARN("SPACING",
5257 ## "No blank lines before declarations\n" . $hereprev);
5258 ## }
5259 ##
5260
5261 # closing brace should have a space following it when it has anything
5262 # on the line
5263 if ($line =~ /}(?!(?:,|;|\)|\}))\S/) {
5264 if (ERROR("SPACING",
5265 "space required after that close brace '}'\n" . $herecurr) &&
5266 $fix) {
5267 $fixed[$fixlinenr] =~
5268 s/}((?!(?:,|;|\)))\S)/} $1/;
5269 }
5270 }
5271
5272 # check spacing on square brackets
5273 if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
5274 if (ERROR("SPACING",
5275 "space prohibited after that open square bracket '['\n" . $herecurr) &&
5276 $fix) {
5277 $fixed[$fixlinenr] =~
5278 s/\[\s+/\[/;
5279 }
5280 }
5281 if ($line =~ /\s\]/) {
5282 if (ERROR("SPACING",
5283 "space prohibited before that close square bracket ']'\n" . $herecurr) &&
5284 $fix) {
5285 $fixed[$fixlinenr] =~
5286 s/\s+\]/\]/;
5287 }
5288 }
5289
5290 # check spacing on parentheses
5291 if ($line =~ /\(\s/ && $line !~ /\(\s*(?:\\)?$/ &&
5292 $line !~ /for\s*\(\s+;/) {
5293 if (ERROR("SPACING",
5294 "space prohibited after that open parenthesis '('\n" . $herecurr) &&
5295 $fix) {
5296 $fixed[$fixlinenr] =~
5297 s/\(\s+/\(/;
5298 }
5299 }
5300 if ($line =~ /(\s+)\)/ && $line !~ /^.\s*\)/ &&
5301 $line !~ /for\s*\(.*;\s+\)/ &&
5302 $line !~ /:\s+\)/) {
5303 if (ERROR("SPACING",
5304 "space prohibited before that close parenthesis ')'\n" . $herecurr) &&
5305 $fix) {
5306 $fixed[$fixlinenr] =~
5307 s/\s+\)/\)/;
5308 }
5309 }
5310
5311 # check unnecessary parentheses around addressof/dereference single $Lvals
5312 # ie: &(foo->bar) should be &foo->bar and *(foo->bar) should be *foo->bar
5313
5314 while ($line =~ /(?:[^&]&\s*|\*)\(\s*($Ident\s*(?:$Member\s*)+)\s*\)/g) {
5315 my $var = $1;
5316 if (CHK("UNNECESSARY_PARENTHESES",
5317 "Unnecessary parentheses around $var\n" . $herecurr) &&
5318 $fix) {
5319 $fixed[$fixlinenr] =~ s/\(\s*\Q$var\E\s*\)/$var/;
5320 }
5321 }
5322
5323 # check for unnecessary parentheses around function pointer uses
5324 # ie: (foo->bar)(); should be foo->bar();
5325 # but not "if (foo->bar) (" to avoid some false positives
5326 if ($line =~ /(\bif\s*|)(\(\s*$Ident\s*(?:$Member\s*)+\))[ \t]*\(/ && $1 !~ /^if/) {
5327 my $var = $2;
5328 if (CHK("UNNECESSARY_PARENTHESES",
5329 "Unnecessary parentheses around function pointer $var\n" . $herecurr) &&
5330 $fix) {
5331 my $var2 = deparenthesize($var);
5332 $var2 =~ s/\s//g;
5333 $fixed[$fixlinenr] =~ s/\Q$var\E/$var2/;
5334 }
5335 }
5336
5337 # check for unnecessary parentheses around comparisons in if uses
5338 # when !drivers/staging or command-line uses --strict
5339 if (($realfile !~ m@^(?:drivers/staging/)@ || $check_orig) &&
5340 $perl_version_ok && defined($stat) &&
5341 $stat =~ /(^.\s*if\s*($balanced_parens))/) {
5342 my $if_stat = $1;
5343 my $test = substr($2, 1, -1);
5344 my $herectx;
5345 while ($test =~ /(?:^|[^\w\&\!\~])+\s*\(\s*([\&\!\~]?\s*$Lval\s*(?:$Compare\s*$FuncArg)?)\s*\)/g) {
5346 my $match = $1;
5347 # avoid parentheses around potential macro args
5348 next if ($match =~ /^\s*\w+\s*$/);
5349 if (!defined($herectx)) {
5350 $herectx = $here . "\n";
5351 my $cnt = statement_rawlines($if_stat);
5352 for (my $n = 0; $n < $cnt; $n++) {
5353 my $rl = raw_line($linenr, $n);
5354 $herectx .= $rl . "\n";
5355 last if $rl =~ /^[ \+].*\{/;
5356 }
5357 }
5358 CHK("UNNECESSARY_PARENTHESES",
5359 "Unnecessary parentheses around '$match'\n" . $herectx);
5360 }
5361 }
5362
5363 # check that goto labels aren't indented (allow a single space indentation)
5364 # and ignore bitfield definitions like foo:1
5365 # Strictly, labels can have whitespace after the identifier and before the :
5366 # but this is not allowed here as many ?: uses would appear to be labels
5367 if ($sline =~ /^.\s+[A-Za-z_][A-Za-z\d_]*:(?!\s*\d+)/ &&
5368 $sline !~ /^. [A-Za-z\d_][A-Za-z\d_]*:/ &&
5369 $sline !~ /^.\s+default:/) {
5370 if (WARN("INDENTED_LABEL",
5371 "labels should not be indented\n" . $herecurr) &&
5372 $fix) {
5373 $fixed[$fixlinenr] =~
5374 s/^(.)\s+/$1/;
5375 }
5376 }
5377
5378 # check if a statement with a comma should be two statements like:
5379 # foo = bar(), /* comma should be semicolon */
5380 # bar = baz();
5381 if (defined($stat) &&
5382 $stat =~ /^\+\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*,\s*(?:$Lval\s*$Assignment\s*)?$FuncArg\s*;\s*$/) {
5383 my $cnt = statement_rawlines($stat);
5384 my $herectx = get_stat_here($linenr, $cnt, $here);
5385 WARN("SUSPECT_COMMA_SEMICOLON",
5386 "Possible comma where semicolon could be used\n" . $herectx);
5387 }
5388
5389 # return is not a function
5390 if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) {
5391 my $spacing = $1;
5392 if ($perl_version_ok &&
5393 $stat =~ /^.\s*return\s*($balanced_parens)\s*;\s*$/) {
5394 my $value = $1;
5395 $value = deparenthesize($value);
5396 if ($value =~ m/^\s*$FuncArg\s*(?:\?|$)/) {
5397 ERROR("RETURN_PARENTHESES",
5398 "return is not a function, parentheses are not required\n" . $herecurr);
5399 }
5400 } elsif ($spacing !~ /\s+/) {
5401 ERROR("SPACING",
5402 "space required before the open parenthesis '('\n" . $herecurr);
5403 }
5404 }
5405
5406 # unnecessary return in a void function
5407 # at end-of-function, with the previous line a single leading tab, then return;
5408 # and the line before that not a goto label target like "out:"
5409 if ($sline =~ /^[ \+]}\s*$/ &&
5410 $prevline =~ /^\+\treturn\s*;\s*$/ &&
5411 $linenr >= 3 &&
5412 $lines[$linenr - 3] =~ /^[ +]/ &&
5413 $lines[$linenr - 3] !~ /^[ +]\s*$Ident\s*:/) {
5414 WARN("RETURN_VOID",
5415 "void function return statements are not generally useful\n" . $hereprev);
5416 }
5417
5418 # if statements using unnecessary parentheses - ie: if ((foo == bar))
5419 if ($perl_version_ok &&
5420 $line =~ /\bif\s*((?:\(\s*){2,})/) {
5421 my $openparens = $1;
5422 my $count = $openparens =~ tr@\(@\(@;
5423 my $msg = "";
5424 if ($line =~ /\bif\s*(?:\(\s*){$count,$count}$LvalOrFunc\s*($Compare)\s*$LvalOrFunc(?:\s*\)){$count,$count}/) {
5425 my $comp = $4; #Not $1 because of $LvalOrFunc
5426 $msg = " - maybe == should be = ?" if ($comp eq "==");
5427 WARN("UNNECESSARY_PARENTHESES",
5428 "Unnecessary parentheses$msg\n" . $herecurr);
5429 }
5430 }
5431
5432 # comparisons with a constant or upper case identifier on the left
5433 # avoid cases like "foo + BAR < baz"
5434 # only fix matches surrounded by parentheses to avoid incorrect
5435 # conversions like "FOO < baz() + 5" being "misfixed" to "baz() > FOO + 5"
5436 if ($perl_version_ok &&
5437 $line =~ /^\+(.*)\b($Constant|[A-Z_][A-Z0-9_]*)\s*($Compare)\s*($LvalOrFunc)/) {
5438 my $lead = $1;
5439 my $const = $2;
5440 my $comp = $3;
5441 my $to = $4;
5442 my $newcomp = $comp;
5443 if ($lead !~ /(?:$Operators|\.)\s*$/ &&
5444 $to !~ /^(?:Constant|[A-Z_][A-Z0-9_]*)$/ &&
5445 WARN("CONSTANT_COMPARISON",
5446 "Comparisons should place the constant on the right side of the test\n" . $herecurr) &&
5447 $fix) {
5448 if ($comp eq "<") {
5449 $newcomp = ">";
5450 } elsif ($comp eq "<=") {
5451 $newcomp = ">=";
5452 } elsif ($comp eq ">") {
5453 $newcomp = "<";
5454 } elsif ($comp eq ">=") {
5455 $newcomp = "<=";
5456 }
5457 $fixed[$fixlinenr] =~ s/\(\s*\Q$const\E\s*$Compare\s*\Q$to\E\s*\)/($to $newcomp $const)/;
5458 }
5459 }
5460
5461 # Return of what appears to be an errno should normally be negative
5462 if ($sline =~ /\breturn(?:\s*\(+\s*|\s+)(E[A-Z]+)(?:\s*\)+\s*|\s*)[;:,]/) {
5463 my $name = $1;
5464 if ($name ne 'EOF' && $name ne 'ERROR' && $name !~ /^EPOLL/) {
5465 WARN("USE_NEGATIVE_ERRNO",
5466 "return of an errno should typically be negative (ie: return -$1)\n" . $herecurr);
5467 }
5468 }
5469
5470 # Need a space before open parenthesis after if, while etc
5471 if ($line =~ /\b(if|while|for|switch)\(/) {
5472 if (ERROR("SPACING",
5473 "space required before the open parenthesis '('\n" . $herecurr) &&
5474 $fix) {
5475 $fixed[$fixlinenr] =~
5476 s/\b(if|while|for|switch)\(/$1 \(/;
5477 }
5478 }
5479
5480 # Check for illegal assignment in if conditional -- and check for trailing
5481 # statements after the conditional.
5482 if ($line =~ /do\s*(?!{)/) {
5483 ($stat, $cond, $line_nr_next, $remain_next, $off_next) =
5484 ctx_statement_block($linenr, $realcnt, 0)
5485 if (!defined $stat);
5486 my ($stat_next) = ctx_statement_block($line_nr_next,
5487 $remain_next, $off_next);
5488 $stat_next =~ s/\n./\n /g;
5489 ##print "stat<$stat> stat_next<$stat_next>\n";
5490
5491 if ($stat_next =~ /^\s*while\b/) {
5492 # If the statement carries leading newlines,
5493 # then count those as offsets.
5494 my ($whitespace) =
5495 ($stat_next =~ /^((?:\s*\n[+-])*\s*)/s);
5496 my $offset =
5497 statement_rawlines($whitespace) - 1;
5498
5499 $suppress_whiletrailers{$line_nr_next +
5500 $offset} = 1;
5501 }
5502 }
5503 if (!defined $suppress_whiletrailers{$linenr} &&
5504 defined($stat) && defined($cond) &&
5505 $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) {
5506 my ($s, $c) = ($stat, $cond);
5507
5508 if ($c =~ /\bif\s*\(.*[^<>!=]=[^=].*/s) {
5509 if (ERROR("ASSIGN_IN_IF",
5510 "do not use assignment in if condition\n" . $herecurr) &&
5511 $fix && $perl_version_ok) {
5512 if ($rawline =~ /^\+(\s+)if\s*\(\s*(\!)?\s*\(\s*(($Lval)\s*=\s*$LvalOrFunc)\s*\)\s*(?:($Compare)\s*($FuncArg))?\s*\)\s*(\{)?\s*$/) {
5513 my $space = $1;
5514 my $not = $2;
5515 my $statement = $3;
5516 my $assigned = $4;
5517 my $test = $8;
5518 my $against = $9;
5519 my $brace = $15;
5520 fix_delete_line($fixlinenr, $rawline);
5521 fix_insert_line($fixlinenr, "$space$statement;");
5522 my $newline = "${space}if (";
5523 $newline .= '!' if defined($not);
5524 $newline .= '(' if (defined $not && defined($test) && defined($against));
5525 $newline .= "$assigned";
5526 $newline .= " $test $against" if (defined($test) && defined($against));
5527 $newline .= ')' if (defined $not && defined($test) && defined($against));
5528 $newline .= ')';
5529 $newline .= " {" if (defined($brace));
5530 fix_insert_line($fixlinenr + 1, $newline);
5531 }
5532 }
5533 }
5534
5535 # Find out what is on the end of the line after the
5536 # conditional.
5537 substr($s, 0, length($c), '');
5538 $s =~ s/\n.*//g;
5539 $s =~ s/$;//g; # Remove any comments
5540 if (length($c) && $s !~ /^\s*{?\s*\\*\s*$/ &&
5541 $c !~ /}\s*while\s*/)
5542 {
5543 # Find out how long the conditional actually is.
5544 my @newlines = ($c =~ /\n/gs);
5545 my $cond_lines = 1 + $#newlines;
5546 my $stat_real = '';
5547
5548 $stat_real = raw_line($linenr, $cond_lines)
5549 . "\n" if ($cond_lines);
5550 if (defined($stat_real) && $cond_lines > 1) {
5551 $stat_real = "[...]\n$stat_real";
5552 }
5553
5554 ERROR("TRAILING_STATEMENTS",
5555 "trailing statements should be on next line\n" . $herecurr . $stat_real);
5556 }
5557 }
5558
5559 # Check for bitwise tests written as boolean
5560 if ($line =~ /
5561 (?:
5562 (?:\[|\(|\&\&|\|\|)
5563 \s*0[xX][0-9]+\s*
5564 (?:\&\&|\|\|)
5565 |
5566 (?:\&\&|\|\|)
5567 \s*0[xX][0-9]+\s*
5568 (?:\&\&|\|\||\)|\])
5569 )/x)
5570 {
5571 WARN("HEXADECIMAL_BOOLEAN_TEST",
5572 "boolean test with hexadecimal, perhaps just 1 \& or \|?\n" . $herecurr);
5573 }
5574
5575 # if and else should not have general statements after it
5576 if ($line =~ /^.\s*(?:}\s*)?else\b(.*)/) {
5577 my $s = $1;
5578 $s =~ s/$;//g; # Remove any comments
5579 if ($s !~ /^\s*(?:\sif|(?:{|)\s*\\?\s*$)/) {
5580 ERROR("TRAILING_STATEMENTS",
5581 "trailing statements should be on next line\n" . $herecurr);
5582 }
5583 }
5584 # if should not continue a brace
5585 if ($line =~ /}\s*if\b/) {
5586 ERROR("TRAILING_STATEMENTS",
5587 "trailing statements should be on next line (or did you mean 'else if'?)\n" .
5588 $herecurr);
5589 }
5590 # case and default should not have general statements after them
5591 if ($line =~ /^.\s*(?:case\s*.*|default\s*):/g &&
5592 $line !~ /\G(?:
5593 (?:\s*$;*)(?:\s*{)?(?:\s*$;*)(?:\s*\\)?\s*$|
5594 \s*return\s+
5595 )/xg)
5596 {
5597 ERROR("TRAILING_STATEMENTS",
5598 "trailing statements should be on next line\n" . $herecurr);
5599 }
5600
5601 # Check for }<nl>else {, these must be at the same
5602 # indent level to be relevant to each other.
5603 if ($prevline=~/}\s*$/ and $line=~/^.\s*else\s*/ &&
5604 $previndent == $indent) {
5605 if (ERROR("ELSE_AFTER_BRACE",
5606 "else should follow close brace '}'\n" . $hereprev) &&
5607 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
5608 fix_delete_line($fixlinenr - 1, $prevrawline);
5609 fix_delete_line($fixlinenr, $rawline);
5610 my $fixedline = $prevrawline;
5611 $fixedline =~ s/}\s*$//;
5612 if ($fixedline !~ /^\+\s*$/) {
5613 fix_insert_line($fixlinenr, $fixedline);
5614 }
5615 $fixedline = $rawline;
5616 $fixedline =~ s/^(.\s*)else/$1} else/;
5617 fix_insert_line($fixlinenr, $fixedline);
5618 }
5619 }
5620
5621 if ($prevline=~/}\s*$/ and $line=~/^.\s*while\s*/ &&
5622 $previndent == $indent) {
5623 my ($s, $c) = ctx_statement_block($linenr, $realcnt, 0);
5624
5625 # Find out what is on the end of the line after the
5626 # conditional.
5627 substr($s, 0, length($c), '');
5628 $s =~ s/\n.*//g;
5629
5630 if ($s =~ /^\s*;/) {
5631 if (ERROR("WHILE_AFTER_BRACE",
5632 "while should follow close brace '}'\n" . $hereprev) &&
5633 $fix && $prevline =~ /^\+/ && $line =~ /^\+/) {
5634 fix_delete_line($fixlinenr - 1, $prevrawline);
5635 fix_delete_line($fixlinenr, $rawline);
5636 my $fixedline = $prevrawline;
5637 my $trailing = $rawline;
5638 $trailing =~ s/^\+//;
5639 $trailing = trim($trailing);
5640 $fixedline =~ s/}\s*$/} $trailing/;
5641 fix_insert_line($fixlinenr, $fixedline);
5642 }
5643 }
5644 }
5645
5646 #Specific variable tests
5647 while ($line =~ m{($Constant|$Lval)}g) {
5648 my $var = $1;
5649
5650 #CamelCase
5651 if ($var !~ /^$Constant$/ &&
5652 $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
5653 #Ignore some autogenerated defines and enum values
5654 $var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/ &&
5655 #Ignore Page<foo> variants
5656 $var !~ /^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
5657 #Ignore SI style variants like nS, mV and dB
5658 #(ie: max_uV, regulator_min_uA_show, RANGE_mA_VALUE)
5659 $var !~ /^(?:[a-z0-9_]*|[A-Z0-9_]*)?_?[a-z][A-Z](?:_[a-z0-9_]+|_[A-Z0-9_]+)?$/ &&
5660 #Ignore some three character SI units explicitly, like MiB and KHz
5661 $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) {
5662 while ($var =~ m{($Ident)}g) {
5663 my $word = $1;
5664 next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/);
5665 if ($check) {
5666 seed_camelcase_includes();
5667 if (!$file && !$camelcase_file_seeded) {
5668 seed_camelcase_file($realfile);
5669 $camelcase_file_seeded = 1;
5670 }
5671 }
5672 if (!defined $camelcase{$word}) {
5673 $camelcase{$word} = 1;
5674 CHK("CAMELCASE",
5675 "Avoid CamelCase: <$word>\n" . $herecurr);
5676 }
5677 }
5678 }
5679 }
5680
5681 #no spaces allowed after \ in define
5682 if ($line =~ /\#\s*define.*\\\s+$/) {
5683 if (WARN("WHITESPACE_AFTER_LINE_CONTINUATION",
5684 "Whitespace after \\ makes next lines useless\n" . $herecurr) &&
5685 $fix) {
5686 $fixed[$fixlinenr] =~ s/\s+$//;
5687 }
5688 }
5689
5690 # warn if <asm/foo.h> is #included and <linux/foo.h> is available and includes
5691 # itself <asm/foo.h> (uses RAW line)
5692 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
5693 my $file = "$1.h";
5694 my $checkfile = "include/linux/$file";
5695 if (-f "$root/$checkfile" &&
5696 $realfile ne $checkfile &&
5697 $1 !~ /$allowed_asm_includes/)
5698 {
5699 my $asminclude = `grep -Ec "#include\\s+<asm/$file>" $root/$checkfile`;
5700 if ($asminclude > 0) {
5701 if ($realfile =~ m{^arch/}) {
5702 CHK("ARCH_INCLUDE_LINUX",
5703 "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
5704 } else {
5705 WARN("INCLUDE_LINUX",
5706 "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
5707 }
5708 }
5709 }
5710 }
5711
5712 # multi-statement macros should be enclosed in a do while loop, grab the
5713 # first statement and ensure its the whole macro if its not enclosed
5714 # in a known good container
5715 if ($realfile !~ m@/vmlinux.lds.h$@ &&
5716 $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) {
5717 my $ln = $linenr;
5718 my $cnt = $realcnt;
5719 my ($off, $dstat, $dcond, $rest);
5720 my $ctx = '';
5721 my $has_flow_statement = 0;
5722 my $has_arg_concat = 0;
5723 ($dstat, $dcond, $ln, $cnt, $off) =
5724 ctx_statement_block($linenr, $realcnt, 0);
5725 $ctx = $dstat;
5726 #print "dstat<$dstat> dcond<$dcond> cnt<$cnt> off<$off>\n";
5727 #print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n";
5728
5729 $has_flow_statement = 1 if ($ctx =~ /\b(goto|return)\b/);
5730 $has_arg_concat = 1 if ($ctx =~ /\#\#/ && $ctx !~ /\#\#\s*(?:__VA_ARGS__|args)\b/);
5731
5732 $dstat =~ s/^.\s*\#\s*define\s+$Ident(\([^\)]*\))?\s*//;
5733 my $define_args = $1;
5734 my $define_stmt = $dstat;
5735 my @def_args = ();
5736
5737 if (defined $define_args && $define_args ne "") {
5738 $define_args = substr($define_args, 1, length($define_args) - 2);
5739 $define_args =~ s/\s*//g;
5740 $define_args =~ s/\\\+?//g;
5741 @def_args = split(",", $define_args);
5742 }
5743
5744 $dstat =~ s/$;//g;
5745 $dstat =~ s/\\\n.//g;
5746 $dstat =~ s/^\s*//s;
5747 $dstat =~ s/\s*$//s;
5748
5749 # Flatten any parentheses and braces
5750 while ($dstat =~ s/\([^\(\)]*\)/1u/ ||
5751 $dstat =~ s/\{[^\{\}]*\}/1u/ ||
5752 $dstat =~ s/.\[[^\[\]]*\]/1u/)
5753 {
5754 }
5755
5756 # Flatten any obvious string concatenation.
5757 while ($dstat =~ s/($String)\s*$Ident/$1/ ||
5758 $dstat =~ s/$Ident\s*($String)/$1/)
5759 {
5760 }
5761
5762 # Make asm volatile uses seem like a generic function
5763 $dstat =~ s/\b_*asm_*\s+_*volatile_*\b/asm_volatile/g;
5764
5765 my $exceptions = qr{
5766 $Declare|
5767 module_param_named|
5768 MODULE_PARM_DESC|
5769 DECLARE_PER_CPU|
5770 DEFINE_PER_CPU|
5771 __typeof__\(|
5772 union|
5773 struct|
5774 \.$Ident\s*=\s*|
5775 ^\"|\"$|
5776 ^\[
5777 }x;
5778 #print "REST<$rest> dstat<$dstat> ctx<$ctx>\n";
5779
5780 $ctx =~ s/\n*$//;
5781 my $stmt_cnt = statement_rawlines($ctx);
5782 my $herectx = get_stat_here($linenr, $stmt_cnt, $here);
5783
5784 if ($dstat ne '' &&
5785 $dstat !~ /^(?:$Ident|-?$Constant),$/ && # 10, // foo(),
5786 $dstat !~ /^(?:$Ident|-?$Constant);$/ && # foo();
5787 $dstat !~ /^[!~-]?(?:$Lval|$Constant)$/ && # 10 // foo() // !foo // ~foo // -foo // foo->bar // foo.bar->baz
5788 $dstat !~ /^'X'$/ && $dstat !~ /^'XX'$/ && # character constants
5789 $dstat !~ /$exceptions/ &&
5790 $dstat !~ /^\.$Ident\s*=/ && # .foo =
5791 $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo
5792 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...)
5793 $dstat !~ /^while\s*$Constant\s*$Constant\s*$/ && # while (...) {...}
5794 $dstat !~ /^for\s*$Constant$/ && # for (...)
5795 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
5796 $dstat !~ /^do\s*{/ && # do {...
5797 $dstat !~ /^\(\{/ && # ({...
5798 $ctx !~ /^.\s*#\s*define\s+TRACE_(?:SYSTEM|INCLUDE_FILE|INCLUDE_PATH)\b/)
5799 {
5800 if ($dstat =~ /^\s*if\b/) {
5801 ERROR("MULTISTATEMENT_MACRO_USE_DO_WHILE",
5802 "Macros starting with if should be enclosed by a do - while loop to avoid possible if/else logic defects\n" . "$herectx");
5803 } elsif ($dstat =~ /;/) {
5804 ERROR("MULTISTATEMENT_MACRO_USE_DO_WHILE",
5805 "Macros with multiple statements should be enclosed in a do - while loop\n" . "$herectx");
5806 } else {
5807 ERROR("COMPLEX_MACRO",
5808 "Macros with complex values should be enclosed in parentheses\n" . "$herectx");
5809 }
5810
5811 }
5812
5813 # Make $define_stmt single line, comment-free, etc
5814 my @stmt_array = split('\n', $define_stmt);
5815 my $first = 1;
5816 $define_stmt = "";
5817 foreach my $l (@stmt_array) {
5818 $l =~ s/\\$//;
5819 if ($first) {
5820 $define_stmt = $l;
5821 $first = 0;
5822 } elsif ($l =~ /^[\+ ]/) {
5823 $define_stmt .= substr($l, 1);
5824 }
5825 }
5826 $define_stmt =~ s/$;//g;
5827 $define_stmt =~ s/\s+/ /g;
5828 $define_stmt = trim($define_stmt);
5829
5830 # check if any macro arguments are reused (ignore '...' and 'type')
5831 foreach my $arg (@def_args) {
5832 next if ($arg =~ /\.\.\./);
5833 next if ($arg =~ /^type$/i);
5834 my $tmp_stmt = $define_stmt;
5835 $tmp_stmt =~ s/\b(__must_be_array|offsetof|sizeof|sizeof_field|__stringify|typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
5836 $tmp_stmt =~ s/\#+\s*$arg\b//g;
5837 $tmp_stmt =~ s/\b$arg\s*\#\#//g;
5838 my $use_cnt = () = $tmp_stmt =~ /\b$arg\b/g;
5839 if ($use_cnt > 1) {
5840 CHK("MACRO_ARG_REUSE",
5841 "Macro argument reuse '$arg' - possible side-effects?\n" . "$herectx");
5842 }
5843 # check if any macro arguments may have other precedence issues
5844 if ($tmp_stmt =~ m/($Operators)?\s*\b$arg\b\s*($Operators)?/m &&
5845 ((defined($1) && $1 ne ',') ||
5846 (defined($2) && $2 ne ','))) {
5847 CHK("MACRO_ARG_PRECEDENCE",
5848 "Macro argument '$arg' may be better as '($arg)' to avoid precedence issues\n" . "$herectx");
5849 }
5850 }
5851
5852 # check for macros with flow control, but without ## concatenation
5853 # ## concatenation is commonly a macro that defines a function so ignore those
5854 if ($has_flow_statement && !$has_arg_concat) {
5855 my $cnt = statement_rawlines($ctx);
5856 my $herectx = get_stat_here($linenr, $cnt, $here);
5857
5858 WARN("MACRO_WITH_FLOW_CONTROL",
5859 "Macros with flow control statements should be avoided\n" . "$herectx");
5860 }
5861
5862 # check for line continuations outside of #defines, preprocessor #, and asm
5863
5864 } else {
5865 if ($prevline !~ /^..*\\$/ &&
5866 $line !~ /^\+\s*\#.*\\$/ && # preprocessor
5867 $line !~ /^\+.*\b(__asm__|asm)\b.*\\$/ && # asm
5868 $line =~ /^\+.*\\$/) {
5869 WARN("LINE_CONTINUATIONS",
5870 "Avoid unnecessary line continuations\n" . $herecurr);
5871 }
5872 }
5873
5874 # do {} while (0) macro tests:
5875 # single-statement macros do not need to be enclosed in do while (0) loop,
5876 # macro should not end with a semicolon
5877 if ($perl_version_ok &&
5878 $realfile !~ m@/vmlinux.lds.h$@ &&
5879 $line =~ /^.\s*\#\s*define\s+$Ident(\()?/) {
5880 my $ln = $linenr;
5881 my $cnt = $realcnt;
5882 my ($off, $dstat, $dcond, $rest);
5883 my $ctx = '';
5884 ($dstat, $dcond, $ln, $cnt, $off) =
5885 ctx_statement_block($linenr, $realcnt, 0);
5886 $ctx = $dstat;
5887
5888 $dstat =~ s/\\\n.//g;
5889 $dstat =~ s/$;/ /g;
5890
5891 if ($dstat =~ /^\+\s*#\s*define\s+$Ident\s*${balanced_parens}\s*do\s*{(.*)\s*}\s*while\s*\(\s*0\s*\)\s*([;\s]*)\s*$/) {
5892 my $stmts = $2;
5893 my $semis = $3;
5894
5895 $ctx =~ s/\n*$//;
5896 my $cnt = statement_rawlines($ctx);
5897 my $herectx = get_stat_here($linenr, $cnt, $here);
5898
5899 if (($stmts =~ tr/;/;/) == 1 &&
5900 $stmts !~ /^\s*(if|while|for|switch)\b/) {
5901 WARN("SINGLE_STATEMENT_DO_WHILE_MACRO",
5902 "Single statement macros should not use a do {} while (0) loop\n" . "$herectx");
5903 }
5904 if (defined $semis && $semis ne "") {
5905 WARN("DO_WHILE_MACRO_WITH_TRAILING_SEMICOLON",
5906 "do {} while (0) macros should not be semicolon terminated\n" . "$herectx");
5907 }
5908 } elsif ($dstat =~ /^\+\s*#\s*define\s+$Ident.*;\s*$/) {
5909 $ctx =~ s/\n*$//;
5910 my $cnt = statement_rawlines($ctx);
5911 my $herectx = get_stat_here($linenr, $cnt, $here);
5912
5913 WARN("TRAILING_SEMICOLON",
5914 "macros should not use a trailing semicolon\n" . "$herectx");
5915 }
5916 }
5917
5918 # check for redundant bracing round if etc
5919 if ($line =~ /(^.*)\bif\b/ && $1 !~ /else\s*$/) {
5920 my ($level, $endln, @chunks) =
5921 ctx_statement_full($linenr, $realcnt, 1);
5922 #print "chunks<$#chunks> linenr<$linenr> endln<$endln> level<$level>\n";
5923 #print "APW: <<$chunks[1][0]>><<$chunks[1][1]>>\n";
5924 if ($#chunks > 0 && $level == 0) {
5925 my @allowed = ();
5926 my $allow = 0;
5927 my $seen = 0;
5928 my $herectx = $here . "\n";
5929 my $ln = $linenr - 1;
5930 for my $chunk (@chunks) {
5931 my ($cond, $block) = @{$chunk};
5932
5933 # If the condition carries leading newlines, then count those as offsets.
5934 my ($whitespace) = ($cond =~ /^((?:\s*\n[+-])*\s*)/s);
5935 my $offset = statement_rawlines($whitespace) - 1;
5936
5937 $allowed[$allow] = 0;
5938 #print "COND<$cond> whitespace<$whitespace> offset<$offset>\n";
5939
5940 # We have looked at and allowed this specific line.
5941 $suppress_ifbraces{$ln + $offset} = 1;
5942
5943 $herectx .= "$rawlines[$ln + $offset]\n[...]\n";
5944 $ln += statement_rawlines($block) - 1;
5945
5946 substr($block, 0, length($cond), '');
5947
5948 $seen++ if ($block =~ /^\s*{/);
5949
5950 #print "cond<$cond> block<$block> allowed<$allowed[$allow]>\n";
5951 if (statement_lines($cond) > 1) {
5952 #print "APW: ALLOWED: cond<$cond>\n";
5953 $allowed[$allow] = 1;
5954 }
5955 if ($block =~/\b(?:if|for|while)\b/) {
5956 #print "APW: ALLOWED: block<$block>\n";
5957 $allowed[$allow] = 1;
5958 }
5959 if (statement_block_size($block) > 1) {
5960 #print "APW: ALLOWED: lines block<$block>\n";
5961 $allowed[$allow] = 1;
5962 }
5963 $allow++;
5964 }
5965 if ($seen) {
5966 my $sum_allowed = 0;
5967 foreach (@allowed) {
5968 $sum_allowed += $_;
5969 }
5970 if ($sum_allowed == 0) {
5971 WARN("BRACES",
5972 "braces {} are not necessary for any arm of this statement\n" . $herectx);
5973 } elsif ($sum_allowed != $allow &&
5974 $seen != $allow) {
5975 CHK("BRACES",
5976 "braces {} should be used on all arms of this statement\n" . $herectx);
5977 }
5978 }
5979 }
5980 }
5981 if (!defined $suppress_ifbraces{$linenr - 1} &&
5982 $line =~ /\b(if|while|for|else)\b/) {
5983 my $allowed = 0;
5984
5985 # Check the pre-context.
5986 if (substr($line, 0, $-[0]) =~ /(\}\s*)$/) {
5987 #print "APW: ALLOWED: pre<$1>\n";
5988 $allowed = 1;
5989 }
5990
5991 my ($level, $endln, @chunks) =
5992 ctx_statement_full($linenr, $realcnt, $-[0]);
5993
5994 # Check the condition.
5995 my ($cond, $block) = @{$chunks[0]};
5996 #print "CHECKING<$linenr> cond<$cond> block<$block>\n";
5997 if (defined $cond) {
5998 substr($block, 0, length($cond), '');
5999 }
6000 if (statement_lines($cond) > 1) {
6001 #print "APW: ALLOWED: cond<$cond>\n";
6002 $allowed = 1;
6003 }
6004 if ($block =~/\b(?:if|for|while)\b/) {
6005 #print "APW: ALLOWED: block<$block>\n";
6006 $allowed = 1;
6007 }
6008 if (statement_block_size($block) > 1) {
6009 #print "APW: ALLOWED: lines block<$block>\n";
6010 $allowed = 1;
6011 }
6012 # Check the post-context.
6013 if (defined $chunks[1]) {
6014 my ($cond, $block) = @{$chunks[1]};
6015 if (defined $cond) {
6016 substr($block, 0, length($cond), '');
6017 }
6018 if ($block =~ /^\s*\{/) {
6019 #print "APW: ALLOWED: chunk-1 block<$block>\n";
6020 $allowed = 1;
6021 }
6022 }
6023 if ($level == 0 && $block =~ /^\s*\{/ && !$allowed) {
6024 my $cnt = statement_rawlines($block);
6025 my $herectx = get_stat_here($linenr, $cnt, $here);
6026
6027 WARN("BRACES",
6028 "braces {} are not necessary for single statement blocks\n" . $herectx);
6029 }
6030 }
6031
6032 # check for single line unbalanced braces
6033 if ($sline =~ /^.\s*\}\s*else\s*$/ ||
6034 $sline =~ /^.\s*else\s*\{\s*$/) {
6035 CHK("BRACES", "Unbalanced braces around else statement\n" . $herecurr);
6036 }
6037
6038 # check for unnecessary blank lines around braces
6039 if (($line =~ /^.\s*}\s*$/ && $prevrawline =~ /^.\s*$/)) {
6040 if (CHK("BRACES",
6041 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev) &&
6042 $fix && $prevrawline =~ /^\+/) {
6043 fix_delete_line($fixlinenr - 1, $prevrawline);
6044 }
6045 }
6046 if (($rawline =~ /^.\s*$/ && $prevline =~ /^..*{\s*$/)) {
6047 if (CHK("BRACES",
6048 "Blank lines aren't necessary after an open brace '{'\n" . $hereprev) &&
6049 $fix) {
6050 fix_delete_line($fixlinenr, $rawline);
6051 }
6052 }
6053
6054 # no volatiles please
6055 my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
6056 if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {
6057 WARN("VOLATILE",
6058 "Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst\n" . $herecurr);
6059 }
6060
6061 # Check for user-visible strings broken across lines, which breaks the ability
6062 # to grep for the string. Make exceptions when the previous string ends in a
6063 # newline (multiple lines in one string constant) or '\t', '\r', ';', or '{'
6064 # (common in inline assembly) or is a octal \123 or hexadecimal \xaf value
6065 if ($line =~ /^\+\s*$String/ &&
6066 $prevline =~ /"\s*$/ &&
6067 $prevrawline !~ /(?:\\(?:[ntr]|[0-7]{1,3}|x[0-9a-fA-F]{1,2})|;\s*|\{\s*)"\s*$/) {
6068 if (WARN("SPLIT_STRING",
6069 "quoted string split across lines\n" . $hereprev) &&
6070 $fix &&
6071 $prevrawline =~ /^\+.*"\s*$/ &&
6072 $last_coalesced_string_linenr != $linenr - 1) {
6073 my $extracted_string = get_quoted_string($line, $rawline);
6074 my $comma_close = "";
6075 if ($rawline =~ /\Q$extracted_string\E(\s*\)\s*;\s*$|\s*,\s*)/) {
6076 $comma_close = $1;
6077 }
6078
6079 fix_delete_line($fixlinenr - 1, $prevrawline);
6080 fix_delete_line($fixlinenr, $rawline);
6081 my $fixedline = $prevrawline;
6082 $fixedline =~ s/"\s*$//;
6083 $fixedline .= substr($extracted_string, 1) . trim($comma_close);
6084 fix_insert_line($fixlinenr - 1, $fixedline);
6085 $fixedline = $rawline;
6086 $fixedline =~ s/\Q$extracted_string\E\Q$comma_close\E//;
6087 if ($fixedline !~ /\+\s*$/) {
6088 fix_insert_line($fixlinenr, $fixedline);
6089 }
6090 $last_coalesced_string_linenr = $linenr;
6091 }
6092 }
6093
6094 # check for missing a space in a string concatenation
6095 if ($prevrawline =~ /[^\\]\w"$/ && $rawline =~ /^\+[\t ]+"\w/) {
6096 WARN('MISSING_SPACE',
6097 "break quoted strings at a space character\n" . $hereprev);
6098 }
6099
6100 # check for an embedded function name in a string when the function is known
6101 # This does not work very well for -f --file checking as it depends on patch
6102 # context providing the function name or a single line form for in-file
6103 # function declarations
6104 if ($line =~ /^\+.*$String/ &&
6105 defined($context_function) &&
6106 get_quoted_string($line, $rawline) =~ /\b$context_function\b/ &&
6107 length(get_quoted_string($line, $rawline)) != (length($context_function) + 2)) {
6108 WARN("EMBEDDED_FUNCTION_NAME",
6109 "Prefer using '\"%s...\", __func__' to using '$context_function', this function's name, in a string\n" . $herecurr);
6110 }
6111
6112 # check for unnecessary function tracing like uses
6113 # This does not use $logFunctions because there are many instances like
6114 # 'dprintk(FOO, "%s()\n", __func__);' which do not match $logFunctions
6115 if ($rawline =~ /^\+.*\([^"]*"$tracing_logging_tags{0,3}%s(?:\s*\(\s*\)\s*)?$tracing_logging_tags{0,3}(?:\\n)?"\s*,\s*__func__\s*\)\s*;/) {
6116 if (WARN("TRACING_LOGGING",
6117 "Unnecessary ftrace-like logging - prefer using ftrace\n" . $herecurr) &&
6118 $fix) {
6119 fix_delete_line($fixlinenr, $rawline);
6120 }
6121 }
6122
6123 # check for spaces before a quoted newline
6124 if ($rawline =~ /^.*\".*\s\\n/) {
6125 if (WARN("QUOTED_WHITESPACE_BEFORE_NEWLINE",
6126 "unnecessary whitespace before a quoted newline\n" . $herecurr) &&
6127 $fix) {
6128 $fixed[$fixlinenr] =~ s/^(\+.*\".*)\s+\\n/$1\\n/;
6129 }
6130
6131 }
6132
6133 # concatenated string without spaces between elements
6134 if ($line =~ /$String[A-Za-z0-9_]/ || $line =~ /[A-Za-z0-9_]$String/) {
6135 if (CHK("CONCATENATED_STRING",
6136 "Concatenated strings should use spaces between elements\n" . $herecurr) &&
6137 $fix) {
6138 while ($line =~ /($String)/g) {
6139 my $extracted_string = substr($rawline, $-[0], $+[0] - $-[0]);
6140 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E([A-Za-z0-9_])/$extracted_string $1/;
6141 $fixed[$fixlinenr] =~ s/([A-Za-z0-9_])\Q$extracted_string\E/$1 $extracted_string/;
6142 }
6143 }
6144 }
6145
6146 # uncoalesced string fragments
6147 if ($line =~ /$String\s*"/) {
6148 if (WARN("STRING_FRAGMENTS",
6149 "Consecutive strings are generally better as a single string\n" . $herecurr) &&
6150 $fix) {
6151 while ($line =~ /($String)(?=\s*")/g) {
6152 my $extracted_string = substr($rawline, $-[0], $+[0] - $-[0]);
6153 $fixed[$fixlinenr] =~ s/\Q$extracted_string\E\s*"/substr($extracted_string, 0, -1)/e;
6154 }
6155 }
6156 }
6157
6158 # check for non-standard and hex prefixed decimal printf formats
6159 my $show_L = 1; #don't show the same defect twice
6160 my $show_Z = 1;
6161 while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) {
6162 my $string = substr($rawline, $-[1], $+[1] - $-[1]);
6163 $string =~ s/%%/__/g;
6164 # check for %L
6165 if ($show_L && $string =~ /%[\*\d\.\$]*L([diouxX])/) {
6166 WARN("PRINTF_L",
6167 "\%L$1 is non-standard C, use %ll$1\n" . $herecurr);
6168 $show_L = 0;
6169 }
6170 # check for %Z
6171 if ($show_Z && $string =~ /%[\*\d\.\$]*Z([diouxX])/) {
6172 WARN("PRINTF_Z",
6173 "%Z$1 is non-standard C, use %z$1\n" . $herecurr);
6174 $show_Z = 0;
6175 }
6176 # check for 0x<decimal>
6177 if ($string =~ /0x%[\*\d\.\$\Llzth]*[diou]/) {
6178 ERROR("PRINTF_0XDECIMAL",
6179 "Prefixing 0x with decimal output is defective\n" . $herecurr);
6180 }
6181 }
6182
6183 # check for line continuations in quoted strings with odd counts of "
6184 if ($rawline =~ /\\$/ && $sline =~ tr/"/"/ % 2) {
6185 WARN("LINE_CONTINUATIONS",
6186 "Avoid line continuations in quoted strings\n" . $herecurr);
6187 }
6188
6189 # warn about #if 0
6190 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
6191 WARN("IF_0",
6192 "Consider removing the code enclosed by this #if 0 and its #endif\n" . $herecurr);
6193 }
6194
6195 # warn about #if 1
6196 if ($line =~ /^.\s*\#\s*if\s+1\b/) {
6197 WARN("IF_1",
6198 "Consider removing the #if 1 and its #endif\n" . $herecurr);
6199 }
6200
6201 # check for needless "if (<foo>) fn(<foo>)" uses
6202 if ($prevline =~ /\bif\s*\(\s*($Lval)\s*\)/) {
6203 my $tested = quotemeta($1);
6204 my $expr = '\s*\(\s*' . $tested . '\s*\)\s*;';
6205 if ($line =~ /\b(kfree|usb_free_urb|debugfs_remove(?:_recursive)?|(?:kmem_cache|mempool|dma_pool)_destroy)$expr/) {
6206 my $func = $1;
6207 if (WARN('NEEDLESS_IF',
6208 "$func(NULL) is safe and this check is probably not required\n" . $hereprev) &&
6209 $fix) {
6210 my $do_fix = 1;
6211 my $leading_tabs = "";
6212 my $new_leading_tabs = "";
6213 if ($lines[$linenr - 2] =~ /^\+(\t*)if\s*\(\s*$tested\s*\)\s*$/) {
6214 $leading_tabs = $1;
6215 } else {
6216 $do_fix = 0;
6217 }
6218 if ($lines[$linenr - 1] =~ /^\+(\t+)$func\s*\(\s*$tested\s*\)\s*;\s*$/) {
6219 $new_leading_tabs = $1;
6220 if (length($leading_tabs) + 1 ne length($new_leading_tabs)) {
6221 $do_fix = 0;
6222 }
6223 } else {
6224 $do_fix = 0;
6225 }
6226 if ($do_fix) {
6227 fix_delete_line($fixlinenr - 1, $prevrawline);
6228 $fixed[$fixlinenr] =~ s/^\+$new_leading_tabs/\+$leading_tabs/;
6229 }
6230 }
6231 }
6232 }
6233
6234 # check for unnecessary "Out of Memory" messages
6235 if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
6236 $prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
6237 (defined $1 || defined $3) &&
6238 $linenr > 3) {
6239 my $testval = $2;
6240 my $testline = $lines[$linenr - 3];
6241
6242 my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0);
6243 # print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n");
6244
6245 if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*$allocFunctions\s*\(/ &&
6246 $s !~ /\b__GFP_NOWARN\b/ ) {
6247 WARN("OOM_MESSAGE",
6248 "Possible unnecessary 'out of memory' message\n" . $hereprev);
6249 }
6250 }
6251
6252 # check for logging functions with KERN_<LEVEL>
6253 if ($line !~ /printk(?:_ratelimited|_once)?\s*\(/ &&
6254 $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
6255 my $level = $1;
6256 if (WARN("UNNECESSARY_KERN_LEVEL",
6257 "Possible unnecessary $level\n" . $herecurr) &&
6258 $fix) {
6259 $fixed[$fixlinenr] =~ s/\s*$level\s*//;
6260 }
6261 }
6262
6263 # check for logging continuations
6264 if ($line =~ /\bprintk\s*\(\s*KERN_CONT\b|\bpr_cont\s*\(/) {
6265 WARN("LOGGING_CONTINUATION",
6266 "Avoid logging continuation uses where feasible\n" . $herecurr);
6267 }
6268
6269 # check for unnecessary use of %h[xudi] and %hh[xudi] in logging functions
6270 if (defined $stat &&
6271 $line =~ /\b$logFunctions\s*\(/ &&
6272 index($stat, '"') >= 0) {
6273 my $lc = $stat =~ tr@\n@@;
6274 $lc = $lc + $linenr;
6275 my $stat_real = get_stat_real($linenr, $lc);
6276 pos($stat_real) = index($stat_real, '"');
6277 while ($stat_real =~ /[^\"%]*(%[\#\d\.\*\-]*(h+)[idux])/g) {
6278 my $pspec = $1;
6279 my $h = $2;
6280 my $lineoff = substr($stat_real, 0, $-[1]) =~ tr@\n@@;
6281 if (WARN("UNNECESSARY_MODIFIER",
6282 "Integer promotion: Using '$h' in '$pspec' is unnecessary\n" . "$here\n$stat_real\n") &&
6283 $fix && $fixed[$fixlinenr + $lineoff] =~ /^\+/) {
6284 my $nspec = $pspec;
6285 $nspec =~ s/h//g;
6286 $fixed[$fixlinenr + $lineoff] =~ s/\Q$pspec\E/$nspec/;
6287 }
6288 }
6289 }
6290
6291 # check for mask then right shift without a parentheses
6292 if ($perl_version_ok &&
6293 $line =~ /$LvalOrFunc\s*\&\s*($LvalOrFunc)\s*>>/ &&
6294 $4 !~ /^\&/) { # $LvalOrFunc may be &foo, ignore if so
6295 WARN("MASK_THEN_SHIFT",
6296 "Possible precedence defect with mask then right shift - may need parentheses\n" . $herecurr);
6297 }
6298
6299 # check for pointer comparisons to NULL
6300 if ($perl_version_ok) {
6301 while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
6302 my $val = $1;
6303 my $equal = "!";
6304 $equal = "" if ($4 eq "!=");
6305 if (CHK("COMPARISON_TO_NULL",
6306 "Comparison to NULL could be written \"${equal}${val}\"\n" . $herecurr) &&
6307 $fix) {
6308 $fixed[$fixlinenr] =~ s/\b\Q$val\E\s*(?:==|\!=)\s*NULL\b/$equal$val/;
6309 }
6310 }
6311 }
6312
6313 # check for bad placement of section $InitAttribute (e.g.: __initdata)
6314 if ($line =~ /(\b$InitAttribute\b)/) {
6315 my $attr = $1;
6316 if ($line =~ /^\+\s*static\s+(?:const\s+)?(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*[=;]/) {
6317 my $ptr = $1;
6318 my $var = $2;
6319 if ((($ptr =~ /\b(union|struct)\s+$attr\b/ &&
6320 ERROR("MISPLACED_INIT",
6321 "$attr should be placed after $var\n" . $herecurr)) ||
6322 ($ptr !~ /\b(union|struct)\s+$attr\b/ &&
6323 WARN("MISPLACED_INIT",
6324 "$attr should be placed after $var\n" . $herecurr))) &&
6325 $fix) {
6326 $fixed[$fixlinenr] =~ s/(\bstatic\s+(?:const\s+)?)(?:$attr\s+)?($NonptrTypeWithAttr)\s+(?:$attr\s+)?($Ident(?:\[[^]]*\])?)\s*([=;])\s*/"$1" . trim(string_find_replace($2, "\\s*$attr\\s*", " ")) . " " . trim(string_find_replace($3, "\\s*$attr\\s*", "")) . " $attr" . ("$4" eq ";" ? ";" : " = ")/e;
6327 }
6328 }
6329 }
6330
6331 # check for $InitAttributeData (ie: __initdata) with const
6332 if ($line =~ /\bconst\b/ && $line =~ /($InitAttributeData)/) {
6333 my $attr = $1;
6334 $attr =~ /($InitAttributePrefix)(.*)/;
6335 my $attr_prefix = $1;
6336 my $attr_type = $2;
6337 if (ERROR("INIT_ATTRIBUTE",
6338 "Use of const init definition must use ${attr_prefix}initconst\n" . $herecurr) &&
6339 $fix) {
6340 $fixed[$fixlinenr] =~
6341 s/$InitAttributeData/${attr_prefix}initconst/;
6342 }
6343 }
6344
6345 # check for $InitAttributeConst (ie: __initconst) without const
6346 if ($line !~ /\bconst\b/ && $line =~ /($InitAttributeConst)/) {
6347 my $attr = $1;
6348 if (ERROR("INIT_ATTRIBUTE",
6349 "Use of $attr requires a separate use of const\n" . $herecurr) &&
6350 $fix) {
6351 my $lead = $fixed[$fixlinenr] =~
6352 /(^\+\s*(?:static\s+))/;
6353 $lead = rtrim($1);
6354 $lead = "$lead " if ($lead !~ /^\+$/);
6355 $lead = "${lead}const ";
6356 $fixed[$fixlinenr] =~ s/(^\+\s*(?:static\s+))/$lead/;
6357 }
6358 }
6359
6360 # check for __read_mostly with const non-pointer (should just be const)
6361 if ($line =~ /\b__read_mostly\b/ &&
6362 $line =~ /($Type)\s*$Ident/ && $1 !~ /\*\s*$/ && $1 =~ /\bconst\b/) {
6363 if (ERROR("CONST_READ_MOSTLY",
6364 "Invalid use of __read_mostly with const type\n" . $herecurr) &&
6365 $fix) {
6366 $fixed[$fixlinenr] =~ s/\s+__read_mostly\b//;
6367 }
6368 }
6369
6370 # don't use __constant_<foo> functions outside of include/uapi/
6371 if ($realfile !~ m@^include/uapi/@ &&
6372 $line =~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_to_[bl]e(?:16|32|64)))\s*\(/) {
6373 my $constant_func = $1;
6374 my $func = $constant_func;
6375 $func =~ s/^__constant_//;
6376 if (WARN("CONSTANT_CONVERSION",
6377 "$constant_func should be $func\n" . $herecurr) &&
6378 $fix) {
6379 $fixed[$fixlinenr] =~ s/\b$constant_func\b/$func/g;
6380 }
6381 }
6382
6383 # prefer usleep_range over udelay
6384 if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) {
6385 my $delay = $1;
6386 # ignore udelay's < 10, however
6387 if (! ($delay < 10) ) {
6388 CHK("USLEEP_RANGE",
6389 "usleep_range is preferred over udelay; see Documentation/timers/timers-howto.rst\n" . $herecurr);
6390 }
6391 if ($delay > 2000) {
6392 WARN("LONG_UDELAY",
6393 "long udelay - prefer mdelay; see arch/arm/include/asm/delay.h\n" . $herecurr);
6394 }
6395 }
6396
6397 # warn about unexpectedly long msleep's
6398 if ($line =~ /\bmsleep\s*\((\d+)\);/) {
6399 if ($1 < 20) {
6400 WARN("MSLEEP",
6401 "msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.rst\n" . $herecurr);
6402 }
6403 }
6404
6405 # check for comparisons of jiffies
6406 if ($line =~ /\bjiffies\s*$Compare|$Compare\s*jiffies\b/) {
6407 WARN("JIFFIES_COMPARISON",
6408 "Comparing jiffies is almost always wrong; prefer time_after, time_before and friends\n" . $herecurr);
6409 }
6410
6411 # check for comparisons of get_jiffies_64()
6412 if ($line =~ /\bget_jiffies_64\s*\(\s*\)\s*$Compare|$Compare\s*get_jiffies_64\s*\(\s*\)/) {
6413 WARN("JIFFIES_COMPARISON",
6414 "Comparing get_jiffies_64() is almost always wrong; prefer time_after64, time_before64 and friends\n" . $herecurr);
6415 }
6416
6417 # warn about #ifdefs in C files
6418 # if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
6419 # print "#ifdef in C files should be avoided\n";
6420 # print "$herecurr";
6421 # $clean = 0;
6422 # }
6423
6424 # warn about spacing in #ifdefs
6425 if ($line =~ /^.\s*\#\s*(ifdef|ifndef|elif)\s\s+/) {
6426 if (ERROR("SPACING",
6427 "exactly one space required after that #$1\n" . $herecurr) &&
6428 $fix) {
6429 $fixed[$fixlinenr] =~
6430 s/^(.\s*\#\s*(ifdef|ifndef|elif))\s{2,}/$1 /;
6431 }
6432
6433 }
6434
6435 # check for spinlock_t definitions without a comment.
6436 if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/ ||
6437 $line =~ /^.\s*(DEFINE_MUTEX)\s*\(/) {
6438 my $which = $1;
6439 if (!ctx_has_comment($first_line, $linenr)) {
6440 CHK("UNCOMMENTED_DEFINITION",
6441 "$1 definition without comment\n" . $herecurr);
6442 }
6443 }
6444 # check for memory barriers without a comment.
6445
6446 my $barriers = qr{
6447 mb|
6448 rmb|
6449 wmb
6450 }x;
6451 my $barrier_stems = qr{
6452 mb__before_atomic|
6453 mb__after_atomic|
6454 store_release|
6455 load_acquire|
6456 store_mb|
6457 (?:$barriers)
6458 }x;
6459 my $all_barriers = qr{
6460 (?:$barriers)|
6461 smp_(?:$barrier_stems)|
6462 virt_(?:$barrier_stems)
6463 }x;
6464
6465 if ($line =~ /\b(?:$all_barriers)\s*\(/) {
6466 if (!ctx_has_comment($first_line, $linenr)) {
6467 WARN("MEMORY_BARRIER",
6468 "memory barrier without comment\n" . $herecurr);
6469 }
6470 }
6471
6472 my $underscore_smp_barriers = qr{__smp_(?:$barrier_stems)}x;
6473
6474 if ($realfile !~ m@^include/asm-generic/@ &&
6475 $realfile !~ m@/barrier\.h$@ &&
6476 $line =~ m/\b(?:$underscore_smp_barriers)\s*\(/ &&
6477 $line !~ m/^.\s*\#\s*define\s+(?:$underscore_smp_barriers)\s*\(/) {
6478 WARN("MEMORY_BARRIER",
6479 "__smp memory barriers shouldn't be used outside barrier.h and asm-generic\n" . $herecurr);
6480 }
6481
6482 # check for waitqueue_active without a comment.
6483 if ($line =~ /\bwaitqueue_active\s*\(/) {
6484 if (!ctx_has_comment($first_line, $linenr)) {
6485 WARN("WAITQUEUE_ACTIVE",
6486 "waitqueue_active without comment\n" . $herecurr);
6487 }
6488 }
6489
6490 # check for data_race without a comment.
6491 if ($line =~ /\bdata_race\s*\(/) {
6492 if (!ctx_has_comment($first_line, $linenr)) {
6493 WARN("DATA_RACE",
6494 "data_race without comment\n" . $herecurr);
6495 }
6496 }
6497
6498 # check of hardware specific defines
6499 if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
6500 CHK("ARCH_DEFINES",
6501 "architecture specific defines should be avoided\n" . $herecurr);
6502 }
6503
6504 # check that the storage class is not after a type
6505 if ($line =~ /\b($Type)\s+($Storage)\b/) {
6506 WARN("STORAGE_CLASS",
6507 "storage class '$2' should be located before type '$1'\n" . $herecurr);
6508 }
6509 # Check that the storage class is at the beginning of a declaration
6510 if ($line =~ /\b$Storage\b/ &&
6511 $line !~ /^.\s*$Storage/ &&
6512 $line =~ /^.\s*(.+?)\$Storage\s/ &&
6513 $1 !~ /[\,\)]\s*$/) {
6514 WARN("STORAGE_CLASS",
6515 "storage class should be at the beginning of the declaration\n" . $herecurr);
6516 }
6517
6518 # check the location of the inline attribute, that it is between
6519 # storage class and type.
6520 if ($line =~ /\b$Type\s+$Inline\b/ ||
6521 $line =~ /\b$Inline\s+$Storage\b/) {
6522 ERROR("INLINE_LOCATION",
6523 "inline keyword should sit between storage class and type\n" . $herecurr);
6524 }
6525
6526 # Check for __inline__ and __inline, prefer inline
6527 if ($realfile !~ m@\binclude/uapi/@ &&
6528 $line =~ /\b(__inline__|__inline)\b/) {
6529 if (WARN("INLINE",
6530 "plain inline is preferred over $1\n" . $herecurr) &&
6531 $fix) {
6532 $fixed[$fixlinenr] =~ s/\b(__inline__|__inline)\b/inline/;
6533
6534 }
6535 }
6536
6537 # Check for compiler attributes
6538 if ($realfile !~ m@\binclude/uapi/@ &&
6539 $rawline =~ /\b__attribute__\s*\(\s*($balanced_parens)\s*\)/) {
6540 my $attr = $1;
6541 $attr =~ s/\s*\(\s*(.*)\)\s*/$1/;
6542
6543 my %attr_list = (
6544 "alias" => "__alias",
6545 "aligned" => "__aligned",
6546 "always_inline" => "__always_inline",
6547 "assume_aligned" => "__assume_aligned",
6548 "cold" => "__cold",
6549 "const" => "__attribute_const__",
6550 "copy" => "__copy",
6551 "designated_init" => "__designated_init",
6552 "externally_visible" => "__visible",
6553 "format" => "printf|scanf",
6554 "gnu_inline" => "__gnu_inline",
6555 "malloc" => "__malloc",
6556 "mode" => "__mode",
6557 "no_caller_saved_registers" => "__no_caller_saved_registers",
6558 "noclone" => "__noclone",
6559 "noinline" => "noinline",
6560 "nonstring" => "__nonstring",
6561 "noreturn" => "__noreturn",
6562 "packed" => "__packed",
6563 "pure" => "__pure",
6564 "section" => "__section",
6565 "used" => "__used",
6566 "weak" => "__weak"
6567 );
6568
6569 while ($attr =~ /\s*(\w+)\s*(${balanced_parens})?/g) {
6570 my $orig_attr = $1;
6571 my $params = '';
6572 $params = $2 if defined($2);
6573 my $curr_attr = $orig_attr;
6574 $curr_attr =~ s/^[\s_]+|[\s_]+$//g;
6575 if (exists($attr_list{$curr_attr})) {
6576 my $new = $attr_list{$curr_attr};
6577 if ($curr_attr eq "format" && $params) {
6578 $params =~ /^\s*\(\s*(\w+)\s*,\s*(.*)/;
6579 $new = "__$1\($2";
6580 } else {
6581 $new = "$new$params";
6582 }
6583 if (WARN("PREFER_DEFINED_ATTRIBUTE_MACRO",
6584 "Prefer $new over __attribute__(($orig_attr$params))\n" . $herecurr) &&
6585 $fix) {
6586 my $remove = "\Q$orig_attr\E" . '\s*' . "\Q$params\E" . '(?:\s*,\s*)?';
6587 $fixed[$fixlinenr] =~ s/$remove//;
6588 $fixed[$fixlinenr] =~ s/\b__attribute__/$new __attribute__/;
6589 $fixed[$fixlinenr] =~ s/\}\Q$new\E/} $new/;
6590 $fixed[$fixlinenr] =~ s/ __attribute__\s*\(\s*\(\s*\)\s*\)//;
6591 }
6592 }
6593 }
6594
6595 # Check for __attribute__ unused, prefer __always_unused or __maybe_unused
6596 if ($attr =~ /^_*unused/) {
6597 WARN("PREFER_DEFINED_ATTRIBUTE_MACRO",
6598 "__always_unused or __maybe_unused is preferred over __attribute__((__unused__))\n" . $herecurr);
6599 }
6600 }
6601
6602 # Check for __attribute__ weak, or __weak declarations (may have link issues)
6603 if ($perl_version_ok &&
6604 $line =~ /(?:$Declare|$DeclareMisordered)\s*$Ident\s*$balanced_parens\s*(?:$Attribute)?\s*;/ &&
6605 ($line =~ /\b__attribute__\s*\(\s*\(.*\bweak\b/ ||
6606 $line =~ /\b__weak\b/)) {
6607 ERROR("WEAK_DECLARATION",
6608 "Using weak declarations can have unintended link defects\n" . $herecurr);
6609 }
6610
6611 # check for c99 types like uint8_t used outside of uapi/ and tools/
6612 if ($realfile !~ m@\binclude/uapi/@ &&
6613 $realfile !~ m@\btools/@ &&
6614 $line =~ /\b($Declare)\s*$Ident\s*[=;,\[]/) {
6615 my $type = $1;
6616 if ($type =~ /\b($typeC99Typedefs)\b/) {
6617 $type = $1;
6618 my $kernel_type = 'u';
6619 $kernel_type = 's' if ($type =~ /^_*[si]/);
6620 $type =~ /(\d+)/;
6621 $kernel_type .= $1;
6622 if (CHK("PREFER_KERNEL_TYPES",
6623 "Prefer kernel type '$kernel_type' over '$type'\n" . $herecurr) &&
6624 $fix) {
6625 $fixed[$fixlinenr] =~ s/\b$type\b/$kernel_type/;
6626 }
6627 }
6628 }
6629
6630 # check for cast of C90 native int or longer types constants
6631 if ($line =~ /(\(\s*$C90_int_types\s*\)\s*)($Constant)\b/) {
6632 my $cast = $1;
6633 my $const = $2;
6634 my $suffix = "";
6635 my $newconst = $const;
6636 $newconst =~ s/${Int_type}$//;
6637 $suffix .= 'U' if ($cast =~ /\bunsigned\b/);
6638 if ($cast =~ /\blong\s+long\b/) {
6639 $suffix .= 'LL';
6640 } elsif ($cast =~ /\blong\b/) {
6641 $suffix .= 'L';
6642 }
6643 if (WARN("TYPECAST_INT_CONSTANT",
6644 "Unnecessary typecast of c90 int constant - '$cast$const' could be '$const$suffix'\n" . $herecurr) &&
6645 $fix) {
6646 $fixed[$fixlinenr] =~ s/\Q$cast\E$const\b/$newconst$suffix/;
6647 }
6648 }
6649
6650 # check for sizeof(&)
6651 if ($line =~ /\bsizeof\s*\(\s*\&/) {
6652 WARN("SIZEOF_ADDRESS",
6653 "sizeof(& should be avoided\n" . $herecurr);
6654 }
6655
6656 # check for sizeof without parenthesis
6657 if ($line =~ /\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/) {
6658 if (WARN("SIZEOF_PARENTHESIS",
6659 "sizeof $1 should be sizeof($1)\n" . $herecurr) &&
6660 $fix) {
6661 $fixed[$fixlinenr] =~ s/\bsizeof\s+((?:\*\s*|)$Lval|$Type(?:\s+$Lval|))/"sizeof(" . trim($1) . ")"/ex;
6662 }
6663 }
6664
6665 # check for struct spinlock declarations
6666 if ($line =~ /^.\s*\bstruct\s+spinlock\s+\w+\s*;/) {
6667 WARN("USE_SPINLOCK_T",
6668 "struct spinlock should be spinlock_t\n" . $herecurr);
6669 }
6670
6671 # check for seq_printf uses that could be seq_puts
6672 if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) {
6673 my $fmt = get_quoted_string($line, $rawline);
6674 $fmt =~ s/%%//g;
6675 if ($fmt !~ /%/) {
6676 if (WARN("PREFER_SEQ_PUTS",
6677 "Prefer seq_puts to seq_printf\n" . $herecurr) &&
6678 $fix) {
6679 $fixed[$fixlinenr] =~ s/\bseq_printf\b/seq_puts/;
6680 }
6681 }
6682 }
6683
6684 # check for vsprintf extension %p<foo> misuses
6685 if ($perl_version_ok &&
6686 defined $stat &&
6687 $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s &&
6688 $1 !~ /^_*volatile_*$/) {
6689 my $stat_real;
6690
6691 my $lc = $stat =~ tr@\n@@;
6692 $lc = $lc + $linenr;
6693 for (my $count = $linenr; $count <= $lc; $count++) {
6694 my $specifier;
6695 my $extension;
6696 my $qualifier;
6697 my $bad_specifier = "";
6698 my $fmt = get_quoted_string($lines[$count - 1], raw_line($count, 0));
6699 $fmt =~ s/%%//g;
6700
6701 while ($fmt =~ /(\%[\*\d\.]*p(\w)(\w*))/g) {
6702 $specifier = $1;
6703 $extension = $2;
6704 $qualifier = $3;
6705 if ($extension !~ /[4SsBKRraEehMmIiUDdgVCbGNOxtf]/ ||
6706 ($extension eq "f" &&
6707 defined $qualifier && $qualifier !~ /^w/) ||
6708 ($extension eq "4" &&
6709 defined $qualifier && $qualifier !~ /^cc/)) {
6710 $bad_specifier = $specifier;
6711 last;
6712 }
6713 if ($extension eq "x" && !defined($stat_real)) {
6714 if (!defined($stat_real)) {
6715 $stat_real = get_stat_real($linenr, $lc);
6716 }
6717 WARN("VSPRINTF_SPECIFIER_PX",
6718 "Using vsprintf specifier '\%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '\%p'.\n" . "$here\n$stat_real\n");
6719 }
6720 }
6721 if ($bad_specifier ne "") {
6722 my $stat_real = get_stat_real($linenr, $lc);
6723 my $ext_type = "Invalid";
6724 my $use = "";
6725 if ($bad_specifier =~ /p[Ff]/) {
6726 $use = " - use %pS instead";
6727 $use =~ s/pS/ps/ if ($bad_specifier =~ /pf/);
6728 }
6729
6730 WARN("VSPRINTF_POINTER_EXTENSION",
6731 "$ext_type vsprintf pointer extension '$bad_specifier'$use\n" . "$here\n$stat_real\n");
6732 }
6733 }
6734 }
6735
6736 # Check for misused memsets
6737 if ($perl_version_ok &&
6738 defined $stat &&
6739 $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*$FuncArg\s*\)/) {
6740
6741 my $ms_addr = $2;
6742 my $ms_val = $7;
6743 my $ms_size = $12;
6744
6745 if ($ms_size =~ /^(0x|)0$/i) {
6746 ERROR("MEMSET",
6747 "memset to 0's uses 0 as the 2nd argument, not the 3rd\n" . "$here\n$stat\n");
6748 } elsif ($ms_size =~ /^(0x|)1$/i) {
6749 WARN("MEMSET",
6750 "single byte memset is suspicious. Swapped 2nd/3rd argument?\n" . "$here\n$stat\n");
6751 }
6752 }
6753
6754 # Check for memcpy(foo, bar, ETH_ALEN) that could be ether_addr_copy(foo, bar)
6755 # if ($perl_version_ok &&
6756 # defined $stat &&
6757 # $stat =~ /^\+(?:.*?)\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6758 # if (WARN("PREFER_ETHER_ADDR_COPY",
6759 # "Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)\n" . "$here\n$stat\n") &&
6760 # $fix) {
6761 # $fixed[$fixlinenr] =~ s/\bmemcpy\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/ether_addr_copy($2, $7)/;
6762 # }
6763 # }
6764
6765 # Check for memcmp(foo, bar, ETH_ALEN) that could be ether_addr_equal*(foo, bar)
6766 # if ($perl_version_ok &&
6767 # defined $stat &&
6768 # $stat =~ /^\+(?:.*?)\bmemcmp\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6769 # WARN("PREFER_ETHER_ADDR_EQUAL",
6770 # "Prefer ether_addr_equal() or ether_addr_equal_unaligned() over memcmp()\n" . "$here\n$stat\n")
6771 # }
6772
6773 # check for memset(foo, 0x0, ETH_ALEN) that could be eth_zero_addr
6774 # check for memset(foo, 0xFF, ETH_ALEN) that could be eth_broadcast_addr
6775 # if ($perl_version_ok &&
6776 # defined $stat &&
6777 # $stat =~ /^\+(?:.*?)\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\,\s*ETH_ALEN\s*\)/) {
6778 #
6779 # my $ms_val = $7;
6780 #
6781 # if ($ms_val =~ /^(?:0x|)0+$/i) {
6782 # if (WARN("PREFER_ETH_ZERO_ADDR",
6783 # "Prefer eth_zero_addr over memset()\n" . "$here\n$stat\n") &&
6784 # $fix) {
6785 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_zero_addr($2)/;
6786 # }
6787 # } elsif ($ms_val =~ /^(?:0xff|255)$/i) {
6788 # if (WARN("PREFER_ETH_BROADCAST_ADDR",
6789 # "Prefer eth_broadcast_addr() over memset()\n" . "$here\n$stat\n") &&
6790 # $fix) {
6791 # $fixed[$fixlinenr] =~ s/\bmemset\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*,\s*ETH_ALEN\s*\)/eth_broadcast_addr($2)/;
6792 # }
6793 # }
6794 # }
6795
6796 # strlcpy uses that should likely be strscpy
6797 if ($line =~ /\bstrlcpy\s*\(/) {
6798 WARN("STRLCPY",
6799 "Prefer strscpy over strlcpy - see: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw\@mail.gmail.com/\n" . $herecurr);
6800 }
6801
6802 # typecasts on min/max could be min_t/max_t
6803 if ($perl_version_ok &&
6804 defined $stat &&
6805 $stat =~ /^\+(?:.*?)\b(min|max)\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
6806 if (defined $2 || defined $7) {
6807 my $call = $1;
6808 my $cast1 = deparenthesize($2);
6809 my $arg1 = $3;
6810 my $cast2 = deparenthesize($7);
6811 my $arg2 = $8;
6812 my $cast;
6813
6814 if ($cast1 ne "" && $cast2 ne "" && $cast1 ne $cast2) {
6815 $cast = "$cast1 or $cast2";
6816 } elsif ($cast1 ne "") {
6817 $cast = $cast1;
6818 } else {
6819 $cast = $cast2;
6820 }
6821 WARN("MINMAX",
6822 "$call() should probably be ${call}_t($cast, $arg1, $arg2)\n" . "$here\n$stat\n");
6823 }
6824 }
6825
6826 # check usleep_range arguments
6827 if ($perl_version_ok &&
6828 defined $stat &&
6829 $stat =~ /^\+(?:.*?)\busleep_range\s*\(\s*($FuncArg)\s*,\s*($FuncArg)\s*\)/) {
6830 my $min = $1;
6831 my $max = $7;
6832 if ($min eq $max) {
6833 WARN("USLEEP_RANGE",
6834 "usleep_range should not use min == max args; see Documentation/timers/timers-howto.rst\n" . "$here\n$stat\n");
6835 } elsif ($min =~ /^\d+$/ && $max =~ /^\d+$/ &&
6836 $min > $max) {
6837 WARN("USLEEP_RANGE",
6838 "usleep_range args reversed, use min then max; see Documentation/timers/timers-howto.rst\n" . "$here\n$stat\n");
6839 }
6840 }
6841
6842 # check for naked sscanf
6843 if ($perl_version_ok &&
6844 defined $stat &&
6845 $line =~ /\bsscanf\b/ &&
6846 ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ &&
6847 $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ &&
6848 $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) {
6849 my $lc = $stat =~ tr@\n@@;
6850 $lc = $lc + $linenr;
6851 my $stat_real = get_stat_real($linenr, $lc);
6852 WARN("NAKED_SSCANF",
6853 "unchecked sscanf return value\n" . "$here\n$stat_real\n");
6854 }
6855
6856 # check for simple sscanf that should be kstrto<foo>
6857 if ($perl_version_ok &&
6858 defined $stat &&
6859 $line =~ /\bsscanf\b/) {
6860 my $lc = $stat =~ tr@\n@@;
6861 $lc = $lc + $linenr;
6862 my $stat_real = get_stat_real($linenr, $lc);
6863 if ($stat_real =~ /\bsscanf\b\s*\(\s*$FuncArg\s*,\s*("[^"]+")/) {
6864 my $format = $6;
6865 my $count = $format =~ tr@%@%@;
6866 if ($count == 1 &&
6867 $format =~ /^"\%(?i:ll[udxi]|[udxi]ll|ll|[hl]h?[udxi]|[udxi][hl]h?|[hl]h?|[udxi])"$/) {
6868 WARN("SSCANF_TO_KSTRTO",
6869 "Prefer kstrto<type> to single variable sscanf\n" . "$here\n$stat_real\n");
6870 }
6871 }
6872 }
6873
6874 # check for new externs in .h files.
6875 if ($realfile =~ /\.h$/ &&
6876 $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) {
6877 if (CHK("AVOID_EXTERNS",
6878 "extern prototypes should be avoided in .h files\n" . $herecurr) &&
6879 $fix) {
6880 $fixed[$fixlinenr] =~ s/(.*)\bextern\b\s*(.*)/$1$2/;
6881 }
6882 }
6883
6884 # check for new externs in .c files.
6885 if ($realfile =~ /\.c$/ && defined $stat &&
6886 $stat =~ /^.\s*(?:extern\s+)?$Type\s+($Ident)(\s*)\(/s)
6887 {
6888 my $function_name = $1;
6889 my $paren_space = $2;
6890
6891 my $s = $stat;
6892 if (defined $cond) {
6893 substr($s, 0, length($cond), '');
6894 }
6895 if ($s =~ /^\s*;/)
6896 {
6897 WARN("AVOID_EXTERNS",
6898 "externs should be avoided in .c files\n" . $herecurr);
6899 }
6900
6901 if ($paren_space =~ /\n/) {
6902 WARN("FUNCTION_ARGUMENTS",
6903 "arguments for function declarations should follow identifier\n" . $herecurr);
6904 }
6905
6906 } elsif ($realfile =~ /\.c$/ && defined $stat &&
6907 $stat =~ /^.\s*extern\s+/)
6908 {
6909 WARN("AVOID_EXTERNS",
6910 "externs should be avoided in .c files\n" . $herecurr);
6911 }
6912
6913 # check for function declarations that have arguments without identifier names
6914 if (defined $stat &&
6915 $stat =~ /^.\s*(?:extern\s+)?$Type\s*(?:$Ident|\(\s*\*\s*$Ident\s*\))\s*\(\s*([^{]+)\s*\)\s*;/s &&
6916 $1 ne "void") {
6917 my $args = trim($1);
6918 while ($args =~ m/\s*($Type\s*(?:$Ident|\(\s*\*\s*$Ident?\s*\)\s*$balanced_parens)?)/g) {
6919 my $arg = trim($1);
6920 if ($arg =~ /^$Type$/ && $arg !~ /enum\s+$Ident$/) {
6921 WARN("FUNCTION_ARGUMENTS",
6922 "function definition argument '$arg' should also have an identifier name\n" . $herecurr);
6923 }
6924 }
6925 }
6926
6927 # check for function definitions
6928 if ($perl_version_ok &&
6929 defined $stat &&
6930 $stat =~ /^.\s*(?:$Storage\s+)?$Type\s*($Ident)\s*$balanced_parens\s*{/s) {
6931 $context_function = $1;
6932
6933 # check for multiline function definition with misplaced open brace
6934 my $ok = 0;
6935 my $cnt = statement_rawlines($stat);
6936 my $herectx = $here . "\n";
6937 for (my $n = 0; $n < $cnt; $n++) {
6938 my $rl = raw_line($linenr, $n);
6939 $herectx .= $rl . "\n";
6940 $ok = 1 if ($rl =~ /^[ \+]\{/);
6941 $ok = 1 if ($rl =~ /\{/ && $n == 0);
6942 last if $rl =~ /^[ \+].*\{/;
6943 }
6944 if (!$ok) {
6945 ERROR("OPEN_BRACE",
6946 "open brace '{' following function definitions go on the next line\n" . $herectx);
6947 }
6948 }
6949
6950 # checks for new __setup's
6951 if ($rawline =~ /\b__setup\("([^"]*)"/) {
6952 my $name = $1;
6953
6954 if (!grep(/$name/, @setup_docs)) {
6955 CHK("UNDOCUMENTED_SETUP",
6956 "__setup appears un-documented -- check Documentation/admin-guide/kernel-parameters.txt\n" . $herecurr);
6957 }
6958 }
6959
6960 # check for pointless casting of alloc functions
6961 if ($line =~ /\*\s*\)\s*$allocFunctions\b/) {
6962 WARN("UNNECESSARY_CASTS",
6963 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
6964 }
6965
6966 # alloc style
6967 # p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...)
6968 if ($perl_version_ok &&
6969 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) {
6970 CHK("ALLOC_SIZEOF_STRUCT",
6971 "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr);
6972 }
6973
6974 # check for k[mz]alloc with multiplies that could be kmalloc_array/kcalloc
6975 if ($perl_version_ok &&
6976 defined $stat &&
6977 $stat =~ /^\+\s*($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)\s*,/) {
6978 my $oldfunc = $3;
6979 my $a1 = $4;
6980 my $a2 = $10;
6981 my $newfunc = "kmalloc_array";
6982 $newfunc = "kcalloc" if ($oldfunc eq "kzalloc");
6983 my $r1 = $a1;
6984 my $r2 = $a2;
6985 if ($a1 =~ /^sizeof\s*\S/) {
6986 $r1 = $a2;
6987 $r2 = $a1;
6988 }
6989 if ($r1 !~ /^sizeof\b/ && $r2 =~ /^sizeof\s*\S/ &&
6990 !($r1 =~ /^$Constant$/ || $r1 =~ /^[A-Z_][A-Z0-9_]*$/)) {
6991 my $cnt = statement_rawlines($stat);
6992 my $herectx = get_stat_here($linenr, $cnt, $here);
6993
6994 if (WARN("ALLOC_WITH_MULTIPLY",
6995 "Prefer $newfunc over $oldfunc with multiply\n" . $herectx) &&
6996 $cnt == 1 &&
6997 $fix) {
6998 $fixed[$fixlinenr] =~ s/\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*(k[mz]alloc)\s*\(\s*($FuncArg)\s*\*\s*($FuncArg)/$1 . ' = ' . "$newfunc(" . trim($r1) . ', ' . trim($r2)/e;
6999 }
7000 }
7001 }
7002
7003 # check for krealloc arg reuse
7004 if ($perl_version_ok &&
7005 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*($Lval)\s*,/ &&
7006 $1 eq $3) {
7007 WARN("KREALLOC_ARG_REUSE",
7008 "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
7009 }
7010
7011 # check for alloc argument mismatch
7012 if ($line =~ /\b((?:devm_)?(?:kcalloc|kmalloc_array))\s*\(\s*sizeof\b/) {
7013 WARN("ALLOC_ARRAY_ARGS",
7014 "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr);
7015 }
7016
7017 # check for multiple semicolons
7018 if ($line =~ /;\s*;\s*$/) {
7019 if (WARN("ONE_SEMICOLON",
7020 "Statements terminations use 1 semicolon\n" . $herecurr) &&
7021 $fix) {
7022 $fixed[$fixlinenr] =~ s/(\s*;\s*){2,}$/;/g;
7023 }
7024 }
7025
7026 # check for #defines like: 1 << <digit> that could be BIT(digit), it is not exported to uapi
7027 if ($realfile !~ m@^include/uapi/@ &&
7028 $line =~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$Ident)\s*\)?/) {
7029 my $ull = "";
7030 $ull = "_ULL" if (defined($1) && $1 =~ /ll/i);
7031 if (CHK("BIT_MACRO",
7032 "Prefer using the BIT$ull macro\n" . $herecurr) &&
7033 $fix) {
7034 $fixed[$fixlinenr] =~ s/\(?\s*1\s*[ulUL]*\s*<<\s*(\d+|$Ident)\s*\)?/BIT${ull}($1)/;
7035 }
7036 }
7037
7038 # check for IS_ENABLED() without CONFIG_<FOO> ($rawline for comments too)
7039 if ($rawline =~ /\bIS_ENABLED\s*\(\s*(\w+)\s*\)/ && $1 !~ /^${CONFIG_}/) {
7040 WARN("IS_ENABLED_CONFIG",
7041 "IS_ENABLED($1) is normally used as IS_ENABLED(${CONFIG_}$1)\n" . $herecurr);
7042 }
7043
7044 # check for #if defined CONFIG_<FOO> || defined CONFIG_<FOO>_MODULE
7045 if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(${CONFIG_}[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:\s*\(?\s*|\s+)\1_MODULE\s*\)?\s*$/) {
7046 my $config = $1;
7047 if (WARN("PREFER_IS_ENABLED",
7048 "Prefer IS_ENABLED(<FOO>) to ${CONFIG_}<FOO> || ${CONFIG_}<FOO>_MODULE\n" . $herecurr) &&
7049 $fix) {
7050 $fixed[$fixlinenr] = "\+#if IS_ENABLED($config)";
7051 }
7052 }
7053
7054 # check for /* fallthrough */ like comment, prefer fallthrough;
7055 my @fallthroughs = (
7056 'fallthrough',
7057 '@fallthrough@',
7058 'lint -fallthrough[ \t]*',
7059 'intentional(?:ly)?[ \t]*fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)',
7060 '(?:else,?\s*)?FALL(?:S | |-)?THR(?:OUGH|U|EW)[ \t.!]*(?:-[^\n\r]*)?',
7061 'Fall(?:(?:s | |-)[Tt]|t)hr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7062 'fall(?:s | |-)?thr(?:ough|u|ew)[ \t.!]*(?:-[^\n\r]*)?',
7063 );
7064 if ($raw_comment ne '') {
7065 foreach my $ft (@fallthroughs) {
7066 if ($raw_comment =~ /$ft/) {
7067 my $msg_level = \&WARN;
7068 $msg_level = \&CHK if ($file);
7069 &{$msg_level}("PREFER_FALLTHROUGH",
7070 "Prefer 'fallthrough;' over fallthrough comment\n" . $herecurr);
7071 last;
7072 }
7073 }
7074 }
7075
7076 # check for switch/default statements without a break;
7077 if ($perl_version_ok &&
7078 defined $stat &&
7079 $stat =~ /^\+[$;\s]*(?:case[$;\s]+\w+[$;\s]*:[$;\s]*|)*[$;\s]*\bdefault[$;\s]*:[$;\s]*;/g) {
7080 my $cnt = statement_rawlines($stat);
7081 my $herectx = get_stat_here($linenr, $cnt, $here);
7082
7083 WARN("DEFAULT_NO_BREAK",
7084 "switch default: should use break\n" . $herectx);
7085 }
7086
7087 # check for gcc specific __FUNCTION__
7088 if ($line =~ /\b__FUNCTION__\b/) {
7089 if (WARN("USE_FUNC",
7090 "__func__ should be used instead of gcc specific __FUNCTION__\n" . $herecurr) &&
7091 $fix) {
7092 $fixed[$fixlinenr] =~ s/\b__FUNCTION__\b/__func__/g;
7093 }
7094 }
7095
7096 # check for uses of __DATE__, __TIME__, __TIMESTAMP__
7097 while ($line =~ /\b(__(?:DATE|TIME|TIMESTAMP)__)\b/g) {
7098 ERROR("DATE_TIME",
7099 "Use of the '$1' macro makes the build non-deterministic\n" . $herecurr);
7100 }
7101
7102 # check for use of yield()
7103 if ($line =~ /\byield\s*\(\s*\)/) {
7104 WARN("YIELD",
7105 "Using yield() is generally wrong. See yield() kernel-doc (sched/core.c)\n" . $herecurr);
7106 }
7107
7108 # check for comparisons against true and false
7109 if ($line =~ /\+\s*(.*?)\b(true|false|$Lval)\s*(==|\!=)\s*(true|false|$Lval)\b(.*)$/i) {
7110 my $lead = $1;
7111 my $arg = $2;
7112 my $test = $3;
7113 my $otype = $4;
7114 my $trail = $5;
7115 my $op = "!";
7116
7117 ($arg, $otype) = ($otype, $arg) if ($arg =~ /^(?:true|false)$/i);
7118
7119 my $type = lc($otype);
7120 if ($type =~ /^(?:true|false)$/) {
7121 if (("$test" eq "==" && "$type" eq "true") ||
7122 ("$test" eq "!=" && "$type" eq "false")) {
7123 $op = "";
7124 }
7125
7126 CHK("BOOL_COMPARISON",
7127 "Using comparison to $otype is error prone\n" . $herecurr);
7128
7129 ## maybe suggesting a correct construct would better
7130 ## "Using comparison to $otype is error prone. Perhaps use '${lead}${op}${arg}${trail}'\n" . $herecurr);
7131
7132 }
7133 }
7134
7135 # check for semaphores initialized locked
7136 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
7137 WARN("CONSIDER_COMPLETION",
7138 "consider using a completion\n" . $herecurr);
7139 }
7140
7141 # recommend kstrto* over simple_strto* and strict_strto*
7142 if ($line =~ /\b((simple|strict)_(strto(l|ll|ul|ull)))\s*\(/) {
7143 WARN("CONSIDER_KSTRTO",
7144 "$1 is obsolete, use k$3 instead\n" . $herecurr);
7145 }
7146
7147 # check for __initcall(), use device_initcall() explicitly or more appropriate function please
7148 if ($line =~ /^.\s*__initcall\s*\(/) {
7149 WARN("USE_DEVICE_INITCALL",
7150 "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
7151 }
7152
7153 # check for spin_is_locked(), suggest lockdep instead
7154 if ($line =~ /\bspin_is_locked\(/) {
7155 WARN("USE_LOCKDEP",
7156 "Where possible, use lockdep_assert_held instead of assertions based on spin_is_locked\n" . $herecurr);
7157 }
7158
7159 # check for deprecated apis
7160 if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) {
7161 my $deprecated_api = $1;
7162 my $new_api = $deprecated_apis{$deprecated_api};
7163 WARN("DEPRECATED_API",
7164 "Deprecated use of '$deprecated_api', prefer '$new_api' instead\n" . $herecurr);
7165 }
7166
7167 # check for various structs that are normally const (ops, kgdb, device_tree)
7168 # and avoid what seem like struct definitions 'struct foo {'
7169 if (defined($const_structs) &&
7170 $line !~ /\bconst\b/ &&
7171 $line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
7172 WARN("CONST_STRUCT",
7173 "struct $1 should normally be const\n" . $herecurr);
7174 }
7175
7176 # use of NR_CPUS is usually wrong
7177 # ignore definitions of NR_CPUS and usage to define arrays as likely right
7178 # ignore designated initializers using NR_CPUS
7179 if ($line =~ /\bNR_CPUS\b/ &&
7180 $line !~ /^.\s*\s*#\s*if\b.*\bNR_CPUS\b/ &&
7181 $line !~ /^.\s*\s*#\s*define\b.*\bNR_CPUS\b/ &&
7182 $line !~ /^.\s*$Declare\s.*\[[^\]]*NR_CPUS[^\]]*\]/ &&
7183 $line !~ /\[[^\]]*\.\.\.[^\]]*NR_CPUS[^\]]*\]/ &&
7184 $line !~ /\[[^\]]*NR_CPUS[^\]]*\.\.\.[^\]]*\]/ &&
7185 $line !~ /^.\s*\.\w+\s*=\s*.*\bNR_CPUS\b/)
7186 {
7187 WARN("NR_CPUS",
7188 "usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr);
7189 }
7190
7191 # Use of __ARCH_HAS_<FOO> or ARCH_HAVE_<BAR> is wrong.
7192 if ($line =~ /\+\s*#\s*define\s+((?:__)?ARCH_(?:HAS|HAVE)\w*)\b/) {
7193 ERROR("DEFINE_ARCH_HAS",
7194 "#define of '$1' is wrong - use Kconfig variables or standard guards instead\n" . $herecurr);
7195 }
7196
7197 # likely/unlikely comparisons similar to "(likely(foo) > 0)"
7198 if ($perl_version_ok &&
7199 $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {
7200 WARN("LIKELY_MISUSE",
7201 "Using $1 should generally have parentheses around the comparison\n" . $herecurr);
7202 }
7203
7204 # return sysfs_emit(foo, fmt, ...) fmt without newline
7205 if ($line =~ /\breturn\s+sysfs_emit\s*\(\s*$FuncArg\s*,\s*($String)/ &&
7206 substr($rawline, $-[6], $+[6] - $-[6]) !~ /\\n"$/) {
7207 my $offset = $+[6] - 1;
7208 if (WARN("SYSFS_EMIT",
7209 "return sysfs_emit(...) formats should include a terminating newline\n" . $herecurr) &&
7210 $fix) {
7211 substr($fixed[$fixlinenr], $offset, 0) = '\\n';
7212 }
7213 }
7214
7215 # nested likely/unlikely calls
7216 if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
7217 WARN("LIKELY_MISUSE",
7218 "nested (un)?likely() calls, $1 already uses unlikely() internally\n" . $herecurr);
7219 }
7220
7221 # whine mightly about in_atomic
7222 if ($line =~ /\bin_atomic\s*\(/) {
7223 if ($realfile =~ m@^drivers/@) {
7224 ERROR("IN_ATOMIC",
7225 "do not use in_atomic in drivers\n" . $herecurr);
7226 } elsif ($realfile !~ m@^kernel/@) {
7227 WARN("IN_ATOMIC",
7228 "use of in_atomic() is incorrect outside core kernel code\n" . $herecurr);
7229 }
7230 }
7231
7232 # check for lockdep_set_novalidate_class
7233 if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
7234 $line =~ /__lockdep_no_validate__\s*\)/ ) {
7235 if ($realfile !~ m@^kernel/lockdep@ &&
7236 $realfile !~ m@^include/linux/lockdep@ &&
7237 $realfile !~ m@^drivers/base/core@) {
7238 ERROR("LOCKDEP",
7239 "lockdep_no_validate class is reserved for device->mutex.\n" . $herecurr);
7240 }
7241 }
7242
7243 if ($line =~ /debugfs_create_\w+.*\b$mode_perms_world_writable\b/ ||
7244 $line =~ /DEVICE_ATTR.*\b$mode_perms_world_writable\b/) {
7245 WARN("EXPORTED_WORLD_WRITABLE",
7246 "Exporting world writable files is usually an error. Consider more restrictive permissions.\n" . $herecurr);
7247 }
7248
7249 # check for DEVICE_ATTR uses that could be DEVICE_ATTR_<FOO>
7250 # and whether or not function naming is typical and if
7251 # DEVICE_ATTR permissions uses are unusual too
7252 if ($perl_version_ok &&
7253 defined $stat &&
7254 $stat =~ /\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?\s*(\s*(?:${multi_mode_perms_string_search}|0[0-7]{3,3})\s*)\s*\)?\s*,\s*(\w+)\s*,\s*(\w+)\s*\)/) {
7255 my $var = $1;
7256 my $perms = $2;
7257 my $show = $3;
7258 my $store = $4;
7259 my $octal_perms = perms_to_octal($perms);
7260 if ($show =~ /^${var}_show$/ &&
7261 $store =~ /^${var}_store$/ &&
7262 $octal_perms eq "0644") {
7263 if (WARN("DEVICE_ATTR_RW",
7264 "Use DEVICE_ATTR_RW\n" . $herecurr) &&
7265 $fix) {
7266 $fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*$store\s*\)/DEVICE_ATTR_RW(${var})/;
7267 }
7268 } elsif ($show =~ /^${var}_show$/ &&
7269 $store =~ /^NULL$/ &&
7270 $octal_perms eq "0444") {
7271 if (WARN("DEVICE_ATTR_RO",
7272 "Use DEVICE_ATTR_RO\n" . $herecurr) &&
7273 $fix) {
7274 $fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*$show\s*,\s*NULL\s*\)/DEVICE_ATTR_RO(${var})/;
7275 }
7276 } elsif ($show =~ /^NULL$/ &&
7277 $store =~ /^${var}_store$/ &&
7278 $octal_perms eq "0200") {
7279 if (WARN("DEVICE_ATTR_WO",
7280 "Use DEVICE_ATTR_WO\n" . $herecurr) &&
7281 $fix) {
7282 $fixed[$fixlinenr] =~ s/\bDEVICE_ATTR\s*\(\s*$var\s*,\s*\Q$perms\E\s*,\s*NULL\s*,\s*$store\s*\)/DEVICE_ATTR_WO(${var})/;
7283 }
7284 } elsif ($octal_perms eq "0644" ||
7285 $octal_perms eq "0444" ||
7286 $octal_perms eq "0200") {
7287 my $newshow = "$show";
7288 $newshow = "${var}_show" if ($show ne "NULL" && $show ne "${var}_show");
7289 my $newstore = $store;
7290 $newstore = "${var}_store" if ($store ne "NULL" && $store ne "${var}_store");
7291 my $rename = "";
7292 if ($show ne $newshow) {
7293 $rename .= " '$show' to '$newshow'";
7294 }
7295 if ($store ne $newstore) {
7296 $rename .= " '$store' to '$newstore'";
7297 }
7298 WARN("DEVICE_ATTR_FUNCTIONS",
7299 "Consider renaming function(s)$rename\n" . $herecurr);
7300 } else {
7301 WARN("DEVICE_ATTR_PERMS",
7302 "DEVICE_ATTR unusual permissions '$perms' used\n" . $herecurr);
7303 }
7304 }
7305
7306 # Mode permission misuses where it seems decimal should be octal
7307 # This uses a shortcut match to avoid unnecessary uses of a slow foreach loop
7308 # o Ignore module_param*(...) uses with a decimal 0 permission as that has a
7309 # specific definition of not visible in sysfs.
7310 # o Ignore proc_create*(...) uses with a decimal 0 permission as that means
7311 # use the default permissions
7312 if ($perl_version_ok &&
7313 defined $stat &&
7314 $line =~ /$mode_perms_search/) {
7315 foreach my $entry (@mode_permission_funcs) {
7316 my $func = $entry->[0];
7317 my $arg_pos = $entry->[1];
7318
7319 my $lc = $stat =~ tr@\n@@;
7320 $lc = $lc + $linenr;
7321 my $stat_real = get_stat_real($linenr, $lc);
7322
7323 my $skip_args = "";
7324 if ($arg_pos > 1) {
7325 $arg_pos--;
7326 $skip_args = "(?:\\s*$FuncArg\\s*,\\s*){$arg_pos,$arg_pos}";
7327 }
7328 my $test = "\\b$func\\s*\\(${skip_args}($FuncArg(?:\\|\\s*$FuncArg)*)\\s*[,\\)]";
7329 if ($stat =~ /$test/) {
7330 my $val = $1;
7331 $val = $6 if ($skip_args ne "");
7332 if (!($func =~ /^(?:module_param|proc_create)/ && $val eq "0") &&
7333 (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
7334 ($val =~ /^$Octal$/ && length($val) ne 4))) {
7335 ERROR("NON_OCTAL_PERMISSIONS",
7336 "Use 4 digit octal (0777) not decimal permissions\n" . "$here\n" . $stat_real);
7337 }
7338 if ($val =~ /^$Octal$/ && (oct($val) & 02)) {
7339 ERROR("EXPORTED_WORLD_WRITABLE",
7340 "Exporting writable files is usually an error. Consider more restrictive permissions.\n" . "$here\n" . $stat_real);
7341 }
7342 }
7343 }
7344 }
7345
7346 # check for uses of S_<PERMS> that could be octal for readability
7347 while ($line =~ m{\b($multi_mode_perms_string_search)\b}g) {
7348 my $oval = $1;
7349 my $octal = perms_to_octal($oval);
7350 if (WARN("SYMBOLIC_PERMS",
7351 "Symbolic permissions '$oval' are not preferred. Consider using octal permissions '$octal'.\n" . $herecurr) &&
7352 $fix) {
7353 $fixed[$fixlinenr] =~ s/\Q$oval\E/$octal/;
7354 }
7355 }
7356
7357 # validate content of MODULE_LICENSE against list from include/linux/module.h
7358 if ($line =~ /\bMODULE_LICENSE\s*\(\s*($String)\s*\)/) {
7359 my $extracted_string = get_quoted_string($line, $rawline);
7360 my $valid_licenses = qr{
7361 GPL|
7362 GPL\ v2|
7363 GPL\ and\ additional\ rights|
7364 Dual\ BSD/GPL|
7365 Dual\ MIT/GPL|
7366 Dual\ MPL/GPL|
7367 Proprietary
7368 }x;
7369 if ($extracted_string !~ /^"(?:$valid_licenses)"$/x) {
7370 WARN("MODULE_LICENSE",
7371 "unknown module license " . $extracted_string . "\n" . $herecurr);
7372 }
7373 }
7374
7375 # check for sysctl duplicate constants
7376 if ($line =~ /\.extra[12]\s*=\s*&(zero|one|int_max)\b/) {
7377 WARN("DUPLICATED_SYSCTL_CONST",
7378 "duplicated sysctl range checking value '$1', consider using the shared one in include/linux/sysctl.h\n" . $herecurr);
7379 }
7380 }
7381
7382 # If we have no input at all, then there is nothing to report on
7383 # so just keep quiet.
7384 if ($#rawlines == -1) {
7385 exit(0);
7386 }
7387
7388 # In mailback mode only produce a report in the negative, for
7389 # things that appear to be patches.
7390 if ($mailback && ($clean == 1 || !$is_patch)) {
7391 exit(0);
7392 }
7393
7394 # This is not a patch, and we are in 'no-patch' mode so
7395 # just keep quiet.
7396 if (!$chk_patch && !$is_patch) {
7397 exit(0);
7398 }
7399
7400 if (!$is_patch && $filename !~ /cover-letter\.patch$/) {
7401 ERROR("NOT_UNIFIED_DIFF",
7402 "Does not appear to be a unified-diff format patch\n");
7403 }
7404 if ($is_patch && $has_commit_log && $chk_signoff) {
7405 if ($signoff == 0) {
7406 ERROR("MISSING_SIGN_OFF",
7407 "Missing Signed-off-by: line(s)\n");
7408 } elsif ($authorsignoff != 1) {
7409 # authorsignoff values:
7410 # 0 -> missing sign off
7411 # 1 -> sign off identical
7412 # 2 -> names and addresses match, comments mismatch
7413 # 3 -> addresses match, names different
7414 # 4 -> names match, addresses different
7415 # 5 -> names match, addresses excluding subaddress details (refer RFC 5233) match
7416
7417 my $sob_msg = "'From: $author' != 'Signed-off-by: $author_sob'";
7418
7419 if ($authorsignoff == 0) {
7420 ERROR("NO_AUTHOR_SIGN_OFF",
7421 "Missing Signed-off-by: line by nominal patch author '$author'\n");
7422 } elsif ($authorsignoff == 2) {
7423 CHK("FROM_SIGN_OFF_MISMATCH",
7424 "From:/Signed-off-by: email comments mismatch: $sob_msg\n");
7425 } elsif ($authorsignoff == 3) {
7426 WARN("FROM_SIGN_OFF_MISMATCH",
7427 "From:/Signed-off-by: email name mismatch: $sob_msg\n");
7428 } elsif ($authorsignoff == 4) {
7429 WARN("FROM_SIGN_OFF_MISMATCH",
7430 "From:/Signed-off-by: email address mismatch: $sob_msg\n");
7431 } elsif ($authorsignoff == 5) {
7432 WARN("FROM_SIGN_OFF_MISMATCH",
7433 "From:/Signed-off-by: email subaddress mismatch: $sob_msg\n");
7434 }
7435 }
7436 }
7437
7438 print report_dump();
7439 if ($summary && !($clean == 1 && $quiet == 1)) {
7440 print "$filename " if ($summary_file);
7441 print "total: $cnt_error errors, $cnt_warn warnings, " .
7442 (($check)? "$cnt_chk checks, " : "") .
7443 "$cnt_lines lines checked\n";
7444 }
7445
7446 if ($quiet == 0) {
7447 # If there were any defects found and not already fixing them
7448 if (!$clean and !$fix) {
7449 print << "EOM"
7450
7451 NOTE: For some of the reported defects, checkpatch may be able to
7452 mechanically convert to the typical style using --fix or --fix-inplace.
7453 EOM
7454 }
7455 # If there were whitespace errors which cleanpatch can fix
7456 # then suggest that.
7457 if ($rpt_cleaners) {
7458 $rpt_cleaners = 0;
7459 print << "EOM"
7460
7461 NOTE: Whitespace errors detected.
7462 You may wish to use scripts/cleanpatch or scripts/cleanfile
7463 EOM
7464 }
7465 }
7466
7467 if ($clean == 0 && $fix &&
7468 ("@rawlines" ne "@fixed" ||
7469 $#fixed_inserted >= 0 || $#fixed_deleted >= 0)) {
7470 my $newfile = $filename;
7471 $newfile .= ".EXPERIMENTAL-checkpatch-fixes" if (!$fix_inplace);
7472 my $linecount = 0;
7473 my $f;
7474
7475 @fixed = fix_inserted_deleted_lines(\@fixed, \@fixed_inserted, \@fixed_deleted);
7476
7477 open($f, '>', $newfile)
7478 or die "$P: Can't open $newfile for write\n";
7479 foreach my $fixed_line (@fixed) {
7480 $linecount++;
7481 if ($file) {
7482 if ($linecount > 3) {
7483 $fixed_line =~ s/^\+//;
7484 print $f $fixed_line . "\n";
7485 }
7486 } else {
7487 print $f $fixed_line . "\n";
7488 }
7489 }
7490 close($f);
7491
7492 if (!$quiet) {
7493 print << "EOM";
7494
7495 Wrote EXPERIMENTAL --fix correction(s) to '$newfile'
7496
7497 Do _NOT_ trust the results written to this file.
7498 Do _NOT_ submit these changes without inspecting them for correctness.
7499
7500 This EXPERIMENTAL file is simply a convenience to help rewrite patches.
7501 No warranties, expressed or implied...
7502 EOM
7503 }
7504 }
7505
7506 if ($quiet == 0) {
7507 print "\n";
7508 if ($clean == 1) {
7509 print "$vname has no obvious style problems and is ready for submission.\n";
7510 } else {
7511 print "$vname has style problems, please review.\n";
7512 }
7513 }
7514 return $clean;
7515 }
+0
-1
tests/ci/checkpatch/const_structs.checkpatch less more
0 invalid.struct.name
+0
-1609
tests/ci/checkpatch/spelling.txt less more
0 # Originally from Debian's Lintian tool. Various false positives have been
1 # removed, and various additions have been made as they've been discovered
2 # in the kernel source.
3 #
4 # License: GPLv2
5 #
6 # The format of each line is:
7 # mistake||correction
8 #
9 abandonning||abandoning
10 abigious||ambiguous
11 abitrary||arbitrary
12 abitrate||arbitrate
13 abnornally||abnormally
14 abnrormal||abnormal
15 abord||abort
16 aboslute||absolute
17 abov||above
18 abreviated||abbreviated
19 absense||absence
20 absolut||absolute
21 absoulte||absolute
22 acccess||access
23 acceess||access
24 accelaration||acceleration
25 acceleratoin||acceleration
26 accelleration||acceleration
27 accesing||accessing
28 accesnt||accent
29 accessable||accessible
30 accesss||access
31 accidentaly||accidentally
32 accidentually||accidentally
33 acclerated||accelerated
34 accoding||according
35 accomodate||accommodate
36 accomodates||accommodates
37 accordign||according
38 accoring||according
39 accout||account
40 accquire||acquire
41 accquired||acquired
42 accross||across
43 accumalate||accumulate
44 accumalator||accumulator
45 acessable||accessible
46 acess||access
47 acessing||accessing
48 achitecture||architecture
49 acient||ancient
50 acitions||actions
51 acitve||active
52 acknowldegement||acknowledgment
53 acknowledgement||acknowledgment
54 ackowledge||acknowledge
55 ackowledged||acknowledged
56 acording||according
57 activete||activate
58 actived||activated
59 actualy||actually
60 acumulating||accumulating
61 acumulative||accumulative
62 acumulator||accumulator
63 acutally||actually
64 adapater||adapter
65 addional||additional
66 additionaly||additionally
67 additonal||additional
68 addres||address
69 adddress||address
70 addreses||addresses
71 addresss||address
72 addrress||address
73 aditional||additional
74 aditionally||additionally
75 aditionaly||additionally
76 adminstrative||administrative
77 adress||address
78 adresses||addresses
79 adrresses||addresses
80 advertisment||advertisement
81 adviced||advised
82 afecting||affecting
83 againt||against
84 agaist||against
85 aggreataon||aggregation
86 aggreation||aggregation
87 ajust||adjust
88 albumns||albums
89 alegorical||allegorical
90 algined||aligned
91 algorith||algorithm
92 algorithmical||algorithmically
93 algoritm||algorithm
94 algoritms||algorithms
95 algorithmn||algorithm
96 algorrithm||algorithm
97 algorritm||algorithm
98 aligment||alignment
99 alignement||alignment
100 allign||align
101 alligned||aligned
102 alllocate||allocate
103 alloated||allocated
104 allocatote||allocate
105 allocatrd||allocated
106 allocte||allocate
107 allocted||allocated
108 allpication||application
109 alocate||allocate
110 alogirhtms||algorithms
111 alogrithm||algorithm
112 alot||a lot
113 alow||allow
114 alows||allows
115 alreay||already
116 alredy||already
117 altough||although
118 alue||value
119 ambigious||ambiguous
120 ambigous||ambiguous
121 amoung||among
122 amout||amount
123 amplifer||amplifier
124 amplifyer||amplifier
125 an union||a union
126 an user||a user
127 an userspace||a userspace
128 an one||a one
129 analysator||analyzer
130 ang||and
131 anniversery||anniversary
132 annoucement||announcement
133 anomolies||anomalies
134 anomoly||anomaly
135 anway||anyway
136 aplication||application
137 appearence||appearance
138 applicaion||application
139 appliction||application
140 applictions||applications
141 applys||applies
142 appplications||applications
143 appropiate||appropriate
144 appropriatly||appropriately
145 approriate||appropriate
146 approriately||appropriately
147 apropriate||appropriate
148 aquainted||acquainted
149 aquired||acquired
150 aquisition||acquisition
151 arbitary||arbitrary
152 architechture||architecture
153 arguement||argument
154 arguements||arguments
155 arithmatic||arithmetic
156 aritmetic||arithmetic
157 arne't||aren't
158 arraival||arrival
159 artifical||artificial
160 artillary||artillery
161 asign||assign
162 asser||assert
163 assertation||assertion
164 assertting||asserting
165 assgined||assigned
166 assiged||assigned
167 assigment||assignment
168 assigments||assignments
169 assistent||assistant
170 assocaited||associated
171 assocating||associating
172 assocation||association
173 associcated||associated
174 assotiated||associated
175 asssert||assert
176 assum||assume
177 assumtpion||assumption
178 asuming||assuming
179 asycronous||asynchronous
180 asynchnous||asynchronous
181 asynchromous||asynchronous
182 asymetric||asymmetric
183 asymmeric||asymmetric
184 atleast||at least
185 atomatically||automatically
186 atomicly||atomically
187 atempt||attempt
188 atrributes||attributes
189 attachement||attachment
190 attatch||attach
191 attched||attached
192 attemp||attempt
193 attemps||attempts
194 attemping||attempting
195 attepmpt||attempt
196 attnetion||attention
197 attruibutes||attributes
198 authentification||authentication
199 authenicated||authenticated
200 automaticaly||automatically
201 automaticly||automatically
202 automatize||automate
203 automatized||automated
204 automatizes||automates
205 autonymous||autonomous
206 auxillary||auxiliary
207 auxilliary||auxiliary
208 avaiable||available
209 avaible||available
210 availabe||available
211 availabled||available
212 availablity||availability
213 availaible||available
214 availale||available
215 availavility||availability
216 availble||available
217 availiable||available
218 availible||available
219 avalable||available
220 avaliable||available
221 aysnc||async
222 backgroud||background
223 backword||backward
224 backwords||backwards
225 bahavior||behavior
226 bakup||backup
227 baloon||balloon
228 baloons||balloons
229 bandwith||bandwidth
230 banlance||balance
231 batery||battery
232 beacuse||because
233 becasue||because
234 becomming||becoming
235 becuase||because
236 beeing||being
237 befor||before
238 begining||beginning
239 beter||better
240 betweeen||between
241 bianries||binaries
242 bitmast||bitmask
243 boardcast||broadcast
244 borad||board
245 boundry||boundary
246 brievely||briefly
247 brigde||bridge
248 broadcase||broadcast
249 broadcat||broadcast
250 bufer||buffer
251 bufufer||buffer
252 cacluated||calculated
253 caculate||calculate
254 caculation||calculation
255 cadidate||candidate
256 cahces||caches
257 calender||calendar
258 calescing||coalescing
259 calle||called
260 callibration||calibration
261 callled||called
262 callser||caller
263 calucate||calculate
264 calulate||calculate
265 cancelation||cancellation
266 cancle||cancel
267 canot||cannot
268 capabilites||capabilities
269 capabilties||capabilities
270 capabilty||capability
271 capabitilies||capabilities
272 capablity||capability
273 capatibilities||capabilities
274 capapbilities||capabilities
275 caputure||capture
276 carefuly||carefully
277 cariage||carriage
278 catagory||category
279 cehck||check
280 challange||challenge
281 challanges||challenges
282 chache||cache
283 chanell||channel
284 changable||changeable
285 chanined||chained
286 channle||channel
287 channnel||channel
288 charachter||character
289 charachters||characters
290 charactor||character
291 charater||character
292 charaters||characters
293 charcter||character
294 chcek||check
295 chck||check
296 checksumed||checksummed
297 checksuming||checksumming
298 childern||children
299 childs||children
300 chiled||child
301 chked||checked
302 chnage||change
303 chnages||changes
304 chnnel||channel
305 choosen||chosen
306 chouse||chose
307 circumvernt||circumvent
308 claread||cleared
309 clared||cleared
310 closeing||closing
311 clustred||clustered
312 cnfiguration||configuration
313 coexistance||coexistence
314 colescing||coalescing
315 collapsable||collapsible
316 colorfull||colorful
317 comand||command
318 comit||commit
319 commerical||commercial
320 comming||coming
321 comminucation||communication
322 commited||committed
323 commiting||committing
324 committ||commit
325 commnunication||communication
326 commoditiy||commodity
327 comsume||consume
328 comsumer||consumer
329 comsuming||consuming
330 compability||compatibility
331 compaibility||compatibility
332 comparsion||comparison
333 compatability||compatibility
334 compatable||compatible
335 compatibililty||compatibility
336 compatibiliy||compatibility
337 compatibilty||compatibility
338 compatiblity||compatibility
339 competion||completion
340 compilant||compliant
341 compleatly||completely
342 completition||completion
343 completly||completely
344 complient||compliant
345 componnents||components
346 compoment||component
347 comppatible||compatible
348 compres||compress
349 compresion||compression
350 comression||compression
351 comunicate||communicate
352 comunication||communication
353 conbination||combination
354 conditionaly||conditionally
355 conditon||condition
356 condtion||condition
357 conected||connected
358 conector||connector
359 configration||configuration
360 configred||configured
361 configuartion||configuration
362 configuation||configuration
363 configued||configured
364 configuratoin||configuration
365 configuraton||configuration
366 configuretion||configuration
367 configutation||configuration
368 conider||consider
369 conjuction||conjunction
370 connecetd||connected
371 connectinos||connections
372 connetor||connector
373 connnection||connection
374 connnections||connections
375 consistancy||consistency
376 consistant||consistent
377 containes||contains
378 containts||contains
379 contaisn||contains
380 contant||contact
381 contence||contents
382 contiguos||contiguous
383 continious||continuous
384 continous||continuous
385 continously||continuously
386 continueing||continuing
387 contraints||constraints
388 contruct||construct
389 contol||control
390 contoller||controller
391 controled||controlled
392 controler||controller
393 controll||control
394 contruction||construction
395 contry||country
396 conuntry||country
397 convertion||conversion
398 convertor||converter
399 convienient||convenient
400 convinient||convenient
401 corected||corrected
402 correponding||corresponding
403 correponds||corresponds
404 correspoding||corresponding
405 cotrol||control
406 cound||could
407 couter||counter
408 coutner||counter
409 cryptocraphic||cryptographic
410 cunter||counter
411 curently||currently
412 cylic||cyclic
413 dafault||default
414 deactive||deactivate
415 deafult||default
416 deamon||daemon
417 debouce||debounce
418 decendant||descendant
419 decendants||descendants
420 decompres||decompress
421 decsribed||described
422 decription||description
423 dectected||detected
424 defailt||default
425 deferal||deferral
426 deffered||deferred
427 defferred||deferred
428 definate||definite
429 definately||definitely
430 definiation||definition
431 defintion||definition
432 defintions||definitions
433 defualt||default
434 defult||default
435 deintializing||deinitializing
436 deintialize||deinitialize
437 deintialized||deinitialized
438 deivce||device
439 delared||declared
440 delare||declare
441 delares||declares
442 delaring||declaring
443 delemiter||delimiter
444 delievered||delivered
445 demodualtor||demodulator
446 demension||dimension
447 dependancies||dependencies
448 dependancy||dependency
449 dependant||dependent
450 dependend||dependent
451 depreacted||deprecated
452 depreacte||deprecate
453 desactivate||deactivate
454 desciptor||descriptor
455 desciptors||descriptors
456 descripto||descriptor
457 descripton||description
458 descrition||description
459 descritptor||descriptor
460 desctiptor||descriptor
461 desriptor||descriptor
462 desriptors||descriptors
463 desination||destination
464 destionation||destination
465 destoried||destroyed
466 destory||destroy
467 destoryed||destroyed
468 destorys||destroys
469 destroied||destroyed
470 detabase||database
471 deteced||detected
472 detectt||detect
473 develope||develop
474 developement||development
475 developped||developed
476 developpement||development
477 developper||developer
478 developpment||development
479 deveolpment||development
480 devided||divided
481 deviece||device
482 devision||division
483 diable||disable
484 diabled||disabled
485 dicline||decline
486 dictionnary||dictionary
487 didnt||didn't
488 diferent||different
489 differrence||difference
490 diffrent||different
491 differenciate||differentiate
492 diffrentiate||differentiate
493 difinition||definition
494 digial||digital
495 dimention||dimension
496 dimesions||dimensions
497 diconnected||disconnected
498 disabed||disabled
499 disble||disable
500 disgest||digest
501 disired||desired
502 dispalying||displaying
503 diplay||display
504 directon||direction
505 direcly||directly
506 direectly||directly
507 diregard||disregard
508 disassocation||disassociation
509 disapear||disappear
510 disapeared||disappeared
511 disappared||disappeared
512 disbale||disable
513 disbaled||disabled
514 disble||disable
515 disbled||disabled
516 disconnet||disconnect
517 discontinous||discontinuous
518 disharge||discharge
519 disnabled||disabled
520 dispertion||dispersion
521 dissapears||disappears
522 dissconect||disconnect
523 distiction||distinction
524 divisable||divisible
525 divsiors||divisors
526 docuentation||documentation
527 documantation||documentation
528 documentaion||documentation
529 documment||document
530 doesnt||doesn't
531 donwload||download
532 donwloading||downloading
533 dorp||drop
534 dosen||doesn
535 downlad||download
536 downlads||downloads
537 droped||dropped
538 droput||dropout
539 druing||during
540 dyanmic||dynamic
541 dynmaic||dynamic
542 eanable||enable
543 eanble||enable
544 easilly||easily
545 ecspecially||especially
546 edditable||editable
547 editting||editing
548 efective||effective
549 effectivness||effectiveness
550 efficently||efficiently
551 ehther||ether
552 eigth||eight
553 elementry||elementary
554 eletronic||electronic
555 embeded||embedded
556 enabledi||enabled
557 enbale||enable
558 enble||enable
559 enchanced||enhanced
560 encorporating||incorporating
561 encrupted||encrypted
562 encrypiton||encryption
563 encryptio||encryption
564 endianess||endianness
565 enpoint||endpoint
566 enhaced||enhanced
567 enlightnment||enlightenment
568 enqueing||enqueuing
569 entires||entries
570 entites||entities
571 entrys||entries
572 enocded||encoded
573 enought||enough
574 enterily||entirely
575 enviroiment||environment
576 enviroment||environment
577 environement||environment
578 environent||environment
579 eqivalent||equivalent
580 equiped||equipped
581 equivelant||equivalent
582 equivilant||equivalent
583 eror||error
584 errorr||error
585 errror||error
586 estbalishment||establishment
587 etsablishment||establishment
588 etsbalishment||establishment
589 evalute||evaluate
590 evalutes||evaluates
591 evalution||evaluation
592 excecutable||executable
593 exceded||exceeded
594 exceds||exceeds
595 exceeed||exceed
596 excellant||excellent
597 execeeded||exceeded
598 execeeds||exceeds
599 exeed||exceed
600 exeeds||exceeds
601 exeuction||execution
602 existance||existence
603 existant||existent
604 exixt||exist
605 exlcude||exclude
606 exlcusive||exclusive
607 exmaple||example
608 expecially||especially
609 experies||expires
610 explicite||explicit
611 explicitely||explicitly
612 explict||explicit
613 explictely||explicitly
614 explictly||explicitly
615 expresion||expression
616 exprimental||experimental
617 extened||extended
618 exteneded||extended
619 extensability||extensibility
620 extention||extension
621 extenstion||extension
622 extracter||extractor
623 faied||failed
624 faield||failed
625 faild||failed
626 failded||failed
627 failer||failure
628 faill||fail
629 failied||failed
630 faillure||failure
631 failue||failure
632 failuer||failure
633 failng||failing
634 faireness||fairness
635 falied||failed
636 faliure||failure
637 fallbck||fallback
638 familar||familiar
639 fatser||faster
640 feauture||feature
641 feautures||features
642 fetaure||feature
643 fetaures||features
644 fileystem||filesystem
645 fimrware||firmware
646 fimware||firmware
647 firmare||firmware
648 firmaware||firmware
649 firware||firmware
650 firwmare||firmware
651 finanize||finalize
652 findn||find
653 finilizes||finalizes
654 finsih||finish
655 flusing||flushing
656 folloing||following
657 followign||following
658 followings||following
659 follwing||following
660 fonud||found
661 forseeable||foreseeable
662 forse||force
663 fortan||fortran
664 forwardig||forwarding
665 frambuffer||framebuffer
666 framming||framing
667 framwork||framework
668 frequence||frequency
669 frequncy||frequency
670 frequancy||frequency
671 frome||from
672 fucntion||function
673 fuction||function
674 fuctions||functions
675 fullill||fulfill
676 funcation||function
677 funcion||function
678 functionallity||functionality
679 functionaly||functionally
680 functionnality||functionality
681 functonality||functionality
682 funtion||function
683 funtions||functions
684 furthur||further
685 futhermore||furthermore
686 futrue||future
687 gatable||gateable
688 gateing||gating
689 gauage||gauge
690 gaurenteed||guaranteed
691 generiously||generously
692 genereate||generate
693 genereted||generated
694 genric||generic
695 globel||global
696 grabing||grabbing
697 grahical||graphical
698 grahpical||graphical
699 granularty||granularity
700 grapic||graphic
701 grranted||granted
702 guage||gauge
703 guarenteed||guaranteed
704 guarentee||guarantee
705 halfs||halves
706 hander||handler
707 handfull||handful
708 hanlde||handle
709 hanled||handled
710 happend||happened
711 hardare||hardware
712 harware||hardware
713 havind||having
714 heirarchically||hierarchically
715 heirarchy||hierarchy
716 helpfull||helpful
717 hearbeat||heartbeat
718 heterogenous||heterogeneous
719 hexdecimal||hexadecimal
720 hybernate||hibernate
721 hierachy||hierarchy
722 hierarchie||hierarchy
723 homogenous||homogeneous
724 howver||however
725 hsould||should
726 hypervior||hypervisor
727 hypter||hyper
728 identidier||identifier
729 iligal||illegal
730 illigal||illegal
731 illgal||illegal
732 iomaped||iomapped
733 imblance||imbalance
734 immeadiately||immediately
735 immedaite||immediate
736 immedate||immediate
737 immediatelly||immediately
738 immediatly||immediately
739 immidiate||immediate
740 immutible||immutable
741 impelentation||implementation
742 impementated||implemented
743 implemantation||implementation
744 implemenation||implementation
745 implementaiton||implementation
746 implementated||implemented
747 implemention||implementation
748 implementd||implemented
749 implemetation||implementation
750 implemntation||implementation
751 implentation||implementation
752 implmentation||implementation
753 implmenting||implementing
754 incative||inactive
755 incomming||incoming
756 incompatabilities||incompatibilities
757 incompatable||incompatible
758 incompatble||incompatible
759 inconsistant||inconsistent
760 increas||increase
761 incremeted||incremented
762 incrment||increment
763 incuding||including
764 inculde||include
765 indendation||indentation
766 indended||intended
767 independant||independent
768 independantly||independently
769 independed||independent
770 indiate||indicate
771 indicat||indicate
772 inexpect||inexpected
773 inferface||interface
774 infinit||infinite
775 infomation||information
776 informatiom||information
777 informations||information
778 informtion||information
779 infromation||information
780 ingore||ignore
781 inital||initial
782 initalized||initialized
783 initalised||initialized
784 initalise||initialize
785 initalize||initialize
786 initation||initiation
787 initators||initiators
788 initialiazation||initialization
789 initializationg||initialization
790 initializiation||initialization
791 initialze||initialize
792 initialzed||initialized
793 initialzing||initializing
794 initilization||initialization
795 initilize||initialize
796 initliaze||initialize
797 initilized||initialized
798 inofficial||unofficial
799 inrerface||interface
800 insititute||institute
801 instace||instance
802 instal||install
803 instanciate||instantiate
804 instanciated||instantiated
805 instuments||instruments
806 insufficent||insufficient
807 inteface||interface
808 integreated||integrated
809 integrety||integrity
810 integrey||integrity
811 intendet||intended
812 intented||intended
813 interanl||internal
814 interchangable||interchangeable
815 interferring||interfering
816 interger||integer
817 intergrated||integrated
818 intermittant||intermittent
819 internel||internal
820 interoprability||interoperability
821 interuupt||interrupt
822 interupt||interrupt
823 interupts||interrupts
824 interrface||interface
825 interrrupt||interrupt
826 interrup||interrupt
827 interrups||interrupts
828 interruptted||interrupted
829 interupted||interrupted
830 intiailized||initialized
831 intial||initial
832 intialisation||initialisation
833 intialised||initialised
834 intialise||initialise
835 intialization||initialization
836 intialized||initialized
837 intialize||initialize
838 intregral||integral
839 intrerrupt||interrupt
840 intrrupt||interrupt
841 intterrupt||interrupt
842 intuative||intuitive
843 inavlid||invalid
844 invaid||invalid
845 invaild||invalid
846 invailid||invalid
847 invald||invalid
848 invalde||invalid
849 invalide||invalid
850 invalidiate||invalidate
851 invalud||invalid
852 invididual||individual
853 invokation||invocation
854 invokations||invocations
855 ireelevant||irrelevant
856 irrelevent||irrelevant
857 isnt||isn't
858 isssue||issue
859 issus||issues
860 iteraions||iterations
861 iternations||iterations
862 itertation||iteration
863 itslef||itself
864 jave||java
865 jeffies||jiffies
866 jumpimng||jumping
867 juse||just
868 jus||just
869 kown||known
870 langage||language
871 langauage||language
872 langauge||language
873 langugage||language
874 lauch||launch
875 layed||laid
876 legnth||length
877 leightweight||lightweight
878 lengh||length
879 lenght||length
880 lenth||length
881 lesstiff||lesstif
882 libaries||libraries
883 libary||library
884 librairies||libraries
885 libraris||libraries
886 licenceing||licencing
887 limted||limited
888 logaritmic||logarithmic
889 loggging||logging
890 loggin||login
891 logile||logfile
892 loobpack||loopback
893 loosing||losing
894 losted||lost
895 maangement||management
896 machinary||machinery
897 maibox||mailbox
898 maintainance||maintenance
899 maintainence||maintenance
900 maintan||maintain
901 makeing||making
902 mailformed||malformed
903 malplaced||misplaced
904 malplace||misplace
905 managable||manageable
906 managament||management
907 managment||management
908 mangement||management
909 manger||manager
910 manoeuvering||maneuvering
911 manufaucturing||manufacturing
912 mappping||mapping
913 maping||mapping
914 matchs||matches
915 mathimatical||mathematical
916 mathimatic||mathematic
917 mathimatics||mathematics
918 maximium||maximum
919 maxium||maximum
920 mechamism||mechanism
921 meetign||meeting
922 memeory||memory
923 memmber||member
924 memoery||memory
925 memroy||memory
926 ment||meant
927 mergable||mergeable
928 mesage||message
929 messags||messages
930 messgaes||messages
931 messsage||message
932 messsages||messages
933 metdata||metadata
934 micropone||microphone
935 microprocesspr||microprocessor
936 migrateable||migratable
937 milliseonds||milliseconds
938 minium||minimum
939 minimam||minimum
940 miniumum||minimum
941 minumum||minimum
942 misalinged||misaligned
943 miscelleneous||miscellaneous
944 misformed||malformed
945 mispelled||misspelled
946 mispelt||misspelt
947 mising||missing
948 mismactch||mismatch
949 missign||missing
950 missmanaged||mismanaged
951 missmatch||mismatch
952 misssing||missing
953 miximum||maximum
954 mmnemonic||mnemonic
955 mnay||many
956 modfiy||modify
957 modifer||modifier
958 modulues||modules
959 momery||memory
960 memomry||memory
961 monitring||monitoring
962 monochorome||monochrome
963 monochromo||monochrome
964 monocrome||monochrome
965 mopdule||module
966 mroe||more
967 multipler||multiplier
968 mulitplied||multiplied
969 multidimensionnal||multidimensional
970 multipe||multiple
971 multple||multiple
972 mumber||number
973 muticast||multicast
974 mutilcast||multicast
975 mutiple||multiple
976 mutli||multi
977 nams||names
978 navagating||navigating
979 nead||need
980 neccecary||necessary
981 neccesary||necessary
982 neccessary||necessary
983 necesary||necessary
984 neded||needed
985 negaive||negative
986 negoitation||negotiation
987 negotation||negotiation
988 nerver||never
989 nescessary||necessary
990 nessessary||necessary
991 noticable||noticeable
992 notication||notification
993 notications||notifications
994 notifcations||notifications
995 notifed||notified
996 notity||notify
997 nubmer||number
998 numebr||number
999 numner||number
1000 obtaion||obtain
1001 obusing||abusing
1002 occassionally||occasionally
1003 occationally||occasionally
1004 occurance||occurrence
1005 occurances||occurrences
1006 occurd||occurred
1007 occured||occurred
1008 occurence||occurrence
1009 occure||occurred
1010 occuring||occurring
1011 offser||offset
1012 offet||offset
1013 offlaod||offload
1014 offloded||offloaded
1015 offseting||offsetting
1016 omited||omitted
1017 omiting||omitting
1018 omitt||omit
1019 ommiting||omitting
1020 ommitted||omitted
1021 onself||oneself
1022 ony||only
1023 openning||opening
1024 operatione||operation
1025 opertaions||operations
1026 opportunies||opportunities
1027 optionnal||optional
1028 optmizations||optimizations
1029 orientatied||orientated
1030 orientied||oriented
1031 orignal||original
1032 originial||original
1033 otherise||otherwise
1034 ouput||output
1035 oustanding||outstanding
1036 overaall||overall
1037 overhread||overhead
1038 overlaping||overlapping
1039 overflw||overflow
1040 overlfow||overflow
1041 overide||override
1042 overrided||overridden
1043 overriden||overridden
1044 overrrun||overrun
1045 overun||overrun
1046 overwritting||overwriting
1047 overwriten||overwritten
1048 pacakge||package
1049 pachage||package
1050 packacge||package
1051 packege||package
1052 packge||package
1053 packtes||packets
1054 pakage||package
1055 paket||packet
1056 pallette||palette
1057 paln||plan
1058 paramameters||parameters
1059 paramaters||parameters
1060 paramater||parameter
1061 parametes||parameters
1062 parametised||parametrised
1063 paramter||parameter
1064 paramters||parameters
1065 parmaters||parameters
1066 particuarly||particularly
1067 particularily||particularly
1068 partion||partition
1069 partions||partitions
1070 partiton||partition
1071 pased||passed
1072 passin||passing
1073 pathes||paths
1074 pattrns||patterns
1075 pecularities||peculiarities
1076 peformance||performance
1077 peforming||performing
1078 peice||piece
1079 pendantic||pedantic
1080 peprocessor||preprocessor
1081 perfomance||performance
1082 perfoming||performing
1083 perfomring||performing
1084 periperal||peripheral
1085 peripherial||peripheral
1086 permissons||permissions
1087 peroid||period
1088 persistance||persistence
1089 persistant||persistent
1090 phoneticly||phonetically
1091 plalform||platform
1092 platfoem||platform
1093 platfrom||platform
1094 plattform||platform
1095 pleaes||please
1096 ploting||plotting
1097 plugable||pluggable
1098 poinnter||pointer
1099 pointeur||pointer
1100 poiter||pointer
1101 posible||possible
1102 positon||position
1103 possibilites||possibilities
1104 potocol||protocol
1105 powerfull||powerful
1106 pramater||parameter
1107 preamle||preamble
1108 preample||preamble
1109 preapre||prepare
1110 preceeded||preceded
1111 preceeding||preceding
1112 preceed||precede
1113 precendence||precedence
1114 precission||precision
1115 preemptable||preemptible
1116 prefered||preferred
1117 prefferably||preferably
1118 prefitler||prefilter
1119 preform||perform
1120 premption||preemption
1121 prepaired||prepared
1122 prepate||prepare
1123 preperation||preparation
1124 preprare||prepare
1125 pressre||pressure
1126 presuambly||presumably
1127 previosuly||previously
1128 primative||primitive
1129 princliple||principle
1130 priorty||priority
1131 privilaged||privileged
1132 privilage||privilege
1133 priviledge||privilege
1134 priviledges||privileges
1135 privleges||privileges
1136 probaly||probably
1137 procceed||proceed
1138 proccesors||processors
1139 procesed||processed
1140 proces||process
1141 procesing||processing
1142 processessing||processing
1143 processess||processes
1144 processpr||processor
1145 processsed||processed
1146 processsing||processing
1147 procteted||protected
1148 prodecure||procedure
1149 progamming||programming
1150 progams||programs
1151 progess||progress
1152 programable||programmable
1153 programers||programmers
1154 programm||program
1155 programms||programs
1156 progresss||progress
1157 prohibitted||prohibited
1158 prohibitting||prohibiting
1159 promiscous||promiscuous
1160 promps||prompts
1161 pronnounced||pronounced
1162 prononciation||pronunciation
1163 pronouce||pronounce
1164 pronunce||pronounce
1165 propery||property
1166 propigate||propagate
1167 propigation||propagation
1168 propogation||propagation
1169 propogate||propagate
1170 prosess||process
1171 protable||portable
1172 protcol||protocol
1173 protecion||protection
1174 protedcted||protected
1175 protocoll||protocol
1176 promixity||proximity
1177 psudo||pseudo
1178 psuedo||pseudo
1179 psychadelic||psychedelic
1180 purgable||purgeable
1181 pwoer||power
1182 queing||queuing
1183 quering||querying
1184 queus||queues
1185 randomally||randomly
1186 raoming||roaming
1187 reasearcher||researcher
1188 reasearchers||researchers
1189 reasearch||research
1190 receieve||receive
1191 recepient||recipient
1192 recevied||received
1193 receving||receiving
1194 recievd||received
1195 recieved||received
1196 recieve||receive
1197 reciever||receiver
1198 recieves||receives
1199 recieving||receiving
1200 recogniced||recognised
1201 recognizeable||recognizable
1202 recommanded||recommended
1203 recyle||recycle
1204 redircet||redirect
1205 redirectrion||redirection
1206 redundacy||redundancy
1207 reename||rename
1208 refcounf||refcount
1209 refence||reference
1210 refered||referred
1211 referenace||reference
1212 refering||referring
1213 refernces||references
1214 refernnce||reference
1215 refrence||reference
1216 registed||registered
1217 registerd||registered
1218 registeration||registration
1219 registeresd||registered
1220 registerred||registered
1221 registes||registers
1222 registraration||registration
1223 regsiter||register
1224 regster||register
1225 regualar||regular
1226 reguator||regulator
1227 regulamentations||regulations
1228 reigstration||registration
1229 releated||related
1230 relevent||relevant
1231 reloade||reload
1232 remoote||remote
1233 remore||remote
1234 removeable||removable
1235 repectively||respectively
1236 replacable||replaceable
1237 replacments||replacements
1238 replys||replies
1239 reponse||response
1240 representaion||representation
1241 reqeust||request
1242 reqister||register
1243 requed||requeued
1244 requestied||requested
1245 requiere||require
1246 requirment||requirement
1247 requred||required
1248 requried||required
1249 requst||request
1250 requsted||requested
1251 reregisteration||reregistration
1252 reseting||resetting
1253 reseved||reserved
1254 reseverd||reserved
1255 resizeable||resizable
1256 resouce||resource
1257 resouces||resources
1258 resoures||resources
1259 responce||response
1260 resrouce||resource
1261 ressizes||resizes
1262 ressource||resource
1263 ressources||resources
1264 restesting||retesting
1265 resumbmitting||resubmitting
1266 retransmited||retransmitted
1267 retreived||retrieved
1268 retreive||retrieve
1269 retreiving||retrieving
1270 retrive||retrieve
1271 retrived||retrieved
1272 retrun||return
1273 retun||return
1274 retuned||returned
1275 reudce||reduce
1276 reuest||request
1277 reuqest||request
1278 reutnred||returned
1279 revsion||revision
1280 rmeoved||removed
1281 rmeove||remove
1282 rmeoves||removes
1283 rountine||routine
1284 routins||routines
1285 rquest||request
1286 runing||running
1287 runned||ran
1288 runnning||running
1289 runtine||runtime
1290 sacrifying||sacrificing
1291 safly||safely
1292 safty||safety
1293 savable||saveable
1294 scaleing||scaling
1295 scaned||scanned
1296 scaning||scanning
1297 scarch||search
1298 schdule||schedule
1299 seach||search
1300 searchs||searches
1301 secion||section
1302 secquence||sequence
1303 secund||second
1304 segement||segment
1305 seleted||selected
1306 semaphone||semaphore
1307 senario||scenario
1308 senarios||scenarios
1309 sentivite||sensitive
1310 separatly||separately
1311 sepcify||specify
1312 seperated||separated
1313 seperately||separately
1314 seperate||separate
1315 seperatly||separately
1316 seperator||separator
1317 sepperate||separate
1318 seqeunce||sequence
1319 seqeuncer||sequencer
1320 seqeuencer||sequencer
1321 sequece||sequence
1322 sequemce||sequence
1323 sequencial||sequential
1324 serivce||service
1325 serveral||several
1326 servive||service
1327 setts||sets
1328 settting||setting
1329 shapshot||snapshot
1330 shotdown||shutdown
1331 shoud||should
1332 shouldnt||shouldn't
1333 shoule||should
1334 shrinked||shrunk
1335 siginificantly||significantly
1336 signabl||signal
1337 significanly||significantly
1338 similary||similarly
1339 similiar||similar
1340 simlar||similar
1341 simliar||similar
1342 simpified||simplified
1343 singaled||signaled
1344 singal||signal
1345 singed||signed
1346 sleeped||slept
1347 sliped||slipped
1348 softwade||software
1349 softwares||software
1350 soley||solely
1351 souce||source
1352 speach||speech
1353 specfic||specific
1354 specfield||specified
1355 speciefied||specified
1356 specifc||specific
1357 specifed||specified
1358 specificatin||specification
1359 specificaton||specification
1360 specificed||specified
1361 specifing||specifying
1362 specifiy||specify
1363 specifiying||specifying
1364 speficied||specified
1365 speicify||specify
1366 speling||spelling
1367 spinlcok||spinlock
1368 spinock||spinlock
1369 splitted||split
1370 spreaded||spread
1371 spurrious||spurious
1372 sructure||structure
1373 stablilization||stabilization
1374 staically||statically
1375 staion||station
1376 standardss||standards
1377 standartization||standardization
1378 standart||standard
1379 standy||standby
1380 stardard||standard
1381 staticly||statically
1382 statuss||status
1383 stoped||stopped
1384 stoping||stopping
1385 stoppped||stopped
1386 straming||streaming
1387 struc||struct
1388 structres||structures
1389 stuct||struct
1390 strucuture||structure
1391 stucture||structure
1392 sturcture||structure
1393 subdirectoires||subdirectories
1394 suble||subtle
1395 substract||subtract
1396 submited||submitted
1397 submition||submission
1398 succeded||succeeded
1399 suceed||succeed
1400 succesfully||successfully
1401 succesful||successful
1402 successed||succeeded
1403 successfull||successful
1404 successfuly||successfully
1405 sucessfully||successfully
1406 sucessful||successful
1407 sucess||success
1408 superflous||superfluous
1409 superseeded||superseded
1410 suplied||supplied
1411 suported||supported
1412 suport||support
1413 supportet||supported
1414 suppored||supported
1415 supportin||supporting
1416 suppoted||supported
1417 suppported||supported
1418 suppport||support
1419 supprot||support
1420 supress||suppress
1421 surpressed||suppressed
1422 surpresses||suppresses
1423 susbsystem||subsystem
1424 suspeneded||suspended
1425 suspsend||suspend
1426 suspicously||suspiciously
1427 swaping||swapping
1428 switchs||switches
1429 swith||switch
1430 swithable||switchable
1431 swithc||switch
1432 swithced||switched
1433 swithcing||switching
1434 swithed||switched
1435 swithing||switching
1436 swtich||switch
1437 syfs||sysfs
1438 symetric||symmetric
1439 synax||syntax
1440 synchonized||synchronized
1441 synchronuously||synchronously
1442 syncronize||synchronize
1443 syncronized||synchronized
1444 syncronizing||synchronizing
1445 syncronus||synchronous
1446 syste||system
1447 sytem||system
1448 sythesis||synthesis
1449 taht||that
1450 tansmit||transmit
1451 targetted||targeted
1452 targetting||targeting
1453 taskelt||tasklet
1454 teh||the
1455 temorary||temporary
1456 temproarily||temporarily
1457 temperture||temperature
1458 thead||thread
1459 therfore||therefore
1460 thier||their
1461 threds||threads
1462 threee||three
1463 threshhold||threshold
1464 thresold||threshold
1465 throught||through
1466 trackling||tracking
1467 troughput||throughput
1468 trys||tries
1469 thses||these
1470 tiggers||triggers
1471 tiggered||triggered
1472 tipically||typically
1473 timeing||timing
1474 timout||timeout
1475 tmis||this
1476 toogle||toggle
1477 torerable||tolerable
1478 traget||target
1479 traking||tracking
1480 tramsmitted||transmitted
1481 tramsmit||transmit
1482 tranasction||transaction
1483 tranceiver||transceiver
1484 tranfer||transfer
1485 tranmission||transmission
1486 transcevier||transceiver
1487 transciever||transceiver
1488 transferd||transferred
1489 transfered||transferred
1490 transfering||transferring
1491 transision||transition
1492 transmittd||transmitted
1493 transormed||transformed
1494 trasfer||transfer
1495 trasmission||transmission
1496 treshold||threshold
1497 triggerd||triggered
1498 trigerred||triggered
1499 trigerring||triggering
1500 trun||turn
1501 tunning||tuning
1502 ture||true
1503 tyep||type
1504 udpate||update
1505 uesd||used
1506 uknown||unknown
1507 usccess||success
1508 uncommited||uncommitted
1509 uncompatible||incompatible
1510 unconditionaly||unconditionally
1511 undeflow||underflow
1512 underun||underrun
1513 unecessary||unnecessary
1514 unexecpted||unexpected
1515 unexepected||unexpected
1516 unexpcted||unexpected
1517 unexpectd||unexpected
1518 unexpeted||unexpected
1519 unexpexted||unexpected
1520 unfortunatelly||unfortunately
1521 unifiy||unify
1522 uniterrupted||uninterrupted
1523 unintialized||uninitialized
1524 unitialized||uninitialized
1525 unkmown||unknown
1526 unknonw||unknown
1527 unknouwn||unknown
1528 unknow||unknown
1529 unkown||unknown
1530 unamed||unnamed
1531 uneeded||unneeded
1532 unneded||unneeded
1533 unneccecary||unnecessary
1534 unneccesary||unnecessary
1535 unneccessary||unnecessary
1536 unnecesary||unnecessary
1537 unneedingly||unnecessarily
1538 unnsupported||unsupported
1539 unmached||unmatched
1540 unprecise||imprecise
1541 unregester||unregister
1542 unresgister||unregister
1543 unrgesiter||unregister
1544 unsinged||unsigned
1545 unstabel||unstable
1546 unsolicitied||unsolicited
1547 unsuccessfull||unsuccessful
1548 unsuported||unsupported
1549 untill||until
1550 ununsed||unused
1551 unuseful||useless
1552 unvalid||invalid
1553 upate||update
1554 upsupported||unsupported
1555 usefule||useful
1556 usefull||useful
1557 usege||usage
1558 usera||users
1559 usualy||usually
1560 usupported||unsupported
1561 utilites||utilities
1562 utillities||utilities
1563 utilties||utilities
1564 utiltity||utility
1565 utitity||utility
1566 utitlty||utility
1567 vaid||valid
1568 vaild||valid
1569 valide||valid
1570 variantions||variations
1571 varible||variable
1572 varient||variant
1573 vaule||value
1574 verbse||verbose
1575 veify||verify
1576 veriosn||version
1577 verisons||versions
1578 verison||version
1579 verson||version
1580 vicefersa||vice-versa
1581 virtal||virtual
1582 virtaul||virtual
1583 virtiual||virtual
1584 visiters||visitors
1585 vitual||virtual
1586 vunerable||vulnerable
1587 wakeus||wakeups
1588 wathdog||watchdog
1589 wating||waiting
1590 wiat||wait
1591 wether||whether
1592 whataver||whatever
1593 whcih||which
1594 whenver||whenever
1595 wheter||whether
1596 whe||when
1597 wierd||weird
1598 wiil||will
1599 wirte||write
1600 withing||within
1601 wnat||want
1602 wont||won't
1603 workarould||workaround
1604 writeing||writing
1605 writting||writing
1606 wtih||with
1607 zombe||zombie
1608 zomebie||zombie
+0
-17
tests/ci/install_openssl.sh less more
0 #!/bin/sh
1
2 set -e
3
4 PREFIX="$1"
5
6 [ -x "${PREFIX}/bin/openssl" ] && exit 0
7
8 VERSION=1.0.2u
9 SRC="https://www.openssl.org/source/old/1.0.2/openssl-${VERSION}.tar.gz"
10
11 wget -O openssl.tar.gz "$SRC"
12 tar -xf openssl.tar.gz -C "$HOME"
13 cd "${HOME}/openssl-${VERSION}"
14 ./config --prefix="$PREFIX" shared -fPIC
15 make
16 make install
+0
-31
tests/lint/astyle.sh less more
0 #!/bin/bash
1 # Copyright (C) 2015 Adrien Vergé
2
3 # Check that astyle is installed
4 if ! command -v astyle &>/dev/null; then
5 echo "error: astyle is not installed" >&2
6 exit -1
7 fi
8
9 rc=0
10
11 for file in "$@"; do
12 tmp=$(mktemp)
13
14 astyle \
15 --style=linux \
16 --indent=tab=8 \
17 --pad-header \
18 --align-reference=type \
19 <"$file" >"$tmp"
20
21 if ! cmp -s "$file" "$tmp"; then
22 echo "error: $file does not comply with coding style" >&2
23 git --no-pager diff --no-index -U0 "$file" "$tmp"
24 rc=1
25 fi
26
27 rm "$tmp"
28 done
29
30 exit $rc
+0
-25
tests/lint/checkpatch.sh less more
0 #!/bin/bash
1 # Copyright (C) 2020 Dimitri Papadopoulos
2
3 # Path to checkpatch.pl
4 script_dir=`dirname "${BASH_SOURCE[0]}"`
5 checkpatch_path=`realpath "${script_dir}/../ci/checkpatch/checkpatch.pl"`
6
7 rc=0
8
9 for file in "$@"; do
10 tmp=$(mktemp)
11
12 "$checkpatch_path" --no-tree --terse \
13 --ignore LEADING_SPACE,SPDX_LICENSE_TAG,CODE_INDENT,NAKED_SSCANF,VOLATILE,NEW_TYPEDEFS,LONG_LINE,LONG_LINE_STRING,QUOTED_WHITESPACE_BEFORE_NEWLINE,STRLCPY \
14 -f "$file" | tee "$tmp"
15
16 if [ -s "$tmp" ]; then
17 echo "error: $file does not comply with Linux kernel coding style" >&2
18 rc=1
19 fi
20
21 rm "$tmp"
22 done
23
24 exit $rc
+0
-18
tests/lint/eol-at-eof.sh less more
0 #!/bin/bash
1 # Copyright (C) 2015 Adrien Vergé
2
3 rc=0
4
5 for file in "$@"; do
6 if [ "$(sed -n '$p' "$file")" = "" ]; then
7 echo "$file: too many newlines at end of file" >&2
8 rc=1
9 fi
10
11 if [ "$(tail -c 1 "$file")" != "" ]; then
12 echo "$file: no newline at end of file" >&2
13 rc=1
14 fi
15 done
16
17 exit $rc
+0
-78
tests/lint/line_length.py less more
0 #!/usr/bin/python3
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2015 Adrien Vergé
3
4 """Enforce maximum line length in openfortivpn C source code.
5
6 Example
7 -------
8 Pass the list of files to check as arguments to the script::
9
10 $ line_length.py file1.c file2.c file3.c
11
12 Notes
13 -----
14 This script has been working so far for openfortivpn.
15 It has not been widely tested. It may not work on any C source file.
16
17 """
18
19 import sys
20
21 # Guidelines say 80, let's tolerate a bit more
22 MAX = 90
23
24
25 def endswithstring(line):
26 """Detect lines from C source code ending with a string.
27
28 This function has not been widely tested.
29
30 Parameters
31 ----------
32 line : str
33 Line of C source code.
34
35 Returns
36 -------
37 bool
38 True if line ends with string, False otherwise.
39
40 """
41 for end in ('"', '",', '");', '";', '" \\', '];'):
42 if line.endswith(end):
43 return True
44 return False
45
46
47 def main():
48 """Check each file provided as a command line parameter
49
50 Returns
51 -------
52 int
53 1 if a line in one of the files exceeds the expected length, else 0.
54
55 """
56 exit_status = 0
57
58 for arg in sys.argv[1:]:
59 with open(arg, "r") as source_file:
60 for i, line in enumerate(source_file):
61 line = line.rstrip()
62 # Lines that end with a string are exempted
63 if endswithstring(line):
64 continue
65 # Replace tabs with 8 spaces
66 line = line.replace("\t", " ")
67 # Lines longer than MAX are reported as an error
68 if len(line) > MAX:
69 print("{}: {}: line too long ({} characters)"
70 .format(arg, i, len(line)))
71 exit_status = 1
72
73 sys.exit(exit_status)
74
75
76 if __name__ == "__main__":
77 main()
+0
-14
tests/lint/run.sh less more
0 #!/bin/bash
1 # Copyright (C) 2015 Adrien Vergé
2
3 rc=0
4
5 ./tests/lint/eol-at-eof.sh $(git ls-files | grep -v openssl_hostname_validation) || rc=1
6
7 ./tests/lint/line_length.py $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation) || rc=1
8
9 ./tests/lint/astyle.sh $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation) || rc=1
10
11 ./tests/lint/checkpatch.sh $(git ls-files '*.[ch]' | grep -v openssl_hostname_validation) || rc=1
12
13 exit $rc