diff --git a/Config b/Config index b51a413..8fe0d40 100755 --- a/Config +++ b/Config @@ -280,7 +280,7 @@ OPEROVERRIDEVERIFY="" GENCERTIFICATE="1" EXTRAPARA="" SANITIZER="" -GEOIP="none" +GEOIP="classic" if [ "`eval echo -n 'a'`" = "-n a" ] ; then c="\c" else @@ -364,7 +364,7 @@ fi clear if [ -f "doc/Config.header" -a -z "$NOINTRO" ] ; then - more doc/Config.header + cat doc/Config.header echo "" echo $n "[Press Enter to continue]" read cc @@ -375,7 +375,7 @@ echo "We will now ask you a number of questions. You can just press ENTER to acc echo "" # This needs to be updated each release so auto-upgrading works for settings, modules, etc!!: -UNREALRELEASES="unrealircd-6.0.4.1 unrealircd-6.0.4 unrealircd-6.0.4-rc2 unrealircd-6.0.4-rc1 unrealircd-6.0.3 unrealircd-6.0.2 unrealircd-6.0.1.1 unrealircd-6.0.1 unrealircd-6.0.0 unrealircd-6.0.0-rc2 unrealircd-6.0.0-rc1 unrealircd-6.0.0-beta4 unrealircd-6.0.0-beta3 unrealircd-6.0.0-beta2 unrealircd-6.0.0-beta1 unrealircd-5.2.3 unrealircd-5.2.2 unrealircd-5.2.1.1 unrealircd-5.2.1 unrealircd-5.2.1-rc1 unrealircd-5.2.0.2 unrealircd-5.2.0.1 unrealircd-5.2.0 unrealircd-5.2.0-rc1 unrealircd-5.0.9.1 unrealircd-5.0.9 unrealircd-5.0.9-rc1 unrealircd-5.0.8 unrealircd-5.0.8-rc1 unrealircd-5.0.7 unrealircd-5.0.7-rc1 unrealircd-5.0.6" +UNREALRELEASES="unrealircd-6.1.0-rc2 unrealircd-6.1.0-rc1 unrealircd-6.0.7 unrealircd-6.0.6 unrealircd-6.0.5 unrealircd-6.0.5-rc2 unrealircd-6.0.5-rc1 unrealircd-6.0.4.2 unrealircd-6.0.4.1 unrealircd-6.0.4 unrealircd-6.0.4-rc2 unrealircd-6.0.4-rc1 unrealircd-6.0.3 unrealircd-6.0.2 unrealircd-6.0.1.1 unrealircd-6.0.1 unrealircd-6.0.0 unrealircd-6.0.0-rc2 unrealircd-6.0.0-rc1 unrealircd-6.0.0-beta4 unrealircd-6.0.0-beta3 unrealircd-6.0.0-beta2 unrealircd-6.0.0-beta1 unrealircd-5.2.3 unrealircd-5.2.2 unrealircd-5.2.1.1 unrealircd-5.2.1 unrealircd-5.2.1-rc1 unrealircd-5.2.0.2 unrealircd-5.2.0.1 unrealircd-5.2.0 unrealircd-5.2.0-rc1 unrealircd-5.0.9.1 unrealircd-5.0.9 unrealircd-5.0.9-rc1 unrealircd-5.0.8 unrealircd-5.0.8-rc1 unrealircd-5.0.7 unrealircd-5.0.7-rc1 unrealircd-5.0.6" if [ -f "config.settings" ]; then . ./config.settings else @@ -527,6 +527,29 @@ else SSLDIR=`eval echo $cc` # modified fi +if [ "$SSLDIR" != "" -a "$SSLDIR" != "/usr" ]; then + echo "" + echo "You answered previous question manually. Just note that if the library is not" + echo "in your default library path then UnrealIRCd may fail to start with an error" + echo "that it cannot find certain .so files (libraries). In that case you would have" + echo "to either set the LD_LIBARY_PATH environment variable, or you could update the" + echo "Makefile to link with -Wl,-rpath,$SSLDIR or similar." + echo "" + if [ "$SSLDIR" = "/usr/local" ]; then + echo "**** CAUTION ****" + echo "You have chosen to use OpenSSL from /usr/local. Just be aware that if you" + echo "use the LD_LIBRARY_PATH or -Wl,-rpath,$SSLDIR from above," + echo "that you are diverting OTHER libraries to that path as well." + echo "It's not only loading OpenSSL from /usr/local but also potentially other" + echo "libraries like PCRE2, Jansson, or any of the other libraries that" + echo "UnrealIRCd uses (including dependencies about 40 libs in total!)" + echo "All that can result in weird issues and crashes!" + echo "" + fi + echo "Press enter to continue with the rest of the questions, or CTRL+C to abort." + read cc +fi + TEST="" while [ -z "$TEST" ] ; do if [ "$REMOTEINC" = "1" ] ; then diff --git a/Makefile.in b/Makefile.in index ad594f1..6b11b4b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -199,6 +199,9 @@ install: all $(INSTALL) -m 0700 -d $(DESTDIR)@MODULESDIR@/extbans @rm -f $(DESTDIR)@MODULESDIR@/extbans/*.so 1>/dev/null 2>&1 $(INSTALL) -m 0700 src/modules/extbans/*.so $(DESTDIR)@MODULESDIR@/extbans + $(INSTALL) -m 0700 -d $(DESTDIR)@MODULESDIR@/rpc + @rm -f $(DESTDIR)@MODULESDIR@/rpc/*.so 1>/dev/null 2>&1 + $(INSTALL) -m 0700 src/modules/rpc/*.so $(DESTDIR)@MODULESDIR@/rpc @#If the conf/ssl directory exists then rename it here to conf/tls @#and add a symlink for backwards compatibility (so that f.e. certbot @#doesn't randomly fail after an upgrade to U5). diff --git a/Makefile.windows b/Makefile.windows index f0f8898..5cc8be3 100644 --- a/Makefile.windows +++ b/Makefile.windows @@ -184,13 +184,13 @@ EXP_OBJ_FILES=src/ircd_vars.obj src/channel.obj src/send.obj src/socket.obj \ src/version.obj src/ircsprintf.obj \ src/scache.obj src/dns.obj src/modules.obj \ src/aliases.obj src/api-event.obj src/api-usermode.obj src/auth.obj src/tls.obj \ - src/random.obj src/api-channelmode.obj src/api-moddata.obj src/mempool.obj \ + src/random.obj src/api-channelmode.obj src/api-moddata.obj src/api-rpc.obj src/mempool.obj \ src/dispatch.obj src/api-isupport.obj src/api-command.obj \ src/api-clicap.obj src/api-messagetag.obj src/api-history-backend.obj \ src/api-extban.obj src/api-efunctions.obj src/crypt_blowfish.obj \ src/operclass.obj src/crashreport.obj src/unrealdb.obj \ src/openssl_hostname_validation.obj \ - src/utf8.obj src/log.obj $(CURLOBJ) + src/utf8.obj src/json.obj src/log.obj $(CURLOBJ) OBJ_FILES=$(EXP_OBJ_FILES) src/gui.obj src/service.obj src/windebug.obj src/rtf.obj \ src/editor.obj src/win.obj src/ircd.obj src/proc_io_client.obj @@ -253,6 +253,7 @@ DLL_FILES=\ src/modules/clienttagdeny.dll \ src/modules/close.dll \ src/modules/connect.dll \ + src/modules/connect-flood.dll \ src/modules/connthrottle.dll \ src/modules/creationtime.dll \ src/modules/cycle.dll \ @@ -265,6 +266,7 @@ DLL_FILES=\ src/modules/extbans/country.dll \ src/modules/extbans/inchannel.dll \ src/modules/extbans/join.dll \ + src/modules/extbans/flood.dll \ src/modules/extbans/msgbypass.dll \ src/modules/extbans/nickchange.dll \ src/modules/extbans/operclass.dll \ @@ -305,6 +307,7 @@ DLL_FILES=\ src/modules/locops.dll \ src/modules/lusers.dll \ src/modules/map.dll \ + src/modules/max-unknown-connections-per-ip.dll \ src/modules/md.dll \ src/modules/message.dll \ src/modules/message-ids.dll \ @@ -329,11 +332,23 @@ DLL_FILES=\ src/modules/plaintext-policy.dll \ src/modules/protoctl.dll \ src/modules/quit.dll \ + src/modules/real-quit-reason.dll \ src/modules/reply-tag.dll \ src/modules/reputation.dll \ src/modules/require-module.dll \ src/modules/restrict-commands.dll \ src/modules/rmtkl.dll \ + src/modules/rpc/channel.dll \ + src/modules/rpc/log.dll \ + src/modules/rpc/name_ban.dll \ + src/modules/rpc/rpc.dll \ + src/modules/rpc/stats.dll \ + src/modules/rpc/server.dll \ + src/modules/rpc/server_ban.dll \ + src/modules/rpc/server_ban_exception.dll \ + src/modules/rpc/spamfilter.dll \ + src/modules/rpc/whowas.dll \ + src/modules/rpc/user.dll \ src/modules/rules.dll \ src/modules/sajoin.dll \ src/modules/samode.dll \ @@ -353,12 +368,15 @@ DLL_FILES=\ src/modules/slog.dll \ src/modules/sqline.dll \ src/modules/squit.dll \ + src/modules/sreply.dll \ src/modules/staff.dll \ + src/modules/standard-replies.dll \ src/modules/starttls.dll \ src/modules/stats.dll \ src/modules/sts.dll \ src/modules/svsjoin.dll \ src/modules/svskill.dll \ + src/modules/svslogin.dll \ src/modules/svslusers.dll \ src/modules/svsmode.dll \ src/modules/svsmotd.dll \ @@ -376,6 +394,7 @@ DLL_FILES=\ src/modules/time.dll \ src/modules/tkl.dll \ src/modules/tkldb.dll \ + src/modules/tline.dll \ src/modules/tls_antidos.dll \ src/modules/tls_cipher.dll \ src/modules/topic.dll \ @@ -407,10 +426,13 @@ DLL_FILES=\ src/modules/watch.dll \ src/modules/webirc.dll \ src/modules/webredir.dll \ + src/modules/webserver.dll \ src/modules/websocket.dll \ + src/modules/websocket_common.dll \ src/modules/whois.dll \ src/modules/who_old.dll \ src/modules/whowas.dll \ + src/modules/whowasdb.dll \ src/modules/whox.dll @@ -582,6 +604,9 @@ src/api-channelmode.obj: src/api-channelmode.c $(INCLUDES) src/api-moddata.obj: src/api-moddata.c $(INCLUDES) $(CC) $(CFLAGS) src/api-moddata.c +src/api-rpc.obj: src/api-rpc.c $(INCLUDES) + $(CC) $(CFLAGS) src/api-rpc.c + src/mempool.obj: src/mempool.c $(INCLUDES) $(CC) $(CFLAGS) src/mempool.c @@ -633,6 +658,9 @@ src/utf8.obj: src/utf8.c $(INCLUDES) ./include/dbuf.h src/openssl_hostname_validation.obj: src/openssl_hostname_validation.c $(INCLUDES) ./include/dbuf.h $(CC) $(CFLAGS) src/openssl_hostname_validation.c +src/json.obj: src/json.c $(INCLUDES) ./include/dbuf.h + $(CC) $(CFLAGS) src/json.c + src/log.obj: src/log.c $(INCLUDES) ./include/dbuf.h $(CC) $(CFLAGS) src/log.c @@ -832,6 +860,9 @@ src/modules/close.dll: src/modules/close.c $(INCLUDES) src/modules/connect.dll: src/modules/connect.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/connect.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/connect.pdb $(MODLFLAGS) +src/modules/connect-flood.dll: src/modules/connect-flood.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/connect-flood.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/connect-flood.pdb $(MODLFLAGS) + src/modules/connthrottle.dll: src/modules/connthrottle.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/connthrottle.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/connthrottle.pdb $(MODLFLAGS) @@ -868,6 +899,9 @@ src/modules/extbans/inchannel.dll: src/modules/extbans/inchannel.c $(INCLUDES) src/modules/extbans/join.dll: src/modules/extbans/join.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/extbans/join.c /Fesrc/modules/extbans/ /Fosrc/modules/extbans/ /Fdsrc/modules/extbans/join.pdb $(MODLFLAGS) +src/modules/extbans/flood.dll: src/modules/extbans/flood.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/extbans/flood.c /Fesrc/modules/extbans/ /Fosrc/modules/extbans/ /Fdsrc/modules/extbans/flood.pdb $(MODLFLAGS) + src/modules/extbans/msgbypass.dll: src/modules/extbans/msgbypass.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/extbans/msgbypass.c /Fesrc/modules/extbans/ /Fosrc/modules/extbans/ /Fdsrc/modules/extbans/msgbypass.pdb $(MODLFLAGS) @@ -991,6 +1025,9 @@ src/modules/lusers.dll: src/modules/lusers.c $(INCLUDES) src/modules/map.dll: src/modules/map.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/map.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/map.pdb $(MODLFLAGS) +src/modules/max-unknown-connections-per-ip.dll: src/modules/max-unknown-connections-per-ip.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/max-unknown-connections-per-ip.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/max-unknown-connections-per-ip.pdb $(MODLFLAGS) + src/modules/md.dll: src/modules/md.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/md.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/md.pdb $(MODLFLAGS) @@ -1063,6 +1100,9 @@ src/modules/protoctl.dll: src/modules/protoctl.c $(INCLUDES) src/modules/quit.dll: src/modules/quit.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/quit.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/quit.pdb $(MODLFLAGS) +src/modules/real-quit-reason.dll: src/modules/real-quit-reason.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/real-quit-reason.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/real-quit-reason.pdb $(MODLFLAGS) + src/modules/reply-tag.dll: src/modules/reply-tag.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/reply-tag.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/reply-tag.pdb $(MODLFLAGS) @@ -1078,6 +1118,39 @@ src/modules/restrict-commands.dll: src/modules/restrict-commands.c $(INCLUDES) src/modules/rmtkl.dll: src/modules/rmtkl.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/rmtkl.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/rmtkl.pdb $(MODLFLAGS) +src/modules/rpc/channel.dll: src/modules/rpc/channel.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/channel.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/channel.pdb $(MODLFLAGS) + +src/modules/rpc/log.dll: src/modules/rpc/log.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/log.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/log.pdb $(MODLFLAGS) + +src/modules/rpc/name_ban.dll: src/modules/rpc/name_ban.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/name_ban.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/name_ban.pdb $(MODLFLAGS) + +src/modules/rpc/rpc.dll: src/modules/rpc/rpc.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/rpc.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/rpc.pdb $(MODLFLAGS) + +src/modules/rpc/stats.dll: src/modules/rpc/stats.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/stats.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/stats.pdb $(MODLFLAGS) + +src/modules/rpc/server.dll: src/modules/rpc/server.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/server.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/server.pdb $(MODLFLAGS) + +src/modules/rpc/server_ban.dll: src/modules/rpc/server_ban.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/server_ban.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/server_ban.pdb $(MODLFLAGS) + +src/modules/rpc/server_ban_exception.dll: src/modules/rpc/server_ban_exception.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/server_ban_exception.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/server_ban_exception.pdb $(MODLFLAGS) + +src/modules/rpc/spamfilter.dll: src/modules/rpc/spamfilter.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/spamfilter.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/spamfilter.pdb $(MODLFLAGS) + +src/modules/rpc/user.dll: src/modules/rpc/user.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/user.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/user.pdb $(MODLFLAGS) + +src/modules/rpc/whowas.dll: src/modules/rpc/whowas.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/rpc/whowas.c /Fesrc/modules/rpc/ /Fosrc/modules/rpc/ /Fdsrc/modules/rpc/whowas.pdb $(MODLFLAGS) + src/modules/rules.dll: src/modules/rules.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/rules.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/rules.pdb $(MODLFLAGS) @@ -1135,9 +1208,15 @@ src/modules/sqline.dll: src/modules/sqline.c $(INCLUDES) src/modules/squit.dll: src/modules/squit.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/squit.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/squit.pdb $(MODLFLAGS) +src/modules/sreply.dll: src/modules/sreply.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/sreply.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/sreply.pdb $(MODLFLAGS) + src/modules/staff.dll: src/modules/staff.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/staff.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/staff.pdb $(MODLFLAGS) +src/modules/standard-replies.dll: src/modules/standard-replies.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/standard-replies.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/standard-replies.pdb $(MODLFLAGS) + src/modules/starttls.dll: src/modules/starttls.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/starttls.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/starttls.pdb $(MODLFLAGS) @@ -1153,6 +1232,9 @@ src/modules/svsjoin.dll: src/modules/svsjoin.c $(INCLUDES) src/modules/svskill.dll: src/modules/svskill.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/svskill.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/svskill.pdb $(MODLFLAGS) +src/modules/svslogin.dll: src/modules/svslogin.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/svslogin.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/svslogin.pdb $(MODLFLAGS) + src/modules/svslusers.dll: src/modules/svslusers.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/svslusers.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/svslusers.pdb $(MODLFLAGS) @@ -1204,6 +1286,9 @@ src/modules/tkl.dll: src/modules/tkl.c $(INCLUDES) src/modules/tkldb.dll: src/modules/tkldb.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/tkldb.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/tkldb.pdb $(MODLFLAGS) +src/modules/tline.dll: src/modules/tline.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/tline.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/tline.pdb $(MODLFLAGS) + src/modules/tls_antidos.dll: src/modules/tls_antidos.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/tls_antidos.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/tls_antidos.pdb $(MODLFLAGS) @@ -1297,9 +1382,15 @@ src/modules/webirc.dll: src/modules/webirc.c $(INCLUDES) src/modules/webredir.dll: src/modules/webredir.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/webredir.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/webredir.pdb $(MODLFLAGS) +src/modules/webserver.dll: src/modules/webserver.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/webserver.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/webserver.pdb $(MODLFLAGS) + src/modules/websocket.dll: src/modules/websocket.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/websocket.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/websocket.pdb $(MODLFLAGS) +src/modules/websocket_common.dll: src/modules/websocket_common.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/websocket_common.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/websocket_common.pdb $(MODLFLAGS) + src/modules/whois.dll: src/modules/whois.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/whois.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/whois.pdb $(MODLFLAGS) @@ -1309,6 +1400,9 @@ src/modules/who_old.dll: src/modules/who_old.c $(INCLUDES) src/modules/whowas.dll: src/modules/whowas.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/whowas.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/whowas.pdb $(MODLFLAGS) +src/modules/whowasdb.dll: src/modules/whowasdb.c $(INCLUDES) + $(CC) $(MODCFLAGS) src/modules/whowasdb.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/whowasdb.pdb $(MODLFLAGS) + src/modules/whox.dll: src/modules/whox.c $(INCLUDES) $(CC) $(MODCFLAGS) src/modules/whox.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/whox.pdb $(MODLFLAGS) diff --git a/README.md b/README.md index 8e505c9..1cf2171 100644 --- a/README.md +++ b/README.md @@ -11,55 +11,18 @@ online documentation. ## Versions * UnrealIRCd 6 is the *stable* series since December 2021. All new features go in there. -* UnrealIRCd 5 is the *oldstable* series. It will receive bug fixes until - July 1, 2022 plus another 12 months of security fixes. +* UnrealIRCd 5 is the *oldstable* series. It is End Of Life. Only security bugs will + be fixed until June 30, 2023, after which all support will stop. * For full details of release scheduling and EOL dates, see [UnrealIRCd releases](https://www.unrealircd.org/docs/UnrealIRCd_releases) on the wiki ## How to get started -### Use the wiki! -**IMPORTANT:** We recommend you follow our installation guide on the wiki instead of the -steps in this README. The wiki has more detailed information and is more easy to navigate. +Follow the installation guide on the wiki. See: * [Installing from source for *NIX](https://www.unrealircd.org/docs/Installing_from_source) * [Installating instructions for Windows](https://www.unrealircd.org/docs/Installing_(Windows)) -Please consult the online documentation at https://www.unrealircd.org/docs/ when setting up the IRCd! - -### Step 1: Installation -#### Windows -Simply download the UnrealIRCd Windows version from www.unrealircd.org - -Alternatively you can compile UnrealIRCd for Windows yourself. However this is not straightforward and thus not recommended. - -#### *BSD/Linux/macOS -Do the following steps under a separate account for running UnrealIRCd, -[do NOT compile or run as root](https://www.unrealircd.org/docs/Do_not_run_as_root). - -### Step 1: Compile the IRCd - -* Run `./Config` -* Run `make` -* Run `make install` -* Now change to the directory where you installed UnrealIRCd, e.g. `cd /home/xxxx/unrealircd` - -### Step 2: Configuration -Configuration files are stored in the `conf/` folder by default (eg: `/home/xxxx/unrealircd/conf`) - -#### Create a configuration file -If you are new, then you need to create your own configuration file: -Copy `conf/examples/example.conf` to `conf/` and call it `unrealircd.conf`. -Then open it in an editor and carefully modify it using the documentation and FAQ as a guide (see below). - -### Step 3: Booting - -#### Linux/*BSD/macOS -Run `./unrealircd start` in the directory where you installed UnrealIRCd. - -#### Windows -Start -> All Programs -> UnrealIRCd -> UnrealIRCd - ## Documentation & FAQ -You can find the **documentation** online at: https://www.unrealircd.org/docs/ +You can find all **documentation** online at: https://www.unrealircd.org/docs/ We also have a good **FAQ**: https://www.unrealircd.org/docs/FAQ diff --git a/autoconf/m4/unreal.m4 b/autoconf/m4/unreal.m4 index 73d37a9..283ac23 100644 --- a/autoconf/m4/unreal.m4 +++ b/autoconf/m4/unreal.m4 @@ -97,7 +97,7 @@ AC_DEFUN([CHECK_LIBCURL], with the system-installed libcURL, this is a bad idea which may result in error messages looking like: - \`\`[error] unrealircd.conf:9: include: error downloading '(http://example.net/ex.conf)': Could not resolve host: example.net (Successful completion)'' + error downloading ... Could not resolve host: example.net (Successful completion) Or UnrealIRCd might even crash. @@ -321,6 +321,26 @@ else fi ]) +AC_DEFUN([CHECK_X509_check_host], +[ +AC_MSG_CHECKING([for X509_check_host in SSL library]) +AC_LANG_PUSH(C) +SAVE_LIBS="$LIBS" +LIBS="$LIBS $CRYPTOLIB" +AC_TRY_LINK([#include ], + [X509_check_host(NULL, NULL, 0, 0, NULL);], + has_function=1, + has_function=0) +LIBS="$SAVE_LIBS" +AC_LANG_POP(C) +if test $has_function = 1; then + AC_MSG_RESULT([yes]) + AC_DEFINE([HAS_X509_check_host], [], [Define if ssl library has X509_check_host]) +else + AC_MSG_RESULT([no]) +fi +]) + dnl For geoip-api-c AC_DEFUN([CHECK_GEOIP_CLASSIC], [ @@ -366,6 +386,7 @@ AC_DEFUN([CHECK_GEOIP_CLASSIC], AC_MSG_RESULT(compiling GeoIP Classic library) $ac_cv_prog_MAKER || exit 1 AC_MSG_RESULT(installing GeoIP Classic library) + rm -f "$PRIVATELIBDIR/"libGeoIP.so* $ac_cv_prog_MAKER install || exit 1 dnl Try pkg-config first... AS_IF([test -n "$ac_cv_path_PKGCONFIG"], diff --git a/configure b/configure index 28dbafc..56e1a03 100755 --- a/configure +++ b/configure @@ -1,11 +1,12 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for unrealircd 6.0.4.2. +# Generated by GNU Autoconf 2.71 for unrealircd 6.1.0. # # Report bugs to . # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, +# Inc. # # # This configure script is free software; the Free Software Foundation @@ -16,14 +17,16 @@ # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -33,46 +36,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -81,13 +84,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -96,8 +92,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -109,30 +109,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. @@ -154,20 +134,22 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST -else +else \$as_nop case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( @@ -187,42 +169,53 @@ as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : -else +else \$as_nop exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : + if (eval "$as_required") 2>/dev/null +then : as_have_required=yes -else +else $as_nop as_have_required=no fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : -else +else $as_nop as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base + as_shell=$as_dir$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : break 2 fi fi @@ -230,14 +223,21 @@ fi esac as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi - if test "x$CONFIG_SHELL" != x; then : + if test "x$CONFIG_SHELL" != x +then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also @@ -255,18 +255,19 @@ esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and $0: https://bugs.unrealircd.org/ about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run @@ -294,6 +295,7 @@ as_fn_unset () } as_unset=as_fn_unset + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -311,6 +313,14 @@ as_fn_exit () as_fn_set_status $1 exit $1 } # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_mkdir_p # ------------- @@ -325,7 +335,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -334,7 +344,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -373,12 +383,13 @@ as_fn_executable_p () # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -390,18 +401,27 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- @@ -413,9 +433,9 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error @@ -442,7 +462,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -486,7 +506,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall @@ -500,6 +520,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -513,6 +537,13 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -580,48 +611,44 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unrealircd' PACKAGE_TARNAME='unrealircd' -PACKAGE_VERSION='6.0.4.2' -PACKAGE_STRING='unrealircd 6.0.4.2' +PACKAGE_VERSION='6.1.0' +PACKAGE_STRING='unrealircd 6.1.0' PACKAGE_BUGREPORT='https://bugs.unrealircd.org/' PACKAGE_URL='https://unrealircd.org/' ac_unique_file="src/ircd.c" # Factoring default headers for most tests. ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include +#include +#ifdef HAVE_STDIO_H +# include #endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS +#ifdef HAVE_STDLIB_H # include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif #endif #ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif # include #endif -#ifdef HAVE_STRINGS_H -# include -#endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_UNISTD_H # include #endif" +ac_header_c_list= ac_subst_vars='LTLIBOBJS LIBOBJS UNRLINCDIR @@ -674,13 +701,13 @@ BUILDDIR DYNAMIC_LDFLAGS MODULEFLAGS CRYPTOLIB +EGREP +GREP +CPP HARDEN_BINLDFLAGS HARDEN_BINCFLAGS HARDEN_LDFLAGS HARDEN_CFLAGS -EGREP -GREP -CPP GMAKE MAKER OBJEXT @@ -865,8 +892,6 @@ do *) ac_optarg=yes ;; esac - # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; @@ -907,9 +932,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -933,9 +958,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + as_fn_error $? "invalid feature name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" @@ -1146,9 +1171,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1162,9 +1187,9 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + as_fn_error $? "invalid package name: \`$ac_useropt'" ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" @@ -1208,9 +1233,9 @@ Try \`$0 --help' for more information" *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + printf "%s\n" "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; @@ -1226,7 +1251,7 @@ if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1290,7 +1315,7 @@ $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | +printf "%s\n" X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1347,7 +1372,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures unrealircd 6.0.4.2 to adapt to many kinds of systems. +\`configure' configures unrealircd 6.1.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1413,7 +1438,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unrealircd 6.0.4.2:";; + short | recursive ) echo "Configuration of unrealircd 6.1.0:";; esac cat <<\_ACEOF @@ -1542,9 +1567,9 @@ if test "$ac_init_help" = "recursive"; then case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1572,7 +1597,8 @@ esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive @@ -1580,7 +1606,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1589,10 +1615,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unrealircd configure 6.0.4.2 -generated by GNU Autoconf 2.69 +unrealircd configure 6.1.0 +generated by GNU Autoconf 2.71 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1609,14 +1635,14 @@ fi ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext + rm -f conftest.$ac_objext conftest.beam if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1624,14 +1650,15 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest.$ac_objext; then : + } && test -s conftest.$ac_objext +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1647,14 +1674,14 @@ fi ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then @@ -1662,17 +1689,18 @@ $as_echo "$ac_try_echo"; } >&5 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext - }; then : + } +then : ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 @@ -1689,8 +1717,8 @@ fi # ac_fn_c_try_run LINENO # ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack @@ -1700,25 +1728,26 @@ case "(($ac_try" in *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +printf "%s\n" "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status @@ -1729,43 +1758,6 @@ fi } # ac_fn_c_try_run -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in @@ -1773,132 +1765,44 @@ fi ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ------------------------------------------- ## -## Report this to https://bugs.unrealircd.org/ ## -## ------------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. @@ -1906,16 +1810,9 @@ else #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif + which can conflict with char $2 (); below. */ +#include #undef $2 /* Override any GCC internal prototype to avoid an error. @@ -1933,35 +1830,94 @@ choke me #endif int -main () +main (void) { return $2 (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : eval "$3=yes" -else +else $as_nop eval "$3=no" fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by unrealircd $as_me 6.0.4.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by unrealircd $as_me 6.1.0, which was +generated by GNU Autoconf 2.71. Invocation command line was - $ $0 $@ + $ $0$ac_configure_args_raw _ACEOF exec 5>>config.log @@ -1994,8 +1950,12 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" done IFS=$as_save_IFS @@ -2030,7 +1990,7 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; @@ -2065,11 +2025,13 @@ done # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" # Save into config.log some information that might help in debugging. { echo - $as_echo "## ---------------- ## + printf "%s\n" "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo @@ -2080,8 +2042,8 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -2105,7 +2067,7 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + printf "%s\n" "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo @@ -2113,14 +2075,14 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + printf "%s\n" "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo @@ -2128,15 +2090,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + printf "%s\n" "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - $as_echo "## ----------- ## + printf "%s\n" "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo @@ -2144,8 +2106,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -2159,63 +2121,48 @@ ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h +printf "%s\n" "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_files="$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" + +for ac_site_file in $ac_site_files do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi @@ -2225,1166 +2172,34 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -ac_config_headers="$ac_config_headers include/setup.h" - -ac_aux_dir= -for ac_dir in autoconf "$srcdir"/autoconf; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in autoconf \"$srcdir\"/autoconf" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - - - -if test "x$enable_dynamic_linking" = "x"; then - echo "Please use ./Config instead of ./configure" - exit 1 -fi - -orig_cflags="$CFLAGS" - -BUILDDIR_NOW="`pwd`" - -# Generation version number (e.g.: X in X.Y.Z) -UNREAL_VERSION_GENERATION="6" - -cat >>confdefs.h <<_ACEOF -#define UNREAL_VERSION_GENERATION $UNREAL_VERSION_GENERATION -_ACEOF - - -# Major version number (e.g.: Y in X.Y.Z) -UNREAL_VERSION_MAJOR="0" - -cat >>confdefs.h <<_ACEOF -#define UNREAL_VERSION_MAJOR $UNREAL_VERSION_MAJOR -_ACEOF - - -# Minor version number (e.g.: Z in X.Y.Z) -UNREAL_VERSION_MINOR="4" - -cat >>confdefs.h <<_ACEOF -#define UNREAL_VERSION_MINOR $UNREAL_VERSION_MINOR -_ACEOF - - -# The version suffix such as a beta marker or release candidate -# marker. (e.g.: -rcX for unrealircd-3.2.9-rcX). This macro is a -# string instead of an integer because it contains arbitrary data. -UNREAL_VERSION_SUFFIX=".2" - -cat >>confdefs.h <<_ACEOF -#define UNREAL_VERSION_SUFFIX "$UNREAL_VERSION_SUFFIX" -_ACEOF - - -# Extract the first word of "rm", so it can be a program name with args. -set dummy rm; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_RM+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $RM in - [\\/]* | ?:[\\/]*) - ac_cv_path_RM="$RM" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -RM=$ac_cv_path_RM -if test -n "$RM"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 -$as_echo "$RM" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "cp", so it can be a program name with args. -set dummy cp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CP+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $CP in - [\\/]* | ?:[\\/]*) - ac_cv_path_CP="$CP" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -CP=$ac_cv_path_CP -if test -n "$CP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CP" >&5 -$as_echo "$CP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "touch", so it can be a program name with args. -set dummy touch; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_TOUCH+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $TOUCH in - [\\/]* | ?:[\\/]*) - ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_TOUCH="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -TOUCH=$ac_cv_path_TOUCH -if test -n "$TOUCH"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TOUCH" >&5 -$as_echo "$TOUCH" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "openssl", so it can be a program name with args. -set dummy openssl; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_OPENSSLPATH+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $OPENSSLPATH in - [\\/]* | ?:[\\/]*) - ac_cv_path_OPENSSLPATH="$OPENSSLPATH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_OPENSSLPATH="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -OPENSSLPATH=$ac_cv_path_OPENSSLPATH -if test -n "$OPENSSLPATH"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSLPATH" >&5 -$as_echo "$OPENSSLPATH" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -if test x"$OPENSSLPATH" = "x"; then : - -echo "" -echo "Apparently you do not have both the openssl binary and openssl development libraries installed." -echo "The following packages are required:" -echo "1) The library package is often called 'openssl-dev', 'openssl-devel' or 'libssl-dev'" -echo "2) The binary package is usually called 'openssl'." -echo "NOTE: you or your system administrator needs to install the library AND the binary package." -echo "After doing so, simply re-run ./Config" -exit 1 - -fi - -# Extract the first word of "install", so it can be a program name with args. -set dummy install; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_INSTALL+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $INSTALL in - [\\/]* | ?:[\\/]*) - ac_cv_path_INSTALL="$INSTALL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_INSTALL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -INSTALL=$ac_cv_path_INSTALL -if test -n "$INSTALL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "gunzip", so it can be a program name with args. -set dummy gunzip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GUNZIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $GUNZIP in - [\\/]* | ?:[\\/]*) - ac_cv_path_GUNZIP="$GUNZIP" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GUNZIP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -GUNZIP=$ac_cv_path_GUNZIP -if test -n "$GUNZIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GUNZIP" >&5 -$as_echo "$GUNZIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -# Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKGCONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKGCONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKGCONFIG=$ac_cv_path_PKGCONFIG -if test -n "$PKGCONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 -$as_echo "$PKGCONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +#include #include -#include struct stat; -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); +struct buf * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; @@ -3402,87 +2217,47 @@ static char *f (char * (*g) (char **, int), char **p, ...) } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' -fi +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include #include -#include -#include -#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); // Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) #define showlist(...) puts (#__VA_ARGS__) #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) static void @@ -3501,11 +2276,11 @@ test_varargs_macros (void) #define BIG32 4294967295ul #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) #if !BIG_OK - your preprocessor is broken; + #error "your preprocessor is broken" #endif #if BIG_OK #else - your preprocessor is broken; + #error "your preprocessor is broken" #endif static long long int bignum = -9223372036854775807LL; static unsigned long long int ubignum = BIG64; @@ -3530,13 +2305,13 @@ test_restrict (ccp restrict text) // See if C++-style comments work. // Iterate through items via the restricted pointer. // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) continue; return 0; } // Check varargs and va_copy. -static void +static bool test_varargs (const char *format, ...) { va_list args; @@ -3544,21 +2319,21 @@ test_varargs (const char *format, ...) va_list args_copy; va_copy (args_copy, args); - const char *str; - int number; - float fnumber; + const char *str = ""; + int number = 0; + float fnumber = 0; while (*format) { switch (*format++) { - case 's': // string + case '\''s'\'': // string str = va_arg (args_copy, const char *); break; - case 'd': // int + case '\''d'\'': // int number = va_arg (args_copy, int); break; - case 'f': // float + case '\''f'\'': // float fnumber = va_arg (args_copy, double); break; default: @@ -3567,14 +2342,16 @@ test_varargs (const char *format, ...) } va_end (args_copy); va_end (args); + + return *str && number && fnumber; } +' -int -main () -{ - +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' // Check bool. _Bool success = false; + success |= (argc != 0); // Check restrict. if (test_restrict ("String literal") == 0) @@ -3582,7 +2359,7 @@ main () char *restrict newvar = "Another string"; // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); test_varargs_macros (); // Check flexible array members. @@ -3602,58 +2379,1676 @@ main () ni.number = 58; int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; dynamic_array[ni.number - 1] = 543; // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" + +# Auxiliary files required by this configure script. +ac_aux_files="config.guess config.sub" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/autoconf" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_config_headers="$ac_config_headers include/setup.h" + + + + +if test "x$enable_dynamic_linking" = "x"; then + echo "Please use ./Config instead of ./configure" + exit 1 +fi + +orig_cflags="$CFLAGS" + +BUILDDIR_NOW="`pwd`" + +# Generation version number (e.g.: X in X.Y.Z) +UNREAL_VERSION_GENERATION="6" + +printf "%s\n" "#define UNREAL_VERSION_GENERATION $UNREAL_VERSION_GENERATION" >>confdefs.h + + +# Major version number (e.g.: Y in X.Y.Z) +UNREAL_VERSION_MAJOR="1" + +printf "%s\n" "#define UNREAL_VERSION_MAJOR $UNREAL_VERSION_MAJOR" >>confdefs.h + + +# Minor version number (e.g.: Z in X.Y.Z) +UNREAL_VERSION_MINOR="0" + +printf "%s\n" "#define UNREAL_VERSION_MINOR $UNREAL_VERSION_MINOR" >>confdefs.h + + +# The version suffix such as a beta marker or release candidate +# marker. (e.g.: -rcX for unrealircd-3.2.9-rcX). This macro is a +# string instead of an integer because it contains arbitrary data. +UNREAL_VERSION_SUFFIX="" + +printf "%s\n" "#define UNREAL_VERSION_SUFFIX \"$UNREAL_VERSION_SUFFIX\"" >>confdefs.h + + +# Extract the first word of "rm", so it can be a program name with args. +set dummy rm; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_RM+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $RM in + [\\/]* | ?:[\\/]*) + ac_cv_path_RM="$RM" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_RM="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +RM=$ac_cv_path_RM +if test -n "$RM"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RM" >&5 +printf "%s\n" "$RM" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Extract the first word of "cp", so it can be a program name with args. +set dummy cp; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_CP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $CP in + [\\/]* | ?:[\\/]*) + ac_cv_path_CP="$CP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_CP="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +CP=$ac_cv_path_CP +if test -n "$CP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CP" >&5 +printf "%s\n" "$CP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Extract the first word of "touch", so it can be a program name with args. +set dummy touch; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_TOUCH+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $TOUCH in + [\\/]* | ?:[\\/]*) + ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_TOUCH="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +TOUCH=$ac_cv_path_TOUCH +if test -n "$TOUCH"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $TOUCH" >&5 +printf "%s\n" "$TOUCH" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Extract the first word of "openssl", so it can be a program name with args. +set dummy openssl; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_OPENSSLPATH+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $OPENSSLPATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_OPENSSLPATH="$OPENSSLPATH" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_OPENSSLPATH="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +OPENSSLPATH=$ac_cv_path_OPENSSLPATH +if test -n "$OPENSSLPATH"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OPENSSLPATH" >&5 +printf "%s\n" "$OPENSSLPATH" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +if test x"$OPENSSLPATH" = "x" +then : + +echo "" +echo "Apparently you do not have both the openssl binary and openssl development libraries installed." +echo "The following packages are required:" +echo "1) The library package is often called 'openssl-dev', 'openssl-devel' or 'libssl-dev'" +echo "2) The binary package is usually called 'openssl'." +echo "NOTE: you or your system administrator needs to install the library AND the binary package." +echo "After doing so, simply re-run ./Config" +exit 1 + +fi + +# Extract the first word of "install", so it can be a program name with args. +set dummy install; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_INSTALL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $INSTALL in + [\\/]* | ?:[\\/]*) + ac_cv_path_INSTALL="$INSTALL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_INSTALL="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +INSTALL=$ac_cv_path_INSTALL +if test -n "$INSTALL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$INSTALL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Extract the first word of "gunzip", so it can be a program name with args. +set dummy gunzip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_GUNZIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $GUNZIP in + [\\/]* | ?:[\\/]*) + ac_cv_path_GUNZIP="$GUNZIP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_GUNZIP="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +GUNZIP=$ac_cv_path_GUNZIP +if test -n "$GUNZIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GUNZIP" >&5 +printf "%s\n" "$GUNZIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +# Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKGCONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $PKGCONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKGCONFIG="$PKGCONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKGCONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKGCONFIG=$ac_cv_path_PKGCONFIG +if test -n "$PKGCONFIG"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5 +printf "%s\n" "$PKGCONFIG" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + if test "$as_dir$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ ; return 0; } _ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : ac_cv_prog_cc_c99=$ac_arg fi -rm -f core conftest.err conftest.$ac_objext +rm -f core conftest.err conftest.$ac_objext conftest.beam test "x$ac_cv_prog_cc_c99" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - fi +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi -if test "$ac_cv_prog_cc_c99" = "no"; then : +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if test "$ac_cv_prog_cc_c99" = "no" +then : as_fn_error $? "No C99 compiler was found. Please install gcc or clang and other build tools. Eg, on Debian/Ubuntu you probably want to run the following as root: apt-get install build-essential " "$LINENO" 5 fi # Extract the first word of "gmake", so it can be a program name with args. set dummy gmake; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MAKER+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MAKER+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$MAKER"; then ac_cv_prog_MAKER="$MAKER" # Let the user override the test. else @@ -3661,11 +4056,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_MAKER="gmake" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3677,21 +4076,22 @@ fi fi MAKER=$ac_cv_prog_MAKER if test -n "$MAKER"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKER" >&5 -$as_echo "$MAKER" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAKER" >&5 +printf "%s\n" "$MAKER" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi # Extract the first word of "gmake", so it can be a program name with args. set dummy gmake; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GMAKE+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_GMAKE+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $GMAKE in [\\/]* | ?:[\\/]*) ac_cv_path_GMAKE="$GMAKE" # Let the user override the test with a path. @@ -3701,11 +4101,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GMAKE="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_GMAKE="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3717,26 +4121,28 @@ esac fi GMAKE=$ac_cv_path_GMAKE if test -n "$GMAKE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMAKE" >&5 -$as_echo "$GMAKE" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GMAKE" >&5 +printf "%s\n" "$GMAKE" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -if $MAKER --version | grep -q "GNU Make"; then : +if $MAKER --version | grep -q "GNU Make" +then : GNUMAKE="0" -else +else $as_nop as_fn_error $? "It seems your system does not have make/gmake installed. If you are on Linux then install make, otherwise install gmake." "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -ldescrypt" >&5 -$as_echo_n "checking for crypt in -ldescrypt... " >&6; } -if ${ac_cv_lib_descrypt_crypt+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for crypt in -ldescrypt" >&5 +printf %s "checking for crypt in -ldescrypt... " >&6; } +if test ${ac_cv_lib_descrypt_crypt+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldescrypt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3745,40 +4151,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char crypt (); int -main () +main (void) { return crypt (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_descrypt_crypt=yes -else +else $as_nop ac_cv_lib_descrypt_crypt=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_descrypt_crypt" >&5 -$as_echo "$ac_cv_lib_descrypt_crypt" >&6; } -if test "x$ac_cv_lib_descrypt_crypt" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_descrypt_crypt" >&5 +printf "%s\n" "$ac_cv_lib_descrypt_crypt" >&6; } +if test "x$ac_cv_lib_descrypt_crypt" = xyes +then : -$as_echo "#define HAVE_CRYPT /**/" >>confdefs.h +printf "%s\n" "#define HAVE_CRYPT /**/" >>confdefs.h IRCDLIBS="$IRCDLIBS-ldescrypt " -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 -$as_echo_n "checking for crypt in -lcrypt... " >&6; } -if ${ac_cv_lib_crypt_crypt+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5 +printf %s "checking for crypt in -lcrypt... " >&6; } +if test ${ac_cv_lib_crypt_crypt+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lcrypt $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3787,32 +4193,31 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char crypt (); int -main () +main (void) { return crypt (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_crypt_crypt=yes -else +else $as_nop ac_cv_lib_crypt_crypt=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 -$as_echo "$ac_cv_lib_crypt_crypt" >&6; } -if test "x$ac_cv_lib_crypt_crypt" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5 +printf "%s\n" "$ac_cv_lib_crypt_crypt" >&6; } +if test "x$ac_cv_lib_crypt_crypt" = xyes +then : -$as_echo "#define HAVE_CRYPT /**/" >>confdefs.h +printf "%s\n" "#define HAVE_CRYPT /**/" >>confdefs.h IRCDLIBS="$IRCDLIBS-lcrypt " fi @@ -3827,408 +4232,41 @@ case $host_cpu in #( *) : ;; esac -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes +ac_header= ac_cache= +for ac_item in $ac_header_c_list do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +printf %s "checking whether byte ordering is bigendian... " >&6; } +if test ${ac_cv_c_bigendian+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4239,7 +4277,8 @@ else typedef int dummy; _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. @@ -4263,7 +4302,7 @@ if ac_fn_c_try_compile "$LINENO"; then : fi done fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4272,7 +4311,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main () +main (void) { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ @@ -4284,7 +4323,8 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -4292,7 +4332,7 @@ if ac_fn_c_try_compile "$LINENO"; then : #include int -main () +main (void) { #if BYTE_ORDER != BIG_ENDIAN not big endian @@ -4302,14 +4342,15 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_bigendian=yes -else +else $as_nop ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). @@ -4318,7 +4359,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext #include int -main () +main (void) { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros @@ -4328,14 +4369,15 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { #ifndef _BIG_ENDIAN not big endian @@ -4345,31 +4387,33 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ac_cv_c_bigendian=yes -else +else $as_nop ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes +then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -short int ascii_mm[] = +unsigned short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = + unsigned short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } - short int ebcdic_ii[] = + unsigned short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = + unsigned short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; @@ -4377,14 +4421,15 @@ short int ascii_mm[] = extern int foo; int -main () +main (void) { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi @@ -4397,13 +4442,13 @@ if ac_fn_c_try_compile "$LINENO"; then : fi fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int -main () +main (void) { /* Are we little or big endian? From Harbison&Steele. */ @@ -4419,9 +4464,10 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_c_bigendian=no -else +else $as_nop ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -4430,16 +4476,16 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +printf "%s\n" "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) -$as_echo "#define NATIVE_BIG_ENDIAN 1" >>confdefs.h +printf "%s\n" "#define NATIVE_BIG_ENDIAN 1" >>confdefs.h ;; #( no) -$as_echo "#define NATIVE_LITTLE_ENDIAN 1" >>confdefs.h +printf "%s\n" "#define NATIVE_LITTLE_ENDIAN 1" >>confdefs.h ;; #( universal) as_fn_error $? "universal endianness is not supported - compile separately and use lipo(1)" "$LINENO" 5 @@ -4468,16 +4514,18 @@ LD="$flag_wrap $LD" # Check whether --enable-hardening was given. -if test "${enable_hardening+set}" = set; then : +if test ${enable_hardening+y} +then : enableval=$enable_hardening; hardening="$enableval" -else +else $as_nop hardening="yes" fi HARDEN_CFLAGS="" HARDEN_LDFLAGS="" -if test x"$hardening" != x"no"; then : +if test x"$hardening" != x"no" +then : ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4485,11 +4533,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-strict-overflow" >&5 -$as_echo_n "checking whether C compiler accepts -fno-strict-overflow... " >&6; } -if ${ax_cv_check_cflags__Werror___fno_strict_overflow+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-strict-overflow" >&5 +printf %s "checking whether C compiler accepts -fno-strict-overflow... " >&6; } +if test ${ax_cv_check_cflags__Werror___fno_strict_overflow+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fno-strict-overflow" @@ -4497,26 +4546,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___fno_strict_overflow=yes -else +else $as_nop ax_cv_check_cflags__Werror___fno_strict_overflow=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fno_strict_overflow" >&5 -$as_echo "$ax_cv_check_cflags__Werror___fno_strict_overflow" >&6; } -if test x"$ax_cv_check_cflags__Werror___fno_strict_overflow" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fno_strict_overflow" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___fno_strict_overflow" >&6; } +if test x"$ax_cv_check_cflags__Werror___fno_strict_overflow" = xyes +then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fno-strict-overflow" -else +else $as_nop : fi @@ -4534,11 +4585,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -D_FORTIFY_SOURCE=2" >&5 -$as_echo_n "checking whether C compiler accepts -D_FORTIFY_SOURCE=2... " >&6; } -if ${ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -D_FORTIFY_SOURCE=2" >&5 +printf %s "checking whether C compiler accepts -D_FORTIFY_SOURCE=2... " >&6; } +if test ${ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -D_FORTIFY_SOURCE=2" @@ -4546,26 +4598,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2=yes -else +else $as_nop ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2" >&5 -$as_echo "$ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2" >&6; } -if test x"$ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2" >&6; } +if test x"$ax_cv_check_cflags__Werror___D_FORTIFY_SOURCE_2" = xyes +then : HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2" -else +else $as_nop : fi @@ -4582,11 +4636,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-protector-all" >&5 -$as_echo_n "checking whether C compiler accepts -fstack-protector-all... " >&6; } -if ${ax_cv_check_cflags__Werror___fstack_protector_all+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-protector-all" >&5 +printf %s "checking whether C compiler accepts -fstack-protector-all... " >&6; } +if test ${ax_cv_check_cflags__Werror___fstack_protector_all+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fstack-protector-all" @@ -4594,29 +4649,32 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___fstack_protector_all=yes -else +else $as_nop ax_cv_check_cflags__Werror___fstack_protector_all=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fstack_protector_all" >&5 -$as_echo "$ax_cv_check_cflags__Werror___fstack_protector_all" >&6; } -if test x"$ax_cv_check_cflags__Werror___fstack_protector_all" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fstack-protector-all" >&5 -$as_echo_n "checking whether the linker accepts -fstack-protector-all... " >&6; } -if ${ax_cv_check_ldflags__Werror___fstack_protector_all+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fstack_protector_all" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___fstack_protector_all" >&6; } +if test x"$ax_cv_check_cflags__Werror___fstack_protector_all" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fstack-protector-all" >&5 +printf %s "checking whether the linker accepts -fstack-protector-all... " >&6; } +if test ${ax_cv_check_ldflags__Werror___fstack_protector_all+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -fstack-protector-all" @@ -4624,25 +4682,27 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_cv_check_ldflags__Werror___fstack_protector_all=yes -else +else $as_nop ax_cv_check_ldflags__Werror___fstack_protector_all=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fstack_protector_all" >&5 -$as_echo "$ax_cv_check_ldflags__Werror___fstack_protector_all" >&6; } -if test x"$ax_cv_check_ldflags__Werror___fstack_protector_all" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fstack_protector_all" >&5 +printf "%s\n" "$ax_cv_check_ldflags__Werror___fstack_protector_all" >&6; } +if test x"$ax_cv_check_ldflags__Werror___fstack_protector_all" = xyes +then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all" ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4650,11 +4710,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wstack-protector" >&5 -$as_echo_n "checking whether C compiler accepts -Wstack-protector... " >&6; } -if ${ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wstack-protector" >&5 +printf %s "checking whether C compiler accepts -Wstack-protector... " >&6; } +if test ${ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fstack-protector-all -Wstack-protector" @@ -4662,26 +4723,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector=yes -else +else $as_nop ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector" >&5 -$as_echo "$ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector" >&6; } -if test x"$ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector" >&6; } +if test x"$ax_cv_check_cflags__Werror__fstack_protector_all__Wstack_protector" = xyes +then : HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector" -else +else $as_nop : fi @@ -4697,11 +4760,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts --param ssp-buffer-size=1" >&5 -$as_echo_n "checking whether C compiler accepts --param ssp-buffer-size=1... " >&6; } -if ${ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts --param ssp-buffer-size=1" >&5 +printf %s "checking whether C compiler accepts --param ssp-buffer-size=1... " >&6; } +if test ${ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fstack-protector-all --param ssp-buffer-size=1" @@ -4709,26 +4773,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1=yes -else +else $as_nop ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" >&5 -$as_echo "$ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" >&6; } -if test x"$ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" >&6; } +if test x"$ax_cv_check_cflags__Werror__fstack_protector_all___param_ssp_buffer_size_1" = xyes +then : HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1" -else +else $as_nop : fi @@ -4738,11 +4804,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -else +else $as_nop : fi -else +else $as_nop : fi @@ -4760,11 +4826,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-clash-protection" >&5 -$as_echo_n "checking whether C compiler accepts -fstack-clash-protection... " >&6; } -if ${ax_cv_check_cflags__Werror___fstack_clash_protection+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-clash-protection" >&5 +printf %s "checking whether C compiler accepts -fstack-clash-protection... " >&6; } +if test ${ax_cv_check_cflags__Werror___fstack_clash_protection+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fstack-clash-protection" @@ -4772,26 +4839,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___fstack_clash_protection=yes -else +else $as_nop ax_cv_check_cflags__Werror___fstack_clash_protection=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fstack_clash_protection" >&5 -$as_echo "$ax_cv_check_cflags__Werror___fstack_clash_protection" >&6; } -if test x"$ax_cv_check_cflags__Werror___fstack_clash_protection" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fstack_clash_protection" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___fstack_clash_protection" >&6; } +if test x"$ax_cv_check_cflags__Werror___fstack_clash_protection" = xyes +then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-clash-protection" -else +else $as_nop : fi @@ -4809,11 +4878,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fcf-protection" >&5 -$as_echo_n "checking whether C compiler accepts -fcf-protection... " >&6; } -if ${ax_cv_check_cflags__Werror___fcf_protection+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fcf-protection" >&5 +printf %s "checking whether C compiler accepts -fcf-protection... " >&6; } +if test ${ax_cv_check_cflags__Werror___fcf_protection+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fcf-protection" @@ -4821,26 +4891,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___fcf_protection=yes -else +else $as_nop ax_cv_check_cflags__Werror___fcf_protection=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fcf_protection" >&5 -$as_echo "$ax_cv_check_cflags__Werror___fcf_protection" >&6; } -if test x"$ax_cv_check_cflags__Werror___fcf_protection" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fcf_protection" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___fcf_protection" >&6; } +if test x"$ax_cv_check_cflags__Werror___fcf_protection" = xyes +then : HARDEN_CFLAGS="$HARDEN_CFLAGS -fcf-protection" -else +else $as_nop : fi @@ -4860,11 +4932,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fPIE" >&5 -$as_echo_n "checking whether C compiler accepts -fPIE... " >&6; } -if ${ax_cv_check_cflags__Werror___fPIE+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fPIE" >&5 +printf %s "checking whether C compiler accepts -fPIE... " >&6; } +if test ${ax_cv_check_cflags__Werror___fPIE+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fPIE" @@ -4872,29 +4945,32 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___fPIE=yes -else +else $as_nop ax_cv_check_cflags__Werror___fPIE=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fPIE" >&5 -$as_echo "$ax_cv_check_cflags__Werror___fPIE" >&6; } -if test x"$ax_cv_check_cflags__Werror___fPIE" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fPIE -pie" >&5 -$as_echo_n "checking whether the linker accepts -fPIE -pie... " >&6; } -if ${ax_cv_check_ldflags__Werror___fPIE__pie+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fPIE" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___fPIE" >&6; } +if test x"$ax_cv_check_cflags__Werror___fPIE" = xyes +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fPIE -pie" >&5 +printf %s "checking whether the linker accepts -fPIE -pie... " >&6; } +if test ${ax_cv_check_ldflags__Werror___fPIE__pie+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -fPIE -pie" @@ -4902,33 +4978,36 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_cv_check_ldflags__Werror___fPIE__pie=yes -else +else $as_nop ax_cv_check_ldflags__Werror___fPIE__pie=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fPIE__pie" >&5 -$as_echo "$ax_cv_check_ldflags__Werror___fPIE__pie" >&6; } -if test x"$ax_cv_check_ldflags__Werror___fPIE__pie" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fPIE__pie" >&5 +printf "%s\n" "$ax_cv_check_ldflags__Werror___fPIE__pie" >&6; } +if test x"$ax_cv_check_ldflags__Werror___fPIE__pie" = xyes +then : HARDEN_BINCFLAGS="-fPIE" HARDEN_BINLDFLAGS="-pie" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fPIE -Wl,-pie" >&5 -$as_echo_n "checking whether the linker accepts -fPIE -Wl,-pie... " >&6; } -if ${ax_cv_check_ldflags__Werror___fPIE__Wl__pie+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fPIE -Wl,-pie" >&5 +printf %s "checking whether the linker accepts -fPIE -Wl,-pie... " >&6; } +if test ${ax_cv_check_ldflags__Werror___fPIE__Wl__pie+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -fPIE -Wl,-pie" @@ -4936,34 +5015,36 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_cv_check_ldflags__Werror___fPIE__Wl__pie=yes -else +else $as_nop ax_cv_check_ldflags__Werror___fPIE__Wl__pie=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fPIE__Wl__pie" >&5 -$as_echo "$ax_cv_check_ldflags__Werror___fPIE__Wl__pie" >&6; } -if test x"$ax_cv_check_ldflags__Werror___fPIE__Wl__pie" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___fPIE__Wl__pie" >&5 +printf "%s\n" "$ax_cv_check_ldflags__Werror___fPIE__Wl__pie" >&6; } +if test x"$ax_cv_check_ldflags__Werror___fPIE__Wl__pie" = xyes +then : HARDEN_BINCFLAGS="-fPIE" HARDEN_BINLDFLAGS="-Wl,-pie" -else +else $as_nop : fi fi -else +else $as_nop : fi @@ -4974,11 +5055,12 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-z,relro" >&5 -$as_echo_n "checking whether the linker accepts -Wl,-z,relro... " >&6; } -if ${ax_cv_check_ldflags__Werror___Wl__z_relro+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-z,relro" >&5 +printf %s "checking whether the linker accepts -Wl,-z,relro... " >&6; } +if test ${ax_cv_check_ldflags__Werror___Wl__z_relro+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -Wl,-z,relro" @@ -4986,31 +5068,34 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_cv_check_ldflags__Werror___Wl__z_relro=yes -else +else $as_nop ax_cv_check_ldflags__Werror___Wl__z_relro=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___Wl__z_relro" >&5 -$as_echo "$ax_cv_check_ldflags__Werror___Wl__z_relro" >&6; } -if test x"$ax_cv_check_ldflags__Werror___Wl__z_relro" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___Wl__z_relro" >&5 +printf "%s\n" "$ax_cv_check_ldflags__Werror___Wl__z_relro" >&6; } +if test x"$ax_cv_check_ldflags__Werror___Wl__z_relro" = xyes +then : HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,relro" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-z,now" >&5 -$as_echo_n "checking whether the linker accepts -Wl,-z,now... " >&6; } -if ${ax_cv_check_ldflags__Werror___Wl__z_now+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,-z,now" >&5 +printf %s "checking whether the linker accepts -Wl,-z,now... " >&6; } +if test ${ax_cv_check_ldflags__Werror___Wl__z_now+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$LDFLAGS LDFLAGS="$LDFLAGS -Werror -Wl,-z,now" @@ -5018,31 +5103,33 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_cv_check_ldflags__Werror___Wl__z_now=yes -else +else $as_nop ax_cv_check_ldflags__Werror___Wl__z_now=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___Wl__z_now" >&5 -$as_echo "$ax_cv_check_ldflags__Werror___Wl__z_now" >&6; } -if test x"$ax_cv_check_ldflags__Werror___Wl__z_now" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags__Werror___Wl__z_now" >&5 +printf "%s\n" "$ax_cv_check_ldflags__Werror___Wl__z_now" >&6; } +if test x"$ax_cv_check_ldflags__Werror___Wl__z_now" = xyes +then : HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,now" -else +else $as_nop : fi -else +else $as_nop : fi @@ -5063,11 +5150,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-strict-aliasing" >&5 -$as_echo_n "checking whether C compiler accepts -fno-strict-aliasing... " >&6; } -if ${ax_cv_check_cflags__Werror___fno_strict_aliasing+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-strict-aliasing" >&5 +printf %s "checking whether C compiler accepts -fno-strict-aliasing... " >&6; } +if test ${ax_cv_check_cflags__Werror___fno_strict_aliasing+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fno-strict-aliasing" @@ -5075,26 +5163,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___fno_strict_aliasing=yes -else +else $as_nop ax_cv_check_cflags__Werror___fno_strict_aliasing=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fno_strict_aliasing" >&5 -$as_echo "$ax_cv_check_cflags__Werror___fno_strict_aliasing" >&6; } -if test x"$ax_cv_check_cflags__Werror___fno_strict_aliasing" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fno_strict_aliasing" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___fno_strict_aliasing" >&6; } +if test x"$ax_cv_check_cflags__Werror___fno_strict_aliasing" = xyes +then : CFLAGS="$CFLAGS -fno-strict-aliasing" -else +else $as_nop : fi @@ -5111,11 +5201,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-common" >&5 -$as_echo_n "checking whether C compiler accepts -fno-common... " >&6; } -if ${ax_cv_check_cflags__Werror___fno_common+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-common" >&5 +printf %s "checking whether C compiler accepts -fno-common... " >&6; } +if test ${ax_cv_check_cflags__Werror___fno_common+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -fno-common" @@ -5123,26 +5214,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___fno_common=yes -else +else $as_nop ax_cv_check_cflags__Werror___fno_common=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fno_common" >&5 -$as_echo "$ax_cv_check_cflags__Werror___fno_common" >&6; } -if test x"$ax_cv_check_cflags__Werror___fno_common" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___fno_common" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___fno_common" >&6; } +if test x"$ax_cv_check_cflags__Werror___fno_common" = xyes +then : CFLAGS="$CFLAGS -fno-common" -else +else $as_nop : fi @@ -5165,11 +5258,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextra" >&5 -$as_echo_n "checking whether C compiler accepts -Wextra... " >&6; } -if ${ax_cv_check_cflags__Werror___Wextra+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wextra" >&5 +printf %s "checking whether C compiler accepts -Wextra... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wextra+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wextra" @@ -5177,26 +5271,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wextra=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wextra=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wextra" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wextra" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wextra" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wextra" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wextra" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wextra" = xyes +then : CFLAGS="$CFLAGS -Wextra" -else +else $as_nop : fi @@ -5212,11 +5308,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Waggregate-return" >&5 -$as_echo_n "checking whether C compiler accepts -Waggregate-return... " >&6; } -if ${ax_cv_check_cflags__Werror___Waggregate_return+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Waggregate-return" >&5 +printf %s "checking whether C compiler accepts -Waggregate-return... " >&6; } +if test ${ax_cv_check_cflags__Werror___Waggregate_return+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Waggregate-return" @@ -5224,26 +5321,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Waggregate_return=yes -else +else $as_nop ax_cv_check_cflags__Werror___Waggregate_return=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Waggregate_return" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Waggregate_return" >&6; } -if test x"$ax_cv_check_cflags__Werror___Waggregate_return" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Waggregate_return" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Waggregate_return" >&6; } +if test x"$ax_cv_check_cflags__Werror___Waggregate_return" = xyes +then : CFLAGS="$CFLAGS -Waggregate-return" -else +else $as_nop : fi @@ -5259,11 +5358,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-nonliteral" >&5 -$as_echo_n "checking whether C compiler accepts -Wformat-nonliteral... " >&6; } -if ${ax_cv_check_cflags__Werror___Wformat_nonliteral+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-nonliteral" >&5 +printf %s "checking whether C compiler accepts -Wformat-nonliteral... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wformat_nonliteral+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wformat-nonliteral" @@ -5271,26 +5371,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wformat_nonliteral=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wformat_nonliteral=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_nonliteral" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wformat_nonliteral" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wformat_nonliteral" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_nonliteral" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wformat_nonliteral" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wformat_nonliteral" = xyes +then : CFLAGS="$CFLAGS -Wformat-nonliteral" -else +else $as_nop : fi @@ -5307,11 +5409,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wduplicated-cond" >&5 -$as_echo_n "checking whether C compiler accepts -Wduplicated-cond... " >&6; } -if ${ax_cv_check_cflags__Werror___Wduplicated_cond+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wduplicated-cond" >&5 +printf %s "checking whether C compiler accepts -Wduplicated-cond... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wduplicated_cond+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wduplicated-cond" @@ -5319,26 +5422,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wduplicated_cond=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wduplicated_cond=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wduplicated_cond" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wduplicated_cond" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wduplicated_cond" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wduplicated_cond" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wduplicated_cond" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wduplicated_cond" = xyes +then : CFLAGS="$CFLAGS -Wduplicated-cond" -else +else $as_nop : fi @@ -5354,11 +5459,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wduplicated-branches" >&5 -$as_echo_n "checking whether C compiler accepts -Wduplicated-branches... " >&6; } -if ${ax_cv_check_cflags__Werror___Wduplicated_branches+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wduplicated-branches" >&5 +printf %s "checking whether C compiler accepts -Wduplicated-branches... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wduplicated_branches+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wduplicated-branches" @@ -5366,26 +5472,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wduplicated_branches=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wduplicated_branches=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wduplicated_branches" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wduplicated_branches" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wduplicated_branches" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wduplicated_branches" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wduplicated_branches" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wduplicated_branches" = xyes +then : CFLAGS="$CFLAGS -Wduplicated-branches" -else +else $as_nop : fi @@ -5402,11 +5510,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wparentheses" >&5 -$as_echo_n "checking whether C compiler accepts -Wparentheses... " >&6; } -if ${ax_cv_check_cflags__Werror___Wparentheses+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wparentheses" >&5 +printf %s "checking whether C compiler accepts -Wparentheses... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wparentheses+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wparentheses" @@ -5414,26 +5523,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wparentheses=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wparentheses=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wparentheses" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wparentheses" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wparentheses" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wparentheses" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wparentheses" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wparentheses" = xyes +then : CFLAGS="$CFLAGS -Wparentheses" -else +else $as_nop : fi @@ -5452,11 +5563,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wpointer-sign" >&5 -$as_echo_n "checking whether C compiler accepts -Wpointer-sign... " >&6; } -if ${ax_cv_check_cflags__Werror___Wpointer_sign+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wpointer-sign" >&5 +printf %s "checking whether C compiler accepts -Wpointer-sign... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wpointer_sign+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wpointer-sign" @@ -5464,26 +5576,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wpointer_sign=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wpointer_sign=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wpointer_sign" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wpointer_sign" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wpointer_sign" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wpointer_sign" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wpointer_sign" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wpointer_sign" = xyes +then : CFLAGS="$CFLAGS -Wno-pointer-sign" -else +else $as_nop : fi @@ -5500,11 +5614,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Winvalid-source-encoding" >&5 -$as_echo_n "checking whether C compiler accepts -Winvalid-source-encoding... " >&6; } -if ${ax_cv_check_cflags__Werror___Winvalid_source_encoding+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Winvalid-source-encoding" >&5 +printf %s "checking whether C compiler accepts -Winvalid-source-encoding... " >&6; } +if test ${ax_cv_check_cflags__Werror___Winvalid_source_encoding+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Winvalid-source-encoding" @@ -5512,26 +5627,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Winvalid_source_encoding=yes -else +else $as_nop ax_cv_check_cflags__Werror___Winvalid_source_encoding=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Winvalid_source_encoding" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Winvalid_source_encoding" >&6; } -if test x"$ax_cv_check_cflags__Werror___Winvalid_source_encoding" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Winvalid_source_encoding" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Winvalid_source_encoding" >&6; } +if test x"$ax_cv_check_cflags__Werror___Winvalid_source_encoding" = xyes +then : CFLAGS="$CFLAGS -Wno-invalid-source-encoding" -else +else $as_nop : fi @@ -5548,11 +5665,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-zero-length" >&5 -$as_echo_n "checking whether C compiler accepts -Wformat-zero-length... " >&6; } -if ${ax_cv_check_cflags__Werror___Wformat_zero_length+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-zero-length" >&5 +printf %s "checking whether C compiler accepts -Wformat-zero-length... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wformat_zero_length+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wformat-zero-length" @@ -5560,26 +5678,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wformat_zero_length=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wformat_zero_length=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_zero_length" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wformat_zero_length" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wformat_zero_length" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_zero_length" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wformat_zero_length" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wformat_zero_length" = xyes +then : CFLAGS="$CFLAGS -Wno-format-zero-length" -else +else $as_nop : fi @@ -5596,11 +5716,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-truncation" >&5 -$as_echo_n "checking whether C compiler accepts -Wformat-truncation... " >&6; } -if ${ax_cv_check_cflags__Werror___Wformat_truncation+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-truncation" >&5 +printf %s "checking whether C compiler accepts -Wformat-truncation... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wformat_truncation+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wformat-truncation" @@ -5608,26 +5729,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wformat_truncation=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wformat_truncation=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_truncation" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wformat_truncation" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wformat_truncation" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_truncation" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wformat_truncation" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wformat_truncation" = xyes +then : CFLAGS="$CFLAGS -Wno-format-truncation" -else +else $as_nop : fi @@ -5644,11 +5767,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-overflow" >&5 -$as_echo_n "checking whether C compiler accepts -Wformat-overflow... " >&6; } -if ${ax_cv_check_cflags__Werror___Wformat_overflow+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wformat-overflow" >&5 +printf %s "checking whether C compiler accepts -Wformat-overflow... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wformat_overflow+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wformat-overflow" @@ -5656,26 +5780,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wformat_overflow=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wformat_overflow=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_overflow" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wformat_overflow" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wformat_overflow" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wformat_overflow" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wformat_overflow" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wformat_overflow" = xyes +then : CFLAGS="$CFLAGS -Wno-format-overflow" -else +else $as_nop : fi @@ -5692,11 +5818,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused" >&5 -$as_echo_n "checking whether C compiler accepts -Wunused... " >&6; } -if ${ax_cv_check_cflags__Werror___Wunused+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused" >&5 +printf %s "checking whether C compiler accepts -Wunused... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wunused+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wunused" @@ -5704,26 +5831,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wunused=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wunused=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunused" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wunused" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wunused" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunused" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wunused" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wunused" = xyes +then : CFLAGS="$CFLAGS -Wno-unused" -else +else $as_nop : fi @@ -5739,11 +5868,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-parameter" >&5 -$as_echo_n "checking whether C compiler accepts -Wunused-parameter... " >&6; } -if ${ax_cv_check_cflags__Werror___Wunused_parameter+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-parameter" >&5 +printf %s "checking whether C compiler accepts -Wunused-parameter... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wunused_parameter+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wunused-parameter" @@ -5751,26 +5881,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wunused_parameter=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wunused_parameter=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunused_parameter" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wunused_parameter" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wunused_parameter" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunused_parameter" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wunused_parameter" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wunused_parameter" = xyes +then : CFLAGS="$CFLAGS -Wno-unused-parameter" -else +else $as_nop : fi @@ -5786,11 +5918,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-but-set-parameter" >&5 -$as_echo_n "checking whether C compiler accepts -Wunused-but-set-parameter... " >&6; } -if ${ax_cv_check_cflags__Werror___Wunused_but_set_parameter+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunused-but-set-parameter" >&5 +printf %s "checking whether C compiler accepts -Wunused-but-set-parameter... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wunused_but_set_parameter+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wunused-but-set-parameter" @@ -5798,26 +5931,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wunused_but_set_parameter=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wunused_but_set_parameter=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunused_but_set_parameter" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wunused_but_set_parameter" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wunused_but_set_parameter" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunused_but_set_parameter" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wunused_but_set_parameter" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wunused_but_set_parameter" = xyes +then : CFLAGS="$CFLAGS -Wno-unused-but-set-parameter" -else +else $as_nop : fi @@ -5834,11 +5969,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wchar-subscripts" >&5 -$as_echo_n "checking whether C compiler accepts -Wchar-subscripts... " >&6; } -if ${ax_cv_check_cflags__Werror___Wchar_subscripts+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wchar-subscripts" >&5 +printf %s "checking whether C compiler accepts -Wchar-subscripts... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wchar_subscripts+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wchar-subscripts" @@ -5846,26 +5982,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wchar_subscripts=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wchar_subscripts=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wchar_subscripts" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wchar_subscripts" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wchar_subscripts" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wchar_subscripts" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wchar_subscripts" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wchar_subscripts" = xyes +then : CFLAGS="$CFLAGS -Wno-char-subscripts" -else +else $as_nop : fi @@ -5882,11 +6020,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wsign-compare" >&5 -$as_echo_n "checking whether C compiler accepts -Wsign-compare... " >&6; } -if ${ax_cv_check_cflags__Werror___Wsign_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wsign-compare" >&5 +printf %s "checking whether C compiler accepts -Wsign-compare... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wsign_compare+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wsign-compare" @@ -5894,26 +6033,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wsign_compare=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wsign_compare=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wsign_compare" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wsign_compare" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wsign_compare" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wsign_compare" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wsign_compare" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wsign_compare" = xyes +then : CFLAGS="$CFLAGS -Wno-sign-compare" -else +else $as_nop : fi @@ -5930,11 +6071,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wempty-body" >&5 -$as_echo_n "checking whether C compiler accepts -Wempty-body... " >&6; } -if ${ax_cv_check_cflags__Werror___Wempty_body+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wempty-body" >&5 +printf %s "checking whether C compiler accepts -Wempty-body... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wempty_body+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wempty-body" @@ -5942,26 +6084,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wempty_body=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wempty_body=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wempty_body" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wempty_body" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wempty_body" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wempty_body" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wempty_body" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wempty_body" = xyes +then : CFLAGS="$CFLAGS -Wno-empty-body" -else +else $as_nop : fi @@ -5972,7 +6116,59 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -if $CC --version | grep -q "clang version 3."; then : +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wdeprecated-non-prototype" >&5 +printf %s "checking whether C compiler accepts -Wdeprecated-non-prototype... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wdeprecated_non_prototype+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ax_check_save_flags=$CFLAGS + CFLAGS="$CFLAGS -Werror -Wdeprecated-non-prototype" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ax_cv_check_cflags__Werror___Wdeprecated_non_prototype=yes +else $as_nop + ax_cv_check_cflags__Werror___Wdeprecated_non_prototype=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CFLAGS=$ax_check_save_flags +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wdeprecated_non_prototype" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wdeprecated_non_prototype" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wdeprecated_non_prototype" = xyes +then : + CFLAGS="$CFLAGS -Wno-deprecated-non-prototype" +else $as_nop + : +fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +if $CC --version | grep -q "clang version 3." +then : CFLAGS="$CFLAGS -Wno-tautological-compare -Wno-pragmas" fi @@ -5982,11 +6178,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wpragmas" >&5 -$as_echo_n "checking whether C compiler accepts -Wpragmas... " >&6; } -if ${ax_cv_check_cflags__Werror___Wpragmas+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wpragmas" >&5 +printf %s "checking whether C compiler accepts -Wpragmas... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wpragmas+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wpragmas" @@ -5994,26 +6191,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wpragmas=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wpragmas=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wpragmas" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wpragmas" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wpragmas" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wpragmas" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wpragmas" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wpragmas" = xyes +then : no_pragmas=1 -else +else $as_nop no_pragmas=0 fi @@ -6029,11 +6228,12 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunknown-warning-option" >&5 -$as_echo_n "checking whether C compiler accepts -Wunknown-warning-option... " >&6; } -if ${ax_cv_check_cflags__Werror___Wunknown_warning_option+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wunknown-warning-option" >&5 +printf %s "checking whether C compiler accepts -Wunknown-warning-option... " >&6; } +if test ${ax_cv_check_cflags__Werror___Wunknown_warning_option+y} +then : + printf %s "(cached) " >&6 +else $as_nop ax_check_save_flags=$CFLAGS CFLAGS="$CFLAGS -Werror -Wunknown-warning-option" @@ -6041,26 +6241,28 @@ else /* end confdefs.h. */ int -main () +main (void) { ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_c_try_compile "$LINENO" +then : ax_cv_check_cflags__Werror___Wunknown_warning_option=yes -else +else $as_nop ax_cv_check_cflags__Werror___Wunknown_warning_option=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS=$ax_check_save_flags fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunknown_warning_option" >&5 -$as_echo "$ax_cv_check_cflags__Werror___Wunknown_warning_option" >&6; } -if test x"$ax_cv_check_cflags__Werror___Wunknown_warning_option" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror___Wunknown_warning_option" >&5 +printf "%s\n" "$ax_cv_check_cflags__Werror___Wunknown_warning_option" >&6; } +if test x"$ax_cv_check_cflags__Werror___Wunknown_warning_option" = xyes +then : unknown_warning_option=1 -else +else $as_nop unknown_warning_option=0 fi @@ -6083,32 +6285,36 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system has IPv6 support" >&5 -$as_echo_n "checking if your system has IPv6 support... " >&6; } -if ${ac_cv_ip6+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if your system has IPv6 support" >&5 +printf %s "checking if your system has IPv6 support... " >&6; } +if test ${ac_cv_ip6+y} +then : + printf %s "(cached) " >&6 +else $as_nop -if test "$cross_compiling" = yes; then : - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +if test "$cross_compiling" = yes +then : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -int main() { +#include +int main(void) { int s = socket(AF_INET6, SOCK_STREAM, 0); exit(0); /* We only check if the code compiles, that's enough. We can deal with missing runtime IPv6 */ } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : +if ac_fn_c_try_run "$LINENO" +then : ac_cv_ip6=yes -else +else $as_nop ac_cv_ip6=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -6117,146 +6323,422 @@ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ip6" >&5 -$as_echo "$ac_cv_ip6" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ip6" >&5 +printf "%s\n" "$ac_cv_ip6" >&6; } if test "$ac_cv_ip6" = "no"; then as_fn_error $? "Your system does not support IPv6" "$LINENO" 5 fi -ac_fn_c_check_header_mongrel "$LINENO" "sys/syslog.h" "ac_cv_header_sys_syslog_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_syslog_h" = xyes; then : +ac_fn_c_check_header_compile "$LINENO" "sys/syslog.h" "ac_cv_header_sys_syslog_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_syslog_h" = xyes +then : -$as_echo "#define SYSSYSLOGH /**/" >>confdefs.h +printf "%s\n" "#define SYSSYSLOGH /**/" >>confdefs.h + +fi + +ac_fn_c_check_header_compile "$LINENO" "sys/rusage.h" "ac_cv_header_sys_rusage_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_rusage_h" = xyes +then : + +printf "%s\n" "#define RUSAGEH /**/" >>confdefs.h + +fi + +ac_fn_c_check_header_compile "$LINENO" "glob.h" "ac_cv_header_glob_h" "$ac_includes_default" +if test "x$ac_cv_header_glob_h" = xyes +then : + +printf "%s\n" "#define GLOBH /**/" >>confdefs.h + +fi + +ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_inttypes_h" = xyes +then : + printf "%s\n" "#define HAVE_INTTYPES_H 1" >>confdefs.h fi -ac_fn_c_check_header_mongrel "$LINENO" "sys/rusage.h" "ac_cv_header_sys_rusage_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_rusage_h" = xyes; then : -$as_echo "#define RUSAGEH /**/" >>confdefs.h - -fi - - -ac_fn_c_check_header_mongrel "$LINENO" "glob.h" "ac_cv_header_glob_h" "$ac_includes_default" -if test "x$ac_cv_header_glob_h" = xyes; then : - -$as_echo "#define GLOBH /**/" >>confdefs.h - -fi - - -for ac_header in stdint.h inttypes.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_func in strlcpy + for ac_func in strlcpy do : ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" -if test "x$ac_cv_func_strlcpy" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRLCPY 1 -_ACEOF +if test "x$ac_cv_func_strlcpy" = xyes +then : + printf "%s\n" "#define HAVE_STRLCPY 1" >>confdefs.h -$as_echo "#define HAVE_STRLCPY /**/" >>confdefs.h +printf "%s\n" "#define HAVE_STRLCPY /**/" >>confdefs.h fi + done -for ac_func in strlcat + for ac_func in strlcat do : ac_fn_c_check_func "$LINENO" "strlcat" "ac_cv_func_strlcat" -if test "x$ac_cv_func_strlcat" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRLCAT 1 -_ACEOF +if test "x$ac_cv_func_strlcat" = xyes +then : + printf "%s\n" "#define HAVE_STRLCAT 1" >>confdefs.h -$as_echo "#define HAVE_STRLCAT /**/" >>confdefs.h +printf "%s\n" "#define HAVE_STRLCAT /**/" >>confdefs.h fi + done -for ac_func in strlncat + for ac_func in strlncat do : ac_fn_c_check_func "$LINENO" "strlncat" "ac_cv_func_strlncat" -if test "x$ac_cv_func_strlncat" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRLNCAT 1 -_ACEOF +if test "x$ac_cv_func_strlncat" = xyes +then : + printf "%s\n" "#define HAVE_STRLNCAT 1" >>confdefs.h -$as_echo "#define HAVE_STRLNCAT /**/" >>confdefs.h +printf "%s\n" "#define HAVE_STRLNCAT /**/" >>confdefs.h fi + done -for ac_func in strlncpy + for ac_func in strlncpy do : ac_fn_c_check_func "$LINENO" "strlncpy" "ac_cv_func_strlncpy" -if test "x$ac_cv_func_strlncpy" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STRLNCPY 1 -_ACEOF +if test "x$ac_cv_func_strlncpy" = xyes +then : + printf "%s\n" "#define HAVE_STRLNCPY 1" >>confdefs.h -$as_echo "#define HAVE_STRLNCPY /**/" >>confdefs.h +printf "%s\n" "#define HAVE_STRLNCPY /**/" >>confdefs.h fi + done -for ac_func in getrusage + for ac_func in getrusage do : ac_fn_c_check_func "$LINENO" "getrusage" "ac_cv_func_getrusage" -if test "x$ac_cv_func_getrusage" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETRUSAGE 1 -_ACEOF +if test "x$ac_cv_func_getrusage" = xyes +then : + printf "%s\n" "#define HAVE_GETRUSAGE 1" >>confdefs.h -$as_echo "#define GETRUSAGE_2 /**/" >>confdefs.h +printf "%s\n" "#define GETRUSAGE_2 /**/" >>confdefs.h + +else $as_nop -else for ac_func in times do : ac_fn_c_check_func "$LINENO" "times" "ac_cv_func_times" -if test "x$ac_cv_func_times" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TIMES 1 +if test "x$ac_cv_func_times" = xyes +then : + printf "%s\n" "#define HAVE_TIMES 1" >>confdefs.h + +printf "%s\n" "#define TIMES_2 /**/" >>confdefs.h + +fi + +done +fi + +done +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test ${ac_cv_prog_CPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error _ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : -$as_echo "#define TIMES_2 /**/" >>confdefs.h +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CPP=$CPP fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi fi -done +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" -for ac_func in setproctitle + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + + + for ac_func in setproctitle do : ac_fn_c_check_func "$LINENO" "setproctitle" "ac_cv_func_setproctitle" -if test "x$ac_cv_func_setproctitle" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SETPROCTITLE 1 -_ACEOF +if test "x$ac_cv_func_setproctitle" = xyes +then : + printf "%s\n" "#define HAVE_SETPROCTITLE 1" >>confdefs.h -$as_echo "#define HAVE_SETPROCTITLE /**/" >>confdefs.h +printf "%s\n" "#define HAVE_SETPROCTITLE /**/" >>confdefs.h -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for setproctitle in -lutil" >&5 -$as_echo_n "checking for setproctitle in -lutil... " >&6; } -if ${ac_cv_lib_util_setproctitle+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for setproctitle in -lutil" >&5 +printf %s "checking for setproctitle in -lutil... " >&6; } +if test ${ac_cv_lib_util_setproctitle+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -6265,35 +6747,34 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char setproctitle (); int -main () +main (void) { return setproctitle (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_util_setproctitle=yes -else +else $as_nop ac_cv_lib_util_setproctitle=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_setproctitle" >&5 -$as_echo "$ac_cv_lib_util_setproctitle" >&6; } -if test "x$ac_cv_lib_util_setproctitle" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_util_setproctitle" >&5 +printf "%s\n" "$ac_cv_lib_util_setproctitle" >&6; } +if test "x$ac_cv_lib_util_setproctitle" = xyes +then : -$as_echo "#define HAVE_SETPROCTITLE /**/" >>confdefs.h +printf "%s\n" "#define HAVE_SETPROCTITLE /**/" >>confdefs.h IRCDLIBS="$IRCDLIBS-lutil" -else +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -6301,26 +6782,27 @@ else _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "#define.*PS_STRINGS.*" >/dev/null 2>&1; then : + $EGREP "#define.*PS_STRINGS.*" >/dev/null 2>&1 +then : -$as_echo "#define HAVE_PSSTRINGS /**/" >>confdefs.h +printf "%s\n" "#define HAVE_PSSTRINGS /**/" >>confdefs.h + +else $as_nop -else for ac_func in pstat do : ac_fn_c_check_func "$LINENO" "pstat" "ac_cv_func_pstat" -if test "x$ac_cv_func_pstat" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PSTAT 1 -_ACEOF +if test "x$ac_cv_func_pstat" = xyes +then : + printf "%s\n" "#define HAVE_PSTAT 1" >>confdefs.h -$as_echo "#define HAVE_PSTAT /**/" >>confdefs.h +printf "%s\n" "#define HAVE_PSTAT /**/" >>confdefs.h fi + done - fi -rm -f conftest* +rm -rf conftest* fi @@ -6328,81 +6810,89 @@ fi fi + done -for ac_func in explicit_bzero + for ac_func in explicit_bzero do : ac_fn_c_check_func "$LINENO" "explicit_bzero" "ac_cv_func_explicit_bzero" -if test "x$ac_cv_func_explicit_bzero" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_EXPLICIT_BZERO 1 -_ACEOF +if test "x$ac_cv_func_explicit_bzero" = xyes +then : + printf "%s\n" "#define HAVE_EXPLICIT_BZERO 1" >>confdefs.h -$as_echo "#define HAVE_EXPLICIT_BZERO /**/" >>confdefs.h +printf "%s\n" "#define HAVE_EXPLICIT_BZERO /**/" >>confdefs.h fi + done -for ac_func in syslog + for ac_func in syslog do : ac_fn_c_check_func "$LINENO" "syslog" "ac_cv_func_syslog" -if test "x$ac_cv_func_syslog" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYSLOG 1 -_ACEOF +if test "x$ac_cv_func_syslog" = xyes +then : + printf "%s\n" "#define HAVE_SYSLOG 1" >>confdefs.h -$as_echo "#define HAVE_SYSLOG /**/" >>confdefs.h +printf "%s\n" "#define HAVE_SYSLOG /**/" >>confdefs.h fi + done + for ac_func in strnlen +do : + ac_fn_c_check_func "$LINENO" "strnlen" "ac_cv_func_strnlen" +if test "x$ac_cv_func_strnlen" = xyes +then : + printf "%s\n" "#define HAVE_STRNLEN 1" >>confdefs.h + +printf "%s\n" "#define HAVE_STRNLEN /**/" >>confdefs.h + +fi + +done # Check whether --with-nick-history was given. -if test "${with_nick_history+set}" = set; then : +if test ${with_nick_history+y} +then : withval=$with_nick_history; -cat >>confdefs.h <<_ACEOF -#define NICKNAMEHISTORYLENGTH $withval -_ACEOF +printf "%s\n" "#define NICKNAMEHISTORYLENGTH $withval" >>confdefs.h -else +else $as_nop -$as_echo "#define NICKNAMEHISTORYLENGTH 2000" >>confdefs.h +printf "%s\n" "#define NICKNAMEHISTORYLENGTH 2000" >>confdefs.h fi # Check whether --with-permissions was given. -if test "${with_permissions+set}" = set; then : +if test ${with_permissions+y} +then : withval=$with_permissions; -cat >>confdefs.h <<_ACEOF -#define DEFAULT_PERMISSIONS 0$withval -_ACEOF +printf "%s\n" "#define DEFAULT_PERMISSIONS 0$withval" >>confdefs.h -else +else $as_nop -$as_echo "#define DEFAULT_PERMISSIONS 0600" >>confdefs.h +printf "%s\n" "#define DEFAULT_PERMISSIONS 0600" >>confdefs.h fi # Check whether --with-bindir was given. -if test "${with_bindir+set}" = set; then : +if test ${with_bindir+y} +then : withval=$with_bindir; -cat >>confdefs.h <<_ACEOF -#define BINDIR "$withval" -_ACEOF +printf "%s\n" "#define BINDIR \"$withval\"" >>confdefs.h BINDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define BINDIR "$HOME/unrealircd/bin" -_ACEOF +printf "%s\n" "#define BINDIR \"$HOME/unrealircd/bin\"" >>confdefs.h BINDIR="$HOME/unrealircd/bin" fi @@ -6410,18 +6900,15 @@ fi # Check whether --with-scriptdir was given. -if test "${with_scriptdir+set}" = set; then : +if test ${with_scriptdir+y} +then : withval=$with_scriptdir; -cat >>confdefs.h <<_ACEOF -#define SCRIPTDIR "$withval" -_ACEOF +printf "%s\n" "#define SCRIPTDIR \"$withval\"" >>confdefs.h SCRIPTDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define SCRIPTDIR "$HOME/unrealircd" -_ACEOF +printf "%s\n" "#define SCRIPTDIR \"$HOME/unrealircd\"" >>confdefs.h SCRIPTDIR="$HOME/unrealircd" fi @@ -6429,18 +6916,15 @@ fi # Check whether --with-confdir was given. -if test "${with_confdir+set}" = set; then : +if test ${with_confdir+y} +then : withval=$with_confdir; -cat >>confdefs.h <<_ACEOF -#define CONFDIR "$withval" -_ACEOF +printf "%s\n" "#define CONFDIR \"$withval\"" >>confdefs.h CONFDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define CONFDIR "$HOME/unrealircd/conf" -_ACEOF +printf "%s\n" "#define CONFDIR \"$HOME/unrealircd/conf\"" >>confdefs.h CONFDIR="$HOME/unrealircd/conf" fi @@ -6448,18 +6932,15 @@ fi # Check whether --with-builddir was given. -if test "${with_builddir+set}" = set; then : +if test ${with_builddir+y} +then : withval=$with_builddir; -cat >>confdefs.h <<_ACEOF -#define BUILDDIR "$withval" -_ACEOF +printf "%s\n" "#define BUILDDIR \"$withval\"" >>confdefs.h BUILDDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define BUILDDIR "$BUILDDIR_NOW" -_ACEOF +printf "%s\n" "#define BUILDDIR \"$BUILDDIR_NOW\"" >>confdefs.h BUILDDIR="$BUILDDIR_NOW" fi @@ -6467,18 +6948,15 @@ fi # Check whether --with-modulesdir was given. -if test "${with_modulesdir+set}" = set; then : +if test ${with_modulesdir+y} +then : withval=$with_modulesdir; -cat >>confdefs.h <<_ACEOF -#define MODULESDIR "$withval" -_ACEOF +printf "%s\n" "#define MODULESDIR \"$withval\"" >>confdefs.h MODULESDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define MODULESDIR "$HOME/unrealircd/modules" -_ACEOF +printf "%s\n" "#define MODULESDIR \"$HOME/unrealircd/modules\"" >>confdefs.h MODULESDIR="$HOME/unrealircd/modules" fi @@ -6486,18 +6964,15 @@ fi # Check whether --with-logdir was given. -if test "${with_logdir+set}" = set; then : +if test ${with_logdir+y} +then : withval=$with_logdir; -cat >>confdefs.h <<_ACEOF -#define LOGDIR "$withval" -_ACEOF +printf "%s\n" "#define LOGDIR \"$withval\"" >>confdefs.h LOGDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define LOGDIR "$HOME/unrealircd/logs" -_ACEOF +printf "%s\n" "#define LOGDIR \"$HOME/unrealircd/logs\"" >>confdefs.h LOGDIR="$HOME/unrealircd/logs" fi @@ -6505,18 +6980,15 @@ fi # Check whether --with-cachedir was given. -if test "${with_cachedir+set}" = set; then : +if test ${with_cachedir+y} +then : withval=$with_cachedir; -cat >>confdefs.h <<_ACEOF -#define CACHEDIR "$withval" -_ACEOF +printf "%s\n" "#define CACHEDIR \"$withval\"" >>confdefs.h CACHEDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define CACHEDIR "$HOME/unrealircd/cache" -_ACEOF +printf "%s\n" "#define CACHEDIR \"$HOME/unrealircd/cache\"" >>confdefs.h CACHEDIR="$HOME/unrealircd/cache" fi @@ -6524,18 +6996,15 @@ fi # Check whether --with-tmpdir was given. -if test "${with_tmpdir+set}" = set; then : +if test ${with_tmpdir+y} +then : withval=$with_tmpdir; -cat >>confdefs.h <<_ACEOF -#define TMPDIR "$withval" -_ACEOF +printf "%s\n" "#define TMPDIR \"$withval\"" >>confdefs.h TMPDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define TMPDIR "$HOME/unrealircd/tmp" -_ACEOF +printf "%s\n" "#define TMPDIR \"$HOME/unrealircd/tmp\"" >>confdefs.h TMPDIR="$HOME/unrealircd/tmp" fi @@ -6543,18 +7012,15 @@ fi # Check whether --with-datadir was given. -if test "${with_datadir+set}" = set; then : +if test ${with_datadir+y} +then : withval=$with_datadir; -cat >>confdefs.h <<_ACEOF -#define PERMDATADIR "$withval" -_ACEOF +printf "%s\n" "#define PERMDATADIR \"$withval\"" >>confdefs.h PERMDATADIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define DATADIR "$HOME/unrealircd/data" -_ACEOF +printf "%s\n" "#define DATADIR \"$HOME/unrealircd/data\"" >>confdefs.h PERMDATADIR="$HOME/unrealircd/data" fi @@ -6562,18 +7028,15 @@ fi # Check whether --with-docdir was given. -if test "${with_docdir+set}" = set; then : +if test ${with_docdir+y} +then : withval=$with_docdir; -cat >>confdefs.h <<_ACEOF -#define DOCDIR "$withval" -_ACEOF +printf "%s\n" "#define DOCDIR \"$withval\"" >>confdefs.h DOCDIR="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define DOCDIR "$HOME/unrealircd/doc" -_ACEOF +printf "%s\n" "#define DOCDIR \"$HOME/unrealircd/doc\"" >>confdefs.h DOCDIR="$HOME/unrealircd/doc" fi @@ -6581,18 +7044,15 @@ fi # Check whether --with-pidfile was given. -if test "${with_pidfile+set}" = set; then : +if test ${with_pidfile+y} +then : withval=$with_pidfile; -cat >>confdefs.h <<_ACEOF -#define PIDFILE "$withval" -_ACEOF +printf "%s\n" "#define PIDFILE \"$withval\"" >>confdefs.h PIDFILE="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define PIDFILE "$HOME/unrealircd/data/unrealircd.pid" -_ACEOF +printf "%s\n" "#define PIDFILE \"$HOME/unrealircd/data/unrealircd.pid\"" >>confdefs.h PIDFILE="$HOME/unrealircd/data/unrealircd.pid" fi @@ -6600,18 +7060,15 @@ fi # Check whether --with-controlfile was given. -if test "${with_controlfile+set}" = set; then : +if test ${with_controlfile+y} +then : withval=$with_controlfile; -cat >>confdefs.h <<_ACEOF -#define CONTROLFILE "$withval" -_ACEOF +printf "%s\n" "#define CONTROLFILE \"$withval\"" >>confdefs.h CONTROLFILE="$withval" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define CONTROLFILE "$HOME/unrealircd/data/unrealircd.ctl" -_ACEOF +printf "%s\n" "#define CONTROLFILE \"$HOME/unrealircd/data/unrealircd.ctl\"" >>confdefs.h CONTROLFILE="$HOME/unrealircd/data/unrealircd.ctl" fi @@ -6619,26 +7076,28 @@ fi # Check whether --with-privatelibdir was given. -if test "${with_privatelibdir+set}" = set; then : +if test ${with_privatelibdir+y} +then : withval=$with_privatelibdir; -else +else $as_nop with_privatelibdir="yes" fi -if test "x$with_privatelibdir" = "xno"; then : +if test "x$with_privatelibdir" = "xno" +then : PRIVATELIBDIR= -elif test "x$with_privatelibdir" = "xyes"; then : +elif test "x$with_privatelibdir" = "xyes" +then : PRIVATELIBDIR="$HOME/unrealircd/lib" -else +else $as_nop PRIVATELIBDIR="$with_privatelibdir" fi -if test "x$PRIVATELIBDIR" = "x"; then : +if test "x$PRIVATELIBDIR" = "x" +then : LDFLAGS_PRIVATELIBS="" -else +else $as_nop -cat >>confdefs.h <<_ACEOF -#define PRIVATELIBDIR "$PRIVATELIBDIR" -_ACEOF +printf "%s\n" "#define PRIVATELIBDIR \"$PRIVATELIBDIR\"" >>confdefs.h LDFLAGS_PRIVATELIBS="-Wl,-rpath,$PRIVATELIBDIR" LDFLAGS="$LDFLAGS $LDFLAGS_PRIVATELIBS" @@ -6661,95 +7120,105 @@ fi # Check whether --with-maxconnections was given. -if test "${with_maxconnections+set}" = set; then : +if test ${with_maxconnections+y} +then : withval=$with_maxconnections; ac_fd=$withval -else +else $as_nop ac_fd=0 fi -cat >>confdefs.h <<_ACEOF -#define MAXCONNECTIONS_REQUEST $ac_fd -_ACEOF +printf "%s\n" "#define MAXCONNECTIONS_REQUEST $ac_fd" >>confdefs.h # Check whether --with-no-operoverride was given. -if test "${with_no_operoverride+set}" = set; then : - withval=$with_no_operoverride; if test $withval = "yes"; then : +if test ${with_no_operoverride+y} +then : + withval=$with_no_operoverride; if test $withval = "yes" +then : -$as_echo "#define NO_OPEROVERRIDE /**/" >>confdefs.h +printf "%s\n" "#define NO_OPEROVERRIDE /**/" >>confdefs.h fi fi # Check whether --with-operoverride-verify was given. -if test "${with_operoverride_verify+set}" = set; then : - withval=$with_operoverride_verify; if test $withval = "yes"; then : +if test ${with_operoverride_verify+y} +then : + withval=$with_operoverride_verify; if test $withval = "yes" +then : -$as_echo "#define OPEROVERRIDE_VERIFY /**/" >>confdefs.h +printf "%s\n" "#define OPEROVERRIDE_VERIFY /**/" >>confdefs.h fi fi # Check whether --with-system-pcre2 was given. -if test "${with_system_pcre2+set}" = set; then : +if test ${with_system_pcre2+y} +then : withval=$with_system_pcre2; -else +else $as_nop with_system_pcre2=yes fi # Check whether --with-system-argon2 was given. -if test "${with_system_argon2+set}" = set; then : +if test ${with_system_argon2+y} +then : withval=$with_system_argon2; -else +else $as_nop with_system_argon2=yes fi # Check whether --with-system-sodium was given. -if test "${with_system_sodium+set}" = set; then : +if test ${with_system_sodium+y} +then : withval=$with_system_sodium; -else +else $as_nop with_system_sodium=yes fi # Check whether --with-system-cares was given. -if test "${with_system_cares+set}" = set; then : +if test ${with_system_cares+y} +then : withval=$with_system_cares; -else +else $as_nop with_system_cares=yes fi # Check whether --with-system-jansson was given. -if test "${with_system_jansson+set}" = set; then : +if test ${with_system_jansson+y} +then : withval=$with_system_jansson; -else +else $as_nop with_system_jansson=yes fi # Check whether --enable-ssl was given. -if test "${enable_ssl+set}" = set; then : +if test ${enable_ssl+y} +then : enableval=$enable_ssl; -else +else $as_nop enable_ssl=no fi -if test $enable_ssl != "no"; then : +if test $enable_ssl != "no" +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL" >&5 -$as_echo_n "checking for OpenSSL... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for OpenSSL" >&5 +printf %s "checking for OpenSSL... " >&6; } for dir in $enable_ssl /usr/local/opt/openssl /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/sfw /usr/local /usr; do ssldir="$dir" if test -f "$dir/include/openssl/ssl.h"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir/include/openssl" >&5 -$as_echo "found in $ssldir/include/openssl" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found in $ssldir/include/openssl" >&5 +printf "%s\n" "found in $ssldir/include/openssl" >&6; } found_ssl="yes"; if test ! "$ssldir" = "/usr" ; then CFLAGS="$CFLAGS -I$ssldir/include"; @@ -6757,8 +7226,8 @@ $as_echo "found in $ssldir/include/openssl" >&6; } break fi if test -f "$dir/include/ssl.h"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir/include" >&5 -$as_echo "found in $ssldir/include" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: found in $ssldir/include" >&5 +printf "%s\n" "found in $ssldir/include" >&6; } found_ssl="yes"; if test ! "$ssldir" = "/usr" ; then CFLAGS="$CFLAGS -I$ssldir/include"; @@ -6767,8 +7236,8 @@ $as_echo "found in $ssldir/include" >&6; } fi done if test x_$found_ssl != x_yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 -$as_echo "not found" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not found" >&5 +printf "%s\n" "not found" >&6; } echo "" echo "Apparently you do not have both the openssl binary and openssl development libraries installed." echo "The following packages are required:" @@ -6789,63 +7258,65 @@ $as_echo "not found" >&6; } OPENSSLPATH="$ssldir/bin/openssl"; fi fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl" >&5 -$as_echo_n "checking OpenSSL linking with -ldl... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl" >&5 +printf %s "checking OpenSSL linking with -ldl... " >&6; } SAVE_LIBS="$LIBS" LIBS="$LIBS $CRYPTOLIB -ldl" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { ERR_clear_error(); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } CRYPTOLIB="$CRYPTOLIB -ldl" -else +else $as_nop - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl and -lpthread" >&5 -$as_echo_n "checking OpenSSL linking with -ldl and -lpthread... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking OpenSSL linking with -ldl and -lpthread" >&5 +printf %s "checking OpenSSL linking with -ldl and -lpthread... " >&6; } LIBS="$SAVE_LIBS $CRYPTOLIB -ldl -lpthread" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { ERR_clear_error(); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } CRYPTOLIB="$CRYPTOLIB -ldl -lpthread" -else +else $as_nop - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$SAVE_LIBS" fi @@ -6853,8 +7324,8 @@ rm -f core conftest.err conftest.$ac_objext \ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_set1_curves_list in SSL library" >&5 -$as_echo_n "checking for SSL_CTX_set1_curves_list in SSL library... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_set1_curves_list in SSL library" >&5 +printf %s "checking for SSL_CTX_set1_curves_list in SSL library... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6867,19 +7338,20 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { SSL_CTX *ctx = NULL; SSL_CTX_set1_curves_list(ctx, "test"); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_function=1 -else +else $as_nop has_function=0 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$SAVE_LIBS" ac_ext=c @@ -6889,19 +7361,19 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $has_function = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -$as_echo "#define HAS_SSL_CTX_SET1_CURVES_LIST /**/" >>confdefs.h +printf "%s\n" "#define HAS_SSL_CTX_SET1_CURVES_LIST /**/" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_set_min_proto_version in SSL library" >&5 -$as_echo_n "checking for SSL_CTX_set_min_proto_version in SSL library... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_set_min_proto_version in SSL library" >&5 +printf %s "checking for SSL_CTX_set_min_proto_version in SSL library... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6914,19 +7386,20 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { SSL_CTX *ctx = NULL; SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_function=1 -else +else $as_nop has_function=0 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$SAVE_LIBS" ac_ext=c @@ -6936,19 +7409,19 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $has_function = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -$as_echo "#define HAS_SSL_CTX_SET_MIN_PROTO_VERSION /**/" >>confdefs.h +printf "%s\n" "#define HAS_SSL_CTX_SET_MIN_PROTO_VERSION /**/" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_set_security_level in SSL library" >&5 -$as_echo_n "checking for SSL_CTX_set_security_level in SSL library... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SSL_CTX_set_security_level in SSL library" >&5 +printf %s "checking for SSL_CTX_set_security_level in SSL library... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -6961,19 +7434,20 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { SSL_CTX *ctx = NULL; SSL_CTX_set_security_level(ctx, 1); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_function=1 -else +else $as_nop has_function=0 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$SAVE_LIBS" ac_ext=c @@ -6983,19 +7457,19 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $has_function = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -$as_echo "#define HAS_SSL_CTX_SET_SECURITY_LEVEL /**/" >>confdefs.h +printf "%s\n" "#define HAS_SSL_CTX_SET_SECURITY_LEVEL /**/" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ASN1_TIME_diff in SSL library" >&5 -$as_echo_n "checking for ASN1_TIME_diff in SSL library... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ASN1_TIME_diff in SSL library" >&5 +printf %s "checking for ASN1_TIME_diff in SSL library... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -7008,19 +7482,20 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { int one, two; ASN1_TIME_diff(&one, &two, NULL, NULL); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_function=1 -else +else $as_nop has_function=0 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$SAVE_LIBS" ac_ext=c @@ -7030,19 +7505,19 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $has_function = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -$as_echo "#define HAS_ASN1_TIME_diff /**/" >>confdefs.h +printf "%s\n" "#define HAS_ASN1_TIME_diff /**/" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for X509_get0_notAfter in SSL library" >&5 -$as_echo_n "checking for X509_get0_notAfter in SSL library... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X509_get0_notAfter in SSL library" >&5 +printf %s "checking for X509_get0_notAfter in SSL library... " >&6; } ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -7055,19 +7530,20 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { X509_get0_notAfter(NULL); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : has_function=1 -else +else $as_nop has_function=0 fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$SAVE_LIBS" ac_ext=c @@ -7077,34 +7553,86 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $has_function = 1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } -$as_echo "#define HAS_X509_get0_notAfter /**/" >>confdefs.h +printf "%s\n" "#define HAS_X509_get0_notAfter /**/" >>confdefs.h else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for X509_check_host in SSL library" >&5 +printf %s "checking for X509_check_host in SSL library... " >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +SAVE_LIBS="$LIBS" +LIBS="$LIBS $CRYPTOLIB" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +X509_check_host(NULL, NULL, 0, 0, NULL); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + has_function=1 +else $as_nop + has_function=0 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS="$SAVE_LIBS" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $has_function = 1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + +printf "%s\n" "#define HAS_X509_check_host /**/" >>confdefs.h + +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi # Check whether --enable-dynamic-linking was given. -if test "${enable_dynamic_linking+set}" = set; then : +if test ${enable_dynamic_linking+y} +then : enableval=$enable_dynamic_linking; enable_dynamic_linking=$enableval -else +else $as_nop enable_dynamic_linking="yes" fi -if test $enable_dynamic_linking = "yes"; then : +if test $enable_dynamic_linking = "yes" +then : ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +if test "x$ac_cv_func_dlopen" = xyes +then : -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -7113,36 +7641,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char dlopen (); int -main () +main (void) { return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_lib_dl_dlopen=yes -else +else $as_nop ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : IRCDLIBS="$IRCDLIBS -ldl" -else +else $as_nop -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Dynamic linking is not enabled because dlopen was not found" >&5 -$as_echo "$as_me: WARNING: Dynamic linking is not enabled because dlopen was not found" >&2;} -$as_echo "#define STATIC_LINKING 1" >>confdefs.h +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Dynamic linking is not enabled because dlopen was not found" >&5 +printf "%s\n" "$as_me: WARNING: Dynamic linking is not enabled because dlopen was not found" >&2;} +printf "%s\n" "#define STATIC_LINKING 1" >>confdefs.h fi @@ -7153,43 +7680,46 @@ fi hold_cflags=$CFLAGS DYNAMIC_LDFLAGS="" CFLAGS="$CFLAGS -Wl,-export-dynamic" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we need the -export-dynamic flag" >&5 -$as_echo_n "checking if we need the -export-dynamic flag... " >&6; } -if ${ac_cv_export_dynamic+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we need the -export-dynamic flag" >&5 +printf %s "checking if we need the -export-dynamic flag... " >&6; } +if test ${ac_cv_export_dynamic+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int -main () +main (void) { int i; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ac_cv_export_dynamic=yes -else +else $as_nop ac_cv_export_dynamic=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_export_dynamic" >&5 -$as_echo "$ac_cv_export_dynamic" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_export_dynamic" >&5 +printf "%s\n" "$ac_cv_export_dynamic" >&6; } CFLAGS=$hold_cflags if test "$ac_cv_export_dynamic" = "yes"; then DYNAMIC_LDFLAGS="-Wl,-export-dynamic" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option to produce PIC" >&5 -$as_echo_n "checking for compiler option to produce PIC... " >&6; } -if ${ac_cv_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compiler option to produce PIC" >&5 +printf %s "checking for compiler option to produce PIC... " >&6; } +if test ${ac_cv_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "$ac_cv_c_compiler_gnu" = "yes"; then ac_cv_pic="-fPIC -DPIC -shared" @@ -7210,16 +7740,17 @@ esac fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pic" >&5 -$as_echo "$ac_cv_pic" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system prepends an underscore on symbols" >&5 -$as_echo_n "checking if your system prepends an underscore on symbols... " >&6; } -if ${ac_cv_underscore+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pic" >&5 +printf "%s\n" "$ac_cv_pic" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if your system prepends an underscore on symbols" >&5 +printf %s "checking if your system prepends an underscore on symbols... " >&6; } +if test ${ac_cv_underscore+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat >uscore.c << __EOF__ -int main() { +int main(void) { return 0; } __EOF__ @@ -7232,79 +7763,85 @@ fi rm -f uscore uscore.c fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_underscore" >&5 -$as_echo "$ac_cv_underscore" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_underscore" >&5 +printf "%s\n" "$ac_cv_underscore" >&6; } if test "$ac_cv_underscore" = "yes"; then -$as_echo "#define UNDERSCORE /**/" >>confdefs.h +printf "%s\n" "#define UNDERSCORE /**/" >>confdefs.h fi MODULEFLAGS="$ac_cv_pic $DYNAMIC_LDFLAGS" -else +else $as_nop -$as_echo "#define STATIC_LINKING /**/" >>confdefs.h +printf "%s\n" "#define STATIC_LINKING /**/" >>confdefs.h fi # Check whether --enable-werror was given. -if test "${enable_werror+set}" = set; then : +if test ${enable_werror+y} +then : enableval=$enable_werror; ac_cv_werror="$enableval" -else +else $as_nop ac_cv_werror="no" fi # Check whether --enable-asan was given. -if test "${enable_asan+set}" = set; then : +if test ${enable_asan+y} +then : enableval=$enable_asan; ac_cv_asan="$enableval" -else +else $as_nop ac_cv_asan="no" fi -for ac_func in poll + + for ac_func in poll do : ac_fn_c_check_func "$LINENO" "poll" "ac_cv_func_poll" -if test "x$ac_cv_func_poll" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_POLL 1 -_ACEOF +if test "x$ac_cv_func_poll" = xyes +then : + printf "%s\n" "#define HAVE_POLL 1" >>confdefs.h -$as_echo "#define HAVE_POLL /**/" >>confdefs.h +printf "%s\n" "#define HAVE_POLL /**/" >>confdefs.h fi + done -for ac_func in epoll_create epoll_ctl epoll_wait + for ac_func in epoll_create epoll_ctl epoll_wait do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -$as_echo "#define HAVE_EPOLL /**/" >>confdefs.h +printf "%s\n" "#define HAVE_EPOLL /**/" >>confdefs.h fi + done -for ac_func in kqueue kevent + for ac_func in kqueue kevent do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` + as_ac_var=`printf "%s\n" "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +if eval test \"x\$"$as_ac_var"\" = x"yes" +then : cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `printf "%s\n" "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -$as_echo "#define HAVE_KQUEUE /**/" >>confdefs.h +printf "%s\n" "#define HAVE_KQUEUE /**/" >>confdefs.h fi -done +done export PATH_SEPARATOR @@ -7320,11 +7857,12 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. @@ -7334,11 +7872,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7350,11 +7892,11 @@ esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +printf "%s\n" "$PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -7363,11 +7905,12 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_path_ac_pt_PKG_CONFIG+y} +then : + printf %s "(cached) " >&6 +else $as_nop case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. @@ -7377,11 +7920,15 @@ else for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir$ac_word$ac_exec_ext" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -7393,11 +7940,11 @@ esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +printf "%s\n" "$ac_pt_PKG_CONFIG" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then @@ -7405,8 +7952,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG @@ -7418,34 +7965,35 @@ fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +printf %s "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } PKG_CONFIG="" fi fi -if test "x$with_system_pcre2" = "xyes"; then : +if test "x$with_system_pcre2" = "xyes" +then : pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PCRE2" >&5 -$as_echo_n "checking for PCRE2... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PCRE2" >&5 +printf %s "checking for PCRE2... " >&6; } if test -n "$PCRE2_CFLAGS"; then pkg_cv_PCRE2_CFLAGS="$PCRE2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.00\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.00") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.36\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.36") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PCRE2_CFLAGS=`$PKG_CONFIG --cflags "libpcre2-8 >= 10.00" 2>/dev/null` + pkg_cv_PCRE2_CFLAGS=`$PKG_CONFIG --cflags "libpcre2-8 >= 10.36" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -7457,12 +8005,12 @@ if test -n "$PCRE2_LIBS"; then pkg_cv_PCRE2_LIBS="$PCRE2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.00\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.00") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpcre2-8 >= 10.36\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpcre2-8 >= 10.36") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PCRE2_LIBS=`$PKG_CONFIG --libs "libpcre2-8 >= 10.00" 2>/dev/null` + pkg_cv_PCRE2_LIBS=`$PKG_CONFIG --libs "libpcre2-8 >= 10.36" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -7474,8 +8022,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -7483,35 +8031,37 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PCRE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre2-8 >= 10.00" 2>&1` + PCRE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre2-8 >= 10.36" 2>&1` else - PCRE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre2-8 >= 10.00" 2>&1` + PCRE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre2-8 >= 10.36" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PCRE2_PKG_ERRORS" >&5 has_system_pcre2=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } has_system_pcre2=no else PCRE2_CFLAGS=$pkg_cv_PCRE2_CFLAGS PCRE2_LIBS=$pkg_cv_PCRE2_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } has_system_pcre2=yes -if test "x$PRIVATELIBDIR" != "x"; then : +if test "x$PRIVATELIBDIR" != "x" +then : rm -f "$PRIVATELIBDIR/"libpcre2* fi fi fi -if test "$has_system_pcre2" = "no"; then : +if test "$has_system_pcre2" = "no" +then : -pcre2_version="10.39" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: extracting PCRE2 regex library" >&5 -$as_echo "extracting PCRE2 regex library" >&6; } +pcre2_version="10.42" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: extracting PCRE2 regex library" >&5 +printf "%s\n" "extracting PCRE2 regex library" >&6; } cur_dir=`pwd` cd extras rm -rf pcre2-$pcre2_version pcre2 @@ -7523,23 +8073,26 @@ else cp pcre2.tar.gz.bak pcre2.tar.gz tar xf pcre2.tar fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: configuring PCRE2 regex library" >&5 -$as_echo "configuring PCRE2 regex library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: configuring PCRE2 regex library" >&5 +printf "%s\n" "configuring PCRE2 regex library" >&6; } cd pcre2-$pcre2_version ./configure --enable-jit --enable-shared --prefix=$cur_dir/extras/pcre2 --libdir=$PRIVATELIBDIR || exit 1 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling PCRE2 regex library" >&5 -$as_echo "compiling PCRE2 regex library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling PCRE2 regex library" >&5 +printf "%s\n" "compiling PCRE2 regex library" >&6; } $ac_cv_prog_MAKER || exit 1 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: installing PCRE2 regex library" >&5 -$as_echo "installing PCRE2 regex library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: installing PCRE2 regex library" >&5 +printf "%s\n" "installing PCRE2 regex library" >&6; } +rm -f "$PRIVATELIBDIR/"libpcre2* $ac_cv_prog_MAKER install || exit 1 PCRE2_CFLAGS="-I$cur_dir/extras/pcre2/include" PCRE2_LIBS= -if test -n "$ac_cv_path_PKGCONFIG"; then : +if test -n "$ac_cv_path_PKGCONFIG" +then : PCRE2_LIBS="`$ac_cv_path_PKGCONFIG --libs libpcre2-8.pc`" fi -if test -z "$PCRE2_LIBS"; then : +if test -z "$PCRE2_LIBS" +then : PCRE2_LIBS="$PRIVATELIBDIR/libpcre2-8.so" fi @@ -7548,21 +8101,22 @@ cd $cur_dir fi has_system_argon2="no" -if test "x$with_system_argon2" = "xyes"; then : +if test "x$with_system_argon2" = "xyes" +then : pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARGON2" >&5 -$as_echo_n "checking for ARGON2... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ARGON2" >&5 +printf %s "checking for ARGON2... " >&6; } if test -n "$ARGON2_CFLAGS"; then pkg_cv_ARGON2_CFLAGS="$ARGON2_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 0~20161029\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 0~20161029\""; } >&5 ($PKG_CONFIG --exists --print-errors "libargon2 >= 0~20161029") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ARGON2_CFLAGS=`$PKG_CONFIG --cflags "libargon2 >= 0~20161029" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7576,10 +8130,10 @@ if test -n "$ARGON2_LIBS"; then pkg_cv_ARGON2_LIBS="$ARGON2_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 0~20161029\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 0~20161029\""; } >&5 ($PKG_CONFIG --exists --print-errors "libargon2 >= 0~20161029") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_ARGON2_LIBS=`$PKG_CONFIG --libs "libargon2 >= 0~20161029" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7593,8 +8147,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -7611,43 +8165,45 @@ fi has_system_argon2=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } has_system_argon2=no else ARGON2_CFLAGS=$pkg_cv_ARGON2_CFLAGS ARGON2_LIBS=$pkg_cv_ARGON2_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } has_system_argon2=yes -if test "x$PRIVATELIBDIR" != "x"; then : +if test "x$PRIVATELIBDIR" != "x" +then : rm -f "$PRIVATELIBDIR/"libargon2* fi fi fi -if test "$has_system_argon2" = "no"; then : +if test "$has_system_argon2" = "no" +then : -argon2_version="20181209" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: extracting Argon2 library" >&5 -$as_echo "extracting Argon2 library" >&6; } +argon2_version="20190702" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: extracting Argon2 library" >&5 +printf "%s\n" "extracting Argon2 library" >&6; } cur_dir=`pwd` cd extras rm -rf argon2-$argon2_version argon2 if test "x$ac_cv_path_GUNZIP" = "x" ; then - tar xfz argon2-$argon2_version.tar.gz + tar xfz argon2.tar.gz else - cp argon2-$argon2_version.tar.gz argon2-$argon2_version.tar.gz.bak - gunzip -f argon2-$argon2_version.tar.gz - cp argon2-$argon2_version.tar.gz.bak argon2-$argon2_version.tar.gz - tar xf argon2-$argon2_version.tar + cp argon2.tar.gz argon2.tar.gz.bak + gunzip -f argon2.tar.gz + cp argon2.tar.gz.bak argon2.tar.gz + tar xf argon2.tar fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling Argon2 library" >&5 -$as_echo "compiling Argon2 library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling Argon2 library" >&5 +printf "%s\n" "compiling Argon2 library" >&6; } cd argon2-$argon2_version $ac_cv_prog_MAKER || exit 1 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: installing Argon2 library" >&5 -$as_echo "installing Argon2 library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: installing Argon2 library" >&5 +printf "%s\n" "installing Argon2 library" >&6; } $ac_cv_prog_MAKER install PREFIX=$cur_dir/extras/argon2 || exit 1 # We need to manually copy the libs to PRIVATELIBDIR because # there is no way to tell make install in libargon2 to do so. @@ -7666,21 +8222,22 @@ cd $cur_dir fi has_system_sodium="no" -if test "x$with_system_sodium" = "xyes"; then : +if test "x$with_system_sodium" = "xyes" +then : pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SODIUM" >&5 -$as_echo_n "checking for SODIUM... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SODIUM" >&5 +printf %s "checking for SODIUM... " >&6; } if test -n "$SODIUM_CFLAGS"; then pkg_cv_SODIUM_CFLAGS="$SODIUM_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsodium >= 1.0.16\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsodium >= 1.0.16\""; } >&5 ($PKG_CONFIG --exists --print-errors "libsodium >= 1.0.16") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SODIUM_CFLAGS=`$PKG_CONFIG --cflags "libsodium >= 1.0.16" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7694,10 +8251,10 @@ if test -n "$SODIUM_LIBS"; then pkg_cv_SODIUM_LIBS="$SODIUM_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsodium >= 1.0.16\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsodium >= 1.0.16\""; } >&5 ($PKG_CONFIG --exists --print-errors "libsodium >= 1.0.16") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SODIUM_LIBS=`$PKG_CONFIG --libs "libsodium >= 1.0.16" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7711,8 +8268,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -7729,26 +8286,28 @@ fi has_system_sodium=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } has_system_sodium=no else SODIUM_CFLAGS=$pkg_cv_SODIUM_CFLAGS SODIUM_LIBS=$pkg_cv_SODIUM_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } has_system_sodium=yes -if test "x$PRIVATELIBDIR" != "x"; then : +if test "x$PRIVATELIBDIR" != "x" +then : rm -f "$PRIVATELIBDIR/"libsodium* fi fi fi -if test "$has_system_sodium" = "no"; then : +if test "$has_system_sodium" = "no" +then : sodium_version="1.0.18" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: extracting sodium library" >&5 -$as_echo "extracting sodium library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: extracting sodium library" >&5 +printf "%s\n" "extracting sodium library" >&6; } cur_dir=`pwd` cd extras rm -rf sodium-$sodium_version sodium @@ -7760,27 +8319,30 @@ else cp libsodium.tar.gz.bak libsodium.tar.gz tar xf libsodium.tar fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling sodium library" >&5 -$as_echo "compiling sodium library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling sodium library" >&5 +printf "%s\n" "compiling sodium library" >&6; } cd libsodium-$sodium_version save_cflags="$CFLAGS" CFLAGS="$orig_cflags" export CFLAGS ./configure --prefix=$cur_dir/extras/sodium --libdir=$PRIVATELIBDIR --enable-shared --disable-static --enable-opt || exit 1 CFLAGS="$save_cflags" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling sodium resolver library" >&5 -$as_echo "compiling sodium resolver library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling sodium resolver library" >&5 +printf "%s\n" "compiling sodium resolver library" >&6; } $ac_cv_prog_MAKER || exit 1 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: installing sodium resolver library" >&5 -$as_echo "installing sodium resolver library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: installing sodium resolver library" >&5 +printf "%s\n" "installing sodium resolver library" >&6; } +rm -f "$PRIVATELIBDIR/"libsodium* $ac_cv_prog_MAKER install || exit 1 SODIUM_CFLAGS="-I$cur_dir/extras/sodium/include" SODIUM_LIBS= -if test -n "$ac_cv_path_PKGCONFIG"; then : +if test -n "$ac_cv_path_PKGCONFIG" +then : SODIUM_LIBS="`$ac_cv_path_PKGCONFIG --libs libsodium.pc`" fi -if test -z "$SODIUM_LIBS"; then : +if test -z "$SODIUM_LIBS" +then : SODIUM_LIBS="-L$PRIVATELIBDIR -lsodium" fi @@ -7789,21 +8351,22 @@ cd $cur_dir fi has_system_cares="no" -if test "x$with_system_cares" = "xyes"; then : +if test "x$with_system_cares" = "xyes" +then : pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CARES" >&5 -$as_echo_n "checking for CARES... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CARES" >&5 +printf %s "checking for CARES... " >&6; } if test -n "$CARES_CFLAGS"; then pkg_cv_CARES_CFLAGS="$CARES_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares >= 1.6.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares >= 1.6.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libcares >= 1.6.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CARES_CFLAGS=`$PKG_CONFIG --cflags "libcares >= 1.6.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7817,10 +8380,10 @@ if test -n "$CARES_LIBS"; then pkg_cv_CARES_LIBS="$CARES_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares >= 1.6.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcares >= 1.6.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libcares >= 1.6.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CARES_LIBS=`$PKG_CONFIG --libs "libcares >= 1.6.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7834,8 +8397,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -7852,26 +8415,28 @@ fi has_system_cares=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } has_system_cares=no else CARES_CFLAGS=$pkg_cv_CARES_CFLAGS CARES_LIBS=$pkg_cv_CARES_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } has_system_cares=yes -if test "x$PRIVATELIBDIR" != "x"; then : +if test "x$PRIVATELIBDIR" != "x" +then : rm -f "$PRIVATELIBDIR/"libcares* fi fi fi -if test "$has_system_cares" = "no"; then : +if test "$has_system_cares" = "no" +then : -cares_version="1.18.1" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: extracting c-ares resolver library" >&5 -$as_echo "extracting c-ares resolver library" >&6; } +cares_version="1.19.0" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: extracting c-ares resolver library" >&5 +printf "%s\n" "extracting c-ares resolver library" >&6; } cur_dir=`pwd` cd extras rm -rf c-ares-$cares_version c-ares @@ -7883,19 +8448,20 @@ else cp c-ares.tar.gz.bak c-ares.tar.gz tar xf c-ares.tar fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: configuring c-ares library" >&5 -$as_echo "configuring c-ares library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: configuring c-ares library" >&5 +printf "%s\n" "configuring c-ares library" >&6; } cd c-ares-$cares_version save_cflags="$CFLAGS" CFLAGS="$orig_cflags" export CFLAGS ./configure --prefix=$cur_dir/extras/c-ares --libdir=$PRIVATELIBDIR --enable-shared --disable-tests || exit 1 CFLAGS="$save_cflags" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling c-ares resolver library" >&5 -$as_echo "compiling c-ares resolver library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling c-ares resolver library" >&5 +printf "%s\n" "compiling c-ares resolver library" >&6; } $ac_cv_prog_MAKER || exit 1 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: installing c-ares resolver library" >&5 -$as_echo "installing c-ares resolver library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: installing c-ares resolver library" >&5 +printf "%s\n" "installing c-ares resolver library" >&6; } +rm -f "$PRIVATELIBDIR/"libcares* $ac_cv_prog_MAKER install || exit 1 CARES_CFLAGS="-I$cur_dir/extras/c-ares/include" @@ -7931,21 +8497,22 @@ cd $cur_dir fi has_system_jansson="no" -if test "x$with_system_jansson" = "xyes"; then : +if test "x$with_system_jansson" = "xyes" +then : pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for JANSSON" >&5 -$as_echo_n "checking for JANSSON... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for JANSSON" >&5 +printf %s "checking for JANSSON... " >&6; } if test -n "$JANSSON_CFLAGS"; then pkg_cv_JANSSON_CFLAGS="$JANSSON_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson >= 2.0.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson >= 2.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "jansson >= 2.0.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JANSSON_CFLAGS=`$PKG_CONFIG --cflags "jansson >= 2.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7959,10 +8526,10 @@ if test -n "$JANSSON_LIBS"; then pkg_cv_JANSSON_LIBS="$JANSSON_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson >= 2.0.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"jansson >= 2.0.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "jansson >= 2.0.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JANSSON_LIBS=`$PKG_CONFIG --libs "jansson >= 2.0.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -7976,8 +8543,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -7994,26 +8561,28 @@ fi has_system_jansson=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } has_system_jansson=no else JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS JANSSON_LIBS=$pkg_cv_JANSSON_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } has_system_jansson=yes -if test "x$PRIVATELIBDIR" != "x"; then : +if test "x$PRIVATELIBDIR" != "x" +then : rm -f "$PRIVATELIBDIR/"libjansson* fi fi fi -if test "$has_system_jansson" = "no"; then : +if test "$has_system_jansson" = "no" +then : -jansson_version="2.13.1" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: extracting jansson library" >&5 -$as_echo "extracting jansson library" >&6; } +jansson_version="2.14" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: extracting jansson library" >&5 +printf "%s\n" "extracting jansson library" >&6; } cur_dir=`pwd` cd extras rm -rf jansson-$jansson_version jansson @@ -8025,27 +8594,30 @@ else cp jansson.tar.gz.bak jansson.tar.gz tar xf jansson.tar fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling jansson library" >&5 -$as_echo "compiling jansson library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling jansson library" >&5 +printf "%s\n" "compiling jansson library" >&6; } cd jansson-$jansson_version save_cflags="$CFLAGS" CFLAGS="$orig_cflags" export CFLAGS -./configure --prefix=$cur_dir/extras/jansson --libdir=$PRIVATELIBDIR --enable-shared --disable-static --enable-opt || exit 1 +./configure --prefix=$cur_dir/extras/jansson --libdir=$PRIVATELIBDIR --enable-shared --disable-static || exit 1 CFLAGS="$save_cflags" -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling jansson resolver library" >&5 -$as_echo "compiling jansson resolver library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling jansson resolver library" >&5 +printf "%s\n" "compiling jansson resolver library" >&6; } $ac_cv_prog_MAKER || exit 1 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: installing jansson resolver library" >&5 -$as_echo "installing jansson resolver library" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: installing jansson resolver library" >&5 +printf "%s\n" "installing jansson resolver library" >&6; } +rm -f "$PRIVATELIBDIR/"libjansson* $ac_cv_prog_MAKER install || exit 1 JANSSON_CFLAGS="-I$cur_dir/extras/jansson/include" JANSSON_LIBS= -if test -n "$ac_cv_path_PKGCONFIG"; then : +if test -n "$ac_cv_path_PKGCONFIG" +then : JANSSON_LIBS="`$ac_cv_path_PKGCONFIG --libs jansson.pc`" fi -if test -z "$JANSSON_LIBS"; then : +if test -z "$JANSSON_LIBS" +then : JANSSON_LIBS="-L$PRIVATELIBDIR -ljansson" fi @@ -8054,26 +8626,30 @@ cd $cur_dir fi -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop ac_build_alias=$build_alias test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; @@ -8092,21 +8668,22 @@ IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; @@ -8147,33 +8724,31 @@ if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 -$as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5 +printf %s "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif char pthread_join (); int -main () +main (void) { return pthread_join (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_pthread_ok=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 -$as_echo "$ax_pthread_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +printf "%s\n" "$ax_pthread_ok" >&6; } if test x"$ax_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" @@ -8237,8 +8812,8 @@ esac # -Werror. We throw in some extra Clang-specific options to ensure that # this doesn't happen for GCC, which also accepts -Werror. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if compiler needs -Werror to reject unknown flags" >&5 -$as_echo_n "checking if compiler needs -Werror to reject unknown flags... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler needs -Werror to reject unknown flags" >&5 +printf %s "checking if compiler needs -Werror to reject unknown flags... " >&6; } save_CFLAGS="$CFLAGS" ax_pthread_extra_flags="-Werror" CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument" @@ -8246,22 +8821,23 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo(void); int -main () +main (void) { foo() ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else +if ac_fn_c_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop ax_pthread_extra_flags= - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext CFLAGS="$save_CFLAGS" if test x"$ax_pthread_ok" = xno; then @@ -8269,24 +8845,25 @@ for flag in $ax_pthread_flags; do case $flag in none) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 -$as_echo_n "checking whether pthreads work without any flags... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5 +printf %s "checking whether pthreads work without any flags... " >&6; } ;; -*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 -$as_echo_n "checking whether pthreads work with $flag... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5 +printf %s "checking whether pthreads work with $flag... " >&6; } PTHREAD_CFLAGS="$flag" ;; pthread-config) # Extract the first word of "pthread-config", so it can be a program name with args. set dummy pthread-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ax_pthread_config+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ax_pthread_config+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$ax_pthread_config"; then ac_cv_prog_ax_pthread_config="$ax_pthread_config" # Let the user override the test. else @@ -8294,11 +8871,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_ax_pthread_config="yes" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8310,11 +8891,11 @@ fi fi ax_pthread_config=$ac_cv_prog_ax_pthread_config if test -n "$ax_pthread_config"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 -$as_echo "$ax_pthread_config" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_config" >&5 +printf "%s\n" "$ax_pthread_config" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8324,8 +8905,8 @@ fi ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 -$as_echo_n "checking for the pthreads library -l$flag... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5 +printf %s "checking for the pthreads library -l$flag... " >&6; } PTHREAD_LIBS="-l$flag" ;; esac @@ -8350,7 +8931,7 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; } static void routine(void *a) { a = 0; } static void *start_routine(void *a) { return a; } int -main () +main (void) { pthread_t th; pthread_attr_t attr; pthread_create(&th, 0, start_routine, 0); @@ -8362,17 +8943,18 @@ pthread_t th; pthread_attr_t attr; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_pthread_ok=yes fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 -$as_echo "$ax_pthread_ok" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_pthread_ok" >&5 +printf "%s\n" "$ax_pthread_ok" >&6; } if test "x$ax_pthread_ok" = xyes; then break; fi @@ -8390,39 +8972,38 @@ if test "x$ax_pthread_ok" = xyes; then CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 -$as_echo_n "checking for joinable pthread attribute... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5 +printf %s "checking for joinable pthread attribute... " >&6; } attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { int attr = $attr; return attr /* ; */ ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : attr_name=$attr; break fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 -$as_echo "$attr_name" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5 +printf "%s\n" "$attr_name" >&6; } if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then -cat >>confdefs.h <<_ACEOF -#define PTHREAD_CREATE_JOINABLE $attr_name -_ACEOF +printf "%s\n" "#define PTHREAD_CREATE_JOINABLE $attr_name" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 -$as_echo_n "checking if more special flags are required for pthreads... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5 +printf %s "checking if more special flags are required for pthreads... " >&6; } flag=no case ${host_os} in aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";; @@ -8436,43 +9017,46 @@ $as_echo_n "checking if more special flags are required for pthreads... " >&6; } fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $flag" >&5 -$as_echo "$flag" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $flag" >&5 +printf "%s\n" "$flag" >&6; } if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 -$as_echo_n "checking for PTHREAD_PRIO_INHERIT... " >&6; } -if ${ax_cv_PTHREAD_PRIO_INHERIT+:} false; then : - $as_echo_n "(cached) " >&6 -else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_PRIO_INHERIT" >&5 +printf %s "checking for PTHREAD_PRIO_INHERIT... " >&6; } +if test ${ax_cv_PTHREAD_PRIO_INHERIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int -main () +main (void) { int i = PTHREAD_PRIO_INHERIT; ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_c_try_link "$LINENO" +then : ax_cv_PTHREAD_PRIO_INHERIT=yes -else +else $as_nop ax_cv_PTHREAD_PRIO_INHERIT=no fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 -$as_echo "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } - if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"; then : +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_PTHREAD_PRIO_INHERIT" >&5 +printf "%s\n" "$ax_cv_PTHREAD_PRIO_INHERIT" >&6; } + if test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" +then : -$as_echo "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h +printf "%s\n" "#define HAVE_PTHREAD_PRIO_INHERIT 1" >>confdefs.h fi @@ -8488,7 +9072,8 @@ fi #handle absolute path differently from PATH based program lookup case "x$CC" in #( x/*) : - if as_fn_executable_p ${CC}_r; then : + if as_fn_executable_p ${CC}_r +then : PTHREAD_CC="${CC}_r" fi ;; #( *) : @@ -8496,11 +9081,12 @@ fi ;; #( do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PTHREAD_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_PTHREAD_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop if test -n "$PTHREAD_CC"; then ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test. else @@ -8508,11 +9094,15 @@ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then ac_cv_prog_PTHREAD_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -8523,11 +9113,11 @@ fi fi PTHREAD_CC=$ac_cv_prog_PTHREAD_CC if test -n "$PTHREAD_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 -$as_echo "$PTHREAD_CC" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5 +printf "%s\n" "$PTHREAD_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi @@ -8553,7 +9143,7 @@ test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$ax_pthread_ok" = xyes; then -$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h +printf "%s\n" "#define HAVE_PTHREAD 1" >>confdefs.h : else @@ -8570,30 +9160,34 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --enable-libcurl was given. -if test "${enable_libcurl+set}" = set; then : +if test ${enable_libcurl+y} +then : enableval=$enable_libcurl; enable_curl=$enableval -else +else $as_nop enable_curl=no fi - if test "x$enable_curl" != "xno"; then : + if test "x$enable_curl" != "xno" +then : CURLCONFIG="curl-config" - if test "x$enable_curl" != "xyes"; then : + if test "x$enable_curl" != "xyes" +then : CURLCONFIG="$enable_curl/bin/curl-config" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking $CURLCONFIG" >&5 -$as_echo_n "checking $CURLCONFIG... " >&6; } - if $CURLCONFIG --version 2>/dev/null >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking $CURLCONFIG" >&5 +printf %s "checking $CURLCONFIG... " >&6; } + if $CURLCONFIG --version 2>/dev/null >/dev/null +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Could not find curl-config, try editing --enable-libcurl See \`config.log' for more details" "$LINENO" 5; } fi @@ -8601,19 +9195,22 @@ fi CURLCFLAG="`$CURLCONFIG --cflags`" CURLLIBS="`$CURLCONFIG --libs`" - if $CURLCONFIG --libs | grep -q -e ares; then : + if $CURLCONFIG --libs | grep -q -e ares +then : CURLUSESCARES="1" -else +else $as_nop CURLUSESCARES="0" fi - if test -z "${CURLLIBS}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: CURLLIBS is empty, that probably means that I could not find $enable_curl/bin/curl-config" >&5 -$as_echo "$as_me: WARNING: CURLLIBS is empty, that probably means that I could not find $enable_curl/bin/curl-config" >&2;} + if test -z "${CURLLIBS}" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: CURLLIBS is empty, that probably means that I could not find $enable_curl/bin/curl-config" >&5 +printf "%s\n" "$as_me: WARNING: CURLLIBS is empty, that probably means that I could not find $enable_curl/bin/curl-config" >&2;} fi - if test "x$has_system_cares" = "xno" && test "x$BUILDDIR/extras/curl" != "x$enable_curl" && test "$CURLUSESCARES" != "0" ; then : + if test "x$has_system_cares" = "xno" && test "x$BUILDDIR/extras/curl" != "x$enable_curl" && test "$CURLUSESCARES" != "0" +then : as_fn_error $? " @@ -8624,7 +9221,7 @@ fi with the system-installed libcURL, this is a bad idea which may result in error messages looking like: - \`\`[error] unrealircd.conf:9: include: error downloading '(http://example.net/ex.conf)': Could not resolve host: example.net (Successful completion)'' + error downloading ... Could not resolve host: example.net (Successful completion) Or UnrealIRCd might even crash. @@ -8636,11 +9233,11 @@ fi IRCDLIBS="$IRCDLIBS $CURLLIBS" CFLAGS="$CFLAGS $CURLCFLAG" -$as_echo "#define USE_LIBCURL /**/" >>confdefs.h +printf "%s\n" "#define USE_LIBCURL /**/" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking curl_easy_init() in $CURLLIBS" >&5 -$as_echo_n "checking curl_easy_init() in $CURLLIBS... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking curl_easy_init() in $CURLLIBS" >&5 +printf %s "checking curl_easy_init() in $CURLLIBS... " >&6; } LIBS_SAVEDA="$LIBS" CFLAGS_SAVEDA="$CFLAGS" @@ -8651,7 +9248,7 @@ $as_echo_n "checking curl_easy_init() in $CURLLIBS... " >&6; } #include int -main () +main (void) { CURL *curl = curl_easy_init(); ; @@ -8659,26 +9256,27 @@ CURL *curl = curl_easy_init(); } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +if ac_fn_c_try_link "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "You asked for libcURL (remote includes) support, but it can't be found at $enable_curl See \`config.log' for more details" "$LINENO" 5; } fi -rm -f core conftest.err conftest.$ac_objext \ +rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext LIBS="$LIBS_SAVEDA" CFLAGS="$CFLAGS_SAVEDA" URL="url_curl.o" -else +else $as_nop URL="url_unreal.o" @@ -8687,29 +9285,31 @@ fi # Check whether --enable-geoip_classic was given. -if test "${enable_geoip_classic+set}" = set; then : +if test ${enable_geoip_classic+y} +then : enableval=$enable_geoip_classic; enable_geoip_classic=$enableval -else +else $as_nop enable_geoip_classic=no fi - if test "x$enable_geoip_classic" = "xyes"; then : + if test "x$enable_geoip_classic" = "xyes" +then : has_system_geoip_classic="no" pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GEOIP_CLASSIC" >&5 -$as_echo_n "checking for GEOIP_CLASSIC... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GEOIP_CLASSIC" >&5 +printf %s "checking for GEOIP_CLASSIC... " >&6; } if test -n "$GEOIP_CLASSIC_CFLAGS"; then pkg_cv_GEOIP_CLASSIC_CFLAGS="$GEOIP_CLASSIC_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"geoip >= 1.6.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"geoip >= 1.6.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "geoip >= 1.6.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GEOIP_CLASSIC_CFLAGS=`$PKG_CONFIG --cflags "geoip >= 1.6.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -8723,10 +9323,10 @@ if test -n "$GEOIP_CLASSIC_LIBS"; then pkg_cv_GEOIP_CLASSIC_LIBS="$GEOIP_CLASSIC_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"geoip >= 1.6.0\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"geoip >= 1.6.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "geoip >= 1.6.0") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GEOIP_CLASSIC_LIBS=`$PKG_CONFIG --libs "geoip >= 1.6.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -8740,8 +9340,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -8758,25 +9358,27 @@ fi has_system_geoip_classic=no elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } has_system_geoip_classic=no else GEOIP_CLASSIC_CFLAGS=$pkg_cv_GEOIP_CLASSIC_CFLAGS GEOIP_CLASSIC_LIBS=$pkg_cv_GEOIP_CLASSIC_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } has_system_geoip_classic=yes - if test "x$PRIVATELIBDIR" != "x"; then : + if test "x$PRIVATELIBDIR" != "x" +then : rm -f "$PRIVATELIBDIR/"libGeoIP.* fi fi - if test "$has_system_geoip_classic" = "no"; then : + if test "$has_system_geoip_classic" = "no" +then : geoip_classic_version="1.6.12" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: extracting GeoIP Classic library" >&5 -$as_echo "extracting GeoIP Classic library" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: extracting GeoIP Classic library" >&5 +printf "%s\n" "extracting GeoIP Classic library" >&6; } cur_dir=`pwd` cd extras rm -rf GeoIP-$geoip_classic_version geoip-classic @@ -8788,25 +9390,28 @@ $as_echo "extracting GeoIP Classic library" >&6; } cp geoip-classic.tar.gz.bak geoip-classic.tar.gz tar xf geoip-classic.tar fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: configuring GeoIP Classic library" >&5 -$as_echo "configuring GeoIP Classic library" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: configuring GeoIP Classic library" >&5 +printf "%s\n" "configuring GeoIP Classic library" >&6; } cd GeoIP-$geoip_classic_version save_cflags="$CFLAGS" CFLAGS="$orig_cflags" export CFLAGS ./configure --prefix=$cur_dir/extras/geoip-classic --libdir=$PRIVATELIBDIR --enable-shared --disable-static || exit 1 CFLAGS="$save_cflags" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: compiling GeoIP Classic library" >&5 -$as_echo "compiling GeoIP Classic library" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: compiling GeoIP Classic library" >&5 +printf "%s\n" "compiling GeoIP Classic library" >&6; } $ac_cv_prog_MAKER || exit 1 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: installing GeoIP Classic library" >&5 -$as_echo "installing GeoIP Classic library" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: installing GeoIP Classic library" >&5 +printf "%s\n" "installing GeoIP Classic library" >&6; } + rm -f "$PRIVATELIBDIR/"libGeoIP.so* $ac_cv_prog_MAKER install || exit 1 - if test -n "$ac_cv_path_PKGCONFIG"; then : + if test -n "$ac_cv_path_PKGCONFIG" +then : GEOIP_CLASSIC_LIBS="`$ac_cv_path_PKGCONFIG --libs geoip.pc`" GEOIP_CLASSIC_CFLAGS="`$ac_cv_path_PKGCONFIG --cflags geoip.pc`" fi - if test -z "$GEOIP_CLASSIC_LIBS"; then : + if test -z "$GEOIP_CLASSIC_LIBS" +then : GEOIP_CLASSIC_LIBS="-L$PRIVATELIBDIR -lGeoIP" GEOIP_CLASSIC_CFLAGS="-I$cur_dir/extras/geoip-classic/include" fi @@ -8824,29 +9429,31 @@ fi # Check whether --enable-libmaxminddb was given. -if test "${enable_libmaxminddb+set}" = set; then : +if test ${enable_libmaxminddb+y} +then : enableval=$enable_libmaxminddb; enable_libmaxminddb=$enableval -else +else $as_nop enable_libmaxminddb=no fi - if test "x$enable_libmaxminddb" = "xyes"; then : + if test "x$enable_libmaxminddb" = "xyes" +then : has_system_libmaxminddb="no" pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBMAXMINDDB" >&5 -$as_echo_n "checking for LIBMAXMINDDB... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBMAXMINDDB" >&5 +printf %s "checking for LIBMAXMINDDB... " >&6; } if test -n "$LIBMAXMINDDB_CFLAGS"; then pkg_cv_LIBMAXMINDDB_CFLAGS="$LIBMAXMINDDB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb >= 1.4.3\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb >= 1.4.3\""; } >&5 ($PKG_CONFIG --exists --print-errors "libmaxminddb >= 1.4.3") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBMAXMINDDB_CFLAGS=`$PKG_CONFIG --cflags "libmaxminddb >= 1.4.3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -8860,10 +9467,10 @@ if test -n "$LIBMAXMINDDB_LIBS"; then pkg_cv_LIBMAXMINDDB_LIBS="$LIBMAXMINDDB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb >= 1.4.3\""; } >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libmaxminddb >= 1.4.3\""; } >&5 ($PKG_CONFIG --exists --print-errors "libmaxminddb >= 1.4.3") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBMAXMINDDB_LIBS=`$PKG_CONFIG --libs "libmaxminddb >= 1.4.3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes @@ -8877,8 +9484,8 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -8904,10 +9511,10 @@ Alternatively, you may set the environment variables LIBMAXMINDDB_CFLAGS and LIBMAXMINDDB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. @@ -8921,11 +9528,12 @@ See \`config.log' for more details" "$LINENO" 5; } else LIBMAXMINDDB_CFLAGS=$pkg_cv_LIBMAXMINDDB_CFLAGS LIBMAXMINDDB_LIBS=$pkg_cv_LIBMAXMINDDB_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } has_system_libmaxminddb=yes fi - if test "x$has_system_libmaxminddb" = "xyes"; then : + if test "x$has_system_libmaxminddb" = "xyes" +then : @@ -8954,7 +9562,7 @@ fi -ac_config_files="$ac_config_files Makefile src/Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/extbans/Makefile src/modules/third/Makefile extras/unrealircd-upgrade-script unrealircd" +ac_config_files="$ac_config_files Makefile src/Makefile src/modules/Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/extbans/Makefile src/modules/rpc/Makefile src/modules/third/Makefile extras/unrealircd-upgrade-script unrealircd" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -8983,8 +9591,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -9014,15 +9622,15 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; /^ac_cv_env_/b end t clear :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else @@ -9036,8 +9644,8 @@ $as_echo "$as_me: updating cache $cache_file" >&6;} fi fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -9054,7 +9662,7 @@ U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -9070,8 +9678,8 @@ LTLIBOBJS=$ac_ltlibobjs ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL @@ -9094,14 +9702,16 @@ cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST -else +else $as_nop case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( @@ -9111,46 +9721,46 @@ esac fi + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. as_nl=' ' export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi # The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then +if ${PATH_SEPARATOR+false} :; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || @@ -9159,13 +9769,6 @@ if test "${PATH_SEPARATOR+set}" != set; then fi -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( @@ -9174,8 +9777,12 @@ case $0 in #(( for as_dir in $PATH do IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break done IFS=$as_save_IFS @@ -9187,30 +9794,10 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] @@ -9223,13 +9810,14 @@ as_fn_error () as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi - $as_echo "$as_me: error: $2" >&2 + printf "%s\n" "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error + # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. @@ -9256,18 +9844,20 @@ as_fn_unset () { eval $1=; unset $1;} } as_unset=as_fn_unset + # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : eval 'as_fn_append () { eval $1+=\$2 }' -else +else $as_nop as_fn_append () { eval $1=\$$1\$2 @@ -9279,12 +9869,13 @@ fi # as_fn_append # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : eval 'as_fn_arith () { as_val=$(( $* )) }' -else +else $as_nop as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` @@ -9315,7 +9906,7 @@ as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +printf "%s\n" X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -9337,6 +9928,10 @@ as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) @@ -9350,6 +9945,12 @@ case `echo -n x` in #((((( ECHO_N='-n';; esac +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file @@ -9391,7 +9992,7 @@ as_fn_mkdir_p () as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -9400,7 +10001,7 @@ $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +printf "%s\n" X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -9462,8 +10063,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by unrealircd $as_me 6.0.4.2, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by unrealircd $as_me 6.1.0, which was +generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -9522,14 +10123,16 @@ Report bugs to . unrealircd home page: ." _ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -unrealircd config.status 6.0.4.2 -configured by $0, generated by GNU Autoconf 2.69, +unrealircd config.status 6.1.0 +configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2021 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -9566,15 +10169,15 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + printf "%s\n" "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; + printf "%s\n" "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" @@ -9582,7 +10185,7 @@ do --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; @@ -9591,7 +10194,7 @@ do as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + printf "%s\n" "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; @@ -9619,7 +10222,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" @@ -9633,7 +10236,7 @@ exec 5>>config.log sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + printf "%s\n" "$ac_log" } >&5 _ACEOF @@ -9653,6 +10256,7 @@ do "src/modules/chanmodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/chanmodes/Makefile" ;; "src/modules/usermodes/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/usermodes/Makefile" ;; "src/modules/extbans/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/extbans/Makefile" ;; + "src/modules/rpc/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/rpc/Makefile" ;; "src/modules/third/Makefile") CONFIG_FILES="$CONFIG_FILES src/modules/third/Makefile" ;; "extras/unrealircd-upgrade-script") CONFIG_FILES="$CONFIG_FILES extras/unrealircd-upgrade-script" ;; "unrealircd") CONFIG_FILES="$CONFIG_FILES unrealircd" ;; @@ -9667,8 +10271,8 @@ done # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test ${CONFIG_FILES+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree @@ -10004,7 +10608,7 @@ do esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done @@ -10012,17 +10616,17 @@ do # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | + ac_sed_conf_input=`printf "%s\n" "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac @@ -10039,7 +10643,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +printf "%s\n" X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -10063,9 +10667,9 @@ $as_echo X"$ac_file" | case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -10118,8 +10722,8 @@ ac_sed_dataroot=' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' @@ -10161,9 +10765,9 @@ test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" @@ -10179,20 +10783,20 @@ which seems to be undefined. Please make sure it is defined" >&2;} # if test x"$ac_file" != x-; then { - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else - $as_echo "/* $configure_input */" \ + printf "%s\n" "/* $configure_input */" >&1 \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi @@ -10233,8 +10837,9 @@ if test "$no_create" != yes; then $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi chmod 0700 unrealircd + diff --git a/configure.ac b/configure.ac index 1873c89..f441e4e 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ dnl src/windows/unrealinst.iss dnl doc/Config.header dnl src/version.c.SH -AC_INIT([unrealircd], [6.0.4.2], [https://bugs.unrealircd.org/], [], [https://unrealircd.org/]) +AC_INIT([unrealircd], [6.1.0], [https://bugs.unrealircd.org/], [], [https://unrealircd.org/]) AC_CONFIG_SRCDIR([src/ircd.c]) AC_CONFIG_HEADER([include/setup.h]) AC_CONFIG_AUX_DIR([autoconf]) @@ -30,17 +30,17 @@ UNREAL_VERSION_GENERATION=["6"] AC_DEFINE_UNQUOTED([UNREAL_VERSION_GENERATION], [$UNREAL_VERSION_GENERATION], [Generation version number (e.g.: X for X.Y.Z)]) # Major version number (e.g.: Y in X.Y.Z) -UNREAL_VERSION_MAJOR=["0"] +UNREAL_VERSION_MAJOR=["1"] AC_DEFINE_UNQUOTED([UNREAL_VERSION_MAJOR], [$UNREAL_VERSION_MAJOR], [Major version number (e.g.: Y for X.Y.Z)]) # Minor version number (e.g.: Z in X.Y.Z) -UNREAL_VERSION_MINOR=["4"] +UNREAL_VERSION_MINOR=["0"] AC_DEFINE_UNQUOTED([UNREAL_VERSION_MINOR], [$UNREAL_VERSION_MINOR], [Minor version number (e.g.: Z for X.Y.Z)]) # The version suffix such as a beta marker or release candidate # marker. (e.g.: -rcX for unrealircd-3.2.9-rcX). This macro is a # string instead of an integer because it contains arbitrary data. -UNREAL_VERSION_SUFFIX=[".2"] +UNREAL_VERSION_SUFFIX=[""] AC_DEFINE_UNQUOTED([UNREAL_VERSION_SUFFIX], ["$UNREAL_VERSION_SUFFIX"], [Version suffix such as a beta marker or release candidate marker. (e.g.: -rcX for unrealircd-3.2.9-rcX)]) AC_PATH_PROG(RM,rm) @@ -257,6 +257,9 @@ check_cc_flag([-Wsign-compare], [CFLAGS="$CFLAGS -Wno-sign-compare"]) dnl Don't warn about empty body, we use this, eg via Debug(()) or in if's. check_cc_flag([-Wempty-body], [CFLAGS="$CFLAGS -Wno-empty-body"]) +dnl This warns about all our hook calls - RunHook() and others +check_cc_flag([-Wdeprecated-non-prototype], [CFLAGS="$CFLAGS -Wno-deprecated-non-prototype"]) + dnl Yeah this old clang version is a bit problematic dnl (ships in Ubuntu 16.04 for example) dnl -Wtautological-compare has false positives @@ -326,7 +329,7 @@ fi ]) AC_CACHE_CHECK(if your system prepends an underscore on symbols,ac_cv_underscore,[ cat >uscore.c << __EOF__ -int main() { +int main(void) { return 0; } __EOF__ @@ -354,7 +357,8 @@ AC_CACHE_CHECK([if your system has IPv6 support], [ac_cv_ip6], [ AC_TRY_RUN([ #include #include -int main() { +#include +int main(void) { int s = socket(AF_INET6, SOCK_STREAM, 0); exit(0); /* We only check if the code compiles, that's enough. We can deal with missing runtime IPv6 */ } @@ -405,6 +409,7 @@ AC_CHECK_FUNCS([setproctitle], AC_CHECK_FUNCS(explicit_bzero,AC_DEFINE([HAVE_EXPLICIT_BZERO], [], [Define if you have explicit_bzero])) AC_CHECK_FUNCS(syslog,AC_DEFINE([HAVE_SYSLOG], [], [Define if you have syslog])) +AC_CHECK_FUNCS(strnlen,AC_DEFINE([HAVE_STRNLEN], [], [Define if you have strnlen])) AC_SUBST(CRYPTOLIB) AC_SUBST(MODULEFLAGS) AC_SUBST(DYNAMIC_LDFLAGS) @@ -547,6 +552,7 @@ CHECK_SSL_CTX_SET_MIN_PROTO_VERSION CHECK_SSL_CTX_SET_SECURITY_LEVEL CHECK_ASN1_TIME_diff CHECK_X509_get0_notAfter +CHECK_X509_check_host AC_ARG_ENABLE(dynamic-linking, [AS_HELP_STRING([--disable-dynamic-linking], [Make the IRCd statically link with shared objects rather than dynamically (noone knows if disabling dynamic linking actually does anything or not)])], [enable_dynamic_linking=$enableval], [enable_dynamic_linking="yes"]) AS_IF([test $enable_dynamic_linking = "yes"], @@ -580,12 +586,12 @@ export PATH_SEPARATOR dnl Use system pcre2 when available, unless --without-system-pcre2. has_system_pcre2="no" AS_IF([test "x$with_system_pcre2" = "xyes"],[ -PKG_CHECK_MODULES([PCRE2], libpcre2-8 >= 10.00,[has_system_pcre2=yes +PKG_CHECK_MODULES([PCRE2], libpcre2-8 >= 10.36,[has_system_pcre2=yes AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libpcre2*])],[has_system_pcre2=no])]) AS_IF([test "$has_system_pcre2" = "no"], [ dnl REMEMBER TO CHANGE WITH A NEW PCRE2 RELEASE! -pcre2_version="10.39" +pcre2_version="10.42" AC_MSG_RESULT(extracting PCRE2 regex library) cur_dir=`pwd` cd extras @@ -606,6 +612,7 @@ cd pcre2-$pcre2_version AC_MSG_RESULT(compiling PCRE2 regex library) $ac_cv_prog_MAKER || exit 1 AC_MSG_RESULT(installing PCRE2 regex library) +rm -f "$PRIVATELIBDIR/"libpcre2* $ac_cv_prog_MAKER install || exit 1 PCRE2_CFLAGS="-I$cur_dir/extras/pcre2/include" AC_SUBST(PCRE2_CFLAGS) @@ -631,7 +638,7 @@ AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libargon2*])],[ha AS_IF([test "$has_system_argon2" = "no"],[ dnl REMEMBER TO CHANGE WITH A NEW ARGON2 RELEASE! -argon2_version="20181209" +argon2_version="20190702" AC_MSG_RESULT(extracting Argon2 library) cur_dir=`pwd` cd extras @@ -639,12 +646,12 @@ dnl remove old argon2 directory to force a recompile... dnl and remove its installation prefix just to clean things up. rm -rf argon2-$argon2_version argon2 if test "x$ac_cv_path_GUNZIP" = "x" ; then - tar xfz argon2-$argon2_version.tar.gz + tar xfz argon2.tar.gz else - cp argon2-$argon2_version.tar.gz argon2-$argon2_version.tar.gz.bak - gunzip -f argon2-$argon2_version.tar.gz - cp argon2-$argon2_version.tar.gz.bak argon2-$argon2_version.tar.gz - tar xf argon2-$argon2_version.tar + cp argon2.tar.gz argon2.tar.gz.bak + gunzip -f argon2.tar.gz + cp argon2.tar.gz.bak argon2.tar.gz + tar xf argon2.tar fi AC_MSG_RESULT(compiling Argon2 library) cd argon2-$argon2_version @@ -699,6 +706,7 @@ CFLAGS="$save_cflags" AC_MSG_RESULT(compiling sodium resolver library) $ac_cv_prog_MAKER || exit 1 AC_MSG_RESULT(installing sodium resolver library) +rm -f "$PRIVATELIBDIR/"libsodium* $ac_cv_prog_MAKER install || exit 1 SODIUM_CFLAGS="-I$cur_dir/extras/sodium/include" AC_SUBST(SODIUM_CFLAGS) @@ -725,7 +733,7 @@ AS_IF([test "$has_system_cares" = "no"], [ dnl REMEMBER TO CHANGE WITH A NEW C-ARES RELEASE! dnl NOTE: when changing this here, ALSO change it in extras/curlinstall dnl and in the comment in this file around line 400! -cares_version="1.18.1" +cares_version="1.19.0" AC_MSG_RESULT(extracting c-ares resolver library) cur_dir=`pwd` cd extras @@ -749,6 +757,7 @@ CFLAGS="$save_cflags" AC_MSG_RESULT(compiling c-ares resolver library) $ac_cv_prog_MAKER || exit 1 AC_MSG_RESULT(installing c-ares resolver library) +rm -f "$PRIVATELIBDIR/"libcares* $ac_cv_prog_MAKER install || exit 1 CARES_CFLAGS="-I$cur_dir/extras/c-ares/include" AC_SUBST(CARES_CFLAGS) @@ -799,7 +808,7 @@ AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libjansson*])],[h AS_IF([test "$has_system_jansson" = "no"],[ dnl REMEMBER TO CHANGE WITH A NEW JANSSON RELEASE! -jansson_version="2.13.1" +jansson_version="2.14" AC_MSG_RESULT(extracting jansson library) cur_dir=`pwd` cd extras @@ -819,11 +828,12 @@ cd jansson-$jansson_version save_cflags="$CFLAGS" CFLAGS="$orig_cflags" export CFLAGS -./configure --prefix=$cur_dir/extras/jansson --libdir=$PRIVATELIBDIR --enable-shared --disable-static --enable-opt || exit 1 +./configure --prefix=$cur_dir/extras/jansson --libdir=$PRIVATELIBDIR --enable-shared --disable-static || exit 1 CFLAGS="$save_cflags" AC_MSG_RESULT(compiling jansson resolver library) $ac_cv_prog_MAKER || exit 1 AC_MSG_RESULT(installing jansson resolver library) +rm -f "$PRIVATELIBDIR/"libjansson* $ac_cv_prog_MAKER install || exit 1 JANSSON_CFLAGS="-I$cur_dir/extras/jansson/include" AC_SUBST(JANSSON_CFLAGS) @@ -873,6 +883,7 @@ AC_CONFIG_FILES([Makefile src/modules/chanmodes/Makefile src/modules/usermodes/Makefile src/modules/extbans/Makefile + src/modules/rpc/Makefile src/modules/third/Makefile extras/unrealircd-upgrade-script unrealircd]) diff --git a/doc/Config.header b/doc/Config.header index 0b937c0..d0ecb0d 100644 --- a/doc/Config.header +++ b/doc/Config.header @@ -7,7 +7,7 @@ \___/|_| |_|_| \___|\__,_|_|\___/\_| \_| \____/\__,_| Configuration Program - for UnrealIRCd 6.0.4.2 + for UnrealIRCd 6.1.0 This program will help you to compile your IRC server, and ask you questions regarding the compile-time settings of it during the process. diff --git a/doc/RELEASE-NOTES.md b/doc/RELEASE-NOTES.md index 77253cb..5c4a7e0 100644 --- a/doc/RELEASE-NOTES.md +++ b/doc/RELEASE-NOTES.md @@ -1,19 +1,451 @@ -UnrealIRCd 6.0.4.2 -=================== -Another small update to 6.0.4.x: +UnrealIRCd 6.1.0 +================= +This is UnrealIRCd 6.1.0 stable. It is the direct successor to 6.0.7, there +will be no 6.0.8. -* Fix crash when linking. This requires a certain sequence of events: first +This release contains several channel mode `+f` enhancements and introduces a +new channel mode `+F` which works with flood profiles like `+F normal` and +`+F strict`. It is much easier for users than the scary looking mode +f. + +UnrealIRCd 6.1.0 also contains lots of JSON-RPC improvements, which is used +by the [UnrealIRCd admin panel](https://www.unrealircd.org/docs/UnrealIRCd_webpanel). +Live streaming of logs has been added and the webpanel now communicates to +UnrealIRCd which web user issued a command (eg: who issued a kill, who +changed a channel mode, ..). + +Other improvements are whowasdb (persistent WHOWAS history) and a new guide +on running a Tor Onion service. The release also fixes a crash bug related +to remote includes and fixes multiple memory leaks. + +See the full release notes below. As usual on *NIX you can upgrade easily +with the command: `./unrealircd upgrade` + +### Enhancements: +* Channel flood protection improvements: + * New [channel mode `+F`](https://www.unrealircd.org/docs/Channel_anti-flood_settings) + (uppercase F). This allows the user to choose a "flood profile", + which (behind the scenes) translates to something similar to an `+f` mode. + This so end-users can simply choose an `+F` profile without having to learn + the complex channel mode `+f`. + * For example `+F normal` effectively results in + `[7c#C15,30j#R10,10k#K15,40m#M10,8n#N15]:15` + * Multiple profiles are available and changing them is possible, + see [the documentation](https://www.unrealircd.org/docs/Channel_anti-flood_settings). + * Any settings in mode `+f` will override the ones of the `+F` profile. + To see the effective flood settings, use `MODE #channel F`. + * You can optionally set a default profile via + [set::anti-flood::channel::default-profile](https://www.unrealircd.org/docs/Channel_anti-flood_settings#Default_profile). + This profile is used if the channel is `-F`. If the user does not + want channel flood protection then they have to use an explicit `+F off`. + * When channel mode `+f` or `+F` detect that a flood is caused by >75% of + ["unknown-users"](https://www.unrealircd.org/docs/Security-group_block), + the server will now set a temporary ban on `~security-group:unknown-users`. + It will still set `+i` and other modes if the flood keeps on going + (eg. is caused by known-users). + * Forced nick changes (eg. by NickServ) are no longer counted in nick flood + for channel mode `+f`/`+F`. + * When a server splits on the network, we now temporarily disable +f/+F + join-flood protection for 75 seconds + ([set::anti-flood::channel::split-delay](https://www.unrealircd.org/docs/Channel_anti-flood_settings#config)). + This because a server splitting could mean that server has network problems + or has died (or restarted), in which case the clients would typically + reconnect to the remaining other servers, triggering an +f/+F join-flood and + channels ending up being `+i` and such. That is not good because we want + +f/+F to be as effortless as possible, with as little false positives as + possible. + * If your network has 5+ servers and the user load is spread evenly among + them, then you could disable this feature by setting the amount of seconds + to `0`. This because in such a scenario only 1/5th (20%) of the users + would reconnect and hopefully don't trigger +f/+F join floods. + * All these features only work properly if all servers are on 6.1.0-rc1 or later. +* New module `whowasdb` (persistent `WHOWAS` history): this saves the WHOWAS + history on disk periodically and when we terminate, so next server boot + still has the WHOWAS history. This module is currently not loaded by default. +* New option [listen::spoof-ip](https://www.unrealircd.org/docs/Listen_block#spoof-ip), + only valid when using UNIX domain sockets (so listen::file). + This way you can override the IP address that users come online with when + they use the socket (default was and still is `127.0.0.1`). +* Add a new guide [Running Tor Onion service with UnrealIRCd](https://www.unrealircd.org/docs/Running_Tor_Onion_service_with_UnrealIRCd) + which uses the new listen::spoof-ip and optionally requires a services account. +* [JSON-RPC](https://www.unrealircd.org/docs/JSON-RPC): + * Logging of JSON-RPC requests (eg. via snomask `+R`) has been improved, + it now shows: + * The issuer, such as the user logged in to the admin panel (if known) + * The parameters of the request + * The JSON-RPC calls + [`channel.list`](https://www.unrealircd.org/docs/JSON-RPC:Channel#channel.list), + [`channel.get`](https://www.unrealircd.org/docs/JSON-RPC:Channel#channel.get), + [`user.list`](https://www.unrealircd.org/docs/JSON-RPC:User#user.list) and + [`user.get`](https://www.unrealircd.org/docs/JSON-RPC:User#user.get) + now support an optional argument `object_detail_level` which specifies how detailed + the [Channel](https://www.unrealircd.org/docs/JSON-RPC:Channel#Structure_of_a_channel) + and [User](https://www.unrealircd.org/docs/JSON-RPC:User#Structure_of_a_client_object) + response object will be. Especially useful if you don't need all the + details in the list calls. + * New JSON-RPC methods + [`log.subscribe`](https://www.unrealircd.org/docs/JSON-RPC:Log#log.subscribe) and + [`log.unsubscribe`](https://www.unrealircd.org/docs/JSON-RPC:Log#log.unsubscribe) + to allow real-time streaming of + [JSON log events](https://www.unrealircd.org/docs/JSON_logging). + * New JSON-RPC method + [`rpc.set_issuer`](https://www.unrealircd.org/docs/JSON-RPC:Rpc#rpc.set_issuer) + to indiciate who is actually issuing the requests. The admin panel uses this + to communicate who is logged in to the panel so this info can be used in logging. + * New JSON-RPC methods + [`rpc.add_timer`](https://www.unrealircd.org/docs/JSON-RPC:Rpc#rpc.add_timer) and + [`rpc.del_timer`](https://www.unrealircd.org/docs/JSON-RPC:Rpc#rpc.del_timer) + so you can schedule JSON-RPC calls, like stats.get, to be executed every xyz msec. + * New JSON-RPC method + [`whowas.get`](https://www.unrealircd.org/docs/JSON-RPC:Whowas#whowas.get) + to fetch WHOWAS history. + * Low ASCII is no longer filtered out in strings in JSON-RPC, only in JSON logging. +* A new message tag `unrealircd.org/issued-by` which is IRCOp-only (and + used intra-server) to communicate who actually issued a command. + See [docs](https://www.unrealircd.org/issued-by). + +### Changes: +* The RPC modules are enabled by default now. This so remote RPC works + from other IRC servers for calls like `modules.list`. The default + configuration does NOT enable the webserver nor does it cause + listening on any socket for RPC, for that you need to follow the + [JSON-RPC](https://www.unrealircd.org/docs/JSON-RPC) instructions. +* The [blacklist-module](https://www.unrealircd.org/docs/Blacklist-module_directive) + directive now accepts wildcards, eg `blacklist-module rpc/*;` +* The setting set::modef-boot-delay has been moved to + [set::anti-flood::channel::boot-delay](https://www.unrealircd.org/docs/Channel_anti-flood_settings#config). +* We now only exempt `127.0.0.1` and `::1` from banning by default + (hardcoded in the source). Previously we exempted whole `127.*` but + that gets in the way if you want to allow Tor with a + [require authentication](https://www.unrealircd.org/docs/Require_authentication_block) + block or soft-ban. Now you can just tell Tor to bind to `127.0.0.2` + so its not affected by the default exemption. + +### Fixes: +* Crash if there is a parse error in an included file and there are + other remote included files still being downloaded. +* Memory leak in WHOWAS +* Memory leak when connecting to a TLS server fails +* Workaround a bug in some websocket implementations where the WSOP_PONG + frame is unmasked (now permitted). + +### Developers and protocol: +* The `cmode.free_param` definition changed. It now has an extra argument + `int soft` and for return value you will normally `return 0` here. + You can `return 1` if you resist freeing, which is rare and only used by + `+F` with set::anti-flood::channel::default-profile. +* New `cmode.flood_type_action` which can be used to indicate a channel mode + can be used from +f/+F as an action. You need to specify for which + flood type your mode is, eg `cmode.flood_type_action = 'j';` for joinflood. +* JSON-RPC supports + [UNIX domain sockets](https://www.unrealircd.org/docs/JSON-RPC:Technical_documentation#UNIX_domain_socket) + for making RPC calls. If this is used, we now split on `\n` (newline) + so multiple parallel requests can be handled properly. +* Message tag `unrealircd.org/issued-by`, sent to IRCOps only. + See [docs](https://www.unrealircd.org/issued-by). + +UnrealIRCd 6.0.7 +----------------- + +UnrealIRCd 6.0.7 makes WHOWAS show more information to IRCOps and adds an +experimental spamfilter feature. It also contains other enhancements and +quite a number of bug fixes. One notable change is that on linking of anope +or atheme, every server will now check if they have ulines { } for that +services server, since it's a common mistake to forget this, leading to +desyncs or other weird problems. + +### Enhancements: +* [Spamfilter](https://www.unrealircd.org/docs/Spamfilter) can now be made UTF8-aware: + * This is experimental, to enable: `set { spamfilter { utf8 yes; } }` + * Case insensitive matches will then work better. For example, for extended + Latin, a spamfilter on `ę` then also matches `Ę`. + * Other PCRE2 features such as [\p](https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC5) + can then be used. For example the regex `\p{Arabic}` would block all Arabic script. + See also this [full list of scripts](https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC7). + Please use this new tool with care. Blocking an entire language or script + is quite a drastic measure. + * As a consequence of this we require PCRE2 10.36 or newer. If your system + PCRE2 is older, then the UnrealIRCd-shipped-library version will be compiled + and `./Config` may take a little longer than usual. +* `WHOWAS` now shows IP address and account information to IRCOps +* Allow services to send a couple of protocol messages in the + unregistered / SASL stage. These are: `CHGHOST`, `CHGIDENT` + and `SREPLY` + * This allows services to set the vhost on a user during SASL, + so the user receives the vhost straight from the start, before + all the auto-joining/re-rejoining of channels. + * Future anope/atheme/etc services will presumably support this. +* [WebSocket](https://www.unrealircd.org/docs/WebSocket_support) status is + now synced over the network and an extra default + [security group](https://www.unrealircd.org/docs/Security-group_block) + `websocket-users` has been added. Similarly there is now + security-group::websocket and security-group::exclude-websocket item. + Same for [mask items](https://www.unrealircd.org/docs/Mask_item) such + as in [set::restrict-commands::command::except](https://www.unrealircd.org/docs/Restrict_commands). +* Support for IRCv3 [Standard Replies](https://ircv3.net/specs/extensions/standard-replies). + Right now nothing fancy yet, other than us sending `ACCOUNT_REQUIRED_TO_CONNECT` + from the authprompt module when a user is + [soft-banned](https://www.unrealircd.org/docs/Soft_ban). +* Add support for sending IRCv3 Standard Replies intra-server, eg + from services (`SREPLY` server-to-server command) +* Support `NO_COLOR` environment variable, as per [no-color.org](https://no-color.org). + +### Changes: +* We now verify that all servers have + [ulines { }](https://www.unrealircd.org/docs/Ulines_block) for Anope and + Atheme servers and reject the link if this is not the case. +* The `FLOOD_BLOCKED` log message now shows the target of the flood + for `target-flood-user` and `target-flood-channel`. +* When an IRCOp sets `+H` to hide ircop status, only the swhois items that + were added through oper will be hidden (and not the ones added by eg. vhost). + Previously all were hidden. +* Update shipped libraries: c-ares to 1.19.0, Jansson to 2.14, PCRE2 to 10.42, + and on Windows LibreSSL to 3.6.2 and cURL to 8.0.1. + +### Fixes: +* Crash if a third party module is loaded which allows very large message tags + (e.g. has no length check) +* Crash if an IRCOp uses + [`unrealircd.org/json-log`](https://www.unrealircd.org/docs/JSON_logging#Enabling_on_IRC) + on IRC and during `REHASH` some module sends log output during MOD_INIT + (eg. with some 3rd party modules) +* Crash when parsing [deny link block](https://www.unrealircd.org/docs/Deny_link_block) +* The [Module manager](https://www.unrealircd.org/docs/Module_manager) + now works on FreeBSD and similar. +* In `LUSERS` the "unknown connection(s)" count was wrong. This was just a + harmless counting error with no other effects. +* Silence warnings on Clang 15+ (eg. Ubuntu 23.04) +* Don't download `GeoIP.dat` if you have + [`blacklist-module geoip_classic;`](https://www.unrealircd.org/docs/Blacklist-module_directive) +* Channel mode `+S` stripping too much on incorrect color codes. +* Make [`@if module-loaded()`](https://www.unrealircd.org/docs/Defines_and_conditional_config) + work correctly for modules that are about to be unloaded during REHASH. +* Some missing notices if remotely REHASHing a server, and one duplicate line. +* Check invalid host setting in oper::vhost, just like we already have in vhost::vhost. + +UnrealIRCd 6.0.6 +----------------- + +The main objective of this release is to enhance the new JSON-RPC functionality. +In 6.0.5 we made a start and in 6.0.6 it is expanded a lot, plus some important +bugs were fixed in it. Thanks everyone who has been testing the functionality! + +The new [UnrealIRCd Administration Webpanel](https://github.com/unrealircd/unrealircd-webpanel/) +(which uses JSON-RPC) is very much usable now. It allows admins to view the +users/channels/servers lists, view detailed information on users and channels, +manage server bans and spamfilters, all from the browser. + +Both the JSON-RPC API and the webpanel are work in progress. They will improve +and expand with more features over time. + +If you are already using UnrealIRCd 6.0.5 and you are NOT interested in +JSON-RPC or the webpanel then there is NO reason to upgrade to 6.0.6. + +As usual, on *NIX you can easily upgrade with `./unrealircd upgrade` + +### Enhancements: +* The [JSON-RPC](https://www.unrealircd.org/docs/JSON-RPC) API for + UnrealIRCd has been expanded a lot. From 12 API methods to 42: + `stats.get`, `rpc.info`, `user.part`, + `user.join`, `user.quit`, `user.kill`, + `user.set_oper`, `user.set_snomask`, `user.set_mode`, + `user.set_vhost`, `user.set_realname`, + `user.set_username`, `user.set_nick`, `user.get`, + `user.list`, `server.module_list`, `server.disconnect`, + `server.connect`, `server.rehash`, `server.get`, + `server.list`, `channel.kick`, `channel.set_topic`, + `channel.set_mode`, `channel.get`, `channel.list`, + `server_ban.add`, `server_ban.del`, `server_ban.get`, + `server_ban.list`, `server_ban_exception.add`, + `server_ban_exception.del`, `server_ban_exception.get`, + `server_ban_exception.list`, `name_ban.add`, + `name_ban.del`, `name_ban.get`, `name_ban.list`, + `spamfilter.add`, `spamfilter.del`, `spamfilter.get`, + `spamfilter.list`. + * Server admins can read the [JSON-RPC](https://www.unrealircd.org/docs/JSON-RPC) + documentation on how to get started. For developers, see the + [Technical documentation](https://www.unrealircd.org/docs/JSON-RPC:Technical_documentation) + for all info on the different RPC calls and the protocol. + * Some functionality requires all servers to be on 6.0.6 or later. + * Some functionality requires all servers to include + `rpc.modules.default.conf` instead of only the single server that + the webpanel interfaces with through JSON-RPC. + When all servers have that file included then the API call + `server.module_list` can work for remote servers, and the API call + `server.rehash` for remote servers can return the actual rehash result + and a full log of the rehash process. It is not used for any other + API call at the moment, but in the future more API calls may need this + functionality because it allows us to do things that are otherwise impossible + or very hard. + * Known issue: logging of RPC actions needs to be improved. For some API calls, + like adding of server bans and spamfilters, this already works, but in + other API calls it is not clearly logged yet "who did what". + +### Changes: +* Previously some server protocol commands could only be used by + services, commands such as `SVSJOIN` and `SVSPART`. We now allow SVS* + command to be used by any servers, so the JSON-RPC API can use them. + There's a new option + [set::limit-svscmds](https://www.unrealircd.org/docs/Set_block#set::limit-svscmds) + so one can revert back to the original situation, if needed. +* All JSON-RPC calls that don't change anything, such as `user.list` + are now logged in the `rpc.debug` facility. Any call that changes + anything like `user.join` or `spamfilter.add` is logged via `rpc.info`. + This because JSON-RPC calls can be quite noisy and logging the + read-only calls is generally not so interesting. + +### Fixes: +* When using JSON-RPC with UnrealIRCd 6.0.5 it would often crash +* Fix parsing services version (anope) in `EAUTH`. + +### Developers and protocol: +* A new `RRPC` server to server command to handle RPC-over-IRC. + This way the JSON-RPC user, like the admin panel, can interface with + a remote server. If you are writing an RPC handler, then the remote + RPC request does not look much different than a local one, so you + can just process it as usual. See the code for `server.rehash` or + `server.module_list` for an example (src/modules/rpc/server.c). + +UnrealIRCd 6.0.5 +----------------- + +This release adds experimental JSON-RPC support, a new TLINE command, the +`./unrealircd restart` command has been improved to check for config errors, +logging to files has been improved and there are several other enhancements. + +There are also two important changes: 1) servers that use websockets now also +need to load the "webserver" module (so you may need to edit your config +file). 2) we now require TLSv1.2 or higher and a modern cipher for IRC clients. +This should be no problem for clients using any reasonably new SSL/TLS library +(from 2014 or later). + +I would also like to take this opportunity to say that we are +[looking for webdevs to create an UnrealIRCd admin panel](https://forums.unrealircd.org/viewtopic.php?t=9257). +The previous attempt at this failed so we are looking for new people. + +See the full release notes below for all changes in more detail. + +As usual, on *NIX you can easily upgrade with `./unrealircd upgrade` + +### Enhancements: +* Internally the websocket module has been split up into 3 modules: + `websocket_common`, `webserver` and `websocket`. The `websocket_common` one + is loaded by default via modules.default.conf, the other two are not. + **Important:** if you use websockets then you need to load two modules now (instead of only one): + ``` + loadmodule "websocket"; + loadmodule "webserver"; + ``` +* [JSON-RPC](https://www.unrealircd.org/docs/JSON-RPC) API for UnrealIRCd. + This is work in progress. +* New `TLINE` command to test *LINEs. This can be especially useful for + checking how many people match an [extended server ban](https://www.unrealircd.org/docs/Extended_server_bans) + such as `TLINE ~C:NL` +* The `./unrealircd start` command will now refuse to start if UnrealIRCd + is already running. +* The `./unrealircd restart` command will validate the configuration file + (it will call `./unrealircd configtest`). If there is a configuration + error then the restart will not go through and the current UnrealIRCd + process is kept running. +* When an IRCOp is outside the channel and does `MODE #channel` they will + now get to see the mode parameters too. This depends on the `channel:see:mode:remote` + [operclass permission](https://www.unrealircd.org/docs/Operclass_permissions) + which all IRCOps have by default if you use the default operclasses. +* [Logging to a file](https://www.unrealircd.org/docs/Log_block) now creates + a directory structure if needed. + * You could already use: + ``` + log { source { !debug; all; } destination { file "ircd.%Y-%m-%d.log"; } } + ``` + * But now you can also use: + ``` + log { source { !debug; all; } destination { file "%Y-%m-%d/ircd.log"; } } + ``` + This is especially useful if you output to multiple log files and then + want them grouped by date in a directory. +* Add additional variables in + [blacklist::reason](https://www.unrealircd.org/docs/Blacklist_block): + * `$blacklist`: name of the blacklist block + * `$dnsname`: the blacklist::dns::name + * `$dnsreply`: the DNS reply code +* Resolved technical issue so opers can `REHASH` from + [Websocket connections](https://www.unrealircd.org/docs/WebSocket_support). +* In the [TLD block](https://www.unrealircd.org/docs/Tld_block) the use + of `tld::motd` and `tld::rules` is now optional. +* Log which oper actually initiated a server link request (`CONNECT`) + +### Changes: +* SSL/TLS: By default we now require TLSv1.2 or later and a modern cipher + with forward secrecy. Otherwise the connection is refused. + * Since UnrealIRCd 4.2.2 (March 2019) users see an on-connect notice with + a warning when they use an outdated TLS protocol or cipher that does not + meet these requirements. + * This move also reflects the phase out of versions below TLSv1.2 which + happened in browsers in 2020/2021. + * In practice on the client-side this requires at least: + * OpenSSL 1.0.1 (released in 2012) + * GnuTLS 3.2.6 (2013) + * Android 4.4.2 (2013) + * Or presumably any other SSL/TLS library that is not 9+ years old + * If you want to revert back to the previous less secure settings, then + look under ''Previous less secure setting'' in + [TLS Ciphers and protocols](https://www.unrealircd.org/docs/TLS_Ciphers_and_protocols). +* The code for handling + [`set::anti-flood::everyone::connect-flood`](https://www.unrealircd.org/docs/Anti-flood_settings#connect-flood) + is now in its own module `connect-flood`. This module is loaded by default, + no changes needed in your configuration file. +* Similarly, + [`set:max-unknown-connections-per-ip`](https://www.unrealircd.org/docs/Set_block#set::max-unknown-connections-per-ip) + is now handled by the new module `max-unknown-connections-per-ip`. This module is loaded + by default as well, no changes needed in your configuration file. +* Upgrade shipped PCRE2 to 10.41, curl-ca-bundle to 2022-10-11, + on Windows LibreSSL to 3.6.1 and cURL to 7.86.0. +* After people do a major upgrade on their Linux distro, UnrealIRCd may + no longer start due to an `error while loading shared libraries`. + We now print a more helpful message and link to the new + [FAQ entry](https://www.unrealircd.org/docs/FAQ#shared-library-error) + about it. +* When timing out on the [authprompt](https://www.unrealircd.org/docs/Set_block#set::authentication-prompt) + module, the error (quit message) is now the original (ban) reason for the + prompt, instead of the generic `Registration timeout`. + +### Fixes: +* Crash when linking. This requires a certain sequence of events: first a server is linked in successfully, then we need to REHASH, and then a new link attempt has to come in with the same server name (for example because there is a network issue and the old link has not timed out yet). If all that happens, then an UnreaIRCd 6 server may crash, but not always. +* Warning message about moddata creationtime when linking. +* [Snomask `+j`](https://www.unrealircd.org/docs/Snomasks) was not showing + remote joins, even though it did show remote parts and kicks. +* Leak of 1 file descriptor per /REHASH (the control socket). +* Ban letters showing up twice in 005 EXTBAN= +* Setting [set::authentication-prompt::enabled](https://www.unrealircd.org/docs/Set_block#set::authentication-prompt) + to `no` was ignored. The default is still `yes`. + +### Developers and protocol: +* Add `CALL_CMD_FUNC(cmd_func_name)` for calling commands in the same + module, see [this commit](https://github.com/unrealircd/unrealircd/commit/dc55c3ec9f19e5ed284e5a786f646d0e6bb60ef9). + Benefit of this is that it will keep working if we ever change command paramters. +* Add `CALL_NEXT_COMMAND_OVERRIDE()` which can be used instead of + `CallCommandOverride()`, see also [this commit](https://github.com/unrealircd/unrealircd/commit/4e5598b6cf0986095f757f31a2540b03e4d235dc). + This too, will keep working if we ever change command parameters. +* During loading and rehash we now set `loop.config_status` to one of + `CONFIG_STATUS_*` so modules (and core) can see at what step we are + during configuration file and module processing. +* New RPC API. See the `src/modules/rpc/` directory for examples. +* New function `get_nvplist(NameValuePrioList *list, const char *name)` + +UnrealIRCd 6.0.4.2 +------------------- +Another small update to 6.0.4.x: + * Two IRCv3 specifications were ratified which we already supported as drafts: * Change CAP `draft/extended-monitor` to `extended-monitor` * Add message-tag `bot` next to existing (for now) `draft/bot` * Update Turkish translations UnrealIRCd 6.0.4.1 -=================== +------------------- This is a small update to 6.0.4. It fixes the following issues that were present in all 6.0.x versions: @@ -27,12 +459,11 @@ present in all 6.0.x versions: (limit) and other restrictions and would have to resort back to using MODE or SAMODE. Only +b and +i could be bypassed via INVITE OperOverride. +(This cherry picks commit 0e6fc07bd9000ecc463577892cf2195a670de4be and + commit 0d139c6e7c268e31ca8a4c9fc5cb7bfeb4f56831 from 6.0.5-git) + UnrealIRCd 6.0.4 ----------------- -This release comes with lots of features and enhancements. In particular, -security groups and mask items now allow you to write cleaner and more -flexible configuration files. There are also JSON logging enhancements and -several bug fixes. Thanks a lot to everyone who tested the release candidates! If you are already running UnrealIRCd 6 then read below. Otherwise, jump straight to the [summary about UnrealIRCd 6](#Summary) to learn more @@ -148,8 +579,8 @@ about UnrealIRCd 6. ### Changes: * Clarified that UnrealIRCd is licensed as "GPLv2 or later" * Fix use of variables in - [`set::reject-message](https://www.unrealircd.org/docs/Set_block#set::reject-message) - and in [`blacklist::reason](https://www.unrealircd.org/docs/Blacklist_block): + [`set::reject-message`](https://www.unrealircd.org/docs/Set_block#set::reject-message) + and in [`blacklist::reason`](https://www.unrealircd.org/docs/Blacklist_block): previously short forms of variables were (unintentionally) expanded as well, such as `$serv` for `$server`. This is no longer supported, you need to use the correct full variable names. diff --git a/doc/conf/modules.conf b/doc/conf/modules.conf index 854f29c..8b542ed 100644 --- a/doc/conf/modules.conf +++ b/doc/conf/modules.conf @@ -164,6 +164,7 @@ loadmodule "usermodes/servicebot"; /* +S */ loadmodule "extbans/account"; /* +b ~account */ loadmodule "extbans/certfp"; /* +b ~certfp */ #loadmodule "extbans/country"; /* +b ~country */ +loadmodule "extbans/flood"; /* +e ~flood */ loadmodule "extbans/inchannel"; /* +b ~channel */ loadmodule "extbans/join"; /* +b ~join */ loadmodule "extbans/msgbypass"; /* +e ~msgbypass */ @@ -194,9 +195,23 @@ loadmodule "monitor"; loadmodule "plaintext-policy"; loadmodule "reply-tag"; loadmodule "server-time"; +loadmodule "standard-replies"; loadmodule "sts"; loadmodule "typing-indicator"; +// RPC +loadmodule "rpc/rpc"; +loadmodule "rpc/stats"; +loadmodule "rpc/user"; +loadmodule "rpc/server"; +loadmodule "rpc/channel"; +loadmodule "rpc/server_ban"; +loadmodule "rpc/server_ban_exception"; +loadmodule "rpc/name_ban"; +loadmodule "rpc/spamfilter"; +loadmodule "rpc/log"; +loadmodule "rpc/whowas"; + // Other loadmodule "antimixedutf8"; #loadmodule "authprompt"; @@ -228,3 +243,4 @@ loadmodule "watch-backend"; #loadmodule "webirc"; #loadmodule "webserver"; #loadmodule "websocket"; +loadmodule "websocket_common"; \ No newline at end of file diff --git a/doc/conf/snomasks.conf b/doc/conf/snomasks.conf index 87d9855..8fdef07 100644 --- a/doc/conf/snomasks.conf +++ b/doc/conf/snomasks.conf @@ -16,6 +16,7 @@ log { nomatch; oper; operoverride; + rpc; sacmds; tkl.BAN_REALNAME; tkl.RMTKL_COMMAND; diff --git a/doc/conf/unrealircd.remote.conf b/doc/conf/unrealircd.remote.conf index 0c3ddf3..b8caac9 100644 --- a/doc/conf/unrealircd.remote.conf +++ b/doc/conf/unrealircd.remote.conf @@ -146,6 +146,16 @@ set { oper-message "Network operators must be using an up-to-date TLS protocol & cipher"; } anti-flood { + channel { + profile very-strict { flood-mode "[7c#C15,10j#R10,10k#K15,30m#M10,10n#N15]:15"; } + profile strict { flood-mode "[7c#C15,15j#R10,10k#K15,40m#M10,10n#N15]:15"; } + profile normal { flood-mode "[7c#C15,30j#R10,10k#K15,40m#M10,10n#N15]:15"; } + profile relaxed { flood-mode "[7c#C15,45j#R10,10k#K15,60m#M10,10n#N15]:15"; } + profile very-relaxed { flood-mode "[7c#C15,60j#R10,10k#K15,90m#M10,10n#N15]:15"; } + default-profile normal; + boot-delay 75; + split-delay 75; + } everyone { connect-flood 3:300; handshake-data-flood { diff --git a/doc/technical/005.txt b/doc/technical/005.txt index c1d9b37..f428d51 100644 --- a/doc/technical/005.txt +++ b/doc/technical/005.txt @@ -18,14 +18,14 @@ by this server" Currently UnrealIRCd supports several tokens that are included in numeric 005. A list of all tokens, their respective value and a brief description are listed below. -Unreal attempts to follow the proposed ISupport standard as much as possible. Unreal only -ignores the standard in one regard, the TARGMAX token. This token is believed to be +UnrealIRCd attempts to follow the proposed ISupport standard as much as possible. UnrealIRCd +only ignores the standard in one regard, the TARGMAX token. This token is believed to be impractical and technically impossible to correctly implement due to existing limitations in the standard. Therefore, this token is not currently supported. -Unreal does additionally provide a few tokens which are not specified in the standard, these +UnrealIRCd does additionally provide a few tokens which are not specified in the standard, these include: HCN, AWAYLEN, WATCH, SILENCE, EXTBAN, ELIST, CMDS, NAMESX, UHNAMES, and WATCHOPTS. -Unreal also maintains a few legacy tokens such as MAXCHANNELS and WALLCHOPS to ensure +UnrealIRCd also maintains a few legacy tokens such as MAXCHANNELS and WALLCHOPS to ensure compatibility until the ISupport standard is more widely accepted by clients. Token Value Default Value Description diff --git a/extras/argon2-20181209.tar.gz b/extras/argon2-20181209.tar.gz deleted file mode 100644 index 9ed4ab3..0000000 Binary files a/extras/argon2-20181209.tar.gz and /dev/null differ diff --git a/extras/argon2.tar.gz b/extras/argon2.tar.gz new file mode 100644 index 0000000..ff9bad1 Binary files /dev/null and b/extras/argon2.tar.gz differ diff --git a/extras/build-tests/nix/build b/extras/build-tests/nix/build index caab490..058bddb 100755 --- a/extras/build-tests/nix/build +++ b/extras/build-tests/nix/build @@ -48,8 +48,8 @@ fi $MAKE yes ''|$MAKE pem $MAKE || exit 1 -./unrealircd module install third/dumpcmds $MAKE install || exit 1 +./unrealircd module install third/dumpcmds || exit 1 set +x echo "" diff --git a/extras/build-tests/windows/compilecmd/vs2019.bat b/extras/build-tests/windows/compilecmd/vs2019.bat index 238b808..a7247a0 100644 --- a/extras/build-tests/windows/compilecmd/vs2019.bat +++ b/extras/build-tests/windows/compilecmd/vs2019.bat @@ -6,7 +6,7 @@ rem But nowadays we use JOM for parallel builds: jom /j32 -f makefile.windows ^ LIBRESSL_INC_DIR="c:\projects\unrealircd-6-libs\libressl\include" ^ LIBRESSL_LIB_DIR="c:\projects\unrealircd-6-libs\libressl\lib" ^ -SSLLIB="crypto-47.lib ssl-50.lib" ^ +SSLLIB="crypto-50.lib ssl-53.lib" ^ USE_REMOTEINC=1 ^ LIBCURL_INC_DIR="c:\projects\unrealircd-6-libs\curl\include" ^ LIBCURL_LIB_DIR="c:\projects\unrealircd-6-libs\curl\builds\libcurl-vc-x64-release-dll-ssl-dll-cares-dll-ipv6-obj-lib" ^ diff --git a/extras/c-ares.tar.gz b/extras/c-ares.tar.gz index 7523b17..4cd6123 100644 Binary files a/extras/c-ares.tar.gz and b/extras/c-ares.tar.gz differ diff --git a/extras/curlinstall b/extras/curlinstall index 9e0debd..aaeb509 100755 --- a/extras/curlinstall +++ b/extras/curlinstall @@ -76,4 +76,6 @@ cd "$OUTD" || exit 1 echo "Building and installing libcurl" ./configure --prefix=$UNREALDIR/extras/curl --libdir=$PRIVATELIBDIR --enable-shared --with-openssl -make && make install +make || exit 1 +rm -f "$PRIVATELIBDIR/"libcurl* +make install || exit 1 diff --git a/extras/doxygen/Doxyfile b/extras/doxygen/Doxyfile index 24d123f..77d3746 100644 --- a/extras/doxygen/Doxyfile +++ b/extras/doxygen/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "UnrealIRCd" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.4.2 +PROJECT_NUMBER = 6.1.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/extras/jansson.tar.gz b/extras/jansson.tar.gz index bd1d16c..7efa26a 100644 Binary files a/extras/jansson.tar.gz and b/extras/jansson.tar.gz differ diff --git a/extras/pcre2.tar.gz b/extras/pcre2.tar.gz index d16fe48..5eda638 100644 Binary files a/extras/pcre2.tar.gz and b/extras/pcre2.tar.gz differ diff --git a/extras/tests/tls/cipherscan_profiles/baseline.txt b/extras/tests/tls/cipherscan_profiles/baseline.txt index 3231e7f..a8c9272 100644 --- a/extras/tests/tls/cipherscan_profiles/baseline.txt +++ b/extras/tests/tls/cipherscan_profiles/baseline.txt @@ -1,12 +1,10 @@ Target: 127.0.0.1:5901 -prio ciphersuite protocols pfs curves -1 ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -2 ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -3 ECDHE-ECDSA-AES256-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -4 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -5 ECDHE-ECDSA-AES256-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -6 ECDHE-ECDSA-AES128-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 +prio ciphersuite protocols pfs curves +1 ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 +2 ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 +3 ECDHE-ECDSA-AES256-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 +4 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 Certificate: untrusted, 384 bits, ecdsa-with-SHA256 signature TLS ticket lifetime hint: None @@ -20,8 +18,8 @@ TLS Tolerance: yes Intolerance to: SSL 3.254 : absent - TLS 1.0 : absent - TLS 1.1 : absent + TLS 1.0 : PRESENT + TLS 1.1 : PRESENT TLS 1.2 : absent TLS 1.3 : absent TLS 1.4 : absent diff --git a/extras/tests/tls/cipherscan_profiles/openssl-101.txt b/extras/tests/tls/cipherscan_profiles/openssl-101.txt deleted file mode 100644 index d74eb56..0000000 --- a/extras/tests/tls/cipherscan_profiles/openssl-101.txt +++ /dev/null @@ -1,27 +0,0 @@ -Target: 127.0.0.1:5901 - -prio ciphersuite protocols pfs curves -1 ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 ECDH,P-256,256bits prime256v1 -2 ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 ECDH,P-256,256bits prime256v1 -3 ECDHE-ECDSA-AES256-SHA384 TLSv1.2 ECDH,P-256,256bits prime256v1 -4 ECDHE-ECDSA-AES256-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-256,256bits prime256v1 -5 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 ECDH,P-256,256bits prime256v1 -6 ECDHE-ECDSA-AES128-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-256,256bits prime256v1 - -Certificate: untrusted, 384 bits, ecdsa-with-SHA256 signature -TLS ticket lifetime hint: None -NPN protocols: None -OCSP stapling: not supported -Cipher ordering: server -Curves ordering: server - fallback: no -Server supports secure renegotiation -Server supported compression methods: NONE -TLS Tolerance: yes - -Intolerance to: - SSL 3.254 : absent - TLS 1.0 : absent - TLS 1.1 : absent - TLS 1.2 : absent - TLS 1.3 : absent - TLS 1.4 : absent diff --git a/extras/tests/tls/cipherscan_profiles/openssl-102-ubuntu16.txt b/extras/tests/tls/cipherscan_profiles/openssl-102-ubuntu16.txt deleted file mode 100644 index 347ee63..0000000 --- a/extras/tests/tls/cipherscan_profiles/openssl-102-ubuntu16.txt +++ /dev/null @@ -1,27 +0,0 @@ -Target: 127.0.0.1:5901 - -prio ciphersuite protocols pfs curves -1 ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -2 ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -3 ECDHE-ECDSA-AES256-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -4 ECDHE-ECDSA-AES256-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -5 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -6 ECDHE-ECDSA-AES128-SHA TLSv1,TLSv1.1,TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 - -Certificate: untrusted, 384 bits, ecdsa-with-SHA256 signature -TLS ticket lifetime hint: None -NPN protocols: None -OCSP stapling: not supported -Cipher ordering: server -Curves ordering: server - fallback: no -Server supports secure renegotiation -Server supported compression methods: NONE -TLS Tolerance: yes - -Intolerance to: - SSL 3.254 : absent - TLS 1.0 : absent - TLS 1.1 : absent - TLS 1.2 : absent - TLS 1.3 : absent - TLS 1.4 : absent diff --git a/extras/tests/tls/cipherscan_profiles/openssl-300.txt b/extras/tests/tls/cipherscan_profiles/openssl-300.txt deleted file mode 100644 index 76c368f..0000000 --- a/extras/tests/tls/cipherscan_profiles/openssl-300.txt +++ /dev/null @@ -1,27 +0,0 @@ -Target: 127.0.0.1:5901 - -prio ciphersuite protocols pfs curves -1 ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -2 ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -3 ECDHE-ECDSA-AES256-SHA384 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -4 ECDHE-ECDSA-AES128-SHA256 TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -5 ECDHE-ECDSA-AES256-SHA TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 -6 ECDHE-ECDSA-AES128-SHA TLSv1.2 ECDH,P-521,521bits secp521r1,secp384r1 - -Certificate: untrusted, 384 bits, ecdsa-with-SHA256 signature -TLS ticket lifetime hint: None -NPN protocols: None -OCSP stapling: not supported -Cipher ordering: server -Curves ordering: server - fallback: no -Server supports secure renegotiation -Server supported compression methods: NONE -TLS Tolerance: yes - -Intolerance to: - SSL 3.254 : absent - TLS 1.0 : PRESENT - TLS 1.1 : PRESENT - TLS 1.2 : absent - TLS 1.3 : absent - TLS 1.4 : absent diff --git a/include/common.h b/include/common.h index 5a0d1d6..e595e4b 100644 --- a/include/common.h +++ b/include/common.h @@ -96,6 +96,7 @@ extern int myncmp(const char *, const char *, int); #endif extern char *strtoken(char **, char *, char *); +extern char *strtoken_noskip(char **, char *, char *); extern MODVAR int global_count, max_global_count; #ifdef _WIN32 @@ -167,7 +168,7 @@ extern MODVAR unsigned char char_atribs[]; * you are doing. */ -/* IRCu/Hybrid/Unreal way now :) -Stskeeps */ +/* IRCu/Hybrid/unrealircd way now :) -Stskeeps */ #define EXPAR1 extchmstr[0] #define EXPAR2 extchmstr[1] diff --git a/include/config.h b/include/config.h index 7281cb9..30706f2 100644 --- a/include/config.h +++ b/include/config.h @@ -275,12 +275,12 @@ /* Default TLS cipherlist (except for TLS1.3, see further down). * This can be changed via set::ssl::options::ciphers in the config file. */ -#define UNREALIRCD_DEFAULT_CIPHERS "TLS13-CHACHA20-POLY1305-SHA256 TLS13-AES-256-GCM-SHA384 TLS13-AES-128-GCM-SHA256 EECDH+CHACHA20 EECDH+AESGCM EECDH+AES AES256-GCM-SHA384 AES128-GCM-SHA256 AES256-SHA256 AES128-SHA256 AES256-SHA AES128-SHA" +#define UNREALIRCD_DEFAULT_CIPHERS "EECDH+CHACHA20 EECDH+AESGCM EECDH+AES+SHA384 EECDH+AES+SHA256" /* Default TLS 1.3 ciphersuites. * This can be changed via set::ssl::options::ciphersuites in the config file. */ -#define UNREALIRCD_DEFAULT_CIPHERSUITES "TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256:TLS_AES_128_CCM_8_SHA256:TLS_AES_128_CCM_SHA256" +#define UNREALIRCD_DEFAULT_CIPHERSUITES "TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256" /* Default TLS curves for ECDH(E) * This can be changed via set::ssl::options::ecdh-curve in the config file. diff --git a/include/dbuf.h b/include/dbuf.h index 522b6c4..2bf2ad2 100644 --- a/include/dbuf.h +++ b/include/dbuf.h @@ -95,6 +95,7 @@ void dbuf_delete(dbuf *, size_t); #define DBufClear(dyn) dbuf_delete((dyn),DBufLength(dyn)) extern int dbuf_getmsg(dbuf *, char *); +extern int dbuf_get(dbuf *dyn, char **buf); extern void dbuf_queue_init(dbuf *dyn); extern void dbuf_init(void); diff --git a/include/dynconf.h b/include/dynconf.h index 54b1c16..6adbb78 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -53,6 +53,8 @@ typedef enum BanTarget { BAN_TARGET_IP=1, BAN_TARGET_USERIP=2, BAN_TARGET_HOST=3 typedef enum HideIdleTimePolicy { HIDE_IDLE_TIME_NEVER=1, HIDE_IDLE_TIME_ALWAYS=2, HIDE_IDLE_TIME_USERMODE=3, HIDE_IDLE_TIME_OPER_USERMODE=4 } HideIdleTimePolicy; +typedef enum LimitSVSCMDS { LIMIT_SVSCMDS_SERVERS=0, LIMIT_SVSCMDS_ULINES=1 } LimitSVSCMDS; + /** The set { } block configuration */ typedef struct Configuration Configuration; struct Configuration { @@ -128,6 +130,7 @@ struct Configuration { long spamfilter_detectslow_warn; long spamfilter_detectslow_fatal; int spamfilter_stop_on_first_match; + int spamfilter_utf8; int maxbans; int maxbanlength; int watch_away_notification; @@ -171,6 +174,7 @@ struct Configuration { char *sasl_server; int server_notice_colors; int server_notice_show_event; + LimitSVSCMDS limit_svscmds; }; extern MODVAR Configuration iConf; diff --git a/include/fdlist.h b/include/fdlist.h index bb24f4f..0405c3e 100644 --- a/include/fdlist.h +++ b/include/fdlist.h @@ -35,7 +35,7 @@ extern int fd_fileopen(const char *path, unsigned int flags); #define FD_SELECT_WRITE 0x2 extern void fd_setselect(int fd, int flags, IOCallbackFunc iocb, void *data); -extern void fd_select(time_t delay); /* backend-specific */ +extern void fd_select(int delay); /* backend-specific */ extern void fd_refresh(int fd); /* backend-specific */ extern void fd_fork(); /* backend-specific */ diff --git a/include/h.h b/include/h.h index d22bda8..41fd18c 100644 --- a/include/h.h +++ b/include/h.h @@ -105,7 +105,6 @@ extern MODVAR ConfigItem_link *conf_link; extern MODVAR ConfigItem_sni *conf_sni; extern MODVAR ConfigItem_ban *conf_ban; extern MODVAR ConfigItem_deny_channel *conf_deny_channel; -extern MODVAR ConfigItem_deny_link *conf_deny_link; extern MODVAR ConfigItem_allow_channel *conf_allow_channel; extern MODVAR ConfigItem_deny_version *conf_deny_version; extern MODVAR ConfigItem_alias *conf_alias; @@ -148,7 +147,7 @@ extern ConfigItem_listen *find_listen(const char *ipmask, int port, SocketType s extern ConfigItem_sni *find_sni(const char *name); extern ConfigItem_ulines *find_uline(const char *host); extern ConfigItem_tld *find_tld(Client *cptr); -extern ConfigItem_link *find_link(const char *servername, Client *acptr); +extern ConfigItem_link *find_link(const char *servername); extern ConfigItem_ban *find_ban(Client *, const char *host, short type); extern ConfigItem_ban *find_banEx(Client *,const char *host, short type, short type2); extern ConfigItem_vhost *find_vhost(const char *name); @@ -183,6 +182,7 @@ extern MODVAR struct list_head unknown_list; extern MODVAR struct list_head control_list; extern MODVAR struct list_head global_server_list; extern MODVAR struct list_head dead_list; +extern MODVAR struct list_head rpc_remote_list; extern RealCommand *find_command(const char *cmd, int flags); extern RealCommand *find_command_simple(const char *cmd); extern Membership *find_membership_link(Membership *lp, Channel *ptr); @@ -226,12 +226,15 @@ extern const char *extban_conv_param_nuh_or_extban(BanContext *b, Extban *extban extern const char *extban_conv_param_nuh(BanContext *b, Extban *extban); extern Ban *is_banned(Client *, Channel *, int, const char **, const char **); extern Ban *is_banned_with_nick(Client *, Channel *, int, const char *, const char **, const char **); +extern int ban_exists(Ban *lst, const char *str); +extern int ban_exists_ignore_time(Ban *lst, const char *str); extern Client *find_client(const char *, Client *); extern Client *find_name(const char *, Client *); extern Client *find_nickserv(const char *, Client *); extern Client *find_user(const char *, Client *); extern Client *find_server(const char *, Client *); +extern Client *find_server_by_uid(const char *uid); extern Client *find_service(const char *, Client *); #define find_server_quick(x) find_server(x, NULL) extern char *find_or_add(char *); @@ -283,6 +286,7 @@ extern void sendto_channel(Channel *channel, Client *from, Client *skip, extern void sendto_local_common_channels(Client *user, Client *skip, long clicap, MessageTag *mtags, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,5,6))); +extern void quit_sendto_local_common_channels(Client *user, MessageTag *mtags, const char *reason); extern void sendto_match_servs(Channel *, Client *, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4))); extern void sendto_match_butone(Client *, Client *, const char *, int, MessageTag *, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,6,7))); @@ -312,8 +316,33 @@ extern void sendnotice(Client *to, FORMAT_STRING(const char *pattern), ...) __at * @endcode * @ingroup SendFunctions */ -#define sendnumeric(to, numeric, ...) sendnumericfmt(to, numeric, STR_ ## numeric, ##__VA_ARGS__) -extern void sendnumericfmt(Client *to, int numeric, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,3,4))); +#define sendnumeric(to, numeric, ...) sendtaggednumericfmt(to, NULL, numeric, STR_ ## numeric, ##__VA_ARGS__) + +/** Send numeric message to a client - format to user specific needs. + * This will ignore the numeric definition of src/numeric.c and always send ":me.name numeric clientname " + * followed by the pattern and format string you choose. + * @param to The recipient + * @param numeric The numeric, one of RPL_* or ERR_*, see src/numeric.c + * @param pattern The format string / pattern to use. + * @param ... Format string parameters. + * @note Don't forget to add a colon if you need it (eg `:%%s`), this is a common mistake. + */ +#define sendnumericfmt(to, numeric, ...) sendtaggednumericfmt(to, NULL, numeric, __VA_ARGS__) + +/** Send numeric message to a client - format to user specific needs. + * This will ignore the numeric definition of src/numeric.c and always send ":me.name numeric clientname " + * followed by the pattern and format string you choose. + * @param to The recipient + * @param mtags NULL, or NULL-terminated array of message tags + * @param numeric The numeric, one of RPL_* or ERR_*, see src/numeric.c + * @param pattern The format string / pattern to use. + * @param ... Format string parameters. + * @note Don't forget to add a colon if you need it (eg `:%%s`), this is a common mistake. + */ +#define sendtaggednumeric(to, mtags, numeric, ...) sendtaggednumericfmt(to, mtags, numeric, STR_ ## numeric, ##__VA_ARGS__) + +extern void sendtaggednumericfmt(Client *to, MessageTag *mtags, int numeric, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,4,5))); + extern void sendtxtnumeric(Client *to, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,2,3))); /** Build numeric message so it is ready to be sent to a client - rarely used, normally you use sendnumeric() instead. * This function is normally only used in eg CAN_KICK and CAN_SET_TOPIC, where @@ -408,7 +437,13 @@ extern uint64_t siphash_raw(const char *in, size_t len, const char *k); extern uint64_t siphash_nocase(const char *in, const char *k); extern void siphash_generate_key(char *k); extern void init_hash(void); -uint64_t hash_whowas_name(const char *name); +extern void add_whowas_to_clist(WhoWas **, WhoWas *); +extern void del_whowas_from_clist(WhoWas **, WhoWas *); +extern void add_whowas_to_list(WhoWas **, WhoWas *); +extern void del_whowas_from_list(WhoWas **, WhoWas *); +extern uint64_t hash_whowas_name(const char *name); +extern void create_whowas_entry(Client *client, WhoWas *e, WhoWasEvent event); +extern void free_whowas_fields(WhoWas *e); extern int add_to_client_hash_table(const char *, Client *); extern int del_from_client_hash_table(const char *, Client *); extern int add_to_id_hash_table(const char *, Client *); @@ -454,6 +489,9 @@ extern MODVAR long SNO_SNOTICE; extern MODVAR long SNO_SPAMF; extern MODVAR long SNO_OPER; +#ifndef HAVE_STRNLEN +extern size_t strnlen(const char *s, size_t maxlen); +#endif #ifndef HAVE_STRLCPY extern size_t strlcpy(char *dst, const char *src, size_t size); #endif @@ -489,11 +527,11 @@ extern MODVAR RealCommand *CommandHash[256]; extern void init_CommandHash(void); /* CRULE */ -char *crule_parse(char *); -int crule_test(char *); -char *crule_errstring(int); -int crule_eval(char *); -void crule_free(char **); +extern struct CRuleNode* crule_parse(const char*); +extern void crule_free(struct CRuleNode**); +extern int crule_eval(struct CRuleNode* rule); +extern int crule_test(const char *rule); +extern const char *crule_errstring(int errcode); /* * Close all local socket connections, invalidate client fd's @@ -664,11 +702,16 @@ extern void IRCToRTF(unsigned char *buffer, unsigned char *string); #endif extern void verify_opercount(Client *, const char *); extern int valid_host(const char *host, int strict); +extern int valid_username(const char *username); +extern int valid_vhost(const char *userhost); extern int count_oper_sessions(const char *); extern char *unreal_mktemp(const char *dir, const char *suffix); extern char *unreal_getpathname(const char *filepath, char *path); extern const char *unreal_getfilename(const char *path); extern const char *unreal_getmodfilename(const char *path); +extern int unreal_create_directory_structure_for_file(const char *fname, mode_t mode); +extern int unreal_create_directory_structure(const char *dname, mode_t mode); +extern int unreal_mkdir(const char *pathname, mode_t mode); extern int unreal_copyfile(const char *src, const char *dest); extern int unreal_copyfileex(const char *src, const char *dest, int tryhardlink); extern time_t unreal_getfilemodtime(const char *filename); @@ -704,8 +747,8 @@ extern int add_banid(Client *, Channel *, const char *); extern int add_exbanid(Client *cptr, Channel *channel, const char *banid); extern int sub1_from_channel(Channel *); extern MODVAR CoreChannelModeTable corechannelmodetable[]; -extern char *unreal_encodespace(char *s); -extern char *unreal_decodespace(char *s); +extern char *unreal_encodespace(const char *s); +extern char *unreal_decodespace(const char *s); extern MODVAR Link *helpign; extern void reread_motdsandrules(); extern MODVAR int SVSNOOP; @@ -739,12 +782,14 @@ extern MODVAR int (*can_join)(Client *client, Channel *channel, const char *key, extern MODVAR void (*do_mode)(Channel *channel, Client *client, MessageTag *mtags, int parc, const char *parv[], time_t sendts, int samode); extern MODVAR MultiLineMode *(*set_mode)(Channel *channel, Client *cptr, int parc, const char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]); -extern MODVAR void (*set_channel_mode)(Channel *channel, char *modes, char *parameters); +extern MODVAR void (*set_channel_mode)(Channel *channel, MessageTag *mtags, const char *modes, const char *parameters); +extern MODVAR void (*set_channel_topic)(Client *client, Channel *channel, MessageTag *recv_mtags, const char *topic, const char *set_by, time_t set_at); extern MODVAR void (*cmd_umode)(Client *, MessageTag *, int, const char **); extern MODVAR int (*register_user)(Client *client); extern MODVAR int (*tkl_hash)(unsigned int c); extern MODVAR char (*tkl_typetochar)(int type); extern MODVAR int (*tkl_chartotype)(char c); +extern MODVAR char (*tkl_configtypetochar)(const char *name); extern MODVAR const char *(*tkl_type_string)(TKL *tk); extern MODVAR const char *(*tkl_type_config_string)(TKL *tk); extern MODVAR TKL *(*tkl_add_serverban)(int type, const char *usermask, const char *hostmask, const char *reason, const char *setby, @@ -798,7 +843,6 @@ extern MODVAR void (*send_moddata_client)(Client *srv, Client *acptr); extern MODVAR void (*send_moddata_channel)(Client *srv, Channel *channel); extern MODVAR void (*send_moddata_members)(Client *srv); extern MODVAR void (*broadcast_moddata_client)(Client *acptr); -extern MODVAR int (*check_banned)(Client *cptr, int exitflags); extern MODVAR void (*introduce_user)(Client *to, Client *acptr); extern MODVAR int (*check_deny_version)(Client *cptr, const char *software, int protocol, const char *flags); extern MODVAR int (*match_user)(const char *rmask, Client *acptr, int options); @@ -810,6 +854,7 @@ extern MODVAR int (*do_remote_nick_name)(char *nick); extern MODVAR const char *(*charsys_get_current_languages)(void); extern MODVAR void (*broadcast_sinfo)(Client *acptr, Client *to, Client *except); extern MODVAR void (*connect_server)(ConfigItem_link *aconf, Client *by, struct hostent *hp); +extern MODVAR int (*is_services_but_not_ulined)(Client *client); extern MODVAR void (*parse_message_tags)(Client *cptr, char **str, MessageTag **mtag_list); extern MODVAR const char *(*mtags_to_string)(MessageTag *m, Client *acptr); extern MODVAR int (*can_send_to_channel)(Client *cptr, Channel *channel, const char **msgtext, const char **errmsg, int notice); @@ -818,6 +863,9 @@ extern MODVAR void (*broadcast_md_globalvar_cmd)(Client *except, Client *sender, extern MODVAR int (*tkl_ip_hash)(const char *ip); extern MODVAR int (*tkl_ip_hash_type)(int type); extern MODVAR int (*find_tkl_exception)(int ban_type, Client *cptr); +extern MODVAR int (*server_ban_parse_mask)(Client *client, int add, char type, const char *str, char **usermask_out, char **hostmask_out, int *soft, const char **error); +extern MODVAR int (*server_ban_exception_parse_mask)(Client *client, int add, const char *bantypes, const char *str, char **usermask_out, char **hostmask_out, int *soft, const char **error); +extern MODVAR void (*tkl_added)(Client *client, TKL *tkl); extern MODVAR int (*del_silence)(Client *client, const char *mask); extern MODVAR int (*add_silence)(Client *client, const char *mask, int senderr); extern MODVAR int (*is_silenced)(Client *client, Client *acptr); @@ -836,6 +884,22 @@ extern MODVAR char *(*get_chmodes_for_user)(Client *client, const char *flags); extern MODVAR WhoisConfigDetails (*whois_get_policy)(Client *client, Client *target, const char *name); extern MODVAR int (*make_oper)(Client *client, const char *operblock_name, const char *operclass, ConfigItem_class *clientclass, long modes, const char *snomask, const char *vhost); extern MODVAR int (*unreal_match_iplist)(Client *client, NameList *l); +extern MODVAR void (*webserver_send_response)(Client *client, int status, char *msg); +extern MODVAR void (*webserver_close_client)(Client *client); +extern MODVAR int (*webserver_handle_body)(Client *client, WebRequest *web, const char *readbuf, int length); +extern MODVAR void (*rpc_response)(Client *client, json_t *request, json_t *result); +extern MODVAR void (*rpc_error)(Client *client, json_t *request, JsonRpcError error_code, const char *error_message); +extern MODVAR void (*rpc_error_fmt)(Client *client, json_t *request, JsonRpcError error_code, FORMAT_STRING(const char *fmt), ...) __attribute__((format(printf,4,5))); +extern MODVAR void (*rpc_send_request_to_remote)(Client *source, Client *target, json_t *request); +extern MODVAR void (*rpc_send_response_to_remote)(Client *source, Client *target, json_t *request); +extern MODVAR int (*rrpc_supported_simple)(Client *target, char **problem_server); +extern MODVAR int (*rrpc_supported)(Client *target, const char *module, const char *minimum_version, char **problem_server); +extern MODVAR int (*websocket_handle_websocket)(Client *client, WebRequest *web, const char *readbuf2, int length2, int callback(Client *client, char *buf, int len)); +extern MODVAR int (*websocket_create_packet)(int opcode, char **buf, int *len); +extern MODVAR int (*websocket_create_packet_ex)(int opcode, char **buf, int *len, char *sendbuf, size_t sendbufsize); +extern MODVAR int (*websocket_create_packet_simple)(int opcode, const char **buf, int *len); +extern MODVAR const char *(*check_deny_link)(ConfigItem_link *link, int auto_connect); +extern MODVAR void (*mtag_add_issued_by)(MessageTag **mtags, Client *client, MessageTag *recv_mtags); /* /Efuncs */ /* TLS functions */ @@ -872,6 +936,21 @@ extern int del_silence_default_handler(Client *client, const char *mask); extern int is_silenced_default_handler(Client *client, Client *acptr); extern void do_unreal_log_remote_deliver_default_handler(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, const char *json_serialized); extern int make_oper_default_handler(Client *client, const char *operblock_name, const char *operclass, ConfigItem_class *clientclass, long modes, const char *snomask, const char *vhost); +extern void webserver_send_response_default_handler(Client *client, int status, char *msg); +extern void webserver_close_client_default_handler(Client *client); +extern int webserver_handle_body_default_handler(Client *client, WebRequest *web, const char *readbuf, int length); +extern void rpc_response_default_handler(Client *client, json_t *request, json_t *result); +extern void rpc_error_default_handler(Client *client, json_t *request, JsonRpcError error_code, const char *error_message); +extern void rpc_error_fmt_default_handler(Client *client, json_t *request, JsonRpcError error_code, const char *fmt, ...); +extern void rpc_send_request_to_remote_default_handler(Client *source, Client *target, json_t *request); +extern void rpc_send_response_to_remote_default_handler(Client *source, Client *target, json_t *response); +extern int rrpc_supported_simple_default_handler(Client *target, char **problem_server); +extern int rrpc_supported_default_handler(Client *target, const char *module, const char *minimum_version, char **problem_server); +extern int websocket_handle_websocket_default_handler(Client *client, WebRequest *web, const char *readbuf2, int length2, int callback(Client *client, char *buf, int len)); +extern int websocket_create_packet_default_handler(int opcode, char **buf, int *len); +extern int websocket_create_packet_ex_default_handler(int opcode, char **buf, int *len, char *sendbuf, size_t sendbufsize); +extern int websocket_create_packet_simple_default_handler(int opcode, const char **buf, int *len); +extern void mtag_add_issued_by_default_handler(MessageTag **mtags, Client *client, MessageTag *recv_mtags); /* End of default handlers for efunctions */ extern MODVAR MOTDFile opermotd, svsmotd, motd, botmotd, smotd, rules; @@ -880,6 +959,7 @@ extern int add_listmode(Ban **list, Client *cptr, Channel *channel, const char * extern int add_listmode_ex(Ban **list, Client *cptr, Channel *channel, const char *banid, const char *setby, time_t seton); extern int del_listmode(Ban **list, Channel *channel, const char *banid); extern int Halfop_mode(long mode); +extern const char *convert_regular_ban(char *mask, char *buf, size_t buflen); extern const char *clean_ban_mask(const char *, int, Client *, int); extern int find_invex(Channel *channel, Client *client); extern void DoMD5(char *mdout, const char *src, unsigned long n); @@ -955,6 +1035,7 @@ extern int unix_sockets_capable(void); extern void init_winsock(void); #endif extern MODVAR Client *remote_rehash_client; +extern MODVAR json_t *json_rehash_log; extern MODVAR int debugfd; extern void convert_to_absolute_path(char **path, const char *reldir); extern int has_user_mode(Client *acptr, char mode); @@ -994,7 +1075,7 @@ extern int verify_certificate(SSL *ssl, const char *hostname, char **errstr); extern const char *certificate_name(SSL *ssl); extern void start_of_normal_client_handshake(Client *acptr); extern void clicap_pre_rehash(void); -extern void clicap_post_rehash(void); +extern void clicap_check_for_changes(void); extern void unload_all_unused_mtag_handlers(void); extern void send_cap_notify(int add, const char *token); extern void sendbufto_one(Client *to, char *msg, unsigned int quick); @@ -1002,6 +1083,7 @@ extern MODVAR int current_serial; extern const char *spki_fingerprint(Client *acptr); extern const char *spki_fingerprint_ex(X509 *x509_cert); extern int is_module_loaded(const char *name); +extern int is_blacklisted_module(const char *name); extern void close_std_descriptors(void); extern void banned_client(Client *acptr, const char *bantype, const char *reason, int global, int noexit); extern char *mystpcpy(char *dst, const char *src); @@ -1093,6 +1175,7 @@ extern int hide_idle_time(Client *client, Client *target); extern void lost_server_link(Client *serv, const char *tls_error_string); extern const char *sendtype_to_cmd(SendType sendtype); extern MODVAR MessageTagHandler *mtaghandlers; +extern MODVAR RPCHandler *rpchandlers; #define nv_find_by_name(stru, name) do_nv_find_by_name(stru, name, ARRAY_SIZEOF((stru))) extern long do_nv_find_by_name(NameValue *table, const char *cmd, int numelements); #define nv_find_by_value(stru, value) do_nv_find_by_value(stru, value, ARRAY_SIZEOF((stru))) @@ -1111,6 +1194,7 @@ extern void add_fmt_nvplist(NameValuePrioList **lst, int priority, const char *n #define add_nvplist_numeric(lst, priority, name, to, numeric, ...) add_nvplist_numeric_fmt(lst, priority, name, to, numeric, STR_ ## numeric, ##__VA_ARGS__) extern void add_nvplist_numeric_fmt(NameValuePrioList **lst, int priority, const char *name, Client *to, int numeric, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,6,7))); extern NameValuePrioList *find_nvplist(NameValuePrioList *list, const char *name); +extern const char *get_nvplist(NameValuePrioList *list, const char *name); extern void free_nvplist(NameValuePrioList *lst); extern void unreal_add_name_values(NameValuePrioList **n, const char *name, ConfigEntry *ce); extern const char *namevalue(NameValuePrioList *n); @@ -1127,7 +1211,21 @@ extern void skip_whitespace(char **p); extern void read_until(char **p, char *stopchars); extern int is_ip_valid(const char *ip); extern int is_file_readable(const char *file, const char *dir); -json_t *json_string_unreal(const char *s); +/* json.c */ +extern int log_json_filter; +extern json_t *json_string_unreal(const char *s); +extern const char *json_object_get_string(json_t *j, const char *name); +extern int json_object_get_integer(json_t *j, const char *name, int default_value); +extern int json_object_get_boolean(json_t *j, const char *name, int default_value); +extern json_t *json_timestamp(time_t v); +extern const char *timestamp_iso8601_now(void); +extern const char *timestamp_iso8601(time_t v); +extern const char *json_get_value(json_t *t); +extern void json_expand_client(json_t *j, const char *key, Client *client, int detail); +extern void json_expand_client_security_groups(json_t *parent, Client *client); +extern void json_expand_channel(json_t *j, const char *key, Channel *channel, int detail); +extern void json_expand_tkl(json_t *j, const char *key, TKL *tkl, int detail); +/* end of json.c */ /* securitygroup.c start */ extern MODVAR SecurityGroup *securitygroups; extern void unreal_delete_masks(ConfigItem_mask *m); @@ -1202,7 +1300,7 @@ extern const char *log_type_valtostring(LogType v); #endif extern void do_unreal_log(LogLevel loglevel, const char *subsystem, const char *event_id, Client *client, const char *msg, ...) __attribute__((format(printf,5,0))); extern void do_unreal_log_raw(LogLevel loglevel, const char *subsystem, const char *event_id, Client *client, const char *msg, ...); -extern void do_unreal_log_internal_from_remote(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, const char *json_serialized, Client *from_server); +extern void do_unreal_log_internal_from_remote(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, json_t *json, const char *json_serialized, Client *from_server); extern LogData *log_data_string(const char *key, const char *str); extern LogData *log_data_char(const char *key, const char c); extern LogData *log_data_integer(const char *key, int64_t integer); @@ -1219,11 +1317,15 @@ extern int log_tests(void); extern void config_pre_run_log(void); extern void log_blocks_switchover(void); extern void postconf_defaults_log_block(void); +extern int valid_loglevel(int v); extern LogLevel log_level_stringtoval(const char *str); extern const char *log_level_valtostring(LogLevel loglevel); extern LogLevel log_level_stringtoval(const char *str); extern int valid_event_id(const char *s); extern int valid_subsystem(const char *s); +extern LogSource *add_log_source(const char *str); +extern void free_log_sources(LogSource *l); +extern int log_sources_match(LogSource *logsource, LogLevel loglevel, const char *subsystem, const char *event_id, int matched_already); extern const char *timestamp_iso8601_now(void); extern const char *timestamp_iso8601(time_t v); extern int is_valid_snomask(char c); @@ -1244,11 +1346,13 @@ extern const char *displayurl(const char *url); extern char *url_getfilename(const char *url); extern void download_file_async(const char *url, time_t cachetime, vFP callback, void *callback_data, char *original_url, int maxredirects); extern void url_init(void); +extern void url_cancel_handle_by_callback_data(void *ptr); extern EVENT(url_socket_timeout); /* end of url stuff */ extern char *collapse(char *pattern); extern void clear_scache_hash_table(void); extern void sendto_one(Client *, MessageTag *mtags, FORMAT_STRING(const char *), ...) __attribute__((format(printf,3,4))); +extern void mark_data_to_send(Client *to); extern EVENT(garbage_collect); extern EVENT(loop_event); extern EVENT(check_pings); @@ -1270,5 +1374,8 @@ extern void procio_post_rehash(int failure); /* end of proc i/o */ extern int minimum_msec_since_last_run(struct timeval *tv_old, long minimum); extern long get_connected_time(Client *client); +extern time_t get_creationtime(Client *client); extern const char *StripControlCodes(const char *text); extern const char *StripControlCodesEx(const char *text, char *output, size_t outputlen, int strip_flags); +extern MODVAR Module *Modules; +extern const char *command_issued_by_rpc(MessageTag *mtags); diff --git a/include/modules.h b/include/modules.h index 3c34c05..8c68dbc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -22,7 +22,7 @@ #define MODULES_H #include "types.h" #define MAXCUSTOMHOOKS 30 -#define MAXHOOKTYPES 150 +#define MAXHOOKTYPES 200 #define MAXCALLBACKS 30 #define MAXEFUNCTIONS 128 #if defined(_WIN32) @@ -107,6 +107,7 @@ typedef enum ModuleObjectType { MOBJ_CLICAP = 16, MOBJ_MTAG = 17, MOBJ_HISTORY_BACKEND = 18, + MOBJ_RPC = 19, } ModuleObjectType; typedef struct Umode Umode; @@ -284,10 +285,13 @@ struct Cmode { /** Free and remove parameter from list. * This function pointer is NULL (unused) for modes without parameters. - * @param parastruct The parameter struct + * @param parastruct The parameter struct + * @param soft This is set to 1 if you may 'resist freeing' + * (used by floodprot module to have active F profile even if -F). + * @returns Normally return 0, must return 1 if it 'resisted' freeing. * @note In most cases you will just call safe_free() on 'list' */ - void (*free_param)(void *parastruct); + int (*free_param)(void *parastruct, int soft); /** duplicate a struct and return a pointer to duplicate. * This function pointer is NULL (unused) for modes without parameters. @@ -317,6 +321,11 @@ struct Cmode { /** Unsetting also eats/requires a parameter. Unusual, but possible. */ char unset_with_param; + /** Is this mode available for chanmode +f, and if so for which flood type? + * eg 'j' for join flood. + */ + char flood_type_action; + /** Is this mode being unloaded? * This is set to 1 if the chanmode module providing this mode is unloaded * and we are waiting to see if in our new round of loads a "new" chanmode @@ -324,7 +333,7 @@ struct Cmode { * should never be 0 outside an internal rehash. */ char unloaded; - + /** Slot number - Can be used instead of GETPARAMSLOT() */ int param_slot; @@ -346,11 +355,12 @@ typedef struct { void * (*put_param)(void *, const char *); const char * (*get_param)(void *); const char * (*conv_param)(const char *, Client *, Channel *); - void (*free_param)(void *); + int (*free_param)(void *, int); void * (*dup_struct)(void *); int (*sjoin_check)(Channel *, void *, void *); char local; char unset_with_param; + char flood_type_action; } CmodeInfo; /** Get a slot number for a param - eg GETPARAMSLOT('k') */ @@ -433,7 +443,7 @@ struct Extban { int (*is_ok)(BanContext *b); - /** Convert input parameter to output [optional]. + /** Convert input parameter to output. * like with normal bans '+b blah' gets '+b blah!*@*', and it allows * you to limit the length of the ban too. * return value: pointer to output string (temp. storage) @@ -604,6 +614,49 @@ typedef struct { int (*history_destroy)(const char *object); } HistoryBackendInfo; +/** @defgroup RPCAPI RPC API + * @{ + */ + +/** No special flags set */ +#define RPC_HANDLER_FLAGS_NONE 0x0 +#define RPC_HANDLER_FLAGS_UNFILTERED 0x1 /**< Don't filter input (don't reject strings bigger than 510 in length or containing \r or \n) */ + +/** RPC Tag Handler */ +typedef struct RPCHandler RPCHandler; +struct RPCHandler { + RPCHandler *prev, *next; + char *method; /**< Name of the method handler, eg "client.get" */ + int flags; /**< A flag of RPC_HANDLER_FLAG_* */ + LogLevel loglevel; /**< Log level to use for this call: for example ULOG_DEBUG for .list calls, leave 0 for default */ + void (*call)(Client *, json_t *request, json_t *params); /**< RPC call: use RPC_CALL_FUNC() ! */ + Module *owner; /**< Module introducing this. */ + char unloaded; /**< Internal flag to indicate module is being unloaded */ +}; + +/** The struct used to register a RPC handler. + * For documentation, see the RPCHandler struct. + */ +typedef struct { + char *method; + int flags; + LogLevel loglevel; + void (*call)(Client *, json_t *request, json_t *params); +} RPCHandlerInfo; + +/** RPC function - used by all RPC call functions. + * This is used in the code like
RPC_CALL_FUNC(rpc_call_xyz)
as a function definition. + * It allows the UnrealIRCd devs to add or change parameters to the function without + * (necessarily) breaking your code. + * @param client The client issueing the request + * @param request The full JSON-RPC request + * @param params Parameters of the JSON-RPC call + * @note You are expected to call rpc_response() or rpc_error() on the request. + */ +#define RPC_CALL_FUNC(x) void (x) (Client *client, json_t *request, json_t *params) + +/** @} */ + struct Hook { Hook *prev, *next; int priority; @@ -688,6 +741,7 @@ typedef struct ModuleObject { ClientCapability *clicap; MessageTagHandler *mtag; HistoryBackend *history_backend; + RPCHandler *rpc; } object; } ModuleObject; @@ -735,9 +789,15 @@ struct Module #define MOD_OPT_OFFICIAL 0x0002 /* Official module, do not set "tainted" */ #define MOD_OPT_PERM_RELOADABLE 0x0004 /* Module is semi-permanent: it can be re-loaded but not un-loaded */ #define MOD_OPT_GLOBAL 0x0008 /* Module is required to be loaded globally (i.e. across the entire network) */ -#define MOD_OPT_UNLOAD_PRIORITY 0x1000 /* Module wants a higher or lower unload priority */ +#define MOD_OPT_PRIORITY 0x1000 /* Module wants a higher or lower priority for unloading, init, load, etc */ +#define MOD_OPT_UNLOAD_PRIORITY 0x1000 /* Alias for MOD_OPT_PRIORITY */ #define MOD_Dep(name, container,module) {#name, (vFP *) &container, module} +/** Websocket module should init 'first' because it handles sockets */ +#define WEBSOCKET_MODULE_PRIORITY_INIT -1000000000 +/** Websocket module should unload 'last' because it handles sockets */ +#define WEBSOCKET_MODULE_PRIORITY_UNLOAD 1000000000 + /** Event structs */ struct Event { Event *prev; /**< Previous event (linked list) */ @@ -825,6 +885,10 @@ extern HistoryBackend *HistoryBackendFind(const char *name); extern HistoryBackend *HistoryBackendAdd(Module *module, HistoryBackendInfo *mreq); extern void HistoryBackendDel(HistoryBackend *m); +extern RPCHandler *RPCHandlerFind(const char *method); +extern RPCHandler *RPCHandlerAdd(Module *module, RPCHandlerInfo *mreq); +extern void RPCHandlerDel(RPCHandler *m); + #ifndef GCC_TYPECHECKING #define HookAdd(module, hooktype, priority, func) HookAddMain(module, hooktype, priority, func, NULL, NULL, NULL) #define HookAddVoid(module, hooktype, priority, func) HookAddMain(module, hooktype, priority, NULL, func, NULL, NULL) @@ -909,6 +973,11 @@ extern int CommandExists(const char *name); extern CommandOverride *CommandOverrideAdd(Module *module, const char *name, int priority, OverrideCmdFunc func); extern void CommandOverrideDel(CommandOverride *ovr); extern void CallCommandOverride(CommandOverride *ovr, Client *client, MessageTag *mtags, int parc, const char *parv[]); +/** Call next command override function - easy way to do it. + * This way you don't have to call CallCommandOverride() with the right arguments. + * Which is nice because command (override) arguments may change in future UnrealIRCd versions. + */ +#define CALL_NEXT_COMMAND_OVERRIDE() CallCommandOverride(ovr, client, recv_mtags, parc, parv) extern void moddata_free_client(Client *acptr); extern void moddata_free_local_client(Client *acptr); @@ -937,6 +1006,11 @@ extern int LoadPersistentLongX(ModuleInfo *modinfo, const char *varshortname, lo extern void SavePersistentLongX(ModuleInfo *modinfo, const char *varshortname, long var); #define SavePersistentLong(modinfo, var) SavePersistentLongX(modinfo, #var, var) +extern int LoadPersistentLongLongX(ModuleInfo *modinfo, const char *varshortname, long long *var); +#define LoadPersistentLongLong(modinfo, var) LoadPersistentLongLongX(modinfo, #var, &var) +extern void SavePersistentLongLongX(ModuleInfo *modinfo, const char *varshortname, long long var); +#define SavePersistentLongLong(modinfo, var) SavePersistentLongLongX(modinfo, #var, var) + /** Hooks trigger on "events", such as a new user connecting or joining a channel, * see https://www.unrealircd.org/docs/Dev:Hook_API for background info. * You are suggested to use CTRL+F on this page to search for any useful hook, @@ -1170,6 +1244,12 @@ extern void SavePersistentLongX(ModuleInfo *modinfo, const char *varshortname, l #define HOOKTYPE_JSON_EXPAND_CLIENT_SERVER 114 /** See hooktype_json_expand_channel() */ #define HOOKTYPE_JSON_EXPAND_CHANNEL 115 +/** See hooktype_accept() */ +#define HOOKTYPE_ACCEPT 116 +/** See hooktype_pre_local_handshake_timeout */ +#define HOOKTYPE_PRE_LOCAL_HANDSHAKE_TIMEOUT 117 +/** See hooktype_rehash_log */ +#define HOOKTYPE_REHASH_LOG 118 /* Adding a new hook here? * 1) Add the #define HOOKTYPE_.... with a new number @@ -1759,11 +1839,12 @@ int hooktype_tkl_del(Client *client, TKL *tkl); * @param subsystem Subsystem (eg "operoverride") * @param event_id Event ID (eg "SAJOIN_COMMAND") * @param msg Message(s) in text form - * @param json_serialized The associated JSON text + * @param json The JSON log entry + * @param json_serialized The serialized JSON log entry (as a string) * @param timebuf The [xxxx] time buffer, for convenience * @return The return value is ignored (use return 0) */ -int hooktype_log(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, const char *json_serialized, const char *timebuf); +int hooktype_log(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, json_t *json, const char *json_serialized, const char *timebuf); /** Called when a local user matches a spamfilter (function prototype for HOOKTYPE_LOCAL_SPAMFILTER). * @param client The client @@ -1821,6 +1902,18 @@ int hooktype_packet(Client *from, Client *to, Client *intended_to, char **msg, i */ int hooktype_handshake(Client *client); +/** Called very early when a client connects (function prototype for HOOKTYPE_ACCEPT). + * Module coders: have a look at hooktype_handshake() instead of this one! + * HOOKTYPE_ACCEPT is called even before HOOKTYPE_HANDSHAKE, as soon as the socket + * is connected and during the client is being set up, before the SSL/TLS handshake. + * It is only used for connection flood detection and checking (G)Z-lines. + * Note that this connection is also called for *NIX domain socket connections, + * HTTP(S) requests, and so on. + * @param client The client + * @return One of HOOK_*. Use HOOK_DENY to reject the client. + */ +int hooktype_accept(Client *client); + /** Called when a client structure is freed (function prototype for HOOKTYPE_FREE_CLIENT). * @param client The client * @note Normally you use hooktype_local_quit(), hooktype_remote_quit() and hooktype_unkuser_quit() for this. @@ -2200,6 +2293,24 @@ int hooktype_json_expand_client_server(Client *client, int detail, json_t *j, js */ int hooktype_json_expand_channel(Channel *channel, int detail, json_t *j); +/** Called when a local user is about to be disconnected due to a registration timeout, + * allows changing the disconnect reason (function prototype for HOOKTYPE_PRE_LOCAL_HANDSHAKE_TIMEOUT). + * This is used by the authprompt module. + * @param client The client + * @param comment The quit/disconnect reason (can be changed by you) + * @retval HOOK_CONTINUE Continue as normal + * @retval HOOK_ALLOW Do not exit the user due to a handshake timeout + */ +int hooktype_pre_local_handshake_timeout(Client *client, const char **comment); + +/** Called when a REHASH completed (either succesfully or with a failure). + * This gives the full rehash log. Used by the JSON-RPC interface. + * @param failure Set to 1 if the rehash failed, otherwise 0. + * @param t The JSON object containing the rehash log and other information. + * @return The return value is ignored (use return 0) + */ +int hooktype_rehash_log(int failure, json_t *rehash_log); + /** @} */ #ifdef GCC_TYPECHECKING @@ -2318,7 +2429,9 @@ _UNREAL_ERROR(_hook_error_incompatible, "Incompatible hook function. Check argum ((hooktype == HOOKTYPE_JSON_EXPAND_CLIENT) && !ValidateHook(hooktype_json_expand_client, func)) || \ ((hooktype == HOOKTYPE_JSON_EXPAND_CLIENT_USER) && !ValidateHook(hooktype_json_expand_client_user, func)) || \ ((hooktype == HOOKTYPE_JSON_EXPAND_CLIENT_SERVER) && !ValidateHook(hooktype_json_expand_client_server, func)) || \ - ((hooktype == HOOKTYPE_JSON_EXPAND_CHANNEL) && !ValidateHook(hooktype_json_expand_channel, func)) ) \ + ((hooktype == HOOKTYPE_JSON_EXPAND_CHANNEL) && !ValidateHook(hooktype_json_expand_channel, func)) || \ + ((hooktype == HOOKTYPE_PRE_LOCAL_HANDSHAKE_TIMEOUT) && !ValidateHook(hooktype_pre_local_handshake_timeout, func)) || \ + ((hooktype == HOOKTYPE_REHASH_LOG) && !ValidateHook(hooktype_rehash_log, func)) ) \ _hook_error_incompatible(); #endif /* GCC_TYPECHECKING */ @@ -2350,6 +2463,7 @@ enum EfunctionType { EFUNC_DO_MODE, EFUNC_SET_MODE, EFUNC_SET_CHANNEL_MODE, + EFUNC_SET_CHANNEL_TOPIC, EFUNC_CMD_UMODE, EFUNC_REGISTER_USER, EFUNC_TKL_HASH, @@ -2382,7 +2496,6 @@ enum EfunctionType { EFUNC_BROADCAST_MD_CHANNEL, EFUNC_BROADCAST_MD_MEMBER, EFUNC_BROADCAST_MD_MEMBERSHIP, - EFUNC_CHECK_BANNED, EFUNC_INTRODUCE_USER, EFUNC_CHECK_DENY_VERSION, EFUNC_BROADCAST_MD_CLIENT_CMD, @@ -2404,9 +2517,11 @@ enum EfunctionType { EFUNC_CHARSYS_GET_CURRENT_LANGUAGES, EFUNC_BROADCAST_SINFO, EFUNC_CONNECT_SERVER, + EFUNC_IS_SERVICES_BUT_NOT_ULINED, EFUNC_PARSE_MESSAGE_TAGS, EFUNC_MTAGS_TO_STRING, EFUNC_TKL_CHARTOTYPE, + EFUNC_TKL_CONFIGTYPETOCHAR, EFUNC_TKL_TYPE_STRING, EFUNC_TKL_TYPE_CONFIG_STRING, EFUNC_CAN_SEND_TO_CHANNEL, @@ -2426,6 +2541,9 @@ enum EfunctionType { EFUNC_FIND_TKL_NAMEBAN, EFUNC_FIND_TKL_SPAMFILTER, EFUNC_FIND_TKL_EXCEPTION, + EFUNC_SERVER_BAN_PARSE_MASK, + EFUNC_SERVER_BAN_EXCEPTION_PARSE_MASK, + EFUNC_TKL_ADDED, EFUNC_ADD_SILENCE, EFUNC_DEL_SILENCE, EFUNC_IS_SILENCED, @@ -2444,6 +2562,22 @@ enum EfunctionType { EFUNC_WHOIS_GET_POLICY, EFUNC_MAKE_OPER, EFUNC_UNREAL_MATCH_IPLIST, + EFUNC_WEBSERVER_SEND_RESPONSE, + EFUNC_WEBSERVER_CLOSE_CLIENT, + EFUNC_WEBSERVER_HANDLE_BODY, + EFUNC_RPC_RESPONSE, + EFUNC_RPC_ERROR, + EFUNC_RPC_ERROR_FMT, + EFUNC_RPC_SEND_REQUEST_TO_REMOTE, + EFUNC_RPC_SEND_RESPONSE_TO_REMOTE, + EFUNC_RRPC_SUPPORTED, + EFUNC_RRPC_SUPPORTED_SIMPLE, + EFUNC_WEBSOCKET_HANDLE_WEBSOCKET, + EFUNC_WEBSOCKET_CREATE_PACKET, + EFUNC_WEBSOCKET_CREATE_PACKET_EX, + EFUNC_WEBSOCKET_CREATE_PACKET_SIMPLE, + EFUNC_CHECK_DENY_LINK, + EFUNC_MTAG_GENERATE_ISSUED_BY_IRC, }; /* Module flags */ diff --git a/include/numeric.h b/include/numeric.h index 5380bbe..2f71723 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -59,6 +59,7 @@ #define ERR_NORECIPIENT 411 #define ERR_NOTEXTTOSEND 412 #define ERR_TOOMANYMATCHES 416 +#define ERR_INPUTTOOLONG 417 #define ERR_UNKNOWNCOMMAND 421 #define ERR_NOMOTD 422 @@ -482,6 +483,7 @@ #define STR_ERR_NORECIPIENT /* 411 */ ":No recipient given (%s)" #define STR_ERR_NOTEXTTOSEND /* 412 */ ":No text to send" #define STR_ERR_TOOMANYMATCHES /* 416 */ "%s :%s" +#define STR_ERR_INPUTTOOLONG /* 417 */ ":Input line was too long" #define STR_ERR_UNKNOWNCOMMAND /* 421 */ "%s :Unknown command" #define STR_ERR_NOMOTD /* 422 */ ":MOTD File is missing" #define STR_ERR_NOADMININFO /* 423 */ "%s :No administrative info available" diff --git a/include/setup.h.in b/include/setup.h.in index 16b097c..1b69b18 100644 --- a/include/setup.h.in +++ b/include/setup.h.in @@ -43,6 +43,9 @@ /* Define if ssl library has SSL_CTX_set_security_level */ #undef HAS_SSL_CTX_SET_SECURITY_LEVEL +/* Define if ssl library has X509_check_host */ +#undef HAS_X509_check_host + /* Define if ssl library has X509_get0_notAfter */ #undef HAS_X509_get0_notAfter @@ -76,9 +79,6 @@ /* Define to 1 if you have the `kqueue' function. */ #undef HAVE_KQUEUE -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL @@ -100,6 +100,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H @@ -121,6 +124,9 @@ /* Define to 1 if you have the `strlncpy' function. */ #undef HAVE_STRLNCPY +/* Define to 1 if you have the `strnlen' function. */ +#undef HAVE_STRNLEN + /* Define to 1 if you have the `syslog' function. */ #undef HAVE_SYSLOG @@ -201,7 +207,9 @@ tofail) */ #undef STATIC_LINKING -/* Define to 1 if you have the ANSI C header files. */ +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ #undef STDC_HEADERS /* Define if you have the header file. */ diff --git a/include/struct.h b/include/struct.h index 86d99e6..de3f5de 100644 --- a/include/struct.h +++ b/include/struct.h @@ -39,6 +39,9 @@ #include #include #include +#ifdef HAS_X509_check_host +#include +#endif #include #include "common.h" #include "sys.h" @@ -104,7 +107,6 @@ typedef struct ConfigItem_vhost ConfigItem_vhost; typedef struct ConfigItem_link ConfigItem_link; typedef struct ConfigItem_ban ConfigItem_ban; typedef struct ConfigItem_deny_dcc ConfigItem_deny_dcc; -typedef struct ConfigItem_deny_link ConfigItem_deny_link; typedef struct ConfigItem_deny_channel ConfigItem_deny_channel; typedef struct ConfigItem_deny_version ConfigItem_deny_version; typedef struct ConfigItem_alias ConfigItem_alias; @@ -128,6 +130,7 @@ typedef struct LocalClient LocalClient; typedef struct Channel Channel; typedef struct User User; typedef struct Server Server; +typedef struct RPCClient RPCClient; typedef struct Link Link; typedef struct Ban Ban; typedef struct Mode Mode; @@ -179,7 +182,9 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia #define KEYLEN 23 #define LINKLEN 32 #define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */ -#define READBUFSIZE 8192 /* for the read buffer */ +#define MAXTAGSIZE 8192 /**< Maximum length of message tags (4K user + 4K server) */ +#define MAXLINELENGTH (MAXTAGSIZE+BUFSIZE) /**< Maximum length of a line on IRC: 4k client tags + 4k server tags + 512 bytes (IRCv3) */ +#define READBUFSIZE MAXLINELENGTH /* for the read buffer */ #define MAXRECIPIENTS 20 #define MAXSILELENGTH NICKLEN+USERLEN+HOSTLEN+10 #define IDLEN 12 @@ -323,9 +328,10 @@ typedef enum LogDestination { LOG_DEST_SNOMASK=0, LOG_DEST_OPER=1, LOG_DEST_REMO * @{ */ typedef enum ClientStatus { - CLIENT_STATUS_CONTROL = -8, /**< Client is on the control channel */ - CLIENT_STATUS_LOG = -7, /**< Client is a log file */ - CLIENT_STATUS_TLS_STARTTLS_HANDSHAKE = -8, /**< Client is doing a STARTTLS handshake */ + CLIENT_STATUS_RPC = -10, /**< RPC Client (either local or remote) */ + CLIENT_STATUS_CONTROL = -9, /**< Client is on the control channel */ + CLIENT_STATUS_LOG = -8, /**< Client is a log file */ + CLIENT_STATUS_TLS_STARTTLS_HANDSHAKE = -7, /**< Client is doing a STARTTLS handshake */ CLIENT_STATUS_CONNECTING = -6, /**< Client is an outgoing connect */ CLIENT_STATUS_TLS_CONNECT_HANDSHAKE = -5, /**< Client is doing an TLS handshake - outgoing connection */ CLIENT_STATUS_TLS_ACCEPT_HANDSHAKE = -4, /**< Client is doing an TLS handshake - incoming connection */ @@ -346,7 +352,8 @@ typedef enum ClientStatus { /** Client is not fully registered yet. May become a user or a server, we don't know yet. */ #define IsUnknown(x) (((x)->status == CLIENT_STATUS_UNKNOWN) || ((x)->status == CLIENT_STATUS_TLS_STARTTLS_HANDSHAKE)) #define IsServer(x) ((x)->status == CLIENT_STATUS_SERVER) /**< Is a server that has completed the connection handshake */ -#define IsControl(x) ((x)->status == CLIENT_STATUS_CONTROL) /**< Is on the control channel (not on IRC) */ +#define IsControl(x) ((x)->status == CLIENT_STATUS_CONTROL) /**< Is on the control channel (not an IRC client) */ +#define IsRPC(x) ((x)->status == CLIENT_STATUS_RPC) /**< Is doing RPC (not an IRC client) */ #define IsLog(x) ((x)->status == CLIENT_STATUS_LOG) /**< Is a log file, not a user or server */ #define IsStartTLSHandshake(x) ((x)->status == CLIENT_STATUS_TLS_STARTTLS_HANDSHAKE) /**< Currently doing a STARTTLS handshake */ #define IsTLSAcceptHandshake(x) ((x)->status == CLIENT_STATUS_TLS_ACCEPT_HANDSHAKE) /**< Currently doing a TLS handshake - incoming */ @@ -364,6 +371,7 @@ typedef enum ClientStatus { #define SetUser(x) ((x)->status = CLIENT_STATUS_USER) #define SetLog(x) ((x)->status = CLIENT_STATUS_LOG) #define SetControl(x) ((x)->status = CLIENT_STATUS_CONTROL) +#define SetRPC(x) ((x)->status = CLIENT_STATUS_RPC) #define SetUser(x) ((x)->status = CLIENT_STATUS_USER) /** @} */ @@ -403,6 +411,7 @@ typedef enum ClientStatus { #define CLIENT_FLAG_PINGWARN 0x10000000 /**< Server ping warning (remote server slow with responding to PINGs) */ #define CLIENT_FLAG_NOHANDSHAKEDELAY 0x20000000 /**< No handshake delay */ #define CLIENT_FLAG_SERVER_DISCONNECT_LOGGED 0x40000000 /**< Server disconnect message is (already) logged */ +#define CLIENT_FLAG_ASYNC_RPC 0x80000000 /**< Asynchronous remote RPC request - special case for rehash etc. */ /** @} */ @@ -493,8 +502,10 @@ typedef enum ClientStatus { #define IsTLS(x) ((x)->flags & CLIENT_FLAG_TLS) #define IsSecure(x) ((x)->flags & CLIENT_FLAG_TLS) #define IsULine(x) ((x)->flags & CLIENT_FLAG_ULINE) +#define IsSvsCmdOk(x) (((x)->flags & CLIENT_FLAG_ULINE) || ((iConf.limit_svscmds == LIMIT_SVSCMDS_SERVERS) && (IsServer((x)) || IsMe((x))))) #define IsVirus(x) ((x)->flags & CLIENT_FLAG_VIRUS) #define IsIdentLookupSent(x) ((x)->flags & CLIENT_FLAG_IDENTLOOKUPSENT) +#define IsAsyncRPC(x) ((x)->flags & CLIENT_FLAG_ASYNC_RPC) #define SetIdentLookup(x) do { (x)->flags |= CLIENT_FLAG_IDENTLOOKUP; } while(0) #define SetClosing(x) do { (x)->flags |= CLIENT_FLAG_CLOSING; } while(0) #define SetDCCBlock(x) do { (x)->flags |= CLIENT_FLAG_DCCBLOCK; } while(0) @@ -526,6 +537,7 @@ typedef enum ClientStatus { #define SetULine(x) do { (x)->flags |= CLIENT_FLAG_ULINE; } while(0) #define SetVirus(x) do { (x)->flags |= CLIENT_FLAG_VIRUS; } while(0) #define SetIdentLookupSent(x) do { (x)->flags |= CLIENT_FLAG_IDENTLOOKUPSENT; } while(0) +#define SetAsyncRPC(x) do { (x)->flags |= CLIENT_FLAG_ASYNC_RPC; } while(0) #define ClearIdentLookup(x) do { (x)->flags &= ~CLIENT_FLAG_IDENTLOOKUP; } while(0) #define ClearClosing(x) do { (x)->flags &= ~CLIENT_FLAG_CLOSING; } while(0) #define ClearDCCBlock(x) do { (x)->flags &= ~CLIENT_FLAG_DCCBLOCK; } while(0) @@ -556,12 +568,13 @@ typedef enum ClientStatus { #define ClearULine(x) do { (x)->flags &= ~CLIENT_FLAG_ULINE; } while(0) #define ClearVirus(x) do { (x)->flags &= ~CLIENT_FLAG_VIRUS; } while(0) #define ClearIdentLookupSent(x) do { (x)->flags &= ~CLIENT_FLAG_IDENTLOOKUPSENT; } while(0) +#define ClearAsyncRPC(x) do { (x)->flags &= ~CLIENT_FLAG_ASYNC_RPC; } while(0) +/** @} */ + #define IsIPV6(x) ((x)->local->socket_type == SOCKET_TYPE_IPV6) #define IsUnixSocket(x) ((x)->local->socket_type == SOCKET_TYPE_UNIX) #define SetIPV6(x) do { (x)->local->socket_type = SOCKET_TYPE_IPV6; } while(0) #define SetUnixSocket(x) do { (x)->local->socket_type = SOCKET_TYPE_UNIX; } while(0) -/** @} */ - /* Others that access client structs: */ #define IsNotSpoof(x) ((x)->local->nospoof == 0) @@ -788,6 +801,20 @@ struct MOTDLine { struct MOTDLine *next; }; +/** Current status of configuration in memory (what stage are we in..) */ +typedef enum ConfigStatus { + CONFIG_STATUS_NONE = 0, /**< Config files have not been parsed yet */ + CONFIG_STATUS_TEST = 1, /**< Currently running MOD_TEST() */ + CONFIG_STATUS_POSTTEST = 2, /**< Currently running post_config_test hooks */ + CONFIG_STATUS_PRE_INIT = 3, /**< In-between */ + CONFIG_STATUS_INIT = 4, /**< Currently running MOD_INIT() */ + CONFIG_STATUS_RUN_CONFIG = 5, /**< Currently running CONFIG_RUN hooks */ + CONFIG_STATUS_LOAD = 6, /**< Currently running MOD_LOAD() */ + CONFIG_STATUS_POSTLOAD = 7, /**< Doing post-load stuff like activating listeners */ + CONFIG_STATUS_COMPLETE = 8, /**< Load or rehash complete */ + CONFIG_STATUS_ROLLBACK = 99, /**< Configuration failed, rolling back changes */ +} ConfigStatus; + struct LoopStruct { unsigned do_garbage_collect : 1; unsigned config_test : 1; @@ -801,6 +828,7 @@ struct LoopStruct { unsigned rehash_download_busy : 1; /* don't return "all downloads complete", needed for race condition */ unsigned tainted : 1; int rehashing; + ConfigStatus config_status; Client *rehash_save_client; void (*boot_function)(); }; @@ -826,10 +854,15 @@ typedef struct Whowas { char *username; char *hostname; char *virthost; + char *ip; char *servername; char *realname; + char *account; long umodes; - time_t logoff; + time_t logon; + time_t logoff; + time_t connected_since; + WhoWasEvent event; struct Client *online; /* Pointer to new nickname for chasing or NULL */ struct Whowas *next; /* for hash table... */ struct Whowas *prev; /* for hash table... */ @@ -873,8 +906,9 @@ struct SWhois { /** Command function - used by all command handlers. * This is used in the code like
CMD_FUNC(cmd_yourcmd)
as a function definition. - * @param cptr The client direction pointer. - * @param client The source client pointer (you usually need this one). + * It allows UnrealIRCd devs to change the parameters in the function without + * (necessarily) breaking your code. + * @param client The client * @param recv_mtags Received message tags for this command. * @param parc Parameter count *plus* 1. * @param parv Parameter values. @@ -885,6 +919,15 @@ struct SWhois { * E.g. parv[3] in the above example is out of bounds. */ #define CMD_FUNC(x) void (x) (Client *client, MessageTag *recv_mtags, int parc, const char *parv[]) + +/** Call a command function - can be useful if you are calling another command function in your own module. + * For example in cmd_nick() we call cmd_nick_local() for local functions, + * and then we can just use CALL_CMD_FUNC(cmd_nick_local); and don't have + * to bother with passing the right command arguments. Which is nice because + * command arguments may change in future UnrealIRCd versions. + */ +#define CALL_CMD_FUNC(x) (x)(client, recv_mtags, parc, parv) + /** @} */ /** Command override function - used by all command override handlers. @@ -1226,13 +1269,15 @@ extern ModDataInfo *ModDataAdd(Module *module, ModDataInfo req); extern void ModDataDel(ModDataInfo *md); extern void unload_all_unused_moddata(void); -#define LISTENER_NORMAL 0x000001 -#define LISTENER_CLIENTSONLY 0x000002 -#define LISTENER_SERVERSONLY 0x000004 -#define LISTENER_TLS 0x000010 -#define LISTENER_BOUND 0x000020 -#define LISTENER_DEFER_ACCEPT 0x000040 -#define LISTENER_CONTROL 0x000080 /**< Control channel */ +#define LISTENER_NORMAL 0x000001 +#define LISTENER_CLIENTSONLY 0x000002 +#define LISTENER_SERVERSONLY 0x000004 +#define LISTENER_TLS 0x000010 +#define LISTENER_BOUND 0x000020 +#define LISTENER_DEFER_ACCEPT 0x000040 +#define LISTENER_CONTROL 0x000080 /**< Control channel */ +#define LISTENER_NO_CHECK_CONNECT_FLOOD 0x000100 /**< Don't check for connect-flood and max-unknown-connections-per-ip (eg for RPC) */ +#define LISTENER_NO_CHECK_ZLINED 0x000200 /**< Don't check for zlines */ #define IsServersOnlyListener(x) ((x) && ((x)->options & LISTENER_SERVERSONLY)) @@ -1292,11 +1337,12 @@ struct Client { LocalClient *local; /**< Additional information regarding locally connected clients */ User *user; /**< Additional information, if this client is a user */ Server *server; /**< Additional information, if this is a server */ + RPCClient *rpc; /**< RPC Client, or NULL */ ClientStatus status; /**< Client status, one of CLIENT_STATUS_* */ struct list_head client_hash; /**< For name hash table (clientTable) */ char name[HOSTLEN + 1]; /**< Unique name of the client: nickname for users, hostname for servers */ time_t lastnick; /**< Timestamp on nick */ - long flags; /**< Client flags (one or more of CLIENT_FLAG_*) */ + uint64_t flags; /**< Client flags (one or more of CLIENT_FLAG_*) */ long umodes; /**< Client usermodes (if user) */ Client *direction; /**< Direction from which this client originated. This always points to a directly connected server or &me. @@ -1349,6 +1395,7 @@ struct LocalClient { char sockhost[HOSTLEN + 1]; /**< Hostname from the socket */ u_short port; /**< Remote TCP port of client */ FloodCounter flood[MAXFLOODOPTIONS]; + RPCClient *rpc; /**< RPC Client, or NULL */ }; /** User information (persons, not servers), you use client->user to access these (see also @link Client @endlink). @@ -1393,6 +1440,15 @@ struct Server { /** @} */ +typedef struct RPCClient RPCClient; +/** RPC Client information */ +struct RPCClient { + char *rpc_user; /**< Name of the rpc-user block after authentication, NULL during pre-auth */ + char *issuer; /**< Optional name of the issuer, set by rpc.set_issuer(), eg logged in user on admin panel, can be NULL */ + json_t *rehash_request; /**< If a REHASH (request) is currently running, otherwise NULL */ + LogSource *log_sources; /**< Subscribed to which log sources */ +}; + struct MessageTag { MessageTag *prev, *next; char *name; @@ -1409,7 +1465,8 @@ typedef enum PreprocessorItem { typedef enum PreprocessorPhase { PREPROCESSOR_PHASE_INITIAL = 1, - PREPROCESSOR_PHASE_MODULE = 2 + PREPROCESSOR_PHASE_SECONDARY = 2, + PREPROCESSOR_PHASE_MODULE = 3 } PreprocessorPhase; typedef enum AuthenticationType { @@ -1437,6 +1494,30 @@ struct AuthConfig { #define crypt DES_crypt #endif +/* CRULE stuff */ + +#define CRULE_ALL 0 +#define CRULE_AUTO 1 + +/* some constants and shared data types */ +#define CR_MAXARGLEN 80 /**< Maximum arg length (must be > HOSTLEN) */ +#define CR_MAXARGS 3 /**< Maximum number of args for a rule */ + +/** Evaluation function for a connection rule. */ +typedef int (*crule_funcptr) (int, void **); + +/** CRULE - Node in a connection rule tree. */ +struct CRuleNode { + crule_funcptr funcptr; /**< Evaluation function for this node. */ + int numargs; /**< Number of arguments. */ + void *arg[CR_MAXARGS]; /**< Array of arguments. For operators, each arg + is a tree element; for functions, each arg is + a string. */ +}; +typedef struct CRuleNode CRuleNode; +typedef struct CRuleNode* CRuleNodePtr; + + /* * conf2 stuff -stskeeps */ @@ -1514,9 +1595,6 @@ struct ConfigFlag_tld #define CONF_BAN_TYPE_AKILL 1 #define CONF_BAN_TYPE_TEMPORARY 2 -#define CRULE_ALL 0 -#define CRULE_AUTO 1 - struct ConfigItem { ConfigItem *prev, *next; ConfigFlag flag; @@ -1693,19 +1771,93 @@ struct ConfigItem_tld { u_short options; }; +#define WEB_OPT_ENABLE 0x1 + +typedef enum HttpMethod { + HTTP_METHOD_NONE = 0, /**< No valid HTTP request (yet) */ + HTTP_METHOD_HEAD = 1, /**< HEAD request */ + HTTP_METHOD_GET = 2, /**< GET request */ + HTTP_METHOD_PUT = 3, /**< PUT request */ + HTTP_METHOD_POST = 4, /**< POST request */ +} HttpMethod; + +typedef enum TransferEncoding { + TRANSFER_ENCODING_NONE=0, + TRANSFER_ENCODING_CHUNKED=1 +} TransferEncoding; + +typedef struct WebRequest WebRequest; +struct WebRequest { + HttpMethod method; /**< GET/PUT/POST */ + char *uri; /**< Requested resource, eg "/api" */ + NameValuePrioList *headers; /**< HTTP request headers */ + int num_headers; /**< Number of HTTP request headers (also used for sorting the list) */ + char request_header_parsed; /**< Done parsing? */ + char *lefttoparse; /**< Leftover buffer to parse */ + int lefttoparselen; /**< Length of lefttoparse buffer */ + int pending_close; /**< Set to 1 when connection should be closed as soon as all data is sent (sendq==0) */ + char *request_buffer; /**< Buffer for POST data */ + int request_buffer_size; /**< Size of buffer for POST data */ + int request_body_complete; /**< POST data has all been read */ + long long content_length; /**< "Content-Length" as sent by the client */ + long long chunk_remaining; + TransferEncoding transfer_encoding; + long long config_max_request_buffer_size; /**< CONFIG: Maximum request length allowed */ +}; + +typedef struct WebServer WebServer; +struct WebServer { + int (*handle_request)(Client *client, WebRequest *web); + int (*handle_body)(Client *client, WebRequest *web, const char *buf, int length); +}; + +typedef enum WebSocketType { + WEBSOCKET_TYPE_BINARY = 1, + WEBSOCKET_TYPE_TEXT = 2 +} WebSocketType; + +typedef struct WebSocketUser WebSocketUser; +struct WebSocketUser { + char get; /**< GET initiated */ + char handshake_completed; /**< Handshake completed, use websocket frames */ + char *handshake_key; /**< Handshake key (used during handshake) */ + char *lefttoparse; /**< Leftover buffer to parse */ + int lefttoparselen; /**< Length of lefttoparse buffer */ + WebSocketType type; /**< WEBSOCKET_TYPE_BINARY or WEBSOCKET_TYPE_TEXT */ + char *sec_websocket_protocol; /**< Only valid during parsing of the request, after that it is NULL again */ + char *forwarded; /**< Unparsed `Forwarded:` header, RFC 7239 */ + int secure; /**< If there is a Forwarded header, this indicates if the remote connection is secure */ +}; + +#define WEBSOCKET_MAGIC_KEY "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" /* see RFC6455 */ + +/* Websocket operations: */ +#define WSOP_CONTINUATION 0x00 +#define WSOP_TEXT 0x01 +#define WSOP_BINARY 0x02 +#define WSOP_CLOSE 0x08 +#define WSOP_PING 0x09 +#define WSOP_PONG 0x0a + struct ConfigItem_listen { ConfigItem_listen *prev, *next; ConfigFlag flag; - SocketType socket_type; - char *file; - char *ip; - int port; - int options, clients; - int fd; - SSL_CTX *ssl_ctx; - TLSOptions *tls_options; - int websocket_options; /* should be in module, but lazy */ - char *websocket_forward; + SocketType socket_type; /**< Socket type, eg. SOCKET_TYPE_IPV4 or SOCKET_TYPE_UNIX */ + char *file; /**< If the listener is a file, the full pathname */ + char *ip; /**< IP bind address (if IP listener) */ + int port; /**< Port to listen on (if IP listener) */ + int mode; /**< Mode permissions (if file aka unix socket listener) */ + int options; /**< e.g. LISTENER_BOUND if active */ + int clients; /**< Clients connected to this socket / listener */ + int fd; /**< File descriptor (if open), or -1 (if not open yet) */ + char *spoof_ip; /**< listen::spoof-ip (only for listen::file, if you want to override 127.0.0.1) */ + SSL_CTX *ssl_ctx; /**< SSL/TLS context */ + TLSOptions *tls_options; /**< SSL/TLS options */ + WebServer *webserver; /**< For the webserver module */ + void (*start_handshake)(Client *client); /**< Function to call on accept() */ + int websocket_options; /**< Websocket options (for the websocket module) */ + int rpc_options; /**< For the RPC module */ + char *websocket_forward; /**< For websocket module too */ }; struct ConfigItem_sni { @@ -1768,13 +1920,6 @@ struct ConfigItem_deny_dcc { char *filename, *reason; }; -struct ConfigItem_deny_link { - ConfigItem_deny_link *prev, *next; - ConfigFlag_except flag; - ConfigItem_mask *mask; - char *rule, *prettyrule; -}; - struct ConfigItem_deny_version { ConfigItem_deny_version *prev, *next; ConfigFlag flag; @@ -1873,6 +2018,7 @@ struct SecurityGroup { int reputation_score; long connect_time; int webirc; + int websocket; int tls; NameList *ip; ConfigItem_mask *mask; @@ -1883,6 +2029,7 @@ struct SecurityGroup { int exclude_reputation_score; long exclude_connect_time; int exclude_webirc; + int exclude_websocket; int exclude_tls; NameList *exclude_ip; ConfigItem_mask *exclude_mask; @@ -2270,6 +2417,62 @@ typedef enum WhoisConfigDetails { #define UNRL_STRIP_LOW_ASCII 0x1 /**< Strip all ASCII < 32 (control codes) */ #define UNRL_STRIP_KEEP_LF 0x2 /**< Do not strip LF (line feed, \n) */ +/** JSON-RPC API Errors, according to jsonrpc.org spec */ +typedef enum JsonRpcError { + // Official JSON-RPC error codes: + JSON_RPC_ERROR_PARSE_ERROR = -32700, /**< JSON parse error (fatal) */ + JSON_RPC_ERROR_INVALID_REQUEST = -32600, /**< Invalid JSON-RPC Request */ + JSON_RPC_ERROR_METHOD_NOT_FOUND = -32601, /**< Method not found */ + JSON_RPC_ERROR_INVALID_PARAMS = -32602, /**< Method parameters invalid */ + JSON_RPC_ERROR_INTERNAL_ERROR = -32603, /**< Internal server error */ + // UnrealIRCd JSON-RPC server specific error codes: + JSON_RPC_ERROR_API_CALL_DENIED = -32000, /**< The api user does not have enough permissions to do this call */ + JSON_RPC_ERROR_SERVER_GONE = -32001, /**< The request was forwarded to a remote server, but this server went gone while processing the request */ + JSON_RPC_ERROR_TIMEOUT = -32002, /**< The request was forwarded to a remote server, but the request/response timed out (15 seconds) */ + JSON_RPC_ERROR_REMOTE_SERVER_NO_RPC = -32003, /**< The request was going to be forwarded to a remote server, but the remote server does not support JSON-RPC */ + // UnrealIRCd specific application error codes: + JSON_RPC_ERROR_NOT_FOUND = -1000, /**< Target not found (no such nick / channel / ..) */ + JSON_RPC_ERROR_ALREADY_EXISTS = -1001, /**< Resource already exists by that name (eg on nickchange request, a gline, etc) */ + JSON_RPC_ERROR_INVALID_NAME = -1002, /**< Name is not permitted (eg: nick, channel, ..) */ + JSON_RPC_ERROR_USERNOTINCHANNEL = -1003, /**< The user is not in the channel */ + JSON_RPC_ERROR_TOO_MANY_ENTRIES = -1004, /**< Too many entries (eg: banlist, ..) */ + JSON_RPC_ERROR_DENIED = -1005, /**< Permission denied for user (unrelated to api user permissions) */ +} JsonRpcError; + +/** Require a parameter in an RPC command */ +#define REQUIRE_PARAM_STRING(name, varname) do { \ + varname = json_object_get_string(params, name); \ + if (!varname) \ + { \ + rpc_error_fmt(client, request, JSON_RPC_ERROR_INVALID_PARAMS, "Missing parameter: '%s'", name); \ + return; \ + } \ + } while(0) + +#define REQUIRE_PARAM_INTEGER(name, varname) do { \ + json_t *t = json_object_get(params, name); \ + if (!t || !json_is_integer(t)) \ + { \ + rpc_error_fmt(client, request, JSON_RPC_ERROR_INVALID_PARAMS, "Missing parameter: '%s'", name); \ + return; \ + } \ + varname = json_integer_value(t); \ + } while(0) + +#define REQUIRE_PARAM_BOOLEAN(name, varname) do { \ + json_t *vvv = json_object_get(params, name); \ + if (!v || !json_is_boolean(v)) \ + { \ + rpc_error_fmt(client, request, JSON_RPC_ERROR_INVALID_PARAMS, "Missing parameter: '%s'", name); \ + return; \ + } \ + varname = json_is_true(v) ? 1 : 0; \ + } while(0) + +#define OPTIONAL_PARAM_STRING(name, varname) varname = json_object_get_string(params, name) +#define OPTIONAL_PARAM_INTEGER(name, varname, def) varname = json_object_get_integer(params, name, def) +#define OPTIONAL_PARAM_BOOLEAN(name, varname, def) varname = json_object_get_boolean(params, name, def) + #endif /* __struct_include__ */ #include "dynconf.h" diff --git a/include/version.h b/include/version.h index c1cfb40..18957aa 100644 --- a/include/version.h +++ b/include/version.h @@ -54,7 +54,7 @@ * Can be useful if the above 3 versionids are insufficient for you (eg: you want to support CVS). * This is updated automatically on the CVS server every Monday. so don't touch it. */ -#define UNREAL_VERSION_TIME 202204 +#define UNREAL_VERSION_TIME 202313 #define UNREAL_VERSION ((UNREAL_VERSION_GENERATION << 24) + (UNREAL_VERSION_MAJOR << 16) + (UNREAL_VERSION_MINOR << 8)) #define UnrealProtocol 6000 diff --git a/include/whowas.h b/include/whowas.h index ceaefed..4f4d330 100644 --- a/include/whowas.h +++ b/include/whowas.h @@ -35,6 +35,15 @@ #ifndef __whowas_include__ #define __whowas_include__ +/* NOTE: Don't reorder values of these, as they are used in whowasdb */ +typedef enum WhoWasEvent { + WHOWAS_EVENT_QUIT=0, + WHOWAS_EVENT_NICK_CHANGE=1, + WHOWAS_EVENT_SERVER_TERMINATING=2 +} WhoWasEvent; +#define WHOWAS_LOWEST_EVENT 0 +#define WHOWAS_HIGHEST_EVENT 2 + /* ** add_history ** Add the currently defined name of the client to history. @@ -42,7 +51,7 @@ ** Client must be a fully registered user (specifically, ** the user structure must have been allocated). */ -void add_history(Client *, int); +void add_history(Client *, int, WhoWasEvent); /* ** off_history diff --git a/include/windows/setup.h b/include/windows/setup.h index 4360b35..80ebc1b 100644 --- a/include/windows/setup.h +++ b/include/windows/setup.h @@ -39,6 +39,7 @@ #define strcasecmp _stricmp #define strncasecmp _strnicmp #define HAVE_EXPLICIT_BZERO +#define HAVE_STRNLEN #define explicit_bzero(a,b) SecureZeroMemory(a,b) /* mode_t: Needed in s_conf.c for the third argument of open(3p). @@ -59,13 +60,13 @@ #define UNREAL_VERSION_GENERATION 6 /* Major version number (e.g.: 2 for Unreal3.2*) */ -#define UNREAL_VERSION_MAJOR 0 +#define UNREAL_VERSION_MAJOR 1 /* Minor version number (e.g.: 1 for Unreal3.2.1) */ -#define UNREAL_VERSION_MINOR 4 +#define UNREAL_VERSION_MINOR 0 /* Version suffix such as a beta marker or release candidate marker. (e.g.: -rcX for unrealircd-3.2.9-rcX) */ -#define UNREAL_VERSION_SUFFIX ".2" +#define UNREAL_VERSION_SUFFIX "" #endif diff --git a/src/Makefile.in b/src/Makefile.in index b33b44b..5308cff 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -30,9 +30,9 @@ OBJS=ircd_vars.o dns.o auth.o channel.o crule.o dbuf.o \ version.o whowas.o random.o api-usermode.o api-channelmode.o \ api-moddata.o api-extban.o api-isupport.o api-command.o \ api-clicap.o api-messagetag.o api-history-backend.o api-efunctions.o \ - api-event.o \ + api-event.o api-rpc.o \ crypt_blowfish.o unrealdb.o crashreport.o modulemanager.o \ - utf8.o log.o \ + utf8.o json.o log.o \ openssl_hostname_validation.o $(URL) SRC=$(OBJS:%.o=%.c) diff --git a/src/api-channelmode.c b/src/api-channelmode.c index 1a5beee..33fd289 100644 --- a/src/api-channelmode.c +++ b/src/api-channelmode.c @@ -423,6 +423,7 @@ Cmode *CmodeAdd(Module *module, CmodeInfo req, Cmode_t *mode) cm->sjoin_check = req.sjoin_check; cm->local = req.local; cm->unset_with_param = req.unset_with_param; + cm->flood_type_action = req.flood_type_action; cm->owner = module; cm->unloaded = 0; @@ -534,7 +535,7 @@ static void unload_extcmode_commit(Cmode *cmode) } free_message_tags(mtags); - cmode->free_param(GETPARASTRUCT(channel, cmode->letter)); + cmode->free_param(GETPARASTRUCT(channel, cmode->letter), 0); channel->mode.mode &= ~cmode->mode; } } @@ -627,8 +628,9 @@ void cm_putparameter(Channel *channel, char mode, const char *str) */ void cm_freeparameter(Channel *channel, char mode) { - GETPARAMHANDLERBYLETTER(mode)->free_param(GETPARASTRUCT(channel, mode)); - GETPARASTRUCT(channel, mode) = NULL; + int n = GETPARAMHANDLERBYLETTER(mode)->free_param(GETPARASTRUCT(channel, mode), 1); + if (n == 0) + GETPARASTRUCT(channel, mode) = NULL; } @@ -713,7 +715,7 @@ void extcmode_free_paramlist(void **ar) handler = GETPARAMHANDLERBYSLOT(i); if (!handler) continue; /* nothing here... */ - handler->free_param(ar[handler->param_slot]); + handler->free_param(ar[handler->param_slot], 0); ar[handler->param_slot] = NULL; } } diff --git a/src/api-clicap.c b/src/api-clicap.c index f760b90..58abef6 100644 --- a/src/api-clicap.c +++ b/src/api-clicap.c @@ -22,10 +22,20 @@ #include "unrealircd.h" +#define ADVERTISEONLYCAPS 16 +/* Advertise only caps are not counted anywhere, this only provides space in rehash temporary storage arrays. + * If exceeded, the caps just won't be stored and will be re-added safely. --k4be + */ + +#define MAXCLICAPS ((int)(sizeof(long)*8 - 1 + ADVERTISEONLYCAPS)) /* how many cap bits will fit in `long`? */ +static char *old_caps[MAXCLICAPS]; /**< List of old CAP names - used for /rehash */ +int old_caps_proto[MAXCLICAPS]; /**< List of old CAP protocol values - used for /rehash */ + MODVAR ClientCapability *clicaps = NULL; /* List of client capabilities */ void clicap_init(void) { + memset(&old_caps, 0, sizeof(old_caps)); } /** @@ -211,7 +221,7 @@ void unload_clicap_commit(ClientCapability *clicap) log_data_string("token", clicap->name)); /* NOTE: Stripping the CAP from local clients is done - * in clicap_post_rehash(), so not here. + * in clicap_check_for_changes(), so not here. */ /* A message tag handler may depend on us, remove it */ @@ -266,24 +276,19 @@ void unload_all_unused_caps(void) } } -#define ADVERTISEONLYCAPS 16 -/* Advertise only caps are not counted anywhere, this only provides space in rehash temporary storage arrays. - * If exceeded, the caps just won't be stored and will be re-added safely. --k4be - */ - -#define MAXCLICAPS ((int)(sizeof(long)*8 - 1 + ADVERTISEONLYCAPS)) /* how many cap bits will fit in `long`? */ -static char *old_caps[MAXCLICAPS]; /**< List of old CAP names - used for /rehash */ -int old_caps_proto[MAXCLICAPS]; /**< List of old CAP protocol values - used for /rehash */ - /** Called before REHASH. This saves the list of cap names and protocol values */ void clicap_pre_rehash(void) { ClientCapability *clicap; int i = 0; - memset(&old_caps, 0, sizeof(old_caps)); + for (i=0; i < MAXCLICAPS; i++) + { + safe_free(old_caps[i]); + old_caps_proto[i] = 0; + } - for (clicap = clicaps; clicap; clicap = clicap->next) + for (i=0, clicap = clicaps; clicap; clicap = clicap->next) { if (i == MAXCLICAPS) { @@ -321,7 +326,7 @@ void clear_cap_for_users(long cap) * 2. Sending any CAP DEL * 3. Sending any CAP NEW */ -void clicap_post_rehash(void) +void clicap_check_for_changes(void) { ClientCapability *clicap; char *name; diff --git a/src/api-efunctions.c b/src/api-efunctions.c index 05eee26..e2ffb29 100644 --- a/src/api-efunctions.c +++ b/src/api-efunctions.c @@ -40,12 +40,14 @@ int (*can_join)(Client *client, Channel *channel, const char *key, char **errmsg void (*do_mode)(Channel *channel, Client *client, MessageTag *mtags, int parc, const char *parv[], time_t sendts, int samode); MultiLineMode *(*set_mode)(Channel *channel, Client *client, int parc, const char *parv[], u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3]); -void (*set_channel_mode)(Channel *channel, char *modes, char *parameters); +void (*set_channel_mode)(Channel *channel, MessageTag *mtags, const char *modes, const char *parameters); +void (*set_channel_topic)(Client *client, Channel *channel, MessageTag *recv_mtags, const char *topic, const char *set_by, time_t set_at); void (*cmd_umode)(Client *client, MessageTag *mtags, int parc, const char *parv[]); int (*register_user)(Client *client); int (*tkl_hash)(unsigned int c); char (*tkl_typetochar)(int type); int (*tkl_chartotype)(char c); +char (*tkl_configtypetochar)(const char *name); const char *(*tkl_type_string)(TKL *tk); const char *(*tkl_type_config_string)(TKL *tk); char *(*tkl_uhost)(TKL *tkl, char *buf, size_t buflen, int options); @@ -84,7 +86,6 @@ void (*broadcast_md_client)(ModDataInfo *mdi, Client *client, ModData *md); void (*broadcast_md_channel)(ModDataInfo *mdi, Channel *channel, ModData *md); void (*broadcast_md_member)(ModDataInfo *mdi, Channel *channel, Member *m, ModData *md); void (*broadcast_md_membership)(ModDataInfo *mdi, Client *client, Membership *m, ModData *md); -int (*check_banned)(Client *client, int exitflags); int (*check_deny_version)(Client *client, const char *software, int protocol, const char *flags); void (*broadcast_md_client_cmd)(Client *except, Client *sender, Client *acptr, const char *varname, const char *value); void (*broadcast_md_channel_cmd)(Client *except, Client *sender, Channel *channel, const char *varname, const char *value); @@ -105,6 +106,7 @@ int (*do_remote_nick_name)(char *nick); const char *(*charsys_get_current_languages)(void); void (*broadcast_sinfo)(Client *client, Client *to, Client *except); void (*connect_server)(ConfigItem_link *aconf, Client *by, struct hostent *hp); +int (*is_services_but_not_ulined)(Client *client); void (*parse_message_tags)(Client *client, char **str, MessageTag **mtag_list); const char *(*mtags_to_string)(MessageTag *m, Client *client); int (*can_send_to_channel)(Client *client, Channel *channel, const char **msgtext, const char **errmsg, int notice); @@ -120,6 +122,9 @@ TKL *(*find_tkl_banexception)(int type, const char *usermask, const char *hostma TKL *(*find_tkl_nameban)(int type, const char *name, int hold); TKL *(*find_tkl_spamfilter)(int type, const char *match_string, unsigned short action, unsigned short target); int (*find_tkl_exception)(int ban_type, Client *client); +int (*server_ban_parse_mask)(Client *client, int add, char type, const char *str, char **usermask_out, char **hostmask_out, int *soft, const char **error); +int (*server_ban_exception_parse_mask)(Client *client, int add, const char *bantypes, const char *str, char **usermask_out, char **hostmask_out, int *soft, const char **error); +void (*tkl_added)(Client *client, TKL *tkl); int (*is_silenced)(Client *client, Client *acptr); int (*del_silence)(Client *client, const char *mask); int (*add_silence)(Client *client, const char *mask, int senderr); @@ -137,6 +142,22 @@ char *(*get_chmodes_for_user)(Client *client, const char *flags); WhoisConfigDetails (*whois_get_policy)(Client *client, Client *target, const char *name); int (*make_oper)(Client *client, const char *operblock_name, const char *operclass, ConfigItem_class *clientclass, long modes, const char *snomask, const char *vhost); int (*unreal_match_iplist)(Client *client, NameList *l); +void (*webserver_send_response)(Client *client, int status, char *msg); +void (*webserver_close_client)(Client *client); +int (*webserver_handle_body)(Client *client, WebRequest *web, const char *readbuf, int length); +void (*rpc_response)(Client *client, json_t *request, json_t *result); +void (*rpc_error)(Client *client, json_t *request, JsonRpcError error_code, const char *error_message); +void (*rpc_error_fmt)(Client *client, json_t *request, JsonRpcError error_code, const char *fmt, ...); +void (*rpc_send_request_to_remote)(Client *source, Client *target, json_t *request); +void (*rpc_send_response_to_remote)(Client *source, Client *target, json_t *response); +int (*rrpc_supported_simple)(Client *target, char **problem_server); +int (*rrpc_supported)(Client *target, const char *module, const char *minimum_version, char **problem_server); +int (*websocket_handle_websocket)(Client *client, WebRequest *web, const char *readbuf2, int length2, int callback(Client *client, char *buf, int len)); +int (*websocket_create_packet)(int opcode, char **buf, int *len); +int (*websocket_create_packet_ex)(int opcode, char **buf, int *len, char *sendbuf, size_t sendbufsize); +int (*websocket_create_packet_simple)(int opcode, const char **buf, int *len); +const char *(*check_deny_link)(ConfigItem_link *link, int auto_connect); +void (*mtag_add_issued_by)(MessageTag **mtags, Client *client, MessageTag *recv_mtags); Efunction *EfunctionAddMain(Module *module, EfunctionType eftype, int (*func)(), void (*vfunc)(), void *(*pvfunc)(), char *(*stringfunc)(), const char *(*conststringfunc)()) { @@ -320,6 +341,7 @@ void efunctions_init(void) efunc_init_function(EFUNC_DO_MODE, do_mode, NULL); efunc_init_function(EFUNC_SET_MODE, set_mode, NULL); efunc_init_function(EFUNC_SET_CHANNEL_MODE, set_channel_mode, NULL); + efunc_init_function(EFUNC_SET_CHANNEL_TOPIC, set_channel_topic, NULL); efunc_init_function(EFUNC_CMD_UMODE, cmd_umode, NULL); efunc_init_function(EFUNC_REGISTER_USER, register_user, NULL); efunc_init_function(EFUNC_TKL_HASH, tkl_hash, NULL); @@ -349,7 +371,6 @@ void efunctions_init(void) efunc_init_function(EFUNC_BROADCAST_MD_CHANNEL, broadcast_md_channel, NULL); efunc_init_function(EFUNC_BROADCAST_MD_MEMBER, broadcast_md_member, NULL); efunc_init_function(EFUNC_BROADCAST_MD_MEMBERSHIP, broadcast_md_membership, NULL); - efunc_init_function(EFUNC_CHECK_BANNED, check_banned, NULL); efunc_init_function(EFUNC_INTRODUCE_USER, introduce_user, NULL); efunc_init_function(EFUNC_CHECK_DENY_VERSION, check_deny_version, NULL); efunc_init_function(EFUNC_BROADCAST_MD_CLIENT_CMD, broadcast_md_client_cmd, NULL); @@ -371,9 +392,11 @@ void efunctions_init(void) efunc_init_function(EFUNC_CHARSYS_GET_CURRENT_LANGUAGES, charsys_get_current_languages, NULL); efunc_init_function(EFUNC_BROADCAST_SINFO, broadcast_sinfo, NULL); efunc_init_function(EFUNC_CONNECT_SERVER, connect_server, NULL); + efunc_init_function(EFUNC_IS_SERVICES_BUT_NOT_ULINED, is_services_but_not_ulined, NULL); efunc_init_function(EFUNC_PARSE_MESSAGE_TAGS, parse_message_tags, &parse_message_tags_default_handler); efunc_init_function(EFUNC_MTAGS_TO_STRING, mtags_to_string, &mtags_to_string_default_handler); efunc_init_function(EFUNC_TKL_CHARTOTYPE, tkl_chartotype, NULL); + efunc_init_function(EFUNC_TKL_CONFIGTYPETOCHAR, tkl_configtypetochar, NULL); efunc_init_function(EFUNC_TKL_TYPE_STRING, tkl_type_string, NULL); efunc_init_function(EFUNC_TKL_TYPE_CONFIG_STRING, tkl_type_config_string, NULL); efunc_init_function(EFUNC_CAN_SEND_TO_CHANNEL, can_send_to_channel, NULL); @@ -391,6 +414,9 @@ void efunctions_init(void) efunc_init_function(EFUNC_FIND_TKL_NAMEBAN, find_tkl_nameban, NULL); efunc_init_function(EFUNC_FIND_TKL_SPAMFILTER, find_tkl_spamfilter, NULL); efunc_init_function(EFUNC_FIND_TKL_EXCEPTION, find_tkl_exception, NULL); + efunc_init_function(EFUNC_SERVER_BAN_PARSE_MASK, server_ban_parse_mask, NULL); + efunc_init_function(EFUNC_SERVER_BAN_EXCEPTION_PARSE_MASK, server_ban_exception_parse_mask, NULL); + efunc_init_function(EFUNC_TKL_ADDED, tkl_added, NULL); efunc_init_function(EFUNC_ADD_SILENCE, add_silence, add_silence_default_handler); efunc_init_function(EFUNC_DEL_SILENCE, del_silence, del_silence_default_handler); efunc_init_function(EFUNC_IS_SILENCED, is_silenced, is_silenced_default_handler); @@ -409,4 +435,20 @@ void efunctions_init(void) efunc_init_function(EFUNC_WHOIS_GET_POLICY, whois_get_policy, NULL); efunc_init_function(EFUNC_MAKE_OPER, make_oper, make_oper_default_handler); efunc_init_function(EFUNC_UNREAL_MATCH_IPLIST, unreal_match_iplist, NULL); + efunc_init_function(EFUNC_WEBSERVER_SEND_RESPONSE, webserver_send_response, webserver_send_response_default_handler); + efunc_init_function(EFUNC_WEBSERVER_CLOSE_CLIENT, webserver_close_client, webserver_close_client_default_handler); + efunc_init_function(EFUNC_WEBSERVER_HANDLE_BODY, webserver_handle_body, webserver_handle_body_default_handler); + efunc_init_function(EFUNC_RPC_RESPONSE, rpc_response, rpc_response_default_handler); + efunc_init_function(EFUNC_RPC_ERROR, rpc_error, rpc_error_default_handler); + efunc_init_function(EFUNC_RPC_ERROR_FMT, rpc_error_fmt, rpc_error_fmt_default_handler); + efunc_init_function(EFUNC_RPC_SEND_REQUEST_TO_REMOTE, rpc_send_request_to_remote, rpc_send_request_to_remote_default_handler); + efunc_init_function(EFUNC_RPC_SEND_RESPONSE_TO_REMOTE, rpc_send_response_to_remote, rpc_send_response_to_remote_default_handler); + efunc_init_function(EFUNC_RRPC_SUPPORTED, rrpc_supported, rrpc_supported_default_handler); + efunc_init_function(EFUNC_RRPC_SUPPORTED_SIMPLE, rrpc_supported_simple, rrpc_supported_simple_default_handler); + efunc_init_function(EFUNC_WEBSOCKET_HANDLE_WEBSOCKET, websocket_handle_websocket, websocket_handle_websocket_default_handler); + efunc_init_function(EFUNC_WEBSOCKET_CREATE_PACKET, websocket_create_packet, websocket_create_packet_default_handler); + efunc_init_function(EFUNC_WEBSOCKET_CREATE_PACKET_EX, websocket_create_packet_ex, websocket_create_packet_ex_default_handler); + efunc_init_function(EFUNC_WEBSOCKET_CREATE_PACKET_SIMPLE, websocket_create_packet_simple, websocket_create_packet_simple_default_handler); + efunc_init_function(EFUNC_CHECK_DENY_LINK, check_deny_link, NULL); + efunc_init_function(EFUNC_MTAG_GENERATE_ISSUED_BY_IRC, mtag_add_issued_by, mtag_add_issued_by_default_handler); } diff --git a/src/api-extban.c b/src/api-extban.c index 343c5f6..8674ddd 100644 --- a/src/api-extban.c +++ b/src/api-extban.c @@ -80,8 +80,10 @@ int is_valid_extban_name(const char *p) { if (!*p) return 0; /* empty name */ + if (strlen(p) > 32) + return 0; /* too long */ for (; *p; p++) - if (!isalnum(*p) && !strchr("_-", *p)) + if (!islower(*p) && !isdigit(*p) && !strchr("_-", *p)) return 0; return 1; } @@ -169,6 +171,15 @@ Extban *ExtbanAdd(Module *module, ExtbanInfo req) return NULL; } + if (!req.conv_param) + { + module->errorcode = MODERR_INVALID; + unreal_log(ULOG_ERROR, "module", "EXTBANADD_API_ERROR", NULL, + "ExtbanAdd(): conv_param event missing. Module: $module_name", + log_data_string("module_name", module->header->name)); + return NULL; + } + for (e=extbans; e; e = e->next) { if (e->letter == req.letter) @@ -188,6 +199,7 @@ Extban *ExtbanAdd(Module *module, ExtbanInfo req) */ e->preregistered = 0; existing = 1; + break; } else if (module->flags == MODFLAG_NONE) { @@ -360,33 +372,12 @@ int extban_is_ok_nuh_extban(BanContext *b) */ const char *extban_conv_param_nuh(BanContext *b, Extban *extban) { - char *cp, *user, *host, *mask, *ret = NULL; - static char retbuf[USERLEN + NICKLEN + HOSTLEN + 32]; char tmpbuf[USERLEN + NICKLEN + HOSTLEN + 32]; + static char retbuf[USERLEN + NICKLEN + HOSTLEN + 32]; /* Work on a copy */ strlcpy(tmpbuf, b->banstr, sizeof(retbuf)); - mask = tmpbuf; - - if (!*mask) - return NULL; /* empty extban */ - if ((*mask == '~') && !strchr(mask, '@')) - return NULL; /* not a user@host ban, too confusing. */ - if ((user = strchr((cp = mask), '!'))) - *user++ = '\0'; - if ((host = strrchr(user ? user : cp, '@'))) - { - *host++ = '\0'; - if (!user) - ret = make_nick_user_host(NULL, trim_str(cp,USERLEN), trim_str(host,HOSTLEN)); - } - else if (!user && strchr(cp, '.')) - ret = make_nick_user_host(NULL, NULL, trim_str(cp,HOSTLEN)); - if (!ret) - ret = make_nick_user_host(trim_str(cp,NICKLEN), trim_str(user,USERLEN), trim_str(host,HOSTLEN)); - - strlcpy(retbuf, ret, sizeof(retbuf)); - return retbuf; + return convert_regular_ban(tmpbuf, retbuf, sizeof(retbuf)); } /** conv_param to deal with stacked extbans. @@ -440,25 +431,11 @@ const char *extban_conv_param_nuh_or_extban(BanContext *b, Extban *self_extban) return NULL; } - if (extban->conv_param) - { - //BanContext *b = safe_alloc(sizeof(BanContext)); - //b->banstr = mask; <-- this is redundant right? we can use existing 'b' context?? - extban_recursion++; - ret = extban->conv_param(b, extban); - extban_recursion--; - ret = prefix_with_extban(ret, b, extban, retbuf, sizeof(retbuf)); - //safe_free(b); - return ret; - } - /* I honestly don't know what the deal is with the 80 char cap in clean_ban_mask is about. So I'm leaving it out here. -- aquanight */ - /* I don't know why it's 80, but I like a limit anyway. A ban of 500 characters can never be good... -- Syzop */ - if (strlen(b->banstr) > 80) - { - strlcpy(retbuf, b->banstr, 128); - return retbuf; - } - return b->banstr; + extban_recursion++; + ret = extban->conv_param(b, extban); + extban_recursion--; + ret = prefix_with_extban(ret, b, extban, retbuf, sizeof(retbuf)); + return ret; } char *prefix_with_extban(const char *remainder, BanContext *b, Extban *extban, char *buf, size_t buflen) diff --git a/src/api-rpc.c b/src/api-rpc.c new file mode 100644 index 0000000..9460183 --- /dev/null +++ b/src/api-rpc.c @@ -0,0 +1,150 @@ +/************************************************************************ + * UnrealIRCd - Unreal Internet Relay Chat Daemon - src/api-rpc.c + * (c) 2022- Bram Matthys and The UnrealIRCd Team + * License: GPLv2 or later + */ + +/** @file + * @brief RPC API + */ +#include "unrealircd.h" + +/** This is the RPC API used for web requests. + * For an overview of available RPC's (not the API) + * see https://www.unrealircd.org/docs/RPC + * @defgroup RPCAPI RPC API + * @{ + */ + +/** List of RPC handlers */ +MODVAR RPCHandler *rpchandlers = NULL; + +/* Forward declarations */ +static void unload_rpc_handler_commit(RPCHandler *m); + +/** Adds a new RPC handler. + * @param module The module which owns this RPC handler. + * @param mreq The details of the request such as the method name, callback, etc. + * @return Returns the handle to the RPC handler if successful, otherwise NULL. + * The module's error code contains specific information about the + * error. + */ +RPCHandler *RPCHandlerAdd(Module *module, RPCHandlerInfo *mreq) +{ + RPCHandler *m; + ModuleObject *mobj; + + /* Some consistency checks to avoid a headache for module devs later on: */ + if (!mreq->method || !mreq->call) + { + unreal_log(ULOG_ERROR, "module", "RPCHANDLERADD_API_ERROR", NULL, + "RPCHandlerAdd() from module $module_name: " + "Missing required fields.", + log_data_string("module_name", module->header->name)); + abort(); + } + + m = RPCHandlerFind(mreq->method); + if (m) + { + if (m->unloaded) + { + m->unloaded = 0; + } else { + if (module) + module->errorcode = MODERR_EXISTS; + return NULL; + } + } else { + /* New RPC handler */ + m = safe_alloc(sizeof(RPCHandler)); + safe_strdup(m->method, mreq->method); + AddListItem(m, rpchandlers); + } + /* Add or update the following fields: */ + m->owner = module; + m->flags = mreq->flags; + m->loglevel = mreq->loglevel; + if (!valid_loglevel(m->loglevel)) + m->loglevel = ULOG_INFO; + m->call = mreq->call; + + /* Add module object */ + mobj = safe_alloc(sizeof(ModuleObject)); + mobj->type = MOBJ_RPC; + mobj->object.rpc = m; + AddListItem(mobj, module->objects); + module->errorcode = MODERR_NOERROR; + + return m; +} + +/** Returns the RPC handler for the given method name. + * @param method The method to search for. + * @return Returns the handle to the RPC handler, + * or NULL if not found. + */ +RPCHandler *RPCHandlerFind(const char *method) +{ + RPCHandler *m; + + for (m = rpchandlers; m; m = m->next) + { + if (!strcasecmp(method, m->method)) + return m; + } + return NULL; +} + +/** Remove the specified RPC handler - modules should not call this. + * This is done automatically for modules on unload, so is only called internally. + * @param m The PRC handler to remove. + */ +void RPCHandlerDel(RPCHandler *m) +{ + if (m->owner) + { + ModuleObject *mobj; + for (mobj = m->owner->objects; mobj; mobj = mobj->next) { + if (mobj->type == MOBJ_RPC && mobj->object.rpc == m) + { + DelListItem(mobj, m->owner->objects); + safe_free(mobj); + break; + } + } + m->owner = NULL; + } + + if (loop.rehashing) + m->unloaded = 1; + else + unload_rpc_handler_commit(m); +} + +/** @} */ + +static void unload_rpc_handler_commit(RPCHandler *m) +{ + /* This is an unusual operation, I think we should log it. */ + unreal_log(ULOG_INFO, "module", "UNLOAD_RPC_HANDLER", NULL, + "Unloading RPC handler for '$method'", + log_data_string("method", m->method)); + + /* Destroy the object */ + DelListItem(m, rpchandlers); + safe_free(m->method); + safe_free(m); +} + +void unload_all_unused_rpc_handlers(void) +{ + RPCHandler *m, *m_next; + + for (m = rpchandlers; m; m = m_next) + { + m_next = m->next; + if (m->unloaded) + unload_rpc_handler_commit(m); + } +} diff --git a/src/channel.c b/src/channel.c index 385d992..be35bed 100644 --- a/src/channel.c +++ b/src/channel.c @@ -473,6 +473,46 @@ Ban *is_banned_with_nick(Client *client, Channel *channel, int type, const char return ban; } +/** Checks if a ban already exists */ +int ban_exists(Ban *lst, const char *str) +{ + for (; lst; lst = lst->next) + if (!mycmp(lst->banstr, str)) + return 1; + return 0; +} + +/** Checks if a ban already exists - special version. + * This ignores the "~time:xx:" suffixes in the banlist. + * So it will return 1 if a ban is there for ~time:5:blah!*@* + * and you call ban_exists_ignore_time(channel->banlist, "blah!*@*") + */ +int ban_exists_ignore_time(Ban *lst, const char *str) +{ + const char *p; + + for (; lst; lst = lst->next) + { + if (!strncmp(lst->banstr, "~time:", 6)) + { + /* Special treatment for ~time:xx: */ + p = strchr(lst->banstr+6, ':'); + if (p) + { + p++; + if (!mycmp(p, str)) + return 1; + } + } else + { + /* The simple version */ + if (!mycmp(lst->banstr, str)) + return 1; + } + } + return 0; +} + /** Add user to the channel. * This adds both the Member struct to the channel->members linked list * and also the Membership struct to the client->user->channel linked list. @@ -614,34 +654,24 @@ Cmode_t get_extmode_bitbychar(char m) */ void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *channel, int hide_local_modes) { - int ismember = 0; + int show_mode_parameters = 0; Cmode *cm; if (!mbuf_size || !pbuf_size) return; - if (!client || IsMember(client, channel) || IsServer(client) || IsMe(client) || IsULine(client)) - ismember = 1; + if (!client || IsMember(client, channel) || IsServer(client) || IsMe(client) || IsULine(client) || + ValidatePermissionsForPath("channel:see:mode:remote",client,NULL,channel,NULL)) + { + show_mode_parameters = 1; + } *pbuf = '\0'; strlcpy(mbuf, "+", mbuf_size); - /* Paramless first */ for (cm=channelmodes; cm; cm = cm->next) { if (cm->letter && - !cm->paracount && - !(hide_local_modes && cm->local) && - (channel->mode.mode & cm->mode)) - { - strlcat_letter(mbuf, cm->letter, mbuf_size); - } - } - - for (cm=channelmodes; cm; cm = cm->next) - { - if (cm->letter && - cm->paracount && !(hide_local_modes && cm->local) && (channel->mode.mode & cm->mode)) { @@ -650,7 +680,7 @@ void channel_modes(Client *client, char *mbuf, char *pbuf, size_t mbuf_size, siz if (mbuf_size) strlcat_letter(mbuf, flag, mbuf_size); - if (ismember) + if (cm->paracount && show_mode_parameters) { strlcat(pbuf, cm_getparameter(channel, flag), pbuf_size); strlcat(pbuf, " ", pbuf_size); @@ -704,6 +734,59 @@ char *trim_str(char *str, int len) return str; } +/* Convert regular ban (non-extban) if needed. + * This does things like: + * nick!user@host -> nick!user@host (usually no change) + * nickkkkkkkkkkkkkkkkkkkkkkkkkk!user@host -> nickkkkkkk*!user@host (dealing with NICKLEN restrictions and such). + * user@host -> *!user@host + * 1.2.3.4 -> *!*@1.2.3.4 (converting IP to a proper mask) + * @param mask Incoming mask (this will be touched/fragged!) + * @param buf Output buffer + * @param buflen Length of the output buffer, eg sizeof(buf) + * @retval The sanitized mask, or NULL if it should be rejected fully. + * @note Since 'mask' will be fragged, you most likely wish to pass a copy of it rather than the original. + */ +const char *convert_regular_ban(char *mask, char *buf, size_t buflen) +{ + static char namebuf[USERLEN + HOSTLEN + 6]; + char *user, *host; + + if (!*mask) + return NULL; /* empty extban */ + + if (!buf) + { + buf = namebuf; + buflen = sizeof(namebuf); + } + + if ((*mask == '~') && !strchr(mask, '@')) + { + /* has a '~', which makes it look like an extban, + * but is not a user@host ban, too confusing. + */ + return NULL; + } + + if ((user = strchr(mask, '!'))) + *user++ = '\0'; + + if ((host = strrchr(user ? user : mask, '@'))) + { + *host++ = '\0'; + if (!user) + return make_nick_user_host_r(buf, buflen, NULL, trim_str(mask,USERLEN), trim_str(host,HOSTLEN)); + } + else if (!user && (strchr(mask, '.') || strchr(mask, ':'))) + { + /* 1.2.3.4 -> *!*@1.2.3.4 (and the same for IPv6) */ + return make_nick_user_host_r(buf, buflen, NULL, NULL, trim_str(mask,HOSTLEN)); + } + + /* regular nick!user@host with the auto-trimming feature */ + return make_nick_user_host_r(buf, buflen, trim_str(mask,NICKLEN), trim_str(user,USERLEN), trim_str(host,HOSTLEN)); +} + /** Make a proper ban mask. * This takes user input (eg: "nick") and converts it to a mask suitable * in the +beI lists (eg: "nick!*@*"). It also deals with extended bans, @@ -719,8 +802,6 @@ char *trim_str(char *str, int len) const char *clean_ban_mask(const char *mask_in, int what, Client *client, int conv_options) { char *cp, *x; - char *user; - char *host; static char mask[512]; /* Strip any ':' at beginning since that would cause a desync */ @@ -798,21 +879,7 @@ const char *clean_ban_mask(const char *mask_in, int what, Client *client, int co return mask; } - if ((*mask == '~') && !strchr(mask, '@')) - return NULL; /* not an extended ban and not a ~user@host ban either. */ - - if ((user = strchr((cp = mask), '!'))) - *user++ = '\0'; - if ((host = strrchr(user ? user : cp, '@'))) - { - *host++ = '\0'; - - if (!user) - return make_nick_user_host(NULL, trim_str(cp,USERLEN), trim_str(host,HOSTLEN)); - } - else if (!user && strchr(cp, '.')) - return make_nick_user_host(NULL, NULL, trim_str(cp,HOSTLEN)); - return make_nick_user_host(trim_str(cp,NICKLEN), trim_str(user,USERLEN), trim_str(host,HOSTLEN)); + return convert_regular_ban(mask, NULL, 0); } /** Check if 'client' matches an invite exception (+I) on 'channel' */ diff --git a/src/conf.c b/src/conf.c index a01daf1..e36905c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -52,7 +52,6 @@ static int _conf_link (ConfigFile *conf, ConfigEntry *ce); static int _conf_ban (ConfigFile *conf, ConfigEntry *ce); static int _conf_set (ConfigFile *conf, ConfigEntry *ce); static int _conf_deny (ConfigFile *conf, ConfigEntry *ce); -static int _conf_deny_link (ConfigFile *conf, ConfigEntry *ce); static int _conf_deny_channel (ConfigFile *conf, ConfigEntry *ce); static int _conf_deny_version (ConfigFile *conf, ConfigEntry *ce); static int _conf_require (ConfigFile *conf, ConfigEntry *ce); @@ -188,6 +187,8 @@ extern void unload_all_unused_extcmodes(void); extern void unload_all_unused_extbans(void); extern void unload_all_unused_caps(void); extern void unload_all_unused_history_backends(void); +extern void unload_all_unused_rpc_handlers(void); + int reloadable_perm_module_unloaded(void); int tls_tests(void); @@ -226,7 +227,6 @@ ConfigItem_link *conf_link = NULL; ConfigItem_ban *conf_ban = NULL; ConfigItem_deny_channel *conf_deny_channel = NULL; ConfigItem_allow_channel *conf_allow_channel = NULL; -ConfigItem_deny_link *conf_deny_link = NULL; ConfigItem_deny_version *conf_deny_version = NULL; ConfigItem_alias *conf_alias = NULL; ConfigResource *config_resources = NULL; @@ -241,6 +241,7 @@ MODVAR ConfigFile *conf = NULL; extern NameValueList *config_defines; MODVAR int ipv6_disabled = 0; MODVAR Client *remote_rehash_client = NULL; +MODVAR json_t *json_rehash_log = NULL; MODVAR int config_error_flag = 0; int config_verbose = 0; @@ -1413,8 +1414,6 @@ void config_error(FORMAT_STRING(const char *format), ...) if ((ptr = strchr(buffer, '\n')) != NULL) *ptr = '\0'; unreal_log_raw(ULOG_ERROR, "config", "CONFIG_ERROR_GENERIC", NULL, buffer); - if (remote_rehash_client) - sendnotice(remote_rehash_client, "error: %s", buffer); /* We cannot live with this */ config_error_flag = 1; } @@ -1471,8 +1470,6 @@ void config_status(FORMAT_STRING(const char *format), ...) if ((ptr = strchr(buffer, '\n')) != NULL) *ptr = '\0'; unreal_log_raw(ULOG_INFO, "config", "CONFIG_INFO_GENERIC", NULL, buffer); - if (remote_rehash_client) - sendnotice(remote_rehash_client, "%s", buffer); } void config_warn(FORMAT_STRING(const char *format), ...) @@ -1487,8 +1484,6 @@ void config_warn(FORMAT_STRING(const char *format), ...) if ((ptr = strchr(buffer, '\n')) != NULL) *ptr = '\0'; unreal_log_raw(ULOG_WARNING, "config", "CONFIG_WARNING_GENERIC", NULL, buffer); - if (remote_rehash_client) - sendnotice(remote_rehash_client, "[warning] %s", buffer); } void config_warn_duplicate(const char *filename, int line, const char *entry) @@ -1731,7 +1726,7 @@ void config_setdefaultsettings(Configuration *i) safe_strdup(i->tls_options->trusted_ca_file, tmp); safe_strdup(i->tls_options->ciphers, UNREALIRCD_DEFAULT_CIPHERS); safe_strdup(i->tls_options->ciphersuites, UNREALIRCD_DEFAULT_CIPHERSUITES); - i->tls_options->protocols = TLS_PROTOCOL_ALL; + i->tls_options->protocols = TLS_PROTOCOL_TLSV1_2|TLS_PROTOCOL_TLSV1_3; /* TLSv1.2 & TLSv1.3 */ #ifdef HAS_SSL_CTX_SET1_CURVES_LIST safe_strdup(i->tls_options->ecdh_curves, UNREALIRCD_DEFAULT_ECDH_CURVES); #endif @@ -1979,6 +1974,7 @@ void config_load_failed(void) { if (conf) unreal_log(ULOG_ERROR, "config", "CONFIG_NOT_LOADED", NULL, "IRCd configuration failed to load"); + loop.config_status = CONFIG_STATUS_ROLLBACK; Unload_all_testing_modules(); free_all_config_resources(); config_free(conf); @@ -2051,6 +2047,7 @@ int config_test(void) } config_status("Testing IRCd configuration.."); + loop.config_status = CONFIG_STATUS_TEST; memset(&tempiConf, 0, sizeof(iConf)); memset(&settings, 0, sizeof(settings)); @@ -2067,6 +2064,8 @@ int config_test(void) return -1; } + loop.config_status = CONFIG_STATUS_POSTTEST; + preprocessor_resolve_conditionals_all(PREPROCESSOR_PHASE_MODULE); if (!config_test_all()) @@ -2075,6 +2074,7 @@ int config_test(void) config_load_failed(); return -1; } + loop.config_status = CONFIG_STATUS_PRE_INIT; callbacks_switchover(); efunctions_switchover(); set_targmax_defaults(); @@ -2085,8 +2085,6 @@ int config_test(void) safe_strdup(old_pid_file, conf_files->pid_file); unrealdns_delasyncconnects(); config_rehash(); - Unload_all_loaded_modules(); - /* Notify permanent modules of the rehash */ for (h = Hooks[HOOKTYPE_REHASH]; h; h = h->next) { @@ -2096,11 +2094,15 @@ int config_test(void) continue; (*(h->func.intfunc))(); } + /* Last step: */ + Unload_all_loaded_modules(); } config_pre_run_log(); + loop.config_status = CONFIG_STATUS_INIT; Init_all_testing_modules(); + loop.config_status = CONFIG_STATUS_RUN_CONFIG; if (config_run_blocks() < 0) { config_error("Bad case of config errors. Server will now die. This really shouldn't happen"); @@ -2124,12 +2126,13 @@ int config_test(void) conf = NULL; if (loop.rehashing) { + /* loop.config_status = CONFIG_STATUS_LOAD is done by module_loadall() */ module_loadall(); RunHook(HOOKTYPE_REHASH_COMPLETE); } + loop.config_status = CONFIG_STATUS_POSTLOAD; postconf(); unreal_log(ULOG_INFO, "config", "CONFIG_LOADED", NULL, "Configuration loaded"); - clicap_post_rehash(); unload_all_unused_mtag_handlers(); return 0; } @@ -2230,6 +2233,8 @@ int config_read_file(const char *filename, const char *display_name) if (!strcmp(ce->name, "blacklist-module")) _test_blacklist_module(cfptr, ce); + preprocessor_resolve_conditionals_ce(&cfptr->items, PREPROCESSOR_PHASE_SECONDARY); + /* Load urls */ config_parse_and_queue_urls(cfptr->items); @@ -2326,7 +2331,6 @@ void config_rehash() ConfigItem_listen *listen_ptr; ConfigItem_tld *tld_ptr; ConfigItem_vhost *vhost_ptr; - ConfigItem_deny_link *deny_link_ptr; ConfigItem_deny_channel *deny_channel_ptr; ConfigItem_allow_channel *allow_channel_ptr; ConfigItem_admin *admin_ptr; @@ -2471,14 +2475,6 @@ void config_rehash() remove_config_tkls(); - for (deny_link_ptr = conf_deny_link; deny_link_ptr; deny_link_ptr = (ConfigItem_deny_link *) next) { - next = (ListStruct *)deny_link_ptr->next; - safe_free(deny_link_ptr->prettyrule); - unreal_delete_masks(deny_link_ptr->mask); - crule_free(&deny_link_ptr->rule); - DelListItem(deny_link_ptr, conf_deny_link); - safe_free(deny_link_ptr); - } for (deny_version_ptr = conf_deny_version; deny_version_ptr; deny_version_ptr = (ConfigItem_deny_version *) next) { next = (ListStruct *)deny_version_ptr->next; safe_free(deny_version_ptr->mask); @@ -3056,15 +3052,14 @@ ConfigItem_tld *find_tld(Client *client) return NULL; } - -ConfigItem_link *find_link(const char *servername, Client *client) +/** Find a link block by server name (but don't check any restrictions like IP or auth) */ +ConfigItem_link *find_link(const char *servername) { ConfigItem_link *link; for (link = conf_link; link; link = link->next) { - if (match_simple(link->servername, servername) && - user_allowed_by_security_group(client, link->incoming.match)) + if (!link->flag.temporary && match_simple(link->servername, servername)) { return link; } @@ -4111,6 +4106,12 @@ int _test_oper(ConfigFile *conf, ConfigEntry *ce) cep->line_number, "oper::vhost"); continue; } + if (!valid_vhost(cep->value)) + { + config_error("%s:%i: oper::vhost contains illegal characters or is too long: '%s'", + cep->file->filename, cep->line_number, cep->value); + errors++; + } has_vhost = 1; } /* oper::snomask */ @@ -4900,43 +4901,141 @@ int _test_tld(ConfigFile *conf, ConfigEntry *ce) ce->file->filename, ce->line_number, ce->name); errors++; } - if (!has_motd) - { - config_error_missing(ce->file->filename, ce->line_number, - "tld::motd"); - errors++; - } - if (!has_rules) - { - config_error_missing(ce->file->filename, ce->line_number, - "tld::rules"); - errors++; - } return errors; } +/* Helper for _conf_listen() */ +void conf_listen_configure(const char *ip, int port, SocketType socket_type, int options, ConfigEntry *ce, ConfigEntry *tlsconfig) +{ + ConfigItem_listen *listen; + ConfigEntry *cep, *cepp; + Hook *h; + char isnew = 0; + + if (!(listen = find_listen(ip, port, socket_type))) + { + listen = safe_alloc(sizeof(ConfigItem_listen)); + if (socket_type == SOCKET_TYPE_UNIX) + { + safe_strdup(listen->file, ip); + } else { + safe_strdup(listen->ip, ip); + listen->port = port; + } + listen->fd = -1; + listen->socket_type = socket_type; + isnew = 1; + } + + if (listen->options & LISTENER_BOUND) + options |= LISTENER_BOUND; + listen->options = options; + + if (isnew) + AddListItem(listen, conf_listen); + + /* Reset all settings of the current listener (free and set defaults): */ + listen->flag.temporary = 0; + listen->start_handshake = start_of_normal_client_handshake; + if (listen->ssl_ctx) + { + SSL_CTX_free(listen->ssl_ctx); + listen->ssl_ctx = NULL; + } + if (listen->tls_options) + { + free_tls_options(listen->tls_options); + listen->tls_options = NULL; + } + safe_free(listen->websocket_forward); + safe_free(listen->webserver); + + /* Now set the new settings: */ + if (tlsconfig) + { + listen->tls_options = safe_alloc(sizeof(TLSOptions)); + conf_tlsblock(conf, tlsconfig, listen->tls_options); + listen->ssl_ctx = init_ctx(listen->tls_options, 1); + } + + /* For modules that hook CONFIG_LISTEN and CONFIG_LISTEN_OPTIONS. + * Yeah, ugly we have this here.. + * and again about 100 lines down too. + */ + for (cep = ce->items; cep; cep = cep->next) + { + if (!strcmp(cep->name, "mode")) + { + /* Yeah, we actually do something with this one.. */ + if (cep->value) + listen->mode = strtol(cep->value, NULL, 8); /* octal */ + } + else if (!strcmp(cep->name, "spoof-ip")) + safe_strdup(listen->spoof_ip, cep->value); + else if (!strcmp(cep->name, "ip")) + ; + else if (!strcmp(cep->name, "port")) + ; + else if (!strcmp(cep->name, "options")) + { + for (cepp = cep->items; cepp; cepp = cepp->next) + { + NameValue *ofp; + if (!nv_find_by_name(_ListenerFlags, cepp->name)) + { + for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) + { + int value = (*(h->func.intfunc))(conf, cepp, CONFIG_LISTEN_OPTIONS, listen); + if (value == 1) + break; + } + } + } + } else + if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) + ; + else + { + for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) + { + int value = (*(h->func.intfunc))(conf, cep, CONFIG_LISTEN, listen); + if (value == 1) + break; + } + } + } +} + int _conf_listen(ConfigFile *conf, ConfigEntry *ce) { - ConfigEntry *cep; - ConfigEntry *cepp; + ConfigEntry *cep, *cepp; ConfigEntry *tlsconfig = NULL; - ConfigItem_listen *listen = NULL; char *file = NULL; char *ip = NULL; - int start=0, end=0, port, isnew; - int tmpflags =0; + char *spoof_ip = NULL; + int start=0, end=0, port; + int listener_flags =0; Hook *h; for (cep = ce->items; cep; cep = cep->next) { if (!strcmp(cep->name, "file")) { + convert_to_absolute_path(&cep->value, PERMDATADIR); file = cep->value; } else + if (!strcmp(cep->name, "mode")) + { + // Handled elsewhere, but need to be caught here as noop + } else if (!strcmp(cep->name, "ip")) { ip = cep->value; } else + if (!strcmp(cep->name, "spoof-ip")) + { + spoof_ip = cep->value; + } else if (!strcmp(cep->name, "port")) { port_range(cep->value, &start, &end); @@ -4950,7 +5049,7 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) long v; if ((v = nv_find_by_name(_ListenerFlags, cepp->name))) { - tmpflags |= v; + listener_flags |= v; } else { for (h = Hooks[HOOKTYPE_CONFIGRUN]; h; h = h->next) { @@ -4975,28 +5074,10 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) } } - /* UNIX domain socket code */ + /* UNIX domain socket */ if (file) { - if (!(listen = find_listen(file, 0, SOCKET_TYPE_UNIX))) - { - listen = safe_alloc(sizeof(ConfigItem_listen)); - safe_strdup(listen->file, file); - listen->socket_type = SOCKET_TYPE_UNIX; - listen->fd = -1; - isnew = 1; - } else { - isnew = 0; - } - - if (listen->options & LISTENER_BOUND) - tmpflags |= LISTENER_BOUND; - - listen->options = tmpflags; - if (isnew) - AddListItem(listen, conf_listen); - listen->flag.temporary = 0; - + conf_listen_configure(file, 0, SOCKET_TYPE_UNIX, listener_flags, ce, tlsconfig); return 1; } @@ -5004,171 +5085,13 @@ int _conf_listen(ConfigFile *conf, ConfigEntry *ce) { /* First deal with IPv4 */ if (!strchr(ip, ':')) - { - if (!(listen = find_listen(ip, port, SOCKET_TYPE_IPV4))) - { - listen = safe_alloc(sizeof(ConfigItem_listen)); - safe_strdup(listen->ip, ip); - listen->port = port; - listen->fd = -1; - listen->socket_type = SOCKET_TYPE_IPV4; - isnew = 1; - } else - isnew = 0; - - if (listen->options & LISTENER_BOUND) - tmpflags |= LISTENER_BOUND; - - listen->options = tmpflags; - if (isnew) - AddListItem(listen, conf_listen); - listen->flag.temporary = 0; - - if (listen->ssl_ctx) - { - SSL_CTX_free(listen->ssl_ctx); - listen->ssl_ctx = NULL; - } - - if (listen->tls_options) - { - free_tls_options(listen->tls_options); - listen->tls_options = NULL; - } - - if (tlsconfig) - { - listen->tls_options = safe_alloc(sizeof(TLSOptions)); - conf_tlsblock(conf, tlsconfig, listen->tls_options); - listen->ssl_ctx = init_ctx(listen->tls_options, 1); - } - - safe_free(listen->websocket_forward); - - /* For modules that hook CONFIG_LISTEN and CONFIG_LISTEN_OPTIONS. - * Yeah, ugly we have this here.. - * and again about 100 lines down too. - */ - for (cep = ce->items; cep; cep = cep->next) - { - if (!strcmp(cep->name, "ip")) - ; - else if (!strcmp(cep->name, "port")) - ; - else if (!strcmp(cep->name, "options")) - { - for (cepp = cep->items; cepp; cepp = cepp->next) - { - NameValue *ofp; - if (!nv_find_by_name(_ListenerFlags, cepp->name)) - { - for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) - { - int value = (*(h->func.intfunc))(conf, cepp, CONFIG_LISTEN_OPTIONS, listen); - if (value == 1) - break; - } - } - } - } else - if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) - ; - else - { - for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) - { - int value = (*(h->func.intfunc))(conf, cep, CONFIG_LISTEN, listen); - if (value == 1) - break; - } - } - } - } + conf_listen_configure(ip, port, SOCKET_TYPE_IPV4, listener_flags, ce, tlsconfig); /* Then deal with IPv6 (if available/enabled) */ - if (!DISABLE_IPV6) - { - if (strchr(ip, ':') || (*ip == '*')) - { - if (!(listen = find_listen(ip, port, SOCKET_TYPE_IPV6))) - { - listen = safe_alloc(sizeof(ConfigItem_listen)); - safe_strdup(listen->ip, ip); - listen->port = port; - listen->fd = -1; - listen->socket_type = SOCKET_TYPE_IPV6; - isnew = 1; - } else - isnew = 0; - - if (listen->options & LISTENER_BOUND) - tmpflags |= LISTENER_BOUND; - - listen->options = tmpflags; - if (isnew) - AddListItem(listen, conf_listen); - listen->flag.temporary = 0; - - if (listen->ssl_ctx) - { - SSL_CTX_free(listen->ssl_ctx); - listen->ssl_ctx = NULL; - } - - if (listen->tls_options) - { - free_tls_options(listen->tls_options); - listen->tls_options = NULL; - } - - if (tlsconfig) - { - listen->tls_options = safe_alloc(sizeof(TLSOptions)); - conf_tlsblock(conf, tlsconfig, listen->tls_options); - listen->ssl_ctx = init_ctx(listen->tls_options, 1); - } - - safe_free(listen->websocket_forward); - - /* For modules that hook CONFIG_LISTEN and CONFIG_LISTEN_OPTIONS. - * Yeah, ugly we have this here.. - */ - for (cep = ce->items; cep; cep = cep->next) - { - if (!strcmp(cep->name, "ip")) - ; - else if (!strcmp(cep->name, "port")) - ; - else if (!strcmp(cep->name, "options")) - { - for (cepp = cep->items; cepp; cepp = cepp->next) - { - if (!nv_find_by_name(_ListenerFlags, cepp->name)) - { - for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) - { - int value = (*(h->func.intfunc))(conf, cepp, CONFIG_LISTEN_OPTIONS, listen); - if (value == 1) - break; - } - } - } - } else - if (!strcmp(cep->name, "ssl-options") || !strcmp(cep->name, "tls-options")) - ; - else - { - for (h = Hooks[HOOKTYPE_CONFIGRUN_EX]; h; h = h->next) - { - int value = (*(h->func.intfunc))(conf, cep, CONFIG_LISTEN, listen); - if (value == 1) - break; - } - } - } - } - } + if (!DISABLE_IPV6 && (strchr(ip, ':') || (*ip == '*'))) + conf_listen_configure(ip, port, SOCKET_TYPE_IPV6, listener_flags, ce, tlsconfig); } + return 1; } @@ -5177,7 +5100,7 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) ConfigEntry *cep; ConfigEntry *cepp; int errors = 0; - char has_file = 0, has_ip = 0, has_port = 0, has_options = 0, port_6667 = 0; + char has_file = 0, has_ip = 0, has_port = 0, has_options = 0, port_6667 = 0, has_spoof_ip = 0; char *file = NULL; char *ip = NULL; Hook *h; @@ -5298,6 +5221,28 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) has_file = 1; file = cep->value; } else + if (!strcmp(cep->name, "spoof-ip")) + { + has_spoof_ip = 1; + if (!is_valid_ip(cep->value)) + { + config_error("%s:%i: listen::spoof-ip is not a valid IP address (%s)", + cep->file->filename, cep->line_number, cep->value); + errors++; + } + } else + if (!strcmp(cep->name, "mode")) + { + int mode = strtol(cep->value, NULL, 8); + if ((mode != 0700) && (mode != 0770) && (mode != 0777)) + { + config_error("%s:%i: listen::mode must be one of: 0700 (user only, the default), " + "0770 (user and group readable/writable), or " + "0777 (world readable and writable, not recommended).", + cep->file->filename, cep->line_number); + errors++; + } + } else if (!strcmp(cep->name, "ip")) { has_ip = 1; @@ -5398,6 +5343,13 @@ int _test_listen(ConfigFile *conf, ConfigEntry *ce) } } + if (has_spoof_ip && !has_file) + { + config_error("%s:%d: listen::spoof-ip is only valid when listen::file is used (UNIX domain sockets)", + ce->file->filename, ce->line_number); + errors++; + } + if (port_6667) safe_strdup(port_6667_ip, ip); @@ -6053,40 +6005,12 @@ int _test_vhost(ConfigFile *conf, ConfigEntry *ce) errors++; continue; } - if ((at = strchr(cep->value, '@'))) + if (!valid_vhost(cep->value)) { - for (tmp = cep->value; tmp != at; tmp++) - { - if (*tmp == '~' && tmp == cep->value) - continue; - if (!isallowed(*tmp)) - break; - } - if (tmp != at) - { - config_error("%s:%i: vhost::vhost contains an invalid ident", - cep->file->filename, cep->line_number); - errors++; - } - host = at+1; - } - else - host = cep->value; - if (!*host) - { - config_error("%s:%i: vhost::vhost does not have a host set", - cep->file->filename, cep->line_number); + config_error("%s:%i: oper::vhost contains illegal characters or is too long: '%s'", + cep->file->filename, cep->line_number, cep->value); errors++; } - else - { - if (!valid_host(host, 0)) - { - config_error("%s:%i: vhost::vhost contains an invalid host", - cep->file->filename, cep->line_number); - errors++; - } - } } else if (!strcmp(cep->name, "login")) { @@ -7644,6 +7568,18 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) int lag_penalty_bytes = -1; for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { + /* Check hooks first */ + int used = 0; + for (h = Hooks[HOOKTYPE_CONFIGRUN]; h; h = h->next) + { + used = (*(h->func.intfunc))(conf,ceppp,CONFIG_SET_ANTI_FLOOD); + if (used == 1) + break; + } + if (used == 1) + continue; /* module handled it */ + if (used == 2) + break; /* module handled it and we must stop entire block processing */ if (!strcmp(ceppp->name, "handshake-data-flood")) { for (cep4 = ceppp->items; cep4; cep4 = cep4->next) @@ -7697,7 +7633,7 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) tempiConf.throttle_count = cnt; tempiConf.throttle_period = period; } - if (!strcmp(ceppp->name, "max-concurrent-conversations")) + else if (!strcmp(ceppp->name, "max-concurrent-conversations")) { /* We use a hack here to make it fit our storage format */ char buf[64]; @@ -7717,15 +7653,6 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) snprintf(buf, sizeof(buf), "%d:%ld", users, every); config_parse_flood_generic(buf, &tempiConf, cepp->name, FLD_CONVERSATIONS); } - else - { - for (h = Hooks[HOOKTYPE_CONFIGRUN]; h; h = h->next) - { - int value = (*(h->func.intfunc))(conf,ceppp,CONFIG_SET_ANTI_FLOOD); - if (value == 1) - break; - } - } } if ((lag_penalty != -1) && (lag_penalty_bytes != -1)) { @@ -7840,6 +7767,10 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) { tempiConf.spamfilter_stop_on_first_match = config_checkval(cepp->value, CFG_YESNO); } + else if (!strcmp(cepp->name, "utf8")) + { + tempiConf.spamfilter_utf8 = config_checkval(cepp->value, CFG_YESNO); + } } } else if (!strcmp(cep->name, "default-bantime")) @@ -8006,6 +7937,12 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) if (!strcmp(cepp->name, "policy")) tempiConf.hide_idle_time = hideidletime_strtoval(cepp->value); } + } else if (!strcmp(cep->name, "limit-svscmds")) + { + if (!strcmp(cep->value, "ulines")) + tempiConf.limit_svscmds = LIMIT_SVSCMDS_ULINES; + else + tempiConf.limit_svscmds = LIMIT_SVSCMDS_SERVERS; } else { int value; @@ -8477,9 +8414,52 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) for (ceppp = cepp->items; ceppp; ceppp = ceppp->next) { - int everyone = !strcmp(cepp->name, "everyone") ? 1 : 0; - int for_everyone = flood_option_is_for_everyone(ceppp->name); + int everyone; + int for_everyone; + int used = 0; + Hook *h; + /* First, check hooks... */ + for (h = Hooks[HOOKTYPE_CONFIGTEST]; h; h = h->next) + { + int value, errs = 0; + if (h->owner && !(h->owner->flags & MODFLAG_TESTING) + && !(h->owner->options & MOD_OPT_PERM)) + continue; + value = (*(h->func.intfunc))(conf,ceppp,CONFIG_SET_ANTI_FLOOD,&errs); + if (value == 2) + { + used = 2; + break; + } else + if (value == 1) + { + used = 1; + break; + } else + if (value == -1) + { + used = 1; + errors += errs; + break; + } else + if (value == -2) + { + used = 2; + errors += errs; + break; + } + } + if (used == 1) + continue; /* module handled it */ + if (used == 2) + break; /* module handled it and we must stop entire block processing */ + + /* Prevent users from using options that belong in "everyone" + * at other places, and vice-versa. + */ + everyone = !strcmp(cepp->name, "everyone") ? 1 : 0; + for_everyone = flood_option_is_for_everyone(ceppp->name); if (everyone && !for_everyone) { config_error("%s:%i: %s cannot be in the set::anti-flood::everyone block. " @@ -8724,43 +8704,10 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) } else { - /* hmm.. I don't like this method. but I just quickly copied it from CONFIG_ALLOW for now... */ - int used = 0; - Hook *h; - for (h = Hooks[HOOKTYPE_CONFIGTEST]; h; h = h->next) - { - int value, errs = 0; - if (h->owner && !(h->owner->flags & MODFLAG_TESTING) - && !(h->owner->options & MOD_OPT_PERM)) - continue; - value = (*(h->func.intfunc))(conf,ceppp,CONFIG_SET_ANTI_FLOOD,&errs); - if (value == 2) - used = 1; - if (value == 1) - { - used = 1; - break; - } - if (value == -1) - { - used = 1; - errors += errs; - break; - } - if (value == -2) - { - used = 1; - errors += errs; - } - } - if (!used) - { - config_error_unknownopt(ceppp->file->filename, - ceppp->line_number, "set::anti-flood", - ceppp->name); - errors++; - } - continue; + config_error_unknownopt(ceppp->file->filename, + ceppp->line_number, "set::anti-flood", + ceppp->name); + errors++; } } if (has_lag_penalty+has_lag_penalty_bytes == 1) @@ -8966,6 +8913,9 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) if (!strcmp(cepp->name, "stop-on-first-match")) { } else + if (!strcmp(cepp->name, "utf8")) + { + } else { config_error_unknown(cepp->file->filename, cepp->line_number, "set::spamfilter", @@ -9351,6 +9301,15 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) continue; } } + } else if (!strcmp(cep->name, "limit-svscmds")) + { + CheckNull(cep); + if (strcmp(cep->value, "servers") && strcmp(cep->value, "ulines")) + { + config_error("%s:%i: set::limit-svscmds: value must be one of: 'servers' or 'ulines'", + cep->file->filename, cep->line_number); + errors++; + } } else { int used = 0; @@ -9436,20 +9395,6 @@ int _test_blacklist_module(ConfigFile *conf, ConfigEntry *ce) path = Module_TransformPath(ce->value); - /* Is it a good idea to warn about this? - * Yes, the user may have made a typo, thinking (s)he blacklisted something - * but due to the typo the blacklist-module is not effective. - * No, the user may have blacklisted a bunch of modules of which not all may - * be installed at the time. - * Hmmmmmm. - */ - if (!file_exists(path)) - { - config_warn("%s:%i: blacklist-module for '%s' but module does not exist anyway", - ce->file->filename, ce->line_number, ce->value); - /* fallthrough */ - } - m = safe_alloc(sizeof(ConfigItem_blacklist_module)); safe_strdup(m->name, ce->value); AddListItem(m, conf_blacklist_module); @@ -9463,7 +9408,7 @@ int is_blacklisted_module(const char *name) ConfigItem_blacklist_module *m; for (m = conf_blacklist_module; m; m = m->next) - if (!strcasecmp(m->name, name) || !strcasecmp(m->name, path)) + if (match_simple(m->name, name) || match_simple(m->name, path)) return 1; return 0; @@ -9579,9 +9524,11 @@ void start_listeners(void) /* Actually use configuration */ void config_run(void) { + loop.config_status = CONFIG_STATUS_POSTLOAD; extcmodes_check_for_changes(); start_listeners(); - add_proc_io_server(); + if (!loop.booted) + add_proc_io_server(); free_all_config_resources(); } @@ -9947,8 +9894,6 @@ Hook *h; if (!strcmp(ce->value, "channel")) _conf_deny_channel(conf, ce); - else if (!strcmp(ce->value, "link")) - _conf_deny_link(conf, ce); else if (!strcmp(ce->value, "version")) _conf_deny_version(conf, ce); else @@ -10001,34 +9946,6 @@ int _conf_deny_channel(ConfigFile *conf, ConfigEntry *ce) AddListItem(deny, conf_deny_channel); return 0; } -int _conf_deny_link(ConfigFile *conf, ConfigEntry *ce) -{ - ConfigItem_deny_link *deny = NULL; - ConfigEntry *cep; - - deny = safe_alloc(sizeof(ConfigItem_deny_link)); - for (cep = ce->items; cep; cep = cep->next) - { - if (!strcmp(cep->name, "mask")) - { - unreal_add_masks(&deny->mask, cep); - } - else if (!strcmp(cep->name, "rule")) - { - deny->rule = (char *)crule_parse(cep->value); - safe_strdup(deny->prettyrule, cep->value); - } - else if (!strcmp(cep->name, "type")) { - if (!strcmp(cep->value, "all")) - deny->flag.type = CRULE_ALL; - else if (!strcmp(cep->value, "auto")) - deny->flag.type = CRULE_AUTO; - } - } - AddListItem(deny, conf_deny_link); - return 0; -} - int _conf_deny_version(ConfigFile *conf, ConfigEntry *ce) { ConfigItem_deny_version *deny = NULL; @@ -10164,102 +10081,6 @@ int _test_deny(ConfigFile *conf, ConfigEntry *ce) errors++; } } - else if (!strcmp(ce->value, "link")) - { - char has_mask = 0, has_rule = 0, has_type = 0; - for (cep = ce->items; cep; cep = cep->next) - { - if (!cep->items) - { - if (config_is_blankorempty(cep, "deny link")) - { - errors++; - continue; - } - else if (!strcmp(cep->name, "mask")) - { - has_mask = 1; - } else if (!strcmp(cep->name, "rule")) - { - int val = 0; - if (has_rule) - { - config_warn_duplicate(cep->file->filename, - cep->line_number, "deny link::rule"); - continue; - } - has_rule = 1; - if ((val = crule_test(cep->value))) - { - config_error("%s:%i: deny link::rule contains an invalid expression: %s", - cep->file->filename, - cep->line_number, - crule_errstring(val)); - errors++; - } - } - else if (!strcmp(cep->name, "type")) - { - if (has_type) - { - config_warn_duplicate(cep->file->filename, - cep->line_number, "deny link::type"); - continue; - } - has_type = 1; - if (!strcmp(cep->value, "auto")) - ; - else if (!strcmp(cep->value, "all")) - ; - else { - config_status("%s:%i: unknown deny link type", - cep->file->filename, cep->line_number); - errors++; - } - } - else - { - config_error_unknown(cep->file->filename, - cep->line_number, "deny link", cep->name); - errors++; - } - } - else - { - // Sections - if (!strcmp(cep->name, "mask")) - { - if (cep->value || cep->items) - has_mask = 1; - } - else - { - config_error_unknown(cep->file->filename, - cep->line_number, "deny link", cep->name); - errors++; - continue; - } - } - } - if (!has_mask) - { - config_error_missing(ce->file->filename, ce->line_number, - "deny link::mask"); - errors++; - } - if (!has_rule) - { - config_error_missing(ce->file->filename, ce->line_number, - "deny link::rule"); - errors++; - } - if (!has_type) - { - config_error_missing(ce->file->filename, ce->line_number, - "deny link::type"); - errors++; - } - } else if (!strcmp(ce->value, "version")) { char has_mask = 0, has_version = 0, has_flags = 0; @@ -10733,14 +10554,17 @@ void resource_download_complete(const char *url, const char *file, const char *e } /** Request to REHASH the configuration file. - * There is no guarantee that the request will be done immediately - * (eg: it won't in case of remote includes). + * The rehash will not be done immediately, just scheduled. + * This means this function can safely be called from modules or + * other areas. * @param client The client requesting the /REHASH. * If this is NULL then the rehash was requested * via a signal to the process or GUI. */ void request_rehash(Client *client) { + json_t *j; + if (loop.rehashing) { if (client) @@ -10748,17 +10572,26 @@ void request_rehash(Client *client) return; } + /* Free any old json_rehash_log */ + if (json_rehash_log) + { + json_decref(json_rehash_log); + json_rehash_log = NULL; + } + + /* Start a new json_rehash_log */ + json_rehash_log = json_object(); + if (client) + json_expand_client(json_rehash_log, "rehash_client", client, 99); + j = json_array(); + json_object_set_new(json_rehash_log, "log", j); + + /* Now actually process the rehash request... */ loop.rehashing = 1; loop.rehash_save_client = client; config_read_start(); - /* If we already have everything, then can we proceed with the rehash */ - if (is_config_read_finished()) - { - rehash_internal(client); - return; - } - /* Otherwise, I/O events will take care of it later - * after all remote includes have been downloaded. + /* More config reading (or network I/O), and the actual rehash will + * happen in "the main loop". See end of SocketLoop() in src/ircd.c. */ } @@ -10768,7 +10601,7 @@ int rehash_internal(Client *client) /* Log it here if it is by a signal */ if (client == NULL) - unreal_log(ULOG_INFO, "config", "CONFIG_RELOAD", client, "Rehashing server configuration file [./unrealircd rehash]"); + unreal_log(ULOG_INFO, "config", "CONFIG_RELOAD", NULL, "Rehashing server configuration file [./unrealircd rehash]"); loop.rehashing = 2; /* now doing the actual rehash */ @@ -10782,7 +10615,9 @@ int rehash_internal(Client *client) unload_all_unused_extbans(); unload_all_unused_caps(); unload_all_unused_history_backends(); + unload_all_unused_rpc_handlers(); // unload_all_unused_moddata(); -- this will crash + clicap_check_for_changes(); umodes_check_for_changes(); charsys_check_for_changes(); @@ -10790,6 +10625,10 @@ int rehash_internal(Client *client) loop.rehashing = 0; remote_rehash_client = NULL; procio_post_rehash(failure); + json_object_set_new(json_rehash_log, "success", json_boolean(failure ? 0 : 1)); + RunHook(HOOKTYPE_REHASH_LOG, failure, json_rehash_log); + + loop.config_status = CONFIG_STATUS_COMPLETE; return 1; } @@ -10853,6 +10692,7 @@ void listen_cleanup() safe_free(listen_ptr->ip); free_tls_options(listen_ptr->tls_options); DelListItem(listen_ptr, conf_listen); + safe_free(listen_ptr->webserver); safe_free(listen_ptr->websocket_forward); safe_free(listen_ptr); i++; @@ -10988,6 +10828,7 @@ void free_all_config_resources(void) rs->wce = NULL; if (rs->type & RESOURCE_REMOTE) { + url_cancel_handle_by_callback_data(rs); /* Delete the file, but only if it's not a cached version */ if (rs->file && strncmp(rs->file, CACHEDIR, strlen(CACHEDIR))) { diff --git a/src/conf_preprocessor.c b/src/conf_preprocessor.c index c3cac00..13085a1 100644 --- a/src/conf_preprocessor.c +++ b/src/conf_preprocessor.c @@ -348,7 +348,17 @@ int preprocessor_resolve_if(ConditionalConfig *cc, PreprocessorPhase phase) if (cc->condition == IF_MODULE) { if (phase == PREPROCESSOR_PHASE_INITIAL) - return 1; /* we cannot handle @if module-loaded() yet.. */ + { + /* We cannot handle @if module-loaded() yet.. */ + return 1; + } + if (phase == PREPROCESSOR_PHASE_SECONDARY) + { + /* We can only handle blacklisted modules at this point, so: */ + if (is_blacklisted_module(cc->name)) + return 0; + return 1; + } if (is_module_loaded(cc->name)) { result = 1; diff --git a/src/crule.c b/src/crule.c index 4baf20e..a119cb9 100644 --- a/src/crule.c +++ b/src/crule.c @@ -1,9 +1,11 @@ -/* - * SmartRoute phase 1 - * connection rule patch +/** + * @file + * @brief Connection rule parser and checker + * @version $Id$ + * * by Tony Vencill (Tonto on IRC) * - * The majority of this file is a recusive descent parser used to convert + * The majority of this file is a recursive descent parser used to convert * connection rules into expression trees when the conf file is read. * All parsing structures and types are hidden in the interest of good * programming style and to make possible future data structure changes @@ -29,6 +31,35 @@ * more closely simulate the actual ircd environment). crule_eval and * the rule functions are made empty functions as in the stand-alone * test parser. + * + * The production rules for the grammar are as follows ("rule" is the + * starting production): + * + * rule: + * orexpr END END is end of input or : + * orexpr: + * andexpr + * andexpr || orexpr + * andexpr: + * primary + * primary && andexpr + * primary: + * function + * ! primary + * ( orexpr ) + * function: + * word ( ) word is alphanumeric string, first character + * word ( arglist ) must be a letter + * arglist: + * word + * word , arglist + */ + +/* Last update of parser functions taken from ircu on 2023-03-19 + * matching ircu's ircd/crule.c from 2021-09-04. + * Then ported / UnrealIRCd-ized by Syzop and re-adding crule_test() + * and such. All the actual "functions" like crule_connected() are + * our own and not re-feteched (but were based on older versions). */ #ifndef CR_DEBUG @@ -57,56 +88,67 @@ ID_Copyright("(C) Tony Vincell"); #define safe_free free #endif -/* some constants and shared data types */ -#define CR_MAXARGLEN 80 /* why 80? why not? it's > hostname lengths */ -#define CR_MAXARGS 3 /* there's a better way to do this, but not now */ +/* + * Some symbols for easy reading + */ -/* some symbols for easy reading */ -enum crule_token - { CR_UNKNOWN, CR_END, CR_AND, CR_OR, CR_NOT, CR_OPENPAREN, CR_CLOSEPAREN, - CR_COMMA, CR_WORD -}; -enum crule_errcode - { CR_NOERR, CR_UNEXPCTTOK, CR_UNKNWTOK, CR_EXPCTAND, CR_EXPCTOR, - CR_EXPCTPRIM, CR_EXPCTOPEN, CR_EXPCTCLOSE, CR_UNKNWFUNC, CR_ARGMISMAT +/** Input scanner tokens. */ +enum crule_token { + CR_UNKNOWN, /**< Unknown token type. */ + CR_END, /**< End of input ('\\0' or ':'). */ + CR_AND, /**< Logical and operator (&&). */ + CR_OR, /**< Logical or operator (||). */ + CR_NOT, /**< Logical not operator (!). */ + CR_OPENPAREN, /**< Open parenthesis. */ + CR_CLOSEPAREN, /**< Close parenthesis. */ + CR_COMMA, /**< Comma. */ + CR_WORD /**< Something that looks like a hostmask (alphanumerics, "*?.-"). */ }; -/* expression tree structure, function pointer, and tree pointer */ -/* local! */ -typedef int (*crule_funcptr) (int, void **); -struct crule_treestruct { - crule_funcptr funcptr; - int numargs; - void *arg[CR_MAXARGS]; /* for operators arg points to a tree element; - for functions arg points to a char string */ +/** Parser error codes. */ +enum crule_errcode { + CR_NOERR, /**< No error. */ + CR_UNEXPCTTOK, /**< Invalid token given context. */ + CR_UNKNWTOK, /**< Input did not form a valid token. */ + CR_EXPCTAND, /**< Did not see expected && operator. */ + CR_EXPCTOR, /**< Did not see expected || operator. */ + CR_EXPCTPRIM, /**< Expected a primitive (parentheses, ! or word). */ + CR_EXPCTOPEN, /**< Expected an open parenthesis after function name. */ + CR_EXPCTCLOSE, /**< Expected a close parenthesis to match open parenthesis. */ + CR_UNKNWFUNC, /**< Attempt to use an unknown function. */ + CR_ARGMISMAT /**< Wrong number of arguments to function. */ }; -typedef struct crule_treestruct crule_treeelem; -typedef crule_treeelem *crule_treeptr; + +/* + * Expression tree structure, function pointer, and tree pointer local! + */ /* rule function prototypes - local! */ -int crule_connected(int, void **); -int crule_directcon(int, void **); -int crule_via(int, void **); -int crule_directop(int, void **); -int crule__andor(int, void **); -int crule__not(int, void **); +static int crule_connected(int, void **); +static int crule_directcon(int, void **); +static int crule_via(int, void **); +static int crule_directop(int, void **); +static int crule__andor(int, void **); +static int crule__not(int, void **); /* parsing function prototypes - local! */ -int crule_gettoken(int *, char **); -void crule_getword(char *, int *, int, char **); -int crule_parseandexpr(crule_treeptr *, int *, char **); -int crule_parseorexpr(crule_treeptr *, int *, char **); -int crule_parseprimary(crule_treeptr *, int *, char **); -int crule_parsefunction(crule_treeptr *, int *, char **); -int crule_parsearglist(crule_treeptr, int *, char **); +static int crule_gettoken(int* token, const char** str); +static void crule_getword(char*, int*, size_t, const char**); +static int crule_parseandexpr(CRuleNodePtr*, int *, const char**); +static int crule_parseorexpr(CRuleNodePtr*, int *, const char**); +static int crule_parseprimary(CRuleNodePtr*, int *, const char**); +static int crule_parsefunction(CRuleNodePtr*, int *, const char**); +static int crule_parsearglist(CRuleNodePtr, int *, const char**); #if defined(CR_DEBUG) || defined(CR_CHKCONF) -/* prototypes for the test parser; if not debugging, these are - * defined in h.h */ -char *crule_parse(char *); -void crule_free(char **); +/* + * Prototypes for the test parser; if not debugging, + * these are defined in h.h + */ +struct CRuleNode* crule_parse(const char*); +void crule_free(struct CRuleNode**); #ifdef CR_DEBUG -void print_tree(crule_treeptr)); +void print_tree(CRuleNodePtr); #endif #endif @@ -139,7 +181,7 @@ struct crule_funclistent crule_funclist[] = { {"", 0, NULL} /* this must be here to mark end of list */ }; -int crule_connected(int numargs, void *crulearg[]) +static int crule_connected(int numargs, void *crulearg[]) { #if !defined(CR_DEBUG) && !defined(CR_CHKCONF) Client *client; @@ -156,7 +198,7 @@ int crule_connected(int numargs, void *crulearg[]) #endif } -int crule_directcon(int numargs, void *crulearg[]) +static int crule_directcon(int numargs, void *crulearg[]) { #if !defined(CR_DEBUG) && !defined(CR_CHKCONF) Client *client; @@ -175,7 +217,7 @@ int crule_directcon(int numargs, void *crulearg[]) #endif } -int crule_via(int numargs, void *crulearg[]) +static int crule_via(int numargs, void *crulearg[]) { #if !defined(CR_DEBUG) && !defined(CR_CHKCONF) Client *client; @@ -194,7 +236,7 @@ int crule_via(int numargs, void *crulearg[]) #endif } -int crule_directop(int numargs, void *crulearg[]) +static int crule_directop(int numargs, void *crulearg[]) { #if !defined(CR_DEBUG) && !defined(CR_CHKCONF) Client *client; @@ -212,577 +254,597 @@ int crule_directop(int numargs, void *crulearg[]) #endif } -int crule__andor(int numargs, void *crulearg[]) +/** Evaluate a connection rule. + * @param[in] rule Rule to evalute. + * @return Non-zero if the rule allows the connection, zero otherwise. + */ +int crule_eval(struct CRuleNode* rule) { - int result1; - - result1 = ((crule_treeptr) crulearg[0])->funcptr - (((crule_treeptr) crulearg[0])->numargs, - (void *)((crule_treeptr) crulearg[0])->arg); - if (crulearg[2]) /* or */ - return (result1 || - ((crule_treeptr) crulearg[1])->funcptr - (((crule_treeptr) crulearg[1])->numargs, - (void *)((crule_treeptr) crulearg[1])->arg)); - else - return (result1 && - ((crule_treeptr) crulearg[1])->funcptr - (((crule_treeptr) crulearg[1])->numargs, - (void *)((crule_treeptr) crulearg[1])->arg)); + return (rule->funcptr(rule->numargs, rule->arg)); } -int crule__not(int numargs, void *crulearg[]) +/** Perform an and-or-or test on crulearg[0] and crulearg[1]. + * If crulearg[2] is non-NULL, it means do OR; if it is NULL, do AND. + * @param[in] numargs Number of valid args in \a crulearg. + * @param[in] crulearg Argument array. + * @return Non-zero if the condition is true, zero if not. + */ +static int crule__andor(int numargs, void *crulearg[]) { - return (!((crule_treeptr) crulearg[0])->funcptr - (((crule_treeptr) crulearg[0])->numargs, - (void *)((crule_treeptr) crulearg[0])->arg)); + int result1; + + result1 = crule_eval(crulearg[0]); + if (crulearg[2]) /* or */ + return (result1 || crule_eval(crulearg[1])); + else + return (result1 && crule_eval(crulearg[1])); } -#if !defined(CR_DEBUG) && !defined(CR_CHKCONF) -int crule_eval(rule) - char *rule; +/** Logically invert the result of crulearg[0]. + * @param[in] numargs Number of valid args in \a crulearg. + * @param[in] crulearg Argument array. + * @return Non-zero if the condition is true, zero if not. + */ +static int crule__not(int numargs, void *crulearg[]) { - return (((crule_treeptr) rule)->funcptr - (((crule_treeptr) rule)->numargs, ((crule_treeptr) rule)->arg)); + return (!crule_eval(crulearg[0])); } + +/** Scan an input token from \a ruleptr. + * @param[out] next_tokp Receives type of next token. + * @param[in,out] ruleptr Next readable character from input. + * @return Either CR_UNKNWTOK if the input was unrecognizable, else CR_NOERR. + */ +static int crule_gettoken(int* next_tokp, const char** ruleptr) +{ + char pending = '\0'; + + *next_tokp = CR_UNKNOWN; + while (*next_tokp == CR_UNKNOWN) + switch (*(*ruleptr)++) + { + case ' ': + case '\t': + break; + case '&': + if (pending == '\0') + pending = '&'; + else if (pending == '&') + *next_tokp = CR_AND; + else + return (CR_UNKNWTOK); + break; + case '|': + if (pending == '\0') + pending = '|'; + else if (pending == '|') + *next_tokp = CR_OR; + else + return (CR_UNKNWTOK); + break; + case '!': + *next_tokp = CR_NOT; + break; + case '(': + *next_tokp = CR_OPENPAREN; + break; + case ')': + *next_tokp = CR_CLOSEPAREN; + break; + case ',': + *next_tokp = CR_COMMA; + break; + case '\0': + (*ruleptr)--; + *next_tokp = CR_END; + break; + case ':': + *next_tokp = CR_END; + break; + default: + if ((isalpha(*(--(*ruleptr)))) || (**ruleptr == '*') || + (**ruleptr == '?') || (**ruleptr == '.') || (**ruleptr == '-')) + *next_tokp = CR_WORD; + else + return (CR_UNKNWTOK); + break; + } + return CR_NOERR; +} + +/** Scan a word from \a ruleptr. + * @param[out] word Output buffer. + * @param[out] wordlenp Length of word written to \a word (not including terminating NUL). + * @param[in] maxlen Maximum number of bytes writable to \a word. + * @param[in,out] ruleptr Next readable character from input. + */ +static void crule_getword(char* word, int* wordlenp, size_t maxlen, const char** ruleptr) +{ + char *word_ptr; + + word_ptr = word; + while ((size_t)(word_ptr - word) < maxlen + && (isalnum(**ruleptr) + || **ruleptr == '*' || **ruleptr == '?' + || **ruleptr == '.' || **ruleptr == '-')) + *word_ptr++ = *(*ruleptr)++; + *word_ptr = '\0'; + *wordlenp = word_ptr - word; +} + +/** Parse an entire rule. + * @param[in] rule Text form of rule. + * @return CRuleNode for rule, or NULL if there was a parse error. + */ +struct CRuleNode* crule_parse(const char *rule) +{ + const char* ruleptr = rule; + int next_tok; + struct CRuleNode* ruleroot = 0; + int errcode = CR_NOERR; + + if ((errcode = crule_gettoken(&next_tok, &ruleptr)) == CR_NOERR) { + if ((errcode = crule_parseorexpr(&ruleroot, &next_tok, &ruleptr)) == CR_NOERR) { + if (ruleroot != NULL) { + if (next_tok == CR_END) + return (ruleroot); + else + errcode = CR_UNEXPCTTOK; + } + else + errcode = CR_EXPCTOR; + } + } + if (ruleroot != NULL) + crule_free(&ruleroot); +#if defined(CR_DEBUG) || defined(CR_CHKCONF) + fprintf(stderr, "%s in rule: %s\n", crule_errstr[errcode], rule); #endif - -int crule_gettoken(int *next_tokp, char **ruleptr) -{ - char pending = '\0'; - - *next_tokp = CR_UNKNOWN; - while (*next_tokp == CR_UNKNOWN) - switch (*(*ruleptr)++) - { - case ' ': - case '\t': - break; - case '&': - if (pending == '\0') - pending = '&'; - else if (pending == '&') - *next_tokp = CR_AND; - else - return (CR_UNKNWTOK); - break; - case '|': - if (pending == '\0') - pending = '|'; - else if (pending == '|') - *next_tokp = CR_OR; - else - return (CR_UNKNWTOK); - break; - case '!': - *next_tokp = CR_NOT; - break; - case '(': - *next_tokp = CR_OPENPAREN; - break; - case ')': - *next_tokp = CR_CLOSEPAREN; - break; - case ',': - *next_tokp = CR_COMMA; - break; - case '\0': - (*ruleptr)--; - *next_tokp = CR_END; - break; - /* Both - and : can appear in hostnames so they must not be - * treated as separators -- codemastr */ - default: - if ((isalpha(*(--(*ruleptr)))) || (**ruleptr == '*') - || (**ruleptr == '?') || (**ruleptr == '.') - || (**ruleptr == '-') || (**ruleptr == ':')) - *next_tokp = CR_WORD; - else - return (CR_UNKNWTOK); - break; - } - return CR_NOERR; + return 0; } -void crule_getword(char *word, int *wordlenp, int maxlen, char **ruleptr) +/** Test-parse an entire rule. + * @param[in] rule Text form of rule. + * @return error code, or 0 for no failure + */ +int crule_test(const char *rule) { - char *word_ptr, c; + const char* ruleptr = rule; + int next_tok; + struct CRuleNode* ruleroot = 0; + int errcode = CR_NOERR; - word_ptr = word; - /* Both - and : can appear in hostnames so they must not be - * treated as separators -- codemastr */ + if ((errcode = crule_gettoken(&next_tok, &ruleptr)) == CR_NOERR) { + if ((errcode = crule_parseorexpr(&ruleroot, &next_tok, &ruleptr)) == CR_NOERR) { + if (ruleroot != NULL) { + if (next_tok == CR_END) + { + /* PASS */ + crule_free(&ruleroot); + return 0; + } else { + errcode = CR_UNEXPCTTOK; + } + } + else + errcode = CR_EXPCTOR; + } + } + if (ruleroot != NULL) + crule_free(&ruleroot); +#if defined(CR_DEBUG) || defined(CR_CHKCONF) + fprintf(stderr, "%s in rule: %s\n", crule_errstr[errcode], rule); +#endif + return errcode + 1; +} - while ((isalnum(**ruleptr)) || (**ruleptr == '*') || - (**ruleptr == '?') || (**ruleptr == '.') || (**ruleptr == '-') || - (**ruleptr == ':')) - { - c = *(*ruleptr)++; - if (maxlen > 1) /* >1 instead of >0 so we (possibly) still have room for NUL */ - { - *word_ptr++ = c; - maxlen--; - } - } - if (maxlen) - *word_ptr = '\0'; - *wordlenp = word_ptr - word; +const char *crule_errstring(int errcode) +{ + if (errcode == 0) + return "No error"; + else + return crule_errstr[errcode-1]; +} + +/** Parse an or expression. + * @param[out] orrootp Receives parsed node. + * @param[in,out] next_tokp Next input token type. + * @param[in,out] ruleptr Next input character. + * @return A crule_errcode value. + */ +static int crule_parseorexpr(CRuleNodePtr * orrootp, int *next_tokp, const char** ruleptr) +{ + int errcode = CR_NOERR; + CRuleNodePtr andexpr; + CRuleNodePtr orptr; + + *orrootp = NULL; + while (errcode == CR_NOERR) + { + errcode = crule_parseandexpr(&andexpr, next_tokp, ruleptr); + if ((errcode == CR_NOERR) && (*next_tokp == CR_OR)) + { + orptr = safe_alloc(sizeof(struct CRuleNode)); +#ifdef CR_DEBUG + fprintf(stderr, "allocating or element at %ld\n", orptr); +#endif + orptr->funcptr = crule__andor; + orptr->numargs = 3; + orptr->arg[2] = (void *)1; + if (*orrootp != NULL) + { + (*orrootp)->arg[1] = andexpr; + orptr->arg[0] = *orrootp; + } + else + orptr->arg[0] = andexpr; + *orrootp = orptr; + } + else + { + if (*orrootp != NULL) + { + if (andexpr != NULL) + { + (*orrootp)->arg[1] = andexpr; + return (errcode); + } + else + { + (*orrootp)->arg[1] = NULL; /* so free doesn't seg fault */ + return (CR_EXPCTAND); + } + } + else + { + *orrootp = andexpr; + return (errcode); + } + } + errcode = crule_gettoken(next_tokp, ruleptr); + } + return (errcode); +} + +/** Parse an and expression. + * @param[out] androotp Receives parsed node. + * @param[in,out] next_tokp Next input token type. + * @param[in,out] ruleptr Next input character. + * @return A crule_errcode value. + */ +static int crule_parseandexpr(CRuleNodePtr * androotp, int *next_tokp, const char** ruleptr) +{ + int errcode = CR_NOERR; + CRuleNodePtr primary; + CRuleNodePtr andptr; + + *androotp = NULL; + while (errcode == CR_NOERR) + { + errcode = crule_parseprimary(&primary, next_tokp, ruleptr); + if ((errcode == CR_NOERR) && (*next_tokp == CR_AND)) + { + andptr = safe_alloc(sizeof(struct CRuleNode)); +#ifdef CR_DEBUG + fprintf(stderr, "allocating and element at %ld\n", andptr); +#endif + andptr->funcptr = crule__andor; + andptr->numargs = 3; + andptr->arg[2] = (void *)0; + if (*androotp != NULL) + { + (*androotp)->arg[1] = primary; + andptr->arg[0] = *androotp; + } + else + andptr->arg[0] = primary; + *androotp = andptr; + } + else + { + if (*androotp != NULL) + { + if (primary != NULL) + { + (*androotp)->arg[1] = primary; + return (errcode); + } + else + { + (*androotp)->arg[1] = NULL; /* so free doesn't seg fault */ + return (CR_EXPCTPRIM); + } + } + else + { + *androotp = primary; + return (errcode); + } + } + errcode = crule_gettoken(next_tokp, ruleptr); + } + return (errcode); +} + +/** Parse a primary expression. + * @param[out] primrootp Receives parsed node. + * @param[in,out] next_tokp Next input token type. + * @param[in,out] ruleptr Next input character. + * @return A crule_errcode value. + */ +static int crule_parseprimary(CRuleNodePtr* primrootp, int *next_tokp, const char** ruleptr) +{ + CRuleNodePtr *insertionp; + int errcode = CR_NOERR; + + *primrootp = NULL; + insertionp = primrootp; + while (errcode == CR_NOERR) + { + switch (*next_tokp) + { + case CR_OPENPAREN: + if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) + break; + if ((errcode = crule_parseorexpr(insertionp, next_tokp, ruleptr)) != CR_NOERR) + break; + if (*insertionp == NULL) + { + errcode = CR_EXPCTAND; + break; + } + if (*next_tokp != CR_CLOSEPAREN) + { + errcode = CR_EXPCTCLOSE; + break; + } + errcode = crule_gettoken(next_tokp, ruleptr); + break; + case CR_NOT: + *insertionp = safe_alloc(sizeof(struct CRuleNode)); +#ifdef CR_DEBUG + fprintf(stderr, "allocating primary element at %ld\n", *insertionp); +#endif + (*insertionp)->funcptr = crule__not; + (*insertionp)->numargs = 1; + (*insertionp)->arg[0] = NULL; + insertionp = (CRuleNodePtr *) & ((*insertionp)->arg[0]); + if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) + break; + continue; + case CR_WORD: + errcode = crule_parsefunction(insertionp, next_tokp, ruleptr); + break; + default: + if (*primrootp == NULL) + errcode = CR_NOERR; + else + errcode = CR_EXPCTPRIM; + break; + } + break; /* loop only continues after a CR_NOT */ + } + return (errcode); +} + +/** Parse a function call. + * @param[out] funcrootp Receives parsed node. + * @param[in,out] next_tokp Next input token type. + * @param[in,out] ruleptr Next input character. + * @return A crule_errcode value. + */ +static int crule_parsefunction(CRuleNodePtr* funcrootp, int* next_tokp, const char** ruleptr) +{ + int errcode = CR_NOERR; + char funcname[CR_MAXARGLEN]; + int namelen; + int funcnum; + + *funcrootp = NULL; + crule_getword(funcname, &namelen, CR_MAXARGLEN - 1, ruleptr); + if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) + return (errcode); + if (*next_tokp == CR_OPENPAREN) + { + for (funcnum = 0;; funcnum++) + { + if (0 == strcasecmp(crule_funclist[funcnum].name, funcname)) + break; + if (crule_funclist[funcnum].name[0] == '\0') + return (CR_UNKNWFUNC); + } + if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) + return (errcode); + *funcrootp = safe_alloc(sizeof(struct CRuleNode)); +#ifdef CR_DEBUG + fprintf(stderr, "allocating function element at %ld\n", *funcrootp); +#endif + (*funcrootp)->funcptr = NULL; /* for freeing aborted trees */ + if ((errcode = + crule_parsearglist(*funcrootp, next_tokp, ruleptr)) != CR_NOERR) + return (errcode); + if (*next_tokp != CR_CLOSEPAREN) + return (CR_EXPCTCLOSE); + if ((crule_funclist[funcnum].reqnumargs != (*funcrootp)->numargs) && + (crule_funclist[funcnum].reqnumargs != -1)) + return (CR_ARGMISMAT); + if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) + return (errcode); + (*funcrootp)->funcptr = crule_funclist[funcnum].funcptr; + return (CR_NOERR); + } + else + return (CR_EXPCTOPEN); +} + +/** Parse the argument list to a CRuleNode. + * @param[in,out] argrootp Node whos argument list is being populated. + * @param[in,out] next_tokp Next input token type. + * @param[in,out] ruleptr Next input character. + * @return A crule_errcode value. + */ +static int crule_parsearglist(CRuleNodePtr argrootp, int *next_tokp, const char** ruleptr) +{ + int errcode = CR_NOERR; + char *argelemp = NULL; + char currarg[CR_MAXARGLEN]; + int arglen = 0; + char word[CR_MAXARGLEN]; + int wordlen = 0; + + argrootp->numargs = 0; + currarg[0] = '\0'; + while (errcode == CR_NOERR) + { + switch (*next_tokp) + { + case CR_WORD: + crule_getword(word, &wordlen, CR_MAXARGLEN - 1, ruleptr); + if (currarg[0] != '\0') + { + if ((arglen + wordlen) < (CR_MAXARGLEN - 1)) + { + strcat(currarg, " "); + strcat(currarg, word); + arglen += wordlen + 1; + } + } + else + { + strcpy(currarg, word); + arglen = wordlen; + } + errcode = crule_gettoken(next_tokp, ruleptr); + break; + default: +#if !defined(CR_DEBUG) && !defined(CR_CHKCONF) + collapse(currarg); +#endif + if (currarg[0] != '\0') + { + argelemp = raw_strdup(currarg); + argrootp->arg[argrootp->numargs++] = (void *)argelemp; + } + if (*next_tokp != CR_COMMA) + return (CR_NOERR); + currarg[0] = '\0'; + errcode = crule_gettoken(next_tokp, ruleptr); + break; + } + } + return (errcode); } /* - * Grammar - * rule: - * orexpr END END is end of input - * orexpr: - * andexpr - * andexpr || orexpr - * andexpr: - * primary - * primary && andexpr - * primary: - * function - * ! primary - * ( orexpr ) - * function: - * word ( ) word is alphanumeric string, first character - * word ( arglist ) must be a letter - * arglist: - * word - * word , arglist + * This function is recursive.. I wish I knew a nonrecursive way but + * I don't. Anyway, recursion is fun.. :) + * DO NOT CALL THIS FUNCTION WITH A POINTER TO A NULL POINTER + * (i.e.: If *elem is NULL, you're doing it wrong - seg fault) */ - -char *crule_parse(char *rule) -{ - char *ruleptr = rule; - int next_tok; - crule_treeptr ruleroot = NULL; - int errcode = CR_NOERR; - - if ((errcode = crule_gettoken(&next_tok, &ruleptr)) == CR_NOERR) { - if ((errcode = crule_parseorexpr(&ruleroot, &next_tok, - &ruleptr)) == CR_NOERR) { - if (ruleroot != NULL) { - if (next_tok == CR_END) - return ((char *)ruleroot); - else - errcode = CR_UNEXPCTTOK; - } - else - errcode = CR_EXPCTOR; - } - } - if (ruleroot != NULL) - crule_free((char **)&ruleroot); - return NULL; -} - -int crule_parseorexpr(crule_treeptr *orrootp, int *next_tokp, char **ruleptr) -{ - int errcode = CR_NOERR; - crule_treeptr andexpr; - crule_treeptr orptr; - - *orrootp = NULL; - while (errcode == CR_NOERR) - { - errcode = crule_parseandexpr(&andexpr, next_tokp, ruleptr); - if ((errcode == CR_NOERR) && (*next_tokp == CR_OR)) - { - orptr = - (crule_treeptr) safe_alloc(sizeof(crule_treeelem)); -#ifdef CR_DEBUG - (void)fprintf(stderr, "allocating or element at %ld\n", orptr); -#endif - orptr->funcptr = crule__andor; - orptr->numargs = 3; - orptr->arg[2] = (void *)1; - if (*orrootp != NULL) - { - (*orrootp)->arg[1] = andexpr; - orptr->arg[0] = *orrootp; - } - else - orptr->arg[0] = andexpr; - *orrootp = orptr; - } - else - { - if (*orrootp != NULL) - if (andexpr != NULL) - { - (*orrootp)->arg[1] = andexpr; - return (errcode); - } - else - { - (*orrootp)->arg[1] = NULL; /* so free doesn't seg fault */ - return (CR_EXPCTAND); - } - else - { - *orrootp = andexpr; - return (errcode); - } - } - if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) - return (errcode); - } - return (errcode); -} - -int crule_parseandexpr(crule_treeptr *androotp, int *next_tokp, char **ruleptr) -{ - int errcode = CR_NOERR; - crule_treeptr primary; - crule_treeptr andptr; - - *androotp = NULL; - while (errcode == CR_NOERR) - { - errcode = crule_parseprimary(&primary, next_tokp, ruleptr); - if ((errcode == CR_NOERR) && (*next_tokp == CR_AND)) - { - andptr = - (crule_treeptr) safe_alloc(sizeof(crule_treeelem)); -#ifdef CR_DEBUG - (void)fprintf(stderr, "allocating and element at %ld\n", andptr); -#endif - andptr->funcptr = crule__andor; - andptr->numargs = 3; - andptr->arg[2] = (void *)0; - if (*androotp != NULL) - { - (*androotp)->arg[1] = primary; - andptr->arg[0] = *androotp; - } - else - andptr->arg[0] = primary; - *androotp = andptr; - } - else - { - if (*androotp != NULL) - if (primary != NULL) - { - (*androotp)->arg[1] = primary; - return (errcode); - } - else - { - (*androotp)->arg[1] = NULL; /* so free doesn't seg fault */ - return (CR_EXPCTPRIM); - } - else - { - *androotp = primary; - return (errcode); - } - } - if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) - return (errcode); - } - return (errcode); -} - -int crule_parseprimary(crule_treeptr *primrootp, int *next_tokp, char **ruleptr) -{ - crule_treeptr *insertionp; - int errcode = CR_NOERR; - - *primrootp = NULL; - insertionp = primrootp; - while (errcode == CR_NOERR) - { - switch (*next_tokp) - { - case CR_OPENPAREN: - if ((errcode = - crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) - break; - if ((errcode = - crule_parseorexpr(insertionp, next_tokp, - ruleptr)) != CR_NOERR) - break; - if (*insertionp == NULL) - { - errcode = CR_EXPCTAND; - break; - } - if (*next_tokp != CR_CLOSEPAREN) - { - errcode = CR_EXPCTCLOSE; - break; - } - errcode = crule_gettoken(next_tokp, ruleptr); - break; - case CR_NOT: - *insertionp = - (crule_treeptr) safe_alloc(sizeof(crule_treeelem)); -#ifdef CR_DEBUG - (void)fprintf(stderr, - "allocating primary element at %ld\n", - *insertionp); -#endif - (*insertionp)->funcptr = crule__not; - (*insertionp)->numargs = 1; - (*insertionp)->arg[0] = NULL; - insertionp = - (crule_treeptr *) & ((*insertionp)->arg[0]); - if ((errcode = - crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) - break; - continue; - case CR_WORD: - errcode = - crule_parsefunction(insertionp, next_tokp, - ruleptr); - break; - default: - if (*primrootp == NULL) - errcode = CR_NOERR; - else - errcode = CR_EXPCTPRIM; - break; - } - return (errcode); - } - return (errcode); -} - -int crule_parsefunction(crule_treeptr *funcrootp, int *next_tokp, char **ruleptr) -{ - int errcode = CR_NOERR; - char funcname[CR_MAXARGLEN]; - int namelen; - int funcnum; - - *funcrootp = NULL; - crule_getword(funcname, &namelen, CR_MAXARGLEN, ruleptr); - if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) - return (errcode); - if (*next_tokp == CR_OPENPAREN) - { - for (funcnum = 0;; funcnum++) - { - if (strcasecmp(crule_funclist[funcnum].name, funcname) == 0) - break; - if (crule_funclist[funcnum].name[0] == '\0') - return (CR_UNKNWFUNC); - } - if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) - return (errcode); - *funcrootp = (crule_treeptr) safe_alloc(sizeof(crule_treeelem)); -#ifdef CR_DEBUG - (void)fprintf(stderr, "allocating function element at %ld\n", - *funcrootp); -#endif - (*funcrootp)->funcptr = NULL; /* for freeing aborted trees */ - if ((errcode = crule_parsearglist(*funcrootp, next_tokp, - ruleptr)) != CR_NOERR) - return (errcode); - if (*next_tokp != CR_CLOSEPAREN) - return (CR_EXPCTCLOSE); - if ((crule_funclist[funcnum].reqnumargs != - (*funcrootp)->numargs) - && (crule_funclist[funcnum].reqnumargs != -1)) - return (CR_ARGMISMAT); - if ((errcode = crule_gettoken(next_tokp, ruleptr)) != CR_NOERR) - return (errcode); - (*funcrootp)->funcptr = crule_funclist[funcnum].funcptr; - return (CR_NOERR); - } - else - return (CR_EXPCTOPEN); -} - -int crule_parsearglist(crule_treeptr argrootp, int *next_tokp, char **ruleptr) -{ - int errcode = CR_NOERR; - char *argelemp = NULL; - char currarg[CR_MAXARGLEN]; - int arglen = 0; - char word[CR_MAXARGLEN]; - int wordlen = 0; - - argrootp->numargs = 0; - currarg[0] = '\0'; - while (errcode == CR_NOERR) - { - switch (*next_tokp) - { - case CR_WORD: - crule_getword(word, &wordlen, CR_MAXARGLEN, ruleptr); - if (currarg[0] != '\0') - { - if ((arglen + wordlen) < (CR_MAXARGLEN - 1)) - { - strlcat(currarg, " ", sizeof currarg); - strlcat(currarg, word, sizeof currarg); - arglen += wordlen + 1; - } - } - else - { - strlcpy(currarg, word, sizeof currarg); - arglen = wordlen; - } - errcode = crule_gettoken(next_tokp, ruleptr); - break; - default: -#if !defined(CR_DEBUG) && !defined(CR_CHKCONF) - collapse(currarg); -#endif - if (*currarg) - { - safe_strdup(argelemp, currarg); - argrootp->arg[argrootp->numargs++] = (void *)argelemp; - } - if (*next_tokp != CR_COMMA) - return (CR_NOERR); - currarg[0] = '\0'; - errcode = crule_gettoken(next_tokp, ruleptr); - break; - } - } - return (errcode); -} - -/* - * this function is recursive.. i wish i knew a nonrecursive way but - * i dont. anyway, recursion is fun.. :) - * DO NOT CALL THIS FUNTION WITH A POINTER TO A NULL POINTER - * (ie: if *elem is NULL, you're doing it wrong - seg fault) +/** Free a connection rule and all its children. + * @param[in,out] elem Pointer to pointer to element to free. MUST NOT BE NULL. */ -void crule_free(char **elem) +void crule_free(struct CRuleNode** elem) { - int arg, numargs; + int arg, numargs; - if ((*((crule_treeptr *) elem))->funcptr == crule__not) - { - /* type conversions and ()'s are fun! ;) here have an asprin.. */ - if ((*((crule_treeptr *) elem))->arg[0] != NULL) - crule_free((char **)&((*((crule_treeptr *) - elem))->arg[0])); - } - else if ((*((crule_treeptr *) elem))->funcptr == crule__andor) - { - crule_free((char **)&((*((crule_treeptr *) elem))->arg[0])); - if ((*((crule_treeptr *) elem))->arg[1] != NULL) - crule_free((char **)&((*((crule_treeptr *) - elem))->arg[1])); - } - else - { - numargs = (*((crule_treeptr *) elem))->numargs; - for (arg = 0; arg < numargs; arg++) - safe_free_raw((char *)(*((crule_treeptr *) elem))->arg[arg]); - } + if ((*(elem))->funcptr == crule__not) + { + /* type conversions and ()'s are fun! ;) here have an aspirin.. */ + if ((*(elem))->arg[0] != NULL) + crule_free((struct CRuleNode**) &((*(elem))->arg[0])); + } + else if ((*(elem))->funcptr == crule__andor) + { + crule_free((struct CRuleNode**) &((*(elem))->arg[0])); + if ((*(elem))->arg[1] != NULL) + crule_free((struct CRuleNode**) &((*(elem))->arg[1])); + } + else + { + numargs = (*(elem))->numargs; + for (arg = 0; arg < numargs; arg++) + safe_free((*(elem))->arg[arg]); + } #ifdef CR_DEBUG - (void)fprintf(stderr, "freeing element at %ld\n", *elem); + fprintf(stderr, "freeing element at %ld\n", *elem); #endif - safe_free(*elem); - *elem = NULL; -} - -char *crule_errstring(int errcode) -{ - return crule_errstr[errcode-1]; -} - -int crule_test(char *rule) -{ - char *ruleptr = rule; - int next_tok; - crule_treeptr ruleroot = NULL; - int errcode = CR_NOERR; - - if ((errcode = crule_gettoken(&next_tok, &ruleptr)) == CR_NOERR) { - if ((errcode = crule_parseorexpr(&ruleroot, &next_tok, - &ruleptr)) == CR_NOERR) { - if (ruleroot != NULL) { - if (next_tok == CR_END) - { - crule_free((char **)&ruleroot); - return 0; - } - else - errcode = CR_UNEXPCTTOK; - } - else - errcode = CR_EXPCTOR; - } - } - if (ruleroot != NULL) - crule_free((char **)&ruleroot); - return errcode+1; + safe_free(*elem); + *elem = 0; } #ifdef CR_DEBUG -void print_tree(crule_treeptr printelem) +/** Display a connection rule as text. + * @param[in] printelem Connection rule to display. + */ +static void print_tree(CRuleNodePtr printelem) { - int funcnum, arg; + int funcnum, arg; - if (printelem->funcptr == crule__not) - { - printf("!( "); - print_tree((crule_treeptr) printelem->arg[0]); - printf(") "); - } - else if (printelem->funcptr == crule__andor) - { - printf("( "); - print_tree((crule_treeptr) printelem->arg[0]); - if (printelem->arg[2]) - printf("|| "); - else - printf("&& "); - print_tree((crule_treeptr) printelem->arg[1]); - printf(") "); - } - else - { - for (funcnum = 0;; funcnum++) - { - if (printelem->funcptr == - crule_funclist[funcnum].funcptr) - break; - if (crule_funclist[funcnum].funcptr == NULL) - { - printf("\nACK! *koff* *sputter*\n"); - exit(1); - } - } - printf("%s(", crule_funclist[funcnum].name); - for (arg = 0; arg < printelem->numargs; arg++) - { - if (arg != 0) - printf(","); - printf("%s", (char *)printelem->arg[arg]); - } - printf(") "); - } + if (printelem->funcptr == crule__not) + { + printf("!( "); + print_tree((CRuleNodePtr) printelem->arg[0]); + printf(") "); + } + else if (printelem->funcptr == crule__andor) + { + printf("( "); + print_tree((CRuleNodePtr) printelem->arg[0]); + if (printelem->arg[2]) + printf("|| "); + else + printf("&& "); + print_tree((CRuleNodePtr) printelem->arg[1]); + printf(") "); + } + else + { + for (funcnum = 0;; funcnum++) + { + if (printelem->funcptr == crule_funclist[funcnum].funcptr) + break; + if (crule_funclist[funcnum].funcptr == NULL) + MyCoreDump; + } + printf("%s(", crule_funclist[funcnum].name); + for (arg = 0; arg < printelem->numargs; arg++) + { + if (arg != 0) + printf(","); + printf("%s", (char *)printelem->arg[arg]); + } + printf(") "); + } } #endif #ifdef CR_DEBUG -void main() +/** Read connection rules from stdin and display parsed forms as text. + * @return Zero. + */ +int main(void) { - char indata[256]; - char *rule; + char indata[256]; + CRuleNode* rule; - printf("rule: "); - while (fgets(indata, 256, stdin) != NULL) - { - indata[strlen(indata) - 1] = '\0'; /* lose the newline */ - if ((rule = crule_parse(indata)) != NULL) - { - printf("equivalent rule: "); - print_tree((crule_treeptr) rule); - printf("\n"); - crule_free(&rule); - } - printf("\nrule: "); - } - printf("\n"); + printf("rule: "); + while (fgets(indata, 256, stdin) != NULL) + { + indata[strlen(indata) - 1] = '\0'; /* lose the newline */ + if ((rule = crule_parse(indata)) != NULL) + { + printf("equivalent rule: "); + print_tree((CRuleNodePtr) rule); + printf("\n"); + crule_free(&rule); + } + printf("\nrule: "); + } + printf("\n"); + + return 0; } + #endif diff --git a/src/dbuf.c b/src/dbuf.c index b1ba1ab..b80277d 100644 --- a/src/dbuf.c +++ b/src/dbuf.c @@ -189,3 +189,32 @@ int dbuf_getmsg(dbuf *dyn, char *buf) dbuf_delete(dyn, line_bytes + empty_bytes); return MIN(line_bytes, READBUFSIZE - 2); } + +/* +** dbuf_get +** +** Get the entire dbuf buffer as a newly allocated string. There is NO CR/LF processing. +*/ +int dbuf_get(dbuf *dyn, char **buf) +{ + dbufbuf *block; + char *d; + int bytes = 0; + + /* First calculate the room needed... */ + list_for_each_entry2(block, dbufbuf, &dyn->dbuf_list, dbuf_node) + bytes += block->size; + + d = *buf = safe_alloc(bytes + 1); + + list_for_each_entry2(block, dbufbuf, &dyn->dbuf_list, dbuf_node) + { + memcpy(d, block->data, block->size); + d += block->size; + } + *d = '\0'; /* zero terminate */ + + /* Remove what is now unnecessary */ + dbuf_delete(dyn, bytes); + return bytes; +} diff --git a/src/dispatch.c b/src/dispatch.c index 096243c..1a9d1d7 100644 --- a/src/dispatch.c +++ b/src/dispatch.c @@ -160,7 +160,7 @@ void fd_debug(fd_set *f, int highest, char *name) } } } -void fd_select(time_t delay) +void fd_select(int delay) { struct timeval to; int num, fd; @@ -360,7 +360,7 @@ void fd_refresh(int fd) } } -void fd_select(time_t delay) +void fd_select(int delay) { struct timespec ts; int num, p, revents, fd; @@ -469,7 +469,7 @@ void fd_refresh(int fd) fde->backend_flags = pflags; } -void fd_select(time_t delay) +void fd_select(int delay) { int num, p, revents, fd; struct epoll_event *epfd; @@ -605,7 +605,7 @@ void fd_refresh(int fd) fde->backend_flags = pflags; } -void fd_select(time_t delay) +void fd_select(int delay) { int num, p, revents, fd; struct pollfd *pfd; diff --git a/src/fdlist.c b/src/fdlist.c index ae57aee..c38b8d2 100644 --- a/src/fdlist.c +++ b/src/fdlist.c @@ -19,7 +19,7 @@ #include "unrealircd.h" -/* new FD management code, based on mowgli.eventloop from atheme, hammered into Unreal by +/* new FD management code, based on mowgli.eventloop from atheme, hammered into UnrealIRCd by * me, nenolod. */ FDEntry fd_table[MAXCONNECTIONS + 1]; diff --git a/src/hash.c b/src/hash.c index 0901af9..bccb1c0 100644 --- a/src/hash.c +++ b/src/hash.c @@ -320,7 +320,7 @@ int add_to_client_hash_table(const char *name, Client *client) /* * If you see this, you have probably found your way to why changing the * base version made the IRCd become weird. This has been the case in all - * Unreal versions since 3.0. I'm sick of people ripping the IRCd off and + * UnrealIRCd versions since 3.0. I'm sick of people ripping the IRCd off and * just slapping on some random BASE_VERSION while not changing * a single bit of code. YOU DID NOT WRITE ALL OF THIS THEREFORE YOU DO NOT * DESERVE TO BE ABLE TO DO THAT. If you found this however, I'm OK with you @@ -720,3 +720,21 @@ int throttle_can_connect(Client *client) return 2; } } + +/** Find a server by the SID-part of a UID. + * Eg you pass "001ABCDEFG" and it would look up server "001". + * + * @param uid The UID, eg 001ABCDEFG + * @returns Server where the UID would be hosted on, or NULL + * if no such server is linked. + */ +Client *find_server_by_uid(const char *uid) +{ + char sid[SIDLEN+1]; + + if (!isdigit(*uid)) + return NULL; /* not a UID/SID */ + + strlcpy(sid, uid, sizeof(sid)); + return hash_find_id(sid, NULL); +} diff --git a/src/ircd.c b/src/ircd.c index 17fcb87..c6cded9 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -121,12 +121,32 @@ EVENT(handshake_timeout) list_for_each_entry_safe(client, next, &unknown_list, lclient_node) { - if (client->local->creationtime && ((TStime() - client->local->creationtime) > iConf.handshake_timeout)) + if (client->local->creationtime && + ((TStime() - client->local->creationtime) > iConf.handshake_timeout) && + !(client->local->listener && (client->local->listener->socket_type == SOCKET_TYPE_UNIX))) { + Hook *h; + int n = HOOK_CONTINUE; + const char *quitreason = "Registration Timeout"; + char reasonbuf[512]; + if (client->server && *client->server->by) continue; /* handled by server module */ - exit_client(client, NULL, "Registration Timeout"); + for (h = Hooks[HOOKTYPE_PRE_LOCAL_HANDSHAKE_TIMEOUT]; h; h = h->next) + { + n = (*(h->func.intfunc))(client, &quitreason); + if (n == HOOK_ALLOW) + break; + } + if (n == HOOK_ALLOW) + continue; /* Do not exit the client due to registration timeout */ + + /* Work on a copy here, since the 'quitreason' may point to + * some kind of buffer that gets freed in the exit code. + */ + strlcpy(reasonbuf, quitreason ? quitreason : "Registration Timeout", sizeof(reasonbuf)); + exit_client(client, NULL, reasonbuf); continue; } } @@ -712,6 +732,9 @@ int InitUnrealIRCd(int argc, char *argv[]) #endif fprintf(stderr, "* c-ares %s\n", ares_version(NULL)); fprintf(stderr, "* %s\n", pcre2_version()); +#endif +#if JANSSON_VERSION_HEX >= 0x020D00 + fprintf(stderr, "* jansson %s\n", jansson_version_str()); #endif check_user_limit(); #ifndef _WIN32 @@ -730,6 +753,7 @@ int InitUnrealIRCd(int argc, char *argv[]) #endif init_dynconf(); init_sys(); + clicap_init(); /* * Add default class */ @@ -760,7 +784,6 @@ int InitUnrealIRCd(int argc, char *argv[]) make_server(&me); umodes_check_for_changes(); charsys_check_for_changes(); - clicap_init(); if (!find_command_simple("PRIVMSG")) { config_error("Someone forgot to load modules with proper commands in them. READ THE DOCUMENTATION"); @@ -854,6 +877,7 @@ int InitUnrealIRCd(int argc, char *argv[]) PS_STRINGS->ps_argvstr = me.name; #endif module_loadall(); + loop.config_status = CONFIG_STATUS_COMPLETE; #ifndef _WIN32 SocketLoop(NULL); diff --git a/src/json.c b/src/json.c new file mode 100644 index 0000000..0c433b2 --- /dev/null +++ b/src/json.c @@ -0,0 +1,580 @@ +/************************************************************************ + * UnralIRCd JSON functions, src/json.c + * (C) 2021-.. Bram Matthys (Syzop) and the UnrealIRCd Team + * License: GPLv2 or later + */ + +#include "unrealircd.h" + +/** @file + * @brief JSON functions - used for logging and RPC. + */ + +/** Are we currently in the logging code? */ +int log_json_filter = 0; + +/** Calculate expansion of a JSON string thanks to double escaping. + * orig => JSON => IRC + * " => \" => \\" + * \ => \\ => \\\\ + */ +int json_dump_string_length(const char *s) +{ + int len = 0; + for (; *s; s++) + { + if (*s == '\\') + len += 4; + else if (*s == '"') + len += 3; + else + len++; + } + return len; +} + +/** Convert a regular string value to a JSON string. + * In UnrealIRCd, this must be used instead of json_string() + * as we may use non-UTF8 sequences. Also, this takes care + * of using json_null() if the string was NULL, which is + * usually what we want as well. + * @param s Input string + * @returns a json string value or json null value. + */ +json_t *json_string_unreal(const char *s) +{ + char buf1[512], buf2[512]; + char *verified_s; + const char *stripped; + + if (s == NULL) + return json_null(); + + if (log_json_filter) + { + stripped = StripControlCodesEx(s, buf1, sizeof(buf1), UNRL_STRIP_LOW_ASCII|UNRL_STRIP_KEEP_LF); + verified_s = unrl_utf8_make_valid(buf1, buf2, sizeof(buf2), 0); + } else { + verified_s = unrl_utf8_make_valid(s, buf2, sizeof(buf2), 0); + } + + return json_string(verified_s); +} + +const char *json_object_get_string(json_t *j, const char *name) +{ + json_t *v = json_object_get(j, name); + return v ? json_string_value(v) : NULL; +} + +/** Get integer value of a JSON object. + * @param j The JSON object that should contain a 'name' item + * @param name The item to search for + * @param default_value The value to return when the JSON object 'name' is not found + * or not an integer. + * @returns The integer value, or default_value if the object does not exist or is not an integer. + */ +int json_object_get_integer(json_t *j, const char *name, int default_value) +{ + json_t *v = json_object_get(j, name); + if (!v || !json_is_integer(v)) + return default_value; + return json_integer_value(v); +} + +int json_object_get_boolean(json_t *j, const char *name, int default_value) +{ + json_t *v = json_object_get(j, name); + if (!v) + return default_value; + if (json_is_true(v)) + return 1; + return 0; +} + +#define json_string __BAD___DO__NOT__USE__JSON__STRING__PLZ + +const char *json_get_value(json_t *t) +{ + static char buf[32]; + + if (json_is_string(t)) + return json_string_value(t); + + if (json_is_integer(t)) + { + snprintf(buf, sizeof(buf), "%lld", (long long)json_integer_value(t)); + return buf; + } + + if (json_is_boolean(t)) + { + if (json_is_true(t)) + return "true"; + return "false"; + } + + if (json_is_array(t)) + return ""; + + return NULL; +} + +json_t *json_timestamp(time_t v) +{ + const char *ts = timestamp_iso8601(v); + if (ts) + return json_string_unreal(ts); + return json_null(); +} + +const char *timestamp_iso8601_now(void) +{ + struct timeval t; + struct tm *tm; + time_t sec; + static char buf[64]; + + gettimeofday(&t, NULL); + sec = t.tv_sec; + tm = gmtime(&sec); + + snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec, + (int)(t.tv_usec / 1000)); + + return buf; +} + +const char *timestamp_iso8601(time_t v) +{ + struct tm *tm; + static char buf[64]; + + if (v == 0) + return NULL; + + tm = gmtime(&v); + + if (tm == NULL) + return NULL; + + snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", + tm->tm_year + 1900, + tm->tm_mon + 1, + tm->tm_mday, + tm->tm_hour, + tm->tm_min, + tm->tm_sec, + 0); + + return buf; +} + +void json_expand_client_security_groups(json_t *parent, Client *client) +{ + SecurityGroup *s; + json_t *child = json_array(); + json_object_set_new(parent, "security-groups", child); + + /* We put known-users or unknown-users at the beginning. + * The latter is special and doesn't actually exist + * in the linked list, hence the special code here, + * and again later in the for loop to skip it. + */ + if (user_allowed_by_security_group_name(client, "known-users")) + json_array_append_new(child, json_string_unreal("known-users")); + else + json_array_append_new(child, json_string_unreal("unknown-users")); + + for (s = securitygroups; s; s = s->next) + if (strcmp(s->name, "known-users") && user_allowed_by_security_group(client, s)) + json_array_append_new(child, json_string_unreal(s->name)); +} + +/* detail=0: only name, id + * detail=1: only name, id, hostname, ip, details, geoip + * detail=2: everything, except 'channels' + * detail=3: everything, with 'channels' being a max 384 character string (meant for JSON logging only) + * detail=4: everything, with 'channels' object (full). + */ +void json_expand_client(json_t *j, const char *key, Client *client, int detail) +{ + char buf[BUFSIZE+1]; + json_t *child; + json_t *user = NULL; + time_t ts; + + if (key) + { + child = json_object(); + json_object_set_new(j, key, child); + } else { + child = j; + } + + /* First the information that is available for ALL client types: */ + json_object_set_new(child, "name", json_string_unreal(client->name)); + json_object_set_new(child, "id", json_string_unreal(client->id)); + + if (detail == 0) + return; + + /* hostname is available for all, it just depends a bit on whether it is DNS or IP */ + if (client->user && *client->user->realhost) + json_object_set_new(child, "hostname", json_string_unreal(client->user->realhost)); + else if (client->local && *client->local->sockhost) + json_object_set_new(child, "hostname", json_string_unreal(client->local->sockhost)); + else + json_object_set_new(child, "hostname", json_string_unreal(GetIP(client))); + + /* same for ip, is there for all (well, some services pseudo-users may not have one) */ + json_object_set_new(child, "ip", json_string_unreal(client->ip)); + /* client.details is always available: it is nick!user@host, nick@host, server@host + * server@ip, or just server. + */ + if (client->user) + { + snprintf(buf, sizeof(buf), "%s!%s@%s", client->name, client->user->username, client->user->realhost); + json_object_set_new(child, "details", json_string_unreal(buf)); + } else if (client->ip) { + if (*client->name) + snprintf(buf, sizeof(buf), "%s@%s", client->name, client->ip); + else + snprintf(buf, sizeof(buf), "[%s]", client->ip); + json_object_set_new(child, "details", json_string_unreal(buf)); + } else { + json_object_set_new(child, "details", json_string_unreal(client->name)); + } + + if (detail < 2) + { + RunHook(HOOKTYPE_JSON_EXPAND_CLIENT, client, detail, child); + return; + } + + if (client->local && client->local->listener) + json_object_set_new(child, "server_port", json_integer(client->local->listener->port)); + if (client->local && client->local->port) + json_object_set_new(child, "client_port", json_integer(client->local->port)); + if ((ts = get_creationtime(client))) + json_object_set_new(child, "connected_since", json_timestamp(ts)); + if (client->local && client->local->idle_since) + json_object_set_new(child, "idle_since", json_timestamp(client->local->idle_since)); + + if (client->user) + { + char buf[512]; + const char *str; + /* client.user */ + user = json_object(); + json_object_set_new(child, "user", user); + + json_object_set_new(user, "username", json_string_unreal(client->user->username)); + if (!BadPtr(client->info)) + json_object_set_new(user, "realname", json_string_unreal(client->info)); + if (has_user_mode(client, 'x') && client->user->virthost && strcmp(client->user->virthost, client->user->realhost)) + json_object_set_new(user, "vhost", json_string_unreal(client->user->virthost)); + if (*client->user->cloakedhost) + json_object_set_new(user, "cloakedhost", json_string_unreal(client->user->cloakedhost)); + if (client->uplink) + json_object_set_new(user, "servername", json_string_unreal(client->uplink->name)); + if (IsLoggedIn(client)) + json_object_set_new(user, "account", json_string_unreal(client->user->account)); + json_object_set_new(user, "reputation", json_integer(GetReputation(client))); + json_expand_client_security_groups(user, client); + + /* user modes and snomasks */ + get_usermode_string_r(client, buf, sizeof(buf)); + json_object_set_new(user, "modes", json_string_unreal(buf+1)); + if (client->user->snomask) + json_object_set_new(user, "snomasks", json_string_unreal(client->user->snomask)); + + /* if oper then we can possibly expand a bit more */ + str = get_operlogin(client); + if (str) + json_object_set_new(user, "operlogin", json_string_unreal(str)); + str = get_operclass(client); + if (str) + json_object_set_new(user, "operclass", json_string_unreal(str)); + /* For detail>2 we will include the channels. + * Even if the user is on 0 channels we include "channels":[] + * so it is clear that the user is on 0 channels and it is + * not because of low detail level that channels are skipped. + */ + if (detail > 2) + { + Membership *m; + int cnt = 0; + int len = 0; + json_t *channels = json_array(); + json_object_set_new(user, "channels", channels); + + if (detail == 3) + { + /* Short format, mainly for JSON logging */ + for (m = client->user->channel; m; m = m->next) + { + len += json_dump_string_length(m->channel->name); + if (len > 384) + { + /* Truncated */ + json_array_append_new(channels, json_string_unreal("...")); + break; + } + json_array_append_new(channels, json_string_unreal(m->channel->name)); + } + } else { + /* Long format for JSON-RPC */ + for (m = client->user->channel; m; m = m->next) + { + json_t *e = json_object(); + json_object_set_new(e, "name", json_string_unreal(m->channel->name)); + if (*m->member_modes) + json_object_set_new(e, "level", json_string_unreal(m->member_modes)); + json_array_append_new(channels, e); + } + } + } + RunHook(HOOKTYPE_JSON_EXPAND_CLIENT_USER, client, detail, child, user); + } else + if (IsMe(client)) + { + json_t *server = json_object(); + json_t *features; + + /* client.server */ + json_object_set_new(child, "server", server); + + if (!BadPtr(client->info)) + json_object_set_new(server, "info", json_string_unreal(client->info)); + json_object_set_new(server, "num_users", json_integer(client->server->users)); + json_object_set_new(server, "boot_time", json_timestamp(client->server->boottime)); + + /* client.server.features */ + features = json_object(); + json_object_set_new(server, "features", features); + if (!BadPtr(client->server->features.software)) + { + char buf[256]; + snprintf(buf, sizeof(buf), "UnrealIRCd-%s", buildid); + json_object_set_new(features, "software", json_string_unreal(buf)); + } + json_object_set_new(features, "protocol", json_integer(UnrealProtocol)); + if (!BadPtr(client->server->features.usermodes)) + json_object_set_new(features, "usermodes", json_string_unreal(umodestring)); + + /* client.server.features.chanmodes (array) */ + { + int i; + char buf[512]; + json_t *chanmodes = json_array(); + json_object_set_new(features, "chanmodes", chanmodes); + /* first one is special - wait.. is this still the case? lol. */ + snprintf(buf, sizeof(buf), "%s%s", CHPAR1, EXPAR1); + json_array_append_new(chanmodes, json_string_unreal(buf)); + for (i=1; i < 4; i++) + json_array_append_new(chanmodes, json_string_unreal(extchmstr[i])); + } + if (!BadPtr(client->server->features.nickchars)) + json_object_set_new(features, "nick_character_sets", json_string_unreal(charsys_get_current_languages())); + RunHook(HOOKTYPE_JSON_EXPAND_CLIENT_SERVER, client, detail, child, server); + } else + if (IsServer(client) && client->server) + { + /* client.server */ + + /* Whenever a server is expanded, which is rare, + * we should probably expand as much as info as possible: + */ + json_t *server = json_object(); + json_t *features; + + /* client.server */ + json_object_set_new(child, "server", server); + if (!BadPtr(client->info)) + json_object_set_new(server, "info", json_string_unreal(client->info)); + if (client->uplink) + json_object_set_new(server, "uplink", json_string_unreal(client->uplink->name)); + json_object_set_new(server, "num_users", json_integer(client->server->users)); + json_object_set_new(server, "boot_time", json_timestamp(client->server->boottime)); + json_object_set_new(server, "synced", json_boolean(client->server->flags.synced)); + json_object_set_new(server, "ulined", json_boolean(IsULine(client))); + + /* client.server.features */ + features = json_object(); + json_object_set_new(server, "features", features); + if (!BadPtr(client->server->features.software)) + json_object_set_new(features, "software", json_string_unreal(client->server->features.software)); + json_object_set_new(features, "protocol", json_integer(client->server->features.protocol)); + if (!BadPtr(client->server->features.usermodes)) + json_object_set_new(features, "usermodes", json_string_unreal(client->server->features.usermodes)); + if (!BadPtr(client->server->features.chanmodes[0])) + { + /* client.server.features.chanmodes (array) */ + int i; + json_t *chanmodes = json_array(); + json_object_set_new(features, "chanmodes", chanmodes); + for (i=0; i < 4; i++) + json_array_append_new(chanmodes, json_string_unreal(client->server->features.chanmodes[i])); + } + if (!BadPtr(client->server->features.nickchars)) + json_object_set_new(features, "nick_character_sets", json_string_unreal(client->server->features.nickchars)); + RunHook(HOOKTYPE_JSON_EXPAND_CLIENT_SERVER, client, detail, child, server); + } + RunHook(HOOKTYPE_JSON_EXPAND_CLIENT, client, detail, child); +} + +void json_expand_channel_ban(json_t *child, const char *banlist_name, Ban *banlist) +{ + Ban *ban; + json_t *list, *e; + + list = json_array(); + json_object_set_new(child, banlist_name, list); + for (ban = banlist; ban; ban = ban->next) + { + e = json_object(); + json_array_append_new(list, e); + json_object_set_new(e, "name", json_string_unreal(ban->banstr)); + json_object_set_new(e, "set_by", json_string_unreal(ban->who)); + json_object_set_new(e, "set_at", json_timestamp(ban->when)); + } +} + + +/* detail=1 adds bans, ban_exemptions and invite_exceptions + * detail=2 adds members + * detail=3+ makes the members more detailed + */ +void json_expand_channel(json_t *j, const char *key, Channel *channel, int detail) +{ + char mode1[512], mode2[512], modes[512]; + json_t *child; + + if (key) + { + child = json_object(); + json_object_set_new(j, key, child); + } else { + child = j; + } + + json_object_set_new(child, "name", json_string_unreal(channel->name)); + if (detail == 0) + return; + + json_object_set_new(child, "creation_time", json_timestamp(channel->creationtime)); + json_object_set_new(child, "num_users", json_integer(channel->users)); + if (channel->topic) + { + json_object_set_new(child, "topic", json_string_unreal(channel->topic)); + json_object_set_new(child, "topic_set_by", json_string_unreal(channel->topic_nick)); + json_object_set_new(child, "topic_set_at", json_timestamp(channel->topic_time)); + } + + /* Add "mode" too */ + channel_modes(NULL, mode1, mode2, sizeof(mode1), sizeof(mode2), channel, 0); + if (*mode2) + { + snprintf(modes, sizeof(modes), "%s %s", mode1+1, mode2); + json_object_set_new(child, "modes", json_string_unreal(modes)); + } else { + json_object_set_new(child, "modes", json_string_unreal(mode1+1)); + } + + if (detail > 1) + { + json_expand_channel_ban(child, "bans", channel->banlist); + json_expand_channel_ban(child, "ban_exemptions", channel->exlist); + json_expand_channel_ban(child, "invite_exceptions", channel->invexlist); + } + + if (detail >= 3) + { + Member *u; + json_t *list = json_array(); + json_object_set_new(child, "members", list); + + for (u = channel->members; u; u = u->next) + { + json_t *e = json_object(); + if (*u->member_modes) + json_object_set_new(e, "level", json_string_unreal(u->member_modes)); + json_expand_client(e, NULL, u->client, detail-3); + json_array_append_new(list, e); + } + } + + // Possibly later: If detail is set to 1 then expand more... + RunHook(HOOKTYPE_JSON_EXPAND_CHANNEL, channel, detail, child); +} + +void json_expand_tkl(json_t *root, const char *key, TKL *tkl, int detail) +{ + char buf[BUFSIZE]; + json_t *j; + + if (key) + { + j = json_object(); + json_object_set_new(root, key, j); + } else { + j = root; + } + + json_object_set_new(j, "type", json_string_unreal(tkl_type_config_string(tkl))); // Eg 'kline' + json_object_set_new(j, "type_string", json_string_unreal(tkl_type_string(tkl))); // Eg 'Soft K-Line' + json_object_set_new(j, "set_by", json_string_unreal(tkl->set_by)); + json_object_set_new(j, "set_at", json_timestamp(tkl->set_at)); + json_object_set_new(j, "expire_at", json_timestamp(tkl->expire_at)); + *buf = '\0'; + short_date(tkl->set_at, buf); + strlcat(buf, " GMT", sizeof(buf)); + json_object_set_new(j, "set_at_string", json_string_unreal(buf)); + if (tkl->expire_at <= 0) + { + json_object_set_new(j, "expire_at_string", json_string_unreal("Never")); + json_object_set_new(j, "duration_string", json_string_unreal("permanent")); + } else { + *buf = '\0'; + short_date(tkl->expire_at, buf); + strlcat(buf, " GMT", sizeof(buf)); + json_object_set_new(j, "expire_at_string", json_string_unreal(buf)); + json_object_set_new(j, "duration_string", json_string_unreal(pretty_time_val_r(buf, sizeof(buf), tkl->expire_at - tkl->set_at))); + } + json_object_set_new(j, "set_at_delta", json_integer(TStime() - tkl->set_at)); + if (tkl->flags & TKL_FLAG_CONFIG) + json_object_set_new(j, "set_in_config", json_boolean(1)); + if (TKLIsServerBan(tkl)) + { + json_object_set_new(j, "name", json_string_unreal(tkl_uhost(tkl, buf, sizeof(buf), 0))); + json_object_set_new(j, "reason", json_string_unreal(tkl->ptr.serverban->reason)); + } else + if (TKLIsNameBan(tkl)) + { + json_object_set_new(j, "name", json_string_unreal(tkl->ptr.nameban->name)); + json_object_set_new(j, "reason", json_string_unreal(tkl->ptr.nameban->reason)); + } else + if (TKLIsBanException(tkl)) + { + json_object_set_new(j, "name", json_string_unreal(tkl_uhost(tkl, buf, sizeof(buf), 0))); + json_object_set_new(j, "reason", json_string_unreal(tkl->ptr.banexception->reason)); + json_object_set_new(j, "exception_types", json_string_unreal(tkl->ptr.banexception->bantypes)); + } else + if (TKLIsSpamfilter(tkl)) + { + json_object_set_new(j, "name", json_string_unreal(tkl->ptr.spamfilter->match->str)); + json_object_set_new(j, "match_type", json_string_unreal(unreal_match_method_valtostr(tkl->ptr.spamfilter->match->type))); + json_object_set_new(j, "ban_action", json_string_unreal(banact_valtostring(tkl->ptr.spamfilter->action))); + json_object_set_new(j, "ban_duration", json_integer(tkl->ptr.spamfilter->tkl_duration)); + json_object_set_new(j, "ban_duration_string", json_string_unreal(pretty_time_val_r(buf, sizeof(buf), tkl->ptr.spamfilter->tkl_duration))); + json_object_set_new(j, "spamfilter_targets", json_string_unreal(spamfilter_target_inttostring(tkl->ptr.spamfilter->target))); + json_object_set_new(j, "reason", json_string_unreal(unreal_decodespace(tkl->ptr.spamfilter->tkl_reason))); + } +} diff --git a/src/list.c b/src/list.c index 9435e75..68251c6 100644 --- a/src/list.c +++ b/src/list.c @@ -51,6 +51,7 @@ MODVAR struct list_head server_list; /**< Locally connected servers */ MODVAR struct list_head oper_list; /**< Locally connected IRC Operators */ MODVAR struct list_head global_server_list; /**< All servers (local and remote) */ MODVAR struct list_head dead_list; /**< All dead clients (local and remote) that will soon be freed in the main loop */ +MODVAR struct list_head rpc_remote_list; /**< All remote RPC clients (very specific use-case) */ static mp_pool_t *client_pool = NULL; static mp_pool_t *local_client_pool = NULL; @@ -75,6 +76,7 @@ void initlists(void) INIT_LIST_HEAD(&control_list); INIT_LIST_HEAD(&global_server_list); INIT_LIST_HEAD(&dead_list); + INIT_LIST_HEAD(&rpc_remote_list); client_pool = mp_pool_new(sizeof(Client), 512 * 1024); local_client_pool = mp_pool_new(sizeof(LocalClient), 512 * 1024); @@ -145,6 +147,19 @@ Client *make_client(Client *from, Client *servr) return client; } +/** Free the client->rpc struct. + * NOTE: if you want to fully free the entire client, call free_client() + */ +void free_client_rpc(Client *client) +{ + safe_free(client->rpc->rpc_user); + safe_free(client->rpc->issuer); + if (client->rpc->rehash_request) + json_decref(client->rpc->rehash_request); + free_log_sources(client->rpc->log_sources); + safe_free(client->rpc); +} + void free_client(Client *client) { if (!list_empty(&client->client_node)) @@ -160,6 +175,19 @@ void free_client(Client *client) RunHook(HOOKTYPE_FREE_CLIENT, client); if (client->local) { + if (client->local->listener) + { + if (client->local->listener && !IsOutgoing(client)) + { + ConfigItem_listen *listener = client->local->listener; + listener->clients--; + if (listener->flag.temporary && (listener->clients == 0)) + { + /* Call listen cleanup */ + listen_cleanup(); + } + } + } safe_free(client->local->passwd); safe_free(client->local->error_str); if (client->local->hostp) @@ -176,7 +204,10 @@ void free_client(Client *client) del_from_id_hash_table(client->id, client); } } - + + if (client->rpc) + free_client_rpc(client); + safe_free(client->ip); mp_pool_release(client); @@ -207,8 +238,12 @@ User *make_user(Client *client) } else { *user->realhost = '\0'; } - user->virthost = NULL; - client->user = user; + client->user = user; + /* These may change later (eg when using hostname instead of IP), + * but we now set it early. + */ + make_cloakedhost(client, client->user->realhost, client->user->cloakedhost, sizeof(client->user->cloakedhost)); + safe_strdup(client->user->virthost, client->user->cloakedhost); } return user; } @@ -309,7 +344,7 @@ void remove_client_from_list(Client *client) if (IsUser(client)) /* Only persons can have been added before */ { - add_history(client, 0); + add_history(client, 0, WHOWAS_EVENT_QUIT); off_history(client); /* Remove all pointers to client */ } @@ -590,6 +625,12 @@ NameValuePrioList *find_nvplist(NameValuePrioList *list, const char *name) return NULL; } +const char *get_nvplist(NameValuePrioList *list, const char *name) +{ + NameValuePrioList *e = find_nvplist(list, name); + return e ? e->value : NULL; +} + void add_fmt_nvplist(NameValuePrioList **lst, int priority, const char *name, FORMAT_STRING(const char *format), ...) { char value[512]; diff --git a/src/log.c b/src/log.c index a2748bf..e27892e 100644 --- a/src/log.c +++ b/src/log.c @@ -30,6 +30,8 @@ // TODO: Make configurable at compile time (runtime won't do, as we haven't read the config file) #define show_event_console 0 +#define MAXLOGLENGTH 16384 /**< Maximum length of a log entry (which may be multiple lines) */ + /* Variables */ Log *logs[NUM_LOG_DESTINATIONS] = { NULL, NULL, NULL, NULL, NULL }; Log *temp_logs[NUM_LOG_DESTINATIONS] = { NULL, NULL, NULL, NULL, NULL }; @@ -43,59 +45,6 @@ int log_sources_match(LogSource *logsource, LogLevel loglevel, const char *subsy void do_unreal_log_internal(LogLevel loglevel, const char *subsystem, const char *event_id, Client *client, int expand_msg, const char *msg, va_list vl); void log_blocks_switchover(void); -/** Calculate expansion of a JSON string thanks to double escaping. - * orig => JSON => IRC - * " => \" => \\" - * \ => \\ => \\\\ - */ -int json_dump_string_length(const char *s) -{ - int len = 0; - for (; *s; s++) - { - if (*s == '\\') - len += 4; - else if (*s == '"') - len += 3; - else - len++; - } - return len; -} - -/** Convert a regular string value to a JSON string. - * In UnrealIRCd, this must be used instead of json_string() - * as we may use non-UTF8 sequences. Also, this takes care - * of using json_null() if the string was NULL, which is - * usually what we want as well. - * @param s Input string - * @returns a json string value or json null value. - */ -json_t *json_string_unreal(const char *s) -{ - char buf1[512], buf2[512]; - char *verified_s; - const char *stripped; - - if (s == NULL) - return json_null(); - - stripped = StripControlCodesEx(s, buf1, sizeof(buf1), UNRL_STRIP_LOW_ASCII|UNRL_STRIP_KEEP_LF); - verified_s = unrl_utf8_make_valid(buf1, buf2, sizeof(buf2), 0); - - return json_string(verified_s); -} - -#define json_string __BAD___DO__NOT__USE__JSON__STRING__PLZ - -json_t *json_timestamp(time_t v) -{ - const char *ts = timestamp_iso8601(v); - if (ts) - return json_string_unreal(ts); - return json_null(); -} - LogType log_type_stringtoval(const char *str) { if (!strcmp(str, "json")) @@ -118,6 +67,18 @@ const char *log_type_valtostring(LogType v) } } +/** Checks if 'v' is a valid loglevel */ +int valid_loglevel(int v) +{ + if ((v == ULOG_DEBUG) || (v == ULOG_INFO) || + (v == ULOG_WARNING) || (v == ULOG_ERROR) || + (v == ULOG_FATAL)) + { + return 1; + } + return 0; +} + /***** CONFIGURATION ******/ LogSource *add_log_source(const char *str) @@ -511,273 +472,6 @@ int config_run_log(ConfigFile *conf, ConfigEntry *block) return 0; } - - - -/***** RUNTIME *****/ - -void json_expand_client_security_groups(json_t *parent, Client *client) -{ - SecurityGroup *s; - json_t *child = json_array(); - json_object_set_new(parent, "security-groups", child); - - /* We put known-users or unknown-users at the beginning. - * The latter is special and doesn't actually exist - * in the linked list, hence the special code here, - * and again later in the for loop to skip it. - */ - if (user_allowed_by_security_group_name(client, "known-users")) - json_array_append_new(child, json_string_unreal("known-users")); - else - json_array_append_new(child, json_string_unreal("unknown-users")); - - for (s = securitygroups; s; s = s->next) - if (strcmp(s->name, "known-users") && user_allowed_by_security_group(client, s)) - json_array_append_new(child, json_string_unreal(s->name)); -} - -void json_expand_client(json_t *j, const char *key, Client *client, int detail) -{ - char buf[BUFSIZE+1]; - json_t *child = json_object(); - json_t *user = NULL; - json_object_set_new(j, key, child); - - /* First the information that is available for ALL client types: */ - - json_object_set_new(child, "name", json_string_unreal(client->name)); - json_object_set_new(child, "id", json_string_unreal(client->id)); - - /* hostname is available for all, it just depends a bit on whether it is DNS or IP */ - if (client->user && *client->user->realhost) - json_object_set_new(child, "hostname", json_string_unreal(client->user->realhost)); - else if (client->local && *client->local->sockhost) - json_object_set_new(child, "hostname", json_string_unreal(client->local->sockhost)); - else - json_object_set_new(child, "hostname", json_string_unreal(GetIP(client))); - - /* same for ip, is there for all (well, some services pseudo-users may not have one) */ - json_object_set_new(child, "ip", json_string_unreal(client->ip)); - if (client->local && client->local->listener) - json_object_set_new(child, "server_port", json_integer(client->local->listener->port)); - if (client->local && client->local->port) - json_object_set_new(child, "client_port", json_integer(client->local->port)); - - /* client.details is always available: it is nick!user@host, nick@host, server@host - * server@ip, or just server. - */ - if (client->user) - { - snprintf(buf, sizeof(buf), "%s!%s@%s", client->name, client->user->username, client->user->realhost); - json_object_set_new(child, "details", json_string_unreal(buf)); - } else if (client->ip) { - if (*client->name) - snprintf(buf, sizeof(buf), "%s@%s", client->name, client->ip); - else - snprintf(buf, sizeof(buf), "[%s]", client->ip); - json_object_set_new(child, "details", json_string_unreal(buf)); - } else { - json_object_set_new(child, "details", json_string_unreal(client->name)); - } - - if (client->local && client->local->creationtime) - json_object_set_new(child, "connected_since", json_timestamp(client->local->creationtime)); - - if (client->local && client->local->idle_since) - json_object_set_new(child, "idle_since", json_timestamp(client->local->idle_since)); - - if (client->user) - { - char buf[512]; - const char *str; - /* client.user */ - user = json_object(); - json_object_set_new(child, "user", user); - - json_object_set_new(user, "username", json_string_unreal(client->user->username)); - if (!BadPtr(client->info)) - json_object_set_new(user, "realname", json_string_unreal(client->info)); - if (has_user_mode(client, 'x') && client->user->virthost && strcmp(client->user->virthost, client->user->realhost)) - json_object_set_new(user, "vhost", json_string_unreal(client->user->virthost)); - if (*client->user->cloakedhost) - json_object_set_new(user, "cloakedhost", json_string_unreal(client->user->cloakedhost)); - if (client->uplink) - json_object_set_new(user, "servername", json_string_unreal(client->uplink->name)); - if (IsLoggedIn(client)) - json_object_set_new(user, "account", json_string_unreal(client->user->account)); - json_object_set_new(user, "reputation", json_integer(GetReputation(client))); - json_expand_client_security_groups(user, client); - - /* user modes and snomasks */ - get_usermode_string_r(client, buf, sizeof(buf)); - json_object_set_new(user, "modes", json_string_unreal(buf+1)); - if (client->user->snomask) - json_object_set_new(user, "snomasks", json_string_unreal(client->user->snomask)); - - /* if oper then we can possibly expand a bit more */ - str = get_operlogin(client); - if (str) - json_object_set_new(user, "operlogin", json_string_unreal(str)); - str = get_operclass(client); - if (str) - json_object_set_new(user, "operclass", json_string_unreal(str)); - if (client->user->channel) - { - Membership *m; - int cnt = 0; - int len = 0; - json_t *channels = json_array(); - json_object_set_new(user, "channels", channels); - for (m = client->user->channel; m; m = m->next) - { - len += json_dump_string_length(m->channel->name); - if (len > 384) - { - /* Truncated */ - json_array_append_new(channels, json_string_unreal("...")); - break; - } - json_array_append_new(channels, json_string_unreal(m->channel->name)); - } - } - RunHook(HOOKTYPE_JSON_EXPAND_CLIENT_USER, client, detail, child, user); - } else - if (IsMe(client)) - { - json_t *server = json_object(); - json_t *features; - - /* client.server */ - json_object_set_new(child, "server", server); - - if (!BadPtr(client->info)) - json_object_set_new(server, "info", json_string_unreal(client->info)); - json_object_set_new(server, "num_users", json_integer(client->server->users)); - json_object_set_new(server, "boot_time", json_timestamp(client->server->boottime)); - } else - if (IsServer(client) && client->server) - { - /* client.server */ - - /* Whenever a server is expanded, which is rare, - * we should probably expand as much as info as possible: - */ - json_t *server = json_object(); - json_t *features; - - /* client.server */ - json_object_set_new(child, "server", server); - if (!BadPtr(client->info)) - json_object_set_new(server, "info", json_string_unreal(client->info)); - if (client->uplink) - json_object_set_new(server, "uplink", json_string_unreal(client->uplink->name)); - json_object_set_new(server, "num_users", json_integer(client->server->users)); - json_object_set_new(server, "boot_time", json_timestamp(client->server->boottime)); - json_object_set_new(server, "synced", json_boolean(client->server->flags.synced)); - - /* client.server.features */ - features = json_object(); - json_object_set_new(server, "features", features); - if (!BadPtr(client->server->features.software)) - json_object_set_new(features, "software", json_string_unreal(client->server->features.software)); - json_object_set_new(features, "protocol", json_integer(client->server->features.protocol)); - if (!BadPtr(client->server->features.usermodes)) - json_object_set_new(features, "usermodes", json_string_unreal(client->server->features.usermodes)); - if (!BadPtr(client->server->features.chanmodes[0])) - { - /* client.server.features.chanmodes (array) */ - int i; - json_t *chanmodes = json_array(); - json_object_set_new(features, "chanmodes", chanmodes); - for (i=0; i < 4; i++) - json_array_append_new(chanmodes, json_string_unreal(client->server->features.chanmodes[i])); - } - if (!BadPtr(client->server->features.nickchars)) - json_object_set_new(features, "nick_character_sets", json_string_unreal(client->server->features.nickchars)); - RunHook(HOOKTYPE_JSON_EXPAND_CLIENT_SERVER, client, detail, child, server); - } - RunHook(HOOKTYPE_JSON_EXPAND_CLIENT, client, detail, child); -} - -void json_expand_channel(json_t *j, const char *key, Channel *channel, int detail) -{ - char mode1[512], mode2[512], modes[512]; - - json_t *child = json_object(); - json_object_set_new(j, key, child); - json_object_set_new(child, "name", json_string_unreal(channel->name)); - json_object_set_new(child, "creation_time", json_timestamp(channel->creationtime)); - json_object_set_new(child, "num_users", json_integer(channel->users)); - if (channel->topic) - { - json_object_set_new(child, "topic", json_string_unreal(channel->topic)); - json_object_set_new(child, "topic_set_by", json_string_unreal(channel->topic_nick)); - json_object_set_new(child, "topic_set_at", json_timestamp(channel->topic_time)); - } - - /* Add "mode" too */ - channel_modes(NULL, mode1, mode2, sizeof(mode1), sizeof(mode2), channel, 0); - if (*mode2) - { - snprintf(modes, sizeof(modes), "%s %s", mode1+1, mode2); - json_object_set_new(child, "modes", json_string_unreal(modes)); - } else { - json_object_set_new(child, "modes", json_string_unreal(mode1+1)); - } - - // Possibly later: If detail is set to 1 then expand more... - RunHook(HOOKTYPE_JSON_EXPAND_CHANNEL, channel, detail, child); -} - -const char *timestamp_iso8601_now(void) -{ - struct timeval t; - struct tm *tm; - time_t sec; - static char buf[64]; - - gettimeofday(&t, NULL); - sec = t.tv_sec; - tm = gmtime(&sec); - - snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", - tm->tm_year + 1900, - tm->tm_mon + 1, - tm->tm_mday, - tm->tm_hour, - tm->tm_min, - tm->tm_sec, - (int)(t.tv_usec / 1000)); - - return buf; -} - -const char *timestamp_iso8601(time_t v) -{ - struct tm *tm; - static char buf[64]; - - if (v == 0) - return NULL; - - tm = gmtime(&v); - - if (tm == NULL) - return NULL; - - snprintf(buf, sizeof(buf), "%04d-%02d-%02dT%02d:%02d:%02d.%03dZ", - tm->tm_year + 1900, - tm->tm_mon + 1, - tm->tm_mday, - tm->tm_hour, - tm->tm_min, - tm->tm_sec, - 0); - - return buf; -} - LogData *log_data_string(const char *key, const char *str) { LogData *d = safe_alloc(sizeof(LogData)); @@ -963,51 +657,7 @@ LogData *log_data_tkl(const char *key, TKL *tkl) safe_strdup(d->key, key); d->value.object = j = json_object(); - json_object_set_new(j, "type", json_string_unreal(tkl_type_config_string(tkl))); // Eg 'kline' - json_object_set_new(j, "type_string", json_string_unreal(tkl_type_string(tkl))); // Eg 'Soft K-Line' - json_object_set_new(j, "set_by", json_string_unreal(tkl->set_by)); - json_object_set_new(j, "set_at", json_timestamp(tkl->set_at)); - json_object_set_new(j, "expire_at", json_timestamp(tkl->expire_at)); - *buf = '\0'; - short_date(tkl->set_at, buf); - strlcat(buf, " GMT", sizeof(buf)); - json_object_set_new(j, "set_at_string", json_string_unreal(buf)); - if (tkl->expire_at <= 0) - { - json_object_set_new(j, "expire_at_string", json_string_unreal("Never")); - json_object_set_new(j, "duration_string", json_string_unreal("permanent")); - } else { - *buf = '\0'; - short_date(tkl->expire_at, buf); - strlcat(buf, " GMT", sizeof(buf)); - json_object_set_new(j, "expire_at_string", json_string_unreal(buf)); - json_object_set_new(j, "duration_string", json_string_unreal(pretty_time_val_r(buf, sizeof(buf), tkl->expire_at - tkl->set_at))); - } - json_object_set_new(j, "set_at_delta", json_integer(TStime() - tkl->set_at)); - if (TKLIsServerBan(tkl)) - { - json_object_set_new(j, "name", json_string_unreal(tkl_uhost(tkl, buf, sizeof(buf), 0))); - json_object_set_new(j, "reason", json_string_unreal(tkl->ptr.serverban->reason)); - } else - if (TKLIsNameBan(tkl)) - { - json_object_set_new(j, "name", json_string_unreal(tkl->ptr.nameban->name)); - json_object_set_new(j, "reason", json_string_unreal(tkl->ptr.nameban->reason)); - } else - if (TKLIsBanException(tkl)) - { - json_object_set_new(j, "name", json_string_unreal(tkl_uhost(tkl, buf, sizeof(buf), 0))); - json_object_set_new(j, "reason", json_string_unreal(tkl->ptr.banexception->reason)); - json_object_set_new(j, "exception_types", json_string_unreal(tkl->ptr.banexception->bantypes)); - } else - if (TKLIsSpamfilter(tkl)) - { - json_object_set_new(j, "name", json_string_unreal(tkl->ptr.spamfilter->match->str)); - json_object_set_new(j, "match_type", json_string_unreal(unreal_match_method_valtostr(tkl->ptr.spamfilter->match->type))); - json_object_set_new(j, "ban_action", json_string_unreal(banact_valtostring(tkl->ptr.spamfilter->action))); - json_object_set_new(j, "spamfilter_targets", json_string_unreal(spamfilter_target_inttostring(tkl->ptr.spamfilter->target))); - json_object_set_new(j, "reason", json_string_unreal(unreal_decodespace(tkl->ptr.spamfilter->tkl_reason))); - } + json_expand_tkl(j, NULL, tkl, 1); return d; } @@ -1111,22 +761,6 @@ int valid_subsystem(const char *s) return 1; } -const char *json_get_value(json_t *t) -{ - static char buf[32]; - - if (json_is_string(t)) - return json_string_value(t); - - if (json_is_integer(t)) - { - snprintf(buf, sizeof(buf), "%lld", (long long)json_integer_value(t)); - return buf; - } - - return NULL; -} - // TODO: if in the function below we keep adding auto expanshion shit, // like we currently have $client automatically expanding to $client.name // and $socket_error to $socket_error.error_string, @@ -1246,9 +880,9 @@ literal: } /** Do the actual writing to log files */ -void do_unreal_log_disk(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, const char *json_serialized, Client *from_server) +void do_unreal_log_disk(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, json_t *json, const char *json_serialized, Client *from_server) { - static int last_log_file_warning = 0; + static time_t last_log_file_warning = 0; Log *l; char timebuf[128]; struct stat fstats; @@ -1259,7 +893,7 @@ void do_unreal_log_disk(LogLevel loglevel, const char *subsystem, const char *ev snprintf(timebuf, sizeof(timebuf), "[%s] ", myctime(TStime())); - RunHook(HOOKTYPE_LOG, loglevel, subsystem, event_id, msg, json_serialized, timebuf); + RunHook(HOOKTYPE_LOG, loglevel, subsystem, event_id, msg, json, json_serialized, timebuf); if (!loop.forked && (loglevel > ULOG_DEBUG)) { @@ -1366,17 +1000,27 @@ void do_unreal_log_disk(LogLevel loglevel, const char *subsystem, const char *ev l->logfd = fd_fileopen(l->file, O_CREAT|O_APPEND|O_WRONLY); if (l->logfd == -1) { - if (!loop.booted) + if (errno == ENOENT) { - config_status("WARNING: Unable to write to '%s': %s", l->file, strerror(errno)); - } else { - if (last_log_file_warning + 300 < TStime()) - { - config_status("WARNING: Unable to write to '%s': %s. This warning will not re-appear for at least 5 minutes.", l->file, strerror(errno)); - last_log_file_warning = TStime(); - } + /* Create directory structure and retry */ + unreal_create_directory_structure_for_file(l->file, 0777); + l->logfd = fd_fileopen(l->file, O_CREAT|O_APPEND|O_WRONLY); + } + if (l->logfd == -1) + { + /* Still failed! */ + if (!loop.booted) + { + config_status("WARNING: Unable to write to '%s': %s", l->file, strerror(errno)); + } else { + if (last_log_file_warning + 300 < TStime()) + { + config_status("WARNING: Unable to write to '%s': %s. This warning will not re-appear for at least 5 minutes.", l->file, strerror(errno)); + last_log_file_warning = TStime(); + } + } + continue; } - continue; } } @@ -1397,7 +1041,7 @@ void do_unreal_log_disk(LogLevel loglevel, const char *subsystem, const char *ev { for (m = msg; m; m = m->next) { - char text_buf[8192]; + static char text_buf[MAXLOGLENGTH]; snprintf(text_buf, sizeof(text_buf), "%s%s %s.%s%s %s: %s\n", timebuf, from_server->name, subsystem, event_id, m->next?"+":"", log_level_valtostring(loglevel), m->line); @@ -1686,7 +1330,7 @@ void do_unreal_log_remote(LogLevel loglevel, const char *subsystem, const char * } /** Send server notices to control channel */ -void do_unreal_log_control(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, const char *json_serialized, Client *from_server) +void do_unreal_log_control(LogLevel loglevel, const char *subsystem, const char *event_id, MultiLine *msg, json_t *j, const char *json_serialized, Client *from_server) { Client *client; MultiLine *m; @@ -1699,9 +1343,16 @@ void do_unreal_log_control(LogLevel loglevel, const char *subsystem, const char return; list_for_each_entry(client, &control_list, lclient_node) - if (IsMonitorRehash(client)) + if (IsMonitorRehash(client) && IsControl(client)) for (m = msg; m; m = m->next) sendto_one(client, NULL, "REPLY [%s] %s", log_level_valtostring(loglevel), m->line); + + if (json_rehash_log) + { + json_t *log = json_object_get(json_rehash_log, "log"); + if (log) + json_array_append(log, j); // not xxx_new, right? + } } void do_unreal_log_free_args(va_list vl) @@ -1777,11 +1428,14 @@ void do_unreal_log_internal(LogLevel loglevel, const char *subsystem, const char json_t *j = NULL; json_t *j_details = NULL; json_t *t; - char msgbuf[8192]; + char msgbuf[MAXLOGLENGTH]; const char *loglevel_string = log_level_valtostring(loglevel); MultiLine *mmsg; Client *from_server = NULL; + /* Set flag so json_string_unreal() uses more strict filter */ + log_json_filter = 1; + if (loglevel_string == NULL) { do_unreal_log_norecursioncheck(ULOG_ERROR, "log", "BUG_LOG_LOGLEVEL", NULL, @@ -1826,7 +1480,7 @@ void do_unreal_log_internal(LogLevel loglevel, const char *subsystem, const char * details later on. */ if (client) - json_expand_client(j_details, "client", client, 0); + json_expand_client(j_details, "client", client, 3); /* Additional details (if any) */ while ((d = va_arg(vl, LogData *))) { @@ -1842,10 +1496,10 @@ void do_unreal_log_internal(LogLevel loglevel, const char *subsystem, const char json_object_set_new(j_details, d->key, json_null()); break; case LOG_FIELD_CLIENT: - json_expand_client(j_details, d->key, d->value.client, 0); + json_expand_client(j_details, d->key, d->value.client, 3); break; case LOG_FIELD_CHANNEL: - json_expand_channel(j_details, d->key, d->value.channel, 0); + json_expand_channel(j_details, d->key, d->value.channel, 1); break; case LOG_FIELD_OBJECT: json_object_set_new(j_details, d->key, d->value.object); @@ -1884,10 +1538,10 @@ void do_unreal_log_internal(LogLevel loglevel, const char *subsystem, const char /* Now call all the loggers: */ - do_unreal_log_disk(loglevel, subsystem, event_id, mmsg, json_serialized, from_server); + do_unreal_log_disk(loglevel, subsystem, event_id, mmsg, j, json_serialized, from_server); if ((loop.rehashing == 2) || !strcmp(subsystem, "config")) - do_unreal_log_control(loglevel, subsystem, event_id, mmsg, json_serialized, from_server); + do_unreal_log_control(loglevel, subsystem, event_id, mmsg, j, json_serialized, from_server); do_unreal_log_opers(loglevel, subsystem, event_id, mmsg, json_serialized, from_server); @@ -1897,27 +1551,52 @@ void do_unreal_log_internal(LogLevel loglevel, const char *subsystem, const char // NOTE: code duplication further down! + /* This one should only be in do_unreal_log_internal() + * and never in do_unreal_log_internal_from_remote() + */ + if (remote_rehash_client && + ((!strcmp(event_id, "CONFIG_ERROR_GENERIC") || + !strcmp(event_id, "CONFIG_WARNING_GENERIC") || + !strcmp(event_id, "CONFIG_INFO_GENERIC")) + || + (loop.config_status >= CONFIG_STATUS_TEST)) && + strcmp(subsystem, "rawtraffic")) + { + sendto_log(remote_rehash_client, "NOTICE", remote_rehash_client->name, + iConf.server_notice_colors, iConf.server_notice_show_event, + loglevel, subsystem, event_id, mmsg, json_serialized, from_server); + } + /* Free everything */ safe_free(json_serialized); safe_free_multiline(mmsg); json_decref(j_details); json_decref(j); + + /* Turn off flag again */ + log_json_filter = 0; } void do_unreal_log_internal_from_remote(LogLevel loglevel, const char *subsystem, const char *event_id, - MultiLine *msg, const char *json_serialized, Client *from_server) + MultiLine *msg, json_t *json, const char *json_serialized, Client *from_server) { if (unreal_log_recursion_trap) return; unreal_log_recursion_trap = 1; + /* Set flag so json_string_unreal() uses more strict filter */ + log_json_filter = 1; + /* Call the disk loggers */ - do_unreal_log_disk(loglevel, subsystem, event_id, msg, json_serialized, from_server); + do_unreal_log_disk(loglevel, subsystem, event_id, msg, json, json_serialized, from_server); /* And to IRC */ do_unreal_log_opers(loglevel, subsystem, event_id, msg, json_serialized, from_server); do_unreal_log_channels(loglevel, subsystem, event_id, msg, json_serialized, from_server); + /* Turn off flag again */ + log_json_filter = 0; + unreal_log_recursion_trap = 0; } @@ -1943,7 +1622,7 @@ void free_log_block(Log *l) int log_tests(void) { - if (snomask_num_destinations <= 1) + if (snomask_num_destinations == 0) { unreal_log(ULOG_ERROR, "config", "LOG_SNOMASK_BLOCK_MISSING", NULL, "Missing snomask logging configuration:\n" @@ -1951,7 +1630,6 @@ int log_tests(void) "include \"snomasks.default.conf\";"); return 0; } - snomask_num_destinations = 0; return 1; } @@ -2000,6 +1678,7 @@ void postconf_defaults_log_block(void) void log_pre_rehash(void) { *snomasks_in_use_testing = '\0'; + snomask_num_destinations = 0; } /* Called after CONFIG_TEST right before CONFIG_RUN */ diff --git a/src/macosx/UnrealIRCd/Base.lproj/Main.storyboard b/src/macosx/UnrealIRCd/Base.lproj/Main.storyboard index 662640c..413970e 100644 --- a/src/macosx/UnrealIRCd/Base.lproj/Main.storyboard +++ b/src/macosx/UnrealIRCd/Base.lproj/Main.storyboard @@ -134,7 +134,7 @@