From f2d5cea00a1238d5fc69dc49d679190f103961e2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 10 Mar 2016 02:12:59 -0600 Subject: [PATCH 001/252] modules: remove explicit CPRIVMSG/CNOTICE, this has been obsolete for a long time --- doc/technical/ts6-protocol.txt | 2 - modules/Makefile.am | 1 - modules/m_cmessage.c | 186 --------------------------------- 3 files changed, 189 deletions(-) delete mode 100644 modules/m_cmessage.c diff --git a/doc/technical/ts6-protocol.txt b/doc/technical/ts6-protocol.txt index bf52130da..36d63cd3c 100644 --- a/doc/technical/ts6-protocol.txt +++ b/doc/technical/ts6-protocol.txt @@ -1198,8 +1198,6 @@ CAP CHALLENGE CHANTRACE CLOSE -CNOTICE -CPRIVMSG DIE GET HELP diff --git a/modules/Makefile.am b/modules/Makefile.am index 539f94d7d..7193e02bc 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -21,7 +21,6 @@ auto_load_mod_LTLIBRARIES = \ m_challenge.la \ m_chghost.la \ m_close.la \ - m_cmessage.la \ m_connect.la \ m_dline.la \ m_encap.la \ diff --git a/modules/m_cmessage.c b/modules/m_cmessage.c deleted file mode 100644 index f06848676..000000000 --- a/modules/m_cmessage.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * ircd-ratbox: an advanced Internet Relay Chat Daemon(ircd). - * m_cmessage.c: Handles CPRIVMSG/CNOTICE, target change limitation free - * PRIVMSG/NOTICE implementations. - * - * Copyright (C) 2005 Lee Hardy - * Copyright (C) 2005 ircd-ratbox development team - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * 1.Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2.Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3.The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "stdinc.h" -#include "client.h" -#include "channel.h" -#include "numeric.h" -#include "msg.h" -#include "modules.h" -#include "hash.h" -#include "send.h" -#include "s_conf.h" -#include "packet.h" -#include "supported.h" - -static const char cmessage_desc[] = - "Provides the CPRIVMSG and CNOTICE facilities for bypassing anti-spam measures"; - -static void m_cmessage(int, const char *, struct MsgBuf *, struct Client *, struct Client *, int, const char **); -static void m_cprivmsg(struct MsgBuf *, struct Client *, struct Client *, int, const char **); -static void m_cnotice(struct MsgBuf *, struct Client *, struct Client *, int, const char **); - -static int -_modinit(void) -{ - add_isupport("CPRIVMSG", isupport_string, ""); - add_isupport("CNOTICE", isupport_string, ""); - - return 0; -} - -static void -_moddeinit(void) -{ - delete_isupport("CPRIVMSG"); - delete_isupport("CNOTICE"); -} - -struct Message cprivmsg_msgtab = { - "CPRIVMSG", 0, 0, 0, 0, - {mg_ignore, {m_cprivmsg, 4}, mg_ignore, mg_ignore, mg_ignore, {m_cprivmsg, 4}} -}; -struct Message cnotice_msgtab = { - "CNOTICE", 0, 0, 0, 0, - {mg_ignore, {m_cnotice, 4}, mg_ignore, mg_ignore, mg_ignore, {m_cnotice, 4}} -}; - -mapi_clist_av1 cmessage_clist[] = { &cprivmsg_msgtab, &cnotice_msgtab, NULL }; - -DECLARE_MODULE_AV2(cmessage, _modinit, _moddeinit, cmessage_clist, NULL, NULL, NULL, NULL, cmessage_desc); - -#define PRIVMSG 0 -#define NOTICE 1 - -static void -m_cprivmsg(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -{ - m_cmessage(PRIVMSG, "PRIVMSG", msgbuf_p, client_p, source_p, parc, parv); -} - -static void -m_cnotice(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -{ - m_cmessage(NOTICE, "NOTICE", msgbuf_p, client_p, source_p, parc, parv); -} - -static void -m_cmessage(int p_or_n, const char *command, struct MsgBuf *msgbuf_p, - struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -{ - struct Client *target_p; - struct Channel *chptr; - struct membership *msptr; - - if(!IsFloodDone(source_p)) - flood_endgrace(source_p); - - if((target_p = find_named_person(parv[1])) == NULL) - { - if(p_or_n != NOTICE) - sendto_one_numeric(source_p, ERR_NOSUCHNICK, - form_str(ERR_NOSUCHNICK), parv[1]); - return; - } - - if((chptr = find_channel(parv[2])) == NULL) - { - if(p_or_n != NOTICE) - sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, - form_str(ERR_NOSUCHCHANNEL), parv[2]); - return; - } - - if((msptr = find_channel_membership(chptr, source_p)) == NULL) - { - if(p_or_n != NOTICE) - sendto_one_numeric(source_p, ERR_NOTONCHANNEL, - form_str(ERR_NOTONCHANNEL), - chptr->chname); - return; - } - - if(!is_chanop_voiced(msptr)) - { - if(p_or_n != NOTICE) - sendto_one(source_p, form_str(ERR_VOICENEEDED), - me.name, source_p->name, chptr->chname); - return; - } - - if(!IsMember(target_p, chptr)) - { - if(p_or_n != NOTICE) - sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, - form_str(ERR_USERNOTINCHANNEL), - target_p->name, chptr->chname); - return; - } - - if(MyClient(target_p) && (IsSetCallerId(target_p) || (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])) && - !accept_message(source_p, target_p) && !IsOper(source_p)) - { - if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]) - { - if (p_or_n != NOTICE) - sendto_one_numeric(source_p, ERR_NONONREG, - form_str(ERR_NONONREG), - target_p->name); - return; - } - if(p_or_n != NOTICE) - sendto_one_numeric(source_p, ERR_TARGUMODEG, - form_str(ERR_TARGUMODEG), target_p->name); - - if((target_p->localClient->last_caller_id_time + - ConfigFileEntry.caller_id_wait) < rb_current_time()) - { - if(p_or_n != NOTICE) - sendto_one_numeric(source_p, RPL_TARGNOTIFY, - form_str(RPL_TARGNOTIFY), - target_p->name); - - sendto_one(target_p, form_str(RPL_UMODEGMSG), - me.name, target_p->name, source_p->name, - source_p->username, source_p->host); - - target_p->localClient->last_caller_id_time = rb_current_time(); - } - - return; - } - - if(p_or_n != NOTICE) - source_p->localClient->last = rb_current_time(); - - sendto_anywhere(target_p, source_p, command, ":%s", parv[3]); -} From bc8067e571714e44a67df41b239955982542bc44 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 10 Mar 2016 02:15:28 -0600 Subject: [PATCH 002/252] Send cnotice/cprivmsg help to Hades. --- help/opers/cnotice | 5 ----- help/opers/cprivmsg | 5 ----- help/opers/index | 40 ++++++++++++++++++++-------------------- 3 files changed, 20 insertions(+), 30 deletions(-) delete mode 100644 help/opers/cnotice delete mode 100644 help/opers/cprivmsg diff --git a/help/opers/cnotice b/help/opers/cnotice deleted file mode 100644 index 338b643f9..000000000 --- a/help/opers/cnotice +++ /dev/null @@ -1,5 +0,0 @@ -CNOTICE : - -Providing you are opped (+o) or voiced (+v) in , and -is a member of , CNOTICE generates a NOTICE towards -. CNOTICE bypasses any anti-spam measures in place. diff --git a/help/opers/cprivmsg b/help/opers/cprivmsg deleted file mode 100644 index fd9f0c1e0..000000000 --- a/help/opers/cprivmsg +++ /dev/null @@ -1,5 +0,0 @@ -CPRIVMSG : - -Providing you are opped (+o) or voiced (+v) in , and -is a member of , CPRIVMSG generates a PRIVMSG towards -. CPRIVMSG bypasses any anti-spam measures in place. diff --git a/help/opers/index b/help/opers/index index b33fa210d..3dd196646 100644 --- a/help/opers/index +++ b/help/opers/index @@ -2,23 +2,23 @@ Help topics available to opers: ACCEPT ADMIN AWAY CAPAB CHALLENGE CHANTRACE CLOSE CMODE -CNOTICE CONNECT CPRIVMSG CREDITS -DIE DLINE ERROR ETRACE -EXTBAN HELP INDEX INFO -INVITE ISON JOIN KICK -KILL KLINE KNOCK LINKS -LIST LOCOPS LUSERS MAP -MASKTRACE MODLIST MODLOAD MODRELOAD -MODRESTART MODUNLOAD MONITOR MOTD -NAMES NICK NOTICE OPER -OPERSPY OPERWALL PART PASS -PING PONG POST PRIVMSG -PRIVS QUIT REHASH RESTART -RESV SCAN SERVER SET -SJOIN SNOMASK SQUIT STATS -SVINFO TESTGECOS TESTLINE TESTMASK -TIME TOPIC TRACE UHELP -UMODE UNDLINE UNKLINE UNREJECT -UNRESV UNXLINE USER USERHOST -USERS VERSION WALLOPS WHO -WHOIS WHOWAS XLINE +CONNECT CREDITS DIE DLINE +ERROR ETRACE EXTBAN HELP +INDEX INFO INVITE ISON +JOIN KICK KILL KLINE +KNOCK LINKS LIST LOCOPS +LUSERS MAP MASKTRACE MODLIST +MODLOAD MODRELOAD MODRESTART MODUNLOAD +MONITOR MOTD NAMES NICK +NOTICE OPER OPERSPY OPERWALL +PART PASS PING PONG +POST PRIVMSG PRIVS QUIT +REHASH RESTART RESV SCAN +SERVER SET SJOIN SNOMASK +SQUIT STATS SVINFO TESTGECOS +TESTLINE TESTMASK TIME TOPIC +TRACE UHELP UMODE UNDLINE +UNKLINE UNREJECT UNRESV UNXLINE +USER USERHOST USERS VERSION +WALLOPS WHO WHOIS WHOWAS +XLINE From 50f842125a13a08ea2de5cc169cb7adbda03c7be Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 10 Mar 2016 08:06:57 -0600 Subject: [PATCH 003/252] authd: crap, C was taken already, rename reload to H. --- authd/authd.c | 2 +- include/setup.h.in | 5 ++++- ircd/dns.c | 2 +- librb/include/librb_config.h.in | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 298d3c4f7..623368330 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -28,7 +28,7 @@ static void handle_stat(int parc, char *parv[]); rb_helper *authd_helper = NULL; authd_cmd_handler authd_cmd_handlers[256] = { - ['C'] = handle_reload, + ['H'] = handle_reload, ['D'] = resolve_dns, ['S'] = handle_stat, }; diff --git a/include/setup.h.in b/include/setup.h.in index fce3acbbc..a66efc100 100644 --- a/include/setup.h.in +++ b/include/setup.h.in @@ -169,7 +169,7 @@ /* Define to 1 if you have the `socketpair' function. */ #undef HAVE_SOCKETPAIR -/* Define to 1 if you have the header file. */ +/* Define to 1 if stdbool.h conforms to C99. */ #undef HAVE_STDBOOL_H /* Define to 1 if you have the header file. */ @@ -241,6 +241,9 @@ /* This value is set to 1 to indicate that the system argz facility works */ #undef HAVE_WORKING_ARGZ +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + /* Prefix where help files are installed. */ #undef HELP_DIR diff --git a/ircd/dns.c b/ircd/dns.c index 4b067ba68..055c6b339 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -330,7 +330,7 @@ reload_nameservers(void) /* Shit */ return false; } - rb_helper_write(authd_helper, "C D"); + rb_helper_write(authd_helper, "H D"); init_nameserver_cache(); return true; } diff --git a/librb/include/librb_config.h.in b/librb/include/librb_config.h.in index 661256695..95d88994b 100644 --- a/librb/include/librb_config.h.in +++ b/librb/include/librb_config.h.in @@ -264,12 +264,12 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Defined to mark profiling is enabled */ -#undef RB_PROFILE - /* Prefix where librb is installed. */ #undef RB_PREFIX +/* Defined to mark profiling is enabled */ +#undef RB_PROFILE + /* Define to 1 if sockaddr has a 'sa_len' member. */ #undef SOCKADDR_IN_HAS_LEN From 467a0a79a50548c1c893f76af99cf61943c23ac7 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 10 Mar 2016 11:32:46 -0600 Subject: [PATCH 004/252] Stop building this branch plzkthxbai --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4329ca7a9..48c28dc54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,10 @@ matrix: compiler: clang env: COMPILER=clang LIBTOOLIZE=glibtoolize +branches: + only: + - master + osx_image: xcode7.3 cache: From 47ca8753c78d48c3c75364ccde82429e805cbe66 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 10 Mar 2016 11:42:37 -0600 Subject: [PATCH 005/252] What I really meant to say. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 48c28dc54..ad8efb378 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,8 +45,8 @@ matrix: env: COMPILER=clang LIBTOOLIZE=glibtoolize branches: - only: - - master + except: + - authd-framework osx_image: xcode7.3 From 5567a6f9432f6d27ef1d0f949f86c4b53ee35043 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 06:23:23 -0600 Subject: [PATCH 006/252] Regenerate user help index. --- help/users/index | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/help/users/index b/help/users/index index 06de37bd8..13eb3932d 100644 --- a/help/users/index +++ b/help/users/index @@ -3,12 +3,12 @@ Help topics available to users: ACCEPT ADMIN AWAY CHALLENGE CHANTRACE CMODE CNOTICE CPRIVMSG CREDITS ERROR EXTBAN HELP -INDEX INFO INVITE ISON -JOIN KICK KNOCK LINKS -LIST LUSERS MAP MONITOR -MOTD NAMES NICK NOTICE -OPER PART PASS PING -PONG PRIVMSG QUIT STATS -TIME TOPIC TRACE UMODE -USER USERHOST USERS VERSION -WHO WHOIS WHOWAS +INFO INVITE ISON JOIN +KICK KNOCK LINKS LIST +LUSERS MAP MONITOR MOTD +NAMES NICK NOTICE OPER +PART PASS PING PONG +PRIVMSG QUIT STATS TIME +TOPIC TRACE UMODE USER +USERHOST USERS VERSION WHO +WHOIS WHOWAS From 27aca3c38554f05db58859ca9d2236616a515ab6 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 06:26:50 -0600 Subject: [PATCH 007/252] Really fix the help index. --- help/Makefile.am | 2 +- help/users/index | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/help/Makefile.am b/help/Makefile.am index fae3a746b..9d2efdd0f 100644 --- a/help/Makefile.am +++ b/help/Makefile.am @@ -13,7 +13,7 @@ SYMLINKS= topic accept cmode admin names links away whowas \ version kick who invite quit join list nick oper part \ time credits motd userhost users whois ison lusers \ user help pass error challenge knock ping pong \ - cprivmsg cnotice map trace chantrace extban monitor + map trace chantrace extban monitor all: build: diff --git a/help/users/index b/help/users/index index 13eb3932d..80522d6b2 100644 --- a/help/users/index +++ b/help/users/index @@ -1,14 +1,14 @@ Help topics available to users: ACCEPT ADMIN AWAY CHALLENGE -CHANTRACE CMODE CNOTICE CPRIVMSG -CREDITS ERROR EXTBAN HELP -INFO INVITE ISON JOIN -KICK KNOCK LINKS LIST -LUSERS MAP MONITOR MOTD -NAMES NICK NOTICE OPER -PART PASS PING PONG -PRIVMSG QUIT STATS TIME -TOPIC TRACE UMODE USER -USERHOST USERS VERSION WHO -WHOIS WHOWAS +CHANTRACE CMODE CREDITS ERROR +EXTBAN HELP INDEX INFO +INVITE ISON JOIN KICK +KNOCK LINKS LIST LUSERS +MAP MONITOR MOTD NAMES +NICK NOTICE OPER PART +PASS PING PONG PRIVMSG +QUIT STATS TIME TOPIC +TRACE UMODE USER USERHOST +USERS VERSION WHO WHOIS +WHOWAS From 399c633313508214804549201a0ace80a6ffbe2b Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 07:08:27 -0600 Subject: [PATCH 008/252] authd: add improved API for internal usage This is similar to what exists in ircd, but instead of request ID's, we return struct dns_query pointers (that are freed by the DNS callback, so you don't have to worry about their lifecycle management). --- authd/dns.c | 276 ++++++++++++++++++++++++++++++++++++---------------- authd/dns.h | 25 ++++- 2 files changed, 214 insertions(+), 87 deletions(-) diff --git a/authd/dns.c b/authd/dns.c index ddac5be42..43e69f9c2 100644 --- a/authd/dns.c +++ b/authd/dns.c @@ -1,4 +1,4 @@ -/* authd/dns.h - header for authd DNS functions +/* authd/dns.c - authd DNS functions * Copyright (c) 2016 William Pitcock * * Permission to use, copy, modify, and/or distribute this software for any @@ -22,120 +22,228 @@ #include "dns.h" #include "res.h" -static void -submit_dns_answer(void *userdata, struct DNSReply *reply) -{ - struct dns_request *req = userdata; - char response[64] = "*"; - char status = 'E'; +static void handle_lookup_ip_reply(void *data, struct DNSReply *reply); +static void handle_lookup_hostname_reply(void *data, struct DNSReply *reply); - if (reply == NULL) +uint64_t query_count = 0; + +/* A bit different from ircd... you just get a dns_query object. + * + * It gets freed whenever the res code gets back to us. + */ +struct dns_query * +lookup_ip(const char *host, int aftype, DNSCB callback, void *data) +{ + struct dns_query *query = rb_malloc(sizeof(struct dns_query)); + int g_type; + + if(aftype == AF_INET) { - rb_helper_write(authd_helper, "E %s E %c *", req->reqid, req->type); - goto cleanup; + query->type = QUERY_A; + g_type = T_A; + } +#ifdef RB_IPV6 + else if(aftype == AF_INET6) + { + query->type = QUERY_AAAA; + g_type = T_AAAA; + } +#endif + else + { + rb_free(query); + return NULL; } - switch (req->type) + query->id = query_count++; + query->callback = callback; + query->data = data; + + query->query.ptr = query; + query->query.callback = handle_lookup_ip_reply; + + gethost_byname_type(host, &query->query, g_type); + + return query; +} + +/* See lookup_ip's comment */ +struct dns_query * +lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data) +{ + struct dns_query *query = rb_malloc(sizeof(struct dns_query)); + + if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr)) { - case '4': - if (GET_SS_FAMILY(&reply->addr) == AF_INET) - { - status = 'O'; - rb_inet_ntop_sock((struct sockaddr *) &reply->addr, response, sizeof(response)); - } - break; + rb_free(query); + return NULL; + } + + if(aftype == AF_INET) + query->type = QUERY_PTR_A; #ifdef RB_IPV6 - case '6': - if (GET_SS_FAMILY(&reply->addr) == AF_INET6) - { - char tmpres[63]; - rb_inet_ntop_sock((struct sockaddr *) &reply->addr, tmpres, sizeof(tmpres)); - - if (*tmpres == ':') - { - rb_strlcpy(response, "0", sizeof(response)); - rb_strlcat(response, tmpres, sizeof(response)); - } - else - rb_strlcpy(response, tmpres, sizeof(response)); - - status = 'O'; - } - break; + else if(aftype == AF_INET6) + query->type = QUERY_PTR_AAAA; #endif - case 'R': - { - struct sockaddr_in *ip, *ip_fwd; - ip = (struct sockaddr_in *) &req->addr; - ip_fwd = (struct sockaddr_in *) &reply->addr; + else + { + rb_free(query); + return NULL; + } - if(ip->sin_addr.s_addr == ip_fwd->sin_addr.s_addr && strlen(reply->h_name) < 63) - { - rb_strlcpy(response, reply->h_name, sizeof(response)); - status = 'O'; - } - } + query->id = query_count++; + query->callback = callback; + query->data = data; + + query->query.ptr = query; + query->query.callback = handle_lookup_hostname_reply; + + gethost_byaddr(&query->addr, &query->query); + + return query; +} + +/* Callback from gethost_byname_type */ +static void +handle_lookup_ip_reply(void *data, struct DNSReply *reply) +{ + struct dns_query *query = data; + char ip[64] = "*"; + query_type type = QUERY_INVALID; + + if(!query) + /* Shouldn't happen */ + exit(2); + + type = query->type; + + if(!reply) + goto end; + + switch(query->type) + { + case QUERY_A: + if(GET_SS_FAMILY(&reply->addr) == AF_INET) + rb_inet_ntop_sock((struct sockaddr *)&reply->addr, ip, sizeof(ip)); break; #ifdef RB_IPV6 - case 'S': + case QUERY_AAAA: + if(GET_SS_FAMILY(&reply->addr) == AF_INET6) { - struct sockaddr_in6 *ip, *ip_fwd; - ip = (struct sockaddr_in6 *) &req->addr; - ip_fwd = (struct sockaddr_in6 *) &reply->addr; - - if(memcmp(&ip->sin6_addr, &ip_fwd->sin6_addr, sizeof(struct in6_addr)) == 0 && strlen(reply->h_name) < 63) + rb_inet_ntop_sock((struct sockaddr *)&reply->addr, ip, sizeof(ip)); + if(ip[0] == ':') { - rb_strlcpy(response, reply->h_name, sizeof(response)); - status = 'O'; + memmove(&ip[1], ip, strlen(ip)); + ip[0] = '0'; } } break; #endif default: - exit(7); + exit(3); } - rb_helper_write(authd_helper, "E %s %c %c %s", req->reqid, status, req->type, response); -cleanup: - rb_free(req); +end: + if(query->callback) + query->callback(ip, ip[0] != '*', type, query->data); + + rb_free(query); +} + +/* Callback from gethost_byaddr */ +static void +handle_lookup_hostname_reply(void *data, struct DNSReply *reply) +{ + struct dns_query *query = data; + char *hostname = NULL; + query_type type = QUERY_INVALID; + + if(!query) + /* Shouldn't happen */ + exit(4); + + type = query->type; + + if(!reply) + goto end; + + if(query->type == QUERY_PTR_A) + { + struct sockaddr_in *ip, *ip_fwd; + ip = (struct sockaddr_in *) &query->addr; + ip_fwd = (struct sockaddr_in *) &reply->addr; + + if(ip->sin_addr.s_addr == ip_fwd->sin_addr.s_addr && strlen(reply->h_name) < 63) + hostname = reply->h_name; + } +#ifdef RB_IPV6 + else if(query->type == QUERY_PTR_AAAA) + { + struct sockaddr_in6 *ip, *ip_fwd; + ip = (struct sockaddr_in6 *) &query->addr; + ip_fwd = (struct sockaddr_in6 *) &reply->addr; + + if(memcmp(&ip->sin6_addr, &ip_fwd->sin6_addr, sizeof(struct in6_addr)) == 0 && strlen(reply->h_name) < 63) + hostname = reply->h_name; + } +#endif + else + /* Shouldn't happen */ + exit(5); +end: + if(query->callback) + query->callback(hostname, hostname != NULL, query->type, query->data); + + rb_free(query); +} + +static void +submit_dns_answer(const char *reply, bool status, query_type type, void *data) +{ + char *id = data; + + if(!id || type == QUERY_INVALID) + exit(6); + + if(!reply || !status) + { + rb_helper_write(authd_helper, "E %s E %c *", id, type); + rb_free(id); + } + + rb_helper_write(authd_helper, "E %s O %c %s", id, type, reply); + rb_free(id); } void resolve_dns(int parc, char *parv[]) { - struct dns_request *req; - char *requestid = parv[1]; - char *qtype = parv[2]; - char *rec = parv[3]; - int type; + char *id = rb_strdup(parv[1]); + char qtype = *parv[2]; + char *record = parv[3]; + int aftype = AF_INET; - req = rb_malloc(sizeof(*req)); - rb_strlcpy(req->reqid, requestid, sizeof(req->reqid)); - req->type = *qtype; - - switch (req->type) + switch(qtype) { - case '4': - type = T_A; - break; +#ifdef RB_IPV6 case '6': - type = T_AAAA; + aftype = AF_INET6; +#endif + case '4': + if(!lookup_ip(record, aftype, submit_dns_answer, id)) + submit_dns_answer(NULL, false, qtype, NULL); break; - case 'R': +#ifdef RB_IPV6 case 'S': - if(!rb_inet_pton_sock(rec, (struct sockaddr *) &req->addr)) - exit(6); - type = T_PTR; + aftype = AF_INET6; +#endif + case 'R': + if(!lookup_hostname(record, aftype, submit_dns_answer, id)) + submit_dns_answer(NULL, false, qtype, NULL); break; + default: + exit(7); } - - req->query.ptr = req; - req->query.callback = submit_dns_answer; - - if (type != T_PTR) - gethost_byname_type(rec, &req->query, type); - else - gethost_byaddr(&req->addr, &req->query); } void diff --git a/authd/dns.h b/authd/dns.h index 3e43520af..8957db365 100644 --- a/authd/dns.h +++ b/authd/dns.h @@ -23,17 +23,36 @@ #define DNS_REQ_IDLEN 10 +#include "stdinc.h" #include "res.h" #include "reslib.h" -struct dns_request +typedef enum +{ + QUERY_INVALID = 0, + QUERY_A = '4', + QUERY_AAAA = '6', + QUERY_PTR_A = 'R', + QUERY_PTR_AAAA = 'S', +} query_type; + +/* Similar to that in ircd */ +typedef void (*DNSCB)(const char *res, bool status, query_type type, void *data); + +struct dns_query { struct DNSQuery query; - char reqid[DNS_REQ_IDLEN]; + query_type type; struct rb_sockaddr_storage addr; - char type; + uint64_t id; + + DNSCB callback; + void *data; }; +extern struct dns_query *lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data); +extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); + extern void resolve_dns(int parc, char *parv[]); extern void enumerate_nameservers(const char *rid, const char letter); extern void reload_nameservers(const char letter); From 45ac1e3ce6842fa0e220ef8e93b23b923487730a Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 07:10:27 -0600 Subject: [PATCH 009/252] authd: add the ability to cancel DNS requests --- authd/dns.c | 7 +++++++ authd/dns.h | 1 + 2 files changed, 8 insertions(+) diff --git a/authd/dns.c b/authd/dns.c index 43e69f9c2..6641c2885 100644 --- a/authd/dns.c +++ b/authd/dns.c @@ -103,6 +103,13 @@ lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data) return query; } +/* Cancel a pending query */ +static void +cancel_query(struct dns_query *query) +{ + query->callback = query->data = NULL; +} + /* Callback from gethost_byname_type */ static void handle_lookup_ip_reply(void *data, struct DNSReply *reply) diff --git a/authd/dns.h b/authd/dns.h index 8957db365..e986bd800 100644 --- a/authd/dns.h +++ b/authd/dns.h @@ -52,6 +52,7 @@ struct dns_query extern struct dns_query *lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data); extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); +extern static void cancel_query(struct dns_query *query); extern void resolve_dns(int parc, char *parv[]); extern void enumerate_nameservers(const char *rid, const char letter); From 540676fc18fd2bc72cce6f0e074f25f2908d0701 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 07:36:57 -0600 Subject: [PATCH 010/252] cancel_query: fix stupid build error --- aclocal.m4 | 10021 +++++++++++++++++++++++++++++++++++++++++++++++++- authd/dns.c | 2 +- authd/dns.h | 2 +- 3 files changed, 10016 insertions(+), 9 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 9ba68755c..a0a793943 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -20,6 +20,10020 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 2014 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +]) + +# serial 58 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# '#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS=$save_LDFLAGS + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[[012]][[,.]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + m4_if([$1], [CXX], +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case $ECHO in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program that can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test yes = "$GCC"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + osf3*) + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting $shlibpath_var if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC=$CC +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report what library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC=$lt_save_CC +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)=$prev$p + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)=$p + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)=$p + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test no = "$F77"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_F77"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test no = "$FC"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_FC"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f "$lt_ac_sed" && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test 10 -lt "$lt_ac_count" && break + lt_ac_count=`expr $lt_ac_count + 1` + if test "$lt_ac_count" -gt "$lt_ac_max"; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS + +# Portability macros for glibc argz. -*- Autoconf -*- +# +# Copyright (C) 2004-2007, 2011-2015 Free Software Foundation, Inc. +# Written by Gary V. Vaughan +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 1 ltargz.m4 + +AC_DEFUN([LT_FUNC_ARGZ], [ +AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_TYPES([error_t], + [], + [AC_DEFINE([error_t], [int], + [Define to a type to use for 'error_t' if it is not otherwise available.]) + AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h + does not typedef error_t.])], + [#if defined(HAVE_ARGZ_H) +# include +#endif]) + +LT_ARGZ_H= +AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ + argz_next argz_stringify], [], [LT_ARGZ_H=lt__argz.h; AC_LIBOBJ([lt__argz])]) + +dnl if have system argz functions, allow forced use of +dnl libltdl-supplied implementation (and default to do so +dnl on "known bad" systems). Could use a runtime check, but +dnl (a) detecting malloc issues is notoriously unreliable +dnl (b) only known system that declares argz functions, +dnl provides them, yet they are broken, is cygwin +dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) +dnl So, it's more straightforward simply to special case +dnl this for known bad systems. +AS_IF([test -z "$LT_ARGZ_H"], + [AC_CACHE_CHECK( + [if argz actually works], + [lt_cv_sys_argz_works], + [[case $host_os in #( + *cygwin*) + lt_cv_sys_argz_works=no + if test no != "$cross_compiling"; then + lt_cv_sys_argz_works="guessing no" + else + lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' + save_IFS=$IFS + IFS=-. + set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` + IFS=$save_IFS + lt_os_major=${2-0} + lt_os_minor=${3-0} + lt_os_micro=${4-0} + if test 1 -lt "$lt_os_major" \ + || { test 1 -eq "$lt_os_major" \ + && { test 5 -lt "$lt_os_minor" \ + || { test 5 -eq "$lt_os_minor" \ + && test 24 -lt "$lt_os_micro"; }; }; }; then + lt_cv_sys_argz_works=yes + fi + fi + ;; #( + *) lt_cv_sys_argz_works=yes ;; + esac]]) + AS_IF([test yes = "$lt_cv_sys_argz_works"], + [AC_DEFINE([HAVE_WORKING_ARGZ], 1, + [This value is set to 1 to indicate that the system argz facility works])], + [LT_ARGZ_H=lt__argz.h + AC_LIBOBJ([lt__argz])])]) + +AC_SUBST([LT_ARGZ_H]) +]) + +# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- +# +# Copyright (C) 1999-2008, 2011-2015 Free Software Foundation, Inc. +# Written by Thomas Tanner, 1999 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 20 LTDL_INIT + +# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) +# ------------------------------------------ +# DIRECTORY contains the libltdl sources. It is okay to call this +# function multiple times, as long as the same DIRECTORY is always given. +AC_DEFUN([LT_CONFIG_LTDL_DIR], +[AC_BEFORE([$0], [LTDL_INIT]) +_$0($*) +])# LT_CONFIG_LTDL_DIR + +# We break this out into a separate macro, so that we can call it safely +# internally without being caught accidentally by the sed scan in libtoolize. +m4_defun([_LT_CONFIG_LTDL_DIR], +[dnl remove trailing slashes +m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) +m4_case(_LTDL_DIR, + [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply '.' + m4_if(_ARG_DIR, [.], + [], + [m4_define([_LTDL_DIR], _ARG_DIR) + _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], + [m4_if(_ARG_DIR, _LTDL_DIR, + [], + [m4_fatal([multiple libltdl directories: ']_LTDL_DIR[', ']_ARG_DIR['])])]) +m4_popdef([_ARG_DIR]) +])# _LT_CONFIG_LTDL_DIR + +# Initialise: +m4_define([_LTDL_DIR], []) + + +# _LT_BUILD_PREFIX +# ---------------- +# If Autoconf is new enough, expand to '$(top_build_prefix)', otherwise +# to '$(top_builddir)/'. +m4_define([_LT_BUILD_PREFIX], +[m4_ifdef([AC_AUTOCONF_VERSION], + [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), + [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], + [$(top_build_prefix)], + [$(top_builddir)/])], + [$(top_build_prefix)])], + [$(top_builddir)/])[]dnl +]) + + +# LTDL_CONVENIENCE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with +# '$(top_build_prefix)' if available, otherwise with '$(top_builddir)/', +# and LTDLINCL will be prefixed with '$(top_srcdir)/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_build_prefix, top_builddir, and top_srcdir appropriately +# in your Makefiles. +AC_DEFUN([LTDL_CONVENIENCE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_CONVENIENCE + +# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_CONVENIENCE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_CONVENIENCE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) + + +# _LTDL_CONVENIENCE +# ----------------- +# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). +m4_defun([_LTDL_CONVENIENCE], +[case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; +esac +LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" +LTDLDEPS=$LIBLTDL +LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}" + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL=$LTDLINCL +AC_SUBST([INCLTDL]) +])# _LTDL_CONVENIENCE + + +# LTDL_INSTALLABLE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl installable library +# and LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl +# is not found, LIBLTDL will be prefixed with '$(top_build_prefix)' if +# available, otherwise with '$(top_builddir)/', and LTDLINCL will be +# prefixed with '$(top_srcdir)/' (note the single quotes!). If your +# package is not flat and you're not using automake, define top_build_prefix, +# top_builddir, and top_srcdir appropriately in your Makefiles. +# In the future, this macro may have to be called after LT_INIT. +AC_DEFUN([LTDL_INSTALLABLE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_INSTALLABLE + +# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_INSTALLABLE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_INSTALLABLE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) + + +# _LTDL_INSTALLABLE +# ----------------- +# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). +m4_defun([_LTDL_INSTALLABLE], +[if test -f "$prefix/lib/libltdl.la"; then + lt_save_LDFLAGS=$LDFLAGS + LDFLAGS="-L$prefix/lib $LDFLAGS" + AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) + LDFLAGS=$lt_save_LDFLAGS + if test yes = "${lt_lib_ltdl-no}"; then + if test yes != "$enable_ltdl_install"; then + # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install + AC_MSG_WARN([not overwriting libltdl at $prefix, force with '--enable-ltdl-install']) + enable_ltdl_install=no + fi + elif test no = "$enable_ltdl_install"; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + fi +fi + +# If configure.ac declared an installable ltdl, and the user didn't override +# with --disable-ltdl-install, we will install the shipped libltdl. +case $enable_ltdl_install in + no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL=-lltdl + LTDLDEPS= + LTDLINCL= + ;; + *) enable_ltdl_install=yes + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" + LTDLDEPS=$LIBLTDL + LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}" + ;; +esac + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL=$LTDLINCL +AC_SUBST([INCLTDL]) +])# LTDL_INSTALLABLE + + +# _LTDL_MODE_DISPATCH +# ------------------- +m4_define([_LTDL_MODE_DISPATCH], +[dnl If _LTDL_DIR is '.', then we are configuring libltdl itself: +m4_if(_LTDL_DIR, [], + [], + dnl if _LTDL_MODE was not set already, the default value is 'subproject': + [m4_case(m4_default(_LTDL_MODE, [subproject]), + [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) + _LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir])], + [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir; lt_libobj_prefix=$lt_ltdl_dir/])], + [recursive], [], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl +dnl Be careful not to expand twice: +m4_define([$0], []) +])# _LTDL_MODE_DISPATCH + + +# _LT_LIBOBJ(MODULE_NAME) +# ----------------------- +# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead +# of into LIBOBJS. +AC_DEFUN([_LT_LIBOBJ], [ + m4_pattern_allow([^_LT_LIBOBJS$]) + _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" +])# _LT_LIBOBJS + + +# LTDL_INIT([OPTIONS]) +# -------------------- +# Clients of libltdl can use this macro to allow the installer to +# choose between a shipped copy of the ltdl sources or a preinstalled +# version of the library. If the shipped ltdl sources are not in a +# subdirectory named libltdl, the directory name must be given by +# LT_CONFIG_LTDL_DIR. +AC_DEFUN([LTDL_INIT], +[dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +dnl We need to keep our own list of libobjs separate from our parent project, +dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while +dnl we look for our own LIBOBJs. +m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) +m4_pushdef([AC_LIBSOURCES]) + +dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: +m4_if(_LTDL_MODE, [], + [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) + m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) + +AC_ARG_WITH([included_ltdl], + [AS_HELP_STRING([--with-included-ltdl], + [use the GNU ltdl sources included here])]) + +if test yes != "$with_included_ltdl"; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_DECL([lt_dlinterface_register], + [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], + [with_included_ltdl=no], + [with_included_ltdl=yes])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT + #include ])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT] + ) +fi + +dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE +dnl was called yet, then for old times' sake, we assume libltdl is in an +dnl eponymous directory: +AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) + +AC_ARG_WITH([ltdl_include], + [AS_HELP_STRING([--with-ltdl-include=DIR], + [use the ltdl headers installed in DIR])]) + +if test -n "$with_ltdl_include"; then + if test -f "$with_ltdl_include/ltdl.h"; then : + else + AC_MSG_ERROR([invalid ltdl include directory: '$with_ltdl_include']) + fi +else + with_ltdl_include=no +fi + +AC_ARG_WITH([ltdl_lib], + [AS_HELP_STRING([--with-ltdl-lib=DIR], + [use the libltdl.la installed in DIR])]) + +if test -n "$with_ltdl_lib"; then + if test -f "$with_ltdl_lib/libltdl.la"; then : + else + AC_MSG_ERROR([invalid ltdl library directory: '$with_ltdl_lib']) + fi +else + with_ltdl_lib=no +fi + +case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in + ,yes,no,no,) + m4_case(m4_default(_LTDL_TYPE, [convenience]), + [convenience], [_LTDL_CONVENIENCE], + [installable], [_LTDL_INSTALLABLE], + [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) + ;; + ,no,no,no,) + # If the included ltdl is not to be used, then use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], [1], + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl + LTDLDEPS= + LTDLINCL= + ;; + ,no*,no,*) + AC_MSG_ERROR(['--with-ltdl-include' and '--with-ltdl-lib' options must be used together]) + ;; + *) with_included_ltdl=no + LIBLTDL="-L$with_ltdl_lib -lltdl" + LTDLDEPS= + LTDLINCL=-I$with_ltdl_include + ;; +esac +INCLTDL=$LTDLINCL + +# Report our decision... +AC_MSG_CHECKING([where to find libltdl headers]) +AC_MSG_RESULT([$LTDLINCL]) +AC_MSG_CHECKING([where to find libltdl library]) +AC_MSG_RESULT([$LIBLTDL]) + +_LTDL_SETUP + +dnl restore autoconf definition. +m4_popdef([AC_LIBOBJ]) +m4_popdef([AC_LIBSOURCES]) + +AC_CONFIG_COMMANDS_PRE([ + _ltdl_libobjs= + _ltdl_ltlibobjs= + if test -n "$_LT_LIBOBJS"; then + # Remove the extension. + _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do + _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" + _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" + done + fi + AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) + AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) +]) + +# Only expand once: +m4_define([LTDL_INIT]) +])# LTDL_INIT + +# Old names: +AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIB_LTDL], []) +dnl AC_DEFUN([AC_WITH_LTDL], []) +dnl AC_DEFUN([LT_WITH_LTDL], []) + + +# _LTDL_SETUP +# ----------- +# Perform all the checks necessary for compilation of the ltdl objects +# -- including compiler checks and header checks. This is a public +# interface mainly for the benefit of libltdl's own configure.ac, most +# other users should call LTDL_INIT instead. +AC_DEFUN([_LTDL_SETUP], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl +AC_REQUIRE([LT_SYS_MODULE_PATH])dnl +AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl +AC_REQUIRE([LT_LIB_DLLOAD])dnl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl +AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl +AC_REQUIRE([LT_FUNC_ARGZ])dnl + +m4_require([_LT_CHECK_OBJDIR])dnl +m4_require([_LT_HEADER_DLFCN])dnl +m4_require([_LT_CHECK_DLPREOPEN])dnl +m4_require([_LT_DECL_SED])dnl + +dnl Don't require this, or it will be expanded earlier than the code +dnl that sets the variables it relies on: +_LT_ENABLE_INSTALL + +dnl _LTDL_MODE specific code must be called at least once: +_LTDL_MODE_DISPATCH + +# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS +# the user used. This is so that ltdl.h can pick up the parent projects +# config.h file, The first file in AC_CONFIG_HEADERS must contain the +# definitions required by ltdl.c. +# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). +AC_CONFIG_COMMANDS_PRE([dnl +m4_pattern_allow([^LT_CONFIG_H$])dnl +m4_ifset([AH_HEADER], + [LT_CONFIG_H=AH_HEADER], + [m4_ifset([AC_LIST_HEADERS], + [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's|^[[ ]]*||;s|[[ :]].*$||'`], + [])])]) +AC_SUBST([LT_CONFIG_H]) + +AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], + [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) +AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) + +m4_pattern_allow([LT_LIBEXT])dnl +AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) + +name= +eval "lt_libprefix=\"$libname_spec\"" +m4_pattern_allow([LT_LIBPREFIX])dnl +AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) + +name=ltdl +eval "LTDLOPEN=\"$libname_spec\"" +AC_SUBST([LTDLOPEN]) +])# _LTDL_SETUP + + +# _LT_ENABLE_INSTALL +# ------------------ +m4_define([_LT_ENABLE_INSTALL], +[AC_ARG_ENABLE([ltdl-install], + [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) + +case ,$enable_ltdl_install,$enable_ltdl_convenience in + *yes*) ;; + *) enable_ltdl_convenience=yes ;; +esac + +m4_ifdef([AM_CONDITIONAL], +[AM_CONDITIONAL(INSTALL_LTDL, test no != "${enable_ltdl_install-no}") + AM_CONDITIONAL(CONVENIENCE_LTDL, test no != "${enable_ltdl_convenience-no}")]) +])# _LT_ENABLE_INSTALL + + +# LT_SYS_DLOPEN_DEPLIBS +# --------------------- +AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [lt_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + lt_cv_sys_dlopen_deplibs=unknown + case $host_os in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this 'case' here to explicitly catch those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + aix[[4-9]]*) + lt_cv_sys_dlopen_deplibs=yes + ;; + amigaos*) + case $host_cpu in + powerpc) + lt_cv_sys_dlopen_deplibs=no + ;; + esac + ;; + bitrig*) + lt_cv_sys_dlopen_deplibs=yes + ;; + darwin*) + # Assuming the user has installed a libdl from somewhere, this is true + # If you are looking for one http://www.opendarwin.org/projects/dlcompat + lt_cv_sys_dlopen_deplibs=yes + ;; + freebsd* | dragonfly*) + lt_cv_sys_dlopen_deplibs=yes + ;; + gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) + # GNU and its variants, using gnu ld.so (Glibc) + lt_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + lt_cv_sys_dlopen_deplibs=yes + ;; + interix*) + lt_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + lt_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explicitly say 'no'. + lt_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to 'yes'. Without it, it would be 'no'. + lt_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say 'yes'. + lt_cv_sys_dlopen_deplibs=yes + ;; + qnx*) + lt_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + lt_cv_sys_dlopen_deplibs=yes + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test yes != "$lt_cv_sys_dlopen_deplibs"; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +])# LT_SYS_DLOPEN_DEPLIBS + +# Old name: +AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) + + +# LT_SYS_MODULE_EXT +# ----------------- +AC_DEFUN([LT_SYS_MODULE_EXT], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([what extension is used for runtime loadable modules], + [libltdl_cv_shlibext], +[ +module=yes +eval libltdl_cv_shlibext=$shrext_cmds +module=no +eval libltdl_cv_shrext=$shrext_cmds + ]) +if test -n "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_MODULE_EXT])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], + [Define to the extension used for runtime loadable modules, say, ".so".]) +fi +if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_SHARED_EXT])dnl + AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], + [Define to the shared library suffix, say, ".dylib".]) +fi +if test -n "$shared_archive_member_spec"; then + m4_pattern_allow([LT_SHARED_LIB_MEMBER])dnl + AC_DEFINE_UNQUOTED([LT_SHARED_LIB_MEMBER], ["($shared_archive_member_spec.o)"], + [Define to the shared archive member specification, say "(shr.o)".]) +fi +])# LT_SYS_MODULE_EXT + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) + + +# LT_SYS_MODULE_PATH +# ------------------ +AC_DEFUN([LT_SYS_MODULE_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([what variable specifies run-time module search path], + [lt_cv_module_path_var], [lt_cv_module_path_var=$shlibpath_var]) +if test -n "$lt_cv_module_path_var"; then + m4_pattern_allow([LT_MODULE_PATH_VAR])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], + [Define to the name of the environment variable that determines the run-time module search path.]) +fi +])# LT_SYS_MODULE_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) + + +# LT_SYS_DLSEARCH_PATH +# -------------------- +AC_DEFUN([LT_SYS_DLSEARCH_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([for the default library search path], + [lt_cv_sys_dlsearch_path], + [lt_cv_sys_dlsearch_path=$sys_lib_dlsearch_path_spec]) +if test -n "$lt_cv_sys_dlsearch_path"; then + sys_dlsearch_path= + for dir in $lt_cv_sys_dlsearch_path; do + if test -z "$sys_dlsearch_path"; then + sys_dlsearch_path=$dir + else + sys_dlsearch_path=$sys_dlsearch_path$PATH_SEPARATOR$dir + fi + done + m4_pattern_allow([LT_DLSEARCH_PATH])dnl + AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], + [Define to the system default library search path.]) +fi +])# LT_SYS_DLSEARCH_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) + + +# _LT_CHECK_DLPREOPEN +# ------------------- +m4_defun([_LT_CHECK_DLPREOPEN], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], + [libltdl_cv_preloaded_symbols], + [if test -n "$lt_cv_sys_global_symbol_pipe"; then + libltdl_cv_preloaded_symbols=yes + else + libltdl_cv_preloaded_symbols=no + fi + ]) +if test yes = "$libltdl_cv_preloaded_symbols"; then + AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], + [Define if libtool can extract symbol lists from object files.]) +fi +])# _LT_CHECK_DLPREOPEN + + +# LT_LIB_DLLOAD +# ------------- +AC_DEFUN([LT_LIB_DLLOAD], +[m4_pattern_allow([^LT_DLLOADERS$]) +LT_DLLOADERS= +AC_SUBST([LT_DLLOADERS]) + +AC_LANG_PUSH([C]) +lt_dlload_save_LIBS=$LIBS + +LIBADD_DLOPEN= +AC_SEARCH_LIBS([dlopen], [dl], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + if test "$ac_cv_search_dlopen" != "none required"; then + LIBADD_DLOPEN=-ldl + fi + libltdl_cv_lib_dl_dlopen=yes + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H +# include +#endif + ]], [[dlopen(0, 0);]])], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + libltdl_cv_func_dlopen=yes + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DLOPEN=-lsvld libltdl_cv_func_dlopen=yes + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) +if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen" +then + lt_save_LIBS=$LIBS + LIBS="$LIBS $LIBADD_DLOPEN" + AC_CHECK_FUNCS([dlerror]) + LIBS=$lt_save_LIBS +fi +AC_SUBST([LIBADD_DLOPEN]) + +LIBADD_SHL_LOAD= +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" + LIBADD_SHL_LOAD=-ldld])]) +AC_SUBST([LIBADD_SHL_LOAD]) + +case $host_os in +darwin[[1567]].*) +# We only want this for pre-Mac OS X 10.4. + AC_CHECK_FUNC([_dyld_func_lookup], + [AC_DEFINE([HAVE_DYLD], [1], + [Define if you have the _dyld_func_lookup function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) + ;; +beos*) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" + ;; +cygwin* | mingw* | pw32*) + AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" + ;; +esac + +AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) +AC_SUBST([LIBADD_DLD_LINK]) + +m4_pattern_allow([^LT_DLPREOPEN$]) +LT_DLPREOPEN= +if test -n "$LT_DLLOADERS" +then + for lt_loader in $LT_DLLOADERS; do + LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " + done + AC_DEFINE([HAVE_LIBDLLOADER], [1], + [Define if libdlloader will be built on this platform]) +fi +AC_SUBST([LT_DLPREOPEN]) + +dnl This isn't used anymore, but set it for backwards compatibility +LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" +AC_SUBST([LIBADD_DL]) + +LIBS=$lt_dlload_save_LIBS +AC_LANG_POP +])# LT_LIB_DLLOAD + +# Old name: +AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLLIB], []) + + +# LT_SYS_SYMBOL_USCORE +# -------------------- +# does the compiler prefix global symbols with an underscore? +AC_DEFUN([LT_SYS_SYMBOL_USCORE], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [lt_cv_sys_symbol_underscore], + [lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.c >&AS_MESSAGE_LOG_FD + fi + rm -rf conftest* + ]) + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + AC_SUBST([sys_symbol_underscore]) +])# LT_SYS_SYMBOL_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) + + +# LT_FUNC_DLSYM_USCORE +# -------------------- +AC_DEFUN([LT_FUNC_DLSYM_USCORE], +[AC_REQUIRE([_LT_COMPILER_PIC])dnl for lt_prog_compiler_wl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl for lt_cv_sys_symbol_underscore +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl for libltdl_cv_shlibext +if test yes = "$lt_cv_sys_symbol_underscore"; then + if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen"; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + dlsym_uscore_save_LIBS=$LIBS + LIBS="$LIBS $LIBADD_DLOPEN" + libname=conftmod # stay within 8.3 filename limits! + cat >$libname.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif +int fnord () { return 42; }] +_LT_EOF + + # ltfn_module_cmds module_cmds + # Execute tilde-delimited MODULE_CMDS with environment primed for + # $module_cmds or $archive_cmds type content. + ltfn_module_cmds () + {( # subshell avoids polluting parent global environment + module_cmds_save_ifs=$IFS; IFS='~' + for cmd in @S|@1; do + IFS=$module_cmds_save_ifs + libobjs=$libname.$ac_objext; lib=$libname$libltdl_cv_shlibext + rpath=/not-exists; soname=$libname$libltdl_cv_shlibext; output_objdir=. + major=; versuffix=; verstring=; deplibs= + ECHO=echo; wl=$lt_prog_compiler_wl; allow_undefined_flag= + eval $cmd + done + IFS=$module_cmds_save_ifs + )} + + # Compile a loadable module using libtool macro expansion results. + $CC $pic_flag -c $libname.$ac_ext + ltfn_module_cmds "${module_cmds:-$archive_cmds}" + + # Try to fetch fnord with dlsym(). + libltdl_dlunknown=0; libltdl_dlnouscore=1; libltdl_dluscore=2 + cat >conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" +#if HAVE_DLFCN_H +#include +#endif +#include +#ifndef RTLD_GLOBAL +# ifdef DL_GLOBAL +# define RTLD_GLOBAL DL_GLOBAL +# else +# define RTLD_GLOBAL 0 +# endif +#endif +#ifndef RTLD_NOW +# ifdef DL_NOW +# define RTLD_NOW DL_NOW +# else +# define RTLD_NOW 0 +# endif +#endif +int main () { + void *handle = dlopen ("`pwd`/$libname$libltdl_cv_shlibext", RTLD_GLOBAL|RTLD_NOW); + int status = $libltdl_dlunknown; + if (handle) { + if (dlsym (handle, "fnord")) + status = $libltdl_dlnouscore; + else { + if (dlsym (handle, "_fnord")) + status = $libltdl_dluscore; + else + puts (dlerror ()); + } + dlclose (handle); + } else + puts (dlerror ()); + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + libltdl_status=$? + case x$libltdl_status in + x$libltdl_dlnouscore) libltdl_cv_need_uscore=no ;; + x$libltdl_dluscore) libltdl_cv_need_uscore=yes ;; + x*) libltdl_cv_need_uscore=unknown ;; + esac + fi + rm -rf conftest* $libname* + LIBS=$dlsym_uscore_save_LIBS + ]) + fi +fi + +if test yes = "$libltdl_cv_need_uscore"; then + AC_DEFINE([NEED_USCORE], [1], + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +])# LT_FUNC_DLSYM_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) + +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 8 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option '$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _LT_SET_OPTIONS + + + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# LT_INIT options. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) + +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) + +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 4179 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.6' +macro_revision='2.4.6' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) + +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) + # Copyright (C) 2002-2014 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -1211,11 +11225,4 @@ AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/charybdis.m4]) -m4_include([m4/libtool.m4]) -m4_include([m4/ltargz.m4]) -m4_include([m4/ltdl.m4]) -m4_include([m4/ltoptions.m4]) -m4_include([m4/ltsugar.m4]) -m4_include([m4/ltversion.m4]) -m4_include([m4/lt~obsolete.m4]) m4_include([m4/pkg.m4]) diff --git a/authd/dns.c b/authd/dns.c index 6641c2885..951a5508a 100644 --- a/authd/dns.c +++ b/authd/dns.c @@ -104,7 +104,7 @@ lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data) } /* Cancel a pending query */ -static void +void cancel_query(struct dns_query *query) { query->callback = query->data = NULL; diff --git a/authd/dns.h b/authd/dns.h index e986bd800..4a977b280 100644 --- a/authd/dns.h +++ b/authd/dns.h @@ -52,7 +52,7 @@ struct dns_query extern struct dns_query *lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data); extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); -extern static void cancel_query(struct dns_query *query); +extern void cancel_query(struct dns_query *query); extern void resolve_dns(int parc, char *parv[]); extern void enumerate_nameservers(const char *rid, const char letter); From 9abdcf1c645f5dc72cf18707c652eeb392733ffd Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 20:10:46 -0600 Subject: [PATCH 011/252] modules: can .la suffix. .la archives are prohibited by most Linux distributions because they clutter up the linker. They may get caught up as victims in scripts that purge .la files. Besides, .la files don't matter for simple loadable modules on most systems. So, what we do now instead is just use the platform suffix detected by libtool. --- Makefile.am | 5 ++ doc/ircd.conf.example | 58 ++++++++--------- doc/reference.conf | 140 +++++++++++++++++++++--------------------- ircd/modules.c | 24 +++++--- 4 files changed, 119 insertions(+), 108 deletions(-) diff --git a/Makefile.am b/Makefile.am index 34e152871..c4a49a6df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,3 +37,8 @@ include/serno.h: install-data-hook: test -d ${DESTDIR}${logdir} || mkdir -p ${DESTDIR}${logdir} + +install-exec-hook: + rm -f ${DESTDIR}${moduledir}/*.la + rm -f ${DESTDIR}${moduledir}/autoload/*.la + rm -f ${DESTDIR}${moduledir}/extensions/*.la diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 49951a5ef..9f2616610 100644 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -8,33 +8,33 @@ */ /* Extensions */ -#loadmodule "extensions/chm_operonly_compat.la"; -#loadmodule "extensions/chm_quietunreg_compat.la"; -#loadmodule "extensions/chm_sslonly_compat.la"; -#loadmodule "extensions/chm_operpeace.la"; -#loadmodule "extensions/createauthonly.la"; -#loadmodule "extensions/extb_account.la"; -#loadmodule "extensions/extb_canjoin.la"; -#loadmodule "extensions/extb_channel.la"; -#loadmodule "extensions/extb_combi.la"; -#loadmodule "extensions/extb_extgecos.la"; -#loadmodule "extensions/extb_hostmask.la"; -#loadmodule "extensions/extb_oper.la"; -#loadmodule "extensions/extb_realname.la"; -#loadmodule "extensions/extb_server.la"; -#loadmodule "extensions/extb_ssl.la"; -#loadmodule "extensions/hurt.la"; -#loadmodule "extensions/m_extendchans.la"; -#loadmodule "extensions/m_findforwards.la"; -#loadmodule "extensions/m_identify.la"; -#loadmodule "extensions/no_oper_invis.la"; -#loadmodule "extensions/sno_farconnect.la"; -#loadmodule "extensions/sno_globalkline.la"; -#loadmodule "extensions/sno_globalnickchange.la"; -#loadmodule "extensions/sno_globaloper.la"; -#loadmodule "extensions/sno_whois.la"; -#loadmodule "extensions/override.la"; -#loadmodule "extensions/no_kill_services.la"; +#loadmodule "extensions/chm_operonly_compat"; +#loadmodule "extensions/chm_quietunreg_compat"; +#loadmodule "extensions/chm_sslonly_compat"; +#loadmodule "extensions/chm_operpeace"; +#loadmodule "extensions/createauthonly"; +#loadmodule "extensions/extb_account"; +#loadmodule "extensions/extb_canjoin"; +#loadmodule "extensions/extb_channel"; +#loadmodule "extensions/extb_combi"; +#loadmodule "extensions/extb_extgecos"; +#loadmodule "extensions/extb_hostmask"; +#loadmodule "extensions/extb_oper"; +#loadmodule "extensions/extb_realname"; +#loadmodule "extensions/extb_server"; +#loadmodule "extensions/extb_ssl"; +#loadmodule "extensions/hurt"; +#loadmodule "extensions/m_extendchans"; +#loadmodule "extensions/m_findforwards"; +#loadmodule "extensions/m_identify"; +#loadmodule "extensions/no_oper_invis"; +#loadmodule "extensions/sno_farconnect"; +#loadmodule "extensions/sno_globalkline"; +#loadmodule "extensions/sno_globalnickchange"; +#loadmodule "extensions/sno_globaloper"; +#loadmodule "extensions/sno_whois"; +#loadmodule "extensions/override"; +#loadmodule "extensions/no_kill_services"; /* * IP cloaking extensions: use ip_cloaking_4.0 @@ -43,8 +43,8 @@ * releases. */ -#loadmodule "extensions/ip_cloaking_4.0.la"; -#loadmodule "extensions/ip_cloaking.la"; +#loadmodule "extensions/ip_cloaking_4.0"; +#loadmodule "extensions/ip_cloaking"; serverinfo { name = "hades.arpa"; diff --git a/doc/reference.conf b/doc/reference.conf index 19e337c56..2cb078c7f 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -43,73 +43,73 @@ * Charybdis contains several extensions that are not enabled by default. * To use them, uncomment the lines below. * - * Channel mode +-A (admin only) -- chm_adminonly.la - * Channel mode +-O (oper only) -- chm_operonly.la - * Channel mode +-S (ssl only) -- chm_sslonly.la - * Emulates channel mode +-O (oper only) (+-iI $o) -- chm_operonly_compat.la - * Emulates channel mode +-R (quiet unreg) (+-q $~a) -- chm_quietunreg_compat.la - * Emulates channel mode +-S (ssl only) (+-b $~z) -- chm_sslonly_compat.la - * Channel mode +-M (disallow KICK on IRC ops) -- chm_operpeace.la - * Restrict channel creation to logged in users -- createauthonly.la - * Account bans (+b $a[:mask]) -- extb_account.la - * Banned from another channel (+b $j:mask) -- extb_canjoin.la - * Other-channel bans (+b $c:mask) -- extb_channel.la - * Combination extbans -- extb_combi.la - * Extended ban (+b $x:mask) -- extb_extgecos.la - * Hostmask bans (for combination extbans) -- extb_hostmask.la - * Oper bans (+b $o) -- extb_oper.la - * Realname (gecos) bans (+b $r:mask) -- extb_realname.la - * Server bans (+b $s:mask) -- extb_server.la - * SSL bans (+b $z) -- extb_ssl.la - * Helpops system (umode +H) -- helpops.la - * HURT system -- hurt.la - * New host mangling (umode +x) -- ip_cloaking_4.0.la - * Old host mangling (umode +h) -- ip_cloaking.la - * Dynamically extend channel limits -- m_extendchans.la - * Find channel forwards -- m_findforwards.la - * /identify support -- m_identify.la - * Opers cannot be invisible (umode +i) -- no_oper_invis.la - * Far connection notices (snomask +F) -- sno_farconnect.la - * Remote k/d/x line active notices -- sno_globalkline.la - * Remote oper up notices -- sno_globaloper.la - * Global nick-change notices -- sno_globalnickchange.la - * /whois notifications (snomask +W) -- sno_whois.la - * Oper-override (modehacking only) -- override.la - * Stop services kills -- no_kill_services.la + * Channel mode +-A (admin only) -- chm_adminonly + * Channel mode +-O (oper only) -- chm_operonly + * Channel mode +-S (ssl only) -- chm_sslonly + * Emulates channel mode +-O (oper only) (+-iI $o) -- chm_operonly_compat + * Emulates channel mode +-R (quiet unreg) (+-q $~a) -- chm_quietunreg_compat + * Emulates channel mode +-S (ssl only) (+-b $~z) -- chm_sslonly_compat + * Channel mode +-M (disallow KICK on IRC ops) -- chm_operpeace + * Restrict channel creation to logged in users -- createauthonly + * Account bans (+b $a[:mask]) -- extb_account + * Banned from another channel (+b $j:mask) -- extb_canjoin + * Other-channel bans (+b $c:mask) -- extb_channel + * Combination extbans -- extb_combi + * Extended ban (+b $x:mask) -- extb_extgecos + * Hostmask bans (for combination extbans) -- extb_hostmask + * Oper bans (+b $o) -- extb_oper + * Realname (gecos) bans (+b $r:mask) -- extb_realname + * Server bans (+b $s:mask) -- extb_server + * SSL bans (+b $z) -- extb_ssl + * Helpops system (umode +H) -- helpops + * HURT system -- hurt + * New host mangling (umode +x) -- ip_cloaking_4.0 + * Old host mangling (umode +h) -- ip_cloaking + * Dynamically extend channel limits -- m_extendchans + * Find channel forwards -- m_findforwards + * /identify support -- m_identify + * Opers cannot be invisible (umode +i) -- no_oper_invis + * Far connection notices (snomask +F) -- sno_farconnect + * Remote k/d/x line active notices -- sno_globalkline + * Remote oper up notices -- sno_globaloper + * Global nick-change notices -- sno_globalnickchange + * /whois notifications (snomask +W) -- sno_whois + * Oper-override (modehacking only) -- override + * Stop services kills -- no_kill_services */ -#loadmodule "extensions/chm_adminonly.la"; -#loadmodule "extensions/chm_operonly.la"; -#loadmodule "extensions/chm_sslonly.la"; -#loadmodule "extensions/chm_operonly_compat.la"; -#loadmodule "extensions/chm_quietunreg_compat.la"; -#loadmodule "extensions/chm_sslonly_compat.la"; -#loadmodule "extensions/chm_operpeace.la"; -#loadmodule "extensions/createauthonly.la"; -#loadmodule "extensions/extb_account.la"; -#loadmodule "extensions/extb_canjoin.la"; -#loadmodule "extensions/extb_channel.la"; -#loadmodule "extensions/extb_combi.la"; -#loadmodule "extensions/extb_extgecos.la"; -#loadmodule "extensions/extb_hostmask.la"; -#loadmodule "extensions/extb_oper.la"; -#loadmodule "extensions/extb_realname.la"; -#loadmodule "extensions/extb_server.la"; -#loadmodule "extensions/extb_ssl.la"; -#loadmodule "extensions/helpops.la"; -#loadmodule "extensions/hurt.la"; -#loadmodule "extensions/ip_cloaking_4.0.la"; -#loadmodule "extensions/ip_cloaking.la"; -#loadmodule "extensions/m_extendchans.la"; -#loadmodule "extensions/m_findforwards.la"; -#loadmodule "extensions/m_identify.la"; -#loadmodule "extensions/no_oper_invis.la"; -#loadmodule "extensions/sno_farconnect.la"; -#loadmodule "extensions/sno_globalkline.la"; -#loadmodule "extensions/sno_globalnickchange.la"; -#loadmodule "extensions/sno_globaloper.la"; -#loadmodule "extensions/sno_whois.la"; -#loadmodule "extensions/override.la"; -#loadmodule "extensions/no_kill_services.la"; +#loadmodule "extensions/chm_adminonly"; +#loadmodule "extensions/chm_operonly"; +#loadmodule "extensions/chm_sslonly"; +#loadmodule "extensions/chm_operonly_compat"; +#loadmodule "extensions/chm_quietunreg_compat"; +#loadmodule "extensions/chm_sslonly_compat"; +#loadmodule "extensions/chm_operpeace"; +#loadmodule "extensions/createauthonly"; +#loadmodule "extensions/extb_account"; +#loadmodule "extensions/extb_canjoin"; +#loadmodule "extensions/extb_channel"; +#loadmodule "extensions/extb_combi"; +#loadmodule "extensions/extb_extgecos"; +#loadmodule "extensions/extb_hostmask"; +#loadmodule "extensions/extb_oper"; +#loadmodule "extensions/extb_realname"; +#loadmodule "extensions/extb_server"; +#loadmodule "extensions/extb_ssl"; +#loadmodule "extensions/helpops"; +#loadmodule "extensions/hurt"; +#loadmodule "extensions/ip_cloaking_4.0"; +#loadmodule "extensions/ip_cloaking"; +#loadmodule "extensions/m_extendchans"; +#loadmodule "extensions/m_findforwards"; +#loadmodule "extensions/m_identify"; +#loadmodule "extensions/no_oper_invis"; +#loadmodule "extensions/sno_farconnect"; +#loadmodule "extensions/sno_globalkline"; +#loadmodule "extensions/sno_globalnickchange"; +#loadmodule "extensions/sno_globaloper"; +#loadmodule "extensions/sno_whois"; +#loadmodule "extensions/override"; +#loadmodule "extensions/no_kill_services"; /* serverinfo {}: Contains information about the server. (OLD M:) */ serverinfo { @@ -569,7 +569,7 @@ connect "irc.uplink.com" { flags = compressed, topicburst; }; -connect "ipv6.lame.server" { +connect "ipv6me.server" { /* Hosts that are IPv6 addresses must be in :: shortened form * if applicable. Addresses starting with a colon get an extra * zero prepended, for example: 0::1 @@ -625,8 +625,8 @@ cluster { * all - share all of the above */ - /* share klines/unklines/xlines with *.lan */ - name = "*.lan"; + /* share klines/unklines/xlines with *n */ + name = "*n"; flags = kline, unkline, xline; /* share locops with irc.ircd-ratbox.org and ircd.ircd-ratbox.org */ @@ -1349,5 +1349,5 @@ modules { path = "/usr/local/ircd/modules/autoload"; /* module: the name of a module to load on startup/rehash */ - #module = "some_module.la"; + #module = "some_module"; }; diff --git a/ircd/modules.c b/ircd/modules.c index 8175c6246..6f509ed9e 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -39,6 +39,10 @@ #include +#ifndef LT_MODULE_EXT +# error "Charybdis requires loadable module support." +#endif + struct module **modlist = NULL; static const char *core_module_table[] = { @@ -223,8 +227,8 @@ load_all_modules(int warn) DIR *system_module_dir = NULL; struct dirent *ldirent = NULL; char module_fq_name[PATH_MAX + 1]; - int len; - + static size_t module_ext_len = strlen(LT_MODULE_EXT); + modules_init(); modlist = (struct module **) rb_malloc(sizeof(struct module *) * (MODS_INCREMENT)); @@ -241,8 +245,11 @@ load_all_modules(int warn) while ((ldirent = readdir(system_module_dir)) != NULL) { + struct stat s; + size_t len; + len = strlen(ldirent->d_name); - if((len > 3) && !strcmp(ldirent->d_name+len-3, ".la")) + if(len > module_ext_len && !strcasecmp(ldirent->d_name + (len - module_ext_len), LT_MODULE_EXT)) { (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); (void) load_a_module(module_fq_name, warn, MAPI_ORIGIN_CORE, 0); @@ -267,14 +274,14 @@ load_core_modules(int warn) for (i = 0; core_module_table[i]; i++) { - snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, - core_module_table[i], ".la"); + snprintf(module_name, sizeof(module_name), "%s/%s", MODPATH, + core_module_table[i]); if(load_a_module(module_name, warn, MAPI_ORIGIN_CORE, 1) == -1) { ilog(L_MAIN, - "Error loading core module %s%s: terminating ircd", - core_module_table[i], ".la"); + "Error loading core module %s: terminating ircd", + core_module_table[i]); exit(0); } } @@ -809,7 +816,7 @@ load_a_module(const char *path, int warn, int origin, int core) mod_basename = rb_basename(path); - tmpptr = lt_dlopen(path); + tmpptr = lt_dlopenext(path); if(tmpptr == NULL) { @@ -822,7 +829,6 @@ load_a_module(const char *path, int warn, int origin, int core) return -1; } - /* * _mheader is actually a struct mapi_mheader_*, but mapi_version * is always the first member of this structure, so we treate it From 0e1f3667322e7c1179abfca296b9adc6d5c0f2fc Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 12 Mar 2016 20:27:37 -0600 Subject: [PATCH 012/252] reference.conf: fix me being an incompetent fuckwit. Blind search and replace ruined this file. Remember to check your regexes, people. --- doc/reference.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/reference.conf b/doc/reference.conf index 2cb078c7f..a72a7539d 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -569,7 +569,7 @@ connect "irc.uplink.com" { flags = compressed, topicburst; }; -connect "ipv6me.server" { +connect "ipv6.lame.server" { /* Hosts that are IPv6 addresses must be in :: shortened form * if applicable. Addresses starting with a colon get an extra * zero prepended, for example: 0::1 @@ -625,8 +625,8 @@ cluster { * all - share all of the above */ - /* share klines/unklines/xlines with *n */ - name = "*n"; + /* share klines/unklines/xlines with *.lan */ + name = "*.lan"; flags = kline, unkline, xline; /* share locops with irc.ircd-ratbox.org and ircd.ircd-ratbox.org */ From b22c6f101c74d9859f51aad74d488694d0d1d437 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sun, 13 Mar 2016 00:16:19 -0600 Subject: [PATCH 013/252] rb_dictionary: add functions for uint64_t (long) variables. --- librb/include/rb_dictionary.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 2ae5b7256..d2eb2c633 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -157,6 +157,12 @@ void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void #define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long) (x)) #define RB_UINT_TO_POINTER(x) ((void *) (unsigned long) (uint32_t) (x)) +#define RB_POINTER_TO_LONG(x) ((int64_t) (unsigned long long) (x)) +#define RB_LONG_TO_POINTER(x) ((void *) (unsigned long long) (int64_t) (x)) + +#define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x)) +#define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x)) + static inline int rb_int32cmp(const void *a, const void *b) { return RB_POINTER_TO_INT(b) - RB_POINTER_TO_INT(a); @@ -167,4 +173,14 @@ static inline int rb_uint32cmp(const void *a, const void *b) return RB_POINTER_TO_UINT(b) - RB_POINTER_TO_UINT(a); } +static inline int rb_int64cmp(const void *a, const void *b) +{ + return RB_POINTER_TO_LONG(b) - RB_POINTER_TO_LONG(a); +} + +static inline int rb_uint64cmp(const void *a, const void *b) +{ + return RB_POINER_TO_ULONG(b) - RB_POINTER_TO_ULONG(a); +} + #endif From 1d9925cfb338bef585c6177ed4b788811f6b3e48 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sun, 13 Mar 2016 03:22:41 -0500 Subject: [PATCH 014/252] authd: fix a fallthrough. --- authd/dns.c | 1 + 1 file changed, 1 insertion(+) diff --git a/authd/dns.c b/authd/dns.c index 951a5508a..52e3191cb 100644 --- a/authd/dns.c +++ b/authd/dns.c @@ -216,6 +216,7 @@ submit_dns_answer(const char *reply, bool status, query_type type, void *data) { rb_helper_write(authd_helper, "E %s E %c *", id, type); rb_free(id); + return; } rb_helper_write(authd_helper, "E %s O %c %s", id, type, reply); From 068c6c4a2b67320d0b03e036c262978a01cee585 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sun, 13 Mar 2016 03:23:41 -0500 Subject: [PATCH 015/252] dns: use a dictionary for query storage --- include/dns.h | 13 ++-- ircd/dns.c | 199 ++++++++++++++++++++++---------------------------- ircd/ircd.c | 2 +- 3 files changed, 96 insertions(+), 118 deletions(-) diff --git a/include/dns.h b/include/dns.h index 155bb8430..742b5d7cd 100644 --- a/include/dns.h +++ b/include/dns.h @@ -34,12 +34,15 @@ extern rb_dlink_list nameservers; typedef void (*DNSCB)(const char *res, int status, int aftype, void *data); typedef void (*DNSLISTCB)(int resc, const char *resv[], int status, void *data); -uint16_t lookup_hostname(const char *hostname, int aftype, DNSCB callback, void *data); -uint16_t lookup_ip(const char *hostname, int aftype, DNSCB callback, void *data); -void cancel_lookup(uint16_t xid); +uint32_t lookup_hostname(const char *hostname, int aftype, DNSCB callback, void *data); +uint32_t lookup_ip(const char *hostname, int aftype, DNSCB callback, void *data); +void cancel_lookup(uint32_t xid); +void cancel_dns_stats(uint32_t xid); + void dns_results_callback(const char *callid, const char *status, const char *aftype, const char *results); void dns_stats_results_callback(const char *callid, const char *status, int resc, const char *resv[]); -void init_nameserver_cache(void); -bool reload_nameservers(void); + +void init_dns(void); +void reload_nameservers(void); #endif diff --git a/ircd/dns.c b/ircd/dns.c index 055c6b339..67776e667 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -45,8 +45,8 @@ #define DNS_REVERSE_IPV4 ((char)'R') #define DNS_REVERSE_IPV6 ((char)'S') -static void submit_dns(uint16_t uid, char type, const char *addr); -static void submit_dns_stat(uint16_t uid); +static void submit_dns(uint32_t uid, char type, const char *addr); +static void submit_dns_stat(uint32_t uid); struct dnsreq { @@ -60,55 +60,24 @@ struct dnsstatreq void *data; }; -static struct dnsreq querytable[DNS_IDTABLE_SIZE]; -static struct dnsstatreq stattable[DNS_STATTABLE_SIZE]; +/* These serve as a form of sparse array */ +static struct Dictionary *query_dict; +static struct Dictionary *stat_dict; + rb_dlink_list nameservers; +static uint32_t query_id = 0; +static uint32_t stat_id = 0; -static uint16_t -assign_dns_id(void) -{ - static uint16_t id = 1; - int loopcnt = 0; - while(1) - { - if(++loopcnt > DNS_IDTABLE_SIZE) - return 0; - if(id < DNS_IDTABLE_SIZE - 1 || id == 0) - id++; - else - id = 1; - if(querytable[id].callback == NULL) - break; - } - return (id); -} +#define ASSIGN_ID(id) (id++) -static uint8_t -assign_dns_stat_id(void) -{ - static uint8_t id = 1; - int loopcnt = 0; - while(1) - { - if(++loopcnt > DNS_STATTABLE_SIZE) - return 0; - if(id < DNS_STATTABLE_SIZE - 1 || id == 0) - id++; - else - id = 1; - if(stattable[id].callback == NULL) - break; - } - return (id); -} static void -handle_dns_failure(uint16_t xid) +handle_dns_failure(uint32_t xid) { - struct dnsreq *req; + struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid)); + s_assert(req); - req = &querytable[xid]; if(req->callback == NULL) return; @@ -118,47 +87,49 @@ handle_dns_failure(uint16_t xid) } static void -handle_dns_stat_failure(uint8_t xid) +handle_dns_stat_failure(uint32_t xid) { - struct dnsstatreq *req; - const char *err[] = { "Unknown failure" }; + struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid)); + s_assert(req); - req = &stattable[xid]; if(req->callback == NULL) return; - req->callback(1, err, 2, req->data); + req->callback(1, NULL, 2, req->data); + req->callback = NULL; + req->data = NULL; +} + +void +cancel_lookup(uint32_t xid) +{ + struct dnsreq *req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(xid)); + s_assert(req); req->callback = NULL; req->data = NULL; } void -cancel_lookup(uint16_t xid) +cancel_dns_stats(uint32_t xid) { - querytable[xid].callback = NULL; - querytable[xid].data = NULL; + struct dnsstatreq *req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(xid)); + s_assert(req); + req->callback = NULL; + req->data = NULL; } -void -cancel_dns_stats(uint16_t xid) -{ - stattable[xid].callback = NULL; - stattable[xid].data = NULL; -} -uint16_t +uint32_t lookup_hostname(const char *hostname, int aftype, DNSCB callback, void *data) { - struct dnsreq *req; + struct dnsreq *req = rb_malloc(sizeof(struct dnsreq)); int aft; - uint16_t nid; - check_authd(); - nid = assign_dns_id(); - if((nid = assign_dns_id()) == 0) - return 0; + uint32_t rid = ASSIGN_ID(query_id); - req = &querytable[nid]; + check_authd(); + + rb_dictionary_add(query_dict, RB_UINT_TO_POINTER(rid), req); req->callback = callback; req->data = data; @@ -170,22 +141,20 @@ lookup_hostname(const char *hostname, int aftype, DNSCB callback, void *data) #endif aft = 4; - submit_dns(nid, aft == 4 ? DNS_HOST_IPV4 : DNS_HOST_IPV6, hostname); - return (nid); + submit_dns(rid, aft == 4 ? DNS_HOST_IPV4 : DNS_HOST_IPV6, hostname); + return (rid); } -uint16_t +uint32_t lookup_ip(const char *addr, int aftype, DNSCB callback, void *data) { - struct dnsreq *req; + struct dnsreq *req = rb_malloc(sizeof(struct dnsreq)); int aft; - uint16_t nid; + uint32_t rid = ASSIGN_ID(query_id); + check_authd(); - if((nid = assign_dns_id()) == 0) - return 0; - - req = &querytable[nid]; + rb_dictionary_add(query_dict, RB_UINT_TO_POINTER(rid), req); req->callback = callback; req->data = data; @@ -197,41 +166,45 @@ lookup_ip(const char *addr, int aftype, DNSCB callback, void *data) #endif aft = 4; - submit_dns(nid, aft == 4 ? DNS_REVERSE_IPV4 : DNS_REVERSE_IPV6, addr); - return (nid); + submit_dns(rid, aft == 4 ? DNS_REVERSE_IPV4 : DNS_REVERSE_IPV6, addr); + return (rid); } -uint8_t +uint32_t get_nameservers(DNSLISTCB callback, void *data) { - struct dnsstatreq *req; - uint8_t nid; + struct dnsstatreq *req = rb_malloc(sizeof(struct dnsstatreq)); + uint32_t qid = ASSIGN_ID(stat_id); + check_authd(); - if((nid = assign_dns_stat_id()) == 0) - return 0; + rb_dictionary_add(stat_dict, RB_UINT_TO_POINTER(qid), req); - req = &stattable[nid]; req->callback = callback; req->data = data; - submit_dns_stat(nid); - return (nid); + submit_dns_stat(qid); + return (qid); } + void dns_results_callback(const char *callid, const char *status, const char *type, const char *results) { struct dnsreq *req; - uint16_t nid; + uint32_t rid; int st; int aft; - long lnid = strtol(callid, NULL, 16); + long lrid = strtol(callid, NULL, 16); - if(lnid > DNS_IDTABLE_SIZE || lnid == 0) + if(lrid > UINT32_MAX) return; - nid = (uint16_t)lnid; - req = &querytable[nid]; + + rid = (uint32_t)lrid; + req = rb_dictionary_retrieve(query_dict, RB_UINT_TO_POINTER(rid)); + if(req == NULL) + return; + st = (*status == 'O'); aft = *type == '6' || *type == 'S' ? 6 : 4; if(req->callback == NULL) @@ -248,22 +221,26 @@ dns_results_callback(const char *callid, const char *status, const char *type, c aft = AF_INET; req->callback(results, st, aft, req->data); - req->callback = NULL; - req->data = NULL; + + rb_free(req); + rb_dictionary_delete(query_dict, RB_UINT_TO_POINTER(rid)); } void dns_stats_results_callback(const char *callid, const char *status, int resc, const char *resv[]) { struct dnsstatreq *req; - uint8_t nid; + uint32_t qid; int st, i; - long lnid = strtol(callid, NULL, 16); + long lqid = strtol(callid, NULL, 16); - if(lnid > DNS_STATTABLE_SIZE || lnid == 0) + if(lqid > UINT32_MAX) return; - nid = (uint8_t)lnid; - req = &stattable[nid]; + + qid = (uint32_t)lqid; + req = rb_dictionary_retrieve(stat_dict, RB_UINT_TO_POINTER(qid)); + + s_assert(req); if(req->callback == NULL) { @@ -286,14 +263,14 @@ dns_stats_results_callback(const char *callid, const char *status, int resc, con } /* Query complete */ - req->callback(resc, resv, st, stattable[nid].data); + req->callback(resc, resv, st, req->data); - req->data = NULL; - req->callback = NULL; + rb_free(req); + rb_dictionary_delete(stat_dict, RB_UINT_TO_POINTER(qid)); } static void -get_nameservers_cb(int resc, const char *resv[], int status, void *data) +stats_results_callback(int resc, const char *resv[], int status, void *data) { if(status == 0) { @@ -316,28 +293,26 @@ get_nameservers_cb(int resc, const char *resv[], int status, void *data) } } + void -init_nameserver_cache(void) +init_dns(void) { - (void)get_nameservers(get_nameservers_cb, NULL); + query_dict = rb_dictionary_create("dns queries", rb_uint32cmp); + stat_dict = rb_dictionary_create("dns stat queries", rb_uint32cmp); + (void)get_nameservers(stats_results_callback, NULL); } -bool +void reload_nameservers(void) { - if(authd_helper == NULL) - { - /* Shit */ - return false; - } + check_authd(); rb_helper_write(authd_helper, "H D"); - init_nameserver_cache(); - return true; + (void)get_nameservers(stats_results_callback, NULL); } static void -submit_dns(uint16_t nid, char type, const char *addr) +submit_dns(uint32_t nid, char type, const char *addr) { if(authd_helper == NULL) { @@ -348,7 +323,7 @@ submit_dns(uint16_t nid, char type, const char *addr) } static void -submit_dns_stat(uint16_t nid) +submit_dns_stat(uint32_t nid) { if(authd_helper == NULL) { diff --git a/ircd/ircd.c b/ircd/ircd.c index c96edb32c..432931dee 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -663,7 +663,7 @@ charybdis_main(int argc, char *argv[]) init_auth(); /* Initialise the auth code */ init_authd(); /* Start up authd. */ - init_nameserver_cache(); /* Get our nameserver cache for STATS a/A */ + init_dns(); /* Start up DNS query system */ privilegeset_set_new("default", "", 0); From 532f83a70a27a2fec2a853637ca3f46aef749073 Mon Sep 17 00:00:00 2001 From: Simon Arlott Date: Mon, 14 Mar 2016 22:38:04 +0000 Subject: [PATCH 016/252] ircd: Don't refer to the IP address as a "netmask" in error messages --- ircd/newconf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ircd/newconf.c b/ircd/newconf.c index ccc7afc0a..a08775980 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -239,7 +239,7 @@ conf_set_serverinfo_vhost(void *data) { if(rb_inet_pton(AF_INET, (char *) data, &ServerInfo.ip.sin_addr) <= 0) { - conf_report_error("Invalid netmask for server IPv4 vhost (%s)", (char *) data); + conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data); return; } ServerInfo.ip.sin_family = AF_INET; @@ -252,7 +252,7 @@ conf_set_serverinfo_vhost6(void *data) #ifdef RB_IPV6 if(rb_inet_pton(AF_INET6, (char *) data, &ServerInfo.ip6.sin6_addr) <= 0) { - conf_report_error("Invalid netmask for server IPv6 vhost (%s)", (char *) data); + conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data); return; } @@ -1325,7 +1325,7 @@ conf_set_connect_vhost(void *data) { if(rb_inet_pton_sock(data, (struct sockaddr *)&yy_server->my_ipnum) <= 0) { - conf_report_error("Invalid netmask for server vhost (%s)", + conf_report_error("Invalid IP address for server connect vhost (%s)", (char *) data); return; } From 617144af7a26e3ce7fe9b0a853f5a2bbdf092422 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 14 Mar 2016 22:15:28 -0500 Subject: [PATCH 017/252] dns: remove unneeded defines --- ircd/dns.c | 3 --- librb/include/rb_dictionary.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ircd/dns.c b/ircd/dns.c index 67776e667..a4615351b 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -37,9 +37,6 @@ #include "msg.h" #include "hash.h" -#define DNS_IDTABLE_SIZE 0x2000 -#define DNS_STATTABLE_SIZE 0x10 - #define DNS_HOST_IPV4 ((char)'4') #define DNS_HOST_IPV6 ((char)'6') #define DNS_REVERSE_IPV4 ((char)'R') diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index d2eb2c633..8008f9324 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -180,7 +180,7 @@ static inline int rb_int64cmp(const void *a, const void *b) static inline int rb_uint64cmp(const void *a, const void *b) { - return RB_POINER_TO_ULONG(b) - RB_POINTER_TO_ULONG(a); + return RB_POINTER_TO_ULONG(b) - RB_POINTER_TO_ULONG(a); } #endif From 4598135e449a136a726babb999d4956f0cb073f8 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 17 Mar 2016 14:48:46 -0500 Subject: [PATCH 018/252] mailmap: Sam is Christine now apparently. --- .mailmap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index ea4a51281..0c7637e72 100644 --- a/.mailmap +++ b/.mailmap @@ -17,5 +17,5 @@ Valeriy Yatsko Valeriy Yatsko William Pitcock William Pitcock nenolod -Sam Dodrill -Sam Dodrill +Christine Dodrill +Christine Dodrill From 2b0cc3d36a1c494bec926b4d087e3fe9240a94e9 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 17 Mar 2016 16:23:27 -0500 Subject: [PATCH 019/252] Redo of the authd-framework branch. This is basically most of the code from the authd-framework branch, but written to the new DNS code in master. Not quite done yet but getting there. --- authd/Makefile.am | 9 +- authd/dns.c | 31 ++-- authd/dns.h | 2 +- authd/provider.c | 245 +++++++++++++++++++++++++ authd/provider.h | 114 ++++++++++++ authd/providers/ident.c | 392 ++++++++++++++++++++++++++++++++++++++++ authd/providers/rdns.c | 210 +++++++++++++++++++++ 7 files changed, 986 insertions(+), 17 deletions(-) create mode 100644 authd/provider.c create mode 100644 authd/provider.h create mode 100644 authd/providers/ident.c create mode 100644 authd/providers/rdns.c diff --git a/authd/Makefile.am b/authd/Makefile.am index e1b705e14..fd8299e65 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -2,6 +2,13 @@ pkglibexec_PROGRAMS = authd AM_CFLAGS=$(WARNFLAGS) AM_CPPFLAGS = -I../include -I../librb/include +authd_SOURCES = \ + authd.c \ + res.c \ + reslib.c \ + dns.c \ + provider.c \ + providers/rdns.c \ + providers/ident.c -authd_SOURCES = authd.c res.c reslib.c dns.c authd_LDADD = ../librb/src/librb.la diff --git a/authd/dns.c b/authd/dns.c index 52e3191cb..198a4ad32 100644 --- a/authd/dns.c +++ b/authd/dns.c @@ -69,9 +69,10 @@ lookup_ip(const char *host, int aftype, DNSCB callback, void *data) /* See lookup_ip's comment */ struct dns_query * -lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data) +lookup_hostname(const char *ip, DNSCB callback, void *data) { struct dns_query *query = rb_malloc(sizeof(struct dns_query)); + int aftype; if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr)) { @@ -79,6 +80,8 @@ lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data) return NULL; } + aftype = GET_SS_FAMILY(&query->addr); + if(aftype == AF_INET) query->type = QUERY_PTR_A; #ifdef RB_IPV6 @@ -121,10 +124,10 @@ handle_lookup_ip_reply(void *data, struct DNSReply *reply) if(!query) /* Shouldn't happen */ exit(2); - + type = query->type; - if(!reply) + if(reply == NULL) goto end; switch(query->type) @@ -165,13 +168,13 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply) char *hostname = NULL; query_type type = QUERY_INVALID; - if(!query) + if(query == NULL) /* Shouldn't happen */ exit(4); type = query->type; - if(!reply) + if(reply == NULL) goto end; if(query->type == QUERY_PTR_A) @@ -180,7 +183,7 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply) ip = (struct sockaddr_in *) &query->addr; ip_fwd = (struct sockaddr_in *) &reply->addr; - if(ip->sin_addr.s_addr == ip_fwd->sin_addr.s_addr && strlen(reply->h_name) < 63) + if(ip->sin_addr.s_addr == ip_fwd->sin_addr.s_addr) hostname = reply->h_name; } #ifdef RB_IPV6 @@ -190,7 +193,7 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply) ip = (struct sockaddr_in6 *) &query->addr; ip_fwd = (struct sockaddr_in6 *) &reply->addr; - if(memcmp(&ip->sin6_addr, &ip_fwd->sin6_addr, sizeof(struct in6_addr)) == 0 && strlen(reply->h_name) < 63) + if(memcmp(&ip->sin6_addr, &ip_fwd->sin6_addr, sizeof(struct in6_addr)) == 0) hostname = reply->h_name; } #endif @@ -212,7 +215,7 @@ submit_dns_answer(const char *reply, bool status, query_type type, void *data) if(!id || type == QUERY_INVALID) exit(6); - if(!reply || !status) + if(reply == NULL || status == false) { rb_helper_write(authd_helper, "E %s E %c *", id, type); rb_free(id); @@ -243,10 +246,9 @@ resolve_dns(int parc, char *parv[]) break; #ifdef RB_IPV6 case 'S': - aftype = AF_INET6; #endif case 'R': - if(!lookup_hostname(record, aftype, submit_dns_answer, id)) + if(!lookup_hostname(record, submit_dns_answer, id)) submit_dns_answer(NULL, false, qtype, NULL); break; default: @@ -257,7 +259,7 @@ resolve_dns(int parc, char *parv[]) void enumerate_nameservers(const char *rid, const char letter) { - char buf[40 * IRCD_MAXNS]; /* Plenty */ + char buf[(HOSTIPLEN + 1) * IRCD_MAXNS]; char *c = buf; int i; @@ -270,8 +272,7 @@ enumerate_nameservers(const char *rid, const char letter) for(i = 0; i < irc_nscount; i++) { - char addr[40]; - int ret; + char addr[HOSTIPLEN]; rb_inet_ntop_sock((struct sockaddr *)&irc_nsaddr_list[i], addr, sizeof(addr)); @@ -282,8 +283,8 @@ enumerate_nameservers(const char *rid, const char letter) return; } - ret = snprintf(c, 40, "%s ", addr); - c += (size_t)ret; + (void)snprintf(c, HOSTIPLEN + 1, "%s ", addr); + c += strlen(addr) + 1; } *(--c) = '\0'; diff --git a/authd/dns.h b/authd/dns.h index 4a977b280..a21d98585 100644 --- a/authd/dns.h +++ b/authd/dns.h @@ -50,7 +50,7 @@ struct dns_query void *data; }; -extern struct dns_query *lookup_hostname(const char *ip, int aftype, DNSCB callback, void *data); +extern struct dns_query *lookup_hostname(const char *ip, DNSCB callback, void *data); extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); extern void cancel_query(struct dns_query *query); diff --git a/authd/provider.c b/authd/provider.c new file mode 100644 index 000000000..fc695bc0f --- /dev/null +++ b/authd/provider.c @@ -0,0 +1,245 @@ +/* authd/provider.c - authentication provider framework + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* So the basic design here is to have "authentication providers" that do + * things like query ident and blacklists and even open proxies. + * + * Providers are registered statically in the struct auth_providers array. You will + * probably want to add an item to the provider_t enum also. + * + * Providers can either return failure immediately, immediate acceptance, or + * do work in the background (calling set_provider to signal this). + * + * It is up to providers to keep their own state on clients if they need to. + * + * All providers must implement at a minimum a perform_provider function. You + * don't have to implement the others if you don't need them. + * + * Providers may kick clients off by rejecting them. Upon rejection, all + * providers are cancelled. They can also unconditionally accept them. + * + * When a provider is done and is neutral on accepting/rejecting a client, it + * should call provider_done. Do NOT call this if you have accepted or rejected + * the client. + * + * --Elizafox, 9 March 2016 + */ + +#include "authd.h" +#include "provider.h" + +rb_dlink_list auth_providers; + +/* Clients waiting */ +struct auth_client auth_clients[MAX_CLIENTS]; + +/* Load a provider */ +void load_provider(struct auth_provider *provider) +{ + provider->init(); + rb_dlinkAdd(provider, &provider->node, &auth_providers); +} + +void unload_provider(struct auth_provider *provider) +{ + provider->destroy(); + rb_dlinkDelete(&provider->node, &auth_providers); +} + +/* Initalise all providers */ +void init_providers(void) +{ + load_provider(&rdns_provider); + load_provider(&ident_provider); +} + +/* Terminate all providers */ +void destroy_providers(void) +{ + rb_dlink_node *ptr; + struct auth_provider *provider; + + /* Cancel outstanding connections */ + for (size_t i = 0; i < MAX_CLIENTS; i++) + { + if(auth_clients[i].cid) + { + /* TBD - is this the right thing? + * (NOTE - this error message is designed for morons) */ + reject_client(&auth_clients[i], 0, true, + "IRC server reloading... try reconnecting in a few seconds"); + } + } + + RB_DLINK_FOREACH(ptr, auth_providers.head) + { + provider = ptr->data; + + if(provider->destroy) + provider->destroy(); + } +} + +/* Cancel outstanding providers for a client */ +void cancel_providers(struct auth_client *auth) +{ + rb_dlink_node *ptr; + struct auth_provider *provider; + + RB_DLINK_FOREACH(ptr, auth_providers.head) + { + provider = ptr->data; + + if(provider->cancel && is_provider(auth, provider->id)) + /* Cancel if required */ + provider->cancel(auth); + } +} + +/* Provider is done */ +void provider_done(struct auth_client *auth, provider_t id) +{ + rb_dlink_node *ptr; + struct auth_provider *provider; + + unset_provider(auth, id); + + if(!auth->providers) + { + /* No more providers, done */ + accept_client(auth, 0); + return; + } + + RB_DLINK_FOREACH(ptr, auth_providers.head) + { + provider = ptr->data; + + if(provider->completed && is_provider(auth, provider->id)) + /* Notify pending clients who asked for it */ + provider->completed(auth, id); + } +} + +/* Reject a client, cancel outstanding providers if any if hard set to true */ +void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason) +{ + uint16_t cid = auth->cid; + char reject; + + switch(id) + { + case PROVIDER_RDNS: + reject = 'D'; + break; + case PROVIDER_IDENT: + reject = 'I'; + break; + case PROVIDER_BLACKLIST: + reject = 'B'; + break; + case PROVIDER_NULL: + default: + reject = 'N'; + break; + } + + rb_helper_write(authd_helper, "R %x %c :%s", auth->cid, reject, reason); + + unset_provider(auth, id); + + if(hard && auth->providers) + { + cancel_providers(auth); + memset(&auth_clients[cid], 0, sizeof(struct auth_client)); + } +} + +/* Accept a client, cancel outstanding providers if any */ +void accept_client(struct auth_client *auth, provider_t id) +{ + uint16_t cid = auth->cid; + + rb_helper_write(authd_helper, "A %x %s %s", auth->cid, auth->username, auth->hostname); + + unset_provider(auth, id); + + if(auth->providers) + cancel_providers(auth); + + memset(&auth_clients[cid], 0, sizeof(struct auth_client)); +} + +/* Send a notice to a client */ +void notice_client(struct auth_client *auth, const char *notice) +{ + rb_helper_write(authd_helper, "N %x :%s", auth->cid, notice); +} + +/* Begin authenticating user */ +static void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port) +{ + struct auth_provider *provider; + struct auth_client *auth; + long lcid = strtol(cid, NULL, 16); + rb_dlink_node *ptr; + + if(lcid >= MAX_CLIENTS) + return; + + auth = &auth_clients[lcid]; + if(auth->cid != 0) + /* Shouldn't get here */ + return; + + auth->cid = (uint16_t)lcid; + + rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip)); + auth->l_port = (uint16_t)atoi(l_port); /* should be safe */ + + rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); + auth->c_port = (uint16_t)atoi(c_port); + + RB_DLINK_FOREACH(ptr, auth_providers.head) + { + provider = ptr->data; + + /* Execute providers */ + if(!provider->start(auth)) + { + /* Rejected immediately */ + cancel_providers(auth); + return; + } + } + + /* If no providers are running, accept the client */ + if(!auth->providers) + accept_client(auth, 0); +} + +/* Callback for the initiation */ +void handle_new_connection(int parc, char *parv[]) +{ + if(parc < 7) + return; + + start_auth(parv[1], parv[2], parv[3], parv[4], parv[5]); +} diff --git a/authd/provider.h b/authd/provider.h new file mode 100644 index 000000000..8ce7e53e6 --- /dev/null +++ b/authd/provider.h @@ -0,0 +1,114 @@ +/* authd/provider.h - authentication provider framework + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __CHARYBDIS_AUTHD_PROVIDER_H__ +#define __CHARYBDIS_AUTHD_PROVIDER_H__ + +#include "stdinc.h" + +/* Arbitrary limit */ +#define MAX_CLIENTS 4096 + +/* Registered providers */ +typedef enum +{ + PROVIDER_NULL = 0x0, /* Dummy value */ + PROVIDER_RDNS = 0x1, + PROVIDER_IDENT = 0x2, + PROVIDER_BLACKLIST = 0x4, +} provider_t; + +struct auth_client +{ + uint16_t cid; /* Client ID */ + + char l_ip[HOSTIPLEN + 1]; /* Listener IP address */ + uint16_t l_port; /* Listener port */ + + char c_ip[HOSTIPLEN + 1]; /* Client IP address */ + uint16_t c_port; /* Client port */ + + char hostname[HOSTLEN + 1]; /* Used for DNS lookup */ + char username[USERLEN + 1]; /* Used for ident lookup */ + + unsigned int providers; /* Providers at work, + * none left when set to 0 */ +}; + +typedef bool (*provider_init_t)(void); +typedef bool (*provider_perform_t)(struct auth_client *); +typedef void (*provider_complete_t)(struct auth_client *, provider_t provider); +typedef void (*provider_cancel_t)(struct auth_client *); +typedef void (*provider_destroy_t)(void); + +struct auth_provider +{ + rb_dlink_node node; + + provider_t id; + + provider_init_t init; /* Initalise the provider */ + provider_destroy_t destroy; /* Terminate the provider */ + + provider_perform_t start; /* Perform authentication */ + provider_cancel_t cancel; /* Authentication cancelled */ + provider_complete_t completed; /* Callback for when other performers complete (think dependency chains) */ +}; + +extern rb_dlink_list auth_providers; +extern struct auth_provider rdns_provider; +extern struct auth_provider ident_provider; + +extern struct auth_client auth_clients[MAX_CLIENTS]; + +void load_provider(struct auth_provider *provider); +void unload_provider(struct auth_provider *provider); + +void init_providers(void); +void destroy_providers(void); +void cancel_providers(struct auth_client *auth); + +void provider_done(struct auth_client *auth, provider_t id); +void accept_client(struct auth_client *auth, provider_t id); +void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason); + +void notice_client(struct auth_client *auth, const char *notice); + +void handle_new_connection(int parc, char *parv[]); + +/* Provider is operating on this auth_client (set this if you have async work to do) */ +static inline void set_provider(struct auth_client *auth, provider_t provider) +{ + auth->providers |= provider; +} + +/* Provider is no longer operating on this auth client (you should use provider_done) */ +static inline void unset_provider(struct auth_client *auth, provider_t provider) +{ + auth->providers &= ~provider; +} + +/* Check if provider is operating on this auth client */ +static inline bool is_provider(struct auth_client *auth, provider_t provider) +{ + return auth->providers & provider; +} + +#endif /* __CHARYBDIS_AUTHD_PROVIDER_H__ */ diff --git a/authd/providers/ident.c b/authd/providers/ident.c new file mode 100644 index 000000000..d633d1726 --- /dev/null +++ b/authd/providers/ident.c @@ -0,0 +1,392 @@ +/* authd/providers/ident.c - ident lookup provider for authd + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "stdinc.h" +#include "match.h" +#include "authd.h" +#include "provider.h" +#include "res.h" + +#define IDENT_BUFSIZE 128 + +struct ident_query +{ + rb_dlink_node node; + + struct auth_client *auth; /* Our client */ + time_t timeout; /* Timeout interval */ + rb_fde_t *F; /* Our FD */ +}; + +/* Goinked from old s_auth.c --Elizafox */ +static const char *messages[] = +{ + ":*** Checking Ident", + ":*** Got Ident response", + ":*** No Ident response", +}; + +typedef enum +{ + REPORT_LOOKUP, + REPORT_FOUND, + REPORT_FAIL, +} ident_message; + +static EVH timeout_ident_queries_event; +static CNCB ident_connected; +static PF read_ident_reply; + +static void client_fail(struct ident_query *query, ident_message message); +static void client_success(struct ident_query *query); +static void cleanup_query(struct ident_query *query); +static char * get_valid_ident(char *buf); + +static rb_dlink_list queries; +static struct ev_entry *timeout_ev; +static int ident_timeout = 5; + + +bool ident_init(void) +{ + timeout_ev = rb_event_addish("timeout_ident_queries_event", timeout_ident_queries_event, NULL, 1); + return (timeout_ev != NULL); +} + +void ident_destroy(void) +{ + rb_dlink_node *ptr, *nptr; + + /* Nuke all ident queries */ + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + struct ident_query *query = ptr->data; + + notice_client(query->auth, messages[REPORT_FAIL]); + + rb_close(query->F); + rb_free(query); + rb_dlinkDelete(ptr, &queries); + } +} + +bool ident_start(struct auth_client *auth) +{ + struct ident_query *query = rb_malloc(sizeof(struct ident_query)); + struct rb_sockaddr_storage l_addr, c_addr; + int family; + rb_fde_t *F; + + query->auth = auth; + query->timeout = rb_current_time() + ident_timeout; + + if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL) + { + client_fail(query, REPORT_FAIL); + return true; /* Not a fatal error */ + } + + query->F = F; + + /* Build sockaddr_storages for rb_connect_tcp below */ + if(!rb_inet_ntop_sock((struct sockaddr *)&l_addr, auth->l_ip, sizeof(l_addr)) || + !rb_inet_ntop_sock((struct sockaddr *)&c_addr, auth->c_ip, sizeof(c_addr))) + { + client_fail(query, REPORT_FAIL); + return true; + } + + /* Set the ports correctly */ +#ifdef RB_IPV6 + if(GET_SS_FAMILY(&l_addr) == AF_INET6) + ((struct sockaddr_in6 *)&l_addr)->sin6_port = 0; + else +#endif + ((struct sockaddr_in *)&l_addr)->sin_port = 0; + +#ifdef RB_IPV6 + if(GET_SS_FAMILY(&c_addr) == AF_INET6) + ((struct sockaddr_in6 *)&c_addr)->sin6_port = htons(113); + else +#endif + ((struct sockaddr_in *)&c_addr)->sin_port = htons(113); + + rb_connect_tcp(F, (struct sockaddr *)&c_addr, + (struct sockaddr *)&l_addr, + GET_SS_LEN(&l_addr), ident_connected, + query, ident_timeout); + + rb_dlinkAdd(query, &query->node, &queries); + + set_provider(auth, PROVIDER_IDENT); + notice_client(auth, messages[REPORT_LOOKUP]); + + return true; +} + +void ident_cancel(struct auth_client *auth) +{ + rb_dlink_node *ptr, *nptr; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + struct ident_query *query = ptr->data; + + if(query->auth == auth) + { + client_fail(query, REPORT_FAIL); + + rb_close(query->F); + rb_free(query); + rb_dlinkDelete(ptr, &queries); + + return; + } + } +} + +/* Timeout outstanding queries */ +static void timeout_ident_queries_event(void *notused) +{ + rb_dlink_node *ptr, *nptr; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + struct ident_query *query = ptr->data; + + if(query->timeout < rb_current_time()) + { + client_fail(query, REPORT_FAIL); + + rb_close(query->F); + rb_free(query); + rb_dlinkDelete(ptr, &queries); + } + } +} + +/* + * ident_connected() - deal with the result of rb_connect_tcp() + * + * If the connection failed, we simply close the auth fd and report + * a failure. If the connection suceeded send the ident server a query + * giving "theirport , ourport". The write is only attempted *once* so + * it is deemed to be a fail if the entire write doesn't write all the + * data given. This shouldnt be a problem since the socket should have + * a write buffer far greater than this message to store it in should + * problems arise. -avalon + */ +static void ident_connected(rb_fde_t *F, int error, void *data) +{ + struct ident_query *query = data; + struct auth_client *auth = query->auth; + char authbuf[32]; + int authlen; + + /* Check the error */ + if(error != RB_OK) + { + /* We had an error during connection :( */ + client_fail(query, REPORT_FAIL); + cleanup_query(query); + return; + } + + snprintf(authbuf, sizeof(authbuf), "%u , %u\r\n", + auth->c_port, auth->l_port); + authlen = strlen(authbuf); + + if(rb_write(query->F, authbuf, authlen) != authlen) + { + client_fail(query, REPORT_FAIL); + return; + } + + read_ident_reply(query->F, query); +} + +static void +read_ident_reply(rb_fde_t *F, void *data) +{ + struct ident_query *query = data; + struct auth_client *auth = query->auth; + char *s = NULL; + char *t = NULL; + int len; + int count; + char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */ + + len = rb_read(F, buf, IDENT_BUFSIZE); + if(len < 0 && rb_ignore_errno(errno)) + { + rb_setselect(F, RB_SELECT_READ, read_ident_reply, query); + return; + } + + if(len > 0) + { + buf[len] = '\0'; + + if((s = get_valid_ident(buf))) + { + t = auth->username; + + while (*s == '~' || *s == '^') + s++; + + for (count = USERLEN; *s && count; s++) + { + if(*s == '@') + { + break; + } + if(*s != ' ' && *s != ':' && *s != '[') + { + *t++ = *s; + count--; + } + } + *t = '\0'; + } + } + + if(s == NULL) + client_fail(query, REPORT_FAIL); + else + client_success(query); + + cleanup_query(query); +} + +static void client_fail(struct ident_query *query, ident_message report) +{ + struct auth_client *auth = query->auth; + + if(auth) + { + rb_strlcpy(auth->username, "*", sizeof(auth->username)); + notice_client(auth, messages[report]); + provider_done(auth, PROVIDER_IDENT); + } +} + +static void client_success(struct ident_query *query) +{ + struct auth_client *auth = query->auth; + + if(auth) + { + notice_client(auth, messages[REPORT_FOUND]); + provider_done(auth, PROVIDER_IDENT); + } +} + +static void cleanup_query(struct ident_query *query) +{ + rb_dlink_node *ptr, *nptr; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + struct ident_query *query_l = ptr->data; + + if(query_l == query) + { + rb_close(query->F); + rb_free(query); + rb_dlinkDelete(ptr, &queries); + } + } +} + +/* get_valid_ident + * parse ident query reply from identd server + * + * Torn out of old s_auth.c because there was nothing wrong with it + * --Elizafox + * + * Inputs - pointer to ident buf + * Outputs - NULL if no valid ident found, otherwise pointer to name + * Side effects - None + */ +static char * +get_valid_ident(char *buf) +{ + int remp = 0; + int locp = 0; + char *colon1Ptr; + char *colon2Ptr; + char *colon3Ptr; + char *commaPtr; + char *remotePortString; + + /* All this to get rid of a sscanf() fun. */ + remotePortString = buf; + + colon1Ptr = strchr(remotePortString, ':'); + if(!colon1Ptr) + return 0; + + *colon1Ptr = '\0'; + colon1Ptr++; + colon2Ptr = strchr(colon1Ptr, ':'); + if(!colon2Ptr) + return 0; + + *colon2Ptr = '\0'; + colon2Ptr++; + commaPtr = strchr(remotePortString, ','); + + if(!commaPtr) + return 0; + + *commaPtr = '\0'; + commaPtr++; + + remp = atoi(remotePortString); + if(!remp) + return 0; + + locp = atoi(commaPtr); + if(!locp) + return 0; + + /* look for USERID bordered by first pair of colons */ + if(!strstr(colon1Ptr, "USERID")) + return 0; + + colon3Ptr = strchr(colon2Ptr, ':'); + if(!colon3Ptr) + return 0; + + *colon3Ptr = '\0'; + colon3Ptr++; + return (colon3Ptr); +} + + +struct auth_provider ident_provider = +{ + .id = PROVIDER_IDENT, + .init = ident_init, + .destroy = ident_destroy, + .start = ident_start, + .cancel = ident_cancel, + .completed = NULL, +}; diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c new file mode 100644 index 000000000..0a3c2e5e0 --- /dev/null +++ b/authd/providers/rdns.c @@ -0,0 +1,210 @@ +/* authd/providers/rdns.c - rDNS lookup provider for authd + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "stdinc.h" +#include "rb_commio.h" +#include "authd.h" +#include "provider.h" +#include "res.h" +#include "dns.h" + +struct user_query +{ + rb_dlink_node node; + + struct auth_client *auth; /* Our client */ + struct dns_query *query; /* Pending DNS query */ + time_t timeout; /* When the request times out */ +}; + +/* Goinked from old s_auth.c --Elizabeth */ +static const char *messages[] = +{ + "*** Looking up your hostname...", + "*** Found your hostname", + "*** Couldn't look up your hostname", + "*** Your hostname is too long, ignoring hostname", +}; + +typedef enum +{ + REPORT_LOOKUP, + REPORT_FOUND, + REPORT_FAIL, + REPORT_TOOLONG, +} dns_message; + +static void client_fail(struct user_query *query, dns_message message); +static void client_success(struct user_query *query); +static void get_dns_answer(const char *res, bool status, query_type type, void *data); + +static struct ev_entry *timeout_ev; +static EVH timeout_dns_queries_event; +static int rdns_timeout = 30; +static rb_dlink_list queries; /* Stored here for easy timeout */ + + +bool client_dns_init(void) +{ + timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 5); + return (timeout_ev != NULL); +} + +void client_dns_destroy(void) +{ + rb_dlink_node *ptr, *nptr; + struct user_query *query; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + client_fail(ptr->data, REPORT_FAIL); + rb_dlinkDelete(ptr, &queries); + rb_free(ptr); + } + + rb_event_delete(timeout_ev); +} + +bool client_dns_start(struct auth_client *auth) +{ + struct user_query *query = rb_malloc(sizeof(struct user_query)); + + query->auth = auth; + query->timeout = rb_current_time() + rdns_timeout; + + query->query = lookup_hostname(auth->c_ip, get_dns_answer, query); + + notice_client(auth, messages[REPORT_LOOKUP]); + set_provider(auth, PROVIDER_RDNS); + return true; +} + +void client_dns_cancel(struct auth_client *auth) +{ + rb_dlink_node *ptr, *nptr; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + struct user_query *query = ptr->data; + + if(query->auth == auth) + { + /* Victim found */ + client_fail(query, REPORT_FAIL); + rb_dlinkDelete(ptr, &queries); + rb_free(query); + return; + } + } +} + +static void +get_dns_answer(const char *res, bool status, query_type type, void *data) +{ + struct user_query *query = data; + struct auth_client *auth = query->auth; + bool fail = false; + dns_message response; + rb_dlink_node *ptr, *nptr; + + if(res == NULL || status == false) + { + response = REPORT_FAIL; + fail = true; + goto cleanup; + } + else if(strlen(res) > HOSTLEN) + { + /* Ah well. */ + response = REPORT_TOOLONG; + fail = true; + goto cleanup; + } + + rb_strlcpy(auth->hostname, res, HOSTLEN + 1); + +cleanup: + /* Clean us up off the pending queries list */ + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + struct user_query *query_l = ptr->data; + + if(query == query_l) + { + /* Found */ + if(fail) + client_fail(query, response); + else + client_success(query); + + rb_dlinkDelete(ptr, &queries); + rb_free(query); + return; + } + } +} + +/* Timeout outstanding queries */ +static void timeout_dns_queries_event(void *notused) +{ + rb_dlink_node *ptr, *nptr; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + { + struct user_query *query = ptr->data; + + if(query->auth && query->timeout < rb_current_time()) + { + client_fail(query, REPORT_FAIL); + rb_dlinkDelete(ptr, &queries); + rb_free(query); + return; + } + } +} + +static void client_fail(struct user_query *query, dns_message report) +{ + struct auth_client *auth = query->auth; + + rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname)); + notice_client(auth, messages[report]); + cancel_query(query->query); + provider_done(auth, PROVIDER_RDNS); +} + +static void client_success(struct user_query *query) +{ + struct auth_client *auth = query->auth; + + notice_client(auth, messages[REPORT_FOUND]); + cancel_query(query->query); + provider_done(auth, PROVIDER_RDNS); +} + +struct auth_provider rdns_provider = +{ + .id = PROVIDER_RDNS, + .init = client_dns_init, + .destroy = client_dns_destroy, + .start = client_dns_start, + .cancel = client_dns_cancel, + .completed = NULL, +}; From a16b484f275a1888d46061ccb507fa90a04cbd1b Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 17 Mar 2016 16:25:58 -0500 Subject: [PATCH 020/252] Import this from authd-framework branch --- authd/authd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authd/authd.c b/authd/authd.c index 623368330..bb01be828 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -20,6 +20,7 @@ #include "authd.h" #include "dns.h" +#include "provider.h" #define MAXPARA 10 @@ -28,8 +29,9 @@ static void handle_stat(int parc, char *parv[]); rb_helper *authd_helper = NULL; authd_cmd_handler authd_cmd_handlers[256] = { - ['H'] = handle_reload, + ['C'] = handle_new_connection, ['D'] = resolve_dns, + ['H'] = handle_reload, ['S'] = handle_stat, }; @@ -151,6 +153,7 @@ main(int argc, char *argv[]) rb_set_time(); setup_signals(); init_resolver(); + init_providers(); rb_init_prng(NULL, RB_PRNG_DEFAULT); rb_helper_loop(authd_helper, 0); From 1ca8cd5276b484ac5dae354f076b06abd70a28cd Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 17 Mar 2016 23:12:43 -0500 Subject: [PATCH 021/252] parse: ensure that aliases have a sufficient number of parameters before trying to process them --- ircd/parse.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ircd/parse.c b/ircd/parse.c index b1e57bffe..6e4189f9b 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -146,6 +146,15 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) struct alias_entry *aptr = rb_dictionary_retrieve(alias_dict, msgbuf.cmd); if (aptr != NULL) { + if (msgbuf.n_para < 2) + { + sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), + me.name, + EmptyString(client_p->name) ? "*" : client_p->name, + msgbuf.cmd); + return; + } + do_alias(aptr, client_p, reconstruct_parv(msgbuf.n_para - 1, msgbuf.para + 1)); return; } From c2c236234ebd2bf7ec9dc6eb373904fcd829292a Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 14:35:21 -0500 Subject: [PATCH 022/252] Remove aclocal.m4 --- aclocal.m4 | 11228 --------------------------------------------------- 1 file changed, 11228 deletions(-) delete mode 100644 aclocal.m4 diff --git a/aclocal.m4 b/aclocal.m4 deleted file mode 100644 index a0a793943..000000000 --- a/aclocal.m4 +++ /dev/null @@ -1,11228 +0,0 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- - -# Copyright (C) 1996-2014 Free Software Foundation, Inc. - -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 2014 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program or library that is built -# using GNU Libtool, you may include this file under the same -# distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -]) - -# serial 58 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS=$ltmain - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_PREPARE_CC_BASENAME -# ----------------------- -m4_defun([_LT_PREPARE_CC_BASENAME], [ -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in @S|@*""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} -])# _LT_PREPARE_CC_BASENAME - - -# _LT_CC_BASENAME(CC) -# ------------------- -# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, -# but that macro is also expanded into generated libtool script, which -# arranges for $SED and $ECHO to be set by different means. -m4_defun([_LT_CC_BASENAME], -[m4_require([_LT_PREPARE_CC_BASENAME])dnl -AC_REQUIRE([_LT_DECL_SED])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl -func_cc_basename $1 -cc_basename=$func_cc_basename_result -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl -dnl -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl -m4_require([_LT_CMD_TRUNCATE])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options that allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test set != "${COLLECT_NAMES+set}"; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld=$lt_cv_prog_gnu_ld - -old_CC=$CC -old_CFLAGS=$CFLAGS - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from 'configure', and 'config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# 'config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain=$ac_aux_dir/ltmain.sh -])# _LT_PROG_LTMAIN - - - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the 'libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to 'config.status' so that its -# declaration there will have the same value as in 'configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags='_LT_TAGS'dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into 'config.status', and then the shell code to quote escape them in -# for loops in 'config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# '#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test 0 = "$lt_write_fail" && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -'$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2011 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test 0 != $[#] -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try '$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try '$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test yes = "$silent" && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options that allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}"; then - setopt NO_GLOB_SUBST - fi - - cfgfile=${ofile}T - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL -# Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. - -# Provide generalized library-building support services. -# Written by Gordon Matzigkeit, 1996 - -_LT_COPYING -_LT_LIBTOOL_TAGS - -# Configured defaults for sys_lib_dlsearch_path munging. -: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - cat <<'_LT_EOF' >> "$cfgfile" - -# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE - -_LT_PREPARE_MUNGE_PATH_LIST -_LT_PREPARE_CC_BASENAME - -# ### END FUNCTIONS SHARED WITH CONFIGURE - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test set != "${COLLECT_NAMES+set}"; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Go], [_LT_LANG(GO)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -m4_ifndef([AC_PROG_GO], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_GO. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -m4_defun([AC_PROG_GO], -[AC_LANG_PUSH(Go)dnl -AC_ARG_VAR([GOC], [Go compiler command])dnl -AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl -_AC_ARG_VAR_LDFLAGS()dnl -AC_CHECK_TOOL(GOC, gccgo) -if test -z "$GOC"; then - if test -n "$ac_tool_prefix"; then - AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) - fi -fi -if test -z "$GOC"; then - AC_CHECK_PROG(GOC, gccgo, gccgo, false) -fi -])#m4_defun -])#m4_ifndef - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([AC_PROG_GO], - [LT_LANG(GO)], - [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "$LT_MULTI_MODULE"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test 0 = "$_lt_result"; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS=$save_LDFLAGS - ]) - - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - 10.[[012]][[,.]]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test yes = "$lt_cv_apple_cc_single_mod"; then - _lt_dar_single_mod='$single_module' - fi - if test yes = "$lt_cv_ld_exported_symbols_list"; then - _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' - fi - if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES([TAG]) -# --------------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test yes = "$lt_cv_ld_force_load"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], - [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined - case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test yes = "$_lt_dar_can_shared"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" - m4_if([$1], [CXX], -[ if test yes != "$lt_cv_apple_cc_single_mod"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -if test set = "${lt_cv_aix_libpath+set}"; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script that will find a shell with a builtin -# printf (that we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case $ECHO in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], - [Search for dependent libraries within DIR (or the compiler's sysroot - if not specified).])], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case $with_sysroot in #( - yes) - if test yes = "$GCC"; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([$with_sysroot]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and where our libraries should be installed.])]) - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test no = "$enable_libtool_lock" || enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out what ABI is being produced by ac_compile, and set mode - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE=32 - ;; - *ELF-64*) - HPUX_IA64_MODE=64 - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test yes = "$lt_cv_prog_gnu_ld"; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -mips64*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - emul=elf - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - emul="${emul}32" - ;; - *64-bit*) - emul="${emul}64" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *MSB*) - emul="${emul}btsmip" - ;; - *LSB*) - emul="${emul}ltsmip" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *N32*) - emul="${emul}n32" - ;; - esac - LD="${LD-ld} -m $emul" - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the - # situations where additional linker options are needed (such as when - # doing 32-bit compilation for a host where ld defaults to 64-bit, or - # vice versa); the common cases where no linker options are needed do - # not appear in the list. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - case `/usr/bin/file conftest.o` in - *x86-64*) - LD="${LD-ld} -m elf32_x86_64" - ;; - *) - LD="${LD-ld} -m elf_i386" - ;; - esac - ;; - powerpc64le-*linux*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - powerpcle-*linux*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test yes != "$lt_cv_cc_needs_belf"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS=$SAVE_CFLAGS - fi - ;; -*-*solaris*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*|x86_64-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD=${LD-ld}_sol2 - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks=$enable_libtool_lock -])# _LT_ENABLE_LOCK - - -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test 0 -eq "$ac_status"; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test 0 -ne "$ac_status"; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test no = "$lt_cv_ar_at_file"; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test yes = "[$]$2"; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS=$save_LDFLAGS -]) - -if test yes = "[$]$2"; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring=ABCD - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n "$lt_cv_sys_max_cmd_len"; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test yes = "$cross_compiling"; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test yes != "$enable_dlopen"; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen=load_add_on - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen=LoadLibrary - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ - lt_cv_dlopen=dyld - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - tpf*) - # Don't try to run any link tests for TPF. We know it's impossible - # because TPF is a cross-compiler, and we know how we open DSOs. - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - lt_cv_dlopen_self=no - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen=shl_load], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen=dlopen], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test no = "$lt_cv_dlopen"; then - enable_dlopen=no - else - enable_dlopen=yes - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS=$CPPFLAGS - test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS=$LDFLAGS - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS=$LIBS - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test yes = "$lt_cv_dlopen_self"; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS=$save_CPPFLAGS - LDFLAGS=$save_LDFLAGS - LIBS=$save_LIBS - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links=nottested -if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test no = "$hard_links"; then - AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", - [Define to the sub-directory where libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then - - # We can hardcode non-existent directories. - if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && - test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || - test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then - # Fast installation is not supported - enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP"; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_PREPARE_MUNGE_PATH_LIST -# --------------------------- -# Make sure func_munge_path_list() is defined correctly. -m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], -[[# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x@S|@2 in - x) - ;; - *:) - eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" - ;; - x:*) - eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" - ;; - *) - eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" - ;; - esac -} -]])# _LT_PREPARE_PATH_LIST - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test yes = "$GCC"; then - case $host_os in - darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; - *) lt_awk_arg='/^libraries:/' ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; - *) lt_sed_strip_eq='s|=/|/|g' ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary... - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - # ...but if some path component already ends with the multilib dir we assume - # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). - case "$lt_multi_os_dir; $lt_search_path_spec " in - "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) - lt_multi_os_dir= - ;; - esac - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" - elif test -n "$lt_multi_os_dir"; then - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS = " "; FS = "/|\n";} { - lt_foo = ""; - lt_count = 0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo = "/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=.so -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -AC_ARG_VAR([LT_SYS_LIBRARY_PATH], -[User-defined run-time library search path.]) - -case $host_os in -aix3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' - ;; - -aix[[4-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then - # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a[(]lib.so.V[)]' - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='$libname$shared_ext' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec=$LIB - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[23]].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2.*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 - fi - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test yes = "$lt_cv_prog_gnu_ld"; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd* | bitrig*) - version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib - need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -os2*) - libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no - need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec; then - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test no = "$dynamic_linker" && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec -fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec -fi - -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec - -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" - -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], - [Detected run-time system search path for libraries]) -_LT_DECL([], [configure_time_lt_sys_library_path], [2], - [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program that can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$1"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD - ;; -esac]) -MAGIC_CMD=$lt_cv_path_MAGIC_CMD -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program that can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test no = "$withval" || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test yes = "$GCC"; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD=$ac_prog - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test yes = "$with_gnu_ld"; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i -cat conftest.i conftest.i >conftest2.i -: ${lt_DD:=$DD} -AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], -[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: -fi]) -rm -f conftest.i conftest2.i conftest.out]) -])# _LT_PATH_DD - - -# _LT_CMD_TRUNCATE -# ---------------- -# find command to truncate a binary pipe -m4_defun([_LT_CMD_TRUNCATE], -[m4_require([_LT_PATH_DD]) -AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], -[printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -lt_cv_truncate_bin= -if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" -fi -rm -f conftest.i conftest2.i conftest.out -test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) -_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], - [Command to truncate a binary pipe]) -])# _LT_CMD_TRUNCATE - - -# _LT_CHECK_MAGIC_METHOD -# ---------------------- -# how to check for library dependencies -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_MAGIC_METHOD], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -AC_CACHE_CHECK([how to recognize dependent libraries], -lt_cv_deplibs_check_method, -[lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# 'unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# that responds to the $file_magic_cmd with a given extended regex. -# If you have 'file' or equivalent on your system and you're not sure -# whether 'pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[[4-9]]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[[45]]*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd* | bitrig*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -os2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM=$NM -else - lt_nm_to_check=${ac_tool_prefix}nm - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS=$lt_save_ifs - test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/$lt_tmp_nm - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the 'sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty - case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; - *) lt_bad_file=/dev/null ;; - esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break 2 - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break 2 - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS=$lt_save_ifs - done - : ${lt_cv_path_NM=no} -fi]) -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test : != "$DUMPBIN"; then - NM=$DUMPBIN - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh; - # decide which one to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd=$ECHO - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test yes != "$lt_cv_path_mainfest_tool"; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - - -# _LT_DLL_DEF_P([FILE]) -# --------------------- -# True iff FILE is a Windows DLL '.def' file. -# Keep in sync with func_dll_def_p in the libtool script -AC_DEFUN([_LT_DLL_DEF_P], -[dnl - test DEF = "`$SED -n dnl - -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace - -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments - -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl - -e q dnl Only consider the first "real" line - $1`" dnl -])# _LT_DLL_DEF_P - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM=-lm) - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test yes = "$GCC"; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test ia64 = "$host_cpu"; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" - # Adjust the below global symbol transforms to fixup imported variables. - lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" - lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" - lt_c_name_lib_hook="\ - -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ - -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" -else - # Disable hooks by default. - lt_cv_sys_global_symbol_to_import= - lt_cdecl_hook= - lt_c_name_hook= - lt_c_name_lib_hook= -fi - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n"\ -$lt_cdecl_hook\ -" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ -$lt_c_name_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" - -# Transform an extracted symbol line into symbol name with lib prefix and -# symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ -$lt_c_name_lib_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function, - # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ -" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ -" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ -" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ -" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 can't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined __osf__ -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS=conftstm.$ac_objext - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test yes = "$pipe_works"; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], - [Transform the output of nm into a list of symbols to manually relocate]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], - [The name lister interface]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test yes = "$GXX"; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - case $host_os in - os2*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' - ;; - esac - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' - if test ia64 != "$host_cpu"; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64, which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test yes = "$GCC"; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - case $host_os in - os2*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' - ;; - esac - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test ia64 = "$host_cpu"; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - case $cc_basename in - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - case $host_os in - os2*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' - ;; - esac - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - # old Intel for x86_64, which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ F* | *Sun*Fortran*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - *Intel*\ [[CF]]*Compiler*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - *Portland\ Group*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ' (' and ')$', so one must not match beginning or - # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', - # as well as any symbol that contains 'd'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test yes != "$GCC"; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd* | bitrig*) - with_gnu_ld=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test yes = "$with_gnu_ld"; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test yes = "$lt_use_gnu_ld_interface"; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='$wl' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test ia64 != "$host_cpu"; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - shrext_cmds=.dll - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test linux-dietlibc = "$host_os"; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test no = "$tmp_diet" - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - nagfor*) # NAGFOR 5.3 - tmp_sharedflag='-Wl,-shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - - if test yes = "$supports_anon_versioning"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - tcc*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' - ;; - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test yes = "$supports_anon_versioning"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test ia64 = "$host_cpu"; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag= - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then - aix_use_runtimelinking=yes - break - fi - done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # traditional, no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - ;; - esac - - if test yes = "$GCC"; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag="$shared_flag "'$wl-G' - fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' - else - # not using gcc - if test ia64 = "$host_cpu"; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' - else - shared_flag='$wl-bM:SRE' - fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag - else - if test ia64 = "$host_cpu"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' - if test yes = "$with_gnu_ld"; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - ;; - - hpux10*) - if test yes,no = "$GCC,$with_gnu_ld"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test yes,no = "$GCC,$with_gnu_ld"; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS=$save_LDFLAGS]) - if test yes = "$lt_cv_irix_exported_symbol"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' - fi - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - linux*) - case $cc_basename in - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - _LT_TAGVAR(ld_shlibs, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd* | bitrig*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - shrext_cmds=.dll - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - osf3*) - if test yes = "$GCC"; then - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test yes = "$GCC"; then - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test yes = "$GCC"; then - wlarc='$wl' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='$wl' - _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. GCC discards it without '$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test yes = "$GCC"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test sequent = "$host_vendor"; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' - runpath_var='LD_RUN_PATH' - - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test sni = "$host_vendor"; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test yes,yes = "$GCC,$enable_shared"; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting $shlibpath_var if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to 'libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC=$CC -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report what library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test no = "$can_build_shared" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test yes = "$enable_shared" && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC=$lt_save_CC -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to 'libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test no != "$CXX" && - ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || - (test g++ != "$CXX"))); then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_caught_CXX_error"; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test yes = "$GXX"; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test yes = "$GXX"; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test yes = "$with_gnu_ld"; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='$wl' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test ia64 = "$host_cpu"; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag= - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - ;; - esac - - if test yes = "$GXX"; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag=$shared_flag' $wl-G' - fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' - else - # not using gcc - if test ia64 = "$host_cpu"; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' - else - shared_flag='$wl-bM:SRE' - fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - # The "-G" linker flag allows undefined symbols. - _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag - else - if test ia64 = "$host_cpu"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' - if test yes = "$with_gnu_ld"; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared - # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - shrext_cmds=.dll - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd2.*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test yes = "$GXX"; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - if test yes = "$supports_anon_versioning"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd* | bitrig*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test yes,no = "$GXX,$with_gnu_ld"; then - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test yes,no = "$GXX,$with_gnu_ld"; then - _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require '-G' NOT '-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no - - _LT_TAGVAR(GCC, $1)=$GXX - _LT_TAGVAR(LD, $1)=$LD - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test yes != "$_lt_caught_CXX_error" - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case @S|@2 in - .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; - *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF -package foo -func foo() { -} -_LT_EOF -]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; -esac - -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case $prev$p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test x-L = "$p" || - test x-R = "$p"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test no = "$pre_test_object_deps_done"; then - case $prev in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)=$prev$p - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test no = "$pre_test_object_deps_done"; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)=$p - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)=$p - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test no = "$F77"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_disable_F77"; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${F77-"f77"} - CFLAGS=$FFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test no = "$can_build_shared" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test yes = "$enable_shared" && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)=$G77 - _LT_TAGVAR(LD, $1)=$LD - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test yes != "$_lt_disable_F77" - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test no = "$FC"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_disable_FC"; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${FC-"f95"} - CFLAGS=$FCFLAGS - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test no = "$can_build_shared" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test yes = "$enable_shared" && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu - _LT_TAGVAR(LD, $1)=$LD - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test yes != "$_lt_disable_FC" - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)=$LD -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_GO_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Go compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. -m4_defun([_LT_LANG_GO_CONFIG], -[AC_REQUIRE([LT_PROG_GO])dnl -AC_LANG_SAVE - -# Source file extension for Go test sources. -ac_ext=go - -# Object file extension for compiled Go test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="package main; func main() { }" - -# Code to be used in simple link tests -lt_simple_link_test_code='package main; func main() { }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GOC-"gccgo"} -CFLAGS=$GOFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)=$LD -_LT_CC_BASENAME([$compiler]) - -# Go did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GO_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code=$lt_simple_compile_test_code - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -CFLAGS= -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_GO -# ---------- -AC_DEFUN([LT_PROG_GO], -[AC_CHECK_TOOL(GOC, gccgo,) -]) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f "$lt_ac_sed" && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test 10 -lt "$lt_ac_count" && break - lt_ac_count=`expr $lt_ac_count + 1` - if test "$lt_ac_count" -gt "$lt_ac_max"; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine what file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac -]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS - -# Portability macros for glibc argz. -*- Autoconf -*- -# -# Copyright (C) 2004-2007, 2011-2015 Free Software Foundation, Inc. -# Written by Gary V. Vaughan -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 1 ltargz.m4 - -AC_DEFUN([LT_FUNC_ARGZ], [ -AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) - -AC_CHECK_TYPES([error_t], - [], - [AC_DEFINE([error_t], [int], - [Define to a type to use for 'error_t' if it is not otherwise available.]) - AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h - does not typedef error_t.])], - [#if defined(HAVE_ARGZ_H) -# include -#endif]) - -LT_ARGZ_H= -AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ - argz_next argz_stringify], [], [LT_ARGZ_H=lt__argz.h; AC_LIBOBJ([lt__argz])]) - -dnl if have system argz functions, allow forced use of -dnl libltdl-supplied implementation (and default to do so -dnl on "known bad" systems). Could use a runtime check, but -dnl (a) detecting malloc issues is notoriously unreliable -dnl (b) only known system that declares argz functions, -dnl provides them, yet they are broken, is cygwin -dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) -dnl So, it's more straightforward simply to special case -dnl this for known bad systems. -AS_IF([test -z "$LT_ARGZ_H"], - [AC_CACHE_CHECK( - [if argz actually works], - [lt_cv_sys_argz_works], - [[case $host_os in #( - *cygwin*) - lt_cv_sys_argz_works=no - if test no != "$cross_compiling"; then - lt_cv_sys_argz_works="guessing no" - else - lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' - save_IFS=$IFS - IFS=-. - set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` - IFS=$save_IFS - lt_os_major=${2-0} - lt_os_minor=${3-0} - lt_os_micro=${4-0} - if test 1 -lt "$lt_os_major" \ - || { test 1 -eq "$lt_os_major" \ - && { test 5 -lt "$lt_os_minor" \ - || { test 5 -eq "$lt_os_minor" \ - && test 24 -lt "$lt_os_micro"; }; }; }; then - lt_cv_sys_argz_works=yes - fi - fi - ;; #( - *) lt_cv_sys_argz_works=yes ;; - esac]]) - AS_IF([test yes = "$lt_cv_sys_argz_works"], - [AC_DEFINE([HAVE_WORKING_ARGZ], 1, - [This value is set to 1 to indicate that the system argz facility works])], - [LT_ARGZ_H=lt__argz.h - AC_LIBOBJ([lt__argz])])]) - -AC_SUBST([LT_ARGZ_H]) -]) - -# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- -# -# Copyright (C) 1999-2008, 2011-2015 Free Software Foundation, Inc. -# Written by Thomas Tanner, 1999 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 20 LTDL_INIT - -# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) -# ------------------------------------------ -# DIRECTORY contains the libltdl sources. It is okay to call this -# function multiple times, as long as the same DIRECTORY is always given. -AC_DEFUN([LT_CONFIG_LTDL_DIR], -[AC_BEFORE([$0], [LTDL_INIT]) -_$0($*) -])# LT_CONFIG_LTDL_DIR - -# We break this out into a separate macro, so that we can call it safely -# internally without being caught accidentally by the sed scan in libtoolize. -m4_defun([_LT_CONFIG_LTDL_DIR], -[dnl remove trailing slashes -m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) -m4_case(_LTDL_DIR, - [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply '.' - m4_if(_ARG_DIR, [.], - [], - [m4_define([_LTDL_DIR], _ARG_DIR) - _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], - [m4_if(_ARG_DIR, _LTDL_DIR, - [], - [m4_fatal([multiple libltdl directories: ']_LTDL_DIR[', ']_ARG_DIR['])])]) -m4_popdef([_ARG_DIR]) -])# _LT_CONFIG_LTDL_DIR - -# Initialise: -m4_define([_LTDL_DIR], []) - - -# _LT_BUILD_PREFIX -# ---------------- -# If Autoconf is new enough, expand to '$(top_build_prefix)', otherwise -# to '$(top_builddir)/'. -m4_define([_LT_BUILD_PREFIX], -[m4_ifdef([AC_AUTOCONF_VERSION], - [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), - [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], - [$(top_build_prefix)], - [$(top_builddir)/])], - [$(top_build_prefix)])], - [$(top_builddir)/])[]dnl -]) - - -# LTDL_CONVENIENCE -# ---------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that -# AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with -# '$(top_build_prefix)' if available, otherwise with '$(top_builddir)/', -# and LTDLINCL will be prefixed with '$(top_srcdir)/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_build_prefix, top_builddir, and top_srcdir appropriately -# in your Makefiles. -AC_DEFUN([LTDL_CONVENIENCE], -[AC_BEFORE([$0], [LTDL_INIT])dnl -dnl Although the argument is deprecated and no longer documented, -dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one -dnl here make sure it is the same as any other declaration of libltdl's -dnl location! This also ensures lt_ltdl_dir is set when configure.ac is -dnl not yet using an explicit LT_CONFIG_LTDL_DIR. -m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl -_$0() -])# LTDL_CONVENIENCE - -# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, -# now we have LT_CONFIG_LTDL_DIR: -AU_DEFUN([AC_LIBLTDL_CONVENIENCE], -[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_CONVENIENCE]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) - - -# _LTDL_CONVENIENCE -# ----------------- -# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). -m4_defun([_LTDL_CONVENIENCE], -[case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; -esac -LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" -LTDLDEPS=$LIBLTDL -LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}" - -AC_SUBST([LIBLTDL]) -AC_SUBST([LTDLDEPS]) -AC_SUBST([LTDLINCL]) - -# For backwards non-gettext consistent compatibility... -INCLTDL=$LTDLINCL -AC_SUBST([INCLTDL]) -])# _LTDL_CONVENIENCE - - -# LTDL_INSTALLABLE -# ---------------- -# sets LIBLTDL to the link flags for the libltdl installable library -# and LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that -# AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl -# is not found, LIBLTDL will be prefixed with '$(top_build_prefix)' if -# available, otherwise with '$(top_builddir)/', and LTDLINCL will be -# prefixed with '$(top_srcdir)/' (note the single quotes!). If your -# package is not flat and you're not using automake, define top_build_prefix, -# top_builddir, and top_srcdir appropriately in your Makefiles. -# In the future, this macro may have to be called after LT_INIT. -AC_DEFUN([LTDL_INSTALLABLE], -[AC_BEFORE([$0], [LTDL_INIT])dnl -dnl Although the argument is deprecated and no longer documented, -dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one -dnl here make sure it is the same as any other declaration of libltdl's -dnl location! This also ensures lt_ltdl_dir is set when configure.ac is -dnl not yet using an explicit LT_CONFIG_LTDL_DIR. -m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl -_$0() -])# LTDL_INSTALLABLE - -# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, -# now we have LT_CONFIG_LTDL_DIR: -AU_DEFUN([AC_LIBLTDL_INSTALLABLE], -[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_INSTALLABLE]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) - - -# _LTDL_INSTALLABLE -# ----------------- -# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). -m4_defun([_LTDL_INSTALLABLE], -[if test -f "$prefix/lib/libltdl.la"; then - lt_save_LDFLAGS=$LDFLAGS - LDFLAGS="-L$prefix/lib $LDFLAGS" - AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) - LDFLAGS=$lt_save_LDFLAGS - if test yes = "${lt_lib_ltdl-no}"; then - if test yes != "$enable_ltdl_install"; then - # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install - AC_MSG_WARN([not overwriting libltdl at $prefix, force with '--enable-ltdl-install']) - enable_ltdl_install=no - fi - elif test no = "$enable_ltdl_install"; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - fi -fi - -# If configure.ac declared an installable ltdl, and the user didn't override -# with --disable-ltdl-install, we will install the shipped libltdl. -case $enable_ltdl_install in - no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL=-lltdl - LTDLDEPS= - LTDLINCL= - ;; - *) enable_ltdl_install=yes - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" - LTDLDEPS=$LIBLTDL - LTDLINCL='-I$(top_srcdir)'"${lt_ltdl_dir+/$lt_ltdl_dir}" - ;; -esac - -AC_SUBST([LIBLTDL]) -AC_SUBST([LTDLDEPS]) -AC_SUBST([LTDLINCL]) - -# For backwards non-gettext consistent compatibility... -INCLTDL=$LTDLINCL -AC_SUBST([INCLTDL]) -])# LTDL_INSTALLABLE - - -# _LTDL_MODE_DISPATCH -# ------------------- -m4_define([_LTDL_MODE_DISPATCH], -[dnl If _LTDL_DIR is '.', then we are configuring libltdl itself: -m4_if(_LTDL_DIR, [], - [], - dnl if _LTDL_MODE was not set already, the default value is 'subproject': - [m4_case(m4_default(_LTDL_MODE, [subproject]), - [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) - _LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir])], - [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir=$lt_ltdl_dir; lt_libobj_prefix=$lt_ltdl_dir/])], - [recursive], [], - [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl -dnl Be careful not to expand twice: -m4_define([$0], []) -])# _LTDL_MODE_DISPATCH - - -# _LT_LIBOBJ(MODULE_NAME) -# ----------------------- -# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead -# of into LIBOBJS. -AC_DEFUN([_LT_LIBOBJ], [ - m4_pattern_allow([^_LT_LIBOBJS$]) - _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" -])# _LT_LIBOBJS - - -# LTDL_INIT([OPTIONS]) -# -------------------- -# Clients of libltdl can use this macro to allow the installer to -# choose between a shipped copy of the ltdl sources or a preinstalled -# version of the library. If the shipped ltdl sources are not in a -# subdirectory named libltdl, the directory name must be given by -# LT_CONFIG_LTDL_DIR. -AC_DEFUN([LTDL_INIT], -[dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -dnl We need to keep our own list of libobjs separate from our parent project, -dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while -dnl we look for our own LIBOBJs. -m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) -m4_pushdef([AC_LIBSOURCES]) - -dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: -m4_if(_LTDL_MODE, [], - [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) - m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], - [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) - -AC_ARG_WITH([included_ltdl], - [AS_HELP_STRING([--with-included-ltdl], - [use the GNU ltdl sources included here])]) - -if test yes != "$with_included_ltdl"; then - # We are not being forced to use the included libltdl sources, so - # decide whether there is a useful installed version we can use. - AC_CHECK_HEADER([ltdl.h], - [AC_CHECK_DECL([lt_dlinterface_register], - [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], - [with_included_ltdl=no], - [with_included_ltdl=yes])], - [with_included_ltdl=yes], - [AC_INCLUDES_DEFAULT - #include ])], - [with_included_ltdl=yes], - [AC_INCLUDES_DEFAULT] - ) -fi - -dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE -dnl was called yet, then for old times' sake, we assume libltdl is in an -dnl eponymous directory: -AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) - -AC_ARG_WITH([ltdl_include], - [AS_HELP_STRING([--with-ltdl-include=DIR], - [use the ltdl headers installed in DIR])]) - -if test -n "$with_ltdl_include"; then - if test -f "$with_ltdl_include/ltdl.h"; then : - else - AC_MSG_ERROR([invalid ltdl include directory: '$with_ltdl_include']) - fi -else - with_ltdl_include=no -fi - -AC_ARG_WITH([ltdl_lib], - [AS_HELP_STRING([--with-ltdl-lib=DIR], - [use the libltdl.la installed in DIR])]) - -if test -n "$with_ltdl_lib"; then - if test -f "$with_ltdl_lib/libltdl.la"; then : - else - AC_MSG_ERROR([invalid ltdl library directory: '$with_ltdl_lib']) - fi -else - with_ltdl_lib=no -fi - -case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in - ,yes,no,no,) - m4_case(m4_default(_LTDL_TYPE, [convenience]), - [convenience], [_LTDL_CONVENIENCE], - [installable], [_LTDL_INSTALLABLE], - [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) - ;; - ,no,no,no,) - # If the included ltdl is not to be used, then use the - # preinstalled libltdl we found. - AC_DEFINE([HAVE_LTDL], [1], - [Define this if a modern libltdl is already installed]) - LIBLTDL=-lltdl - LTDLDEPS= - LTDLINCL= - ;; - ,no*,no,*) - AC_MSG_ERROR(['--with-ltdl-include' and '--with-ltdl-lib' options must be used together]) - ;; - *) with_included_ltdl=no - LIBLTDL="-L$with_ltdl_lib -lltdl" - LTDLDEPS= - LTDLINCL=-I$with_ltdl_include - ;; -esac -INCLTDL=$LTDLINCL - -# Report our decision... -AC_MSG_CHECKING([where to find libltdl headers]) -AC_MSG_RESULT([$LTDLINCL]) -AC_MSG_CHECKING([where to find libltdl library]) -AC_MSG_RESULT([$LIBLTDL]) - -_LTDL_SETUP - -dnl restore autoconf definition. -m4_popdef([AC_LIBOBJ]) -m4_popdef([AC_LIBSOURCES]) - -AC_CONFIG_COMMANDS_PRE([ - _ltdl_libobjs= - _ltdl_ltlibobjs= - if test -n "$_LT_LIBOBJS"; then - # Remove the extension. - _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do - _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" - _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" - done - fi - AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) - AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) -]) - -# Only expand once: -m4_define([LTDL_INIT]) -])# LTDL_INIT - -# Old names: -AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) -AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) -AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIB_LTDL], []) -dnl AC_DEFUN([AC_WITH_LTDL], []) -dnl AC_DEFUN([LT_WITH_LTDL], []) - - -# _LTDL_SETUP -# ----------- -# Perform all the checks necessary for compilation of the ltdl objects -# -- including compiler checks and header checks. This is a public -# interface mainly for the benefit of libltdl's own configure.ac, most -# other users should call LTDL_INIT instead. -AC_DEFUN([_LTDL_SETUP], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_SYS_MODULE_EXT])dnl -AC_REQUIRE([LT_SYS_MODULE_PATH])dnl -AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl -AC_REQUIRE([LT_LIB_DLLOAD])dnl -AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl -AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl -AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl -AC_REQUIRE([LT_FUNC_ARGZ])dnl - -m4_require([_LT_CHECK_OBJDIR])dnl -m4_require([_LT_HEADER_DLFCN])dnl -m4_require([_LT_CHECK_DLPREOPEN])dnl -m4_require([_LT_DECL_SED])dnl - -dnl Don't require this, or it will be expanded earlier than the code -dnl that sets the variables it relies on: -_LT_ENABLE_INSTALL - -dnl _LTDL_MODE specific code must be called at least once: -_LTDL_MODE_DISPATCH - -# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS -# the user used. This is so that ltdl.h can pick up the parent projects -# config.h file, The first file in AC_CONFIG_HEADERS must contain the -# definitions required by ltdl.c. -# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). -AC_CONFIG_COMMANDS_PRE([dnl -m4_pattern_allow([^LT_CONFIG_H$])dnl -m4_ifset([AH_HEADER], - [LT_CONFIG_H=AH_HEADER], - [m4_ifset([AC_LIST_HEADERS], - [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's|^[[ ]]*||;s|[[ :]].*$||'`], - [])])]) -AC_SUBST([LT_CONFIG_H]) - -AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], - [], [], [AC_INCLUDES_DEFAULT]) - -AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) -AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) - -m4_pattern_allow([LT_LIBEXT])dnl -AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) - -name= -eval "lt_libprefix=\"$libname_spec\"" -m4_pattern_allow([LT_LIBPREFIX])dnl -AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) - -name=ltdl -eval "LTDLOPEN=\"$libname_spec\"" -AC_SUBST([LTDLOPEN]) -])# _LTDL_SETUP - - -# _LT_ENABLE_INSTALL -# ------------------ -m4_define([_LT_ENABLE_INSTALL], -[AC_ARG_ENABLE([ltdl-install], - [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) - -case ,$enable_ltdl_install,$enable_ltdl_convenience in - *yes*) ;; - *) enable_ltdl_convenience=yes ;; -esac - -m4_ifdef([AM_CONDITIONAL], -[AM_CONDITIONAL(INSTALL_LTDL, test no != "${enable_ltdl_install-no}") - AM_CONDITIONAL(CONVENIENCE_LTDL, test no != "${enable_ltdl_convenience-no}")]) -])# _LT_ENABLE_INSTALL - - -# LT_SYS_DLOPEN_DEPLIBS -# --------------------- -AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_CACHE_CHECK([whether deplibs are loaded by dlopen], - [lt_cv_sys_dlopen_deplibs], - [# PORTME does your system automatically load deplibs for dlopen? - # or its logical equivalent (e.g. shl_load for HP-UX < 11) - # For now, we just catch OSes we know something about -- in the - # future, we'll try test this programmatically. - lt_cv_sys_dlopen_deplibs=unknown - case $host_os in - aix3*|aix4.1.*|aix4.2.*) - # Unknown whether this is true for these versions of AIX, but - # we want this 'case' here to explicitly catch those versions. - lt_cv_sys_dlopen_deplibs=unknown - ;; - aix[[4-9]]*) - lt_cv_sys_dlopen_deplibs=yes - ;; - amigaos*) - case $host_cpu in - powerpc) - lt_cv_sys_dlopen_deplibs=no - ;; - esac - ;; - bitrig*) - lt_cv_sys_dlopen_deplibs=yes - ;; - darwin*) - # Assuming the user has installed a libdl from somewhere, this is true - # If you are looking for one http://www.opendarwin.org/projects/dlcompat - lt_cv_sys_dlopen_deplibs=yes - ;; - freebsd* | dragonfly*) - lt_cv_sys_dlopen_deplibs=yes - ;; - gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) - # GNU and its variants, using gnu ld.so (Glibc) - lt_cv_sys_dlopen_deplibs=yes - ;; - hpux10*|hpux11*) - lt_cv_sys_dlopen_deplibs=yes - ;; - interix*) - lt_cv_sys_dlopen_deplibs=yes - ;; - irix[[12345]]*|irix6.[[01]]*) - # Catch all versions of IRIX before 6.2, and indicate that we don't - # know how it worked for any of those versions. - lt_cv_sys_dlopen_deplibs=unknown - ;; - irix*) - # The case above catches anything before 6.2, and it's known that - # at 6.2 and later dlopen does load deplibs. - lt_cv_sys_dlopen_deplibs=yes - ;; - netbsd*) - lt_cv_sys_dlopen_deplibs=yes - ;; - openbsd*) - lt_cv_sys_dlopen_deplibs=yes - ;; - osf[[1234]]*) - # dlopen did load deplibs (at least at 4.x), but until the 5.x series, - # it did *not* use an RPATH in a shared library to find objects the - # library depends on, so we explicitly say 'no'. - lt_cv_sys_dlopen_deplibs=no - ;; - osf5.0|osf5.0a|osf5.1) - # dlopen *does* load deplibs and with the right loader patch applied - # it even uses RPATH in a shared library to search for shared objects - # that the library depends on, but there's no easy way to know if that - # patch is installed. Since this is the case, all we can really - # say is unknown -- it depends on the patch being installed. If - # it is, this changes to 'yes'. Without it, it would be 'no'. - lt_cv_sys_dlopen_deplibs=unknown - ;; - osf*) - # the two cases above should catch all versions of osf <= 5.1. Read - # the comments above for what we know about them. - # At > 5.1, deplibs are loaded *and* any RPATH in a shared library - # is used to find them so we can finally say 'yes'. - lt_cv_sys_dlopen_deplibs=yes - ;; - qnx*) - lt_cv_sys_dlopen_deplibs=yes - ;; - solaris*) - lt_cv_sys_dlopen_deplibs=yes - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - esac - ]) -if test yes != "$lt_cv_sys_dlopen_deplibs"; then - AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], - [Define if the OS needs help to load dependent libraries for dlopen().]) -fi -])# LT_SYS_DLOPEN_DEPLIBS - -# Old name: -AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) - - -# LT_SYS_MODULE_EXT -# ----------------- -AC_DEFUN([LT_SYS_MODULE_EXT], -[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([what extension is used for runtime loadable modules], - [libltdl_cv_shlibext], -[ -module=yes -eval libltdl_cv_shlibext=$shrext_cmds -module=no -eval libltdl_cv_shrext=$shrext_cmds - ]) -if test -n "$libltdl_cv_shlibext"; then - m4_pattern_allow([LT_MODULE_EXT])dnl - AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], - [Define to the extension used for runtime loadable modules, say, ".so".]) -fi -if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then - m4_pattern_allow([LT_SHARED_EXT])dnl - AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], - [Define to the shared library suffix, say, ".dylib".]) -fi -if test -n "$shared_archive_member_spec"; then - m4_pattern_allow([LT_SHARED_LIB_MEMBER])dnl - AC_DEFINE_UNQUOTED([LT_SHARED_LIB_MEMBER], ["($shared_archive_member_spec.o)"], - [Define to the shared archive member specification, say "(shr.o)".]) -fi -])# LT_SYS_MODULE_EXT - -# Old name: -AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) - - -# LT_SYS_MODULE_PATH -# ------------------ -AC_DEFUN([LT_SYS_MODULE_PATH], -[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([what variable specifies run-time module search path], - [lt_cv_module_path_var], [lt_cv_module_path_var=$shlibpath_var]) -if test -n "$lt_cv_module_path_var"; then - m4_pattern_allow([LT_MODULE_PATH_VAR])dnl - AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], - [Define to the name of the environment variable that determines the run-time module search path.]) -fi -])# LT_SYS_MODULE_PATH - -# Old name: -AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) - - -# LT_SYS_DLSEARCH_PATH -# -------------------- -AC_DEFUN([LT_SYS_DLSEARCH_PATH], -[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([for the default library search path], - [lt_cv_sys_dlsearch_path], - [lt_cv_sys_dlsearch_path=$sys_lib_dlsearch_path_spec]) -if test -n "$lt_cv_sys_dlsearch_path"; then - sys_dlsearch_path= - for dir in $lt_cv_sys_dlsearch_path; do - if test -z "$sys_dlsearch_path"; then - sys_dlsearch_path=$dir - else - sys_dlsearch_path=$sys_dlsearch_path$PATH_SEPARATOR$dir - fi - done - m4_pattern_allow([LT_DLSEARCH_PATH])dnl - AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], - [Define to the system default library search path.]) -fi -])# LT_SYS_DLSEARCH_PATH - -# Old name: -AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) - - -# _LT_CHECK_DLPREOPEN -# ------------------- -m4_defun([_LT_CHECK_DLPREOPEN], -[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], - [libltdl_cv_preloaded_symbols], - [if test -n "$lt_cv_sys_global_symbol_pipe"; then - libltdl_cv_preloaded_symbols=yes - else - libltdl_cv_preloaded_symbols=no - fi - ]) -if test yes = "$libltdl_cv_preloaded_symbols"; then - AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], - [Define if libtool can extract symbol lists from object files.]) -fi -])# _LT_CHECK_DLPREOPEN - - -# LT_LIB_DLLOAD -# ------------- -AC_DEFUN([LT_LIB_DLLOAD], -[m4_pattern_allow([^LT_DLLOADERS$]) -LT_DLLOADERS= -AC_SUBST([LT_DLLOADERS]) - -AC_LANG_PUSH([C]) -lt_dlload_save_LIBS=$LIBS - -LIBADD_DLOPEN= -AC_SEARCH_LIBS([dlopen], [dl], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - if test "$ac_cv_search_dlopen" != "none required"; then - LIBADD_DLOPEN=-ldl - fi - libltdl_cv_lib_dl_dlopen=yes - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H -# include -#endif - ]], [[dlopen(0, 0);]])], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - libltdl_cv_func_dlopen=yes - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], - [AC_CHECK_LIB([svld], [dlopen], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - LIBADD_DLOPEN=-lsvld libltdl_cv_func_dlopen=yes - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) -if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen" -then - lt_save_LIBS=$LIBS - LIBS="$LIBS $LIBADD_DLOPEN" - AC_CHECK_FUNCS([dlerror]) - LIBS=$lt_save_LIBS -fi -AC_SUBST([LIBADD_DLOPEN]) - -LIBADD_SHL_LOAD= -AC_CHECK_FUNC([shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], - [AC_CHECK_LIB([dld], [shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" - LIBADD_SHL_LOAD=-ldld])]) -AC_SUBST([LIBADD_SHL_LOAD]) - -case $host_os in -darwin[[1567]].*) -# We only want this for pre-Mac OS X 10.4. - AC_CHECK_FUNC([_dyld_func_lookup], - [AC_DEFINE([HAVE_DYLD], [1], - [Define if you have the _dyld_func_lookup function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) - ;; -beos*) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" - ;; -cygwin* | mingw* | pw32*) - AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" - ;; -esac - -AC_CHECK_LIB([dld], [dld_link], - [AC_DEFINE([HAVE_DLD], [1], - [Define if you have the GNU dld library.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) -AC_SUBST([LIBADD_DLD_LINK]) - -m4_pattern_allow([^LT_DLPREOPEN$]) -LT_DLPREOPEN= -if test -n "$LT_DLLOADERS" -then - for lt_loader in $LT_DLLOADERS; do - LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " - done - AC_DEFINE([HAVE_LIBDLLOADER], [1], - [Define if libdlloader will be built on this platform]) -fi -AC_SUBST([LT_DLPREOPEN]) - -dnl This isn't used anymore, but set it for backwards compatibility -LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" -AC_SUBST([LIBADD_DL]) - -LIBS=$lt_dlload_save_LIBS -AC_LANG_POP -])# LT_LIB_DLLOAD - -# Old name: -AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_DLLIB], []) - - -# LT_SYS_SYMBOL_USCORE -# -------------------- -# does the compiler prefix global symbols with an underscore? -AC_DEFUN([LT_SYS_SYMBOL_USCORE], -[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -AC_CACHE_CHECK([for _ prefix in compiled symbols], - [lt_cv_sys_symbol_underscore], - [lt_cv_sys_symbol_underscore=no - cat > conftest.$ac_ext <<_LT_EOF -void nm_test_func(){} -int main(){nm_test_func;return 0;} -_LT_EOF - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - ac_nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then - # See whether the symbols have a leading underscore. - if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then - lt_cv_sys_symbol_underscore=yes - else - if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then - : - else - echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD - fi - fi - else - echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.c >&AS_MESSAGE_LOG_FD - fi - rm -rf conftest* - ]) - sys_symbol_underscore=$lt_cv_sys_symbol_underscore - AC_SUBST([sys_symbol_underscore]) -])# LT_SYS_SYMBOL_USCORE - -# Old name: -AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) - - -# LT_FUNC_DLSYM_USCORE -# -------------------- -AC_DEFUN([LT_FUNC_DLSYM_USCORE], -[AC_REQUIRE([_LT_COMPILER_PIC])dnl for lt_prog_compiler_wl -AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl for lt_cv_sys_symbol_underscore -AC_REQUIRE([LT_SYS_MODULE_EXT])dnl for libltdl_cv_shlibext -if test yes = "$lt_cv_sys_symbol_underscore"; then - if test yes = "$libltdl_cv_func_dlopen" || test yes = "$libltdl_cv_lib_dl_dlopen"; then - AC_CACHE_CHECK([whether we have to add an underscore for dlsym], - [libltdl_cv_need_uscore], - [libltdl_cv_need_uscore=unknown - dlsym_uscore_save_LIBS=$LIBS - LIBS="$LIBS $LIBADD_DLOPEN" - libname=conftmod # stay within 8.3 filename limits! - cat >$libname.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" -/* When -fvisibility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif -int fnord () { return 42; }] -_LT_EOF - - # ltfn_module_cmds module_cmds - # Execute tilde-delimited MODULE_CMDS with environment primed for - # $module_cmds or $archive_cmds type content. - ltfn_module_cmds () - {( # subshell avoids polluting parent global environment - module_cmds_save_ifs=$IFS; IFS='~' - for cmd in @S|@1; do - IFS=$module_cmds_save_ifs - libobjs=$libname.$ac_objext; lib=$libname$libltdl_cv_shlibext - rpath=/not-exists; soname=$libname$libltdl_cv_shlibext; output_objdir=. - major=; versuffix=; verstring=; deplibs= - ECHO=echo; wl=$lt_prog_compiler_wl; allow_undefined_flag= - eval $cmd - done - IFS=$module_cmds_save_ifs - )} - - # Compile a loadable module using libtool macro expansion results. - $CC $pic_flag -c $libname.$ac_ext - ltfn_module_cmds "${module_cmds:-$archive_cmds}" - - # Try to fetch fnord with dlsym(). - libltdl_dlunknown=0; libltdl_dlnouscore=1; libltdl_dluscore=2 - cat >conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" -#if HAVE_DLFCN_H -#include -#endif -#include -#ifndef RTLD_GLOBAL -# ifdef DL_GLOBAL -# define RTLD_GLOBAL DL_GLOBAL -# else -# define RTLD_GLOBAL 0 -# endif -#endif -#ifndef RTLD_NOW -# ifdef DL_NOW -# define RTLD_NOW DL_NOW -# else -# define RTLD_NOW 0 -# endif -#endif -int main () { - void *handle = dlopen ("`pwd`/$libname$libltdl_cv_shlibext", RTLD_GLOBAL|RTLD_NOW); - int status = $libltdl_dlunknown; - if (handle) { - if (dlsym (handle, "fnord")) - status = $libltdl_dlnouscore; - else { - if (dlsym (handle, "_fnord")) - status = $libltdl_dluscore; - else - puts (dlerror ()); - } - dlclose (handle); - } else - puts (dlerror ()); - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - libltdl_status=$? - case x$libltdl_status in - x$libltdl_dlnouscore) libltdl_cv_need_uscore=no ;; - x$libltdl_dluscore) libltdl_cv_need_uscore=yes ;; - x*) libltdl_cv_need_uscore=unknown ;; - esac - fi - rm -rf conftest* $libname* - LIBS=$dlsym_uscore_save_LIBS - ]) - fi -fi - -if test yes = "$libltdl_cv_need_uscore"; then - AC_DEFINE([NEED_USCORE], [1], - [Define if dlsym() requires a leading underscore in symbol names.]) -fi -])# LT_FUNC_DLSYM_USCORE - -# Old name: -AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) - -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software -# Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 8 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option '$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl 'shared' nor 'disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], - [_LT_WITH_AIX_SONAME([aix])]) - ]) -])# _LT_SET_OPTIONS - - - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the 'shared' and -# 'disable-shared' LT_INIT options. -# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS=$lt_save_ifs - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the 'static' and -# 'disable-static' LT_INIT options. -# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS=$lt_save_ifs - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the 'fast-install' -# and 'disable-fast-install' LT_INIT options. -# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for pkg in $enableval; do - IFS=$lt_save_ifs - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS=$lt_save_ifs - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_AIX_SONAME([DEFAULT]) -# ---------------------------------- -# implement the --with-aix-soname flag, and support the `aix-soname=aix' -# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT -# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. -m4_define([_LT_WITH_AIX_SONAME], -[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl -shared_archive_member_spec= -case $host,$enable_shared in -power*-*-aix[[5-9]]*,yes) - AC_MSG_CHECKING([which variant of shared library versioning to provide]) - AC_ARG_WITH([aix-soname], - [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], - [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], - [case $withval in - aix|svr4|both) - ;; - *) - AC_MSG_ERROR([Unknown argument to --with-aix-soname]) - ;; - esac - lt_cv_with_aix_soname=$with_aix_soname], - [AC_CACHE_VAL([lt_cv_with_aix_soname], - [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) - with_aix_soname=$lt_cv_with_aix_soname]) - AC_MSG_RESULT([$with_aix_soname]) - if test aix != "$with_aix_soname"; then - # For the AIX way of multilib, we name the shared archive member - # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', - # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. - # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, - # the AIX toolchain works better with OBJECT_MODE set (default 32). - if test 64 = "${OBJECT_MODE-32}"; then - shared_archive_member_spec=shr_64 - else - shared_archive_member_spec=shr - fi - fi - ;; -*) - with_aix_soname=aix - ;; -esac - -_LT_DECL([], [shared_archive_member_spec], [0], - [Shared archive member basename, for filename based shared library versioning on AIX])dnl -])# _LT_WITH_AIX_SONAME - -LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) -LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) -LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' -# LT_INIT options. -# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, - for lt_pkg in $withval; do - IFS=$lt_save_ifs - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS=$lt_save_ifs - ;; - esac], - [pic_mode=m4_default([$1], [default])]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) - -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software -# Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59, which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) - -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# @configure_input@ - -# serial 4179 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.4.6]) -m4_define([LT_PACKAGE_REVISION], [2.4.6]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.6' -macro_revision='2.4.6' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) - -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software -# Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) - -# Copyright (C) 2002-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.15' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) - -# Copyright (C) 2011-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_AR([ACT-IF-FAIL]) -# ------------------------- -# Try to determine the archiver interface, and trigger the ar-lib wrapper -# if it is needed. If the detection of archiver interface fails, run -# ACT-IF-FAIL (default is to abort configure with a proper error message). -AC_DEFUN([AM_PROG_AR], -[AC_BEFORE([$0], [LT_INIT])dnl -AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([ar-lib])dnl -AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) -: ${AR=ar} - -AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], - [AC_LANG_PUSH([C]) - am_cv_ar_interface=ar - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], - [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - ]) - AC_LANG_POP([C])]) - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - m4_default([$1], - [AC_MSG_ERROR([could not determine $AR interface])]) - ;; -esac -AC_SUBST([AR])dnl -]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # We check with '-c' and '-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named 'Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done -} -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each '.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi -dnl The trailing newline in this macro's definition is deliberate, for -dnl backward compatibility and to allow trailing 'dnl'-style comments -dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. -]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) - -# Copyright (C) 2003-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# -------------------- -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) - -# _AM_SET_OPTIONS(OPTIONS) -# ------------------------ -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# Do 'set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) - -# Copyright (C) 2009-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2014 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - -m4_include([m4/charybdis.m4]) -m4_include([m4/pkg.m4]) From f79f3e6a9526c83e2e20f6cee64da790db144a06 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 14:43:50 -0500 Subject: [PATCH 023/252] config.h: update a tad --- include/config.h | 18 +++++++++++------- include/config.h.dist | 12 ++++++++---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/include/config.h b/include/config.h index 6ba69963b..1b5a37b15 100644 --- a/include/config.h +++ b/include/config.h @@ -57,12 +57,12 @@ /* files */ #define SPATH BINPATH "/" PROGRAM_PREFIX "charybdis" /* ircd executable */ -#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ -#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ -#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ -#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */ -#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ -#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ +#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ +#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ +#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ +#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */ +#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ +#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ /* IGNORE_BOGUS_TS * Ignore bogus timestamps from other servers. Yes this will desync @@ -72,6 +72,11 @@ */ #undef IGNORE_BOGUS_TS +/* ENABLE_OPER_CHGHOST + * Allow opers to use the CHGHOST command. Potentially abusive. + */ +#undef ENABLE_OPER_CHGHOST + /* HANGONGOODLINK and HANGONRETRYDELAY * Often net breaks for a short time and it's useful to try to * establishing the same connection again faster than CONNECTFREQUENCY @@ -80,7 +85,6 @@ * (HANGONGOODLINK) and we give the net few seconds to steady * (HANGONRETRYDELAY). This latter has to be long enough that the * other end of the connection has time to notice it broke too. - * 1997/09/18 recommended values by ThemBones for modern EFnet */ #define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */ #define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */ diff --git a/include/config.h.dist b/include/config.h.dist index f143506e8..1b5a37b15 100644 --- a/include/config.h.dist +++ b/include/config.h.dist @@ -27,7 +27,7 @@ #include "setup.h" -/* +/* * Directory paths and filenames for UNIX systems. * IRCD_PREFIX is set using ./configure --prefix, see INSTALL. * The other defaults should be fine. @@ -50,7 +50,7 @@ #define BINPATH IRCD_PREFIX "/bin/" #define MODPATH MODULE_DIR #define AUTOMODPATH MODULE_DIR "/autoload/" -#define ETCPATH ETC_DIR +#define ETCPATH ETC_DIR #define LOGPATH LOG_DIR #define UHPATH HELP_DIR "/users" #define HPATH HELP_DIR "/opers" @@ -72,6 +72,11 @@ */ #undef IGNORE_BOGUS_TS +/* ENABLE_OPER_CHGHOST + * Allow opers to use the CHGHOST command. Potentially abusive. + */ +#undef ENABLE_OPER_CHGHOST + /* HANGONGOODLINK and HANGONRETRYDELAY * Often net breaks for a short time and it's useful to try to * establishing the same connection again faster than CONNECTFREQUENCY @@ -80,7 +85,6 @@ * (HANGONGOODLINK) and we give the net few seconds to steady * (HANGONRETRYDELAY). This latter has to be long enough that the * other end of the connection has time to notice it broke too. - * 1997/09/18 recommended values by ThemBones for modern EFnet */ #define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */ #define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */ @@ -92,7 +96,7 @@ #define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */ /* CHARYBDIS_SOMAXCONN - * Use SOMAXCONN if OS has it, otherwise use this value for the + * Use SOMAXCONN if OS has it, otherwise use this value for the * listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs. */ #define CHARYBDIS_SOMAXCONN 25 From 0e99e13a711a97dcf853ad2c64889c151ccb5b9b Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 14:57:08 -0500 Subject: [PATCH 024/252] configure: add ENABLE_OPER_CHGHOST flag --- configure.ac | 12 ++++++++++++ include/config.h | 5 ----- include/config.h.dist | 5 ----- include/setup.h.in | 3 +++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index e17ef34f7..614a01607 100644 --- a/configure.ac +++ b/configure.ac @@ -497,6 +497,18 @@ if test "x$BRANDING_NAME" != "x$PACKAGE_NAME"; then AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.]) fi +dnl ********************************************************************** +dnl Enable oper chghost +dnl ********************************************************************** + +AC_ARG_ENABLE(oper-chghost, +AC_HELP_STRING([--enable-oper-chghost],[Allow opers to use the CHGHOST command]), +[operchghost=$enableval],[operchghost=no]) + +if test "$operchghost" = yes; then + AC_DEFINE(ENABLE_OPER_CHGHOST, 1, [Define this to enable opers to use the CHGHOST command.]) +fi + dnl Debug-related options dnl ===================== diff --git a/include/config.h b/include/config.h index 1b5a37b15..752d7bfab 100644 --- a/include/config.h +++ b/include/config.h @@ -72,11 +72,6 @@ */ #undef IGNORE_BOGUS_TS -/* ENABLE_OPER_CHGHOST - * Allow opers to use the CHGHOST command. Potentially abusive. - */ -#undef ENABLE_OPER_CHGHOST - /* HANGONGOODLINK and HANGONRETRYDELAY * Often net breaks for a short time and it's useful to try to * establishing the same connection again faster than CONNECTFREQUENCY diff --git a/include/config.h.dist b/include/config.h.dist index 1b5a37b15..752d7bfab 100644 --- a/include/config.h.dist +++ b/include/config.h.dist @@ -72,11 +72,6 @@ */ #undef IGNORE_BOGUS_TS -/* ENABLE_OPER_CHGHOST - * Allow opers to use the CHGHOST command. Potentially abusive. - */ -#undef ENABLE_OPER_CHGHOST - /* HANGONGOODLINK and HANGONRETRYDELAY * Often net breaks for a short time and it's useful to try to * establishing the same connection again faster than CONNECTFREQUENCY diff --git a/include/setup.h.in b/include/setup.h.in index a66efc100..dca682add 100644 --- a/include/setup.h.in +++ b/include/setup.h.in @@ -41,6 +41,9 @@ /* Size of the dlink_node heap. */ #undef DNODE_HEAP_SIZE +/* Define this to enable opers to use the CHGHOST command. */ +#undef ENABLE_OPER_CHGHOST + /* Prefix where config files are installed. */ #undef ETC_DIR From cca418c9b73f806e50fefbf0fce5644f66e7753d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 15:02:59 -0500 Subject: [PATCH 025/252] Add --enable-ignore-bogus-ts flag. This hoists the option out of config.h. --- configure.ac | 14 +++++++++++++- include/config.h | 8 -------- include/config.h.dist | 8 -------- include/setup.h.in | 4 ++++ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 614a01607..77f7a7e0b 100644 --- a/configure.ac +++ b/configure.ac @@ -502,13 +502,25 @@ dnl Enable oper chghost dnl ********************************************************************** AC_ARG_ENABLE(oper-chghost, -AC_HELP_STRING([--enable-oper-chghost],[Allow opers to use the CHGHOST command]), +AC_HELP_STRING([--enable-oper-chghost],[Enable opers to use the CHGHOST command]), [operchghost=$enableval],[operchghost=no]) if test "$operchghost" = yes; then AC_DEFINE(ENABLE_OPER_CHGHOST, 1, [Define this to enable opers to use the CHGHOST command.]) fi +dnl ********************************************************************** +dnl Enable ignoring of bogus timestamps +dnl ********************************************************************** + +AC_ARG_ENABLE(ignore-bogus-ts, +AC_HELP_STRING([--enable-ignore-bogus-ts],[Enable the reset of timestamps in channels to current time if set to 0. Set this network wide or not at all.]), +[ignorebogusts=$enableval],[ignorebogusts=no]) + +if test "$ignorebogusts" = yes; then + AC_DEFINE(IGNORE_BOGUS_TS, 1, [Define this to enable the reset of timestamps in channels to current time if set to 0.]) +fi + dnl Debug-related options dnl ===================== diff --git a/include/config.h b/include/config.h index 752d7bfab..e30ad67bf 100644 --- a/include/config.h +++ b/include/config.h @@ -64,14 +64,6 @@ #define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ #define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ -/* IGNORE_BOGUS_TS - * Ignore bogus timestamps from other servers. Yes this will desync - * the network, but it will allow chanops to resync with a valid non TS 0 - * - * This should be enabled network wide, or not at all. - */ -#undef IGNORE_BOGUS_TS - /* HANGONGOODLINK and HANGONRETRYDELAY * Often net breaks for a short time and it's useful to try to * establishing the same connection again faster than CONNECTFREQUENCY diff --git a/include/config.h.dist b/include/config.h.dist index 752d7bfab..e30ad67bf 100644 --- a/include/config.h.dist +++ b/include/config.h.dist @@ -64,14 +64,6 @@ #define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ #define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ -/* IGNORE_BOGUS_TS - * Ignore bogus timestamps from other servers. Yes this will desync - * the network, but it will allow chanops to resync with a valid non TS 0 - * - * This should be enabled network wide, or not at all. - */ -#undef IGNORE_BOGUS_TS - /* HANGONGOODLINK and HANGONRETRYDELAY * Often net breaks for a short time and it's useful to try to * establishing the same connection again faster than CONNECTFREQUENCY diff --git a/include/setup.h.in b/include/setup.h.in index dca682add..679266bfb 100644 --- a/include/setup.h.in +++ b/include/setup.h.in @@ -250,6 +250,10 @@ /* Prefix where help files are installed. */ #undef HELP_DIR +/* Define this to enable the reset of timestamps in channels to current time + if set to 0. */ +#undef IGNORE_BOGUS_TS + /* Prefix where the ircd is installed. */ #undef IRCD_PREFIX From 1d89c9e945373ee5d8a108dd1797dbd7b26a3e4c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 15:12:42 -0500 Subject: [PATCH 026/252] Remove unnecessary autotools cruft and other detritus --- include/setup.h.in | 480 -------- librb/INSTALL | 182 ---- librb/config.guess | 1421 ------------------------ librb/config.sub | 1807 ------------------------------- librb/include/librb_config.h.in | 377 ------- librb/install-sh | 501 --------- 6 files changed, 4768 deletions(-) delete mode 100644 include/setup.h.in delete mode 100644 librb/INSTALL delete mode 100755 librb/config.guess delete mode 100755 librb/config.sub delete mode 100644 librb/include/librb_config.h.in delete mode 100755 librb/install-sh diff --git a/include/setup.h.in b/include/setup.h.in deleted file mode 100644 index 679266bfb..000000000 --- a/include/setup.h.in +++ /dev/null @@ -1,480 +0,0 @@ -/* include/setup.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Size of away heap. */ -#undef AWAY_HEAP_SIZE - -/* Size of the ban heap. */ -#undef BAN_HEAP_SIZE - -/* Custom branding name. */ -#undef BRANDING_NAME - -/* Custom branding name. */ -#undef BRANDING_VERSION - -/* Size of the channel heap. */ -#undef CHANNEL_HEAP_SIZE - -/* Define this if you are profiling. */ -#undef CHARYBDIS_PROFILE - -/* Size of the client heap. */ -#undef CLIENT_HEAP_SIZE - -/* Size of the confitem heap. */ -#undef CONFITEM_HEAP_SIZE - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* Define if custom branding is enabled. */ -#undef CUSTOM_BRANDING - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Size of the dlink_node heap. */ -#undef DNODE_HEAP_SIZE - -/* Define this to enable opers to use the CHGHOST command. */ -#undef ENABLE_OPER_CHGHOST - -/* Prefix where config files are installed. */ -#undef ETC_DIR - -/* Size of fd heap. */ -#undef FD_HEAP_SIZE - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the `argz_add' function. */ -#undef HAVE_ARGZ_ADD - -/* Define to 1 if you have the `argz_append' function. */ -#undef HAVE_ARGZ_APPEND - -/* Define to 1 if you have the `argz_count' function. */ -#undef HAVE_ARGZ_COUNT - -/* Define to 1 if you have the `argz_create_sep' function. */ -#undef HAVE_ARGZ_CREATE_SEP - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARGZ_H - -/* Define to 1 if you have the `argz_insert' function. */ -#undef HAVE_ARGZ_INSERT - -/* Define to 1 if you have the `argz_next' function. */ -#undef HAVE_ARGZ_NEXT - -/* Define to 1 if you have the `argz_stringify' function. */ -#undef HAVE_ARGZ_STRINGIFY - -/* Define to 1 if you have the `closedir' function. */ -#undef HAVE_CLOSEDIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_CRYPT_H - -/* Define to 1 if you have the declaration of `cygwin_conv_path', and to 0 if - you don't. */ -#undef HAVE_DECL_CYGWIN_CONV_PATH - -/* Define to 1 if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define if you have the GNU dld library. */ -#undef HAVE_DLD - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLD_H - -/* Define to 1 if you have the `dlerror' function. */ -#undef HAVE_DLERROR - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_DL_H - -/* Define if you have the _dyld_func_lookup function. */ -#undef HAVE_DYLD - -/* Define to 1 if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define to 1 if the system has the type `error_t'. */ -#undef HAVE_ERROR_T - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `crypto' library (-lcrypto). */ -#undef HAVE_LIBCRYPTO - -/* Define if you have the libdl library or equivalent. */ -#undef HAVE_LIBDL - -/* Define if libdlloader will be built on this platform */ -#undef HAVE_LIBDLLOADER - -/* Define to 1 if zlib (-lz) is available. */ -#undef HAVE_LIBZ - -/* Define this if a modern libltdl is already installed */ -#undef HAVE_LTDL - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACHINE_ENDIAN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MACH_O_DYLD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `mmap' function. */ -#undef HAVE_MMAP - -/* Define if nanosleep exists */ -#undef HAVE_NANOSLEEP - -/* Define to 1 if you have the `opendir' function. */ -#undef HAVE_OPENDIR - -/* Define if libtool can extract symbol lists from object files. */ -#undef HAVE_PRELOADED_SYMBOLS - -/* Define to 1 if you have the `readdir' function. */ -#undef HAVE_READDIR - -/* Define if you have the shl_load function. */ -#undef HAVE_SHL_LOAD - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if you have the `socketpair' function. */ -#undef HAVE_SOCKETPAIR - -/* Define to 1 if stdbool.h conforms to C99. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strdup' function. */ -#undef HAVE_STRDUP - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strlcat' function. */ -#undef HAVE_STRLCAT - -/* Define to 1 if you have the `strlcpy' function. */ -#undef HAVE_STRLCPY - -/* Define to 1 if you have the `strndup' function. */ -#undef HAVE_STRNDUP - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_DL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SYSLOG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if the system has the type `uintptr_t'. */ -#undef HAVE_UINTPTR_T - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF - -/* Define to 1 if you have the header file. */ -#undef HAVE_WAIT_H - -/* This value is set to 1 to indicate that the system argz facility works */ -#undef HAVE_WORKING_ARGZ - -/* Define to 1 if the system has the type `_Bool'. */ -#undef HAVE__BOOL - -/* Prefix where help files are installed. */ -#undef HELP_DIR - -/* Define this to enable the reset of timestamps in channels to current time - if set to 0. */ -#undef IGNORE_BOGUS_TS - -/* Prefix where the ircd is installed. */ -#undef IRCD_PREFIX - -/* Size of the local client heap. */ -#undef LCLIENT_HEAP_SIZE - -/* Size of the linebuf heap. */ -#undef LINEBUF_HEAP_SIZE - -/* Prefix where to write logfiles. */ -#undef LOG_DIR - -/* Define if the OS needs help to load dependent libraries for dlopen(). */ -#undef LTDL_DLOPEN_DEPLIBS - -/* Define to the system default library search path. */ -#undef LT_DLSEARCH_PATH - -/* The archive extension */ -#undef LT_LIBEXT - -/* The archive prefix */ -#undef LT_LIBPREFIX - -/* Define to the extension used for runtime loadable modules, say, ".so". */ -#undef LT_MODULE_EXT - -/* Define to the name of the environment variable that determines the run-time - module search path. */ -#undef LT_MODULE_PATH_VAR - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#undef LT_OBJDIR - -/* Define to the shared library suffix, say, ".dylib". */ -#undef LT_SHARED_EXT - -/* Define to the shared archive member specification, say "(shr.o)". */ -#undef LT_SHARED_LIB_MEMBER - -/* Sizeof member heap. */ -#undef MEMBER_HEAP_SIZE - -/* Prefix where modules are installed. */ -#undef MODULE_DIR - -/* Size of the monitor heap. */ -#undef MONITOR_HEAP_SIZE - -/* Define this to disable debugging support. */ -#undef NDEBUG - -/* Size of the nick delay heap. */ -#undef ND_HEAP_SIZE - -/* Define if dlsym() requires a leading underscore in symbol names. */ -#undef NEED_USCORE - -/* Nickname length */ -#undef NICKLEN - -/* Size of the WHOWAS array. */ -#undef NICKNAMEHISTORYLENGTH - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Path to /dev/null */ -#undef PATH_DEVNULL - -/* Size of the pre-client heap. */ -#undef PCLIENT_HEAP_SIZE - -/* Directory where binaries the IRCd itself spawns live */ -#undef PKGLIBEXECDIR - -/* Directory in which to store state, such as ban database */ -#undef PKGLOCALSTATEDIR - -/* Directory to store pidfile in. */ -#undef PKGRUNDIR - -/* String with which all programs intended to be in PATH are prefixed. */ -#undef PROGRAM_PREFIX - -/* The size of `int', as computed by sizeof. */ -#undef SIZEOF_INT - -/* The size of `long', as computed by sizeof. */ -#undef SIZEOF_LONG - -/* The size of `long long', as computed by sizeof. */ -#undef SIZEOF_LONG_LONG - -/* The size of `short', as computed by sizeof. */ -#undef SIZEOF_SHORT - -/* Define this to enable soft asserts. */ -#undef SOFT_ASSERT - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Maximum topic length (<=390) */ -#undef TOPICLEN - -/* Size of the topic heap. */ -#undef TOPIC_HEAP_SIZE - -/* Size of the user heap. */ -#undef USER_HEAP_SIZE - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Version number of package */ -#undef VERSION - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -#undef YYTEXT_POINTER - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define so that glibc/gnulib argp.h does not typedef error_t. */ -#undef __error_t_defined - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to a type to use for 'error_t' if it is not otherwise available. */ -#undef error_t - -/* If system does not define in_port_t, define it to what it should be. */ -#undef in_port_t - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `int' if does not define. */ -#undef pid_t - -/* If system does not define sa_family_t, define it here. */ -#undef sa_family_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* If we don't have a real socklen_t, unsigned int is good enough. */ -#undef socklen_t - -/* If system does not define u_int16_t, define a usable substitute. */ -#undef u_int16_t - -/* If system does not define u_int32_t, define to unsigned long int here. */ -#undef u_int32_t diff --git a/librb/INSTALL b/librb/INSTALL deleted file mode 100644 index b42a17ac4..000000000 --- a/librb/INSTALL +++ /dev/null @@ -1,182 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. diff --git a/librb/config.guess b/librb/config.guess deleted file mode 100755 index dbfb9786c..000000000 --- a/librb/config.guess +++ /dev/null @@ -1,1421 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2015 Free Software Foundation, Inc. - -timestamp='2015-01-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -# -# Please send patches to . - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2015 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; -esac - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/librb/config.sub b/librb/config.sub deleted file mode 100755 index 6d2e94c8b..000000000 --- a/librb/config.sub +++ /dev/null @@ -1,1807 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2015 Free Software Foundation, Inc. - -timestamp='2015-01-01' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches to . -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2015 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv | ft32 \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | visium-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/librb/include/librb_config.h.in b/librb/include/librb_config.h.in deleted file mode 100644 index 95d88994b..000000000 --- a/librb/include/librb_config.h.in +++ /dev/null @@ -1,377 +0,0 @@ -/* include/librb_config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. - */ -#undef CRAY_STACKSEG_END - -/* This is a Cygwin system */ -#undef CYGWIN - -/* Define to 1 if using `alloca.c'. */ -#undef C_ALLOCA - -/* Define to 1 if you have `alloca', as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define to 1 if you have and it should be used (not on Ultrix). - */ -#undef HAVE_ALLOCA_H - -/* Define to 1 if you have the `arc4random' function. */ -#undef HAVE_ARC4RANDOM - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CRYPT_H - -/* Define to 1 if you have devpoll */ -#undef HAVE_DEVPOLL - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the `epoll_ctl' function. */ -#undef HAVE_EPOLL_CTL - -/* Define to 1 if you have the header file. */ -#undef HAVE_ERRNO_H - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the `fstat' function. */ -#undef HAVE_FSTAT - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the `getrusage' function. */ -#undef HAVE_GETRUSAGE - -/* Define to 1 if you have the `gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the `gmtime_r' function. */ -#undef HAVE_GMTIME_R - -/* Has GnuTLS */ -#undef HAVE_GNUTLS - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `kevent' function. */ -#undef HAVE_KEVENT - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TCP_H - -/* Has mbedTLS */ -#undef HAVE_MBEDTLS - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define if you have nanosleep */ -#undef HAVE_NANOSLEEP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Has OpenSSL */ -#undef HAVE_OPENSSL - -/* Define to 1 if you have the `poll' function. */ -#undef HAVE_POLL - -/* Define to 1 if you have the `port_create' function. */ -#undef HAVE_PORT_CREATE - -/* Define to 1 if you have the header file. */ -#undef HAVE_PORT_H - -/* Define to 1 if you have the `posix_spawn' function. */ -#undef HAVE_POSIX_SPAWN - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - -/* Define to 1 if you have the `sendmsg' function. */ -#undef HAVE_SENDMSG - -/* Define to 1 if you have the `signalfd' function. */ -#undef HAVE_SIGNALFD - -/* Define to 1 if you have the header file. */ -#undef HAVE_SIGNAL_H - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define to 1 if you have the `socketpair' function. */ -#undef HAVE_SOCKETPAIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_SPAWN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strlcat' function. */ -#undef HAVE_STRLCAT - -/* Define to 1 if you have the `strlcpy' function. */ -#undef HAVE_STRLCPY - -/* Define to 1 if you have the `strnlen' function. */ -#undef HAVE_STRNLEN - -/* Define to 1 if you have the `strtok_r' function. */ -#undef HAVE_STRTOK_R - -/* Define to 1 if the system has the type `struct sockaddr_in6'. */ -#undef HAVE_STRUCT_SOCKADDR_IN6 - -/* Define to 1 if the system has the type `struct sockaddr_storage'. */ -#undef HAVE_STRUCT_SOCKADDR_STORAGE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_DEVPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EVENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_POLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SIGNALFD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMERFD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UIO_H - -/* Define to 1 if you have the `timerfd_create' function. */ -#undef HAVE_TIMERFD_CREATE - -/* Define if you have timer_create */ -#undef HAVE_TIMER_CREATE - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `usleep' function. */ -#undef HAVE_USLEEP - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_VFORK_H - -/* Define to 1 if you have the `vsnprintf' function. */ -#undef HAVE_VSNPRINTF - -/* Define to 1 if you are on windows */ -#undef HAVE_WIN32 - -/* Have WINSOCK2_H */ -#undef HAVE_WINSOCK2_H - -/* Have WINSOCK_H */ -#undef HAVE_WINSOCK_H - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define to 1 if you have the `writev' function. */ -#undef HAVE_WRITEV - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#undef LT_OBJDIR - -/* This is a MinGW system */ -#undef MINGW - -/* Define this to disable debugging support. */ -#undef NDEBUG - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Prefix where librb is installed. */ -#undef RB_PREFIX - -/* Defined to mark profiling is enabled */ -#undef RB_PROFILE - -/* Define to 1 if sockaddr has a 'sa_len' member. */ -#undef SOCKADDR_IN_HAS_LEN - -/* Define this to enable soft asserts. */ -#undef SOFT_ASSERT - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at runtime. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown */ -#undef STACK_DIRECTION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...) */ -#undef USE_TIMERFD_CREATE - -/* Define to 1 if we can use timer_create(CLOCK_REALTIME,...) */ -#undef USE_TIMER_CREATE - -/* Version number of package */ -#undef VERSION - -/* This is a Windows system */ -#undef WINDOWS - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `int' if doesn't define. */ -#undef gid_t - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `int' if does not define. */ -#undef pid_t - -/* If system does not define sa_family_t, define it here. */ -#undef sa_family_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to `int' if does not define. */ -#undef ssize_t - -/* Define to `int' if doesn't define. */ -#undef uid_t - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork diff --git a/librb/install-sh b/librb/install-sh deleted file mode 100755 index 0b0fdcbba..000000000 --- a/librb/install-sh +++ /dev/null @@ -1,501 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2013-12-25.23; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -tab=' ' -nl=' -' -IFS=" $tab$nl" - -# Set DOITPROG to "echo" to test this script. - -doit=${DOITPROG-} -doit_exec=${doit:-exec} - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -is_target_a_directory=possibly - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) - is_target_a_directory=always - dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) is_target_a_directory=never;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -# We allow the use of options -d and -T together, by making -d -# take the precedence; this is for compatibility with GNU install. - -if test -n "$dir_arg"; then - if test -n "$dst_arg"; then - echo "$0: target directory not allowed when installing a directory." >&2 - exit 1 - fi -fi - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call 'install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names problematic for 'test' and other utilities. - case $src in - -* | [=\(\)!]) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - dst=$dst_arg - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test "$is_target_a_directory" = never; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - dstdir=`dirname "$dst"` - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; - esac - - oIFS=$IFS - IFS=/ - set -f - set fnord $dstdir - shift - set +f - IFS=$oIFS - - prefixes= - - for d - do - test X"$d" = X && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - set +f && - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: From 175a4a132fec4f53e5495e44b6e17e28b109ea31 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 15:17:53 -0500 Subject: [PATCH 027/252] Update gitignore --- .gitignore | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d212eb4be..74c89f499 100644 --- a/.gitignore +++ b/.gitignore @@ -12,24 +12,39 @@ Makefile .dirstamp .libs authd/authd -autom4te.cache bandb/bandb bandb/bantool +autom4te.cache +aclocal.m4 +compile +config.guess +config.sub +depcomp +ltmain.sh +missing config.log config.status configure stamp-h1 -include/setup.h libltdl/ librb/configure -librb/include/libratbox_config.h +librb/compile +librb/depcomp +librb/aclocal.m4 +librb/include/librb_config.h +librb/include/librb_config.h.in librb/include/librb-config.h +librb/librb.pc +librb/ltmain.sh +librb/missing librb/libratbox.pc librb/libtool librb/src/version.c librb/src/version.c.last scripts/*.tar.bz2 scripts/*.tar.gz +include/setup.h +include/setup.h.in ircd/charybdis ircd/lex.yy.c ircd/version.c From 1db8a313955e7b587d64979214a0078d1b161656 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 15:32:33 -0500 Subject: [PATCH 028/252] modules: fix stupid GCC false positive warning. This invocation of strlen is on a constant string and should be folded by any sane compiler (GCC included), but it warns anyway because GCC is stupid. --- ircd/modules.c | 4 +- librb/install-sh | 501 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 503 insertions(+), 2 deletions(-) create mode 100755 librb/install-sh diff --git a/ircd/modules.c b/ircd/modules.c index 6f509ed9e..b10b73792 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -227,8 +227,8 @@ load_all_modules(int warn) DIR *system_module_dir = NULL; struct dirent *ldirent = NULL; char module_fq_name[PATH_MAX + 1]; - static size_t module_ext_len = strlen(LT_MODULE_EXT); - + size_t module_ext_len = strlen(LT_MODULE_EXT); + modules_init(); modlist = (struct module **) rb_malloc(sizeof(struct module *) * (MODS_INCREMENT)); diff --git a/librb/install-sh b/librb/install-sh new file mode 100755 index 000000000..0b0fdcbba --- /dev/null +++ b/librb/install-sh @@ -0,0 +1,501 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2013-12-25.23; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: From 36e803d93a8a4fc0d9d3e234a375b94a4c879784 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 15:46:09 -0500 Subject: [PATCH 029/252] crypt: fix strict-aliasing warnings by using an explicit alias. --- librb/src/crypt.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/librb/src/crypt.c b/librb/src/crypt.c index 15c40a0bb..206027fda 100644 --- a/librb/src/crypt.c +++ b/librb/src/crypt.c @@ -1350,7 +1350,7 @@ static void rb_sha256_init_ctx(struct sha256_ctx *ctx) static void *rb_sha256_finish_ctx(struct sha256_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ - uint32_t bytes = ctx->buflen; + uint32_t bytes = ctx->buflen, *ptr; size_t pad; unsigned int i; @@ -1363,9 +1363,11 @@ static void *rb_sha256_finish_ctx(struct sha256_ctx *ctx, void *resbuf) memcpy(&ctx->buffer[bytes], SHA256_fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ - *(uint32_t *) & ctx->buffer[bytes + pad + 4] = SHA256_SWAP(ctx->total[0] << 3); - *(uint32_t *) & ctx->buffer[bytes + pad] = SHA256_SWAP((ctx->total[1] << 3) | - (ctx->total[0] >> 29)); + ptr = (uint32_t *)&ctx->buffer[bytes + pad + 4]; /* Avoid warnings about strict aliasing */ + *ptr = SHA256_SWAP(ctx->total[0] << 3); + + ptr = (uint32_t *)&ctx->buffer[bytes + pad]; + *ptr = SHA256_SWAP((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ rb_sha256_process_block(ctx->buffer, bytes + pad + 8, ctx); @@ -1924,7 +1926,7 @@ static void rb_sha512_init_ctx(struct sha512_ctx *ctx) static void *rb_sha512_finish_ctx(struct sha512_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ - uint64_t bytes = ctx->buflen; + uint64_t bytes = ctx->buflen, *ptr; size_t pad; unsigned int i; @@ -1937,9 +1939,11 @@ static void *rb_sha512_finish_ctx(struct sha512_ctx *ctx, void *resbuf) memcpy(&ctx->buffer[bytes], SHA512_fillbuf, pad); /* Put the 128-bit file length in *bits* at the end of the buffer. */ - *(uint64_t *) & ctx->buffer[bytes + pad + 8] = SHA512_SWAP(ctx->total[0] << 3); - *(uint64_t *) & ctx->buffer[bytes + pad] = SHA512_SWAP((ctx->total[1] << 3) | - (ctx->total[0] >> 61)); + ptr = (uint64_t *)&ctx->buffer[bytes + pad + 8]; /* Avoid warnings about strict aliasing */ + *ptr = SHA512_SWAP(ctx->total[0] << 3); + + ptr = (uint64_t *)&ctx->buffer[bytes + pad]; + *ptr = SHA512_SWAP((ctx->total[1] << 3) | (ctx->total[0] >> 61)); /* Process last bytes. */ rb_sha512_process_block(ctx->buffer, bytes + pad + 16, ctx); From c084fcafec061e45917e5d477d85e41767514c8c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 15:53:43 -0500 Subject: [PATCH 030/252] ircd: fix a really retarded GCC warning by being anal retentively "standards compliant" --- ircd/ircd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index 432931dee..bf9e149db 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -174,7 +174,15 @@ print_startup(int pid) /* let the parent process know the initialization was successful * -- jilles */ if (!server_state_foreground) - write(0, ".", 1); + { + if(write(0, ".", 1) < 1) + /* The circumstances in which this could fail are pretty implausible. + * However, this shuts GCC up about warning the result of write is unused, + * and is "standards compliant" behaviour. + * --Elizabeth + */ + abort(); + } if (dup2(1, 0) == -1) abort(); if (dup2(1, 2) == -1) From b429e2df0713c74e74ae60c20c5d753694541029 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 18 Mar 2016 16:25:38 -0500 Subject: [PATCH 031/252] install-sh: make +x --- install-sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 install-sh diff --git a/install-sh b/install-sh old mode 100644 new mode 100755 From 61eb4ba64abcf84df4d78ca1a010939855cb13e1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 18 Mar 2016 23:14:07 -0500 Subject: [PATCH 032/252] ircd: link libircd with -no-external --- ircd/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/Makefile.am b/ircd/Makefile.am index a1e6c7e29..03f30a50e 100644 --- a/ircd/Makefile.am +++ b/ircd/Makefile.am @@ -63,7 +63,7 @@ libircd_la_SOURCES = \ tgchange.c \ version.c \ whowas.c -libircd_la_LDFLAGS = $(EXTRA_FLAGS) -avoid-version +libircd_la_LDFLAGS = $(EXTRA_FLAGS) -avoid-version -no-undefined libircd_la_LIBADD = @LIBLTDL@ -L$(top_srcdir)/librb/src -lrb libircd_LTLIBRARIES = libircd.la From 066b05dfe29fd9cfcfa4585cf747d5dae21e3a20 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 18 Mar 2016 23:28:42 -0500 Subject: [PATCH 033/252] librb: use charybdis acinclude dir --- librb/autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librb/autogen.sh b/librb/autogen.sh index 3eaa78b60..03a67ed2a 100755 --- a/librb/autogen.sh +++ b/librb/autogen.sh @@ -80,7 +80,7 @@ parse_options "$@" cd $TOP_DIR -run_or_die $ACLOCAL +run_or_die $ACLOCAL -I ../m4 run_or_die $LIBTOOLIZE --force --copy run_or_die $AUTOHEADER run_or_die $AUTOCONF From ca372c23c9bba87d956ed74bb16652b1354b9ee2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 18 Mar 2016 23:39:13 -0500 Subject: [PATCH 034/252] bandb: embedded sqlite3: fix build on cygwin --- bandb/sqlite3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bandb/sqlite3.c b/bandb/sqlite3.c index 60cbc77f0..8716889c1 100644 --- a/bandb/sqlite3.c +++ b/bandb/sqlite3.c @@ -25168,7 +25168,7 @@ winFullPathname(sqlite3_vfs * pVfs, /* Pointer to vfs object */ { #if defined(__CYGWIN__) - cygwin_conv_to_full_win32_path(zRelative, zFull); + cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull); return SQLITE_OK; #endif From 7cc67225cb2e86de70abbd2d27565a6315c0eebe Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 Mar 2016 00:04:38 -0500 Subject: [PATCH 035/252] sslproc: return after calling free_ssl_daemon() when in sandbox ipc service routine --- ircd/sslproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/sslproc.c b/ircd/sslproc.c index 9f01f2290..8b8804bd9 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -514,7 +514,7 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl) ilog(L_MAIN, "%s", no_ssl_or_zlib); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", no_ssl_or_zlib); ssl_killall(); - break; + return; case 'V': len = ctl_buf->buflen - 1; if (len > sizeof(ctl->version) - 1) From bfc44622c8d3c9b94e89ee169e0e04d61adcc098 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 Mar 2016 00:57:32 -0500 Subject: [PATCH 036/252] ircd: do not shadow internal openssl symbol "ssl_ok" (yeah, i know) --- include/ircd.h | 4 ++-- ircd/ircd.c | 8 ++++---- ircd/listener.c | 2 +- ircd/s_conf.c | 4 ++-- ircd/s_serv.c | 2 +- ircd/sslproc.c | 10 +++++----- modules/m_connect.c | 4 ++-- modules/m_starttls.c | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/ircd.h b/include/ircd.h index 48e901eb8..96ee6bc60 100644 --- a/include/ircd.h +++ b/include/ircd.h @@ -99,8 +99,8 @@ extern int testing_conf; extern struct ev_entry *check_splitmode_ev; -extern bool ssl_ok; -extern bool zlib_ok; +extern bool ircd_ssl_ok; +extern bool ircd_zlib_ok; extern int maxconnections; void ircd_shutdown(const char *reason); diff --git a/ircd/ircd.c b/ircd/ircd.c index bf9e149db..a1ee914a2 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -105,8 +105,8 @@ bool doremotd = false; bool kline_queued = false; bool server_state_foreground = false; bool opers_see_all_users = false; -bool ssl_ok = false; -bool zlib_ok = true; +bool ircd_ssl_ok = false; +bool ircd_zlib_ok = true; int testing_conf = 0; time_t startup_time; @@ -721,10 +721,10 @@ charybdis_main(int argc, char *argv[]) if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list)) { ilog(L_MAIN, "WARNING: Unable to setup SSL."); - ssl_ok = false; + ircd_ssl_ok = false; } else - ssl_ok = true; + ircd_ssl_ok = true; } if (testing_conf) diff --git a/ircd/listener.c b/ircd/listener.c index b191333f8..9fa0ca1bc 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -523,7 +523,7 @@ accept_precallback(rb_fde_t *F, struct sockaddr *addr, rb_socklen_t addrlen, voi static time_t last_oper_notice = 0; int len; - if(listener->ssl && (!ssl_ok || !get_ssld_count())) + if(listener->ssl && (!ircd_ssl_ok || !get_ssld_count())) { rb_close(F); return 0; diff --git a/ircd/s_conf.c b/ircd/s_conf.c index aaa9f8678..18d628bd7 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -868,9 +868,9 @@ validate_conf(void) if(!rb_setup_ssl_server(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list)) { ilog(L_MAIN, "WARNING: Unable to setup SSL."); - ssl_ok = false; + ircd_ssl_ok = false; } else { - ssl_ok = true; + ircd_ssl_ok = true; send_new_ssl_certs(ServerInfo.ssl_cert, ServerInfo.ssl_private_key, ServerInfo.ssl_dh_params, ServerInfo.ssl_cipher_list); } diff --git a/ircd/s_serv.c b/ircd/s_serv.c index a479999e9..208a6fe16 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -273,7 +273,7 @@ try_connections(void *unused) continue; /* don't allow ssl connections if ssl isn't setup */ - if(ServerConfSSL(tmp_p) && (!ssl_ok || !get_ssld_count())) + if(ServerConfSSL(tmp_p) && (!ircd_ssl_ok || !get_ssld_count())) continue; cltmp = tmp_p->class; diff --git a/ircd/sslproc.c b/ircd/sslproc.c index 8b8804bd9..c66253147 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -339,7 +339,7 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co rb_close(F2); rb_close(P1); ctl = allocate_ssl_daemon(F1, P2, pid); - if(ssl_ok) + if(ircd_ssl_ok) { send_init_prng(ctl, RB_PRNG_DEFAULT, NULL); send_certfp_method(ctl, ConfigFileEntry.certfp_method); @@ -489,7 +489,7 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl) switch (*ctl_buf->buf) { case 'N': - ssl_ok = false; /* ssld says it can't do ssl/tls */ + ircd_ssl_ok = false; /* ssld says it can't do ssl/tls */ break; case 'D': ssl_process_dead_fd(ctl, ctl_buf); @@ -504,13 +504,13 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl) ssl_process_zipstats(ctl, ctl_buf); break; case 'I': - ssl_ok = false; + ircd_ssl_ok = false; ilog(L_MAIN, "%s", cannot_setup_ssl); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", cannot_setup_ssl); break; case 'U': zlib_ok = 0; - ssl_ok = false; + ircd_ssl_ok = false; ilog(L_MAIN, "%s", no_ssl_or_zlib); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", no_ssl_or_zlib); ssl_killall(); @@ -722,7 +722,7 @@ send_new_ssl_certs(const char *ssl_cert, const char *ssl_private_key, const char rb_dlink_node *ptr; if(ssl_cert == NULL || ssl_private_key == NULL || ssl_dh_params == NULL) { - ssl_ok = false; + ircd_ssl_ok = false; return; } RB_DLINK_FOREACH(ptr, ssl_daemons.head) diff --git a/modules/m_connect.c b/modules/m_connect.c index d3e4a5987..3f1db4ddf 100644 --- a/modules/m_connect.c +++ b/modules/m_connect.c @@ -99,7 +99,7 @@ mo_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour return; } - if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count())) + if(ServerConfSSL(server_p) && (!ircd_ssl_ok || !get_ssld_count())) { sendto_one_notice(source_p, ":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.", @@ -192,7 +192,7 @@ ms_connect(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour return; } - if(ServerConfSSL(server_p) && (!ssl_ok || !get_ssld_count())) + if(ServerConfSSL(server_p) && (!ircd_ssl_ok || !get_ssld_count())) { sendto_one_notice(source_p, ":Connect: Server %s is set to use SSL/TLS but SSL/TLS is not configured.", diff --git a/modules/m_starttls.c b/modules/m_starttls.c index fba20e7da..67f31d154 100644 --- a/modules/m_starttls.c +++ b/modules/m_starttls.c @@ -75,7 +75,7 @@ mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou return; } - if (!ssl_ok || !get_ssld_count()) + if (!ircd_ssl_ok || !get_ssld_count()) { sendto_one_numeric(client_p, ERR_STARTTLS, form_str(ERR_STARTTLS), "TLS is not configured"); return; From d35870ee36997dada891ad385ed779fc7679fe52 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 Mar 2016 00:58:15 -0500 Subject: [PATCH 037/252] ssld: do not shadow openssl-internal symbol "ssl_ok" (yeah, i know) --- ssld/ssld.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ssld/ssld.c b/ssld/ssld.c index 6446a6562..403a71a15 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -151,7 +151,7 @@ static void conn_plain_read_cb(rb_fde_t *fd, void *data); static void conn_plain_read_shutdown_cb(rb_fde_t *fd, void *data); static void mod_cmd_write_queue(mod_ctl_t * ctl, const void *data, size_t len); static const char *remote_closed = "Remote host closed the connection"; -static bool ssl_ok; +static bool ssld_ssl_ok; static int certfp_method = RB_SSL_CERTFP_METH_SHA1; #ifdef HAVE_LIBZ static bool zlib_ok = true; @@ -1015,7 +1015,7 @@ mod_process_cmd_recv(mod_ctl_t * ctl) break; } - if(!ssl_ok) + if(!ssld_ssl_ok) { send_nossl_support(ctl, ctl_buf); break; @@ -1031,7 +1031,7 @@ mod_process_cmd_recv(mod_ctl_t * ctl) break; } - if(!ssl_ok) + if(!ssld_ssl_ok) { send_nossl_support(ctl, ctl_buf); break; @@ -1051,7 +1051,7 @@ mod_process_cmd_recv(mod_ctl_t * ctl) } case 'K': { - if(!ssl_ok) + if(!ssld_ssl_ok) { send_nossl_support(ctl, ctl_buf); break; @@ -1237,7 +1237,7 @@ main(int argc, char **argv) setup_signals(); rb_lib_init(NULL, NULL, NULL, 0, maxfd, 1024, 4096); rb_init_rawbuffers(1024); - ssl_ok = rb_supports_ssl(); + ssld_ssl_ok = rb_supports_ssl(); mod_ctl = rb_malloc(sizeof(mod_ctl_t)); mod_ctl->F = rb_open(ctlfd, RB_FD_SOCKET, "ircd control socket"); mod_ctl->F_pipe = rb_open(pipefd, RB_FD_PIPE, "ircd pipe"); @@ -1248,7 +1248,7 @@ main(int argc, char **argv) read_pipe_ctl(mod_ctl->F_pipe, NULL); mod_read_ctl(mod_ctl->F, mod_ctl); send_version(mod_ctl); - if(!zlib_ok && !ssl_ok) + if(!zlib_ok && !ssld_ssl_ok) { /* this is really useless... */ send_i_am_useless(mod_ctl); @@ -1259,7 +1259,7 @@ main(int argc, char **argv) if(!zlib_ok) send_nozlib_support(mod_ctl, NULL); - if(!ssl_ok) + if(!ssld_ssl_ok) send_nossl_support(mod_ctl, NULL); rb_lib_loop(0); return 0; From 43f06d8d8c46cf587e2c7af15941a6f9f10cbdd3 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 Mar 2016 00:58:57 -0500 Subject: [PATCH 038/252] ircd/sslproc: same for zlib_ok --- ircd/sslproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ircd/sslproc.c b/ircd/sslproc.c index c66253147..b5c0ab297 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -509,7 +509,7 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl) sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", cannot_setup_ssl); break; case 'U': - zlib_ok = 0; + ircd_zlib_ok = 0; ircd_ssl_ok = false; ilog(L_MAIN, "%s", no_ssl_or_zlib); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s", no_ssl_or_zlib); @@ -521,7 +521,7 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl) len = sizeof(ctl->version) - 1; strncpy(ctl->version, &ctl_buf->buf[1], len); case 'z': - zlib_ok = 0; + ircd_zlib_ok = 0; break; default: ilog(L_MAIN, "Received invalid command from ssld: %s", ctl_buf->buf); From f7b37c1dc110f13c10a72d1f1b3e3b5f9bce22dd Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 19 Mar 2016 15:02:11 -0500 Subject: [PATCH 039/252] authd: add provider-specific data to auth_client via a dictionary. --- authd/provider.c | 23 +++++++++++++---------- authd/provider.h | 4 +++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index fc695bc0f..c9b3d3189 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -21,13 +21,13 @@ /* So the basic design here is to have "authentication providers" that do * things like query ident and blacklists and even open proxies. * - * Providers are registered statically in the struct auth_providers array. You will - * probably want to add an item to the provider_t enum also. + * Providers are registered in the auth_providers linked list. It is planned to + * use a bitmap to store provider ID's later. * * Providers can either return failure immediately, immediate acceptance, or * do work in the background (calling set_provider to signal this). * - * It is up to providers to keep their own state on clients if they need to. + * A dictionary is provided in auth_client for storage of provider-specific data. * * All providers must implement at a minimum a perform_provider function. You * don't have to implement the others if you don't need them. @@ -81,10 +81,9 @@ void destroy_providers(void) { if(auth_clients[i].cid) { - /* TBD - is this the right thing? - * (NOTE - this error message is designed for morons) */ - reject_client(&auth_clients[i], 0, true, - "IRC server reloading... try reconnecting in a few seconds"); + /* TBD - is this the right thing? */ + reject_client(&auth_clients[i], 0, + "Authentication system is down... try reconnecting in a few seconds"); } } @@ -138,8 +137,8 @@ void provider_done(struct auth_client *auth, provider_t id) } } -/* Reject a client, cancel outstanding providers if any if hard set to true */ -void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason) +/* Reject a client */ +void reject_client(struct auth_client *auth, provider_t id, const char *reason) { uint16_t cid = auth->cid; char reject; @@ -165,7 +164,7 @@ void reject_client(struct auth_client *auth, provider_t id, bool hard, const cha unset_provider(auth, id); - if(hard && auth->providers) + if(auth->providers) { cancel_providers(auth); memset(&auth_clients[cid], 0, sizeof(struct auth_client)); @@ -199,6 +198,7 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co struct auth_provider *provider; struct auth_client *auth; long lcid = strtol(cid, NULL, 16); + char name[20]; rb_dlink_node *ptr; if(lcid >= MAX_CLIENTS) @@ -217,6 +217,9 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); auth->c_port = (uint16_t)atoi(c_port); + snprintf("%d provider data", sizeof(name), auth->cid); + auth->data = rb_dictionary_create(name, rb_uint32cmp); + RB_DLINK_FOREACH(ptr, auth_providers.head) { provider = ptr->data; diff --git a/authd/provider.h b/authd/provider.h index 8ce7e53e6..d443c0bbe 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -50,6 +50,8 @@ struct auth_client unsigned int providers; /* Providers at work, * none left when set to 0 */ + + struct Dictionary *data; /* Provider-specific data */ }; typedef bool (*provider_init_t)(void); @@ -87,7 +89,7 @@ void cancel_providers(struct auth_client *auth); void provider_done(struct auth_client *auth, provider_t id); void accept_client(struct auth_client *auth, provider_t id); -void reject_client(struct auth_client *auth, provider_t id, bool hard, const char *reason); +void reject_client(struct auth_client *auth, provider_t id, const char *reason); void notice_client(struct auth_client *auth, const char *notice); From 893a92e7b3b3f43960928d9ef2802cde14ba718c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 19 Mar 2016 15:58:30 -0500 Subject: [PATCH 040/252] rb_dictionary: add include needed for int types. --- librb/include/rb_dictionary.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 8008f9324..88774dd6f 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -25,6 +25,8 @@ #ifndef __RB_DICTIONARY_H__ #define __RB_DICTIONARY_H__ +#include "librb-config.h" + struct Dictionary; /* defined in src/dictionary.c */ typedef int (*DCF)(/* const void *a, const void *b */); From 46d17a88b4c8edfe156f4ae7d757fd9c014a409e Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 19 Mar 2016 15:58:48 -0500 Subject: [PATCH 041/252] provider: compile fixes --- authd/provider.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index c9b3d3189..81c8dfc06 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -42,6 +42,7 @@ * --Elizafox, 9 March 2016 */ +#include "rb_dictionary.h" #include "authd.h" #include "provider.h" @@ -110,6 +111,10 @@ void cancel_providers(struct auth_client *auth) /* Cancel if required */ provider->cancel(auth); } + + /* All data should be already destroyed */ + rb_dictionary_destroy(auth->data, NULL, NULL); + auth->data = NULL; } /* Provider is done */ @@ -160,15 +165,12 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) break; } + /* TODO send back ident */ rb_helper_write(authd_helper, "R %x %c :%s", auth->cid, reject, reason); unset_provider(auth, id); - - if(auth->providers) - { - cancel_providers(auth); - memset(&auth_clients[cid], 0, sizeof(struct auth_client)); - } + cancel_providers(auth); + memset(&auth_clients[cid], 0, sizeof(struct auth_client)); } /* Accept a client, cancel outstanding providers if any */ @@ -179,10 +181,7 @@ void accept_client(struct auth_client *auth, provider_t id) rb_helper_write(authd_helper, "A %x %s %s", auth->cid, auth->username, auth->hostname); unset_provider(auth, id); - - if(auth->providers) - cancel_providers(auth); - + cancel_providers(auth); memset(&auth_clients[cid], 0, sizeof(struct auth_client)); } @@ -217,7 +216,7 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); auth->c_port = (uint16_t)atoi(c_port); - snprintf("%d provider data", sizeof(name), auth->cid); + snprintf(name, sizeof(name), "%d provider data", auth->cid); auth->data = rb_dictionary_create(name, rb_uint32cmp); RB_DLINK_FOREACH(ptr, auth_providers.head) From 2a9257c652dcd2d6d501fc2e0c0ce115978430e7 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 19 Mar 2016 15:58:30 -0500 Subject: [PATCH 042/252] rb_dictionary: add include needed for int types. --- librb/include/rb_dictionary.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 8008f9324..88774dd6f 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -25,6 +25,8 @@ #ifndef __RB_DICTIONARY_H__ #define __RB_DICTIONARY_H__ +#include "librb-config.h" + struct Dictionary; /* defined in src/dictionary.c */ typedef int (*DCF)(/* const void *a, const void *b */); From fe4224394e08f88f3994980752558bc803a5158b Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 19 Mar 2016 18:55:13 -0500 Subject: [PATCH 043/252] Can IGNORE_BOGUS_TS at the behest of @kaniini and @jilest --- configure.ac | 12 ------------ modules/core/m_join.c | 21 --------------------- modules/m_version.c | 3 --- 3 files changed, 36 deletions(-) diff --git a/configure.ac b/configure.ac index 77f7a7e0b..a33cbcc7f 100644 --- a/configure.ac +++ b/configure.ac @@ -509,18 +509,6 @@ if test "$operchghost" = yes; then AC_DEFINE(ENABLE_OPER_CHGHOST, 1, [Define this to enable opers to use the CHGHOST command.]) fi -dnl ********************************************************************** -dnl Enable ignoring of bogus timestamps -dnl ********************************************************************** - -AC_ARG_ENABLE(ignore-bogus-ts, -AC_HELP_STRING([--enable-ignore-bogus-ts],[Enable the reset of timestamps in channels to current time if set to 0. Set this network wide or not at all.]), -[ignorebogusts=$enableval],[ignorebogusts=no]) - -if test "$ignorebogusts" = yes; then - AC_DEFINE(IGNORE_BOGUS_TS, 1, [Define this to enable the reset of timestamps in channels to current time if set to 0.]) -fi - dnl Debug-related options dnl ===================== diff --git a/modules/core/m_join.c b/modules/core/m_join.c index a2e789170..d17850152 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -427,15 +427,6 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ newts = atol(parv[1]); oldts = chptr->channelts; -#ifdef IGNORE_BOGUS_TS - if(newts < 800000000) - { - sendto_realops_snomask(SNO_DEBUG, L_ALL, - "*** Bogus TS %ld on %s ignored from %s", - (long) newts, chptr->chname, client_p->name); - newts = (oldts == 0) ? oldts : 800000000; - } -#else /* making a channel TS0 */ if(!isnew && !newts && oldts) { @@ -446,7 +437,6 @@ ms_join(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ "Server %s changing TS on %s from %ld to 0", source_p->name, chptr->chname, (long) oldts); } -#endif if(isnew) chptr->channelts = newts; @@ -614,16 +604,6 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source oldts = chptr->channelts; oldmode = &chptr->mode; -#ifdef IGNORE_BOGUS_TS - if(newts < 800000000) - { - sendto_realops_snomask(SNO_DEBUG, L_ALL, - "*** Bogus TS %ld on %s ignored from %s", - (long) newts, chptr->chname, client_p->name); - - newts = (oldts == 0) ? oldts : 800000000; - } -#else if(!isnew && !newts && oldts) { sendto_channel_local(ALL_MEMBERS, chptr, @@ -634,7 +614,6 @@ ms_sjoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source "Server %s changing TS on %s from %ld to 0", source_p->name, chptr->chname, (long) oldts); } -#endif if(isnew) chptr->channelts = newts; diff --git a/modules/m_version.c b/modules/m_version.c index 597249a8d..ba099fe67 100644 --- a/modules/m_version.c +++ b/modules/m_version.c @@ -139,9 +139,6 @@ confopts(void) if(opers_see_all_users || ConfigFileEntry.operspy_dont_care_user_info) *p++ = 'S'; -#ifdef IGNORE_BOGUS_TS - *p++ = 'T'; -#endif #ifdef HAVE_LIBZ *p++ = 'Z'; From 9b8e9eb32116eb171a951fbbe93c53f1047c9a34 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 19 Mar 2016 19:14:26 -0500 Subject: [PATCH 044/252] config.h delenda est --- include/client.h | 6 +- include/config.h | 107 ----------------------- include/config.h.dist | 107 ----------------------- include/defaults.h | 68 ++++++++++++++- include/ircd.h | 2 +- include/ircd_defs.h | 6 +- include/m_info.h | 2 +- include/modules.h | 2 +- include/msg.h | 2 +- include/newconf.h | 1 - include/numeric.h | 2 +- include/s_assert.h | 2 +- include/s_serv.h | 2 +- include/s_user.h | 2 +- include/send.h | 1 - include/stdinc.h | 1 - ircd/class.c | 2 +- ircd/client.c | 2 +- ircd/ircd.c | 2 +- ircd/ircd_lexer.c | 192 ++++++++++++++++++++++++------------------ ircd/ircd_lexer.l | 2 +- ircd/ircd_parser.c | 2 +- ircd/ircd_parser.y | 2 +- ircd/match.c | 2 +- ircd/s_auth.c | 2 +- modules/core/m_ban.c | 2 +- modules/m_chghost.c | 2 +- modules/m_encap.c | 2 +- modules/m_info.c | 2 +- modules/m_operspy.c | 2 +- modules/m_services.c | 2 +- modules/m_signon.c | 2 +- modules/m_tb.c | 2 +- modules/m_xline.c | 2 +- 34 files changed, 203 insertions(+), 336 deletions(-) delete mode 100644 include/config.h delete mode 100644 include/config.h.dist diff --git a/include/client.h b/include/client.h index b8ca05019..f844aac79 100644 --- a/include/client.h +++ b/include/client.h @@ -26,11 +26,7 @@ #ifndef INCLUDED_client_h #define INCLUDED_client_h -#include "config.h" - -#if !defined(CONFIG_CHARYBDIS_LEVEL_1) -#error Incorrect config.h for this revision of ircd. -#endif +#include "defaults.h" #include "ircd_defs.h" #include "channel.h" diff --git a/include/config.h b/include/config.h deleted file mode 100644 index e30ad67bf..000000000 --- a/include/config.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * ircd-ratbox: A slightly useful ircd. - * config.h: The ircd compile-time-configurable header. - * - * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center - * Copyright (C) 1996-2002 Hybrid Development Team - * Copyright (C) 2002-2004 ircd-ratbox development team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef INCLUDED_config_h -#define INCLUDED_config_h - -#include "setup.h" - -/* - * Directory paths and filenames for UNIX systems. - * IRCD_PREFIX is set using ./configure --prefix, see INSTALL. - * The other defaults should be fine. - * - * NOTE: CHANGING THESE WILL NOT ALTER THE DIRECTORY THAT FILES WILL - * BE INSTALLED TO. IF YOU CHANGE THESE, DO NOT USE MAKE INSTALL, - * BUT COPY THE FILES MANUALLY TO WHERE YOU WANT THEM. - * - * IRCD_PREFIX = prefix for all directories, - * DPATH = root directory of installation, - * BINPATH = directory for binary files, - * ETCPATH = directory for configuration files, - * LOGPATH = directory for logfiles, - * MODPATH = directory for modules, - * AUTOMODPATH = directory for autoloaded modules - */ - -/* dirs */ -#define DPATH IRCD_PREFIX -#define BINPATH IRCD_PREFIX "/bin/" -#define MODPATH MODULE_DIR -#define AUTOMODPATH MODULE_DIR "/autoload/" -#define ETCPATH ETC_DIR -#define LOGPATH LOG_DIR -#define UHPATH HELP_DIR "/users" -#define HPATH HELP_DIR "/opers" - -/* files */ -#define SPATH BINPATH "/" PROGRAM_PREFIX "charybdis" /* ircd executable */ -#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ -#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ -#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ -#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */ -#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ -#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ - -/* HANGONGOODLINK and HANGONRETRYDELAY - * Often net breaks for a short time and it's useful to try to - * establishing the same connection again faster than CONNECTFREQUENCY - * would allow. But, to keep trying on bad connection, we require - * that connection has been open for certain minimum time - * (HANGONGOODLINK) and we give the net few seconds to steady - * (HANGONRETRYDELAY). This latter has to be long enough that the - * other end of the connection has time to notice it broke too. - */ -#define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */ -#define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */ - -/* KILLCHASETIMELIMIT - - * Max time from the nickname change that still causes KILL - * automatically to switch for the current nick of that user. (seconds) - */ -#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */ - -/* CHARYBDIS_SOMAXCONN - * Use SOMAXCONN if OS has it, otherwise use this value for the - * listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs. - */ -#define CHARYBDIS_SOMAXCONN 25 - -/* MAX_BUFFER - * The amount of fds to reserve for clients exempt from limits - * and dns lookups. - */ -#define MAX_BUFFER 60 - -/* ---------------------------------------------------------------- - * STOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOP - * ---------------------------------------------------------------- - * The options below this line should NOT be modified. - * ---------------------------------------------------------------- - */ - -#define CONFIG_CHARYBDIS_LEVEL_2 - -#include "defaults.h" -#endif /* INCLUDED_config_h */ diff --git a/include/config.h.dist b/include/config.h.dist deleted file mode 100644 index e30ad67bf..000000000 --- a/include/config.h.dist +++ /dev/null @@ -1,107 +0,0 @@ -/* - * ircd-ratbox: A slightly useful ircd. - * config.h: The ircd compile-time-configurable header. - * - * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center - * Copyright (C) 1996-2002 Hybrid Development Team - * Copyright (C) 2002-2004 ircd-ratbox development team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef INCLUDED_config_h -#define INCLUDED_config_h - -#include "setup.h" - -/* - * Directory paths and filenames for UNIX systems. - * IRCD_PREFIX is set using ./configure --prefix, see INSTALL. - * The other defaults should be fine. - * - * NOTE: CHANGING THESE WILL NOT ALTER THE DIRECTORY THAT FILES WILL - * BE INSTALLED TO. IF YOU CHANGE THESE, DO NOT USE MAKE INSTALL, - * BUT COPY THE FILES MANUALLY TO WHERE YOU WANT THEM. - * - * IRCD_PREFIX = prefix for all directories, - * DPATH = root directory of installation, - * BINPATH = directory for binary files, - * ETCPATH = directory for configuration files, - * LOGPATH = directory for logfiles, - * MODPATH = directory for modules, - * AUTOMODPATH = directory for autoloaded modules - */ - -/* dirs */ -#define DPATH IRCD_PREFIX -#define BINPATH IRCD_PREFIX "/bin/" -#define MODPATH MODULE_DIR -#define AUTOMODPATH MODULE_DIR "/autoload/" -#define ETCPATH ETC_DIR -#define LOGPATH LOG_DIR -#define UHPATH HELP_DIR "/users" -#define HPATH HELP_DIR "/opers" - -/* files */ -#define SPATH BINPATH "/" PROGRAM_PREFIX "charybdis" /* ircd executable */ -#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ -#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ -#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ -#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */ -#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ -#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ - -/* HANGONGOODLINK and HANGONRETRYDELAY - * Often net breaks for a short time and it's useful to try to - * establishing the same connection again faster than CONNECTFREQUENCY - * would allow. But, to keep trying on bad connection, we require - * that connection has been open for certain minimum time - * (HANGONGOODLINK) and we give the net few seconds to steady - * (HANGONRETRYDELAY). This latter has to be long enough that the - * other end of the connection has time to notice it broke too. - */ -#define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */ -#define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */ - -/* KILLCHASETIMELIMIT - - * Max time from the nickname change that still causes KILL - * automatically to switch for the current nick of that user. (seconds) - */ -#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */ - -/* CHARYBDIS_SOMAXCONN - * Use SOMAXCONN if OS has it, otherwise use this value for the - * listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs. - */ -#define CHARYBDIS_SOMAXCONN 25 - -/* MAX_BUFFER - * The amount of fds to reserve for clients exempt from limits - * and dns lookups. - */ -#define MAX_BUFFER 60 - -/* ---------------------------------------------------------------- - * STOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOPSTOP - * ---------------------------------------------------------------- - * The options below this line should NOT be modified. - * ---------------------------------------------------------------- - */ - -#define CONFIG_CHARYBDIS_LEVEL_2 - -#include "defaults.h" -#endif /* INCLUDED_config_h */ diff --git a/include/defaults.h b/include/defaults.h index a7f1dc909..29b05cfb3 100644 --- a/include/defaults.h +++ b/include/defaults.h @@ -25,10 +25,13 @@ #ifndef INCLUDED_defaults_h #define INCLUDED_defaults_h -/* this file is included (only) at the end of config.h, to supply default - * values for things which are now configurable at runtime. +/* /!\ DANGER WILL ROBINSON! DANGER! /!\ + * + * Do not mess with these values unless you know what you are doing! */ +#include "setup.h" + /* * First, set other fd limits based on values from user */ @@ -59,5 +62,64 @@ #define JOIN_LEAVE_COUNT_EXPIRE_TIME 120 #define MIN_SPAM_NUM 5 #define MIN_SPAM_TIME 60 -#define CONFIG_CHARYBDIS_LEVEL_1 + +/* + * Directory paths and filenames for UNIX systems. + * IRCD_PREFIX is set using ./configure --prefix, see INSTALL. + * + * IRCD_PREFIX = prefix for all directories, + * DPATH = root directory of installation, + * BINPATH = directory for binary files, + * ETCPATH = directory for configuration files, + * LOGPATH = directory for logfiles, + * MODPATH = directory for modules, + * AUTOMODPATH = directory for autoloaded modules + */ + +#define DPATH IRCD_PREFIX +#define BINPATH IRCD_PREFIX "/bin/" +#define MODPATH MODULE_DIR +#define AUTOMODPATH MODULE_DIR "/autoload/" +#define ETCPATH ETC_DIR +#define LOGPATH LOG_DIR +#define UHPATH HELP_DIR "/users" +#define HPATH HELP_DIR "/opers" +#define SPATH BINPATH "/" PROGRAM_PREFIX "charybdis" /* ircd executable */ +#define CPATH ETCPATH "/ircd.conf" /* ircd.conf file */ +#define MPATH ETCPATH "/ircd.motd" /* MOTD file */ +#define LPATH LOGPATH "/ircd.log" /* ircd logfile */ +#define PPATH PKGRUNDIR "/ircd.pid" /* pid file */ +#define OPATH ETCPATH "/opers.motd" /* oper MOTD file */ +#define DBPATH PKGLOCALSTATEDIR "/ban.db" /* bandb file */ + +/* HANGONGOODLINK and HANGONRETRYDELAY + * Often net breaks for a short time and it's useful to try to + * establishing the same connection again faster than CONNECTFREQUENCY + * would allow. But, to keep trying on bad connection, we require + * that connection has been open for certain minimum time + * (HANGONGOODLINK) and we give the net few seconds to steady + * (HANGONRETRYDELAY). This latter has to be long enough that the + * other end of the connection has time to notice it broke too. + */ +#define HANGONRETRYDELAY 60 /* Recommended value: 30-60 seconds */ +#define HANGONGOODLINK 3600 /* Recommended value: 30-60 minutes */ + +/* KILLCHASETIMELIMIT - + * Max time from the nickname change that still causes KILL + * automatically to switch for the current nick of that user. (seconds) + */ +#define KILLCHASETIMELIMIT 90 /* Recommended value: 90 */ + +/* MAX_BUFFER + * The amount of fds to reserve for clients exempt from limits + * and dns lookups. + */ +#define MAX_BUFFER 60 + +/* CHARYBDIS_SOMAXCONN + * Use SOMAXCONN if OS has it, otherwise use this value for the + * listen(); backlog. 5 for AIX/SUNOS, 25 for other OSs. + */ +#define CHARYBDIS_SOMAXCONN 25 + #endif /* INCLUDED_defaults_h */ diff --git a/include/ircd.h b/include/ircd.h index 96ee6bc60..d268efe62 100644 --- a/include/ircd.h +++ b/include/ircd.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_ircd_h #define INCLUDED_ircd_h -#include "config.h" +#include "defaults.h" struct Client; struct rb_dlink_list; diff --git a/include/ircd_defs.h b/include/ircd_defs.h index 0822a37e6..64245cd7c 100644 --- a/include/ircd_defs.h +++ b/include/ircd_defs.h @@ -35,7 +35,7 @@ #ifndef INCLUDED_ircd_defs_h #define INCLUDED_ircd_defs_h -#include "config.h" +#include "defaults.h" /* For those unfamiliar with GNU format attributes, a is the 1 based * argument number of the format string, and b is the 1 based argument @@ -56,10 +56,6 @@ #define IRC_DEPRECATED #endif -#if !defined(CONFIG_CHARYBDIS_LEVEL_1) -# error Incorrect config.h for this revision of ircd. -#endif - #define HOSTLEN 63 /* Length of hostname. Updated to */ /* comply with RFC1123 */ diff --git a/include/m_info.h b/include/m_info.h index 00eb0ab3e..d0ff6417e 100644 --- a/include/m_info.h +++ b/include/m_info.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_m_info_h #define INCLUDED_m_info_h -#include "config.h" +#include "defaults.h" typedef struct Information { diff --git a/include/modules.h b/include/modules.h index b2ff535bf..0b83bd604 100644 --- a/include/modules.h +++ b/include/modules.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_modules_h #define INCLUDED_modules_h #include "serno.h" -#include "config.h" +#include "defaults.h" #include "setup.h" #include "parse.h" diff --git a/include/msg.h b/include/msg.h index 0adc9a84c..34c69f82f 100644 --- a/include/msg.h +++ b/include/msg.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_msg_h #define INCLUDED_msg_h -#include "config.h" +#include "defaults.h" #include "msgbuf.h" struct Client; diff --git a/include/newconf.h b/include/newconf.h index fda64c640..d6c73557c 100644 --- a/include/newconf.h +++ b/include/newconf.h @@ -1,5 +1,4 @@ /* This code is in the public domain. - * $Nightmare: nightmare/include/config.h,v 1.32.2.2.2.2 2002/07/02 03:41:28 ejb Exp $ */ #ifndef _NEWCONF_H_INCLUDED diff --git a/include/numeric.h b/include/numeric.h index 465cee154..154ba98e0 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_numeric_h #define INCLUDED_numeric_h -#include "config.h" +#include "defaults.h" #include "messages.h" /* diff --git a/include/s_assert.h b/include/s_assert.h index 60ea28cd4..74a481984 100644 --- a/include/s_assert.h +++ b/include/s_assert.h @@ -26,7 +26,7 @@ #ifndef INCLUDED_s_assert_h #define INCLUDED_s_assert_h -#include "config.h" +#include "defaults.h" #ifdef SOFT_ASSERT diff --git a/include/s_serv.h b/include/s_serv.h index 5c323320b..6808c37e9 100644 --- a/include/s_serv.h +++ b/include/s_serv.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_serv_h #define INCLUDED_serv_h -#include "config.h" +#include "defaults.h" #include "capability.h" /* diff --git a/include/s_user.h b/include/s_user.h index d50c44d1d..e0f41aa30 100644 --- a/include/s_user.h +++ b/include/s_user.h @@ -25,7 +25,7 @@ #ifndef INCLUDED_s_user_h #define INCLUDED_s_user_h -#include "config.h" +#include "defaults.h" struct Client; struct User; diff --git a/include/send.h b/include/send.h index 6cb5df7bb..695ec5634 100644 --- a/include/send.h +++ b/include/send.h @@ -27,7 +27,6 @@ #include "rb_lib.h" #include "ircd_defs.h" -#include "config.h" /* HAVE_STDARG_H */ struct Client; struct Channel; diff --git a/include/stdinc.h b/include/stdinc.h index 9a32e5cec..0712e6219 100644 --- a/include/stdinc.h +++ b/include/stdinc.h @@ -22,7 +22,6 @@ */ #include "rb_lib.h" -#include "config.h" /* Gotta pull in the autoconf stuff */ #include "ircd_defs.h" /* Needed for some reasons here -- dwr */ /* AIX requires this to be the first thing in the file. */ diff --git a/ircd/class.c b/ircd/class.c index 580b9fc39..a882f405f 100644 --- a/ircd/class.c +++ b/ircd/class.c @@ -23,7 +23,7 @@ */ #include "stdinc.h" -#include "config.h" +#include "defaults.h" #include "class.h" #include "client.h" diff --git a/ircd/client.c b/ircd/client.c index bd6982d07..084891099 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -23,7 +23,7 @@ * USA */ #include "stdinc.h" -#include "config.h" +#include "defaults.h" #include "client.h" #include "class.h" diff --git a/ircd/ircd.c b/ircd/ircd.c index a1ee914a2..c24322196 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -26,7 +26,7 @@ #include "rb_lib.h" #include "stdinc.h" #include "setup.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "channel.h" #include "class.h" diff --git a/ircd/ircd_lexer.c b/ircd/ircd_lexer.c index 23a8c135c..b2c7c003d 100644 --- a/ircd/ircd_lexer.c +++ b/ircd/ircd_lexer.c @@ -7,8 +7,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 0 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -46,7 +46,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -54,7 +53,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -85,6 +83,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -141,7 +141,15 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -167,6 +175,7 @@ extern FILE *yyin, *yyout; #define EOB_ACT_LAST_MATCH 2 #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -332,7 +341,7 @@ void yyfree (void * ); /* Begin user sect3 */ -#define yywrap(n) 1 +#define yywrap() (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; @@ -346,11 +355,17 @@ extern int yylineno; int yylineno = 1; extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif #define yytext_ptr yytext static yy_state_type yy_get_previous_state (void ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); static int yy_get_next_buffer (void ); +#if defined(__GNUC__) && __GNUC__ >= 3 +__attribute__((__noreturn__)) +#endif static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the @@ -359,7 +374,7 @@ static void yy_fatal_error (yyconst char msg[] ); #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ (yytext_ptr) -= (yy_more_len); \ - yyleng = (yy_size_t) (yy_cp - (yytext_ptr)); \ + yyleng = (size_t) (yy_cp - (yytext_ptr)); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; @@ -382,7 +397,7 @@ static yyconst flex_int16_t yy_accept[47] = 0, 1, 0, 1, 8, 0 } ; -static yyconst flex_int32_t yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -414,7 +429,7 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[34] = +static yyconst YY_CHAR yy_meta[34] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, @@ -422,7 +437,7 @@ static yyconst flex_int32_t yy_meta[34] = 3, 3, 1 } ; -static yyconst flex_int16_t yy_base[54] = +static yyconst flex_uint16_t yy_base[54] = { 0, 0, 28, 81, 104, 78, 0, 10, 0, 31, 64, 56, 0, 20, 24, 0, 12, 104, 0, 104, 22, @@ -442,7 +457,7 @@ static yyconst flex_int16_t yy_def[54] = 46, 46, 46 } ; -static yyconst flex_int16_t yy_nxt[138] = +static yyconst flex_uint16_t yy_nxt[138] = { 0, 4, 5, 6, 7, 8, 4, 9, 10, 11, 23, 4, 4, 17, 17, 17, 17, 26, 13, 44, 44, @@ -513,8 +528,9 @@ char *yytext; * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA + * */ -#line 26 "ircd_lexer.l" +#line 25 "ircd_lexer.l" #include #include @@ -529,7 +545,7 @@ char *yytext; #include "stdinc.h" #include "ircd_defs.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "logger.h" #include "s_conf.h" #include "newconf.h" @@ -563,7 +579,7 @@ char linebuf[512]; #define YY_INPUT(buf,result,max_size) \ if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \ YY_FATAL_ERROR("input in flex scanner failed"); -#line 569 "ircd_lexer.c" +#line 583 "ircd_lexer.c" #define INITIAL 0 @@ -596,11 +612,11 @@ void yyset_extra (YY_EXTRA_TYPE user_defined ); FILE *yyget_in (void ); -void yyset_in (FILE * in_str ); +void yyset_in (FILE * _in_str ); FILE *yyget_out (void ); -void yyset_out (FILE * out_str ); +void yyset_out (FILE * _out_str ); yy_size_t yyget_leng (void ); @@ -608,7 +624,7 @@ char *yyget_text (void ); int yyget_lineno (void ); -void yyset_lineno (int line_number ); +void yyset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -622,6 +638,10 @@ extern int yywrap (void ); #endif #endif +#ifndef YY_NO_UNPUT + +#endif + #ifndef yytext_ptr static void yy_flex_strncpy (char *,yyconst char *,int ); #endif @@ -642,7 +662,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -650,7 +675,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -661,7 +686,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -729,7 +754,7 @@ extern int yylex (void); /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -739,14 +764,10 @@ extern int yylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; -#line 83 "ircd_lexer.l" - -#line 751 "ircd_lexer.c" - if ( !(yy_init) ) { (yy_init) = 1; @@ -773,7 +794,12 @@ YY_DECL yy_load_buffer_state( ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 82 "ircd_lexer.l" + +#line 801 "ircd_lexer.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { (yy_more_len) = 0; if ( (yy_more_flag) ) @@ -795,7 +821,7 @@ YY_DECL yy_match: do { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -836,39 +862,39 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 84 "ircd_lexer.l" +#line 83 "ircd_lexer.l" { cinclude(); } YY_BREAK case 2: YY_RULE_SETUP -#line 85 "ircd_lexer.l" +#line 84 "ircd_lexer.l" { ccomment(); } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 86 "ircd_lexer.l" +#line 85 "ircd_lexer.l" { strcpy(linebuf, yytext+1); lineno++; yyless(1); } YY_BREAK case 4: YY_RULE_SETUP -#line 88 "ircd_lexer.l" +#line 87 "ircd_lexer.l" ; YY_BREAK case 5: YY_RULE_SETUP -#line 89 "ircd_lexer.l" +#line 88 "ircd_lexer.l" { hashcomment(); } YY_BREAK case 6: YY_RULE_SETUP -#line 91 "ircd_lexer.l" +#line 90 "ircd_lexer.l" { yylval.number = atoi(yytext); return NUMBER; } YY_BREAK case 7: /* rule 7 can match eol */ YY_RULE_SETUP -#line 93 "ircd_lexer.l" +#line 92 "ircd_lexer.l" { if(yytext[yyleng-2] == '\\') { @@ -916,12 +942,12 @@ YY_RULE_SETUP YY_BREAK case 8: YY_RULE_SETUP -#line 139 "ircd_lexer.l" +#line 138 "ircd_lexer.l" { return LOADMODULE; } YY_BREAK case 9: YY_RULE_SETUP -#line 140 "ircd_lexer.l" +#line 139 "ircd_lexer.l" { strcpy(yylval.string, yytext); yylval.string[yyleng] = '\0'; @@ -930,24 +956,24 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 146 "ircd_lexer.l" +#line 145 "ircd_lexer.l" { return TWODOTS; } YY_BREAK case 11: YY_RULE_SETUP -#line 147 "ircd_lexer.l" +#line 146 "ircd_lexer.l" { return yytext[0]; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 148 "ircd_lexer.l" +#line 147 "ircd_lexer.l" { if (ieof()) yyterminate(); } YY_BREAK case 12: YY_RULE_SETUP -#line 149 "ircd_lexer.l" +#line 148 "ircd_lexer.l" ECHO; YY_BREAK -#line 953 "ircd_lexer.c" +#line 977 "ircd_lexer.c" case YY_END_OF_BUFFER: { @@ -1076,6 +1102,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ + } /* end of user's declarations */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer @@ -1087,9 +1114,9 @@ ECHO; */ static int yy_get_next_buffer (void) { - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = (yytext_ptr); - register int number_to_move, i; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + yy_size_t number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1118,7 +1145,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -1138,7 +1165,7 @@ static int yy_get_next_buffer (void) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) ((yy_c_buf_p) - b->yy_ch_buf); @@ -1221,14 +1248,14 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; yy_current_state = (yy_start); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1253,10 +1280,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - register int yy_is_jam; - register char *yy_cp = (yy_c_buf_p); + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); - register YY_CHAR yy_c = 1; + YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1271,9 +1298,13 @@ static int yy_get_next_buffer (void) yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 46); - return yy_is_jam ? 0 : yy_current_state; + return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (void) @@ -1322,7 +1353,7 @@ static int yy_get_next_buffer (void) case EOB_ACT_END_OF_FILE: { if ( yywrap( ) ) - return 0; + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -1423,7 +1454,7 @@ static void yy_load_buffer_state (void) if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. @@ -1458,10 +1489,6 @@ static void yy_load_buffer_state (void) yyfree((void *) b ); } -#ifndef __cplusplus -extern int isatty (int ); -#endif /* __cplusplus */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a yyrestart() or at EOF. @@ -1582,7 +1609,7 @@ static void yyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; + num_to_alloc = 1; // After all that talk, this was set to 1 anyways... (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); @@ -1599,7 +1626,7 @@ static void yyensure_buffer_stack (void) if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc @@ -1666,8 +1693,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -1675,7 +1702,8 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ n = _yybytes_len + 2; @@ -1706,7 +1734,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len static void yy_fatal_error (yyconst char* msg ) { - (void) fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -1772,29 +1800,29 @@ char *yyget_text (void) } /** Set the current line number. - * @param line_number + * @param _line_number line number * */ -void yyset_lineno (int line_number ) +void yyset_lineno (int _line_number ) { - yylineno = line_number; + yylineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * * @see yy_switch_to_buffer */ -void yyset_in (FILE * in_str ) +void yyset_in (FILE * _in_str ) { - yyin = in_str ; + yyin = _in_str ; } -void yyset_out (FILE * out_str ) +void yyset_out (FILE * _out_str ) { - yyout = out_str ; + yyout = _out_str ; } int yyget_debug (void) @@ -1802,9 +1830,9 @@ int yyget_debug (void) return yy_flex_debug; } -void yyset_debug (int bdebug ) +void yyset_debug (int _bdebug ) { - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } static int yy_init_globals (void) @@ -1864,7 +1892,8 @@ int yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - register int i; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -1873,7 +1902,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -1883,11 +1912,12 @@ static int yy_flex_strlen (yyconst char * s ) void *yyalloc (yy_size_t size ) { - return (void *) malloc( size ); + return (void *) malloc( size ); } void *yyrealloc (void * ptr, yy_size_t size ) { + /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1900,12 +1930,12 @@ void *yyrealloc (void * ptr, yy_size_t size ) void yyfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 149 "ircd_lexer.l" +#line 148 "ircd_lexer.l" diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index 43b79f680..e9dd482a8 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -36,7 +36,7 @@ #include "stdinc.h" #include "ircd_defs.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "logger.h" #include "s_conf.h" #include "newconf.h" diff --git a/ircd/ircd_parser.c b/ircd/ircd_parser.c index a20c2eafc..16d879101 100644 --- a/ircd/ircd_parser.c +++ b/ircd/ircd_parser.c @@ -78,7 +78,7 @@ #include "setup.h" #include "common.h" #include "ircd_defs.h" -#include "config.h" +#include "defaults.h" #include "client.h" #include "modules.h" #include "newconf.h" diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index ca76d9d9a..92716ae54 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -17,7 +17,7 @@ #include "setup.h" #include "common.h" #include "ircd_defs.h" -#include "config.h" +#include "defaults.h" #include "client.h" #include "modules.h" #include "newconf.h" diff --git a/ircd/match.c b/ircd/match.c index dc4d0f881..87a1c7eff 100644 --- a/ircd/match.c +++ b/ircd/match.c @@ -18,7 +18,7 @@ * */ #include "stdinc.h" -#include "config.h" +#include "defaults.h" #include "client.h" #include "ircd.h" #include "match.h" diff --git a/ircd/s_auth.c b/ircd/s_auth.c index 86ce272f6..ea237808a 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -34,7 +34,7 @@ * --Bleep Thomas Helvey */ #include "stdinc.h" -#include "config.h" +#include "defaults.h" #include "s_auth.h" #include "s_conf.h" #include "client.h" diff --git a/modules/core/m_ban.c b/modules/core/m_ban.c index b46e830b0..a9ffbce29 100644 --- a/modules/core/m_ban.c +++ b/modules/core/m_ban.c @@ -32,7 +32,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "match.h" #include "s_conf.h" diff --git a/modules/m_chghost.c b/modules/m_chghost.c index e8b235e07..4a964620f 100644 --- a/modules/m_chghost.c +++ b/modules/m_chghost.c @@ -14,7 +14,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "numeric.h" #include "s_conf.h" diff --git a/modules/m_encap.c b/modules/m_encap.c index 9ba07d1ef..afa4b239d 100644 --- a/modules/m_encap.c +++ b/modules/m_encap.c @@ -32,7 +32,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "numeric.h" #include "s_serv.h" diff --git a/modules/m_info.c b/modules/m_info.c index b5cc9c612..733df8be9 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -779,7 +779,7 @@ send_conf_options(struct Client *source_p) /* * Now send them a list of all our configuration options - * (mostly from config.h) + * (mostly from defaults.h) */ for (infoptr = MyInformation; infoptr->name; infoptr++) { diff --git a/modules/m_operspy.c b/modules/m_operspy.c index 9ad565fe0..241019509 100644 --- a/modules/m_operspy.c +++ b/modules/m_operspy.c @@ -32,7 +32,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "numeric.h" #include "s_serv.h" diff --git a/modules/m_services.c b/modules/m_services.c index 558722f34..515ac735f 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -33,7 +33,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "numeric.h" #include "s_conf.h" diff --git a/modules/m_signon.c b/modules/m_signon.c index 59f757cf8..ad866d968 100644 --- a/modules/m_signon.c +++ b/modules/m_signon.c @@ -33,7 +33,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "numeric.h" #include "s_conf.h" diff --git a/modules/m_tb.c b/modules/m_tb.c index 2b6e70984..2ca66a505 100644 --- a/modules/m_tb.c +++ b/modules/m_tb.c @@ -33,7 +33,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "ircd.h" #include "match.h" #include "s_conf.h" diff --git a/modules/m_xline.c b/modules/m_xline.c index 02c162af4..52ef33218 100644 --- a/modules/m_xline.c +++ b/modules/m_xline.c @@ -33,7 +33,7 @@ #include "channel.h" #include "client.h" #include "common.h" -#include "config.h" +#include "defaults.h" #include "class.h" #include "ircd.h" #include "numeric.h" From 72b51232a961dc0b8345165907f7709e8d93aa9d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 Mar 2016 19:22:14 -0500 Subject: [PATCH 045/252] ensure we do not distribute flex/bison files --- .gitignore | 6 +- ircd/ircd_lexer.c | 2052 -------------------------------------------- ircd/ircd_parser.c | 1817 --------------------------------------- ircd/ircd_parser.h | 86 -- 4 files changed, 3 insertions(+), 3958 deletions(-) delete mode 100644 ircd/ircd_lexer.c delete mode 100644 ircd/ircd_parser.c delete mode 100644 ircd/ircd_parser.h diff --git a/.gitignore b/.gitignore index 74c89f499..5f6506f20 100644 --- a/.gitignore +++ b/.gitignore @@ -46,11 +46,11 @@ scripts/*.tar.gz include/setup.h include/setup.h.in ircd/charybdis -ircd/lex.yy.c +ircd/ircd_parser.c +ircd/ircd_parser.h +ircd/ircd_lexer.c ircd/version.c ircd/version.c.last -ircd/y.tab.h -ircd/y.tab.c ssld/ssld tools/charybdis-mkpasswd tools/genssl diff --git a/ircd/ircd_lexer.c b/ircd/ircd_lexer.c deleted file mode 100644 index b2c7c003d..000000000 --- a/ircd/ircd_lexer.c +++ /dev/null @@ -1,2052 +0,0 @@ - -#line 3 "ircd_lexer.c" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 0 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ - -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) - -#define YY_USE_CONST - -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ - -#ifdef YY_USE_CONST -#define yyconst const -#else -#define yyconst -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * - -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START - -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart(yyin ) - -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern yy_size_t yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - #define YY_LESS_LINENO(n) - #define YY_LINENO_REWIND_TO(ptr) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) - -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - yy_size_t yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) - -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ -yy_size_t yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = (char *) 0; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); - -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); - -#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); - -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); - -#define yy_new_buffer yy_create_buffer - -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } - -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer(yyin,YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } - -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define yywrap() (/*CONSTCOND*/1) -#define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; - -FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; - -typedef int yy_state_type; - -extern int yylineno; - -int yylineno = 1; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -static yy_state_type yy_get_previous_state (void ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); -static int yy_get_next_buffer (void ); -#if defined(__GNUC__) && __GNUC__ >= 3 -__attribute__((__noreturn__)) -#endif -static void yy_fatal_error (yyconst char msg[] ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - (yytext_ptr) -= (yy_more_len); \ - yyleng = (size_t) (yy_cp - (yytext_ptr)); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; - -#define YY_NUM_RULES 12 -#define YY_END_OF_BUFFER 13 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static yyconst flex_int16_t yy_accept[47] = - { 0, - 4, 4, 13, 11, 4, 3, 11, 5, 11, 11, - 6, 9, 9, 4, 3, 0, 7, 5, 10, 0, - 2, 6, 9, 9, 0, 9, 0, 9, 0, 9, - 0, 9, 0, 9, 0, 9, 0, 0, 0, 9, - 0, 1, 0, 1, 8, 0 - } ; - -static yyconst YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, - 1, 6, 1, 1, 1, 7, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 10, 1, 11, - 1, 12, 1, 1, 13, 10, 14, 15, 16, 10, - 10, 10, 17, 10, 10, 18, 19, 20, 21, 10, - 10, 10, 10, 10, 22, 10, 10, 10, 10, 10, - 1, 1, 1, 1, 10, 1, 23, 10, 24, 25, - - 26, 10, 10, 10, 27, 10, 10, 28, 29, 30, - 31, 10, 10, 10, 10, 10, 32, 10, 10, 10, - 10, 10, 1, 1, 1, 33, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -static yyconst YY_CHAR yy_meta[34] = - { 0, - 1, 1, 2, 1, 1, 1, 1, 1, 3, 3, - 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 1 - } ; - -static yyconst flex_uint16_t yy_base[54] = - { 0, - 0, 28, 81, 104, 78, 0, 10, 0, 31, 64, - 56, 0, 20, 24, 0, 12, 104, 0, 104, 22, - 104, 16, 0, 4, 29, 29, 27, 28, 27, 29, - 46, 47, 47, 42, 64, 49, 74, 20, 11, 53, - 18, 17, 8, 7, 0, 104, 85, 88, 91, 94, - 7, 97, 100 - } ; - -static yyconst flex_int16_t yy_def[54] = - { 0, - 47, 47, 46, 46, 46, 48, 49, 50, 46, 46, - 46, 51, 51, 46, 48, 49, 46, 50, 46, 46, - 46, 46, 51, 51, 46, 51, 46, 51, 46, 51, - 46, 51, 46, 51, 46, 51, 46, 52, 53, 51, - 52, 52, 53, 53, 51, 0, 46, 46, 46, 46, - 46, 46, 46 - } ; - -static yyconst flex_uint16_t yy_nxt[138] = - { 0, - 4, 5, 6, 7, 8, 4, 9, 10, 11, 23, - 4, 4, 17, 17, 17, 17, 26, 13, 44, 44, - 42, 42, 44, 42, 22, 14, 26, 13, 4, 5, - 6, 7, 8, 4, 9, 10, 11, 19, 4, 4, - 24, 25, 27, 28, 29, 13, 30, 20, 31, 32, - 24, 25, 27, 28, 29, 13, 30, 20, 31, 32, - 33, 34, 35, 36, 22, 37, 40, 38, 45, 21, - 33, 34, 35, 36, 39, 37, 40, 38, 45, 14, - 46, 46, 46, 46, 39, 12, 12, 12, 15, 46, - 15, 16, 16, 16, 18, 46, 18, 41, 46, 41, - - 43, 46, 43, 3, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46 - } ; - -static yyconst flex_int16_t yy_chk[138] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, - 1, 1, 7, 7, 16, 16, 24, 1, 44, 43, - 42, 41, 39, 38, 22, 14, 24, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 9, 2, 2, - 13, 20, 25, 26, 27, 2, 28, 9, 29, 30, - 13, 20, 25, 26, 27, 2, 28, 9, 29, 30, - 31, 32, 33, 34, 11, 35, 36, 35, 40, 10, - 31, 32, 33, 34, 35, 37, 36, 37, 40, 5, - 3, 0, 0, 0, 37, 47, 47, 47, 48, 0, - 48, 49, 49, 49, 50, 0, 50, 52, 0, 52, - - 53, 0, 53, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46 - } ; - -static yy_state_type yy_last_accepting_state; -static char *yy_last_accepting_cpos; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -static int yy_more_flag = 0; -static int yy_more_len = 0; -#define yymore() ((yy_more_flag) = 1) -#define YY_MORE_ADJ (yy_more_len) -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#line 1 "ircd_lexer.l" -/* src/ircd_lexer.l - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - * - */ -#line 25 "ircd_lexer.l" -#include -#include - -#include - -#include -#include -#include - -#define WE_ARE_MEMORY_C - -#include "stdinc.h" -#include "ircd_defs.h" -#include "common.h" -#include "defaults.h" -#include "logger.h" -#include "s_conf.h" -#include "newconf.h" - -#include "ircd_parser.h" - -int yylex(void); - -#define MAX_INCLUDE_DEPTH 10 - -YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; -int include_stack_ptr=0; -int lineno = 1; -void ccomment(void); -void cinclude(void); -void hashcomment(void); -int ieof(void); -int lineno_stack[MAX_INCLUDE_DEPTH]; -char conffile_stack[MAX_INCLUDE_DEPTH][IRCD_BUFSIZE]; -char conffilebuf[IRCD_BUFSIZE+1]; -char *current_file = conffilebuf; - -FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH]; - -char linebuf[512]; - -#undef YY_INPUT - -#define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg) - -#define YY_INPUT(buf,result,max_size) \ - if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \ - YY_FATAL_ERROR("input in flex scanner failed"); -#line 583 "ircd_lexer.c" - -#define INITIAL 0 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals (void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy (void ); - -int yyget_debug (void ); - -void yyset_debug (int debug_flag ); - -YY_EXTRA_TYPE yyget_extra (void ); - -void yyset_extra (YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in (void ); - -void yyset_in (FILE * _in_str ); - -FILE *yyget_out (void ); - -void yyset_out (FILE * _out_str ); - -yy_size_t yyget_leng (void ); - -char *yyget_text (void ); - -int yyget_lineno (void ); - -void yyset_lineno (int _line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap (void ); -#else -extern int yywrap (void ); -#endif -#endif - -#ifndef YY_NO_UNPUT - -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); -#endif - -#ifndef YY_NO_INPUT - -#ifdef __cplusplus -static int yyinput (void ); -#else -static int input (void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ - { \ - int c = '*'; \ - size_t n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else \ - { \ - errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - } \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - { -#line 82 "ircd_lexer.l" - -#line 801 "ircd_lexer.c" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { - (yy_more_len) = 0; - if ( (yy_more_flag) ) - { - (yy_more_len) = (yy_c_buf_p) - (yytext_ptr); - (yy_more_flag) = 0; - } - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 47 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 104 ); - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - yy_act = yy_accept[yy_current_state]; - } - - YY_DO_BEFORE_ACTION; - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - -case 1: -YY_RULE_SETUP -#line 83 "ircd_lexer.l" -{ cinclude(); } - YY_BREAK -case 2: -YY_RULE_SETUP -#line 84 "ircd_lexer.l" -{ ccomment(); } - YY_BREAK -case 3: -/* rule 3 can match eol */ -YY_RULE_SETUP -#line 85 "ircd_lexer.l" -{ strcpy(linebuf, yytext+1); lineno++; yyless(1); } - YY_BREAK -case 4: -YY_RULE_SETUP -#line 87 "ircd_lexer.l" -; - YY_BREAK -case 5: -YY_RULE_SETUP -#line 88 "ircd_lexer.l" -{ hashcomment(); } - YY_BREAK -case 6: -YY_RULE_SETUP -#line 90 "ircd_lexer.l" -{ yylval.number = atoi(yytext); return NUMBER; } - YY_BREAK -case 7: -/* rule 7 can match eol */ -YY_RULE_SETUP -#line 92 "ircd_lexer.l" -{ - if(yytext[yyleng-2] == '\\') - { - yyless(yyleng-1); /* return last quote */ - yymore(); /* append next string */ - } - else - { - strcpy(yylval.string, yytext + 1); - if(yylval.string[yyleng-2] != '"') - ilog(L_MAIN, "Unterminated character string"); - else - { - int i,j; - yylval.string[yyleng-2] = '\0'; /* remove close - * quote - */ - - for (j=i=0 ;yylval.string[i] != '\0'; i++,j++) - { - if (yylval.string[i] != '\\') - { - yylval.string[j] = yylval.string[i]; - } - else - { - i++; - if (yylval.string[i] == '\0') /* XXX - * should not - * happen - */ - { - ilog(L_MAIN, - "Unterminated character string"); - break; - } - yylval.string[j] = yylval.string[i]; - } - } - yylval.string[j] = '\0'; - return QSTRING; - } - } - } - YY_BREAK -case 8: -YY_RULE_SETUP -#line 138 "ircd_lexer.l" -{ return LOADMODULE; } - YY_BREAK -case 9: -YY_RULE_SETUP -#line 139 "ircd_lexer.l" -{ - strcpy(yylval.string, yytext); - yylval.string[yyleng] = '\0'; - return STRING; - } - YY_BREAK -case 10: -YY_RULE_SETUP -#line 145 "ircd_lexer.l" -{ return TWODOTS; } - YY_BREAK -case 11: -YY_RULE_SETUP -#line 146 "ircd_lexer.l" -{ return yytext[0]; } - YY_BREAK -case YY_STATE_EOF(INITIAL): -#line 147 "ircd_lexer.l" -{ if (ieof()) yyterminate(); } - YY_BREAK -case 12: -YY_RULE_SETUP -#line 148 "ircd_lexer.l" -ECHO; - YY_BREAK -#line 977 "ircd_lexer.c" - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - yy_size_t number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - yy_size_t num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - yy_size_t new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart(yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 47 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); - - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - (yy_last_accepting_state) = yy_current_state; - (yy_last_accepting_cpos) = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 47 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 46); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart(yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = (yy_size_t)size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer(b,file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); - - yyfree((void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer(b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; // After all that talk, this was set to 1 anyways... - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer(b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) -{ - - return yy_scan_bytes(yystr,strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - yy_size_t i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yy_fatal_error (yyconst char* msg ) -{ - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -yy_size_t yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param _line_number line number - * - */ -void yyset_lineno (int _line_number ) -{ - - yylineno = _line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * _in_str ) -{ - yyin = _in_str ; -} - -void yyset_out (FILE * _out_str ) -{ - yyout = _out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int _bdebug ) -{ - yy_flex_debug = _bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - (yy_buffer_stack) = 0; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = (char *) 0; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = (FILE *) 0; - yyout = (FILE *) 0; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) -{ - - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return (void *) malloc( size ); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -#line 148 "ircd_lexer.l" - - - -/* C-comment ignoring routine -kre*/ -void ccomment() -{ - int c; - - /* log(L_NOTICE, "got comment"); */ - while (1) - { - while ((c = input()) != '*' && c != EOF) - if (c == '\n') ++lineno; - if (c == '*') - { - while ((c = input()) == '*'); - if (c == '/') - break; - if (c == '\n') ++lineno; - } - if (c == EOF) - { - YY_FATAL_ERROR("EOF in comment"); - /* XXX hack alert this disables - * the stupid unused function warning - * gcc generates - */ - yy_fatal_error("EOF in comment"); - break; - } - } -} - -void cinclude(void) -{ - char *c; - if ((c = strchr(yytext, '<')) == NULL) - *strchr(c = strchr(yytext, '"') + 1, '"') = 0; - else - *strchr(++c, '>') = 0; - - /* do stacking and co. */ - if (include_stack_ptr >= MAX_INCLUDE_DEPTH) - conf_report_error("Includes nested too deep (max is %d)", MAX_INCLUDE_DEPTH); - else - { - FILE *tmp_fbfile_in; - - tmp_fbfile_in = fopen(c, "r"); - - if (tmp_fbfile_in == NULL) - { - /* if its not found in PREFIX, look in ETCPATH */ - char fnamebuf[IRCD_BUFSIZE]; - - snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ETCPATH, c); - tmp_fbfile_in = fopen(fnamebuf, "r"); - - /* wasnt found there either.. error. */ - if(tmp_fbfile_in == NULL) - { - conf_report_error("Include %s: %s.", c, strerror(errno)); - return; - } - } - lineno_stack[include_stack_ptr] = lineno; - lineno = 1; - inc_fbfile_in[include_stack_ptr] = conf_fbfile_in; - strcpy(conffile_stack[include_stack_ptr], c); - current_file = conffile_stack[include_stack_ptr]; - include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; - conf_fbfile_in = tmp_fbfile_in; - yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); - } -} - -int ieof(void) -{ - if (include_stack_ptr) - fclose(conf_fbfile_in); - if (--include_stack_ptr < 0) - { - /* We will now exit the lexer - restore init values if we get /rehash - * later and reenter lexer -kre */ - include_stack_ptr = 0; - lineno = 1; - return 1; - } - /* switch buffer */ - yy_delete_buffer(YY_CURRENT_BUFFER); - lineno = lineno_stack[include_stack_ptr]; - conf_fbfile_in = inc_fbfile_in[include_stack_ptr]; - - if(include_stack_ptr) - current_file = conffile_stack[include_stack_ptr]; - else - current_file = conffilebuf; - - yy_switch_to_buffer(include_stack[include_stack_ptr]); - return 0; -} - -/* #-comment style, look for #include */ -#define INCLUDE "#include" - -void hashcomment(void) -{ - if (strlen(yytext) < sizeof(INCLUDE) - 1) - return; - - if (!strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1)) - yyerror("You probably meant '.include', skipping"); -} - diff --git a/ircd/ircd_parser.c b/ircd/ircd_parser.c deleted file mode 100644 index 16d879101..000000000 --- a/ircd/ircd_parser.c +++ /dev/null @@ -1,1817 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0.4" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - - - -/* Copy the first part of user declarations. */ -#line 5 "ircd_parser.y" /* yacc.c:339 */ - -#include -#include - -#include - -#include -#include -#include -#include -#define WE_ARE_MEMORY_C -#include "stdinc.h" -#include "setup.h" -#include "common.h" -#include "ircd_defs.h" -#include "defaults.h" -#include "client.h" -#include "modules.h" -#include "newconf.h" - -#define YY_NO_UNPUT - -int yyparse(void); -void yyerror(const char *); -int yylex(void); - -static time_t conf_find_time(char*); - -static struct { - const char * name; - const char * plural; - time_t val; -} ircd_times[] = { - {"second", "seconds", 1}, - {"minute", "minutes", 60}, - {"hour", "hours", 60 * 60}, - {"day", "days", 60 * 60 * 24}, - {"week", "weeks", 60 * 60 * 24 * 7}, - {"fortnight", "fortnights", 60 * 60 * 24 * 14}, - {"month", "months", 60 * 60 * 24 * 7 * 4}, - {"year", "years", 60 * 60 * 24 * 365}, - /* ok-- we now do sizes here too. they aren't times, but - it's close enough */ - {"byte", "bytes", 1}, - {"kb", NULL, 1024}, - {"kbyte", "kbytes", 1024}, - {"kilobyte", "kilebytes", 1024}, - {"mb", NULL, 1024 * 1024}, - {"mbyte", "mbytes", 1024 * 1024}, - {"megabyte", "megabytes", 1024 * 1024}, - {NULL, NULL, 0}, -}; - -time_t conf_find_time(char *name) -{ - int i; - - for (i = 0; ircd_times[i].name; i++) - { - if (strcasecmp(ircd_times[i].name, name) == 0 || - (ircd_times[i].plural && strcasecmp(ircd_times[i].plural, name) == 0)) - return ircd_times[i].val; - } - - return 0; -} - -static struct -{ - const char *word; - int yesno; -} yesno[] = { - {"yes", 1}, - {"no", 0}, - {"true", 1}, - {"false", 0}, - {"on", 1}, - {"off", 0}, - {NULL, 0} -}; - -static int conf_get_yesno_value(char *str) -{ - int i; - - for (i = 0; yesno[i].word; i++) - { - if (strcasecmp(str, yesno[i].word) == 0) - { - return yesno[i].yesno; - } - } - - return -1; -} - -static void free_cur_list(conf_parm_t* list) -{ - if (list->type == CF_STRING || list->type == CF_QSTRING) { - rb_free(list->v.string); - } else if (list->type == CF_FLIST) { - /* Even though CF_FLIST is a flag, comparing with == is valid - * because conf_parm_t.type must be either a type or one flag. - */ - free_cur_list(list->v.list); - } - - if (list->next) { - free_cur_list(list->next); - } - - rb_free(list); -} - - -conf_parm_t * cur_list = NULL; - -static void add_cur_list_cpt(conf_parm_t *new) -{ - if (cur_list == NULL) - { - cur_list = rb_malloc(sizeof(conf_parm_t)); - cur_list->type = CF_FLIST; - cur_list->v.list = new; - } - else - { - new->next = cur_list->v.list; - cur_list->v.list = new; - } -} - -static void add_cur_list(int type, char *str, int number) -{ - conf_parm_t *new; - - new = rb_malloc(sizeof(conf_parm_t)); - new->next = NULL; - new->type = type; - - switch(type) - { - case CF_INT: - case CF_TIME: - case CF_YESNO: - new->v.number = number; - break; - case CF_STRING: - case CF_QSTRING: - new->v.string = rb_strdup(str); - break; - } - - add_cur_list_cpt(new); -} - - - -#line 225 "ircd_parser.c" /* yacc.c:339 */ - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "y.tab.h". */ -#ifndef YY_YY_IRCD_PARSER_H_INCLUDED -# define YY_YY_IRCD_PARSER_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - LOADMODULE = 258, - TWODOTS = 259, - QSTRING = 260, - STRING = 261, - NUMBER = 262 - }; -#endif -/* Tokens. */ -#define LOADMODULE 258 -#define TWODOTS 259 -#define QSTRING 260 -#define STRING 261 -#define NUMBER 262 - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE -{ -#line 164 "ircd_parser.y" /* yacc.c:355 */ - - int number; - char string[IRCD_BUFSIZE + 1]; - conf_parm_t * conf_parm; - -#line 285 "ircd_parser.c" /* yacc.c:355 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE yylval; - -int yyparse (void); - -#endif /* !YY_YY_IRCD_PARSER_H_INCLUDED */ - -/* Copy the second part of user declarations. */ - -#line 302 "ircd_parser.c" /* yacc.c:358 */ - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 3 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 42 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 13 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 17 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 29 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 45 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 262 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 12, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, - 2, 11, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 8, 2, 9, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 183, 183, 184, 185, 188, 189, 193, 192, 202, - 201, 212, 213, 216, 224, 225, 228, 232, 252, 258, - 264, 270, 293, 292, 307, 308, 309, 311, 323, 327 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "LOADMODULE", "TWODOTS", "QSTRING", - "STRING", "NUMBER", "'{'", "'}'", "';'", "'='", "','", "$accept", "conf", - "conf_item", "block", "$@1", "$@2", "block_items", "block_item", - "itemlist", "single", "oneitem", "loadmodule", "$@3", "qstring", - "string", "number", "timespec", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 123, 125, - 59, 61, 44 -}; -# endif - -#define YYPACT_NINF -33 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-33))) - -#define YYTABLE_NINF -3 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int8 yypact[] = -{ - 11, -33, 13, -33, 2, -33, -33, -33, -33, 16, - -33, -33, 18, -33, 19, 22, 24, -33, 9, -33, - 23, 22, 20, -33, -1, 14, -33, -33, 15, -33, - 29, -33, -33, 22, 17, 27, -33, -1, -1, -33, - 22, 17, -33, -33, -33 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 4, 0, 1, 0, 25, 3, 5, 6, 7, - 22, 24, 0, 9, 0, 0, 0, 23, 0, 12, - 0, 0, 0, 11, 0, 0, 8, 26, 0, 15, - 16, 18, 21, 20, 19, 0, 13, 0, 0, 27, - 29, 28, 10, 14, 17 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = -{ - -33, -33, -33, -33, -33, -33, 21, -17, -33, 3, - 1, -33, -33, 32, -2, -32, -31 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int8 yydefgoto[] = -{ - -1, 2, 6, 7, 12, 16, 18, 19, 28, 29, - 30, 8, 14, 31, 20, 33, 34 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int8 yytable[] = -{ - 9, 23, 40, 41, 11, 5, 27, 10, 23, 40, - 41, -2, 1, 3, -2, 5, 4, -2, 22, 5, - 5, 11, 32, 35, 27, 36, 15, 37, 5, 17, - 26, 39, 21, 38, 24, 32, 32, 42, 39, 44, - 43, 13, 25 -}; - -static const yytype_uint8 yycheck[] = -{ - 2, 18, 34, 34, 5, 6, 7, 5, 25, 41, - 41, 0, 1, 0, 3, 6, 3, 6, 9, 6, - 6, 5, 24, 9, 7, 10, 8, 12, 6, 10, - 10, 33, 8, 4, 11, 37, 38, 10, 40, 38, - 37, 9, 21 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 1, 14, 0, 3, 6, 15, 16, 24, 27, - 5, 5, 17, 26, 25, 8, 18, 10, 19, 20, - 27, 8, 9, 20, 11, 19, 10, 7, 21, 22, - 23, 26, 27, 28, 29, 9, 10, 12, 4, 27, - 28, 29, 10, 22, 23 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 13, 14, 14, 14, 15, 15, 17, 16, 18, - 16, 19, 19, 20, 21, 21, 22, 22, 23, 23, - 23, 23, 25, 24, 26, 27, 28, 29, 29, 29 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 0, 2, 1, 1, 1, 0, 6, 0, - 7, 2, 1, 4, 3, 1, 1, 3, 1, 1, - 1, 1, 0, 4, 1, 1, 1, 2, 2, 2 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -{ - YYUSE (yyvaluep); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (void) -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 7: -#line 193 "ircd_parser.y" /* yacc.c:1646 */ - { - conf_start_block((yyvsp[0].string), NULL); - } -#line 1402 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 8: -#line 197 "ircd_parser.y" /* yacc.c:1646 */ - { - if (conf_cur_block) - conf_end_block(conf_cur_block); - } -#line 1411 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 9: -#line 202 "ircd_parser.y" /* yacc.c:1646 */ - { - conf_start_block((yyvsp[-1].string), (yyvsp[0].string)); - } -#line 1419 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 10: -#line 206 "ircd_parser.y" /* yacc.c:1646 */ - { - if (conf_cur_block) - conf_end_block(conf_cur_block); - } -#line 1428 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 13: -#line 217 "ircd_parser.y" /* yacc.c:1646 */ - { - conf_call_set(conf_cur_block, (yyvsp[-3].string), cur_list); - free_cur_list(cur_list); - cur_list = NULL; - } -#line 1438 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 16: -#line 229 "ircd_parser.y" /* yacc.c:1646 */ - { - add_cur_list_cpt((yyvsp[0].conf_parm)); - } -#line 1446 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 17: -#line 233 "ircd_parser.y" /* yacc.c:1646 */ - { - /* "1 .. 5" meaning 1,2,3,4,5 - only valid for integers */ - if ((yyvsp[-2].conf_parm)->type != CF_INT || (yyvsp[0].conf_parm)->type != CF_INT) - { - conf_report_error("Both arguments in '..' notation must be integers."); - break; - } - else - { - int i; - - for (i = (yyvsp[-2].conf_parm)->v.number; i <= (yyvsp[0].conf_parm)->v.number; i++) - { - add_cur_list(CF_INT, 0, i); - } - } - } -#line 1468 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 18: -#line 253 "ircd_parser.y" /* yacc.c:1646 */ - { - (yyval.conf_parm) = rb_malloc(sizeof(conf_parm_t)); - (yyval.conf_parm)->type = CF_QSTRING; - (yyval.conf_parm)->v.string = rb_strdup((yyvsp[0].string)); - } -#line 1478 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 19: -#line 259 "ircd_parser.y" /* yacc.c:1646 */ - { - (yyval.conf_parm) = rb_malloc(sizeof(conf_parm_t)); - (yyval.conf_parm)->type = CF_TIME; - (yyval.conf_parm)->v.number = (yyvsp[0].number); - } -#line 1488 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 20: -#line 265 "ircd_parser.y" /* yacc.c:1646 */ - { - (yyval.conf_parm) = rb_malloc(sizeof(conf_parm_t)); - (yyval.conf_parm)->type = CF_INT; - (yyval.conf_parm)->v.number = (yyvsp[0].number); - } -#line 1498 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 21: -#line 271 "ircd_parser.y" /* yacc.c:1646 */ - { - /* a 'string' could also be a yes/no value .. - so pass it as that, if so */ - int val = conf_get_yesno_value((yyvsp[0].string)); - - (yyval.conf_parm) = rb_malloc(sizeof(conf_parm_t)); - - if (val != -1) - { - (yyval.conf_parm)->type = CF_YESNO; - (yyval.conf_parm)->v.number = val; - } - else - { - (yyval.conf_parm)->type = CF_STRING; - (yyval.conf_parm)->v.string = rb_strdup((yyvsp[0].string)); - } - } -#line 1521 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 22: -#line 293 "ircd_parser.y" /* yacc.c:1646 */ - { - char *m_bn; - m_bn = rb_basename((char *) (yyvsp[0].string)); - - if (findmodule_byname(m_bn) == -1) - { - load_one_module((yyvsp[0].string), MAPI_ORIGIN_EXTENSION, 0); - } - - rb_free(m_bn); - } -#line 1537 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 24: -#line 307 "ircd_parser.y" /* yacc.c:1646 */ - { strcpy((yyval.string), (yyvsp[0].string)); } -#line 1543 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 25: -#line 308 "ircd_parser.y" /* yacc.c:1646 */ - { strcpy((yyval.string), (yyvsp[0].string)); } -#line 1549 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 26: -#line 309 "ircd_parser.y" /* yacc.c:1646 */ - { (yyval.number) = (yyvsp[0].number); } -#line 1555 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 27: -#line 312 "ircd_parser.y" /* yacc.c:1646 */ - { - time_t t; - - if ((t = conf_find_time((yyvsp[0].string))) == 0) - { - conf_report_error("Unrecognised time type/size '%s'", (yyvsp[0].string)); - t = 1; - } - - (yyval.number) = (yyvsp[-1].number) * t; - } -#line 1571 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 28: -#line 324 "ircd_parser.y" /* yacc.c:1646 */ - { - (yyval.number) = (yyvsp[-1].number) + (yyvsp[0].number); - } -#line 1579 "ircd_parser.c" /* yacc.c:1646 */ - break; - - case 29: -#line 328 "ircd_parser.y" /* yacc.c:1646 */ - { - (yyval.number) = (yyvsp[-1].number) + (yyvsp[0].number); - } -#line 1587 "ircd_parser.c" /* yacc.c:1646 */ - break; - - -#line 1591 "ircd_parser.c" /* yacc.c:1646 */ - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} diff --git a/ircd/ircd_parser.h b/ircd/ircd_parser.h deleted file mode 100644 index 5247dfc52..000000000 --- a/ircd/ircd_parser.h +++ /dev/null @@ -1,86 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -#ifndef YY_YY_IRCD_PARSER_H_INCLUDED -# define YY_YY_IRCD_PARSER_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - LOADMODULE = 258, - TWODOTS = 259, - QSTRING = 260, - STRING = 261, - NUMBER = 262 - }; -#endif -/* Tokens. */ -#define LOADMODULE 258 -#define TWODOTS 259 -#define QSTRING 260 -#define STRING 261 -#define NUMBER 262 - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE -{ -#line 164 "ircd_parser.y" /* yacc.c:1909 */ - - int number; - char string[IRCD_BUFSIZE + 1]; - conf_parm_t * conf_parm; - -#line 74 "ircd_parser.h" /* yacc.c:1909 */ -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE yylval; - -int yyparse (void); - -#endif /* !YY_YY_IRCD_PARSER_H_INCLUDED */ From 1859e9d7d7a0fe3569ab4cc91b8dcc3d44722cd9 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 19 Mar 2016 23:05:07 -0500 Subject: [PATCH 046/252] ircd: remove basically entirely pointless ServerInfo.hub (closes #167) --- doc/ircd.conf.example | 1 - doc/reference.conf | 5 ----- doc/server-version-info.txt | 4 ---- ircd/newconf.c | 1 - ircd/s_conf.c | 2 -- ircd/s_serv.c | 13 ------------- modules/m_info.c | 6 ------ modules/m_version.c | 4 ---- 8 files changed, 36 deletions(-) diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 9f2616610..d7525a7a7 100644 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -51,7 +51,6 @@ serverinfo { sid = "42X"; description = "charybdis test server"; network_name = "StaticBox"; - hub = yes; /* On multi-homed hosts you may need the following. These define * the addresses we connect from to other servers. */ diff --git a/doc/reference.conf b/doc/reference.conf index a72a7539d..5c9bd0b58 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -134,11 +134,6 @@ serverinfo { */ network_name = "MyNet"; - /* hub: allow this server to act as a hub and have multiple servers - * connected to it. - */ - hub = no; - /* vhost: the IP to bind to when we connect outward to ipv4 servers. * This should be an ipv4 IP only. */ diff --git a/doc/server-version-info.txt b/doc/server-version-info.txt index 6019ee73c..194c6b35b 100644 --- a/doc/server-version-info.txt +++ b/doc/server-version-info.txt @@ -17,8 +17,6 @@ +----------------------------+ | 'e' | USE_EXCEPT | |------+---------------------| - | 'H' | HUB | - |------+---------------------| | 'I' | USE_INVEX | |------+---------------------| | 'K' | USE_KNOCK | @@ -29,8 +27,6 @@ |------+---------------------| | 'S' | OPERS_SEE_ALL_USERS | |------+---------------------| - | 'T' | IGNORE_BOGUS_TS | - |------+---------------------| | 'Z' | ZIPLINKS | |------+---------------------| | '6' | IPv6 | diff --git a/ircd/newconf.c b/ircd/newconf.c index a08775980..974f798b5 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -2265,7 +2265,6 @@ remove_conf_item(const char *topconf, const char *name) static struct ConfEntry conf_serverinfo_table[] = { { "description", CF_QSTRING, NULL, 0, &ServerInfo.description }, - { "hub", CF_YESNO, NULL, 0, &ServerInfo.hub }, { "network_name", CF_QSTRING, conf_set_serverinfo_network_name, 0, NULL }, { "name", CF_QSTRING, conf_set_serverinfo_name, 0, NULL }, diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 18d628bd7..78bf23d87 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -690,8 +690,6 @@ set_default_conf(void) ServerInfo.specific_ipv6_vhost = 0; #endif - /* Don't reset hub, as that will break lazylinks */ - /* ServerInfo.hub = false; */ AdminInfo.name = NULL; AdminInfo.email = NULL; AdminInfo.description = NULL; diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 208a6fe16..9f4d37356 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -797,19 +797,6 @@ server_estab(struct Client *client_p) /* Its got identd , since its a server */ SetGotId(client_p); - /* If there is something in the serv_list, it might be this - * connecting server.. - */ - if(!ServerInfo.hub && serv_list.head) - { - if(client_p != serv_list.head->data || serv_list.head->next) - { - ServerStats.is_ref++; - sendto_one(client_p, "ERROR :I'm a leaf not a hub"); - return exit_client(client_p, client_p, client_p, "I'm a leaf"); - } - } - if(IsUnknown(client_p)) { /* the server may be linking based on certificate fingerprint now. --nenolod */ diff --git a/modules/m_info.c b/modules/m_info.c index 733df8be9..60461e16c 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -285,12 +285,6 @@ static struct InfoStruct info_table[] = { &ConfigFileEntry.hide_spoof_ips, "Hide IPs of spoofed users" }, - { - "hub", - OUTPUT_BOOLEAN_YN, - &ServerInfo.hub, - "Server is a hub" - }, { "kline_delay", OUTPUT_DECIMAL, diff --git a/modules/m_version.c b/modules/m_version.c index ba099fe67..02cc63696 100644 --- a/modules/m_version.c +++ b/modules/m_version.c @@ -124,10 +124,6 @@ confopts(void) if(ConfigChannel.use_except) *p++ = 'e'; - /* might wanna hide this :P */ - if(ServerInfo.hub) - *p++ = 'H'; - if(ConfigChannel.use_invex) *p++ = 'I'; From b45a2f351ee10e1550423dd1fe9038ba5c723f33 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:11:06 -0500 Subject: [PATCH 047/252] configure: check -lws2_32 for socket() too --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a33cbcc7f..408c0868e 100644 --- a/configure.ac +++ b/configure.ac @@ -141,7 +141,7 @@ AC_CHECK_SIZEOF(long long) dnl Networking Functions dnl ==================== -AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])]) +AC_SEARCH_LIBS(socket, [socket ws2_32], , [AC_MSG_ERROR([You have no socket()! Aborting.])]) dnl SunOS/Solaris required libnsl for inet_ntoa() if test x"$SUN" = xyes; then From b68dee9bcb0f397d7ba134a0ccdc7dc6d7047465 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:18:42 -0500 Subject: [PATCH 048/252] librb: only install WSA stubs if windows SDK does not provide them --- librb/include/rb_lib.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h index c7ad3e29e..75b3f1bc9 100644 --- a/librb/include/rb_lib.h +++ b/librb/include/rb_lib.h @@ -83,14 +83,37 @@ char *alloca(); char *rb_strerror(int error); +#ifndef ENOBUFS #define ENOBUFS WSAENOBUFS +#endif + +#ifndef EINPROGRESS #define EINPROGRESS WSAEINPROGRESS +#endif + +#ifndef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK +#endif + +#ifndef EMSGSIZE #define EMSGSIZE WSAEMSGSIZE +#endif + +#ifndef EALREADY #define EALREADY WSAEALREADY +#endif + +#ifndef EISCONN #define EISCONN WSAEISCONN +#endif + +#ifndef EADDRINUSE #define EADDRINUSE WSAEADDRINUSE +#endif + +#ifndef EAFNOSUPPORT #define EAFNOSUPPORT WSAEAFNOSUPPORT +#endif #define pipe(x) _pipe(x, 1024, O_BINARY) #define ioctl(x,y,z) ioctlsocket(x,y, (u_long *)z) From dc7e6b42ca28185816b38eaa709dac98d052e741 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:33:19 -0500 Subject: [PATCH 049/252] librb: some win32 fixes --- librb/include/commio-int.h | 6 ++++-- librb/include/rb_commio.h | 2 +- librb/src/commio.c | 22 +++++++++++----------- librb/src/win32.c | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/librb/include/commio-int.h b/librb/include/commio-int.h index 90cdf2fb6..f89f499fb 100644 --- a/librb/include/commio-int.h +++ b/librb/include/commio-int.h @@ -36,8 +36,10 @@ #ifdef _WIN32 #define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0) +typedef SOCKET rb_platform_fd_t; #else #define rb_get_errno() +typedef int rb_platform_fd_t; #endif #define rb_hash_fd(x) ((x ^ (x >> RB_FD_HASH_BITS) ^ (x >> (RB_FD_HASH_BITS * 2))) & RB_FD_HASH_MASK) @@ -104,7 +106,7 @@ struct _fde * filedescriptor. Think though: when do you think we'll need more? */ rb_dlink_node node; - int fd; /* So we can use the rb_fde_t as a callback ptr */ + rb_platform_fd_t fd; /* So we can use the rb_fde_t as a callback ptr */ uint8_t flags; uint8_t type; int pflags; @@ -136,7 +138,7 @@ typedef struct timer_data extern rb_dlink_list *rb_fd_table; static inline rb_fde_t * -rb_find_fd(int fd) +rb_find_fd(rb_platform_fd_t fd) { rb_dlink_list *hlist; rb_dlink_node *ptr; diff --git a/librb/include/rb_commio.h b/librb/include/rb_commio.h index 92e75950f..ab5af404b 100644 --- a/librb/include/rb_commio.h +++ b/librb/include/rb_commio.h @@ -154,7 +154,7 @@ int rb_get_fd(rb_fde_t *F); const char *rb_get_ssl_strerror(rb_fde_t *F); int rb_get_ssl_certfp(rb_fde_t *F, uint8_t certfp[RB_SSL_CERTFP_LEN], int method); -rb_fde_t *rb_get_fde(int fd); +rb_fde_t *rb_get_fde(rb_platform_fd_t fd); int rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasize, pid_t pid); int rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int count); diff --git a/librb/src/commio.c b/librb/src/commio.c index b3f1c1824..31f48506d 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -79,7 +79,7 @@ static int rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2); #endif static inline rb_fde_t * -add_fd(int fd) +add_fd(rb_platform_fd_t fd) { rb_fde_t *F = rb_find_fd(fd); @@ -230,7 +230,7 @@ rb_set_nb(rb_fde_t *F) { int nonb = 0; int res; - int fd; + rb_platform_fd_t fd; if(F == NULL) return 0; fd = F->fd; @@ -409,7 +409,7 @@ rb_accept_tcp(rb_fde_t *F, ACPRE * precb, ACCB * callback, void *data) } /* - * void rb_connect_tcp(int fd, struct sockaddr *dest, + * void rb_connect_tcp(rb_platform_fd_t fd, struct sockaddr *dest, * struct sockaddr *clocal, int socklen, * CNCB *callback, void *data, int timeout) * Input: An fd to connect with, a host and port to connect to, @@ -496,7 +496,7 @@ rb_connect_timeout(rb_fde_t *F, void *notused) rb_connect_callback(F, RB_ERR_TIMEOUT); } -/* static void rb_connect_tryconnect(int fd, void *notused) +/* static void rb_connect_tryconnect(rb_platform_fd_t fd, void *notused) * Input: The fd, the handler data(unused). * Output: None. * Side-effects: Try and connect with pending connect data for the FD. If @@ -627,7 +627,7 @@ int rb_pipe(rb_fde_t **F1, rb_fde_t **F2, const char *desc) { #ifndef _WIN32 - int fd[2]; + rb_platform_fd_t fd[2]; if(number_fd >= rb_maxconnections) { errno = ENFILE; @@ -677,7 +677,7 @@ rb_fde_t * rb_socket(int family, int sock_type, int proto, const char *note) { rb_fde_t *F; - int fd; + rb_platform_fd_t fd; /* First, make sure we aren't going to run out of file descriptors */ if(rb_unlikely(number_fd >= rb_maxconnections)) { @@ -821,7 +821,7 @@ rb_fdlist_init(int closeall, int maxfds, size_t heapsize) /* Called to open a given filedescriptor */ rb_fde_t * -rb_open(int fd, uint8_t type, const char *desc) +rb_open(rb_platform_fd_t fd, uint8_t type, const char *desc) { rb_fde_t *F; lrb_assert(fd >= 0); @@ -979,7 +979,7 @@ rb_get_fd(rb_fde_t *F) } rb_fde_t * -rb_get_fde(int fd) +rb_get_fde(rb_platform_fd_t fd) { return rb_find_fd(fd); } @@ -1609,7 +1609,7 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2) struct sockaddr_in addr[2]; rb_socklen_t size = sizeof(struct sockaddr_in); rb_fde_t *F[2]; - unsigned int fd[2]; + unsigned rb_platform_fd_t fd[2]; int i, got; unsigned short port; struct timeval wait = { 0, 100000 }; @@ -1713,7 +1713,7 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2) int -rb_inet_socketpair(int family, int type, int protocol, int fd[2]) +rb_inet_socketpair(int family, int type, int protocol, rb_platform_fd_t fd[2]) { int listener = -1; int connector = -1; @@ -2136,7 +2136,7 @@ rb_recv_fd_buf(rb_fde_t *F, void *data, size_t datasize, rb_fde_t **xF, int nfds struct stat st; uint8_t stype = RB_FD_UNKNOWN; const char *desc; - int fd, len, x, rfds; + rb_platform_fd_t fd, len, x, rfds; int control_len = CMSG_SPACE(sizeof(int) * nfds); diff --git a/librb/src/win32.c b/librb/src/win32.c index 71013431b..b1011a50d 100644 --- a/librb/src/win32.c +++ b/librb/src/win32.c @@ -94,7 +94,7 @@ rb_spawn_process(const char *path, const char **argv) } pid_t -rb_waitpid(int pid, int *status, int flags) +rb_waitpid(pid_t pid, int *status, int flags) { DWORD timeout = (flags & WNOHANG) ? 0 : INFINITE; HANDLE hProcess; @@ -152,7 +152,7 @@ rb_setenv(const char *name, const char *value, int overwrite) } int -rb_kill(int pid, int sig) +rb_kill(pid_t pid, int sig) { HANDLE hProcess; int ret = -1; From 17e4e6af836d4f3623130b24000d2339569ee80a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:35:13 -0500 Subject: [PATCH 050/252] librb: further cleanups --- librb/include/commio-int.h | 9 --------- librb/include/rb_lib.h | 8 +++++++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/librb/include/commio-int.h b/librb/include/commio-int.h index f89f499fb..6a4bfb874 100644 --- a/librb/include/commio-int.h +++ b/librb/include/commio-int.h @@ -33,15 +33,6 @@ #define FD_DESC_SZ 128 /* hostlen + comment */ - -#ifdef _WIN32 -#define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0) -typedef SOCKET rb_platform_fd_t; -#else -#define rb_get_errno() -typedef int rb_platform_fd_t; -#endif - #define rb_hash_fd(x) ((x ^ (x >> RB_FD_HASH_BITS) ^ (x >> (RB_FD_HASH_BITS * 2))) & RB_FD_HASH_MASK) #ifdef HAVE_WRITEV diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h index 75b3f1bc9..626fc78e8 100644 --- a/librb/include/rb_lib.h +++ b/librb/include/rb_lib.h @@ -66,7 +66,13 @@ char *alloca(); #define rb_unlikely(x) (x) #endif - +#ifdef _WIN32 +#define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0) +typedef SOCKET rb_platform_fd_t; +#else +#define rb_get_errno() +typedef int rb_platform_fd_t; +#endif #ifdef _WIN32 #include From 7dbf237f9322b4fef2eb81dc0fb61266be9c8a8c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:36:35 -0500 Subject: [PATCH 051/252] commio: win32 fixes --- librb/src/commio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/librb/src/commio.c b/librb/src/commio.c index 31f48506d..6a9009789 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -1609,7 +1609,7 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2) struct sockaddr_in addr[2]; rb_socklen_t size = sizeof(struct sockaddr_in); rb_fde_t *F[2]; - unsigned rb_platform_fd_t fd[2]; + rb_platform_fd_t fd[2]; int i, got; unsigned short port; struct timeval wait = { 0, 100000 }; @@ -1693,7 +1693,9 @@ rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2) return 0; #ifdef _WIN32 +#ifndef ECONNABORTED #define ECONNABORTED WSAECONNABORTED +#endif #endif abort_failed: From 339150ec6024b599915f798142a5de6463e16b17 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:37:50 -0500 Subject: [PATCH 052/252] commio: further win32 fixes --- librb/include/rb_commio.h | 2 +- librb/src/commio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/librb/include/rb_commio.h b/librb/include/rb_commio.h index ab5af404b..7337604ed 100644 --- a/librb/include/rb_commio.h +++ b/librb/include/rb_commio.h @@ -88,7 +88,7 @@ struct rb_iovec void rb_fdlist_init(int closeall, int maxfds, size_t heapsize); -rb_fde_t *rb_open(int, uint8_t, const char *); +rb_fde_t *rb_open(rb_platform_fd_t, uint8_t, const char *); void rb_close(rb_fde_t *); void rb_dump_fd(DUMPCB *, void *xdata); void rb_note(rb_fde_t *, const char *); diff --git a/librb/src/commio.c b/librb/src/commio.c index 6a9009789..1c323245a 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -74,7 +74,7 @@ static void mangle_mapped_sockaddr(struct sockaddr *in); #endif #ifndef HAVE_SOCKETPAIR -static int rb_inet_socketpair(int d, int type, int protocol, int sv[2]); +static int rb_inet_socketpair(int d, int type, int protocol, rb_platform_fd_t sv[2]); static int rb_inet_socketpair_udp(rb_fde_t **newF1, rb_fde_t **newF2); #endif From e49147e56ea8973e235400ea9c84cd3205b0dce5 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:38:46 -0500 Subject: [PATCH 053/252] commio: even more win32 fixes --- librb/src/commio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librb/src/commio.c b/librb/src/commio.c index 1c323245a..21bc226ec 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -564,7 +564,7 @@ rb_errstr(int error) int rb_socketpair(int family, int sock_type, int proto, rb_fde_t **F1, rb_fde_t **F2, const char *note) { - int nfd[2]; + rb_platform_fd_t nfd[2]; if(number_fd >= rb_maxconnections) { errno = ENFILE; From b1f7e4098f5c13c1de5f3fe8606e4ffb2a3ee639 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 00:41:01 -0500 Subject: [PATCH 054/252] librb: win32: more cleanups --- librb/include/rb_commio.h | 2 +- librb/src/commio.c | 2 +- librb/src/helper.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/librb/include/rb_commio.h b/librb/include/rb_commio.h index 7337604ed..09317ce95 100644 --- a/librb/include/rb_commio.h +++ b/librb/include/rb_commio.h @@ -150,7 +150,7 @@ void rb_setselect(rb_fde_t *, unsigned int type, PF * handler, void *client_data void rb_init_netio(void); int rb_select(unsigned long); int rb_fd_ssl(rb_fde_t *F); -int rb_get_fd(rb_fde_t *F); +rb_platform_fd_t rb_get_fd(rb_fde_t *F); const char *rb_get_ssl_strerror(rb_fde_t *F); int rb_get_ssl_certfp(rb_fde_t *F, uint8_t certfp[RB_SSL_CERTFP_LEN], int method); diff --git a/librb/src/commio.c b/librb/src/commio.c index 21bc226ec..15bd5080c 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -970,7 +970,7 @@ rb_fd_ssl(rb_fde_t *F) return 0; } -int +rb_platform_fd_t rb_get_fd(rb_fde_t *F) { if(F == NULL) diff --git a/librb/src/helper.c b/librb/src/helper.c index a41fa8794..0e653deaf 100644 --- a/librb/src/helper.c +++ b/librb/src/helper.c @@ -78,7 +78,7 @@ rb_helper_child(rb_helper_cb * read_cb, rb_helper_cb * error_cb, log_cb * ilog, if(x > 2) /* don't undo what we just did */ close(x); #else - x = 0; /* shut gcc up */ + (void) x; /* shut gcc up */ #endif rb_lib_init(ilog, irestart, idie, 0, maxfd, dh_size, fd_heap_size); From 76ebf6c489825a572a436f9e3e051aafe78a0a61 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:16:41 -0500 Subject: [PATCH 055/252] authd: initial pass at win32 porting --- authd/Makefile.am | 2 +- authd/getaddrinfo.c | 617 ++++++++++++++++++++++++++++++++++++++++++++ authd/getaddrinfo.h | 130 ++++++++++ authd/getnameinfo.c | 242 +++++++++++++++++ authd/getnameinfo.h | 41 +++ authd/reslib.c | 12 + authd/reslist.c | 276 ++++++++++++++++++++ include/stdinc.h | 2 - 8 files changed, 1319 insertions(+), 3 deletions(-) create mode 100644 authd/getaddrinfo.c create mode 100644 authd/getaddrinfo.h create mode 100644 authd/getnameinfo.c create mode 100644 authd/getnameinfo.h create mode 100644 authd/reslist.c diff --git a/authd/Makefile.am b/authd/Makefile.am index e1b705e14..1b8ebf710 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -3,5 +3,5 @@ AM_CFLAGS=$(WARNFLAGS) AM_CPPFLAGS = -I../include -I../librb/include -authd_SOURCES = authd.c res.c reslib.c dns.c +authd_SOURCES = authd.c res.c reslib.c reslist.c getnameinfo.c getaddrinfo.c dns.c authd_LDADD = ../librb/src/librb.la diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.c new file mode 100644 index 000000000..482e648bd --- /dev/null +++ b/authd/getaddrinfo.c @@ -0,0 +1,617 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifdef _WIN32 +#include +#include "getaddrinfo.h" + +/* $Id$ */ + +static const char in_addrany[] = { 0, 0, 0, 0 }; +static const char in_loopback[] = { 127, 0, 0, 1 }; +static const char in6_addrany[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; +static const char in6_loopback[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 +}; + +static const struct afd { + int a_af; + int a_addrlen; + int a_socklen; + int a_off; + const char *a_addrany; + const char *a_loopback; + int a_scoped; +} afdl [] = { +#define N_INET6 0 +#ifdef IPV6 + {PF_INET6, sizeof(struct in6_addr), + sizeof(struct sockaddr_in6), + offsetof(struct sockaddr_in6, sin6_addr), + in6_addrany, in6_loopback, 1}, +#endif +#define N_INET 1 + {PF_INET, sizeof(struct in_addr), + sizeof(struct sockaddr_in), + offsetof(struct sockaddr_in, sin_addr), + in_addrany, in_loopback, 0}, + {0, 0, 0, 0, NULL, NULL, 0}, +}; + +struct explore { + int e_af; + int e_socktype; + int e_protocol; + const char *e_protostr; + int e_wild; +#define WILD_AF(ex) ((ex)->e_wild & 0x01) +#define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02) +#define WILD_PROTOCOL(ex) ((ex)->e_wild & 0x04) +}; + +static const struct explore explore[] = { +#ifdef IPV6 + { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_INET6, SOCK_RAW, ANY, NULL, 0x05 }, +#endif + { PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_INET, SOCK_RAW, ANY, NULL, 0x05 }, + { PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 }, + { PF_UNSPEC, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 }, + { PF_UNSPEC, SOCK_RAW, ANY, NULL, 0x05 }, + { -1, 0, 0, NULL, 0 }, +}; + +#define PTON_MAX 16 + +static int str_isnumber(const char *); +static int explore_null(const struct rb_addrinfo *, + const char *, struct rb_addrinfo **); +static int explore_numeric(const struct rb_addrinfo *, const char *, + const char *, struct rb_addrinfo **); +static struct rb_addrinfo *get_ai(const struct rb_addrinfo *, + const struct afd *, const char *); +static int get_portmatch(const struct rb_addrinfo *, const char *); +static int get_port(struct rb_addrinfo *, const char *, int); +static const struct afd *find_afd(int); +#if 0 +/* We will need this should we ever want gai_strerror() */ +static char *ai_errlist[] = { + "Success", + "Address family for hostname not supported", /* EAI_ADDRFAMILY */ + "Temporary failure in name resolution", /* EAI_AGAIN */ + "Invalid value for ai_flags", /* EAI_BADFLAGS */ + "Non-recoverable failure in name resolution", /* EAI_FAIL */ + "ai_family not supported", /* EAI_FAMILY */ + "Memory allocation failure", /* EAI_MEMORY */ + "No address associated with hostname", /* EAI_NODATA */ + "hostname nor servname provided, or not known", /* EAI_NONAME */ + "servname not supported for ai_socktype", /* EAI_SERVICE */ + "ai_socktype not supported", /* EAI_SOCKTYPE */ + "System error returned in errno", /* EAI_SYSTEM */ + "Invalid value for hints", /* EAI_BADHINTS */ + "Resolved protocol is unknown", /* EAI_PROTOCOL */ + "Unknown error", /* EAI_MAX */ +}; +#endif +/* XXX macros that make external reference is BAD. */ + +#define GET_AI(ai, afd, addr) \ +do { \ + /* external reference: pai, error, and label free */ \ + (ai) = get_ai(pai, (afd), (addr)); \ + if ((ai) == NULL) { \ + error = EAI_MEMORY; \ + goto free; \ + } \ +} while (/*CONSTCOND*/0) + +#define GET_PORT(ai, serv) \ +do { \ + /* external reference: error and label free */ \ + error = get_port((ai), (serv), 0); \ + if (error != 0) \ + goto free; \ +} while (/*CONSTCOND*/0) + +#define ERR(err) \ +do { \ + /* external reference: error, and label bad */ \ + error = (err); \ + goto bad; \ + /*NOTREACHED*/ \ +} while (/*CONSTCOND*/0) + +#define MATCH_FAMILY(x, y, w) \ + ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC))) +#define MATCH(x, y, w) \ + ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY))) + +#if 0 +/* We will need this should we ever want gai_strerror() */ +char * +gai_strerror(int ecode) +{ + if (ecode < 0 || ecode > EAI_MAX) + ecode = EAI_MAX; + return ai_errlist[ecode]; +} +#endif + +void +rb_freeaddrinfo(struct rb_addrinfo *ai) +{ + struct rb_addrinfo *next; + + do { + next = ai->ai_next; + if (ai->ai_canonname) + rb_free(ai->ai_canonname); + /* no need to free(ai->ai_addr) */ + rb_free(ai); + ai = next; + } while (ai); +} + +static int +str_isnumber(const char *p) +{ + char *ep; + + if (*p == '\0') + return NO; + ep = NULL; + errno = 0; + (void)strtoul(p, &ep, 10); + if (errno == 0 && ep && *ep == '\0') + return YES; + else + return NO; +} + +int +rb_getaddrinfo(const char *hostname, const char *servname, + const struct rb_addrinfo *hints, struct rb_addrinfo **res) +{ + struct rb_addrinfo sentinel; + struct rb_addrinfo *cur; + int error = 0; + struct rb_addrinfo ai; + struct rb_addrinfo ai0; + struct rb_addrinfo *pai; + const struct explore *ex; + + memset(&sentinel, 0, sizeof(sentinel)); + cur = &sentinel; + pai = &ai; + pai->ai_flags = 0; + pai->ai_family = PF_UNSPEC; + pai->ai_socktype = ANY; + pai->ai_protocol = ANY; + pai->ai_addrlen = 0; + pai->ai_canonname = NULL; + pai->ai_addr = NULL; + pai->ai_next = NULL; + + if (hostname == NULL && servname == NULL) + return EAI_NONAME; + if (hints) { + /* error check for hints */ + if (hints->ai_addrlen || hints->ai_canonname || + hints->ai_addr || hints->ai_next) + ERR(EAI_BADHINTS); /* xxx */ + if (hints->ai_flags & ~AI_MASK) + ERR(EAI_BADFLAGS); + switch (hints->ai_family) { + case PF_UNSPEC: + case PF_INET: +#ifdef IPV6 + case PF_INET6: +#endif + break; + default: + ERR(EAI_FAMILY); + } + memcpy(pai, hints, sizeof(*pai)); + + /* + * if both socktype/protocol are specified, check if they + * are meaningful combination. + */ + if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) { + for (ex = explore; ex->e_af >= 0; ex++) { + if (pai->ai_family != ex->e_af) + continue; + if (ex->e_socktype == ANY) + continue; + if (ex->e_protocol == ANY) + continue; + if (pai->ai_socktype == ex->e_socktype && + pai->ai_protocol != ex->e_protocol) { + ERR(EAI_BADHINTS); + } + } + } + } + + /* + * check for special cases. (1) numeric servname is disallowed if + * socktype/protocol are left unspecified. (2) servname is disallowed + * for raw and other inet{,6} sockets. + */ + if (MATCH_FAMILY(pai->ai_family, PF_INET, 1) +#ifdef IPV6 + || MATCH_FAMILY(pai->ai_family, PF_INET6, 1) +#endif + ) { + ai0 = *pai; /* backup *pai */ + + if (pai->ai_family == PF_UNSPEC) { +#ifdef IPV6 + pai->ai_family = PF_INET6; +#else + pai->ai_family = PF_INET; +#endif + } + error = get_portmatch(pai, servname); + if (error) + ERR(error); + + *pai = ai0; + } + + ai0 = *pai; + + /* NULL hostname, or numeric hostname */ + for (ex = explore; ex->e_af >= 0; ex++) { + *pai = ai0; + + /* PF_UNSPEC entries are prepared for DNS queries only */ + if (ex->e_af == PF_UNSPEC) + continue; + + if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex))) + continue; + if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex))) + continue; + if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex))) + continue; + + if (pai->ai_family == PF_UNSPEC) + pai->ai_family = ex->e_af; + if (pai->ai_socktype == ANY && ex->e_socktype != ANY) + pai->ai_socktype = ex->e_socktype; + if (pai->ai_protocol == ANY && ex->e_protocol != ANY) + pai->ai_protocol = ex->e_protocol; + + if (hostname == NULL) + error = explore_null(pai, servname, &cur->ai_next); + else + error = explore_numeric(pai, hostname, servname, &cur->ai_next); + + if (error) + goto free; + + while (cur && cur->ai_next) + cur = cur->ai_next; + } + + /* + * XXX + * If numreic representation of AF1 can be interpreted as FQDN + * representation of AF2, we need to think again about the code below. + */ + if (sentinel.ai_next) + goto good; + + if (pai->ai_flags & AI_NUMERICHOST) + ERR(EAI_NONAME); + if (hostname == NULL) + ERR(EAI_NODATA); + + /* XXX */ + if (sentinel.ai_next) + error = 0; + + if (error) + goto free; + if (error == 0) { + if (sentinel.ai_next) { + good: + *res = sentinel.ai_next; + return SUCCESS; + } else + error = EAI_FAIL; + } + free: + bad: + if (sentinel.ai_next) + rb_freeaddrinfo(sentinel.ai_next); + *res = NULL; + return error; +} + +/* + * hostname == NULL. + * passive socket -> anyaddr (0.0.0.0 or ::) + * non-passive socket -> localhost (127.0.0.1 or ::1) + */ +static int +explore_null(const struct rb_addrinfo *pai, const char *servname, struct rb_addrinfo **res) +{ + int s; + const struct afd *afd; + struct rb_addrinfo *cur; + struct rb_addrinfo sentinel; + int error; + + *res = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; + + /* + * filter out AFs that are not supported by the kernel + * XXX errno? + */ + s = socket(pai->ai_family, SOCK_DGRAM, 0); + if (s < 0) { +#ifdef _WIN32 + errno = WSAGetLastError(); +#endif + if (errno != EMFILE) + return 0; + } else +#ifdef _WIN32 + closesocket(s); +#else + close(s); +#endif + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; + + if (pai->ai_flags & AI_PASSIVE) { + GET_AI(cur->ai_next, afd, afd->a_addrany); + GET_PORT(cur->ai_next, servname); + } else { + GET_AI(cur->ai_next, afd, afd->a_loopback); + GET_PORT(cur->ai_next, servname); + } + cur = cur->ai_next; + + *res = sentinel.ai_next; + return 0; + +free: + if (sentinel.ai_next) + rb_freeaddrinfo(sentinel.ai_next); + return error; +} + +/* + * numeric hostname + */ +static int +explore_numeric(const struct rb_addrinfo *pai, const char *hostname, + const char *servname, struct rb_addrinfo **res) +{ + const struct afd *afd; + struct rb_addrinfo *cur; + struct rb_addrinfo sentinel; + int error; + char pton[PTON_MAX]; + + *res = NULL; + sentinel.ai_next = NULL; + cur = &sentinel; + + /* + * if the servname does not match socktype/protocol, ignore it. + */ + if (get_portmatch(pai, servname) != 0) + return 0; + + afd = find_afd(pai->ai_family); + if (afd == NULL) + return 0; + + switch (afd->a_af) { +#if 0 /*X/Open spec*/ + case AF_INET: + if (rb_inet_pton + if (inet_aton(hostname, (struct in_addr *)pton) == 1) { + if (pai->ai_family == afd->a_af || + pai->ai_family == PF_UNSPEC /*?*/) { + GET_AI(cur->ai_next, afd, pton); + GET_PORT(cur->ai_next, servname); + while (cur && cur->ai_next) + cur = cur->ai_next; + } else + ERR(EAI_FAMILY); /*xxx*/ + } + break; +#endif + default: + if (rb_inet_pton(afd->a_af, hostname, pton) == 1) { + if (pai->ai_family == afd->a_af || + pai->ai_family == PF_UNSPEC /*?*/) { + GET_AI(cur->ai_next, afd, pton); + GET_PORT(cur->ai_next, servname); + while (cur && cur->ai_next) + cur = cur->ai_next; + } else + ERR(EAI_FAMILY); /* XXX */ + } + break; + } + + *res = sentinel.ai_next; + return 0; + +free: +bad: + if (sentinel.ai_next) + rb_freeaddrinfo(sentinel.ai_next); + return error; +} + +static struct rb_addrinfo * +get_ai(const struct rb_addrinfo *pai, const struct afd *afd, const char *addr) +{ + char *p; + struct rb_addrinfo *ai; + + ai = (struct rb_addrinfo *)rb_malloc(sizeof(struct rb_addrinfo) + + (afd->a_socklen)); + if (ai == NULL) + return NULL; + + memcpy(ai, pai, sizeof(struct rb_addrinfo)); + ai->ai_addr = (struct sockaddr *)(void *)(ai + 1); + memset(ai->ai_addr, 0, (size_t)afd->a_socklen); + ai->ai_addrlen = afd->a_socklen; + ai->ai_addr->sa_family = ai->ai_family = afd->a_af; + p = (char *)(void *)(ai->ai_addr); + memcpy(p + afd->a_off, addr, (size_t)afd->a_addrlen); + return ai; +} + +static int +get_portmatch(const struct rb_addrinfo *ai, const char *servname) +{ + struct rb_addrinfo xai; + memcpy(&xai, ai, sizeof(struct rb_addrinfo)); + return(get_port(&xai, servname, 1)); +} + +static int +get_port(struct rb_addrinfo *ai, const char *servname, int matchonly) +{ + const char *proto; + struct servent *sp; + int port; + int allownumeric; + + if (servname == NULL) + return 0; + switch (ai->ai_family) { + case AF_INET: +#ifdef AF_INET6 + case AF_INET6: +#endif + break; + default: + return 0; + } + + switch (ai->ai_socktype) { + case SOCK_RAW: + return EAI_SERVICE; + case SOCK_DGRAM: + case SOCK_STREAM: + allownumeric = 1; + break; + case ANY: + allownumeric = 0; + break; + default: + return EAI_SOCKTYPE; + } + + if (str_isnumber(servname)) { + if (!allownumeric) + return EAI_SERVICE; + port = atoi(servname); + if (port < 0 || port > 65535) + return EAI_SERVICE; + port = htons(port); + } else { + switch (ai->ai_socktype) { + case SOCK_DGRAM: + proto = "udp"; + break; + case SOCK_STREAM: + proto = "tcp"; + break; + default: + proto = NULL; + break; + } + + if ((sp = getservbyname(servname, proto)) == NULL) + return EAI_SERVICE; + port = sp->s_port; + } + + if (!matchonly) { + switch (ai->ai_family) { + case AF_INET: + ((struct sockaddr_in *)(void *) + ai->ai_addr)->sin_port = port; + break; +#ifdef IPV6 + case AF_INET6: + ((struct sockaddr_in6 *)(void *) + ai->ai_addr)->sin6_port = port; + break; +#endif + } + } + + return 0; +} + +static const struct afd * +find_afd(int af) +{ + const struct afd *afd; + + if (af == PF_UNSPEC) + return(NULL); + + for (afd = afdl; afd->a_af; afd++) + { + if (afd->a_af == af) + return(afd); + } + + return(NULL); +} +#endif diff --git a/authd/getaddrinfo.h b/authd/getaddrinfo.h new file mode 100644 index 000000000..746db142a --- /dev/null +++ b/authd/getaddrinfo.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +struct rb_addrinfo { + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + char *ai_canonname; + struct sockaddr *ai_addr; + struct rb_addrinfo *ai_next; +}; + +#ifndef AI_PASSIVE +#define AI_PASSIVE 0x00000001 /* get address to use bind() */ +#endif /* AI_PASSIVE */ + +#ifndef AI_NUMERICHOST +#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ +#endif /* AI_NUMERICHOST */ + +#ifndef EAI_FAIL +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#endif /* EAI_FAIL */ + +#ifndef EAI_FAMILY +#define EAI_FAMILY 5 /* ai_family not supported */ +#endif /* EAI_FAMILY */ + +#ifndef EAI_MEMORY +#define EAI_MEMORY 6 /* memory allocation failure */ +#endif /* EAI_MEMORY */ + +#ifndef EAI_NONAME +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#endif /* EAI_NONAME */ + +#ifndef EAI_SYSTEM +#define EAI_SYSTEM 11 /* system error returned in errno */ +#endif /* EAI_SYSTEM */ + +#ifndef NI_NUMERICHOST +#define NI_NUMERICHOST 0x00000002 +#endif /* NI_NUMERICHOST */ + +#ifndef NI_NAMEREQD +#define NI_NAMEREQD 0x00000004 +#endif /* NI_NAMEREQD */ + +#ifndef NI_NUMERICSERV +#define NI_NUMERICSERV 0x00000008 +#endif /* NI_NUMERICSERV */ + +#ifndef NI_DGRAM +#define NI_DGRAM 0x00000010 +#endif /* NI_DGRAM */ + +#ifndef INADDR_NONE +#define INADDR_NONE ((unsigned int) 0xffffffff) +#endif /* INADDR_NONE */ + +int rb_getaddrinfo(const char *hostname, const char *servname, + const struct rb_addrinfo *hints, struct rb_addrinfo **res); +void rb_freeaddrinfo(struct rb_addrinfo *ai); + +#define SUCCESS 0 +#define ANY 0 +#define YES 1 +#define NO 0 + +#undef EAI_ADDRFAMILY +#undef EAI_AGAIN +#undef EAI_BADFLAGS +#undef EAI_FAIL +#undef EAI_FAMILY +#undef EAI_MEMORY +#undef EAI_NODATA +#undef EAI_NONAME +#undef EAI_SERVICE +#undef EAI_SOCKTYPE +#undef EAI_SYSTEM +#undef EAI_BADHINTS +#undef EAI_PROTOCOL +#undef EAI_MAX +#undef AI_MASK + +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with hostname */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 +#define AI_MASK (AI_PASSIVE | AI_NUMERICHOST) diff --git a/authd/getnameinfo.c b/authd/getnameinfo.c new file mode 100644 index 000000000..eba0181ad --- /dev/null +++ b/authd/getnameinfo.c @@ -0,0 +1,242 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Issues to be discussed: + * - Thread safe-ness must be checked + * - RFC2553 says that we should raise error on short buffer. X/Open says + * we need to truncate the result. We obey RFC2553 (and X/Open should be + * modified). ipngwg rough consensus seems to follow RFC2553. + * - What is "local" in NI_FQDN? + * - NI_NAMEREQD and NI_NUMERICHOST conflict with each other. + * - (KAME extension) always attach textual scopeid (fe80::1%lo0), if + * sin6_scope_id is filled - standardization status? + * XXX breaks backward compat for code that expects no scopeid. + * beware on merge. + */ + +#ifdef _WIN32 +#include +#include "getaddrinfo.h" +#include "getnameinfo.h" + +/* $Id$ */ + +static const struct afd { + int a_af; + int a_addrlen; + rb_socklen_t a_socklen; + int a_off; +} afdl [] = { +#ifdef IPV6 + {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6), + offsetof(struct sockaddr_in6, sin6_addr)}, +#endif + {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in), + offsetof(struct sockaddr_in, sin_addr)}, + {0, 0, 0, 0}, +}; + +struct sockinet +{ + unsigned char si_len; + unsigned char si_family; + unsigned short si_port; +}; + +#ifdef IPV6 +static int ip6_parsenumeric(const struct sockaddr *, const char *, char *, + size_t, int); +#endif + +int +rb_getnameinfo(const struct sockaddr *sa, rb_socklen_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags) +{ + const struct afd *afd; + struct servent *sp; + unsigned short port; + int family, i; + const char *addr; + uint32_t v4a; + char numserv[512]; + char numaddr[512]; + + if (sa == NULL) + return EAI_FAIL; + +/* if (sa->sa_len != salen) + return EAI_FAIL; +*/ + family = sa->sa_family; + for (i = 0; afdl[i].a_af; i++) + if (afdl[i].a_af == family) { + afd = &afdl[i]; + goto found; + } + return EAI_FAMILY; + + found: + if (salen != afd->a_socklen) + return EAI_FAIL; + + /* network byte order */ + port = ((const struct sockinet *)sa)->si_port; + addr = (const char *)sa + afd->a_off; + + if (serv == NULL || servlen == 0) { + /* + * do nothing in this case. + * in case you are wondering if "&&" is more correct than + * "||" here: rfc2553bis-03 says that serv == NULL OR + * servlen == 0 means that the caller does not want the result. + */ + } else { + if (flags & NI_NUMERICSERV) + sp = NULL; + else { + sp = getservbyport(port, + (flags & NI_DGRAM) ? "udp" : "tcp"); + } + if (sp) { + if (strlen(sp->s_name) + 1 > servlen) + return EAI_MEMORY; + rb_strlcpy(serv, sp->s_name, servlen); + } else { + snprintf(numserv, sizeof(numserv), "%u", ntohs(port)); + if (strlen(numserv) + 1 > servlen) + return EAI_MEMORY; + rb_strlcpy(serv, numserv, servlen); + } + } + + switch (sa->sa_family) { + case AF_INET: + v4a = (uint32_t) + ntohl(((const struct sockaddr_in *)sa)->sin_addr.s_addr); + if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a)) + flags |= NI_NUMERICHOST; + v4a >>= IN_CLASSA_NSHIFT; + if (v4a == 0) + flags |= NI_NUMERICHOST; + break; +#ifdef IPV6 + case AF_INET6: + { + const struct sockaddr_in6 *sin6; + sin6 = (const struct sockaddr_in6 *)sa; + switch (sin6->sin6_addr.s6_addr[0]) { + case 0x00: + if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) + ; + else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) + ; + else + flags |= NI_NUMERICHOST; + break; + default: + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + flags |= NI_NUMERICHOST; + } + else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) + flags |= NI_NUMERICHOST; + break; + } + } + break; +#endif + } + if (host == NULL || hostlen == 0) { + /* + * do nothing in this case. + * in case you are wondering if "&&" is more correct than + * "||" here: rfc2553bis-03 says that host == NULL or + * hostlen == 0 means that the caller does not want the result. + */ + } else if (flags & NI_NUMERICHOST) { + size_t numaddrlen; + + /* NUMERICHOST and NAMEREQD conflicts with each other */ + if (flags & NI_NAMEREQD) + return EAI_NONAME; + + switch(afd->a_af) { +#ifdef IPV6 + case AF_INET6: + { + int error; + + if ((error = ip6_parsenumeric(sa, addr, host, + hostlen, flags)) != 0) + return(error); + break; + } +#endif + default: + if (rb_inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr)) + == NULL) + return EAI_SYSTEM; + numaddrlen = strlen(numaddr); + if (numaddrlen + 1 > hostlen) /* don't forget terminator */ + return EAI_MEMORY; + rb_strlcpy(host, numaddr, hostlen); + break; + } + } + return(0); +} + +#ifdef IPV6 +static int +ip6_parsenumeric(const struct sockaddr *sa, const char *addr, + char *host, size_t hostlen, int flags) +{ + size_t numaddrlen; + char numaddr[512]; + + if (rb_inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL) + return(EAI_SYSTEM); + + numaddrlen = strlen(numaddr); + + if (numaddrlen + 1 > hostlen) /* don't forget terminator */ + return(EAI_MEMORY); + + if (*numaddr == ':') + { + *host = '0'; + rb_strlcpy(host+1, numaddr, hostlen-1); + } + else + rb_strlcpy(host, numaddr, hostlen); + + return(0); +} +#endif +#endif diff --git a/authd/getnameinfo.h b/authd/getnameinfo.h new file mode 100644 index 000000000..26b965ab4 --- /dev/null +++ b/authd/getnameinfo.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the project nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +int rb_getnameinfo(const struct sockaddr *sa, rb_socklen_t salen, char *host, + size_t hostlen, char *serv, size_t servlen, int flags); + +#ifndef IN_MULTICAST +#define IN_MULTICAST(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) +#endif + +#ifndef IN_EXPERIMENTAL +#define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xe0000000) == 0xe0000000) +#endif diff --git a/authd/reslib.c b/authd/reslib.c index 6f0180db4..963679dbe 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -76,6 +76,18 @@ * - Dianora */ +#ifndef _WIN32 +#include +#else +#include "getaddrinfo.h" +#include "getnameinfo.h" +#define getaddrinfo rb_getaddrinfo +#define getnameinfo rb_getnameinfo +#define freeaddrinfo rb_freeaddrinfo + +extern const char * get_windows_nameservers(void); +#endif + #include "stdinc.h" #include "ircd_defs.h" #include "common.h" diff --git a/authd/reslist.c b/authd/reslist.c new file mode 100644 index 000000000..d18a06991 --- /dev/null +++ b/authd/reslist.c @@ -0,0 +1,276 @@ +/* + * reslist.c - get nameservers from windows * + * + * ircd-ratbox related changes are as follows + * + * Copyright (C) 2008 Aaron Sethman + * Copyright (C) 2008-2012 ircd-ratbox development team + * + * pretty much all of this was yanked from c-ares ares_init.c here is the original + * header from there -- + * + * Id: ares_init.c,v 1.72 2008-05-15 00:00:19 yangtse Exp $ + * Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2007-2008 by Daniel Stenberg + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * + */ + +#ifdef _WIN32 +#include + +#include +#include + +const char *get_windows_nameservers(void); + + +#define IS_NT() ((int)GetVersion() > 0) +#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" +#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" +#define NAMESERVER "NameServer" +#define DHCPNAMESERVER "DhcpNameServer" +#define DATABASEPATH "DatabasePath" +#define WIN_PATH_HOSTS "\\hosts" + +static int +get_iphlpapi_dns_info(char *ret_buf, size_t ret_size) +{ + FIXED_INFO *fi = alloca(sizeof(*fi)); + DWORD size = sizeof(*fi); + typedef DWORD(WINAPI * get_net_param_func) (FIXED_INFO *, DWORD *); + get_net_param_func xxGetNetworkParams; /* available only on Win-98/2000+ */ + HMODULE handle; + IP_ADDR_STRING *ipAddr; + int i, count = 0; + int debug = 0; + size_t ip_size = sizeof("255.255.255.255,") - 1; + size_t left = ret_size; + char *ret = ret_buf; + HRESULT res; + + if(!fi) + return (0); + + handle = LoadLibrary("iphlpapi.dll"); + if(!handle) + return (0); + + xxGetNetworkParams = (get_net_param_func) GetProcAddress(handle, "GetNetworkParams"); + if(!xxGetNetworkParams) + goto quit; + + res = (*xxGetNetworkParams) (fi, &size); + if((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) + goto quit; + + fi = alloca(size); + if(!fi || (*xxGetNetworkParams) (fi, &size) != ERROR_SUCCESS) + goto quit; + + if(debug) + { + printf("Host Name: %s\n", fi->HostName); + printf("Domain Name: %s\n", fi->DomainName); + printf("DNS Servers:\n" " %s (primary)\n", fi->DnsServerList.IpAddress.String); + } + if(strlen(fi->DnsServerList.IpAddress.String) > 0 && + inet_addr(fi->DnsServerList.IpAddress.String) != INADDR_NONE && left > ip_size) + { + ret += sprintf(ret, "%s,", fi->DnsServerList.IpAddress.String); + left -= ret - ret_buf; + count++; + } + + for(i = 0, ipAddr = fi->DnsServerList.Next; ipAddr && left > ip_size; + ipAddr = ipAddr->Next, i++) + { + if(inet_addr(ipAddr->IpAddress.String) != INADDR_NONE) + { + ret += sprintf(ret, "%s,", ipAddr->IpAddress.String); + left -= ret - ret_buf; + count++; + } + if(debug) + printf(" %s (secondary %d)\n", ipAddr->IpAddress.String, i + 1); + } + + quit: + if(handle) + FreeLibrary(handle); + + if(debug && left <= ip_size) + printf("Too many nameservers. Truncating to %d addressess", count); + if(ret > ret_buf) + ret[-1] = '\0'; + return (count); +} + +/* + * Warning: returns a dynamically allocated buffer, the user MUST + * use free() / rb_free() if the function returns 1 + */ +static int +get_res_nt(HKEY hKey, const char *subkey, char **obuf) +{ + /* Test for the size we need */ + DWORD size = 0; + int result; + + result = RegQueryValueEx(hKey, subkey, 0, NULL, NULL, &size); + if((result != ERROR_SUCCESS && result != ERROR_MORE_DATA) || !size) + return 0; + *obuf = rb_malloc(size + 1); + if(!*obuf) + return 0; + + if(RegQueryValueEx(hKey, subkey, 0, NULL, (LPBYTE) * obuf, &size) != ERROR_SUCCESS) + { + rb_free(*obuf); + return 0; + } + if(size == 1) + { + rb_free(*obuf); + return 0; + } + return 1; +} + +static int +get_res_interfaces_nt(HKEY hKey, const char *subkey, char **obuf) +{ + char enumbuf[39]; /* GUIDs are 38 chars + 1 for NULL */ + DWORD enum_size = 39; + int idx = 0; + HKEY hVal; + + while(RegEnumKeyEx(hKey, idx++, enumbuf, &enum_size, 0, + NULL, NULL, NULL) != ERROR_NO_MORE_ITEMS) + { + int rc; + + enum_size = 39; + if(RegOpenKeyEx(hKey, enumbuf, 0, KEY_QUERY_VALUE, &hVal) != ERROR_SUCCESS) + continue; + rc = get_res_nt(hVal, subkey, obuf); + RegCloseKey(hVal); + if(rc) + return 1; + } + return 0; +} + +const char * +get_windows_nameservers(void) +{ + /* + NameServer info via IPHLPAPI (IP helper API): + GetNetworkParams() should be the trusted source for this. + Available in Win-98/2000 and later. If that fail, fall-back to + registry information. + + NameServer Registry: + + On Windows 9X, the DNS server can be found in: + HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\NameServer + + On Windows NT/2000/XP/2003: + HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NameServer + or + HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DhcpNameServer + or + HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\ + NameServer + or + HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\ + DhcpNameServer + */ + static char namelist[512]; + HKEY mykey; + HKEY subkey; + DWORD data_type; + DWORD bytes; + DWORD result; + char *line = NULL; + memset(&namelist, 0, sizeof(namelist)); + if(get_iphlpapi_dns_info(namelist, sizeof(namelist)) > 0) + { + return namelist; + } + + if(IS_NT()) + { + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, + KEY_READ, &mykey) == ERROR_SUCCESS) + { + RegOpenKeyEx(mykey, "Interfaces", 0, + KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &subkey); + if(get_res_nt(mykey, NAMESERVER, &line)) + { + rb_strlcpy(namelist, line, sizeof(namelist)); + return namelist; + } + else if(get_res_nt(mykey, DHCPNAMESERVER, &line)) + { + rb_strlcpy(namelist, line, sizeof(namelist)); + rb_free(line); + } + /* Try the interfaces */ + else if(get_res_interfaces_nt(subkey, NAMESERVER, &line)) + { + rb_strlcpy(namelist, line, sizeof(namelist)); + rb_free(line); + } + else if(get_res_interfaces_nt(subkey, DHCPNAMESERVER, &line)) + { + rb_strlcpy(namelist, line, sizeof(namelist)); + rb_free(line); + } + RegCloseKey(subkey); + RegCloseKey(mykey); + } + } + else + { + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_9X, 0, + KEY_READ, &mykey) == ERROR_SUCCESS) + { + if((result = RegQueryValueEx(mykey, NAMESERVER, NULL, &data_type, + NULL, &bytes)) == ERROR_SUCCESS || + result == ERROR_MORE_DATA) + { + if(bytes) + { + line = (char *)rb_malloc(bytes + 1); + if(RegQueryValueEx(mykey, NAMESERVER, NULL, &data_type, + (unsigned char *)line, &bytes) == + ERROR_SUCCESS) + { + rb_strlcpy(namelist, line, sizeof(namelist)); + } + free(line); + } + } + } + RegCloseKey(mykey); + } + if(strlen(namelist) > 0) + return namelist; + return NULL; +} + + +#endif diff --git a/include/stdinc.h b/include/stdinc.h index 0712e6219..eb321edb6 100644 --- a/include/stdinc.h +++ b/include/stdinc.h @@ -92,7 +92,6 @@ typedef bool _Bool; #include #include #include -#include #include #include #include @@ -112,7 +111,6 @@ typedef bool _Bool; #endif -#include #include #include From 4f739902455b6c7b147d53bb15cf94baa995a9fc Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:19:07 -0500 Subject: [PATCH 056/252] stdinc: more cleanups --- include/stdinc.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/stdinc.h b/include/stdinc.h index eb321edb6..d620f7799 100644 --- a/include/stdinc.h +++ b/include/stdinc.h @@ -112,14 +112,10 @@ typedef bool _Bool; #include -#include #ifdef HAVE_SYS_PARAM_H #include #endif -#include -#include -#include #ifdef HAVE_ERRNO_H #include From 8da0b2f2cbbc784a2e225166e5a2b542d17d0dc7 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:19:46 -0500 Subject: [PATCH 057/252] authd: use _WIN32 as the define for checking windows presence --- authd/authd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 623368330..937160f91 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -99,7 +99,7 @@ error_cb(rb_helper *helper) exit(1); } -#ifndef WINDOWS +#ifndef _WIN32 static void dummy_handler(int sig) { @@ -110,7 +110,7 @@ dummy_handler(int sig) static void setup_signals(void) { -#ifndef WINDOWS +#ifndef _WIN32 struct sigaction act; act.sa_flags = 0; From c99ae1907fa1767067caa2dc1cd4d94915d76b56 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:30:24 -0500 Subject: [PATCH 058/252] authd: use GET_SS_FAMILY() where appropriate --- authd/res.c | 59 ++++++++++++++++++++++++----------------------------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/authd/res.c b/authd/res.c index 4deafb5f3..262c4f2bf 100644 --- a/authd/res.c +++ b/authd/res.c @@ -167,7 +167,8 @@ random_socket(int family) * revised for ircd, cryogen(stu) may03 * slightly modified for charybdis, mr_flea oct12 */ -static int res_ourserver(const struct rb_sockaddr_storage *inp) +static int +res_ourserver(const struct rb_sockaddr_storage *inp) { #ifdef RB_IPV6 const struct sockaddr_in6 *v6; @@ -177,49 +178,43 @@ static int res_ourserver(const struct rb_sockaddr_storage *inp) const struct sockaddr_in *v4in = (const struct sockaddr_in *)inp; int ns; - for (ns = 0; ns < irc_nscount; ns++) + for(ns = 0; ns < irc_nscount; ns++) { const struct rb_sockaddr_storage *srv = &irc_nsaddr_list[ns]; - - if (srv->ss_family != inp->ss_family) - continue; - #ifdef RB_IPV6 v6 = (const struct sockaddr_in6 *)srv; #endif v4 = (const struct sockaddr_in *)srv; /* could probably just memcmp(srv, inp, srv.ss_len) here - * but we'll err on the side of caution - stu + * but we'll air on the side of caution - stu */ - switch (srv->ss_family) + switch (GET_SS_FAMILY(srv)) { #ifdef RB_IPV6 - case AF_INET6: - if (v6->sin6_port == v6in->sin6_port) - if ((memcmp(&v6->sin6_addr.s6_addr, &v6in->sin6_addr.s6_addr, - sizeof(struct in6_addr)) == 0) || - (memcmp(&v6->sin6_addr.s6_addr, &in6addr_any, - sizeof(struct in6_addr)) == 0)) - { - return ns; - } - break; + case AF_INET6: + if(GET_SS_FAMILY(srv) == GET_SS_FAMILY(inp)) + if(v6->sin6_port == v6in->sin6_port) + if((memcmp(&v6->sin6_addr.s6_addr, &v6in->sin6_addr.s6_addr, + sizeof(struct in6_addr)) == 0) || + (memcmp(&v6->sin6_addr.s6_addr, &in6addr_any, + sizeof(struct in6_addr)) == 0)) + return 1; + break; #endif - case AF_INET: - if (v4->sin_port == v4in->sin_port) - if ((v4->sin_addr.s_addr == INADDR_ANY) - || (v4->sin_addr.s_addr == v4in->sin_addr.s_addr)) - { - return ns; - } - break; - default: - break; + case AF_INET: + if(GET_SS_FAMILY(srv) == GET_SS_FAMILY(inp)) + if(v4->sin_port == v4in->sin_port) + if((v4->sin_addr.s_addr == INADDR_ANY) + || (v4->sin_addr.s_addr == v4in->sin_addr.s_addr)) + return 1; + break; + default: + break; } } - return -1; + return 0; } /* @@ -280,7 +275,7 @@ static void start_resolver(void) if (res_fd == NULL) { - if ((res_fd = rb_socket(irc_nsaddr_list[0].ss_family, SOCK_DGRAM, 0, + if ((res_fd = rb_socket(GET_SS_FAMILY(&irc_nsaddr_list[0]), SOCK_DGRAM, 0, "UDP resolver socket")) == NULL) return; @@ -549,7 +544,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto request->name = (char *)rb_malloc(IRCD_RES_HOSTLEN + 1); } - if (addr->ss_family == AF_INET) + if (GET_SS_FAMILY(addr) == AF_INET) { const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr; cp = (const unsigned char *)&v4->sin_addr.s_addr; @@ -558,7 +553,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto (unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0])); } #ifdef RB_IPV6 - else if (addr->ss_family == AF_INET6) + else if (GET_SS_FAMILY(addr) == AF_INET6) { const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *)addr; cp = (const unsigned char *)&v6->sin6_addr.s6_addr; From 66cd5f6695eef36654dd1532576c6805fc2068dc Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:33:23 -0500 Subject: [PATCH 059/252] authd/reslib: include rb_lib.h --- authd/reslib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/authd/reslib.c b/authd/reslib.c index 963679dbe..59ea43f3e 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -76,6 +76,8 @@ * - Dianora */ +#include + #ifndef _WIN32 #include #else From 2dea53a2032430fbd2432dde032546b7b2cff8fb Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:37:00 -0500 Subject: [PATCH 060/252] authd: some more win32 fixes --- authd/getaddrinfo.c | 2 +- authd/getnameinfo.c | 2 +- authd/reslib.c | 7 ++++++- authd/reslist.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.c index 482e648bd..f76428752 100644 --- a/authd/getaddrinfo.c +++ b/authd/getaddrinfo.c @@ -28,7 +28,7 @@ */ #ifdef _WIN32 -#include +#include #include "getaddrinfo.h" /* $Id$ */ diff --git a/authd/getnameinfo.c b/authd/getnameinfo.c index eba0181ad..f34fffcf8 100644 --- a/authd/getnameinfo.c +++ b/authd/getnameinfo.c @@ -42,7 +42,7 @@ */ #ifdef _WIN32 -#include +#include #include "getaddrinfo.h" #include "getnameinfo.h" diff --git a/authd/reslib.c b/authd/reslib.c index 59ea43f3e..248f753d1 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -79,7 +79,11 @@ #include #ifndef _WIN32 + #include + +typedef struct addrinfo rb_addrinfo; + #else #include "getaddrinfo.h" #include "getnameinfo.h" @@ -88,6 +92,7 @@ #define freeaddrinfo rb_freeaddrinfo extern const char * get_windows_nameservers(void); +typedef struct rb_addrinfo rb_addrinfo; #endif #include "stdinc.h" @@ -235,7 +240,7 @@ parse_resvconf(void) static void add_nameserver(const char *arg) { - struct addrinfo hints, *res; + rb_addrinfo hints, *res; /* Done max number of nameservers? */ if (irc_nscount >= IRCD_MAXNS) diff --git a/authd/reslist.c b/authd/reslist.c index d18a06991..7fb97f5e1 100644 --- a/authd/reslist.c +++ b/authd/reslist.c @@ -29,7 +29,7 @@ */ #ifdef _WIN32 -#include +#include #include #include From 85368a13d3073c77398f121c5f93be3da39d8582 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:44:00 -0500 Subject: [PATCH 061/252] ircd: rewrite SOCKET_ERROR as I_SOCKET_ERROR --- include/s_conf.h | 2 +- ircd/s_conf.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/s_conf.h b/include/s_conf.h index 4f78fbdd0..49c713f42 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -393,7 +393,7 @@ extern char conffilebuf[IRCD_BUFSIZE + 1]; extern int lineno; #define NOT_AUTHORISED (-1) -#define SOCKET_ERROR (-2) +#define I_SOCKET_ERROR (-2) #define I_LINE_FULL (-3) #define BANNED_CLIENT (-4) #define TOO_MANY_LOCAL (-6) diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 78bf23d87..66fa637d9 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -169,7 +169,7 @@ free_conf(struct ConfItem *aconf) * inputs - pointer to client * output - 0 = Success * NOT_AUTHORISED (-1) = Access denied (no I line match) - * SOCKET_ERROR (-2) = Bad socket. + * I_SOCKET_ERROR (-2) = Bad socket. * I_LINE_FULL (-3) = I-line is full * TOO_MANY (-4) = Too many connections from hostname * BANNED_CLIENT (-5) = K-lined @@ -190,7 +190,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern switch (i) { - case SOCKET_ERROR: + case I_SOCKET_ERROR: exit_client(client_p, source_p, &me, "Socket Error"); break; From e0dc28c59f32396c8389e2a9e4d147122cd857ab Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:46:00 -0500 Subject: [PATCH 062/252] librb: rb_dictionary: temporary hack to shut up gcc on windows --- librb/include/rb_dictionary.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 88774dd6f..002fcfba7 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -153,6 +153,8 @@ extern unsigned int rb_dictionary_size(struct Dictionary *dtree); void rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata); +#ifndef _WIN32 + #define RB_POINTER_TO_INT(x) ((int32_t) (long) (x)) #define RB_INT_TO_POINTER(x) ((void *) (long) (int32_t) (x)) @@ -165,6 +167,22 @@ void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void #define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x)) #define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x)) +#else + +#define RB_POINTER_TO_INT(x) ((int32_t) (unsigned long long) (x)) +#define RB_INT_TO_POINTER(x) ((void *) (unsigned long long) (int32_t) (x)) + +#define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long long) (x)) +#define RB_UINT_TO_POINTER(x) ((void *) (unsigned long long) (uint32_t) (x)) + +#define RB_POINTER_TO_LONG(x) ((int64_t) (unsigned long long) (x)) +#define RB_LONG_TO_POINTER(x) ((void *) (unsigned long long) (int64_t) (x)) + +#define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x)) +#define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x)) + +#endif + static inline int rb_int32cmp(const void *a, const void *b) { return RB_POINTER_TO_INT(b) - RB_POINTER_TO_INT(a); From 1d90b085d396fb0332545a2040faaeb162868c33 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:48:14 -0500 Subject: [PATCH 063/252] ircd: blacklist: use GET_SS_FAMILY() --- ircd/blacklist.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ircd/blacklist.c b/ircd/blacklist.c index dca1c2ed1..ae3f10ee0 100644 --- a/ircd/blacklist.c +++ b/ircd/blacklist.c @@ -156,7 +156,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client * blcptr->client_p = client_p; /* IPv4 */ - if ((client_p->localClient->ip.ss_family == AF_INET) && blptr->ipv4) + if ((GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET) && blptr->ipv4) { ip = (uint8_t *)&((struct sockaddr_in *)&client_p->localClient->ip)->sin_addr.s_addr; @@ -168,8 +168,9 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client * (unsigned int) ip[0], blptr->host); } +#ifdef RB_IPV6 /* IPv6 */ - else if ((client_p->localClient->ip.ss_family == AF_INET6) && blptr->ipv6) + else if ((GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6) && blptr->ipv6) { /* Split up for rDNS lookup * ex: ip[0] = 0x00, ip[1] = 0x00... ip[16] = 0x01 for localhost @@ -197,6 +198,7 @@ static void initiate_blacklist_dnsquery(struct Blacklist *blptr, struct Client * /* Tack host on */ strcpy(bufptr, blptr->host); } +#endif /* This shouldn't happen... */ else return; From e867208deb228f61806ae0a448145e7de15db1c2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:54:24 -0500 Subject: [PATCH 064/252] ircd: use GET_SS_FAMILY() in a bunch of places --- ircd/channel.c | 2 +- ircd/client.c | 4 ++-- ircd/listener.c | 8 ++++---- ircd/s_auth.c | 6 +++--- ircd/s_conf.c | 6 +++--- ircd/s_newconf.c | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ircd/channel.c b/ircd/channel.c index 35a9afb64..77bb26c43 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -581,7 +581,7 @@ is_banned_list(struct Channel *chptr, rb_dlink_list *list, } } #ifdef RB_IPV6 - if(who->localClient->ip.ss_family == AF_INET6 && + if(GET_SS_FAMILY(&who->localClient->ip) == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *)&who->localClient->ip, &ip4)) { sprintf(src_ip4host, "%s!%s@", who->name, who->username); diff --git a/ircd/client.c b/ircd/client.c index 084891099..332a3b49e 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -542,7 +542,7 @@ check_dlines(void) if(IsMe(client_p)) continue; - if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip,client_p->localClient->ip.ss_family)) != NULL) + if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, GET_SS_FAMILY(&client_p->localClient->ip))) != NULL) { if(aconf->status & CONF_EXEMPTDLINE) continue; @@ -561,7 +561,7 @@ check_dlines(void) { client_p = ptr->data; - if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip,client_p->localClient->ip.ss_family)) != NULL) + if((aconf = find_dline((struct sockaddr *)&client_p->localClient->ip, GET_SS_FAMILY(&client_p->localClient->ip))) != NULL) { if(aconf->status & CONF_EXEMPTDLINE) continue; diff --git a/ircd/listener.c b/ircd/listener.c index 9fa0ca1bc..f89128b31 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -106,7 +106,7 @@ static uint16_t get_listener_port(const struct Listener *listener) { #ifdef RB_IPV6 - if(listener->addr.ss_family == AF_INET6) + if(GET_SS_FAMILY(&listener->addr) == AF_INET6) return ntohs(((const struct sockaddr_in6 *)&listener->addr)->sin6_port); else #endif @@ -180,7 +180,7 @@ inetport(struct Listener *listener) F = rb_socket(GET_SS_FAMILY(&listener->addr), SOCK_STREAM, 0, "Listener socket"); #ifdef RB_IPV6 - if(listener->addr.ss_family == AF_INET6) + if(GET_SS_FAMILY(&listener->addr) == AF_INET6) { struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&listener->addr; if(!IN6_ARE_ADDR_EQUAL(&in6->sin6_addr, &in6addr_any)) @@ -279,7 +279,7 @@ find_listener(struct rb_sockaddr_storage *addr) for (listener = ListenerPollList; listener; listener = listener->next) { - if(addr->ss_family != listener->addr.ss_family) + if(GET_SS_FAMILY(addr) != GET_SS_FAMILY(&listener->addr)) continue; switch(addr->ss_family) @@ -342,7 +342,7 @@ add_listener(int port, const char *vhost_ip, int family, int ssl, int defer_acce if(port == 0) return; memset(&vaddr, 0, sizeof(vaddr)); - vaddr.ss_family = family; + SET_SS_FAMILY(&vaddr, family); if(vhost_ip != NULL) { diff --git a/ircd/s_auth.c b/ircd/s_auth.c index ea237808a..d9cdadfa5 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -269,7 +269,7 @@ start_auth_query(struct AuthRequest *auth) if(IsAnyDead(auth->client)) return 0; - family = auth->client->localClient->ip.ss_family; + family = GET_SS_FAMILY(&auth->client->localClient->ip); if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL) { ilog_error("creating auth stream socket"); @@ -302,7 +302,7 @@ start_auth_query(struct AuthRequest *auth) /* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */ #ifdef RB_IPV6 - if(localaddr.ss_family == AF_INET6) + if(GET_SS_FAMILY(&localaddr) == AF_INET6) { auth->lport = ntohs(((struct sockaddr_in6 *)&localaddr)->sin6_port); ((struct sockaddr_in6 *)&localaddr)->sin6_port = 0; @@ -316,7 +316,7 @@ start_auth_query(struct AuthRequest *auth) destaddr = auth->client->localClient->ip; #ifdef RB_IPV6 - if(localaddr.ss_family == AF_INET6) + if(GET_SS_FAMILY(&localaddr) == AF_INET6) { auth->rport = ntohs(((struct sockaddr_in6 *)&destaddr)->sin6_port); ((struct sockaddr_in6 *)&destaddr)->sin6_port = htons(113); diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 66fa637d9..65023627d 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -261,7 +261,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern { int port = -1; #ifdef RB_IPV6 - if(source_p->localClient->ip.ss_family == AF_INET6) + if(GET_SS_FAMILY(&source_p->localClient->ip) == AF_INET6) port = ntohs(((struct sockaddr_in6 *)&source_p->localClient->listener->addr)->sin6_port); else #endif @@ -394,7 +394,7 @@ find_address_conf_by_client(struct Client *client_p, const char *username) aconf = find_address_conf(client_p->host, client_p->sockhost, client_p->username, client_p->username, (struct sockaddr *) &client_p->localClient->ip, - client_p->localClient->ip.ss_family, + GET_SS_FAMILY(&client_p->localClient->ip), client_p->localClient->auth_user); } else @@ -404,7 +404,7 @@ find_address_conf_by_client(struct Client *client_p, const char *username) aconf = find_address_conf(client_p->host, client_p->sockhost, non_ident, client_p->username, (struct sockaddr *) &client_p->localClient->ip, - client_p->localClient->ip.ss_family, + GET_SS_FAMILY(&client_p->localClient->ip), client_p->localClient->auth_user); } return aconf; diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index d5e5a9d29..842701f67 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -305,7 +305,7 @@ find_oper_conf(const char *username, const char *host, const char *locip, const if(parse_netmask(addr, &ip, &bits) != HM_HOST) { - if(ip.ss_family == cip.ss_family && + if(GET_SS_FAMILY(&ip) == GET_SS_FAMILY(&cip) && comp_with_mask_sock((struct sockaddr *)&ip, (struct sockaddr *)&cip, bits)) return oper_p; } From 4e376fff559fb1a54245e500b497dfda4db30cc4 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:55:31 -0500 Subject: [PATCH 065/252] include: hostmask: use GET_SS_FAMILY() --- include/hostmask.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hostmask.h b/include/hostmask.h index 43dadc0a3..8e97cf74b 100644 --- a/include/hostmask.h +++ b/include/hostmask.h @@ -54,7 +54,7 @@ struct ConfItem *find_dline(struct sockaddr *, int); #define find_kline(x) (find_conf_by_address((x)->host, (x)->sockhost, \ (x)->orighost, \ (struct sockaddr *)&(x)->localClient->ip, CONF_KILL,\ - (x)->localClient->ip.ss_family, (x)->username, NULL)) + GET_SS_FAMILY(&(x)->localClient->ip), (x)->username, NULL)) void report_auth(struct Client *); #ifdef RB_IPV6 From 0b9aca384a48bc418f1af1bcab79553448650852 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:57:19 -0500 Subject: [PATCH 066/252] ircd: client: fix format string for free_user() debug notice --- ircd/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ircd/client.c b/ircd/client.c index 332a3b49e..1c8504fe9 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -1802,15 +1802,15 @@ free_user(struct User *user, struct Client *client_p) if(user->refcnt < 0 || user->invited.head || user->channel.head) { sendto_realops_snomask(SNO_GENERAL, L_ALL, - "* %#lx user (%s!%s@%s) %#lx %#lx %#lx %lu %d *", - (unsigned long) client_p, + "* %p user (%s!%s@%s) %p %p %p %lu %d *", + client_p, client_p ? client_p-> name : "", client_p->username, client_p->host, - (unsigned long) user, - (unsigned long) user->invited.head, - (unsigned long) user->channel.head, + user, + user->invited.head, + user->channel.head, rb_dlink_list_length(&user->channel), user->refcnt); s_assert(!user->refcnt); From e16f4b78b1656cccb7fb9333acacef1082c2c766 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:58:28 -0500 Subject: [PATCH 067/252] ircd: ircd_parser: we do not need to include netinet/in.h --- ircd/ircd_parser.y | 2 -- 1 file changed, 2 deletions(-) diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index 92716ae54..eb49d7f84 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -6,8 +6,6 @@ #include #include -#include - #include #include #include From 767131678440317a1f04a2ff65c64da0a5730ac8 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 01:59:09 -0500 Subject: [PATCH 068/252] ircd: lexer: likewise --- ircd/ircd_lexer.l | 2 -- 1 file changed, 2 deletions(-) diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index e9dd482a8..b79825870 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -25,8 +25,6 @@ #include #include -#include - #include #include #include From 53e50d0e2f0dd407f6ea6c7f9c0731a69fd9b18d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:00:22 -0500 Subject: [PATCH 069/252] ircd: ircd_signal: win32 stubs --- ircd/ircd_signal.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ircd/ircd_signal.c b/ircd/ircd_signal.c index b60172952..e2195704f 100644 --- a/ircd/ircd_signal.c +++ b/ircd/ircd_signal.c @@ -27,6 +27,8 @@ #include "client.h" #include "send.h" +#ifndef _WIN32 + /* * dummy_handler - don't know if this is really needed but if alarm is still * being used we probably will @@ -171,3 +173,17 @@ setup_signals() sigprocmask(SIG_UNBLOCK, &sigs, NULL); } + +#else +void +setup_signals() +{ +/* this is a stub for mingw32 */ +} + +void +setup_reboot_signals() +{ +/* this is a stub for mingw32 */ +} +#endif From a7fb269357d8852cadac425a1b97c7b20bcc787b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:01:00 -0500 Subject: [PATCH 070/252] ircd: listener: more ss_family grr --- ircd/listener.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/listener.c b/ircd/listener.c index f89128b31..a3d08cbaa 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -282,7 +282,7 @@ find_listener(struct rb_sockaddr_storage *addr) if(GET_SS_FAMILY(addr) != GET_SS_FAMILY(&listener->addr)) continue; - switch(addr->ss_family) + switch(GET_SS_FAMILY(addr)) { case AF_INET: { From 538d208948737f315c301cb0ac4b72a1ee525d6b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:03:32 -0500 Subject: [PATCH 071/252] ircd: ircd main: use librb functions for daemon management --- ircd/ircd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index c24322196..435dd265e 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -220,6 +220,7 @@ init_sys(void) static int make_daemon(void) { +#ifndef _WIN32 int pid; int pip[2]; char c; @@ -254,7 +255,7 @@ make_daemon(void) /* fclose(stdin); fclose(stdout); fclose(stderr); */ - +#endif return 0; } @@ -420,7 +421,7 @@ check_pidfile(const char *filename) if(fgets(buff, 20, fb) != NULL) { pidfromfile = atoi(buff); - if(!kill(pidfromfile, 0)) + if(!rb_kill(pidfromfile, 0)) { printf("ircd: daemon is already running\n"); exit(-1); From 1ba9eba5504a1dd5ab1f60505857eadcf70a9314 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:04:26 -0500 Subject: [PATCH 072/252] ircd: _WIN32 checks on geteuid() too --- ircd/ircd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ircd/ircd.c b/ircd/ircd.c index 435dd265e..376b4cc98 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -548,12 +548,14 @@ charybdis_main(int argc, char *argv[]) { int fd; +#ifndef _WIN32 /* Check to see if the user is running us as root, which is a nono */ if(geteuid() == 0) { fprintf(stderr, "Don't run ircd as root!!!\n"); return -1; } +#endif init_sys(); From 3f97a5c5298c2439262383cb91fa7caab5a393f7 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:07:06 -0500 Subject: [PATCH 073/252] configure: check for MINGW --- configure.ac | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index 408c0868e..2c3b0363b 100644 --- a/configure.ac +++ b/configure.ac @@ -19,6 +19,25 @@ fi AC_PREFIX_DEFAULT($HOME/ircd) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER(include/setup.h) + +case "$host_os" in +*cygwin*) + AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) + AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) + ;; +*mingw*) + AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) + AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) + AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])]) + LIBS="$LIBS -lws2_32 -liphlpapi" + is_mingw="yes" + ;; +*) + ;; +esac + +AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) + AC_CONFIG_SUBDIRS([librb]) AC_CONFIG_AUX_DIR([libltdl/config]) From b5c0180c4bc2270ff7ad83ff5ee7c28f7d2993ce Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:08:14 -0500 Subject: [PATCH 074/252] ircd: build: tell libtool what to DLL_EXPORT --- ircd/Makefile.am | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ircd/Makefile.am b/ircd/Makefile.am index 03f30a50e..20370488e 100644 --- a/ircd/Makefile.am +++ b/ircd/Makefile.am @@ -14,6 +14,10 @@ version.c: version.c.SH ../CREDITS ../include/patchlevel.h ../include/serno.h $(CP) version.c version.c.last touch version.c.SH +if MINGW +EXTRA_FLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*' +endif + libircd_la_SOURCES = \ authd.c \ bandbi.c \ From 3c27591e9da5e3f2cd469c021c9690c491ff0ca2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:11:06 -0500 Subject: [PATCH 075/252] configure: move mingw check down a bit --- configure.ac | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 2c3b0363b..2c4953f30 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,20 @@ AC_PREFIX_DEFAULT($HOME/ircd) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER(include/setup.h) +AC_CONFIG_SUBDIRS([librb]) +AC_CONFIG_AUX_DIR([libltdl/config]) + +AM_INIT_AUTOMAKE([subdir-objects]) +AM_SILENT_RULES([yes]) +AM_PROG_AR + +LT_INIT([dlopen disable-static]) +LT_CONFIG_LTDL_DIR([libltdl]) +LTDL_INIT + +build_ltdl=$with_included_ltdl +AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"]) + case "$host_os" in *cygwin*) AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) @@ -38,20 +52,6 @@ esac AM_CONDITIONAL([MINGW], [test "$is_mingw" = "yes"]) -AC_CONFIG_SUBDIRS([librb]) -AC_CONFIG_AUX_DIR([libltdl/config]) - -AM_INIT_AUTOMAKE([subdir-objects]) -AM_SILENT_RULES([yes]) -AM_PROG_AR - -LT_INIT([dlopen disable-static]) -LT_CONFIG_LTDL_DIR([libltdl]) -LTDL_INIT - -build_ltdl=$with_included_ltdl -AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"]) - if test "$ac_cv_c_compiler_gnu" = yes; then IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall" fi From 4c1e52d3a70845f8d3dddd1b06b7d40db0431165 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:14:13 -0500 Subject: [PATCH 076/252] bandb: use _WIN32 guards where appropriate --- bandb/bandb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bandb/bandb.c b/bandb/bandb.c index 1936b4160..7f7688d9e 100644 --- a/bandb/bandb.c +++ b/bandb/bandb.c @@ -255,7 +255,7 @@ dummy_handler(int sig) static void setup_signals(void) { -#ifndef WINDOWS +#ifndef _WIN32 struct sigaction act; act.sa_flags = 0; From 2d77d121a3ea94f38c765af0b547d3e3464a9d56 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:19:36 -0500 Subject: [PATCH 077/252] m_stats: win32 fixes --- modules/m_stats.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/m_stats.c b/modules/m_stats.c index 2c3812239..b64e1de5d 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -566,7 +566,7 @@ stats_auth (struct Client *source_p) aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL, (struct sockaddr *)&source_p->localClient->ip, CONF_CLIENT, - source_p->localClient->ip.ss_family, + GET_SS_FAMILY(&source_p->localClient->ip), source_p->username, NULL); else aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_CLIENT, @@ -608,7 +608,7 @@ stats_tklines(struct Client *source_p) aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL, (struct sockaddr *)&source_p->localClient->ip, CONF_KILL, - source_p->localClient->ip.ss_family, + GET_SS_FAMILY(&source_p->localClient->ip), source_p->username, NULL); else aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_KILL, @@ -711,7 +711,7 @@ stats_klines(struct Client *source_p) aconf = find_conf_by_address (source_p->host, source_p->sockhost, NULL, (struct sockaddr *)&source_p->localClient->ip, CONF_KILL, - source_p->localClient->ip.ss_family, + GET_SS_FAMILY(&source_p->localClient->ip), source_p->username, NULL); else aconf = find_conf_by_address (source_p->host, NULL, NULL, NULL, CONF_KILL, @@ -942,6 +942,7 @@ stats_ssld(struct Client *source_p) static void stats_usage (struct Client *source_p) { +#ifndef _WIN32 struct rusage rus; time_t secs; time_t rup; @@ -993,6 +994,7 @@ stats_usage (struct Client *source_p) "R :Signals %d Context Vol. %d Invol %d", (int) rus.ru_nsignals, (int) rus.ru_nvcsw, (int) rus.ru_nivcsw); +#endif } static void From c0949eb003bc549055c39e876d0180b49c6fb06a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:26:30 -0500 Subject: [PATCH 078/252] extensions/m_webirc: win32 fixes --- extensions/m_webirc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/m_webirc.c b/extensions/m_webirc.c index cf849efe4..99f66b5b6 100644 --- a/extensions/m_webirc.c +++ b/extensions/m_webirc.c @@ -92,7 +92,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc IsGotId(client_p) ? client_p->username : "webirc", IsGotId(client_p) ? client_p->username : "webirc", (struct sockaddr *) &client_p->localClient->ip, - client_p->localClient->ip.ss_family, NULL); + GET_SS_FAMILY(&client_p->localClient->ip), NULL); if (aconf == NULL || !(aconf->status & CONF_CLIENT)) return; if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc.")) @@ -145,7 +145,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc /* Check dlines now, klines will be checked on registration */ if((aconf = find_dline((struct sockaddr *)&source_p->localClient->ip, - source_p->localClient->ip.ss_family))) + GET_SS_FAMILY(&source_p->localClient->ip)))) { if(!(aconf->status & CONF_EXEMPTDLINE)) { From b870e83db3aa461ce3b4adbe1470b1a0ea8899ec Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:30:57 -0500 Subject: [PATCH 079/252] makefile: remove *.dll.a files too --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index c4a49a6df..4bc92d554 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,3 +42,6 @@ install-exec-hook: rm -f ${DESTDIR}${moduledir}/*.la rm -f ${DESTDIR}${moduledir}/autoload/*.la rm -f ${DESTDIR}${moduledir}/extensions/*.la + rm -f ${DESTDIR}${moduledir}/*.dll.a + rm -f ${DESTDIR}${moduledir}/autoload/*.dll.a + rm -f ${DESTDIR}${moduledir}/extensions/*.dll.a From 02831b6f6522837c79248166c320c104612da73c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 02:42:42 -0500 Subject: [PATCH 080/252] modules: warning cleanups --- ircd/modules.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ircd/modules.c b/ircd/modules.c index b10b73792..5638d1501 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -1033,11 +1033,11 @@ load_a_module(const char *path, int warn, int origin, int core) } sendto_realops_snomask(SNO_GENERAL, L_ALL, - "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at 0x%lx", + "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at %p", mod_basename, ver, MAPI_VERSION(*mapi_version), o, description, - (unsigned long) tmpptr); - ilog(L_MAIN, "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at 0x%lx", - mod_basename, ver, MAPI_VERSION(*mapi_version), o, description, (unsigned long) tmpptr); + (void *) tmpptr); + ilog(L_MAIN, "Module %s [version: %s; MAPI version: %d; origin: %s; description: \"%s\"] loaded at %p", + mod_basename, ver, MAPI_VERSION(*mapi_version), o, description, (void *) tmpptr); } rb_free(mod_basename); return 0; From 48c6d0f56c022f39f08428ba88d811a3a64b7af5 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:02:56 -0500 Subject: [PATCH 081/252] ircd: squelch write(2) warning differently --- ircd/ircd.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index 376b4cc98..b94a71738 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -175,13 +175,7 @@ print_startup(int pid) * -- jilles */ if (!server_state_foreground) { - if(write(0, ".", 1) < 1) - /* The circumstances in which this could fail are pretty implausible. - * However, this shuts GCC up about warning the result of write is unused, - * and is "standards compliant" behaviour. - * --Elizabeth - */ - abort(); + (void) write(0, ".", 1); } if (dup2(1, 0) == -1) abort(); From c1bfea7332518b91338cb7d8760c72bca92724b2 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:06:14 -0500 Subject: [PATCH 082/252] ircd: handle some EXIT_FAILURE cases differently on win32 --- ircd/ircd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index b94a71738..3997a3a88 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -156,6 +156,7 @@ print_startup(int pid) { int fd; +#ifndef _WIN32 close(1); fd = open("/dev/null", O_RDWR); if (fd == -1) { @@ -166,11 +167,13 @@ print_startup(int pid) fd = dup(fd); if (fd != 1) abort(); +#endif inotice("now running in %s mode from %s as pid %d ...", !server_state_foreground ? "background" : "foreground", ConfigFileEntry.dpath, pid); +#ifndef _WIN32 /* let the parent process know the initialization was successful * -- jilles */ if (!server_state_foreground) @@ -181,6 +184,7 @@ print_startup(int pid) abort(); if (dup2(1, 2) == -1) abort(); +#endif } /* @@ -193,7 +197,7 @@ print_startup(int pid) static void init_sys(void) { -#if defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H) +#if !defined(_WIN32) && defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H) struct rlimit limit; if(!getrlimit(RLIMIT_NOFILE, &limit)) From 09f528c24c352af6060fc0df10eea385f72cfcf1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:10:05 -0500 Subject: [PATCH 083/252] ircd: win32 does not need the FD 0,1,2 stuff --- ircd/ircd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ircd/ircd.c b/ircd/ircd.c index 3997a3a88..4634f141d 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -616,6 +616,7 @@ charybdis_main(int argc, char *argv[]) if (testing_conf) server_state_foreground = true; +#ifndef _WIN32 /* Make sure fd 0, 1 and 2 are in use -- jilles */ do { @@ -625,6 +626,7 @@ charybdis_main(int argc, char *argv[]) close(fd); else if (fd == -1) exit(1); +#endif /* Check if there is pidfile and daemon already running */ if(!testing_conf) From 38b68802a354865924009ab7a1e54ff37de1a990 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:41:25 -0500 Subject: [PATCH 084/252] librb: rb_lib: undefine any previous errno consts on win32 --- librb/include/rb_lib.h | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h index 626fc78e8..bc4eb502a 100644 --- a/librb/include/rb_lib.h +++ b/librb/include/rb_lib.h @@ -88,38 +88,29 @@ typedef int rb_platform_fd_t; #define strerror(x) rb_strerror(x) char *rb_strerror(int error); - -#ifndef ENOBUFS +#undef ENOBUFS #define ENOBUFS WSAENOBUFS -#endif -#ifndef EINPROGRESS +#undef EINPROGRESS #define EINPROGRESS WSAEINPROGRESS -#endif -#ifndef EWOULDBLOCK +#undef EWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK -#endif -#ifndef EMSGSIZE +#undef EMSGSIZE #define EMSGSIZE WSAEMSGSIZE -#endif -#ifndef EALREADY +#undef EALREADY #define EALREADY WSAEALREADY -#endif -#ifndef EISCONN +#undef EISCONN #define EISCONN WSAEISCONN -#endif -#ifndef EADDRINUSE +#undef EADDRINUSE #define EADDRINUSE WSAEADDRINUSE -#endif -#ifndef EAFNOSUPPORT +#undef EAFNOSUPPORT #define EAFNOSUPPORT WSAEAFNOSUPPORT -#endif #define pipe(x) _pipe(x, 1024, O_BINARY) #define ioctl(x,y,z) ioctlsocket(x,y, (u_long *)z) From 898268a84d6093057f1a215fb2fdfdaa8d268f8c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:49:06 -0500 Subject: [PATCH 085/252] CREDITS: fix whitespace --- CREDITS | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CREDITS b/CREDITS index 745deb9a4..7db8cc560 100644 --- a/CREDITS +++ b/CREDITS @@ -9,9 +9,9 @@ jilles, Jilles Tjoelker mr_flea, Keith Buck kaniini, William Pitcock spb, Stephen Bennett - + The following people are also project members: - + amdj, Aaron Jones Elizafox, Elizabeth Myers grawity, Mantas MikulÄ—nas @@ -19,7 +19,7 @@ jdhore, JD Horelick lp0, Simon Arlott mniip viatsko, Valerii Iatsko - + The following people have made contributions to the Charybdis releases, in nick-alphabetical order: @@ -32,10 +32,10 @@ Taros, Brett Greenham ThaPrince, Jon Christopherson twincest, River Tarnell w00t, Robin Burchell - -For a list of contributors to ircd-ratbox, ircd-hyrbid, and ircd2.8 (the + +For a list of contributors to ircd-ratbox, ircd-hybrid, and ircd2.8 (the predecessors to Charybdis), see the doc/credits-past.txt file in the Charybdis distribution. - + Visit the Charybdis website at: http://www.charybdis.io Visit us on IRC at: irc.freenode.net #charybdis From 4063dc2f62b7aec852f313d5b3d0740c213c1902 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:51:31 -0500 Subject: [PATCH 086/252] authd: reslib: hook in windows DNS logic --- authd/reslib.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/authd/reslib.c b/authd/reslib.c index 248f753d1..c5f136393 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -131,7 +131,10 @@ static const char digitvalue[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /*256*/ }; +#ifndef _WIN32 static int parse_resvconf(void); +#endif + static void add_nameserver(const char *); static const char digits[] = "0123456789"; @@ -158,12 +161,31 @@ int irc_res_init(void) { irc_nscount = 0; +#ifndef _WIN32 parse_resvconf(); +#else + parse_windows_nameservers(); +#endif if (irc_nscount == 0) add_nameserver("127.0.0.1"); return 0; } +#ifdef _WIN32 +static void +parse_windows_resolvers(void) +{ + const char *ns = get_windows_nameservers(); + char *server; + char *p; + char *buf = rb_strdup(ns); + for(server = rb_strtok_r(buf, " ", &p); server != NULL;server = rb_strtok_r(NULL, " ", &p)) + { + add_nameserver(server); + } + rb_free(buf); +} +#else /* parse_resvconf() * * inputs - NONE @@ -229,6 +251,7 @@ parse_resvconf(void) fclose(file); return 0; } +#endif /* add_nameserver() * From f23719b7cd1fb5c4bb419000ef43cb5b8e7cd29c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:56:00 -0500 Subject: [PATCH 087/252] authd: reslib: fix compile on win32 --- authd/reslib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/authd/reslib.c b/authd/reslib.c index c5f136393..52589ad1c 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -133,6 +133,8 @@ static const char digitvalue[256] = { #ifndef _WIN32 static int parse_resvconf(void); +#else +static void parse_windows_resolvers(void); #endif static void add_nameserver(const char *); From ddebec8cfdc4d5e55f06c84ccda504d09bea6381 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 03:57:21 -0500 Subject: [PATCH 088/252] reslib: really fix it this time --- authd/reslib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authd/reslib.c b/authd/reslib.c index 52589ad1c..ecfe0e84d 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -166,7 +166,7 @@ irc_res_init(void) #ifndef _WIN32 parse_resvconf(); #else - parse_windows_nameservers(); + parse_windows_resolvers(); #endif if (irc_nscount == 0) add_nameserver("127.0.0.1"); From ea83b018b5196f1c43c21b7b1eddbfacd6eb47b7 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:08:12 -0500 Subject: [PATCH 089/252] librb: acinclude: check for ipv6 on win32 --- librb/acinclude.m4 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/librb/acinclude.m4 b/librb/acinclude.m4 index 8325a7d0c..a839aa024 100644 --- a/librb/acinclude.m4 +++ b/librb/acinclude.m4 @@ -38,8 +38,13 @@ dnl RB_PROTO_INET6 AC_DEFUN([RB_PROTO_INET6],[ AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[ AC_TRY_CPP([ +#ifndef _WIN32 #include #include +#else +#include +#include +#endif #ifndef PF_INET6 #error Missing PF_INET6 From 71b2af0611792ce69b744ffc6d5bbb3182b1b006 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:10:33 -0500 Subject: [PATCH 090/252] acinclude: fix sockaddr_in6 checvk too --- librb/acinclude.m4 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/librb/acinclude.m4 b/librb/acinclude.m4 index a839aa024..e0474339b 100644 --- a/librb/acinclude.m4 +++ b/librb/acinclude.m4 @@ -74,9 +74,14 @@ AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ ],[ rb_have_sockaddr_in6=no ],[ +#ifndef _WIN32 #include #include #include +#else +#include +#include +#endif ]) if test "X$rb_have_sockaddr_in6" = "Xyes"; then : From fe277230f9162c2a83e8de45a3ddf5fb509769e0 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:14:28 -0500 Subject: [PATCH 091/252] librb: configure: also include ws2tcpip.h --- librb/configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/librb/configure.ac b/librb/configure.ac index 52f0a2308..26b85a9b6 100644 --- a/librb/configure.ac +++ b/librb/configure.ac @@ -496,6 +496,7 @@ if test "x$rb_windows_h" = "xyes"; then echo '#define WIN32_LEAN_AND_MEAN 1' >> $outfile echo '#include ' >> $outfile echo '#include ' >> $outfile + echo '#include ' >> $outfile echo '#include ' >> $outfile fi From d24856d2289c17e7b9459c81e36d3729bdafe265 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:18:42 -0500 Subject: [PATCH 092/252] librb: commio: squelch setsockopt(3) warnings --- librb/src/commio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librb/src/commio.c b/librb/src/commio.c index 15bd5080c..7309b2e5b 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -703,7 +703,7 @@ rb_socket(int family, int sock_type, int proto, const char *note) if(family == AF_INET6) { int off = 1; - if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &off, sizeof(off)) == -1) + if(setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (void *) &off, sizeof(off)) == -1) { rb_lib_log("rb_socket: Could not set IPV6_V6ONLY option to 1 on FD %d: %s", fd, strerror(errno)); From 44f442e3fb0a9ac309ab5b111f8c06f50c731457 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:21:25 -0500 Subject: [PATCH 093/252] ircd: parse: now this type cast for POINTER MATH is just fucking stupid --- ircd/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/parse.c b/ircd/parse.c index 6e4189f9b..92791bf31 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -186,7 +186,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) /* Its expected this nasty code can be removed * or rewritten later if still needed. */ - if((unsigned long) (p + 8) > (unsigned long) end) + if((p + 8) > end) { for (; p <= end; p++) { From 9783438eb429de6d1830fa3c23e71380b06eddd9 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:22:17 -0500 Subject: [PATCH 094/252] authd: res: fix build on windows ipv6 --- authd/res.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authd/res.c b/authd/res.c index 262c4f2bf..12bd93494 100644 --- a/authd/res.c +++ b/authd/res.c @@ -913,7 +913,7 @@ static int res_read_single_reply(rb_fde_t *F, void *data) * ip#. */ #ifdef RB_IPV6 - if (request->addr.ss_family == AF_INET6) + if (GET_SS_FAMILY(&request->addr) == AF_INET6) gethost_byname_type_fqdn(request->name, request->query, T_AAAA); else #endif From eb558775484a29be74135570b782dafc3145e77c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:24:30 -0500 Subject: [PATCH 095/252] librb: fix socklen_t check --- librb/configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/librb/configure.ac b/librb/configure.ac index 26b85a9b6..a0fefbae6 100644 --- a/librb/configure.ac +++ b/librb/configure.ac @@ -144,6 +144,7 @@ AC_CHECK_TYPE([socklen_t], rb_cv_socklen_t=socklen_t,[ #endif #ifdef HAVE_WINSOCK2_H #include +#include #endif int getpeername (int, $arg2 *, $t *); ],[ From 570bbefb54662ffb993058908e8178942d7644bc Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:40:14 -0500 Subject: [PATCH 096/252] configure: remove old check for socklen_t. ircd uses rb_socklen_t for a long time. --- configure.ac | 6 ------ 1 file changed, 6 deletions(-) diff --git a/configure.ac b/configure.ac index 2c4953f30..1de852d7b 100644 --- a/configure.ac +++ b/configure.ac @@ -167,12 +167,6 @@ if test x"$SUN" = xyes; then AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])]) fi -AC_CHECK_TYPE(socklen_t, , -[AC_DEFINE([socklen_t], [unsigned int], -[If we don't have a real socklen_t, unsigned int is good enough.])], -[#include -#include ]) - AC_ARG_ENABLE(ipv6, AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no]) From 032ef5ef9e1512c02fe01de3bf370b69fb6fb4cc Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 04:46:50 -0500 Subject: [PATCH 097/252] modules: more GET_SS_FAMILY() checking --- extensions/extb_hostmask.c | 2 +- modules/m_etrace.c | 4 ++-- modules/m_whois.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/extb_hostmask.c b/extensions/extb_hostmask.c index fcdee731d..9bffe26b8 100644 --- a/extensions/extb_hostmask.c +++ b/extensions/extb_hostmask.c @@ -56,7 +56,7 @@ eb_hostmask(const char *banstr, struct Client *client_p, struct Channel *chptr, #ifdef RB_IPV6 /* handle Teredo if necessary */ - if (client_p->localClient->ip.ss_family == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4)) + if (GET_SS_FAMILY(&client_p->localClient->ip) == AF_INET6 && ipv4_from_ipv6((const struct sockaddr_in6 *) &client_p->localClient->ip, &ip4)) { sprintf(src_ip4host, "%s!%s@", client_p->name, client_p->username); s4 = src_ip4host + strlen(src_ip4host); diff --git a/modules/m_etrace.c b/modules/m_etrace.c index 3a0f5e18d..7e5e3c049 100644 --- a/modules/m_etrace.c +++ b/modules/m_etrace.c @@ -165,8 +165,8 @@ do_etrace(struct Client *source_p, int ipv4, int ipv6) target_p = ptr->data; #ifdef RB_IPV6 - if((!ipv4 && target_p->localClient->ip.ss_family == AF_INET) || - (!ipv6 && target_p->localClient->ip.ss_family == AF_INET6)) + if((!ipv4 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET) || + (!ipv6 && GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6)) continue; #endif diff --git a/modules/m_whois.c b/modules/m_whois.c index 39b048148..3caf1330d 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -367,7 +367,7 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) target_p->name, target_p->sockhost); #ifdef RB_IPV6 - if (target_p->localClient->ip.ss_family == AF_INET6 && + if (GET_SS_FAMILY(&target_p->localClient->ip) == AF_INET6 && (show_ip(source_p, target_p) || (source_p == target_p && !IsIPSpoof(target_p))) && ipv4_from_ipv6((struct sockaddr_in6 *)&target_p->localClient->ip, &ip4)) From 6cb643f4f9f7f558ce96c5b0087fd28c8a40c6db Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 05:54:48 -0500 Subject: [PATCH 098/252] ircd: modules: use LT_MODULE_EXT more consistently --- ircd/modules.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ircd/modules.c b/ircd/modules.c index 5638d1501..f1faf5d8a 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -274,8 +274,8 @@ load_core_modules(int warn) for (i = 0; core_module_table[i]; i++) { - snprintf(module_name, sizeof(module_name), "%s/%s", MODPATH, - core_module_table[i]); + snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, + core_module_table[i], LT_MODULE_EXT); if(load_a_module(module_name, warn, MAPI_ORIGIN_CORE, 1) == -1) { @@ -299,7 +299,6 @@ load_one_module(const char *path, int origin, int coremodule) char modpath[PATH_MAX]; rb_dlink_node *pathst; const char *mpath; - struct stat statbuf; if (server_state_foreground) @@ -315,7 +314,7 @@ load_one_module(const char *path, int origin, int coremodule) { mpath = pathst->data; - snprintf(modpath, sizeof(modpath), "%s/%s", mpath, path); + snprintf(modpath, sizeof(modpath), "%s/%s%s", mpath, path, LT_MODULE_EXT); if((strstr(modpath, "../") == NULL) && (strstr(modpath, "/..") == NULL)) { if(stat(modpath, &statbuf) == 0) From c9108ea07312cbd49c52dd0b930f76bbaeea8308 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 06:00:20 -0500 Subject: [PATCH 099/252] ircd: modules: findmodule_byname(): also check LT_MODULE_EXT here --- ircd/modules.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ircd/modules.c b/ircd/modules.c index f1faf5d8a..2e0e08697 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -206,12 +206,20 @@ int findmodule_byname(const char *name) { int i; + char name_ext[PATH_MAX + 1]; + + rb_strlcpy(name_ext, name, sizeof basename_ext); + rb_strlcat(name_ext, LT_MODULE_EXT, sizeof basename_ext); for (i = 0; i < num_mods; i++) { if(!irccmp(modlist[i]->name, name)) return i; + + if(!irccmp(modlist[i]->name, name_ext)) + return i; } + return -1; } From dd92c99b8361393050dc2174ab82ff02fa913ff3 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 06:01:12 -0500 Subject: [PATCH 100/252] modules: fix thinko --- ircd/modules.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ircd/modules.c b/ircd/modules.c index 2e0e08697..82226c960 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -208,8 +208,8 @@ findmodule_byname(const char *name) int i; char name_ext[PATH_MAX + 1]; - rb_strlcpy(name_ext, name, sizeof basename_ext); - rb_strlcat(name_ext, LT_MODULE_EXT, sizeof basename_ext); + rb_strlcpy(name_ext, name, sizeof name_ext); + rb_strlcat(name_ext, LT_MODULE_EXT, sizeof name_ext); for (i = 0; i < num_mods; i++) { From 4f5056dd834eb57fcf0b3a967e8083045774eed8 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 06:22:39 -0500 Subject: [PATCH 101/252] ircd: fix build on freebsd --- ircd/ircd_signal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ircd/ircd_signal.c b/ircd/ircd_signal.c index e2195704f..0b3ffdb6e 100644 --- a/ircd/ircd_signal.c +++ b/ircd/ircd_signal.c @@ -29,6 +29,9 @@ #ifndef _WIN32 +#include +#include + /* * dummy_handler - don't know if this is really needed but if alarm is still * being used we probably will From 5a5f173daa21ae1a7f290dbd025b5246dd3a2c5b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 06:40:54 -0500 Subject: [PATCH 102/252] parse: check IsServer() before firing off a remove_unknowns() call --- ircd/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/parse.c b/ircd/parse.c index 92791bf31..9760e6e7a 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -107,7 +107,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) return; } - if (msgbuf.origin != NULL) + if (msgbuf.origin != NULL && IsServer(client_p)) { from = find_client(msgbuf.origin); From 98793cc9e495347698d70982e26ae3cc22a9f632 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sun, 20 Mar 2016 10:26:22 -0500 Subject: [PATCH 103/252] librb: remove an experiment I had. This won't really work on 32-bit architectures due to pointer truncation. In any case, I wasn't planning on using it for this reason, it was simply something I tinkered with. --- librb/include/rb_dictionary.h | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 002fcfba7..3f8a7c221 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -161,12 +161,6 @@ void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void #define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long) (x)) #define RB_UINT_TO_POINTER(x) ((void *) (unsigned long) (uint32_t) (x)) -#define RB_POINTER_TO_LONG(x) ((int64_t) (unsigned long long) (x)) -#define RB_LONG_TO_POINTER(x) ((void *) (unsigned long long) (int64_t) (x)) - -#define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x)) -#define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x)) - #else #define RB_POINTER_TO_INT(x) ((int32_t) (unsigned long long) (x)) @@ -175,12 +169,6 @@ void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void #define RB_POINTER_TO_UINT(x) ((uint32_t) (unsigned long long) (x)) #define RB_UINT_TO_POINTER(x) ((void *) (unsigned long long) (uint32_t) (x)) -#define RB_POINTER_TO_LONG(x) ((int64_t) (unsigned long long) (x)) -#define RB_LONG_TO_POINTER(x) ((void *) (unsigned long long) (int64_t) (x)) - -#define RB_POINTER_TO_ULONG(x) ((uint64_t) (unsigned long long) (x)) -#define RB_ULONG_TO_POINTER(x) ((void *) (unsigned long long) (uint64_t) (x)) - #endif static inline int rb_int32cmp(const void *a, const void *b) @@ -193,14 +181,4 @@ static inline int rb_uint32cmp(const void *a, const void *b) return RB_POINTER_TO_UINT(b) - RB_POINTER_TO_UINT(a); } -static inline int rb_int64cmp(const void *a, const void *b) -{ - return RB_POINTER_TO_LONG(b) - RB_POINTER_TO_LONG(a); -} - -static inline int rb_uint64cmp(const void *a, const void *b) -{ - return RB_POINTER_TO_ULONG(b) - RB_POINTER_TO_ULONG(a); -} - #endif From ad9cbf9e0d9e7176014d3282613dfda846d11bdd Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Sun, 20 Mar 2016 18:59:07 -0400 Subject: [PATCH 104/252] s_user: Don't send CHGHOST clients op/voice syncs --- ircd/s_user.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ircd/s_user.c b/ircd/s_user.c index f1fc52a43..46a1ee61c 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -1464,10 +1464,8 @@ change_nick_user_host(struct Client *target_p, const char *nick, const char *use target_p->info); if(*mode) - sendto_channel_local_butone(target_p, ALL_MEMBERS, chptr, - ":%s MODE %s +%s %s", - target_p->servptr->name, - chptr->chname, mode, modeval); + sendto_channel_local_with_capability_butone(target_p, ALL_MEMBERS, NOCAPS, CLICAP_CHGHOST, chptr, + ":%s MODE %s +%s %s", target_p->servptr->name, chptr->chname, mode, modeval); *modeval = '\0'; } From 4acd32f7fbd62c5790e94c73200254098e43884e Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 19:50:33 -0500 Subject: [PATCH 105/252] add appveyor config --- .appveyor.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..d03e9fb74 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,17 @@ +version: 3.6-dev_{build} +clone_depth: 10 +install: + - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu mingw-w64-x86_64-gcc autoconf automake libtool pkgconf bison flex make mingw-w64-x86_64-openssl" + - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" + - c:\msys64\usr\bin\sh.exe -lc "uname -a" + - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" + - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" + - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" + - ps: Push-AppveyorArtifact cygcheck.log +build_script: + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./autogen.sh < /dev/null" + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./configure --prefix=$APPVEYOR_BUILD_FOLDER/build --enable-openssl=/mingw64 < /dev/null" + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make -j2 < /dev/null" + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make install < /dev/null" + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" + From 4f3db3045175ce1e40fe8cbef6b28e629b7dc6bd Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 19:55:02 -0500 Subject: [PATCH 106/252] appveyor: use pacman -Sy not -Syu --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index d03e9fb74..84d6b0445 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu mingw-w64-x86_64-gcc autoconf automake libtool pkgconf bison flex make mingw-w64-x86_64-openssl" + - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-gcc autoconf automake libtool pkgconf bison flex make mingw-w64-x86_64-openssl" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" From c167a8e14672276c116ef523894fab465a3dcd2d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 19:56:32 -0500 Subject: [PATCH 107/252] appveyor: don't install pkgconf, they have pkg-config instead --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 84d6b0445..e9ca46121 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-gcc autoconf automake libtool pkgconf bison flex make mingw-w64-x86_64-openssl" + - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-gcc autoconf automake libtool bison flex make mingw-w64-x86_64-openssl" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" From dbf326603a93883efec2f37d7a1ee2b3c3e28848 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 19:59:42 -0500 Subject: [PATCH 108/252] appveyor: don't install packages we already have --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index e9ca46121..904845895 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-gcc autoconf automake libtool bison flex make mingw-w64-x86_64-openssl" + - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-openssl" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" From b7029c8a6c5f2208cd7f4548c8060e2d19a848fe Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:02:26 -0500 Subject: [PATCH 109/252] appveyor: pacman --noconfirm i guess --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 904845895..a125ecf0c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-openssl" + - c:\msys64\usr\bin\sh.exe -lc "pacman -S --noconfirm mingw-w64-x86_64-openssl" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" From 1ad16a505ba5422540c52cf3446b67bebb79b368 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:11:17 -0500 Subject: [PATCH 110/252] appveyor: use right gcc --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index a125ecf0c..3f7ab94d8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,7 +10,7 @@ install: - ps: Push-AppveyorArtifact cygcheck.log build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./autogen.sh < /dev/null" - - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./configure --prefix=$APPVEYOR_BUILD_FOLDER/build --enable-openssl=/mingw64 < /dev/null" + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; env CC=/mingw64/bin/x86_64-w64-mingw32-gcc.exe ./configure --prefix=$APPVEYOR_BUILD_FOLDER/build --enable-openssl=/mingw64 < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make -j2 < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make install < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" From 2677b17117ba1c4816ce673a977a4373b0b82b84 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:15:26 -0500 Subject: [PATCH 111/252] appveyor: blah gcc check --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index 3f7ab94d8..b27d3faad 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,6 +7,7 @@ install: - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" + - c:\msys64\usr\bin\sh.exe -lc "/mingw64/bin/x86_64-w64-mingw32-gcc.exe -v" - ps: Push-AppveyorArtifact cygcheck.log build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./autogen.sh < /dev/null" From 0e961686c0c88d946f22b9e4a91ce3415d244c2a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:20:50 -0500 Subject: [PATCH 112/252] appveyor: push config.log on fail --- .appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index b27d3faad..6cac2d385 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -15,4 +15,5 @@ build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make -j2 < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make install < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" - +on_failure: + - ps: Push-AppveyorArtifact config.log From 315c3a8ff6e5312fe97d851fb3431772c2116afa Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:29:16 -0500 Subject: [PATCH 113/252] appveyor: verify msys2 is up to date --- .appveyor.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6cac2d385..d98619a2c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,8 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -S --noconfirm mingw-w64-x86_64-openssl" + - c:\msys64\usr\bin\sh.exe -lc "update-core" + - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu --noconfirm" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" @@ -11,7 +12,7 @@ install: - ps: Push-AppveyorArtifact cygcheck.log build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./autogen.sh < /dev/null" - - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; env CC=/mingw64/bin/x86_64-w64-mingw32-gcc.exe ./configure --prefix=$APPVEYOR_BUILD_FOLDER/build --enable-openssl=/mingw64 < /dev/null" + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; env CC=/mingw64/bin/x86_64-w64-mingw32-gcc.exe ./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make -j2 < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make install < /dev/null" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" From 264e9451b2b89d7564524e1d4b30d062e83c50a5 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:32:06 -0500 Subject: [PATCH 114/252] appveyor: use update-core --noconfirm --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index d98619a2c..460e8b7b7 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "update-core" + - c:\msys64\usr\bin\sh.exe -lc "update-core --noconfirm" - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu --noconfirm" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" From c82ce5c6211abb04fb3478887c45c8c680eead79 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:36:31 -0500 Subject: [PATCH 115/252] appveyor: just do what update-core does without using update-core since it doesnt support unattended upgrades --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 460e8b7b7..3b8ea3c47 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "update-core --noconfirm" + - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu --noconfirm bash pacman msys2-runtime" - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu --noconfirm" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" From e94decb620504764d330260019cc23fd7012b10a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:40:51 -0500 Subject: [PATCH 116/252] appveyor: lol dont do full system upgrade in first go --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 3b8ea3c47..f1df74193 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu --noconfirm bash pacman msys2-runtime" + - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy --noconfirm bash pacman msys2-runtime" - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu --noconfirm" - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" From 64832940fbc27e20204d382f0096b6ff4467092c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:50:57 -0500 Subject: [PATCH 117/252] appveyor: sanity check gcc itself --- .appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index f1df74193..5edc469bf 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,14 +1,13 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy --noconfirm bash pacman msys2-runtime" - - c:\msys64\usr\bin\sh.exe -lc "pacman -Syu --noconfirm" - - c:\msys64\usr\bin\sh.exe -lc "echo 'Building on:'" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" - c:\msys64\usr\bin\sh.exe -lc "/mingw64/bin/x86_64-w64-mingw32-gcc.exe -v" + - c:\msys64\usr\bin\sh.exe -lc "echo 'int main(void) { return 0; }' > gcc-test.c && /mingw64/bin/x86_64-w64-mingw32-gcc.exe -o gcc-test.exe gcc-test.c" + - c:\msys64\usr\bin\sh.exe -lc "./gcc-test" - ps: Push-AppveyorArtifact cygcheck.log build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./autogen.sh < /dev/null" From 5b97e7d2c77bfcb55bb184de4fd941a044c525e0 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 20:54:48 -0500 Subject: [PATCH 118/252] appveyor: make mingw64 gcc more talkative --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5edc469bf..0856c8a97 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,7 +6,7 @@ install: - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" - c:\msys64\usr\bin\sh.exe -lc "/mingw64/bin/x86_64-w64-mingw32-gcc.exe -v" - - c:\msys64\usr\bin\sh.exe -lc "echo 'int main(void) { return 0; }' > gcc-test.c && /mingw64/bin/x86_64-w64-mingw32-gcc.exe -o gcc-test.exe gcc-test.c" + - c:\msys64\usr\bin\sh.exe -lc "echo 'int main(void) { return 0; }' > gcc-test.c && /mingw64/bin/x86_64-w64-mingw32-gcc.exe -v -Wl,--verbose -o gcc-test.exe gcc-test.c" - c:\msys64\usr\bin\sh.exe -lc "./gcc-test" - ps: Push-AppveyorArtifact cygcheck.log build_script: From 5e85b1f894e4b32e5606a436782aeacafce5f681 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:02:39 -0500 Subject: [PATCH 119/252] appveyor: sanity check cc1 --- .appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 0856c8a97..2b876a8cb 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,8 +6,8 @@ install: - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" - c:\msys64\usr\bin\sh.exe -lc "/mingw64/bin/x86_64-w64-mingw32-gcc.exe -v" - - c:\msys64\usr\bin\sh.exe -lc "echo 'int main(void) { return 0; }' > gcc-test.c && /mingw64/bin/x86_64-w64-mingw32-gcc.exe -v -Wl,--verbose -o gcc-test.exe gcc-test.c" - - c:\msys64\usr\bin\sh.exe -lc "./gcc-test" + - c:\msys64\usr\bin\sh.exe -lc "echo 'int main(void) { return 0; }' > gcc-test.c && /mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/cc1.exe -v -D_REENTRANT gcc-test.c -dumpbase gcc-test.c -mtune=generic -march=x86-64 -auxbase gcc-test -version -o cc1-test.s" +# - c:\msys64\usr\bin\sh.exe -lc "./gcc-test" - ps: Push-AppveyorArtifact cygcheck.log build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./autogen.sh < /dev/null" From 4b135591c2e25e875f7975cec2be7ededd587839 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:07:27 -0500 Subject: [PATCH 120/252] appveyor: (re)install mingw-w64-x86_64-libwinpthread-git --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index 2b876a8cb..639882677 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: + - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-libwinpthread-git" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" From 81b6d9c63319158ea8905794ae1f4bb9d2585027 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:09:11 -0500 Subject: [PATCH 121/252] appveyor: --noconfirm --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index 639882677..30724a982 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,7 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy mingw-w64-x86_64-libwinpthread-git" + - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy --noconfirm mingw-w64-x86_64-libwinpthread-git" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" From 74b2b4aa45047fcb3c322ded3d96a10be3edb91b Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:13:19 -0500 Subject: [PATCH 122/252] appveyor: collect more data --- .appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.appveyor.yml b/.appveyor.yml index 30724a982..94f7d3b48 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -6,6 +6,8 @@ install: - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" + - c:\msys64\usr\bin\sh.exe -lc "echo $PATH" + - c:\msys64\usr\bin\sh.exe -lc "ldd /mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/cc1.exe" - c:\msys64\usr\bin\sh.exe -lc "/mingw64/bin/x86_64-w64-mingw32-gcc.exe -v" - c:\msys64\usr\bin\sh.exe -lc "echo 'int main(void) { return 0; }' > gcc-test.c && /mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/cc1.exe -v -D_REENTRANT gcc-test.c -dumpbase gcc-test.c -mtune=generic -march=x86-64 -auxbase gcc-test -version -o cc1-test.s" # - c:\msys64\usr\bin\sh.exe -lc "./gcc-test" From 1a79eced201d1f133bbd269e61a83ad12d7c9acb Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:27:11 -0500 Subject: [PATCH 123/252] appveyor: try a different approach --- .appveyor-build.sh | 10 ++++++++++ .appveyor.yml | 11 +---------- 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 .appveyor-build.sh diff --git a/.appveyor-build.sh b/.appveyor-build.sh new file mode 100644 index 000000000..709f8543f --- /dev/null +++ b/.appveyor-build.sh @@ -0,0 +1,10 @@ +set -v + +export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl + +cd $1 + +sh ./autogen.sh +./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 +make -j2 +make install diff --git a/.appveyor.yml b/.appveyor.yml index 94f7d3b48..dc69dddd3 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,22 +1,13 @@ version: 3.6-dev_{build} clone_depth: 10 install: - - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy --noconfirm mingw-w64-x86_64-libwinpthread-git" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" - - c:\msys64\usr\bin\sh.exe -lc "echo $PATH" - - c:\msys64\usr\bin\sh.exe -lc "ldd /mingw64/lib/gcc/x86_64-w64-mingw32/5.3.0/cc1.exe" - - c:\msys64\usr\bin\sh.exe -lc "/mingw64/bin/x86_64-w64-mingw32-gcc.exe -v" - - c:\msys64\usr\bin\sh.exe -lc "echo 'int main(void) { return 0; }' > gcc-test.c && /mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/cc1.exe -v -D_REENTRANT gcc-test.c -dumpbase gcc-test.c -mtune=generic -march=x86-64 -auxbase gcc-test -version -o cc1-test.s" -# - c:\msys64\usr\bin\sh.exe -lc "./gcc-test" - ps: Push-AppveyorArtifact cygcheck.log build_script: - - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; ./autogen.sh < /dev/null" - - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; env CC=/mingw64/bin/x86_64-w64-mingw32-gcc.exe ./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 < /dev/null" - - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make -j2 < /dev/null" - - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; make install < /dev/null" + - c:\msys64\usr\bin\sh.exe -l ".appveyor-build.sh" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" on_failure: - ps: Push-AppveyorArtifact config.log From 6e2ed9da91cbdb2e91c356e6bb35916066297d9f Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:34:03 -0500 Subject: [PATCH 124/252] appveyor: simplify build script further --- .appveyor-build.sh | 2 -- .appveyor.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.appveyor-build.sh b/.appveyor-build.sh index 709f8543f..6a00f5963 100644 --- a/.appveyor-build.sh +++ b/.appveyor-build.sh @@ -2,8 +2,6 @@ set -v export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl -cd $1 - sh ./autogen.sh ./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 make -j2 diff --git a/.appveyor.yml b/.appveyor.yml index dc69dddd3..496a3a3e1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -7,7 +7,7 @@ install: - c:\msys64\usr\bin\sh.exe -lc "cygcheck -s -v > $APPVEYOR_BUILD_FOLDER/cygcheck.log 2>&1" - ps: Push-AppveyorArtifact cygcheck.log build_script: - - c:\msys64\usr\bin\sh.exe -l ".appveyor-build.sh" + - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; sh .appveyor-build.sh" - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" on_failure: - ps: Push-AppveyorArtifact config.log From a9dbc61d7e5b75eca424df7892a6e41c473f8a23 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:39:25 -0500 Subject: [PATCH 125/252] appveyor: provide git for build --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index 496a3a3e1..30b597457 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,6 +1,7 @@ version: 3.6-dev_{build} clone_depth: 10 install: + - c:\msys64\usr\bin\sh.exe -lc "pacman -Sy --noconfirm git" - c:\msys64\usr\bin\sh.exe -lc "uname -a" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/cpuinfo" - c:\msys64\usr\bin\sh.exe -lc "cat /proc/meminfo" From 46b3fb5bba9d0a7d1a499b79c4067735ff7fe41c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 21:45:05 -0500 Subject: [PATCH 126/252] appveyor: push librb-config.h --- .appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.appveyor.yml b/.appveyor.yml index 30b597457..fc8492290 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -12,3 +12,4 @@ build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" on_failure: - ps: Push-AppveyorArtifact config.log + - ps: Push-AppveyorArtifact librb\include\librb-config.h From e452b26e46cb5ecd4e391c09ff762a48c2ace96c Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 22:01:17 -0500 Subject: [PATCH 127/252] librb: configure: tolerate older msys versions having wrong uname -a output --- librb/configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/librb/configure.ac b/librb/configure.ac index a0fefbae6..0e434c930 100644 --- a/librb/configure.ac +++ b/librb/configure.ac @@ -63,6 +63,7 @@ case "$host_os" in AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) ;; *mingw*) +*msys*) AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])]) From 36b3cff77f82270b2ffb2b17e214d706a85eedd9 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 22:06:54 -0500 Subject: [PATCH 128/252] configure: fix msys checks --- librb/configure.ac | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/librb/configure.ac b/librb/configure.ac index 0e434c930..127214d36 100644 --- a/librb/configure.ac +++ b/librb/configure.ac @@ -62,8 +62,7 @@ case "$host_os" in AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) ;; -*mingw*) -*msys*) +*mingw* | *msys*) AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) AC_CHECK_HEADER(windows.h, , [AC_MSG_ERROR([** MinGW and no windows.h. I give up.])]) From 8978ab4efad612aa16d56b75402d2ec2ee4934d7 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 22:17:52 -0500 Subject: [PATCH 129/252] configure: add same msys check here --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1de852d7b..5ac469565 100644 --- a/configure.ac +++ b/configure.ac @@ -39,7 +39,7 @@ case "$host_os" in AC_DEFINE_UNQUOTED(CYGWIN,1,[This is a Cygwin system]) AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) ;; -*mingw*) +*mingw* | *msys*) AC_DEFINE_UNQUOTED(MINGW,1,[This is a MinGW system]) AC_DEFINE_UNQUOTED(WINDOWS,1,[This is a Windows system]) AC_CHECK_HEADER(winsock2.h, , [AC_MSG_ERROR([** MinGW and no winsock2.h. I give up.])]) From bab056f044e3eb81ef71dfa943cbba6f3ee06cce Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 20 Mar 2016 23:00:30 -0500 Subject: [PATCH 130/252] appveyor: dont try to start ircd for the moment --- .appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor.yml b/.appveyor.yml index fc8492290..6b401717d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -9,7 +9,7 @@ install: - ps: Push-AppveyorArtifact cygcheck.log build_script: - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER; sh .appveyor-build.sh" - - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" +# - c:\msys64\usr\bin\sh.exe -lc "cd $APPVEYOR_BUILD_FOLDER/build/bin; ./charybdis -version" on_failure: - ps: Push-AppveyorArtifact config.log - ps: Push-AppveyorArtifact librb\include\librb-config.h From ceabbbbf3c1e27f853ae021f9d2ffe3b9e186165 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Mon, 21 Mar 2016 00:16:35 -0400 Subject: [PATCH 131/252] m_cap: Remove CLEAR subcommand as per v3 specs --- modules/m_cap.c | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/modules/m_cap.c b/modules/m_cap.c index 726fbe4a8..2a5823540 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -146,12 +146,11 @@ clicap_find(const char *data, int *negate, int *finished) * Generates a list of capabilities. * * Inputs: client to send to, subcmd to send, - * flags to match against: 0 to do none, -1 if client has no flags, - * int to whether we are doing CAP CLEAR + * flags to match against: 0 to do none, -1 if client has no flags * Outputs: None */ static void -clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clear) +clicap_generate(struct Client *source_p, const char *subcmd, int flags) { char buf[BUFSIZE] = { 0 }; char capbuf[BUFSIZE] = { 0 }; @@ -178,14 +177,8 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea struct ClientCapability *clicap = entry->ownerdata; const char *data = NULL; - if(flags) - { - if(!IsCapableEntry(source_p, entry)) - continue; - /* they are capable of this, check sticky */ - else if(clear && HasCapabilityFlag(entry, CLICAP_FLAGS_STICKY)) - continue; - } + if(flags && !IsCapableEntry(source_p, entry)) + continue; if (!clicap_visible(source_p, entry)) continue; @@ -211,8 +204,8 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags, int clea memset(capbuf, 0, sizeof capbuf); } - buflen = rb_snprintf_append(capbuf, sizeof capbuf, "%s%s%s%s ", - clear ? "-" : "", entry->cap, data != NULL ? "=" : "", data != NULL ? data : ""); + buflen = rb_snprintf_append(capbuf, sizeof capbuf, "%s%s%s ", + entry->cap, data != NULL ? "=" : "", data != NULL ? data : ""); } /* remove trailing space */ @@ -254,15 +247,6 @@ cap_ack(struct Client *source_p, const char *arg) source_p->localClient->caps &= ~capdel; } -static void -cap_clear(struct Client *source_p, const char *arg) -{ - clicap_generate(source_p, "ACK", - source_p->localClient->caps ? source_p->localClient->caps : -1, 1); - - source_p->localClient->caps = 0; -} - static void cap_end(struct Client *source_p, const char *arg) { @@ -282,7 +266,7 @@ cap_list(struct Client *source_p, const char *arg) { /* list of what theyre currently using */ clicap_generate(source_p, "LIST", - source_p->localClient->caps ? source_p->localClient->caps : -1, 0); + source_p->localClient->caps ? source_p->localClient->caps : -1); } static void @@ -298,7 +282,7 @@ cap_ls(struct Client *source_p, const char *arg) } /* list of what we support */ - clicap_generate(source_p, "LS", 0, 0); + clicap_generate(source_p, "LS", 0); } static void @@ -404,7 +388,6 @@ static struct clicap_cmd } clicap_cmdlist[] = { /* This list *MUST* be in alphabetical order */ { "ACK", cap_ack }, - { "CLEAR", cap_clear }, { "END", cap_end }, { "LIST", cap_list }, { "LS", cap_ls }, From 4c008ef32763f45c5c1ca935b61425659d71890a Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 21 Mar 2016 08:22:51 -0500 Subject: [PATCH 132/252] Remove stale line from travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ad8efb378..a8fb43f65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ matrix: branches: except: - - authd-framework + - authd-framework-2 osx_image: xcode7.3 From 1a8367735fb4fbd8cab879820c91deed829f672e Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 21 Mar 2016 08:32:21 -0500 Subject: [PATCH 133/252] Make release scripts less out of date. --- scripts/application.sh | 9 ++++++--- scripts/makerelease.sh | 45 +++--------------------------------------- 2 files changed, 9 insertions(+), 45 deletions(-) diff --git a/scripts/application.sh b/scripts/application.sh index ff82db9ec..a04ec371d 100755 --- a/scripts/application.sh +++ b/scripts/application.sh @@ -24,10 +24,13 @@ if [ "x$TIP" = "x" ]; then exit fi -# Charybdis wants the hg tip to be in include/serno.h, in its own format. -MYTIP=`git log -1 --date=short --pretty=format:%cd_%h 2>/dev/null | sed -e s/-//g -e s/_/-/` +# Charybdis wants the git head to be in include/serno.h, in its own format. +SERNO=`git log -1 --date=format:%Y%m%d --pretty=format:%cd-%h` +DATECODE=`git log -1 --pretty=format:%ct` + echo "[charybdis] Generating include/serno.h for tip $MYTIP." cat << _EOF_ > include/serno.h /* Generated automatically by makepackage. Any changes made here will be lost. */ -#define SERNO "$MYTIP" +#define SERNO "$SERNO" +#define DATECODE "$DATECODE" _EOF_ diff --git a/scripts/makerelease.sh b/scripts/makerelease.sh index 106dd8838..2a34e9ef3 100755 --- a/scripts/makerelease.sh +++ b/scripts/makerelease.sh @@ -20,16 +20,12 @@ # if [ "x$1" = "x" ]; then - echo "usage: $0 releasename [--automatic]" + echo "usage: $0 releasename" exit else RELEASENAME="$1" fi -if [ "x$2" = "x--automatic" ]; then - AUTOMATIC="yes" -fi - TIP=`git log -1 --pretty=oneline | cut -d" " -f1` WRKDIR=`pwd` @@ -66,41 +62,6 @@ echo "Building $RELEASENAME.tbz2 from $RELEASENAME/" tar jcf $RELEASENAME.tar.bz2 $RELEASENAME/ rm $RELEASENAME-working.tar.gz +rm -rf $RELEASENAME -PUBLISH="yes" - -ok="0" -if [ "x$AUTOMATIC" != "xyes" ]; then - echo - echo "Would you like to publish these releases now?" - while [ $ok -eq 0 ]; do - echo -n "[$PUBLISH] " - - read INPUT - case $INPUT in - [Yy]*) - PUBLISH="yes" - ok=1 - ;; - [Nn]*) - PUBLISH="no" - ok=1 - ;; - esac - done -fi - -if [ "x$PUBLISH" = "xyes" ]; then - scp $RELEASENAME.tgz hg.atheme.org:/srv/distfiles - scp $RELEASENAME.tbz2 hg.atheme.org:/srv/distfiles - - echo - echo "The releases have been published, and will be available to the entire" - echo "distribution network within 15 minutes." -fi - -echo -echo "Done. If you have any bugs to report, report them against" -echo "the distfiles.atheme.org component at http://jira.atheme.org" -echo "Thanks!" -echo +echo "Done. $RELEASENAME.tar.gz and $RELEASENAME.tar.bz2 built." From b6979c871a1aef4b58862fe02c16c7d35703b661 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 21 Mar 2016 08:32:47 -0500 Subject: [PATCH 134/252] travis: this branch is deprecated, authd-framework-2 is the new hotness --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a8fb43f65..68dba8a51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,9 +44,6 @@ matrix: compiler: clang env: COMPILER=clang LIBTOOLIZE=glibtoolize -branches: - except: - - authd-framework-2 osx_image: xcode7.3 From 8522eb3b2b08987660da97b76fd0f6c322ed0469 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Mon, 21 Mar 2016 09:12:59 -0500 Subject: [PATCH 135/252] mkpasswd: improve help and remove DES support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Just Say Noâ„¢ to weak ciphers. --- tools/README.mkpasswd | 52 +++++---------- tools/mkpasswd.c | 147 +++++++++--------------------------------- 2 files changed, 47 insertions(+), 152 deletions(-) diff --git a/tools/README.mkpasswd b/tools/README.mkpasswd index a07ae54d7..2bae860c1 100644 --- a/tools/README.mkpasswd +++ b/tools/README.mkpasswd @@ -3,56 +3,36 @@ mkpasswd.c documentation This is documentation for the updated mkpasswd.c included with a number of ircd, irc services, and non-IRC related programs -This version of mkpasswd can create DES, Extended DES, Blowfish, and MD5 +This version of mkpasswd can create Blowfish, MD5, SHA256, and SHA512 crypted passwords, with either randomly generated or user provided salts. Options: +-x Generate a SHA256 password +-y Generate a SHA512 password -m Generate an MD5 password --d Generate a DES password -b Generate a Blowfish password --e Generate an Extended (BSDi) DES password -l Specify a length for a random MD5 or Blowfish salt --r Specify a number of rounds for a Blowfish or Extended DES password - Blowfish: no more than 6 recommended, no less than 4 accepted - Extended DES: default of 25 --s Specify a salt, 2 alphanumeric characters for DES, up to 16 for MD5, - up to 22 for Blowfish, 2 for Extended DES +-r Specify a number of rounds for a Blowfish password + Default 4, no more than 6 recommended +-s Specify a salt, up to 16 for MD5, SHA256, and SHA512 + up to 22 for Blowfish -p Specify a plaintext password to use -? Get brief help -h Get extended help -Without the presence of any parameters, it'll behave like the old mkpasswd, -creating a DES password with a randomly generated salt and prompting for -the password (without echo). +Without the presence of any parameters, it'll generate a SHA512 hash with a +randomly generated salt and prompting for the password (without echo). -A DES salt is a pair of alphanumeric characters ('.' and '/' are permitted -as well), such as 'a4' or 'Td'. - -An MD5 salt consists of up to 16 (though most implementations limit you to -8) alphanumeric characters (plus '.' and '/'), -such as 'tGd' or 'J6d4dfG'. +An MD5, SHA256, and SHA512 salt consists of up to 16 alphanumeric characters +(plus '.' and '/'), such as 'tGd' or 'J6d4dfG'. A Blowfish salt consists of up to 22 alphanumeric characters (plus '.' and '/'). Blowfish also specifies a number of rounds*, by default 4. -Known bugs: -The encryption algorithms supported depend on your system's crypt() - implementation. -The maximum length of an MD5 salt is limited to your systems crypt() - implementation, typically 8. +Blowfish may not always be available, but MD5, SHA256, and SHA512 are +guaranteed to be. -Supported Platforms (Known and tested): -Linux glibc (DES and MD5) -FreeBSD 3.x (DES (MD5 maybe)) -FreeBSD 4.x (DES, MD5, Blowfish, Extended DES) -Solaris 2.5-2.6 (DES only) -Cygwin 1.1.4 (DES only) -Prior Cygwin with the MD5 libcrypt (MD5 only) -OpenBSD 2.7 (don't link with -lcrypt) (DES, MD5, Blowfish) -Mac OS-X (Darwin) (don't link with -lcrypt) (DES only) +This program should work anywhere Charybdis does; if you find otherwise, file +a bug. -An MMK build script is included, as well as an MD5 crypt() implementation - -Other systems probably work, but they haven't been amply tested. - -* Blowfish's rounds parameter is a logarithm, not an integer value + * Blowfish's rounds parameter is a logarithm, not an integer value diff --git a/tools/mkpasswd.c b/tools/mkpasswd.c index de1ccc1bd..8762255e2 100644 --- a/tools/mkpasswd.c +++ b/tools/mkpasswd.c @@ -1,15 +1,14 @@ /* simple password generator by Nelson Minar (minar@reed.edu) -** copyright 1991, all rights reserved. -** You can use this code as long as my name stays with it. -** -** md5 patch by W. Campbell -** Modernization, getopt, etc for the Hybrid IRCD team -** by W. Campbell -** -** /dev/random for salt generation added by -** Aaron Sethman -** -*/ + * copyright 1991, all rights reserved. + * You can use this code as long as my name stays with it. + * + * md5 patch by W. Campbell + * Modernization, getopt, etc for the Hybrid IRCD team + * by W. Campbell + * + * /dev/random for salt generation added by + * Aaron Sethman + */ #include #include #include @@ -22,20 +21,15 @@ #endif #define FLAG_MD5 0x00000001 -#define FLAG_DES 0x00000002 -#define FLAG_SALT 0x00000004 -#define FLAG_PASS 0x00000008 -#define FLAG_LENGTH 0x00000010 -#define FLAG_BLOWFISH 0x00000020 -#define FLAG_ROUNDS 0x00000040 -#define FLAG_EXT 0x00000080 -#define FLAG_SHA256 0x00000100 -#define FLAG_SHA512 0x00000200 +#define FLAG_SALT 0x00000002 +#define FLAG_PASS 0x00000004 +#define FLAG_LENGTH 0x00000008 +#define FLAG_BLOWFISH 0x00000010 +#define FLAG_ROUNDS 0x00000020 +#define FLAG_SHA256 0x00000040 +#define FLAG_SHA512 0x00000080 -static char *make_des_salt(void); -static char *make_ext_salt(int); -static char *make_ext_salt_para(int, char *); static char *make_md5_salt(int); static char *make_md5_salt_para(char *); static char *make_sha256_salt(int); @@ -100,30 +94,22 @@ main(int argc, char *argv[]) char *hashed; int flag = 0; int length = 0; /* Not Set */ - int rounds = 0; /* Not set, since extended DES needs 25 and blowfish needs - ** 4 by default, a side effect of this being the encryption - ** type parameter must be specified before the rounds - ** parameter. + int rounds = 0; /* Not set, since blowfish needs 4 by default, a side effect + * of this being the encryption type parameter must be + * specified before the rounds parameter. */ - while((c = getopt(argc, argv, "xymdber:h?l:s:p:")) != -1) + while((c = getopt(argc, argv, "xymbr:h?l:s:p:")) != -1) { switch (c) { case 'm': flag |= FLAG_MD5; break; - case 'd': - flag |= FLAG_DES; - break; case 'b': flag |= FLAG_BLOWFISH; rounds = 4; break; - case 'e': - flag |= FLAG_EXT; - rounds = 25; - break; case 'l': flag |= FLAG_LENGTH; length = atoi(optarg); @@ -187,45 +173,6 @@ main(int argc, char *argv[]) else salt = make_sha256_salt(length); } - else if(flag & FLAG_EXT) - { - /* XXX - rounds needs to be done */ - if(flag & FLAG_SALT) - { - if((strlen(saltpara) == 4)) - { - salt = make_ext_salt_para(rounds, saltpara); - } - else - { - printf("Invalid salt, please enter 4 alphanumeric characters\n"); - exit(1); - } - } - else - { - salt = make_ext_salt(rounds); - } - } - else if (flag & FLAG_DES) - { - if(flag & FLAG_SALT) - { - if((strlen(saltpara) == 2)) - { - salt = saltpara; - } - else - { - printf("Invalid salt, please enter 2 alphanumeric characters\n"); - exit(1); - } - } - else - { - salt = make_des_salt(); - } - } else { if(length == 0) @@ -262,15 +209,6 @@ main(int argc, char *argv[]) return 0; } -static char * -make_des_salt() -{ - static char salt[3]; - generate_random_salt(salt, 2); - salt[2] = '\0'; - return salt; -} - char * int_to_base64(int value) { @@ -289,26 +227,6 @@ int_to_base64(int value) return buf; } -char * -make_ext_salt(int rounds) -{ - static char salt[10]; - - sprintf(salt, "_%s", int_to_base64(rounds)); - generate_random_salt(&salt[5], 4); - salt[9] = '\0'; - return salt; -} - -char * -make_ext_salt_para(int rounds, char *saltpara) -{ - static char salt[10]; - - sprintf(salt, "_%s%s", int_to_base64(rounds), saltpara); - return salt; -} - char * make_md5_salt_para(char *saltpara) { @@ -499,19 +417,16 @@ generate_random_salt(char *salt, int length) void full_usage() { - printf("mkpasswd [-m|-d|-b|-e] [-l saltlength] [-r rounds] [-s salt] [-p plaintext]\n"); + printf("mkpasswd [-m|-b|-x|-y] [-l saltlength] [-r rounds] [-s salt] [-p plaintext]\n"); printf("-x Generate a SHA256 password\n"); printf("-y Generate a SHA512 password\n"); printf("-m Generate an MD5 password\n"); - printf("-d Generate a DES password\n"); printf("-b Generate a Blowfish password\n"); - printf("-e Generate an Extended DES password\n"); printf("-l Specify a length for a random MD5 or Blowfish salt\n"); - printf("-r Specify a number of rounds for a Blowfish or Extended DES password\n"); - printf(" Blowfish: default 4, no more than 6 recommended\n"); - printf(" Extended DES: default 25\n"); - printf("-s Specify a salt, 2 alphanumeric characters for DES, up to 16 for MD5,\n"); - printf(" up to 22 for Blowfish, and 4 for Extended DES\n"); + printf("-r Specify a number of rounds for a Blowfish password\n"); + printf(" Default 4, no more than 6 recommended\n"); + printf("-s Specify a salt, up to 16 for MD5, SHA256, and SHA512\n"); + printf(" up to 22 for Blowfish\n"); printf("-p Specify a plaintext password to use\n"); printf("Example: mkpasswd -m -s 3dr -p test\n"); exit(0); @@ -521,11 +436,11 @@ void brief_usage() { printf("mkpasswd - password hash generator\n"); - printf("Standard DES: mkpasswd [-d] [-s salt] [-p plaintext]\n"); - printf("Extended DES: mkpasswd -e [-r rounds] [-s salt] [-p plaintext]\n"); - printf(" MD5: mkpasswd -m [-l saltlength] [-s salt] [-p plaintext]\n"); - printf(" Blowfish: mkpasswd -b [-r rounds] [-l saltlength] [-s salt]\n"); - printf(" [-p plaintext]\n"); + printf(" SHA512: mkpasswd [-y] [-l saltlength] [-s salt] [-p plaintext]\n"); + printf(" SHA256: mkpasswd -x [-l saltlength] [-s salt] [-p plaintext]\n"); + printf(" MD5: mkpasswd -m [-l saltlength] [-s salt] [-p plaintext]\n"); + printf("Blowfish: mkpasswd -b [-r rounds] [-l saltlength] [-s salt]\n"); + printf(" [-p plaintext]\n"); printf("Use -h for full usage\n"); exit(0); } From f5e99138e3b73bb49f54cda7c0689a0796f12584 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 21 Mar 2016 12:11:56 -0500 Subject: [PATCH 136/252] appveyor: try overriding the triplets --- .appveyor-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.appveyor-build.sh b/.appveyor-build.sh index 6a00f5963..7aa1682c9 100644 --- a/.appveyor-build.sh +++ b/.appveyor-build.sh @@ -3,6 +3,6 @@ set -v export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl sh ./autogen.sh -./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 +./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 --build=x86_64-pc-mingw64 --host=x86_64-pc-mingw64 make -j2 make install From 427ed8ead6c7a66caaa2708f6b2f3471281478d5 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 21 Mar 2016 12:31:43 -0500 Subject: [PATCH 137/252] README: link to appveyor builds too --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f12bfff4c..d138e832e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# charybdis [![Build Status](https://travis-ci.org/charybdis-ircd/charybdis.svg?branch=master)](https://travis-ci.org/charybdis-ircd/charybdis) +# charybdis [![POSIX Build Status](https://travis-ci.org/charybdis-ircd/charybdis.svg?branch=master)](https://travis-ci.org/charybdis-ircd/charybdis) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/is0obsml8xyq2qk7/branch/master?svg=true)](https://ci.appveyor.com/project/kaniini/charybdis/branch/master) Charybdis is an IRCv3 server designed to be highly scalable. It implements IRCv3.1 and some parts of IRCv3.2. From 790e4dce4e0775a69daf9f33321be9c46a83c6ba Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 21 Mar 2016 21:07:53 -0500 Subject: [PATCH 138/252] librb: add rb_path_to_self(), which provides fairly reliable runtime path detection --- librb/configure.ac | 3 ++- librb/include/rb_tools.h | 1 + librb/src/export-syms.txt | 1 + librb/src/unix.c | 45 ++++++++++++++++++++++++++++++++++----- librb/src/win32.c | 9 ++++++++ 5 files changed, 53 insertions(+), 6 deletions(-) diff --git a/librb/configure.ac b/librb/configure.ac index 127214d36..f2e5acbcf 100644 --- a/librb/configure.ac +++ b/librb/configure.ac @@ -211,8 +211,9 @@ AC_CHECK_TYPE([sa_family_t], [], dnl check for various functions... -AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) +AC_CHECK_FUNCS([snprintf vsnprintf socketpair gettimeofday writev sendmsg gmtime_r strtok_r usleep posix_spawn getexecname strlcpy strlcat strnlen fstat signalfd select poll kevent port_create epoll_ctl arc4random getrusage timerfd_create]) +AC_SEARCH_LIBS(dlinfo, dl, AC_DEFINE(HAVE_DLINFO, 1, [Define if you have dlinfo])) AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if you have nanosleep])) AC_SEARCH_LIBS(timer_create, rt, AC_DEFINE(HAVE_TIMER_CREATE, 1, [Define if you have timer_create])) RB_CHECK_TIMER_CREATE diff --git a/librb/include/rb_tools.h b/librb/include/rb_tools.h index 9a2e29499..31edb9f12 100644 --- a/librb/include/rb_tools.h +++ b/librb/include/rb_tools.h @@ -371,5 +371,6 @@ void rb_zstring_append_from_c(rb_zstring_t *zs, const char *buf, size_t len); char *rb_zstring_to_c(rb_zstring_t *zs, char *buf, size_t len); char *rb_zstring_to_c_alloc(rb_zstring_t *zs); size_t rb_zstring_to_ptr(rb_zstring_t *zs, void **ptr); +const char *rb_path_to_self(void); #endif /* __TOOLS_H__ */ diff --git a/librb/src/export-syms.txt b/librb/src/export-syms.txt index ecf64e40c..7a1b0cc5b 100644 --- a/librb/src/export-syms.txt +++ b/librb/src/export-syms.txt @@ -188,3 +188,4 @@ rb_zstring_serialized rb_zstring_to_c rb_zstring_to_c_alloc rb_zstring_to_ptr +rb_path_to_self diff --git a/librb/src/unix.c b/librb/src/unix.c index 31ecac352..10c8051e0 100644 --- a/librb/src/unix.c +++ b/librb/src/unix.c @@ -26,19 +26,23 @@ #include #include - #ifndef _WIN32 #include +#ifdef HAVE_DLINFO +# include +# include +#endif + +#ifdef __APPLE__ +#include +#include +#endif #if defined(HAVE_SPAWN_H) && defined(HAVE_POSIX_SPAWN) #include -#ifdef __APPLE__ -#include -#endif - #ifndef __APPLE__ extern char **environ; #endif @@ -151,5 +155,36 @@ rb_getpid(void) return getpid(); } +const char * +rb_path_to_self(void) +{ + static char path_buf[4096]; +#if defined(HAVE_GETEXECNAME) + char *s = getexecname(); + if (s == NULL) + return NULL; + realpath(s, path_buf); + return path_buf; +#elif defined(HAVE_DLINFO) + struct link_map *map = NULL; + dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map); + if (map == NULL) + return NULL; + realpath(map->l_name, path_buf); +#elif defined(__linux__) + if (readlink("/proc/self/exe", path_buf, sizeof path_buf) != -1) + return path_buf; + return NULL; +#elif defined(__APPLE__) + char tmp_path[4096]; + uint32_t pathlen = 4096; + + if (_NSGetExecutablePath(tmp_path, &pathlen) < 0) + return NULL; + + realpath(tmp_path, path_buf); + return path_buf; +#endif +} #endif /* !WIN32 */ diff --git a/librb/src/win32.c b/librb/src/win32.c index b1011a50d..bf0635fd7 100644 --- a/librb/src/win32.c +++ b/librb/src/win32.c @@ -614,6 +614,15 @@ rb_strerror(int error) rb_strlcpy(buf, _rb_strerror(error), sizeof(buf)); return buf; } + +const char * +rb_path_to_self(void) +{ + static char path_buf[MAX_PATH]; + GetModuleFileName(NULL, exepath, MAX_PATH); + return path_buf; +} + #else /* win32 not supported */ int rb_init_netio_win32(void) From 4d383612d494fb0947a4ce0d41dded2666502fcd Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 21 Mar 2016 21:14:11 -0500 Subject: [PATCH 139/252] ircd: log runtime path (mainly as proof of concept for rb_path_to_self()) --- ircd/ircd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index 4634f141d..6d88a2cc3 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -168,7 +168,7 @@ print_startup(int pid) if (fd != 1) abort(); #endif - + inotice("runtime path: %s", rb_path_to_self()); inotice("now running in %s mode from %s as pid %d ...", !server_state_foreground ? "background" : "foreground", ConfigFileEntry.dpath, pid); From b7c7f290c75087177979a52f432468daf1c825c5 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 21 Mar 2016 21:20:50 -0500 Subject: [PATCH 140/252] librb: provide rb_path_to_self() on windows --- librb/src/win32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librb/src/win32.c b/librb/src/win32.c index bf0635fd7..d9184d973 100644 --- a/librb/src/win32.c +++ b/librb/src/win32.c @@ -619,7 +619,7 @@ const char * rb_path_to_self(void) { static char path_buf[MAX_PATH]; - GetModuleFileName(NULL, exepath, MAX_PATH); + GetModuleFileName(NULL, path_buf, MAX_PATH); return path_buf; } From 87b20cbb75c8994453ad921692a1e7afffd637ad Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 21 Mar 2016 21:26:28 -0500 Subject: [PATCH 141/252] librb: use readlink(2) on linux for the direct path instead of dlinfo --- librb/src/unix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/librb/src/unix.c b/librb/src/unix.c index 10c8051e0..d1ae702e3 100644 --- a/librb/src/unix.c +++ b/librb/src/unix.c @@ -165,16 +165,16 @@ rb_path_to_self(void) return NULL; realpath(s, path_buf); return path_buf; +#elif defined(__linux__) + if (readlink("/proc/self/exe", path_buf, sizeof path_buf) != -1) + return path_buf; + return NULL; #elif defined(HAVE_DLINFO) struct link_map *map = NULL; dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map); if (map == NULL) return NULL; realpath(map->l_name, path_buf); -#elif defined(__linux__) - if (readlink("/proc/self/exe", path_buf, sizeof path_buf) != -1) - return path_buf; - return NULL; #elif defined(__APPLE__) char tmp_path[4096]; uint32_t pathlen = 4096; From e23126c83b87bd59ab4a9f89bdd0d1aa76e96129 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Mon, 21 Mar 2016 21:52:40 -0400 Subject: [PATCH 142/252] Cleanup warnings --- authd/authd.c | 6 +-- authd/dns.c | 5 +-- authd/res.c | 64 -------------------------- extensions/m_sendbans.c | 2 +- ircd/dns.c | 2 +- ircd/modules.c | 1 - ircd/msgbuf.c | 2 - ircd/parse.c | 5 +-- ircd/s_newconf.c | 1 - librb/src/commio.c | 3 +- librb/src/tools.c | 8 ++-- modules/m_cap.c | 2 +- modules/m_rehash.c | 1 - modules/m_restart.c | 4 -- modules/m_stats.c | 99 ++++++++++++++++++++--------------------- tools/mkpasswd.c | 19 -------- 16 files changed, 61 insertions(+), 163 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 937160f91..4e7c7eb6d 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -50,7 +50,7 @@ handle_stat(int parc, char *parv[]) /* XXX Should log this somehow */ return; - if (!(handler = authd_stat_handlers[parv[2][0]])) + if (!(handler = authd_stat_handlers[(unsigned char)parv[2][0]])) return; handler(parv[1], parv[2][0]); @@ -65,7 +65,7 @@ handle_reload(int parc, char *parv[]) /* XXX Should log this somehow */ return; - if (!(handler = authd_reload_handlers[parv[1][0]])) + if (!(handler = authd_reload_handlers[(unsigned char)parv[1][0]])) return; handler(parv[1][0]); @@ -87,7 +87,7 @@ parse_request(rb_helper *helper) if(parc < 1) continue; - handler = authd_cmd_handlers[parv[0][0]]; + handler = authd_cmd_handlers[(unsigned char)parv[0][0]]; if (handler != NULL) handler(parc, parv); } diff --git a/authd/dns.c b/authd/dns.c index 52e3191cb..24fbb2c1b 100644 --- a/authd/dns.c +++ b/authd/dns.c @@ -121,7 +121,7 @@ handle_lookup_ip_reply(void *data, struct DNSReply *reply) if(!query) /* Shouldn't happen */ exit(2); - + type = query->type; if(!reply) @@ -163,14 +163,11 @@ handle_lookup_hostname_reply(void *data, struct DNSReply *reply) { struct dns_query *query = data; char *hostname = NULL; - query_type type = QUERY_INVALID; if(!query) /* Shouldn't happen */ exit(4); - type = query->type; - if(!reply) goto end; diff --git a/authd/res.c b/authd/res.c index 12bd93494..f9db7afdc 100644 --- a/authd/res.c +++ b/authd/res.c @@ -98,7 +98,6 @@ static int check_question(struct reslist *request, HEADER * header, char *buf, c static int proc_answer(struct reslist *request, HEADER * header, char *, char *); static struct reslist *find_id(int id); static struct DNSReply *make_dnsreply(struct reslist *request); -static int generate_random_port(void); static uint16_t generate_random_id(void); #ifdef RES_MIN @@ -107,55 +106,6 @@ static uint16_t generate_random_id(void); #define RES_MIN(a, b) ((a) < (b) ? (a) : (b)) -static rb_fde_t * -random_socket(int family) -{ - rb_fde_t *F; - int nport; - int i; - rb_socklen_t len; - struct rb_sockaddr_storage sockaddr; - F = rb_socket(family, SOCK_DGRAM, 0, "UDP resolver socket"); - if(F == NULL) - return NULL; - - memset(&sockaddr, 0, sizeof(sockaddr)); - - SET_SS_FAMILY(&sockaddr, family); - -#ifdef RB_IPV6 - if(family == AF_INET6) - { - struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&sockaddr; - memcpy(&in6->sin6_addr, &ipv6_addr, sizeof(struct in6_addr)); - len = (rb_socklen_t) sizeof(struct sockaddr_in6); - } - else -#endif - { - struct sockaddr_in *in = (struct sockaddr_in *)&sockaddr; - in->sin_addr.s_addr = ipv4_addr.s_addr; - len = (rb_socklen_t) sizeof(struct sockaddr_in); - } - - for(i = 0; i < 10; i++) - { - nport = htons(generate_random_port()); - - if(family == AF_INET) - ((struct sockaddr_in *)&sockaddr)->sin_port = nport; -#ifdef RB_IPV6 - else - ((struct sockaddr_in6 *)&sockaddr)->sin6_port = nport; - -#endif - if(bind(rb_get_fd(F), (struct sockaddr *)&sockaddr, len) == 0) - return F; - } - rb_close(F); - return NULL; -} - /* * int * res_ourserver(inp) @@ -467,20 +417,6 @@ generate_random_id(void) return id; } -static int -generate_random_port(void) -{ - uint16_t port; - - while(1) - { - rb_get_random(&port, sizeof(port)); - if(port > 1024) - break; - } - return (int)port; -} - /* * gethost_byname_type - get host address from name, adding domain if needed */ diff --git a/extensions/m_sendbans.c b/extensions/m_sendbans.c index a3a1ea270..106cb6b77 100644 --- a/extensions/m_sendbans.c +++ b/extensions/m_sendbans.c @@ -91,7 +91,7 @@ mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou { struct ConfItem *aconf; rb_dlink_node *ptr; - int i, count; + int count; const char *target, *mask2; struct Client *server_p; struct rb_radixtree_iteration_state state; diff --git a/ircd/dns.c b/ircd/dns.c index a4615351b..c9d231524 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -228,7 +228,7 @@ dns_stats_results_callback(const char *callid, const char *status, int resc, con { struct dnsstatreq *req; uint32_t qid; - int st, i; + int st; long lqid = strtol(callid, NULL, 16); if(lqid > UINT32_MAX) diff --git a/ircd/modules.c b/ircd/modules.c index 82226c960..da3da9471 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -253,7 +253,6 @@ load_all_modules(int warn) while ((ldirent = readdir(system_module_dir)) != NULL) { - struct stat s; size_t len; len = strlen(ldirent->d_name); diff --git a/ircd/msgbuf.c b/ircd/msgbuf.c index 3aae2157d..4d47b1860 100644 --- a/ircd/msgbuf.c +++ b/ircd/msgbuf.c @@ -162,8 +162,6 @@ msgbuf_unparse_tags(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned in void msgbuf_unparse_prefix(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask) { - int i; - memset(buf, 0, buflen); if (msgbuf->n_tags > 0) diff --git a/ircd/parse.c b/ircd/parse.c index 9760e6e7a..fd490367b 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -45,9 +45,6 @@ struct Dictionary *cmd_dict = NULL; struct Dictionary *alias_dict = NULL; -/* parv[0] is not used, and parv[LAST] == NULL */ -static char *para[MAXPARA + 2]; - static void cancel_clients(struct Client *, struct Client *); static void remove_unknown(struct Client *, const char *, char *); @@ -82,7 +79,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend) { struct Client *from = client_p; char *end; - int i = 1, res; + int res; int numeric = 0; struct Message *mptr; struct MsgBuf msgbuf; diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index 842701f67..bae03b464 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -685,7 +685,6 @@ expire_temp_rxlines(void *unused) struct ConfItem *aconf; rb_dlink_node *ptr; rb_dlink_node *next_ptr; - int i; struct rb_radixtree_iteration_state state; RB_RADIXTREE_FOREACH(aconf, &state, resv_tree) diff --git a/librb/src/commio.c b/librb/src/commio.c index 7309b2e5b..1029d1caa 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -2223,6 +2223,7 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz if(count > 0) { + size_t ucount = (size_t)count; int len = CMSG_SPACE(sizeof(int) * count); char buf[len]; @@ -2233,7 +2234,7 @@ rb_send_fd_buf(rb_fde_t *xF, rb_fde_t **F, int count, void *data, size_t datasiz cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof(int) * count); - for(unsigned int i = 0; i < count; i++) + for(size_t i = 0; i < ucount; i++) { ((int *)CMSG_DATA(cmsg))[i] = rb_get_fd(F[i]); } diff --git a/librb/src/tools.c b/librb/src/tools.c index 0f4b68c14..03dd632e5 100644 --- a/librb/src/tools.c +++ b/librb/src/tools.c @@ -210,12 +210,10 @@ rb_strnlen(const char *s, size_t count) int rb_snprintf_append(char *str, size_t len, const char *format, ...) { - int x; - if(len == 0) return 0; - x = strlen(str); + size_t x = strlen(str); if(len < x) { @@ -225,10 +223,10 @@ rb_snprintf_append(char *str, size_t len, const char *format, ...) va_list ap; va_start(ap, format); - x = (vsnprintf(str + x, len - x, format, ap) + (int)x); + int y = (vsnprintf(str + x, len - x, format, ap) + (int)x); va_end(ap); - return (x); + return (y); } /* rb_basename diff --git a/modules/m_cap.c b/modules/m_cap.c index 2a5823540..c054aeeab 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -155,7 +155,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags) char buf[BUFSIZE] = { 0 }; char capbuf[BUFSIZE] = { 0 }; int buflen = 0; - int curlen, mlen; + int mlen; struct CapabilityEntry *entry; struct DictionaryIter iter; diff --git a/modules/m_rehash.c b/modules/m_rehash.c index f0380230a..2f0d8cf2f 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -200,7 +200,6 @@ rehash_tresvs(struct Client *source_p) struct rb_radixtree_iteration_state iter; rb_dlink_node *ptr; rb_dlink_node *next_ptr; - int i; sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s is clearing temp resvs", get_oper_name(source_p)); diff --git a/modules/m_restart.c b/modules/m_restart.c index 42041186f..cad6bd72d 100644 --- a/modules/m_restart.c +++ b/modules/m_restart.c @@ -59,10 +59,6 @@ DECLARE_MODULE_AV2(restart, NULL, NULL, restart_clist, NULL, NULL, NULL, NULL, r static void mo_restart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - char buf[BUFSIZE]; - rb_dlink_node *ptr; - struct Client *target_p; - if(!IsOperDie(source_p)) { sendto_one(source_p, form_str(ERR_NOPRIVS), diff --git a/modules/m_stats.c b/modules/m_stats.c index b64e1de5d..b963d2ba4 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -142,53 +142,53 @@ static void stats_capability(struct Client *); */ static struct stats_cmd stats_cmd_table[256] = { /* letter handler/handler_parv parv oper admin */ - ['a'] = { stats_dns_servers, false, true, true, }, - ['A'] = { stats_dns_servers, false, true, true, }, - ['b'] = { stats_delay, false, true, true, }, - ['B'] = { stats_hash, false, true, true, }, - ['c'] = { stats_connect, false, false, false, }, - ['C'] = { stats_capability, false, true, false, }, - ['d'] = { stats_tdeny, false, true, false, }, - ['D'] = { stats_deny, false, true, false, }, - ['e'] = { stats_exempt, false, true, false, }, - ['E'] = { stats_events, false, true, true, }, - ['f'] = { stats_comm, false, true, true, }, - ['F'] = { stats_comm, false, true, true, }, - ['g'] = { stats_prop_klines, false, true, false, }, - ['h'] = { stats_hubleaf, false, false, false, }, - ['H'] = { stats_hubleaf, false, false, false, }, - ['i'] = { stats_auth, false, false, false, }, - ['I'] = { stats_auth, false, false, false, }, - ['k'] = { stats_tklines, false, false, false, }, - ['K'] = { stats_klines, false, false, false, }, - ['l'] = { .handler_parv = stats_ltrace, true, false, false, }, - ['L'] = { .handler_parv = stats_ltrace, true, false, false, }, - ['m'] = { stats_messages, false, false, false, }, - ['M'] = { stats_messages, false, false, false, }, - ['n'] = { stats_dnsbl, false, false, false, }, - ['o'] = { stats_oper, false, false, false, }, - ['O'] = { stats_privset, false, true, false, }, - ['p'] = { stats_operedup, false, false, false, }, - ['P'] = { stats_ports, false, false, false, }, - ['q'] = { stats_tresv, false, true, false, }, - ['Q'] = { stats_resv, false, true, false, }, - ['r'] = { stats_usage, false, true, false, }, - ['R'] = { stats_usage, false, true, false, }, - ['s'] = { stats_ssld, false, true, true, }, - ['S'] = { stats_ssld, false, true, true, }, - ['t'] = { stats_tstats, false, true, false, }, - ['T'] = { stats_tstats, false, true, false, }, - ['u'] = { stats_uptime, false, false, false, }, - ['U'] = { stats_shared, false, true, false, }, - ['v'] = { stats_servers, false, false, false, }, - ['V'] = { stats_servers, false, false, false, }, - ['x'] = { stats_tgecos, false, true, false, }, - ['X'] = { stats_gecos, false, true, false, }, - ['y'] = { stats_class, false, false, false, }, - ['Y'] = { stats_class, false, false, false, }, - ['z'] = { stats_memory, false, true, false, }, - ['Z'] = { stats_ziplinks, false, true, false, }, - ['?'] = { stats_servlinks, false, false, false, }, + ['a'] = { { stats_dns_servers }, false, true, true, }, + ['A'] = { { stats_dns_servers }, false, true, true, }, + ['b'] = { { stats_delay }, false, true, true, }, + ['B'] = { { stats_hash }, false, true, true, }, + ['c'] = { { stats_connect }, false, false, false, }, + ['C'] = { { stats_capability }, false, true, false, }, + ['d'] = { { stats_tdeny }, false, true, false, }, + ['D'] = { { stats_deny }, false, true, false, }, + ['e'] = { { stats_exempt }, false, true, false, }, + ['E'] = { { stats_events }, false, true, true, }, + ['f'] = { { stats_comm }, false, true, true, }, + ['F'] = { { stats_comm }, false, true, true, }, + ['g'] = { { stats_prop_klines }, false, true, false, }, + ['h'] = { { stats_hubleaf }, false, false, false, }, + ['H'] = { { stats_hubleaf }, false, false, false, }, + ['i'] = { { stats_auth }, false, false, false, }, + ['I'] = { { stats_auth }, false, false, false, }, + ['k'] = { { stats_tklines }, false, false, false, }, + ['K'] = { { stats_klines }, false, false, false, }, + ['l'] = { { .handler_parv = stats_ltrace }, true, false, false, }, + ['L'] = { { .handler_parv = stats_ltrace }, true, false, false, }, + ['m'] = { { stats_messages }, false, false, false, }, + ['M'] = { { stats_messages }, false, false, false, }, + ['n'] = { { stats_dnsbl }, false, false, false, }, + ['o'] = { { stats_oper }, false, false, false, }, + ['O'] = { { stats_privset }, false, true, false, }, + ['p'] = { { stats_operedup }, false, false, false, }, + ['P'] = { { stats_ports }, false, false, false, }, + ['q'] = { { stats_tresv }, false, true, false, }, + ['Q'] = { { stats_resv }, false, true, false, }, + ['r'] = { { stats_usage }, false, true, false, }, + ['R'] = { { stats_usage }, false, true, false, }, + ['s'] = { { stats_ssld }, false, true, true, }, + ['S'] = { { stats_ssld }, false, true, true, }, + ['t'] = { { stats_tstats }, false, true, false, }, + ['T'] = { { stats_tstats }, false, true, false, }, + ['u'] = { { stats_uptime }, false, false, false, }, + ['U'] = { { stats_shared }, false, true, false, }, + ['v'] = { { stats_servers }, false, false, false, }, + ['V'] = { { stats_servers }, false, false, false, }, + ['x'] = { { stats_tgecos }, false, true, false, }, + ['X'] = { { stats_gecos }, false, true, false, }, + ['y'] = { { stats_class }, false, false, false, }, + ['Y'] = { { stats_class }, false, false, false, }, + ['z'] = { { stats_memory }, false, true, false, }, + ['Z'] = { { stats_ziplinks }, false, true, false, }, + ['?'] = { { stats_servlinks }, false, false, false, }, }; /* @@ -204,9 +204,8 @@ static void m_stats(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { static time_t last_used = 0; - int i; struct stats_cmd *cmd; - char statchar; + unsigned char statchar; int did_stats = 0; statchar = parv[1][0]; @@ -873,7 +872,6 @@ stats_tresv(struct Client *source_p) struct ConfItem *aconf; struct rb_radixtree_iteration_state state; rb_dlink_node *ptr; - int i; RB_DLINK_FOREACH(ptr, resv_conf_list.head) { @@ -900,7 +898,6 @@ stats_resv(struct Client *source_p) struct ConfItem *aconf; struct rb_radixtree_iteration_state state; rb_dlink_node *ptr; - int i; RB_DLINK_FOREACH(ptr, resv_conf_list.head) { diff --git a/tools/mkpasswd.c b/tools/mkpasswd.c index 8762255e2..689f912ef 100644 --- a/tools/mkpasswd.c +++ b/tools/mkpasswd.c @@ -38,7 +38,6 @@ static char *make_sha512_salt(int); static char *make_sha512_salt_para(char *); static char *make_bf_salt(int, int); static char *make_bf_salt_para(int, char *); -static char *int_to_base64(int); static char *generate_random_salt(char *, int); static char *generate_poor_salt(char *, int); @@ -209,24 +208,6 @@ main(int argc, char *argv[]) return 0; } -char * -int_to_base64(int value) -{ - static char buf[5]; - int i; - - for(i = 0; i < 4; i++) - { - buf[i] = saltChars[value & 63]; - value >>= 6; /* Right shifting 6 places is the same as dividing by 64 */ - } - - buf[i] = '\0'; /* not REALLY needed as it's static, and thus initialized - ** to \0. - */ - return buf; -} - char * make_md5_salt_para(char *saltpara) { From 35472d0f1f52c31213cf9f96b4d80da91d27a865 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Tue, 22 Mar 2016 16:40:19 -0400 Subject: [PATCH 143/252] automake: Fix typo in compiler flag --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5ac469565..333a793d8 100644 --- a/configure.ac +++ b/configure.ac @@ -632,7 +632,7 @@ CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual) CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings) CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration) CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes) -CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis) +CHARYBDIS_C_GCC_TRY_FLAGS([-Wparentheses], charybdis_cv_c_gcc_parentheses) CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w) CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra) CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow) From 0e72a76010abcc623e628b9932500909e27286de Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Tue, 22 Mar 2016 17:06:45 -0400 Subject: [PATCH 144/252] gitignore: Don't commit m4/argz.m4 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5f6506f20..72de63ae1 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,7 @@ ircd/version.c ircd/version.c.last /libtool Makefile.in +m4/argz.m4 m4/libtool.m4 m4/ltargz.m4 m4/ltdl.m4 From 3e875f629fd79c94d29ee441a8fdacb25f31911d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Tue, 22 Mar 2016 19:13:54 -0500 Subject: [PATCH 145/252] authd/provider: overhaul storage of various pieces of data Clients are stored in a dictionary referenced by id (to allow for UINT32_MAX auth clients, which is plenty). Each provider now has a data slot (this limits the number of providers to 32 for now, but that's plenty for now) which they can use to attach data to auth_clients. This consolidates data, aids in debugging, and makes it easier to just pass around auth_client structures. --- authd/provider.c | 48 ++++++-------- authd/provider.h | 25 ++++---- authd/providers/ident.c | 138 ++++++++++++++-------------------------- authd/providers/rdns.c | 117 +++++++++++++--------------------- 4 files changed, 121 insertions(+), 207 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index 81c8dfc06..ecbb45c5c 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -27,7 +27,8 @@ * Providers can either return failure immediately, immediate acceptance, or * do work in the background (calling set_provider to signal this). * - * A dictionary is provided in auth_client for storage of provider-specific data. + * Provider-specific data for each client can be kept in an index of the data + * struct member (using the provider's ID). * * All providers must implement at a minimum a perform_provider function. You * don't have to implement the others if you don't need them. @@ -49,11 +50,15 @@ rb_dlink_list auth_providers; /* Clients waiting */ -struct auth_client auth_clients[MAX_CLIENTS]; +struct Dictionary *auth_clients; /* Load a provider */ void load_provider(struct auth_provider *provider) { + if(rb_dlink_list_length(&auth_providers) >= MAX_PROVIDERS) + /* XXX should probably warn here */ + return; + provider->init(); rb_dlinkAdd(provider, &provider->node, &auth_providers); } @@ -67,6 +72,7 @@ void unload_provider(struct auth_provider *provider) /* Initalise all providers */ void init_providers(void) { + auth_clients = rb_dictionary_create("pending auth clients", rb_uint32cmp); load_provider(&rdns_provider); load_provider(&ident_provider); } @@ -75,17 +81,15 @@ void init_providers(void) void destroy_providers(void) { rb_dlink_node *ptr; + struct DictionaryIter iter; + struct auth_client *auth; struct auth_provider *provider; /* Cancel outstanding connections */ - for (size_t i = 0; i < MAX_CLIENTS; i++) + DICTIONARY_FOREACH(auth, &iter, auth_clients) { - if(auth_clients[i].cid) - { - /* TBD - is this the right thing? */ - reject_client(&auth_clients[i], 0, - "Authentication system is down... try reconnecting in a few seconds"); - } + /* TBD - is this the right thing? */ + reject_client(auth, 0, "Authentication system is down... try reconnecting in a few seconds"); } RB_DLINK_FOREACH(ptr, auth_providers.head) @@ -112,9 +116,8 @@ void cancel_providers(struct auth_client *auth) provider->cancel(auth); } - /* All data should be already destroyed */ - rb_dictionary_destroy(auth->data, NULL, NULL); - auth->data = NULL; + rb_dictionary_delete(auth_clients, RB_UINT_TO_POINTER(auth->cid)); + rb_free(auth); } /* Provider is done */ @@ -145,7 +148,6 @@ void provider_done(struct auth_client *auth, provider_t id) /* Reject a client */ void reject_client(struct auth_client *auth, provider_t id, const char *reason) { - uint16_t cid = auth->cid; char reject; switch(id) @@ -159,7 +161,6 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) case PROVIDER_BLACKLIST: reject = 'B'; break; - case PROVIDER_NULL: default: reject = 'N'; break; @@ -170,19 +171,17 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) unset_provider(auth, id); cancel_providers(auth); - memset(&auth_clients[cid], 0, sizeof(struct auth_client)); } /* Accept a client, cancel outstanding providers if any */ void accept_client(struct auth_client *auth, provider_t id) { - uint16_t cid = auth->cid; + uint32_t cid = auth->cid; rb_helper_write(authd_helper, "A %x %s %s", auth->cid, auth->username, auth->hostname); unset_provider(auth, id); cancel_providers(auth); - memset(&auth_clients[cid], 0, sizeof(struct auth_client)); } /* Send a notice to a client */ @@ -195,20 +194,14 @@ void notice_client(struct auth_client *auth, const char *notice) static void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port) { struct auth_provider *provider; - struct auth_client *auth; + struct auth_client *auth = rb_malloc(sizeof(struct auth_client)); long lcid = strtol(cid, NULL, 16); - char name[20]; rb_dlink_node *ptr; - if(lcid >= MAX_CLIENTS) + if(lcid >= UINT32_MAX) return; - auth = &auth_clients[lcid]; - if(auth->cid != 0) - /* Shouldn't get here */ - return; - - auth->cid = (uint16_t)lcid; + auth->cid = (uint32_t)lcid; rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip)); auth->l_port = (uint16_t)atoi(l_port); /* should be safe */ @@ -216,8 +209,7 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); auth->c_port = (uint16_t)atoi(c_port); - snprintf(name, sizeof(name), "%d provider data", auth->cid); - auth->data = rb_dictionary_create(name, rb_uint32cmp); + rb_dictionary_add(auth_clients, RB_UINT_TO_POINTER(auth->cid), auth); RB_DLINK_FOREACH(ptr, auth_providers.head) { diff --git a/authd/provider.h b/authd/provider.h index d443c0bbe..f9cb12f71 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -22,17 +22,16 @@ #define __CHARYBDIS_AUTHD_PROVIDER_H__ #include "stdinc.h" +#include "rb_dictionary.h" -/* Arbitrary limit */ -#define MAX_CLIENTS 4096 +#define MAX_PROVIDERS 32 /* This should be enough */ /* Registered providers */ typedef enum { - PROVIDER_NULL = 0x0, /* Dummy value */ - PROVIDER_RDNS = 0x1, - PROVIDER_IDENT = 0x2, - PROVIDER_BLACKLIST = 0x4, + PROVIDER_RDNS, + PROVIDER_IDENT, + PROVIDER_BLACKLIST, } provider_t; struct auth_client @@ -48,10 +47,10 @@ struct auth_client char hostname[HOSTLEN + 1]; /* Used for DNS lookup */ char username[USERLEN + 1]; /* Used for ident lookup */ - unsigned int providers; /* Providers at work, + uint32_t providers; /* Providers at work, * none left when set to 0 */ - struct Dictionary *data; /* Provider-specific data */ + void *data[MAX_PROVIDERS]; /* Provider-specific data slots */ }; typedef bool (*provider_init_t)(void); @@ -75,11 +74,11 @@ struct auth_provider }; extern rb_dlink_list auth_providers; +extern struct Dictionary *auth_clients; + extern struct auth_provider rdns_provider; extern struct auth_provider ident_provider; -extern struct auth_client auth_clients[MAX_CLIENTS]; - void load_provider(struct auth_provider *provider); void unload_provider(struct auth_provider *provider); @@ -98,19 +97,19 @@ void handle_new_connection(int parc, char *parv[]); /* Provider is operating on this auth_client (set this if you have async work to do) */ static inline void set_provider(struct auth_client *auth, provider_t provider) { - auth->providers |= provider; + auth->providers |= (1 << provider); } /* Provider is no longer operating on this auth client (you should use provider_done) */ static inline void unset_provider(struct auth_client *auth, provider_t provider) { - auth->providers &= ~provider; + auth->providers &= ~(1 << provider); } /* Check if provider is operating on this auth client */ static inline bool is_provider(struct auth_client *auth, provider_t provider) { - return auth->providers & provider; + return auth->providers & (1 << provider); } #endif /* __CHARYBDIS_AUTHD_PROVIDER_H__ */ diff --git a/authd/providers/ident.c b/authd/providers/ident.c index d633d1726..5a9376cc3 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -28,9 +28,6 @@ struct ident_query { - rb_dlink_node node; - - struct auth_client *auth; /* Our client */ time_t timeout; /* Timeout interval */ rb_fde_t *F; /* Our FD */ }; @@ -54,12 +51,10 @@ static EVH timeout_ident_queries_event; static CNCB ident_connected; static PF read_ident_reply; -static void client_fail(struct ident_query *query, ident_message message); -static void client_success(struct ident_query *query); -static void cleanup_query(struct ident_query *query); +static void client_fail(struct auth_client *auth, ident_message message); +static void client_success(struct auth_client *auth); static char * get_valid_ident(char *buf); -static rb_dlink_list queries; static struct ev_entry *timeout_ev; static int ident_timeout = 5; @@ -72,18 +67,14 @@ bool ident_init(void) void ident_destroy(void) { - rb_dlink_node *ptr, *nptr; + struct auth_client *auth; + struct DictionaryIter iter; /* Nuke all ident queries */ - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + DICTIONARY_FOREACH(auth, &iter, auth_clients) { - struct ident_query *query = ptr->data; - - notice_client(query->auth, messages[REPORT_FAIL]); - - rb_close(query->F); - rb_free(query); - rb_dlinkDelete(ptr, &queries); + if(auth->data[PROVIDER_IDENT] != NULL) + client_fail(auth, REPORT_FAIL); } } @@ -94,12 +85,12 @@ bool ident_start(struct auth_client *auth) int family; rb_fde_t *F; - query->auth = auth; + auth->data[PROVIDER_IDENT] = query; query->timeout = rb_current_time() + ident_timeout; if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL) { - client_fail(query, REPORT_FAIL); + client_fail(auth, REPORT_FAIL); return true; /* Not a fatal error */ } @@ -109,7 +100,7 @@ bool ident_start(struct auth_client *auth) if(!rb_inet_ntop_sock((struct sockaddr *)&l_addr, auth->l_ip, sizeof(l_addr)) || !rb_inet_ntop_sock((struct sockaddr *)&c_addr, auth->c_ip, sizeof(c_addr))) { - client_fail(query, REPORT_FAIL); + client_fail(auth, REPORT_FAIL); return true; } @@ -133,52 +124,32 @@ bool ident_start(struct auth_client *auth) GET_SS_LEN(&l_addr), ident_connected, query, ident_timeout); - rb_dlinkAdd(query, &query->node, &queries); - - set_provider(auth, PROVIDER_IDENT); notice_client(auth, messages[REPORT_LOOKUP]); + set_provider(auth, PROVIDER_IDENT); return true; } void ident_cancel(struct auth_client *auth) { - rb_dlink_node *ptr, *nptr; + struct ident_query *query = auth->data[PROVIDER_IDENT]; - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) - { - struct ident_query *query = ptr->data; - - if(query->auth == auth) - { - client_fail(query, REPORT_FAIL); - - rb_close(query->F); - rb_free(query); - rb_dlinkDelete(ptr, &queries); - - return; - } - } + if(query != NULL) + client_fail(auth, REPORT_FAIL); } /* Timeout outstanding queries */ static void timeout_ident_queries_event(void *notused) { - rb_dlink_node *ptr, *nptr; + struct auth_client *auth; + struct DictionaryIter iter; - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + DICTIONARY_FOREACH(auth, &iter, auth_clients) { - struct ident_query *query = ptr->data; + struct ident_query *query = auth->data[PROVIDER_IDENT]; - if(query->timeout < rb_current_time()) - { - client_fail(query, REPORT_FAIL); - - rb_close(query->F); - rb_free(query); - rb_dlinkDelete(ptr, &queries); - } + if(query != NULL && query->timeout < rb_current_time()) + client_fail(auth, REPORT_FAIL); } } @@ -195,8 +166,8 @@ static void timeout_ident_queries_event(void *notused) */ static void ident_connected(rb_fde_t *F, int error, void *data) { - struct ident_query *query = data; - struct auth_client *auth = query->auth; + struct auth_client *auth = data; + struct ident_query *query = auth->data[PROVIDER_IDENT]; char authbuf[32]; int authlen; @@ -204,8 +175,7 @@ static void ident_connected(rb_fde_t *F, int error, void *data) if(error != RB_OK) { /* We had an error during connection :( */ - client_fail(query, REPORT_FAIL); - cleanup_query(query); + client_fail(auth, REPORT_FAIL); return; } @@ -215,18 +185,18 @@ static void ident_connected(rb_fde_t *F, int error, void *data) if(rb_write(query->F, authbuf, authlen) != authlen) { - client_fail(query, REPORT_FAIL); + client_fail(auth, REPORT_FAIL); return; } - read_ident_reply(query->F, query); + read_ident_reply(query->F, auth); } static void read_ident_reply(rb_fde_t *F, void *data) { - struct ident_query *query = data; - struct auth_client *auth = query->auth; + struct auth_client *auth = data; + struct ident_query *query = auth->data[PROVIDER_IDENT]; char *s = NULL; char *t = NULL; int len; @@ -268,51 +238,35 @@ read_ident_reply(rb_fde_t *F, void *data) } if(s == NULL) - client_fail(query, REPORT_FAIL); + client_fail(auth, REPORT_FAIL); else - client_success(query); - - cleanup_query(query); + client_success(auth); } -static void client_fail(struct ident_query *query, ident_message report) +static void client_fail(struct auth_client *auth, ident_message report) { - struct auth_client *auth = query->auth; + struct ident_query *query = auth->data[PROVIDER_IDENT]; - if(auth) - { - rb_strlcpy(auth->username, "*", sizeof(auth->username)); - notice_client(auth, messages[report]); - provider_done(auth, PROVIDER_IDENT); - } + rb_strlcpy(auth->username, "*", sizeof(auth->username)); + + rb_close(query->F); + rb_free(query); + auth->data[PROVIDER_IDENT] = NULL; + + notice_client(auth, messages[report]); + provider_done(auth, PROVIDER_IDENT); } -static void client_success(struct ident_query *query) +static void client_success(struct auth_client *auth) { - struct auth_client *auth = query->auth; + struct ident_query *query = auth->data[PROVIDER_IDENT]; - if(auth) - { - notice_client(auth, messages[REPORT_FOUND]); - provider_done(auth, PROVIDER_IDENT); - } -} + rb_close(query->F); + rb_free(query); + auth->data[PROVIDER_IDENT] = NULL; -static void cleanup_query(struct ident_query *query) -{ - rb_dlink_node *ptr, *nptr; - - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) - { - struct ident_query *query_l = ptr->data; - - if(query_l == query) - { - rb_close(query->F); - rb_free(query); - rb_dlinkDelete(ptr, &queries); - } - } + notice_client(auth, messages[REPORT_FOUND]); + provider_done(auth, PROVIDER_IDENT); } /* get_valid_ident diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index 0a3c2e5e0..163be7961 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -29,7 +29,6 @@ struct user_query { rb_dlink_node node; - struct auth_client *auth; /* Our client */ struct dns_query *query; /* Pending DNS query */ time_t timeout; /* When the request times out */ }; @@ -51,14 +50,13 @@ typedef enum REPORT_TOOLONG, } dns_message; -static void client_fail(struct user_query *query, dns_message message); -static void client_success(struct user_query *query); +static void client_fail(struct auth_client *auth, dns_message message); +static void client_success(struct auth_client *auth); static void get_dns_answer(const char *res, bool status, query_type type, void *data); static struct ev_entry *timeout_ev; static EVH timeout_dns_queries_event; static int rdns_timeout = 30; -static rb_dlink_list queries; /* Stored here for easy timeout */ bool client_dns_init(void) @@ -69,14 +67,13 @@ bool client_dns_init(void) void client_dns_destroy(void) { - rb_dlink_node *ptr, *nptr; - struct user_query *query; + struct auth_client *auth; + struct DictionaryIter iter; - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + DICTIONARY_FOREACH(auth, &iter, auth_clients) { - client_fail(ptr->data, REPORT_FAIL); - rb_dlinkDelete(ptr, &queries); - rb_free(ptr); + if(auth->data[PROVIDER_RDNS] != NULL) + client_fail(auth, REPORT_FAIL); } rb_event_delete(timeout_ev); @@ -86,10 +83,11 @@ bool client_dns_start(struct auth_client *auth) { struct user_query *query = rb_malloc(sizeof(struct user_query)); - query->auth = auth; query->timeout = rb_current_time() + rdns_timeout; - query->query = lookup_hostname(auth->c_ip, get_dns_answer, query); + auth->data[PROVIDER_RDNS] = query; + + query->query = lookup_hostname(auth->c_ip, get_dns_answer, auth); notice_client(auth, messages[REPORT_LOOKUP]); set_provider(auth, PROVIDER_RDNS); @@ -98,104 +96,75 @@ bool client_dns_start(struct auth_client *auth) void client_dns_cancel(struct auth_client *auth) { - rb_dlink_node *ptr, *nptr; + struct user_query *query = auth->data[PROVIDER_RDNS]; - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) - { - struct user_query *query = ptr->data; - - if(query->auth == auth) - { - /* Victim found */ - client_fail(query, REPORT_FAIL); - rb_dlinkDelete(ptr, &queries); - rb_free(query); - return; - } - } + if(query != NULL) + client_fail(auth, REPORT_FAIL); } static void get_dns_answer(const char *res, bool status, query_type type, void *data) { - struct user_query *query = data; - struct auth_client *auth = query->auth; - bool fail = false; - dns_message response; - rb_dlink_node *ptr, *nptr; + struct auth_client *auth = data; + struct user_query *query = auth->data[PROVIDER_RDNS]; - if(res == NULL || status == false) - { - response = REPORT_FAIL; - fail = true; - goto cleanup; - } + if(query == NULL || res == NULL || status == false) + client_fail(auth, REPORT_FAIL); else if(strlen(res) > HOSTLEN) + client_fail(auth, REPORT_TOOLONG); + else { - /* Ah well. */ - response = REPORT_TOOLONG; - fail = true; - goto cleanup; - } - - rb_strlcpy(auth->hostname, res, HOSTLEN + 1); - -cleanup: - /* Clean us up off the pending queries list */ - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) - { - struct user_query *query_l = ptr->data; - - if(query == query_l) - { - /* Found */ - if(fail) - client_fail(query, response); - else - client_success(query); - - rb_dlinkDelete(ptr, &queries); - rb_free(query); - return; - } + rb_strlcpy(auth->hostname, res, HOSTLEN + 1); + client_success(auth); } } /* Timeout outstanding queries */ static void timeout_dns_queries_event(void *notused) { - rb_dlink_node *ptr, *nptr; + struct auth_client *auth; + struct DictionaryIter iter; - RB_DLINK_FOREACH_SAFE(ptr, nptr, queries.head) + DICTIONARY_FOREACH(auth, &iter, auth_clients) { - struct user_query *query = ptr->data; + struct user_query *query = auth->data[PROVIDER_RDNS]; - if(query->auth && query->timeout < rb_current_time()) + if(query != NULL && query->timeout < rb_current_time()) { - client_fail(query, REPORT_FAIL); - rb_dlinkDelete(ptr, &queries); - rb_free(query); + client_fail(auth, REPORT_FAIL); return; } } } -static void client_fail(struct user_query *query, dns_message report) +static void client_fail(struct auth_client *auth, dns_message report) { - struct auth_client *auth = query->auth; + struct user_query *query = auth->data[PROVIDER_RDNS]; + + if(query == NULL) + return; rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname)); + notice_client(auth, messages[report]); cancel_query(query->query); + + rb_free(query); + auth->data[PROVIDER_RDNS] = NULL; + provider_done(auth, PROVIDER_RDNS); } -static void client_success(struct user_query *query) +static void client_success(struct auth_client *auth) { - struct auth_client *auth = query->auth; + struct user_query *query = auth->data[PROVIDER_RDNS]; notice_client(auth, messages[REPORT_FOUND]); cancel_query(query->query); + + rb_free(query); + auth->data[PROVIDER_RDNS] = NULL; + provider_done(auth, PROVIDER_RDNS); } From 66769bc1f8d394c8af2fd6086e31d193ace71ec6 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Tue, 22 Mar 2016 22:53:56 -0400 Subject: [PATCH 146/252] More cleanup --- extensions/m_echotags.c | 8 +++----- include/channel.h | 4 ++-- include/msg.h | 2 +- ircd/msgbuf.c | 15 ++++----------- ircd/parse.c | 8 ++++---- ircd/send.c | 4 ++-- ircd/sslproc.c | 5 ++--- modules/m_map.c | 2 +- 8 files changed, 19 insertions(+), 29 deletions(-) diff --git a/extensions/m_echotags.c b/extensions/m_echotags.c index 858f7f90b..bbf78aed1 100644 --- a/extensions/m_echotags.c +++ b/extensions/m_echotags.c @@ -20,18 +20,16 @@ DECLARE_MODULE_AV2(echotags, NULL, NULL, echotags_clist, NULL, NULL, NULL, NULL, static void m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - int i; - sendto_one_notice(source_p, ":*** You sent %zu tags.", msgbuf_p->n_tags); - for (i = 0; i < msgbuf_p->n_tags; i++) + for (size_t i = 0; i < msgbuf_p->n_tags; i++) { struct MsgTag *tag = &msgbuf_p->tags[i]; if (tag->value) - sendto_one_notice(source_p, ":*** %d: %s => %s", i, tag->key, tag->value); + sendto_one_notice(source_p, ":*** %zu: %s => %s", i, tag->key, tag->value); else - sendto_one_notice(source_p, ":*** %d: %s", i, tag->key); + sendto_one_notice(source_p, ":*** %zu: %s", i, tag->key); } } diff --git a/include/channel.h b/include/channel.h index 44323b0ec..9069296e1 100644 --- a/include/channel.h +++ b/include/channel.h @@ -73,7 +73,7 @@ struct Channel unsigned int join_count; /* joins within delta */ unsigned int join_delta; /* last ts of join */ - unsigned long bants; + time_t bants; time_t channelts; char *chname; @@ -93,7 +93,7 @@ struct membership struct Client *client_p; unsigned int flags; - unsigned long bants; + time_t bants; }; #define BANLEN 195 diff --git a/include/msg.h b/include/msg.h index 34c69f82f..3709163a1 100644 --- a/include/msg.h +++ b/include/msg.h @@ -54,7 +54,7 @@ typedef void (*MessageHandler) (struct MsgBuf *, struct Client *, struct Client struct MessageEntry { MessageHandler handler; - int min_para; + size_t min_para; }; /* Message table structure */ diff --git a/ircd/msgbuf.c b/ircd/msgbuf.c index 4d47b1860..50538d270 100644 --- a/ircd/msgbuf.c +++ b/ircd/msgbuf.c @@ -35,7 +35,6 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line) char *ch; char *parv[MAXPARA]; size_t n_para; - int i; /* skip any leading spaces */ for (ch = line; *ch && *ch == ' '; ch++) @@ -108,7 +107,7 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line) return 1; msgbuf->cmd = parv[0]; - for (i = 0; i < n_para; i++) + for (size_t i = 0; i < n_para; i++) msgbuf_append_para(msgbuf, parv[i]); return 0; @@ -117,9 +116,7 @@ msgbuf_parse(struct MsgBuf *msgbuf, char *line) static int msgbuf_has_matching_tags(struct MsgBuf *msgbuf, unsigned int capmask) { - int i; - - for (i = 0; i < msgbuf->n_tags; i++) + for (size_t i = 0; i < msgbuf->n_tags; i++) { if ((msgbuf->tags[i].capmask & capmask) != 0) return 1; @@ -131,14 +128,12 @@ msgbuf_has_matching_tags(struct MsgBuf *msgbuf, unsigned int capmask) static void msgbuf_unparse_tags(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask) { - int i; - if (!msgbuf_has_matching_tags(msgbuf, capmask)) return; *buf = '@'; - for (i = 0; i < msgbuf->n_tags; i++) + for (size_t i = 0; i < msgbuf->n_tags; i++) { if ((msgbuf->tags[i].capmask & capmask) == 0) continue; @@ -185,11 +180,9 @@ msgbuf_unparse_prefix(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int msgbuf_unparse(char *buf, size_t buflen, struct MsgBuf *msgbuf, unsigned int capmask) { - int i; - msgbuf_unparse_prefix(buf, buflen, msgbuf, capmask); - for (i = msgbuf->cmd != NULL ? 0 : 1; i < msgbuf->n_para; i++) + for (size_t i = msgbuf->cmd != NULL ? 0 : 1; i < msgbuf->n_para; i++) { if (i == (msgbuf->n_para - 1)) { diff --git a/ircd/parse.c b/ircd/parse.c index fd490367b..e26afd138 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -246,13 +246,13 @@ handle_command(struct Message *mptr, struct MsgBuf *msgbuf_p, struct Client *cli sendto_realops_snomask(SNO_GENERAL, L_ALL, "Dropping server %s due to (invalid) command '%s'" - " with only %zu arguments (expecting %d).", + " with only %zu arguments (expecting %zu).", client_p->name, mptr->cmd, msgbuf_p->n_para, ehandler.min_para); ilog(L_SERVER, - "Insufficient parameters (%zu < %d) for command '%s' from %s.", + "Insufficient parameters (%zu < %zu) for command '%s' from %s.", msgbuf_p->n_para, ehandler.min_para, mptr->cmd, client_p->name); snprintf(squitreason, sizeof squitreason, - "Insufficient parameters (%zu < %d) for command '%s'", + "Insufficient parameters (%zu < %zu) for command '%s'", msgbuf_p->n_para, ehandler.min_para, mptr->cmd); exit_client(client_p, client_p, client_p, squitreason); return (-1); @@ -278,7 +278,7 @@ handle_encap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so ehandler = mptr->handlers[ENCAP_HANDLER]; handler = ehandler.handler; - if(parc < ehandler.min_para || + if((size_t)parc < ehandler.min_para || (ehandler.min_para && EmptyString(parv[ehandler.min_para - 1]))) return; diff --git a/ircd/send.c b/ircd/send.c index 6eec553a1..a733f0497 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -223,7 +223,7 @@ linebuf_put_msgvbuf(struct MsgBuf *msgbuf, buf_head_t *linebuf, unsigned int cap rb_linebuf_newbuf(linebuf); msgbuf_unparse_prefix(buf, sizeof buf, msgbuf, capmask); rb_linebuf_putprefix(linebuf, pattern, va, buf); -} +} /* linebuf_put_msgbuf * @@ -505,7 +505,7 @@ sendto_channel_flags(struct Client *one, int type, struct Client *source_p, struct membership *msptr; rb_dlink_node *ptr; rb_dlink_node *next_ptr; - unsigned int current_capmask = 0; + int current_capmask = 0; struct MsgBuf msgbuf; rb_linebuf_newbuf(&rb_linebuf_local); diff --git a/ircd/sslproc.c b/ircd/sslproc.c index b5c0ab297..6d53caf3a 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -452,7 +452,6 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf) uint32_t len; uint8_t *certfp; char *certfp_string; - int i; if(ctl_buf->buflen > 5 + RB_SSL_CERTFP_LEN) return; /* bogus message..drop it.. XXX should warn here */ @@ -465,7 +464,7 @@ ssl_process_certfp(ssl_ctl_t * ctl, ssl_ctl_buf_t * ctl_buf) return; rb_free(client_p->certfp); certfp_string = rb_malloc(len * 2 + 1); - for(i = 0; i < len; i++) + for(uint32_t i = 0; i < len; i++) snprintf(certfp_string + 2 * i, 3, "%02x", certfp[i]); client_p->certfp = certfp_string; @@ -478,7 +477,7 @@ ssl_process_cmd_recv(ssl_ctl_t * ctl) static const char *no_ssl_or_zlib = "ssld has neither SSL/TLS or zlib support killing all sslds"; rb_dlink_node *ptr, *next; ssl_ctl_buf_t *ctl_buf; - int len; + unsigned long len; if(ctl->dead) return; diff --git a/modules/m_map.c b/modules/m_map.c index 8675fed8e..6ba05e1fa 100644 --- a/modules/m_map.c +++ b/modules/m_map.c @@ -157,7 +157,7 @@ flattened_map(struct Client *client_p) rb_dlink_node *ptr; struct Client *target_p; int i, len; - int cnt = 0; + unsigned long cnt = 0; /* First display me as the root */ rb_strlcpy(buf, me.name, BUFSIZE); From 56f84dedf7532478b524aa3cdfca5175b20442fd Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 07:45:44 -0500 Subject: [PATCH 147/252] =?UTF-8?q?DICTIONARY=5FFOREACH=20=E2=86=92=20RB?= =?UTF-8?q?=5FDICTIONARY=5FFOREACH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is in librb and therefore should be prefixed. --- ircd/cache.c | 4 ++-- ircd/capability.c | 8 ++++---- librb/include/rb_dictionary.h | 2 +- modules/m_cap.c | 2 +- modules/m_stats.c | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ircd/cache.c b/ircd/cache.c index 58a9044c5..3b2671703 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -243,12 +243,12 @@ load_help(void) struct stat sb; #endif - DICTIONARY_FOREACH(cacheptr, &iter, help_dict_oper) + RB_DICTIONARY_FOREACH(cacheptr, &iter, help_dict_oper) { rb_dictionary_delete(help_dict_oper, cacheptr->name); free_cachefile(cacheptr); } - DICTIONARY_FOREACH(cacheptr, &iter, help_dict_user) + RB_DICTIONARY_FOREACH(cacheptr, &iter, help_dict_user) { rb_dictionary_delete(help_dict_user, cacheptr->name); free_cachefile(cacheptr); diff --git a/ircd/capability.c b/ircd/capability.c index 38a6c5a5f..e818d9196 100644 --- a/ircd/capability.c +++ b/ircd/capability.c @@ -175,7 +175,7 @@ capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask) *t = '\0'; - DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) { if ((1 << entry->value) & cap_mask) { @@ -199,7 +199,7 @@ capability_index_mask(struct CapabilityIndex *idx) s_assert(idx != NULL); - DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) { if (!(entry->flags & CAP_ORPHANED)) mask |= (1 << entry->value); @@ -217,7 +217,7 @@ capability_index_get_required(struct CapabilityIndex *idx) s_assert(idx != NULL); - DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) { if (!(entry->flags & CAP_ORPHANED) && (entry->flags & CAP_REQUIRED)) mask |= (1 << entry->value); @@ -241,7 +241,7 @@ capability_index_stats(void (*cb)(const char *line, void *privdata), void *privd snprintf(buf, sizeof buf, "'%s': allocated bits - %d", idx->name, (idx->highest_bit - 1)); cb(buf, privdata); - DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) + RB_DICTIONARY_FOREACH(entry, &iter, idx->cap_dict) { snprintf(buf, sizeof buf, "bit %d: '%s'", entry->value, entry->cap); cb(buf, privdata); diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index 3f8a7c221..d27db3058 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -47,7 +47,7 @@ struct DictionaryIter /* * this is a convenience macro for inlining iteration of dictionaries. */ -#define DICTIONARY_FOREACH(element, state, dict) for (rb_dictionary_foreach_start((dict), (state)); (element = rb_dictionary_foreach_cur((dict), (state))); rb_dictionary_foreach_next((dict), (state))) +#define RB_DICTIONARY_FOREACH(element, state, dict) for (rb_dictionary_foreach_start((dict), (state)); (element = rb_dictionary_foreach_cur((dict), (state))); rb_dictionary_foreach_next((dict), (state))) /* * rb_dictionary_create_named() creates a new dictionary tree which has a name. diff --git a/modules/m_cap.c b/modules/m_cap.c index c054aeeab..0ce25ac67 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -171,7 +171,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags) return; } - DICTIONARY_FOREACH(entry, &iter, cli_capindex->cap_dict) + RB_DICTIONARY_FOREACH(entry, &iter, cli_capindex->cap_dict) { size_t caplen = 0; struct ClientCapability *clicap = entry->ownerdata; diff --git a/modules/m_stats.c b/modules/m_stats.c index b963d2ba4..2602042b6 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -287,7 +287,7 @@ stats_delay(struct Client *source_p) struct nd_entry *nd; struct DictionaryIter iter; - DICTIONARY_FOREACH(nd, &iter, nd_dict) + RB_DICTIONARY_FOREACH(nd, &iter, nd_dict) { sendto_one_notice(source_p, ":Delaying: %s for %ld", nd->name, (long) nd->expire); @@ -738,7 +738,7 @@ stats_messages(struct Client *source_p) struct Message *msg; struct alias_entry *amsg; - DICTIONARY_FOREACH(msg, &iter, cmd_dict) + RB_DICTIONARY_FOREACH(msg, &iter, cmd_dict) { s_assert(msg->cmd != NULL); sendto_one_numeric(source_p, RPL_STATSCOMMANDS, @@ -747,7 +747,7 @@ stats_messages(struct Client *source_p) msg->bytes, msg->rcount); } - DICTIONARY_FOREACH(amsg, &iter, alias_dict) + RB_DICTIONARY_FOREACH(amsg, &iter, alias_dict) { s_assert(amsg->name != NULL); sendto_one_numeric(source_p, RPL_STATSCOMMANDS, From 2ac4ba969b7199fdb573db9a845921edf3ed9b9b Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:07:23 -0500 Subject: [PATCH 148/252] ircd: shut GCC the fuck up. No, it can't probably fail... that isn't what that's there for. --- ircd/ircd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index 6d88a2cc3..f4d3d5353 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -178,7 +178,13 @@ print_startup(int pid) * -- jilles */ if (!server_state_foreground) { - (void) write(0, ".", 1); + /* GCC complains on Linux if we don't check the value of write pedantically. + * Technically you're supposed to check the value, yes, but it probably can't fail. + * No, casting to void is of no use to shut the warning up. You HAVE to use the value. + * --Elizfaox + */ + if(write(0, ".", 1) < 1) + abort(); } if (dup2(1, 0) == -1) abort(); From 4177311e6edcc64a1011949fabf94a685a6d9136 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:09:58 -0500 Subject: [PATCH 149/252] Change struct Dictionary(*) to rb_dictionary(_\1). This cleans things up a slightly and puts the dictionary stuff in its own namespace. --- include/cache.h | 7 +- include/capability.h | 5 +- include/hash.h | 6 +- include/parse.h | 4 +- ircd/cache.c | 6 +- ircd/capability.c | 10 +-- ircd/client.c | 2 +- ircd/dns.c | 4 +- ircd/hash.c | 4 +- ircd/parse.c | 4 +- ircd/s_conf.c | 2 +- librb/include/rb_dictionary.h | 60 ++++++++-------- librb/src/dictionary.c | 130 +++++++++++++++++----------------- modules/m_cap.c | 2 +- modules/m_stats.c | 4 +- 15 files changed, 129 insertions(+), 121 deletions(-) diff --git a/include/cache.h b/include/cache.h index 33c75bbcc..095354d8e 100644 --- a/include/cache.h +++ b/include/cache.h @@ -1,6 +1,8 @@ #ifndef INCLUDED_CACHE_H #define INCLUDED_CACHE_H +#include "rb_dictionary.h" + #define HELP_MAX 100 #define CACHEFILELEN 30 @@ -43,8 +45,7 @@ void send_user_motd(struct Client *); void send_oper_motd(struct Client *); void cache_user_motd(void); -struct Dictionary; -extern struct Dictionary *help_dict_oper; -extern struct Dictionary *help_dict_user; +extern rb_dictionary *help_dict_oper; +extern rb_dictionary *help_dict_user; #endif diff --git a/include/capability.h b/include/capability.h index 0030b7e43..76e58c974 100644 --- a/include/capability.h +++ b/include/capability.h @@ -21,9 +21,12 @@ #ifndef __CAPABILITY_H__ #define __CAPABILITY_H__ +#include "stdinc.h" +#include "rb_dictionary.h" + struct CapabilityIndex { const char *name; - struct Dictionary *cap_dict; + rb_dictionary *cap_dict; unsigned int highest_bit; rb_dlink_node node; }; diff --git a/include/hash.h b/include/hash.h index 1a5a66ba1..18ba9f882 100644 --- a/include/hash.h +++ b/include/hash.h @@ -25,10 +25,10 @@ #ifndef INCLUDED_hash_h #define INCLUDED_hash_h -struct Dictionary; -struct rb_radixtree; +#include "rb_dictionary.h" +#include "rb_radixtree.h" -extern struct Dictionary *nd_dict; +extern rb_dictionary *nd_dict; extern struct rb_radixtree *resv_tree; extern struct rb_radixtree *channel_tree; diff --git a/include/parse.h b/include/parse.h index a61754f13..a60068dd8 100644 --- a/include/parse.h +++ b/include/parse.h @@ -39,7 +39,7 @@ extern void mod_add_cmd(struct Message *msg); extern void mod_del_cmd(struct Message *msg); extern char *reconstruct_parv(int parc, const char *parv[]); -extern struct Dictionary *alias_dict; -extern struct Dictionary *cmd_dict; +extern rb_dictionary *alias_dict; +extern rb_dictionary *cmd_dict; #endif /* INCLUDED_parse_h_h */ diff --git a/ircd/cache.c b/ircd/cache.c index 3b2671703..f596dfa54 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -47,8 +47,8 @@ struct cacheline *emptyline = NULL; rb_dlink_list links_cache_list; char user_motd_changed[MAX_DATE_STRING]; -struct Dictionary *help_dict_oper = NULL; -struct Dictionary *help_dict_user = NULL; +rb_dictionary *help_dict_oper = NULL; +rb_dictionary *help_dict_user = NULL; /* init_cache() * @@ -237,7 +237,7 @@ load_help(void) struct dirent *ldirent= NULL; char filename[PATH_MAX]; struct cachefile *cacheptr; - struct DictionaryIter iter; + rb_dictionary_iter iter; #if defined(S_ISLNK) && defined(HAVE_LSTAT) struct stat sb; diff --git a/ircd/capability.c b/ircd/capability.c index e818d9196..2eb5c60e7 100644 --- a/ircd/capability.c +++ b/ircd/capability.c @@ -129,7 +129,7 @@ capability_require(struct CapabilityIndex *idx, const char *cap) } static void -capability_destroy(struct DictionaryElement *delem, void *privdata) +capability_destroy(rb_dictionary_element *delem, void *privdata) { s_assert(delem != NULL); @@ -165,7 +165,7 @@ capability_index_destroy(struct CapabilityIndex *idx) const char * capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; static char buf[BUFSIZE]; char *t = buf; @@ -193,7 +193,7 @@ capability_index_list(struct CapabilityIndex *idx, unsigned int cap_mask) unsigned int capability_index_mask(struct CapabilityIndex *idx) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; unsigned int mask = 0; @@ -211,7 +211,7 @@ capability_index_mask(struct CapabilityIndex *idx) unsigned int capability_index_get_required(struct CapabilityIndex *idx) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; unsigned int mask = 0; @@ -235,7 +235,7 @@ capability_index_stats(void (*cb)(const char *line, void *privdata), void *privd RB_DLINK_FOREACH(node, capability_indexes.head) { struct CapabilityIndex *idx = node->data; - struct DictionaryIter iter; + rb_dictionary_iter iter; struct CapabilityEntry *entry; snprintf(buf, sizeof buf, "'%s': allocated bits - %d", idx->name, (idx->highest_bit - 1)); diff --git a/ircd/client.c b/ircd/client.c index 1c8504fe9..3ae434f5c 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -79,7 +79,7 @@ static rb_bh *away_heap = NULL; static char current_uid[IDLEN]; static int32_t current_connid = 0; -struct Dictionary *nd_dict = NULL; +rb_dictionary *nd_dict = NULL; enum { diff --git a/ircd/dns.c b/ircd/dns.c index c9d231524..ce3cd6c29 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -58,8 +58,8 @@ struct dnsstatreq }; /* These serve as a form of sparse array */ -static struct Dictionary *query_dict; -static struct Dictionary *stat_dict; +static rb_dictionary *query_dict; +static rb_dictionary *stat_dict; rb_dlink_list nameservers; diff --git a/ircd/hash.c b/ircd/hash.c index 894fe3251..fa491375a 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -40,8 +40,8 @@ #include "rb_dictionary.h" #include "rb_radixtree.h" -struct Dictionary *client_connid_tree = NULL; -struct Dictionary *client_zconnid_tree = NULL; +rb_dictionary *client_connid_tree = NULL; +rb_dictionary *client_zconnid_tree = NULL; struct rb_radixtree *client_id_tree = NULL; struct rb_radixtree *client_name_tree = NULL; diff --git a/ircd/parse.c b/ircd/parse.c index e26afd138..76a3585de 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -42,8 +42,8 @@ #include "packet.h" #include "s_assert.h" -struct Dictionary *cmd_dict = NULL; -struct Dictionary *alias_dict = NULL; +rb_dictionary *cmd_dict = NULL; +rb_dictionary *alias_dict = NULL; static void cancel_clients(struct Client *, struct Client *); static void remove_unknown(struct Client *, const char *, char *); diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 65023627d..ae7675e40 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -1417,7 +1417,7 @@ read_conf_files(bool cold) * free an alias{} entry. */ static void -free_alias_cb(struct DictionaryElement *ptr, void *unused) +free_alias_cb(rb_dictionary_element *ptr, void *unused) { struct alias_entry *aptr = ptr->data; diff --git a/librb/include/rb_dictionary.h b/librb/include/rb_dictionary.h index d27db3058..2baf027d4 100644 --- a/librb/include/rb_dictionary.h +++ b/librb/include/rb_dictionary.h @@ -27,21 +27,25 @@ #include "librb-config.h" -struct Dictionary; /* defined in src/dictionary.c */ +typedef struct rb_dictionary rb_dictionary; +typedef struct rb_dictionary_element rb_dictionary_element; +typedef struct rb_dictionary_iter rb_dictionary_iter; + +struct rb_dictionary; typedef int (*DCF)(/* const void *a, const void *b */); -struct DictionaryElement +struct rb_dictionary_element { - struct DictionaryElement *left, *right, *prev, *next; + rb_dictionary_element *left, *right, *prev, *next; void *data; const void *key; int position; }; -struct DictionaryIter +struct rb_dictionary_iter { - struct DictionaryElement *cur, *next; + rb_dictionary_element *cur, *next; }; /* @@ -53,33 +57,33 @@ struct DictionaryIter * rb_dictionary_create_named() creates a new dictionary tree which has a name. * name is the name, compare_cb is the comparator. */ -extern struct Dictionary *rb_dictionary_create(const char *name, DCF compare_cb); +extern rb_dictionary *rb_dictionary_create(const char *name, DCF compare_cb); /* * rb_dictionary_set_comparator_func() resets the comparator used for lookups and * insertions in the DTree structure. */ -extern void rb_dictionary_set_comparator_func(struct Dictionary *dict, +extern void rb_dictionary_set_comparator_func(rb_dictionary *dict, DCF compare_cb); /* * rb_dictionary_get_comparator_func() returns the comparator used for lookups and * insertions in the DTree structure. */ -extern DCF rb_dictionary_get_comparator_func(struct Dictionary *dict); +extern DCF rb_dictionary_get_comparator_func(rb_dictionary *dict); /* * rb_dictionary_get_linear_index() returns the linear index of an object in the * DTree structure. */ -extern int rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key); +extern int rb_dictionary_get_linear_index(rb_dictionary *dict, const void *key); /* * rb_dictionary_destroy() destroys all entries in a dtree, and also optionally calls * a defined callback function to destroy any data attached to it. */ -extern void rb_dictionary_destroy(struct Dictionary *dtree, - void (*destroy_cb)(struct DictionaryElement *delem, void *privdata), +extern void rb_dictionary_destroy(rb_dictionary *dtree, + void (*destroy_cb)(rb_dictionary_element *delem, void *privdata), void *privdata); /* @@ -88,8 +92,8 @@ extern void rb_dictionary_destroy(struct Dictionary *dtree, * * To shortcircuit iteration, return non-zero from the callback function. */ -extern void rb_dictionary_foreach(struct Dictionary *dtree, - int (*foreach_cb)(struct DictionaryElement *delem, void *privdata), +extern void rb_dictionary_foreach(rb_dictionary *dtree, + int (*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata); /* @@ -99,8 +103,8 @@ extern void rb_dictionary_foreach(struct Dictionary *dtree, * When the object is found, a non-NULL is returned from the callback, which results * in that object being returned to the user. */ -extern void *rb_dictionary_search(struct Dictionary *dtree, - void *(*foreach_cb)(struct DictionaryElement *delem, void *privdata), +extern void *rb_dictionary_search(rb_dictionary *dtree, + void *(*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata); /* @@ -109,48 +113,48 @@ extern void *rb_dictionary_search(struct Dictionary *dtree, * in progress at a time, it is permitted to remove the current element * of the iteration (but not any other element). */ -extern void rb_dictionary_foreach_start(struct Dictionary *dtree, - struct DictionaryIter *state); +extern void rb_dictionary_foreach_start(rb_dictionary *dtree, + rb_dictionary_iter *state); /* * rb_dictionary_foreach_cur() returns the current element of the iteration, * or NULL if there are no more elements. */ -extern void *rb_dictionary_foreach_cur(struct Dictionary *dtree, - struct DictionaryIter *state); +extern void *rb_dictionary_foreach_cur(rb_dictionary *dtree, + rb_dictionary_iter *state); /* * rb_dictionary_foreach_next() moves to the next element. */ -extern void rb_dictionary_foreach_next(struct Dictionary *dtree, - struct DictionaryIter *state); +extern void rb_dictionary_foreach_next(rb_dictionary *dtree, + rb_dictionary_iter *state); /* * rb_dictionary_add() adds a key->value entry to the dictionary tree. */ -extern struct DictionaryElement *rb_dictionary_add(struct Dictionary *dtree, const void *key, void *data); +extern rb_dictionary_element *rb_dictionary_add(rb_dictionary *dtree, const void *key, void *data); /* - * rb_dictionary_find() returns a struct DictionaryElement container from a dtree for key 'key'. + * rb_dictionary_find() returns a rb_dictionary_element container from a dtree for key 'key'. */ -extern struct DictionaryElement *rb_dictionary_find(struct Dictionary *dtree, const void *key); +extern rb_dictionary_element *rb_dictionary_find(rb_dictionary *dtree, const void *key); /* * rb_dictionary_find() returns data from a dtree for key 'key'. */ -extern void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key); +extern void *rb_dictionary_retrieve(rb_dictionary *dtree, const void *key); /* * rb_dictionary_delete() deletes a key->value entry from the dictionary tree. */ -extern void *rb_dictionary_delete(struct Dictionary *dtree, const void *key); +extern void *rb_dictionary_delete(rb_dictionary *dtree, const void *key); /* * rb_dictionary_size() returns the number of elements in a dictionary tree. */ -extern unsigned int rb_dictionary_size(struct Dictionary *dtree); +extern unsigned int rb_dictionary_size(rb_dictionary *dtree); -void rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); +void rb_dictionary_stats(rb_dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); void rb_dictionary_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata); #ifndef _WIN32 diff --git a/librb/src/dictionary.c b/librb/src/dictionary.c index 5bc285dae..eeac439f4 100644 --- a/librb/src/dictionary.c +++ b/librb/src/dictionary.c @@ -26,10 +26,10 @@ #include #include -struct Dictionary +struct rb_dictionary { DCF compare_cb; - struct DictionaryElement *root, *head, *tail; + rb_dictionary_element *root, *head, *tail; unsigned int count; char *id; unsigned int dirty:1; @@ -55,10 +55,10 @@ static rb_dlink_list dictionary_list = {NULL, NULL, 0}; * - if services runs out of memory and cannot allocate the object, * the program will abort. */ -struct Dictionary *rb_dictionary_create(const char *name, +rb_dictionary *rb_dictionary_create(const char *name, DCF compare_cb) { - struct Dictionary *dtree = (struct Dictionary *) rb_malloc(sizeof(struct Dictionary)); + rb_dictionary *dtree = (rb_dictionary *) rb_malloc(sizeof(rb_dictionary)); dtree->compare_cb = compare_cb; dtree->id = rb_strdup(name); @@ -69,7 +69,7 @@ struct Dictionary *rb_dictionary_create(const char *name, } /* - * rb_dictionary_set_comparator_func(struct Dictionary *dict, + * rb_dictionary_set_comparator_func(rb_dictionary *dict, * DCF compare_cb) * * Resets the comparator function used by the dictionary code for @@ -85,7 +85,7 @@ struct Dictionary *rb_dictionary_create(const char *name, * Side Effects: * - the dictionary comparator function is reset. */ -void rb_dictionary_set_comparator_func(struct Dictionary *dict, +void rb_dictionary_set_comparator_func(rb_dictionary *dict, DCF compare_cb) { lrb_assert(dict != NULL); @@ -95,7 +95,7 @@ void rb_dictionary_set_comparator_func(struct Dictionary *dict, } /* - * rb_dictionary_get_comparator_func(struct Dictionary *dict) + * rb_dictionary_get_comparator_func(rb_dictionary *dict) * * Returns the current comparator function used by the dictionary. * @@ -109,7 +109,7 @@ void rb_dictionary_set_comparator_func(struct Dictionary *dict, * - none */ DCF -rb_dictionary_get_comparator_func(struct Dictionary *dict) +rb_dictionary_get_comparator_func(rb_dictionary *dict) { lrb_assert(dict != NULL); @@ -117,7 +117,7 @@ rb_dictionary_get_comparator_func(struct Dictionary *dict) } /* - * rb_dictionary_get_linear_index(struct Dictionary *dict, + * rb_dictionary_get_linear_index(rb_dictionary *dict, * const void *key) * * Gets a linear index number for key. @@ -133,9 +133,9 @@ rb_dictionary_get_comparator_func(struct Dictionary *dict) * - rebuilds the linear index if the tree is marked as dirty. */ int -rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) +rb_dictionary_get_linear_index(rb_dictionary *dict, const void *key) { - struct DictionaryElement *elem; + rb_dictionary_element *elem; lrb_assert(dict != NULL); lrb_assert(key != NULL); @@ -148,7 +148,7 @@ rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) return elem->position; else { - struct DictionaryElement *delem; + rb_dictionary_element *delem; int i; for (delem = dict->head, i = 0; delem != NULL; delem = delem->next, i++) @@ -161,7 +161,7 @@ rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) } /* - * rb_dictionary_retune(struct Dictionary *dict, const void *key) + * rb_dictionary_retune(rb_dictionary *dict, const void *key) * * Retunes the tree, self-optimizing for the element which belongs to key. * @@ -175,9 +175,9 @@ rb_dictionary_get_linear_index(struct Dictionary *dict, const void *key) * - a new root node is nominated. */ static void -rb_dictionary_retune(struct Dictionary *dict, const void *key) +rb_dictionary_retune(rb_dictionary *dict, const void *key) { - struct DictionaryElement n, *tn, *left, *right, *node; + rb_dictionary_element n, *tn, *left, *right, *node; int ret; lrb_assert(dict != NULL); @@ -253,8 +253,8 @@ rb_dictionary_retune(struct Dictionary *dict, const void *key) } /* - * rb_dictionary_link(struct Dictionary *dict, - * struct DictionaryElement *delem) + * rb_dictionary_link(rb_dictionary *dict, + * rb_dictionary_element *delem) * * Links a dictionary tree element to the dictionary. * @@ -274,8 +274,8 @@ rb_dictionary_retune(struct Dictionary *dict, const void *key) * - a node is linked to the dictionary tree */ static void -rb_dictionary_link(struct Dictionary *dict, - struct DictionaryElement *delem) +rb_dictionary_link(rb_dictionary *dict, + rb_dictionary_element *delem) { lrb_assert(dict != NULL); lrb_assert(delem != NULL); @@ -340,7 +340,7 @@ rb_dictionary_link(struct Dictionary *dict, } /* - * rb_dictionary_unlink_root(struct Dictionary *dict) + * rb_dictionary_unlink_root(rb_dictionary *dict) * * Unlinks the root dictionary tree element from the dictionary. * @@ -354,9 +354,9 @@ rb_dictionary_link(struct Dictionary *dict, * - the root node is unlinked from the dictionary tree */ static void -rb_dictionary_unlink_root(struct Dictionary *dict) +rb_dictionary_unlink_root(rb_dictionary *dict) { - struct DictionaryElement *delem, *nextnode, *parentofnext; + rb_dictionary_element *delem, *nextnode, *parentofnext; dict->dirty = TRUE; @@ -409,7 +409,7 @@ rb_dictionary_unlink_root(struct Dictionary *dict) } /* - * rb_dictionary_destroy(struct Dictionary *dtree, + * rb_dictionary_destroy(rb_dictionary *dtree, * void (*destroy_cb)(dictionary_elem_t *delem, void *privdata), * void *privdata); * @@ -430,11 +430,11 @@ rb_dictionary_unlink_root(struct Dictionary *dict) * - if this is called without a callback, the objects bound to the * DTree will not be destroyed. */ -void rb_dictionary_destroy(struct Dictionary *dtree, - void (*destroy_cb)(struct DictionaryElement *delem, void *privdata), +void rb_dictionary_destroy(rb_dictionary *dtree, + void (*destroy_cb)(rb_dictionary_element *delem, void *privdata), void *privdata) { - struct DictionaryElement *n, *tn; + rb_dictionary_element *n, *tn; lrb_assert(dtree != NULL); @@ -452,7 +452,7 @@ void rb_dictionary_destroy(struct Dictionary *dtree, } /* - * rb_dictionary_foreach(struct Dictionary *dtree, + * rb_dictionary_foreach(rb_dictionary *dtree, * void (*destroy_cb)(dictionary_elem_t *delem, void *privdata), * void *privdata); * @@ -469,18 +469,18 @@ void rb_dictionary_destroy(struct Dictionary *dtree, * Side Effects: * - on success, a dtree is iterated */ -void rb_dictionary_foreach(struct Dictionary *dtree, - int (*foreach_cb)(struct DictionaryElement *delem, void *privdata), +void rb_dictionary_foreach(rb_dictionary *dtree, + int (*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata) { - struct DictionaryElement *n, *tn; + rb_dictionary_element *n, *tn; lrb_assert(dtree != NULL); RB_DLINK_FOREACH_SAFE(n, tn, dtree->head) { /* delem_t is a subclass of node_t. */ - struct DictionaryElement *delem = (struct DictionaryElement *) n; + rb_dictionary_element *delem = (rb_dictionary_element *) n; if (foreach_cb != NULL) (*foreach_cb)(delem, privdata); @@ -488,8 +488,8 @@ void rb_dictionary_foreach(struct Dictionary *dtree, } /* - * rb_dictionary_search(struct Dictionary *dtree, - * void (*destroy_cb)(struct DictionaryElement *delem, void *privdata), + * rb_dictionary_search(rb_dictionary *dtree, + * void (*destroy_cb)(rb_dictionary_element *delem, void *privdata), * void *privdata); * * Searches all entries in a DTree using a custom callback. @@ -506,11 +506,11 @@ void rb_dictionary_foreach(struct Dictionary *dtree, * Side Effects: * - a dtree is iterated until the requested conditions are met */ -void *rb_dictionary_search(struct Dictionary *dtree, - void *(*foreach_cb)(struct DictionaryElement *delem, void *privdata), +void *rb_dictionary_search(rb_dictionary *dtree, + void *(*foreach_cb)(rb_dictionary_element *delem, void *privdata), void *privdata) { - struct DictionaryElement *n, *tn; + rb_dictionary_element *n, *tn; void *ret = NULL; lrb_assert(dtree != NULL); @@ -518,7 +518,7 @@ void *rb_dictionary_search(struct Dictionary *dtree, RB_DLINK_FOREACH_SAFE(n, tn, dtree->head) { /* delem_t is a subclass of node_t. */ - struct DictionaryElement *delem = (struct DictionaryElement *) n; + rb_dictionary_element *delem = (rb_dictionary_element *) n; if (foreach_cb != NULL) ret = (*foreach_cb)(delem, privdata); @@ -531,8 +531,8 @@ void *rb_dictionary_search(struct Dictionary *dtree, } /* - * rb_dictionary_foreach_start(struct Dictionary *dtree, - * struct DictionaryIter *state); + * rb_dictionary_foreach_start(rb_dictionary *dtree, + * rb_dictionary_iter *state); * * Initializes a static DTree iterator. * @@ -546,8 +546,8 @@ void *rb_dictionary_search(struct Dictionary *dtree, * Side Effects: * - the static iterator, &state, is initialized. */ -void rb_dictionary_foreach_start(struct Dictionary *dtree, - struct DictionaryIter *state) +void rb_dictionary_foreach_start(rb_dictionary *dtree, + rb_dictionary_iter *state) { lrb_assert(dtree != NULL); lrb_assert(state != NULL); @@ -568,8 +568,8 @@ void rb_dictionary_foreach_start(struct Dictionary *dtree, } /* - * rb_dictionary_foreach_cur(struct Dictionary *dtree, - * struct DictionaryIter *state); + * rb_dictionary_foreach_cur(rb_dictionary *dtree, + * rb_dictionary_iter *state); * * Returns the data from the current node being iterated by the * static iterator. @@ -584,8 +584,8 @@ void rb_dictionary_foreach_start(struct Dictionary *dtree, * Side Effects: * - none */ -void *rb_dictionary_foreach_cur(struct Dictionary *dtree, - struct DictionaryIter *state) +void *rb_dictionary_foreach_cur(rb_dictionary *dtree, + rb_dictionary_iter *state) { lrb_assert(dtree != NULL); lrb_assert(state != NULL); @@ -594,8 +594,8 @@ void *rb_dictionary_foreach_cur(struct Dictionary *dtree, } /* - * rb_dictionary_foreach_next(struct Dictionary *dtree, - * struct DictionaryIter *state); + * rb_dictionary_foreach_next(rb_dictionary *dtree, + * rb_dictionary_iter *state); * * Advances a static DTree iterator. * @@ -609,8 +609,8 @@ void *rb_dictionary_foreach_cur(struct Dictionary *dtree, * Side Effects: * - the static iterator, &state, is advanced to a new DTree node. */ -void rb_dictionary_foreach_next(struct Dictionary *dtree, - struct DictionaryIter *state) +void rb_dictionary_foreach_next(rb_dictionary *dtree, + rb_dictionary_iter *state) { lrb_assert(dtree != NULL); lrb_assert(state != NULL); @@ -630,7 +630,7 @@ void rb_dictionary_foreach_next(struct Dictionary *dtree, } /* - * rb_dictionary_find(struct Dictionary *dtree, const void *key) + * rb_dictionary_find(rb_dictionary *dtree, const void *key) * * Looks up a DTree node by name. * @@ -645,7 +645,7 @@ void rb_dictionary_foreach_next(struct Dictionary *dtree, * Side Effects: * - none */ -struct DictionaryElement *rb_dictionary_find(struct Dictionary *dict, const void *key) +rb_dictionary_element *rb_dictionary_find(rb_dictionary *dict, const void *key) { lrb_assert(dict != NULL); lrb_assert(key != NULL); @@ -660,7 +660,7 @@ struct DictionaryElement *rb_dictionary_find(struct Dictionary *dict, const void } /* - * rb_dictionary_add(struct Dictionary *dtree, const void *key, void *data) + * rb_dictionary_add(rb_dictionary *dtree, const void *key, void *data) * * Creates a new DTree node and binds data to it. * @@ -676,9 +676,9 @@ struct DictionaryElement *rb_dictionary_find(struct Dictionary *dict, const void * Side Effects: * - data is inserted into the DTree. */ -struct DictionaryElement *rb_dictionary_add(struct Dictionary *dict, const void *key, void *data) +rb_dictionary_element *rb_dictionary_add(rb_dictionary *dict, const void *key, void *data) { - struct DictionaryElement *delem; + rb_dictionary_element *delem; lrb_assert(dict != NULL); lrb_assert(key != NULL); @@ -695,7 +695,7 @@ struct DictionaryElement *rb_dictionary_add(struct Dictionary *dict, const void } /* - * rb_dictionary_delete(struct Dictionary *dtree, const void *key) + * rb_dictionary_delete(rb_dictionary *dtree, const void *key) * * Deletes data from a dictionary tree. * @@ -713,9 +713,9 @@ struct DictionaryElement *rb_dictionary_add(struct Dictionary *dict, const void * Notes: * - the returned data needs to be mowgli_freed/released manually! */ -void *rb_dictionary_delete(struct Dictionary *dtree, const void *key) +void *rb_dictionary_delete(rb_dictionary *dtree, const void *key) { - struct DictionaryElement *delem = rb_dictionary_find(dtree, key); + rb_dictionary_element *delem = rb_dictionary_find(dtree, key); void *data; if (delem == NULL) @@ -730,7 +730,7 @@ void *rb_dictionary_delete(struct Dictionary *dtree, const void *key) } /* - * rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) + * rb_dictionary_retrieve(rb_dictionary *dtree, const void *key) * * Retrieves data from a dictionary. * @@ -745,9 +745,9 @@ void *rb_dictionary_delete(struct Dictionary *dtree, const void *key) * Side Effects: * - none */ -void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) +void *rb_dictionary_retrieve(rb_dictionary *dtree, const void *key) { - struct DictionaryElement *delem = rb_dictionary_find(dtree, key); + rb_dictionary_element *delem = rb_dictionary_find(dtree, key); if (delem != NULL) return delem->data; @@ -756,7 +756,7 @@ void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) } /* - * rb_dictionary_size(struct Dictionary *dict) + * rb_dictionary_size(rb_dictionary *dict) * * Returns the size of a dictionary. * @@ -769,7 +769,7 @@ void *rb_dictionary_retrieve(struct Dictionary *dtree, const void *key) * Side Effects: * - none */ -unsigned int rb_dictionary_size(struct Dictionary *dict) +unsigned int rb_dictionary_size(rb_dictionary *dict) { lrb_assert(dict != NULL); @@ -778,7 +778,7 @@ unsigned int rb_dictionary_size(struct Dictionary *dict) /* returns the sum of the depths of the subtree rooted in delem at depth depth */ static int -stats_recurse(struct DictionaryElement *delem, int depth, int *pmaxdepth) +stats_recurse(rb_dictionary_element *delem, int depth, int *pmaxdepth) { int result; @@ -793,7 +793,7 @@ stats_recurse(struct DictionaryElement *delem, int depth, int *pmaxdepth) } /* - * rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) + * rb_dictionary_stats(rb_dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) * * Returns the size of a dictionary. * @@ -808,7 +808,7 @@ stats_recurse(struct DictionaryElement *delem, int depth, int *pmaxdepth) * Side Effects: * - callback called with stats text */ -void rb_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) +void rb_dictionary_stats(rb_dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata) { char str[256]; int sum, maxdepth; diff --git a/modules/m_cap.c b/modules/m_cap.c index 0ce25ac67..a1dd5b297 100644 --- a/modules/m_cap.c +++ b/modules/m_cap.c @@ -157,7 +157,7 @@ clicap_generate(struct Client *source_p, const char *subcmd, int flags) int buflen = 0; int mlen; struct CapabilityEntry *entry; - struct DictionaryIter iter; + rb_dictionary_iter iter; mlen = snprintf(buf, sizeof buf, ":%s CAP %s %s", me.name, diff --git a/modules/m_stats.c b/modules/m_stats.c index 2602042b6..2ab458609 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -285,7 +285,7 @@ static void stats_delay(struct Client *source_p) { struct nd_entry *nd; - struct DictionaryIter iter; + rb_dictionary_iter iter; RB_DICTIONARY_FOREACH(nd, &iter, nd_dict) { @@ -734,7 +734,7 @@ stats_klines(struct Client *source_p) static void stats_messages(struct Client *source_p) { - struct DictionaryIter iter; + rb_dictionary_iter iter; struct Message *msg; struct alias_entry *amsg; From 2fc6772ee1428ba75e1e1e49a1b935a20ece50d4 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:32:22 -0500 Subject: [PATCH 150/252] typedef-ify rb_radixtree for consistency. --- include/hash.h | 4 +- ircd/hash.c | 12 ++-- ircd/monitor.c | 2 +- ircd/operhash.c | 2 +- ircd/s_newconf.c | 2 +- ircd/scache.c | 8 +-- ircd/whowas.c | 2 +- librb/include/rb_radixtree.h | 44 ++++++------ librb/src/radixtree.c | 134 ++++++++++++++++++----------------- modules/m_list.c | 2 +- modules/m_rehash.c | 2 +- modules/m_stats.c | 4 +- 12 files changed, 113 insertions(+), 105 deletions(-) diff --git a/include/hash.h b/include/hash.h index 18ba9f882..4aba22ccf 100644 --- a/include/hash.h +++ b/include/hash.h @@ -29,8 +29,8 @@ #include "rb_radixtree.h" extern rb_dictionary *nd_dict; -extern struct rb_radixtree *resv_tree; -extern struct rb_radixtree *channel_tree; +extern rb_radixtree *resv_tree; +extern rb_radixtree *channel_tree; /* Magic value for FNV hash functions */ #define FNV1_32_INIT 0x811c9dc5UL diff --git a/ircd/hash.c b/ircd/hash.c index fa491375a..f444a25c9 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -42,12 +42,12 @@ rb_dictionary *client_connid_tree = NULL; rb_dictionary *client_zconnid_tree = NULL; -struct rb_radixtree *client_id_tree = NULL; -struct rb_radixtree *client_name_tree = NULL; +rb_radixtree *client_id_tree = NULL; +rb_radixtree *client_name_tree = NULL; -struct rb_radixtree *channel_tree = NULL; -struct rb_radixtree *resv_tree = NULL; -struct rb_radixtree *hostname_tree = NULL; +rb_radixtree *channel_tree = NULL; +rb_radixtree *resv_tree = NULL; +rb_radixtree *hostname_tree = NULL; /* * look in whowas.c for the missing ...[WW_MAX]; entry @@ -480,7 +480,7 @@ void clear_resv_hash(void) { struct ConfItem *aconf; - struct rb_radixtree_iteration_state iter; + rb_radixtree_iteration_state iter; RB_RADIXTREE_FOREACH(aconf, &iter, resv_tree) { diff --git a/ircd/monitor.c b/ircd/monitor.c index 2a9bd3e66..ff15bcd4d 100644 --- a/ircd/monitor.c +++ b/ircd/monitor.c @@ -37,7 +37,7 @@ #include "send.h" #include "rb_radixtree.h" -static struct rb_radixtree *monitor_tree; +static rb_radixtree *monitor_tree; void init_monitor(void) diff --git a/ircd/operhash.c b/ircd/operhash.c index d627bbf1b..a8348cb20 100644 --- a/ircd/operhash.c +++ b/ircd/operhash.c @@ -37,7 +37,7 @@ #include "operhash.h" #include "rb_radixtree.h" -static struct rb_radixtree *operhash_tree = NULL; +static rb_radixtree *operhash_tree = NULL; struct operhash_entry { diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index bae03b464..fc3fe43d5 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -685,7 +685,7 @@ expire_temp_rxlines(void *unused) struct ConfItem *aconf; rb_dlink_node *ptr; rb_dlink_node *next_ptr; - struct rb_radixtree_iteration_state state; + rb_radixtree_iteration_state state; RB_RADIXTREE_FOREACH(aconf, &state, resv_tree) { diff --git a/ircd/scache.c b/ircd/scache.c index 6c57522a0..f418e36f8 100644 --- a/ircd/scache.c +++ b/ircd/scache.c @@ -62,7 +62,7 @@ struct scache_entry time_t last_split; }; -static struct rb_radixtree *scache_tree = NULL; +static rb_radixtree *scache_tree = NULL; void clear_scache_hash_table(void) @@ -134,7 +134,7 @@ void scache_send_flattened_links(struct Client *source_p) { struct scache_entry *scache_ptr; - struct rb_radixtree_iteration_state iter; + rb_radixtree_iteration_state iter; int show; RB_RADIXTREE_FOREACH(scache_ptr, &iter, scache_tree) @@ -170,7 +170,7 @@ void scache_send_missing(struct Client *source_p) { struct scache_entry *scache_ptr; - struct rb_radixtree_iteration_state iter; + rb_radixtree_iteration_state iter; RB_RADIXTREE_FOREACH(scache_ptr, &iter, scache_tree) { @@ -191,7 +191,7 @@ void count_scache(size_t * number_servers_cached, size_t * mem_servers_cached) { struct scache_entry *scache_ptr; - struct rb_radixtree_iteration_state iter; + rb_radixtree_iteration_state iter; *number_servers_cached = 0; *mem_servers_cached = 0; diff --git a/ircd/whowas.c b/ircd/whowas.c index ea9c838ba..624195352 100644 --- a/ircd/whowas.c +++ b/ircd/whowas.c @@ -46,7 +46,7 @@ struct whowas_top rb_dlink_list wwlist; }; -static struct rb_radixtree *whowas_tree = NULL; +static rb_radixtree *whowas_tree = NULL; static rb_dlink_list whowas_list = {NULL, NULL, 0}; static unsigned int whowas_list_length = NICKNAMEHISTORYLENGTH; static void whowas_trim(void *unused); diff --git a/librb/include/rb_radixtree.h b/librb/include/rb_radixtree.h index f647de178..0b5d1bcc9 100644 --- a/librb/include/rb_radixtree.h +++ b/librb/include/rb_radixtree.h @@ -39,12 +39,16 @@ struct rb_radixtree; /* defined in src/rb_radixtree.c */ struct rb_radixtree_leaf; /* defined in src/rb_radixtree.c */ +typedef struct rb_radixtree rb_radixtree; +typedef struct rb_radixtree_leaf rb_radixtree_leaf; +typedef struct rb_radixtree_iteration_state rb_radixtree_iteration_state; + /* * struct rb_radixtree_iteration_state, private. */ struct rb_radixtree_iteration_state { - struct rb_radixtree_leaf *cur, *next; + rb_radixtree_leaf *cur, *next; void *pspare[4]; int ispare[4]; }; @@ -63,7 +67,7 @@ struct rb_radixtree_iteration_state * compare_cb is the canonizing function. */ -extern struct rb_radixtree *rb_radixtree_create(const char *name, void (*canonize_cb)(char *key)); +extern rb_radixtree *rb_radixtree_create(const char *name, void (*canonize_cb)(char *key)); /* * rb_radixtree_shutdown() deallocates all heaps used in patricia trees. This is @@ -76,7 +80,7 @@ extern void rb_radixtree_shutdown(void); * rb_radixtree_destroy() destroys all entries in a dtree, and also optionally calls * a defined callback function to destroy any data attached to it. */ -extern void rb_radixtree_destroy(struct rb_radixtree *dtree, void (*destroy_cb)(const char *key, void *data, void *privdata), void *privdata); +extern void rb_radixtree_destroy(rb_radixtree *dtree, void (*destroy_cb)(const char *key, void *data, void *privdata), void *privdata); /* * rb_radixtree_foreach() iterates all entries in a dtree, and also optionally calls @@ -84,7 +88,7 @@ extern void rb_radixtree_destroy(struct rb_radixtree *dtree, void (*destroy_cb)( * * To shortcircuit iteration, return non-zero from the callback function. */ -extern void rb_radixtree_foreach(struct rb_radixtree *dtree, int (*foreach_cb)(const char *key, void *data, void *privdata), void *privdata); +extern void rb_radixtree_foreach(rb_radixtree *dtree, int (*foreach_cb)(const char *key, void *data, void *privdata), void *privdata); /* * rb_radixtree_search() iterates all entries in a dtree, and also optionally calls @@ -93,7 +97,7 @@ extern void rb_radixtree_foreach(struct rb_radixtree *dtree, int (*foreach_cb)(c * When the object is found, a non-NULL is returned from the callback, which results * in that object being returned to the user. */ -extern void *rb_radixtree_search(struct rb_radixtree *dtree, void *(*foreach_cb)(const char *key, void *data, void *privdata), void *privdata); +extern void *rb_radixtree_search(rb_radixtree *dtree, void *(*foreach_cb)(const char *key, void *data, void *privdata), void *privdata); /* * rb_radixtree_foreach_start() begins an iteration over all items @@ -101,7 +105,7 @@ extern void *rb_radixtree_search(struct rb_radixtree *dtree, void *(*foreach_cb) * in progress at a time, it is permitted to remove the current element * of the iteration (but not any other element). */ -extern void rb_radixtree_foreach_start(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state); +extern void rb_radixtree_foreach_start(rb_radixtree *dtree, rb_radixtree_iteration_state *state); /* * rb_radixtree_foreach_start_from() begins an iteration over all items, @@ -110,44 +114,44 @@ extern void rb_radixtree_foreach_start(struct rb_radixtree *dtree, struct rb_rad * of the iteration (but not any other element). * Use NULL as a key to have it start at the beginning. */ -extern void rb_radixtree_foreach_start_from(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state, const char *key); +extern void rb_radixtree_foreach_start_from(rb_radixtree *dtree, rb_radixtree_iteration_state *state, const char *key); /* * rb_radixtree_foreach_cur() returns the current element of the iteration, * or NULL if there are no more elements. */ -extern void *rb_radixtree_foreach_cur(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state); +extern void *rb_radixtree_foreach_cur(rb_radixtree *dtree, rb_radixtree_iteration_state *state); /* * rb_radixtree_foreach_next() moves to the next element. */ -extern void rb_radixtree_foreach_next(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state); +extern void rb_radixtree_foreach_next(rb_radixtree *dtree, rb_radixtree_iteration_state *state); /* * rb_radixtree_add() adds a key->value entry to the patricia tree. */ -extern int rb_radixtree_add(struct rb_radixtree *dtree, const char *key, void *data); +extern int rb_radixtree_add(rb_radixtree *dtree, const char *key, void *data); /* * rb_radixtree_find() returns data from a dtree for key 'key'. */ -extern void *rb_radixtree_retrieve(struct rb_radixtree *dtree, const char *key); +extern void *rb_radixtree_retrieve(rb_radixtree *dtree, const char *key); /* * rb_radixtree_delete() deletes a key->value entry from the patricia tree. */ -extern void *rb_radixtree_delete(struct rb_radixtree *dtree, const char *key); +extern void *rb_radixtree_delete(rb_radixtree *dtree, const char *key); /* Low-level functions */ -struct rb_radixtree_leaf *rb_radixtree_elem_add(struct rb_radixtree *dtree, const char *key, void *data); -struct rb_radixtree_leaf *rb_radixtree_elem_find(struct rb_radixtree *dtree, const char *key, int fuzzy); -void rb_radixtree_elem_delete(struct rb_radixtree *dtree, struct rb_radixtree_leaf *elem); -const char *rb_radixtree_elem_get_key(struct rb_radixtree_leaf *elem); -void rb_radixtree_elem_set_data(struct rb_radixtree_leaf *elem, void *data); -void *rb_radixtree_elem_get_data(struct rb_radixtree_leaf *elem); +rb_radixtree_leaf *rb_radixtree_elem_add(rb_radixtree *dtree, const char *key, void *data); +rb_radixtree_leaf *rb_radixtree_elem_find(rb_radixtree *dtree, const char *key, int fuzzy); +void rb_radixtree_elem_delete(rb_radixtree *dtree, rb_radixtree_leaf *elem); +const char *rb_radixtree_elem_get_key(rb_radixtree_leaf *elem); +void rb_radixtree_elem_set_data(rb_radixtree_leaf *elem, void *data); +void *rb_radixtree_elem_get_data(rb_radixtree_leaf *elem); -unsigned int rb_radixtree_size(struct rb_radixtree *dict); -void rb_radixtree_stats(struct rb_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata); +unsigned int rb_radixtree_size(rb_radixtree *dict); +void rb_radixtree_stats(rb_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata); void rb_radixtree_stats_walk(void (*cb)(const char *line, void *privdata), void *privdata); #endif diff --git a/librb/src/radixtree.c b/librb/src/radixtree.c index 70740b515..abc153fae 100644 --- a/librb/src/radixtree.c +++ b/librb/src/radixtree.c @@ -53,11 +53,15 @@ rb_dlink_list radixtree_list = {NULL, NULL, 0}; */ union rb_radixtree_elem; +typedef union rb_radixtree_elem rb_radixtree_elem; + +/* Other typedefs are in rb_radixtree.h */ +typedef struct rb_radixtree_node rb_radixtree_node; struct rb_radixtree { void (*canonize_cb)(char *key); - union rb_radixtree_elem *root; + rb_radixtree_elem *root; unsigned int count; char *id; @@ -74,8 +78,8 @@ struct rb_radixtree_node int nibnum; /* branches of the tree */ - union rb_radixtree_elem *down[POINTERS_PER_NODE]; - union rb_radixtree_elem *parent; + rb_radixtree_elem *down[POINTERS_PER_NODE]; + rb_radixtree_elem *parent; char parent_val; }; @@ -90,7 +94,7 @@ struct rb_radixtree_leaf /* key (canonized copy) */ char *key; - union rb_radixtree_elem *parent; + rb_radixtree_elem *parent; char parent_val; }; @@ -98,9 +102,9 @@ struct rb_radixtree_leaf union rb_radixtree_elem { int nibnum; - struct rb_radixtree_node node; + rb_radixtree_node node; - struct rb_radixtree_leaf leaf; + rb_radixtree_leaf leaf; }; #define IS_LEAF(elem) ((elem)->nibnum == -1) @@ -123,8 +127,8 @@ union rb_radixtree_elem * Side Effects: * - none */ -static union rb_radixtree_elem * -first_leaf(union rb_radixtree_elem *delem) +static rb_radixtree_elem * +first_leaf(rb_radixtree_elem *delem) { int val; @@ -160,10 +164,10 @@ first_leaf(union rb_radixtree_elem *delem) * - if services runs out of memory and cannot allocate the object, * the program will abort. */ -struct rb_radixtree * +rb_radixtree * rb_radixtree_create(const char *name, void (*canonize_cb)(char *key)) { - struct rb_radixtree *dtree = (struct rb_radixtree *) rb_malloc(sizeof(struct rb_radixtree)); + rb_radixtree *dtree = (rb_radixtree *) rb_malloc(sizeof(rb_radixtree)); dtree->canonize_cb = canonize_cb; dtree->id = rb_strdup(name); @@ -175,7 +179,7 @@ rb_radixtree_create(const char *name, void (*canonize_cb)(char *key)) } /* - * rb_radixtree_destroy(struct rb_radixtree *dtree, + * rb_radixtree_destroy(rb_radixtree *dtree, * void (*destroy_cb)(const char *key, void *data, void *privdata), * void *privdata); * @@ -197,10 +201,10 @@ rb_radixtree_create(const char *name, void (*canonize_cb)(char *key)) * DTree will not be destroyed. */ void -rb_radixtree_destroy(struct rb_radixtree *dtree, void (*destroy_cb)(const char *key, void *data, void *privdata), void *privdata) +rb_radixtree_destroy(rb_radixtree *dtree, void (*destroy_cb)(const char *key, void *data, void *privdata), void *privdata) { - struct rb_radixtree_iteration_state state; - union rb_radixtree_elem *delem; + rb_radixtree_iteration_state state; + rb_radixtree_elem *delem; void *entry; @@ -223,7 +227,7 @@ rb_radixtree_destroy(struct rb_radixtree *dtree, void (*destroy_cb)(const char * } /* - * rb_radixtree_foreach(struct rb_radixtree *dtree, + * rb_radixtree_foreach(rb_radixtree *dtree, * int (*foreach_cb)(const char *key, void *data, void *privdata), * void *privdata); * @@ -241,9 +245,9 @@ rb_radixtree_destroy(struct rb_radixtree *dtree, void (*destroy_cb)(const char * * - on success, a dtree is iterated */ void -rb_radixtree_foreach(struct rb_radixtree *dtree, int (*foreach_cb)(const char *key, void *data, void *privdata), void *privdata) +rb_radixtree_foreach(rb_radixtree *dtree, int (*foreach_cb)(const char *key, void *data, void *privdata), void *privdata) { - union rb_radixtree_elem *delem, *next; + rb_radixtree_elem *delem, *next; int val; @@ -299,7 +303,7 @@ rb_radixtree_foreach(struct rb_radixtree *dtree, int (*foreach_cb)(const char *k } /* - * rb_radixtree_search(struct rb_radixtree *dtree, + * rb_radixtree_search(rb_radixtree *dtree, * void *(*foreach_cb)(const char *key, void *data, void *privdata), * void *privdata); * @@ -318,9 +322,9 @@ rb_radixtree_foreach(struct rb_radixtree *dtree, int (*foreach_cb)(const char *k * - a dtree is iterated until the requested conditions are met */ void * -rb_radixtree_search(struct rb_radixtree *dtree, void *(*foreach_cb)(const char *key, void *data, void *privdata), void *privdata) +rb_radixtree_search(rb_radixtree *dtree, void *(*foreach_cb)(const char *key, void *data, void *privdata), void *privdata) { - union rb_radixtree_elem *delem, *next; + rb_radixtree_elem *delem, *next; int val; void *ret = NULL; @@ -382,8 +386,8 @@ rb_radixtree_search(struct rb_radixtree *dtree, void *(*foreach_cb)(const char * } /* - * rb_radixtree_foreach_start(struct rb_radixtree *dtree, - * struct rb_radixtree_iteration_state *state); + * rb_radixtree_foreach_start(rb_radixtree *dtree, + * rb_radixtree_iteration_state *state); * * Initializes a static DTree iterator. * @@ -398,7 +402,7 @@ rb_radixtree_search(struct rb_radixtree *dtree, void *(*foreach_cb)(const char * * - the static iterator, &state, is initialized. */ void -rb_radixtree_foreach_start(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state) +rb_radixtree_foreach_start(rb_radixtree *dtree, rb_radixtree_iteration_state *state) { if (dtree == NULL) return; @@ -421,8 +425,8 @@ rb_radixtree_foreach_start(struct rb_radixtree *dtree, struct rb_radixtree_itera } /* - * rb_radixtree_foreach_cur(struct rb_radixtree *dtree, - * struct rb_radixtree_iteration_state *state); + * rb_radixtree_foreach_cur(rb_radixtree *dtree, + * rb_radixtree_iteration_state *state); * * Returns the data from the current node being iterated by the * static iterator. @@ -438,7 +442,7 @@ rb_radixtree_foreach_start(struct rb_radixtree *dtree, struct rb_radixtree_itera * - none */ void * -rb_radixtree_foreach_cur(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state) +rb_radixtree_foreach_cur(rb_radixtree *dtree, rb_radixtree_iteration_state *state) { if (dtree == NULL) return NULL; @@ -446,12 +450,12 @@ rb_radixtree_foreach_cur(struct rb_radixtree *dtree, struct rb_radixtree_iterati lrb_assert(state != NULL); return STATE_CUR(state) != NULL ? - ((struct rb_radixtree_leaf *) STATE_CUR(state))->data : NULL; + ((rb_radixtree_leaf *) STATE_CUR(state))->data : NULL; } /* - * rb_radixtree_foreach_next(struct rb_radixtree *dtree, - * struct rb_radixtree_iteration_state *state); + * rb_radixtree_foreach_next(rb_radixtree *dtree, + * rb_radixtree_iteration_state *state); * * Advances a static DTree iterator. * @@ -466,11 +470,11 @@ rb_radixtree_foreach_cur(struct rb_radixtree *dtree, struct rb_radixtree_iterati * - the static iterator, &state, is advanced to a new DTree node. */ void -rb_radixtree_foreach_next(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state) +rb_radixtree_foreach_next(rb_radixtree *dtree, rb_radixtree_iteration_state *state) { - struct rb_radixtree_leaf *leaf; + rb_radixtree_leaf *leaf; - union rb_radixtree_elem *delem, *next; + rb_radixtree_elem *delem, *next; int val; @@ -537,7 +541,7 @@ rb_radixtree_foreach_next(struct rb_radixtree *dtree, struct rb_radixtree_iterat } /* - * rb_radixtree_elem_find(struct rb_radixtree *dtree, const char *key) + * rb_radixtree_elem_find(rb_radixtree *dtree, const char *key) * * Looks up a DTree node by name. * @@ -553,14 +557,14 @@ rb_radixtree_foreach_next(struct rb_radixtree *dtree, struct rb_radixtree_iterat * Side Effects: * - none */ -struct rb_radixtree_leaf * -rb_radixtree_elem_find(struct rb_radixtree *dict, const char *key, int fuzzy) +rb_radixtree_leaf * +rb_radixtree_elem_find(rb_radixtree *dict, const char *key, int fuzzy) { char ckey_store[256]; char *ckey_buf = NULL; const char *ckey; - union rb_radixtree_elem *delem; + rb_radixtree_elem *delem; int val, keylen; @@ -612,7 +616,7 @@ rb_radixtree_elem_find(struct rb_radixtree *dict, const char *key, int fuzzy) } /* - * rb_radixtree_foreach_start_from(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state, const char *key) + * rb_radixtree_foreach_start_from(rb_radixtree *dtree, rb_radixtree_iteration_state *state, const char *key) * * Starts iteration from a specified key, by wrapping rb_radixtree_elem_find(). * @@ -628,7 +632,7 @@ rb_radixtree_elem_find(struct rb_radixtree *dict, const char *key, int fuzzy) * - the iterator's state is initialized at a specific point */ void -rb_radixtree_foreach_start_from(struct rb_radixtree *dtree, struct rb_radixtree_iteration_state *state, const char *key) +rb_radixtree_foreach_start_from(rb_radixtree *dtree, rb_radixtree_iteration_state *state, const char *key) { lrb_assert(dtree != NULL); lrb_assert(state != NULL); @@ -647,7 +651,7 @@ rb_radixtree_foreach_start_from(struct rb_radixtree *dtree, struct rb_radixtree_ } /* - * rb_radixtree_add(struct rb_radixtree *dtree, const char *key, void *data) + * rb_radixtree_add(rb_radixtree *dtree, const char *key, void *data) * * Creates a new DTree node and binds data to it. * @@ -663,14 +667,14 @@ rb_radixtree_foreach_start_from(struct rb_radixtree *dtree, struct rb_radixtree_ * Side Effects: * - data is inserted into the DTree. */ -struct rb_radixtree_leaf * -rb_radixtree_elem_add(struct rb_radixtree *dict, const char *key, void *data) +rb_radixtree_leaf * +rb_radixtree_elem_add(rb_radixtree *dict, const char *key, void *data) { char *ckey; - union rb_radixtree_elem *delem, *prev, *newnode; + rb_radixtree_elem *delem, *prev, *newnode; - union rb_radixtree_elem **place1; + rb_radixtree_elem **place1; int val, keylen; int i, j; @@ -720,7 +724,7 @@ rb_radixtree_elem_add(struct rb_radixtree *dict, const char *key, void *data) lrb_assert(prev == NULL); lrb_assert(dict->count == 0); place1 = &dict->root; - *place1 = rb_malloc(sizeof(struct rb_radixtree_leaf)); + *place1 = rb_malloc(sizeof(rb_radixtree_leaf)); lrb_assert(*place1 != NULL); (*place1)->nibnum = -1; (*place1)->leaf.data = data; @@ -745,7 +749,7 @@ rb_radixtree_elem_add(struct rb_radixtree *dict, const char *key, void *data) if ((prev == NULL) || (prev->nibnum < i)) { /* Insert new node below prev */ - newnode = rb_malloc(sizeof(struct rb_radixtree_node)); + newnode = rb_malloc(sizeof(rb_radixtree_node)); lrb_assert(newnode != NULL); newnode->nibnum = i; newnode->node.parent = prev; @@ -800,7 +804,7 @@ rb_radixtree_elem_add(struct rb_radixtree *dict, const char *key, void *data) val = NIBBLE_VAL(ckey, i); place1 = &newnode->node.down[val]; lrb_assert(*place1 == NULL); - *place1 = rb_malloc(sizeof(struct rb_radixtree_leaf)); + *place1 = rb_malloc(sizeof(rb_radixtree_leaf)); lrb_assert(*place1 != NULL); (*place1)->nibnum = -1; (*place1)->leaf.data = data; @@ -812,13 +816,13 @@ rb_radixtree_elem_add(struct rb_radixtree *dict, const char *key, void *data) } int -rb_radixtree_add(struct rb_radixtree *dict, const char *key, void *data) +rb_radixtree_add(rb_radixtree *dict, const char *key, void *data) { return (rb_radixtree_elem_add(dict, key, data) != NULL); } /* - * rb_radixtree_delete(struct rb_radixtree *dtree, const char *key) + * rb_radixtree_delete(rb_radixtree *dtree, const char *key) * * Deletes data from a patricia tree. * @@ -837,10 +841,10 @@ rb_radixtree_add(struct rb_radixtree *dict, const char *key, void *data) * - the returned data needs to be rb_freed/released manually! */ void * -rb_radixtree_delete(struct rb_radixtree *dict, const char *key) +rb_radixtree_delete(rb_radixtree *dict, const char *key) { void *data; - struct rb_radixtree_leaf *leaf; + rb_radixtree_leaf *leaf; leaf = rb_radixtree_elem_find(dict, key, 0); @@ -853,16 +857,16 @@ rb_radixtree_delete(struct rb_radixtree *dict, const char *key) } void -rb_radixtree_elem_delete(struct rb_radixtree *dict, struct rb_radixtree_leaf *leaf) +rb_radixtree_elem_delete(rb_radixtree *dict, rb_radixtree_leaf *leaf) { - union rb_radixtree_elem *delem, *prev, *next; + rb_radixtree_elem *delem, *prev, *next; int val, i, used; lrb_assert(dict != NULL); lrb_assert(leaf != NULL); - delem = (union rb_radixtree_elem *) leaf; + delem = (rb_radixtree_elem *) leaf; val = delem->leaf.parent_val; prev = delem->leaf.parent; @@ -924,7 +928,7 @@ rb_radixtree_elem_delete(struct rb_radixtree *dict, struct rb_radixtree_leaf *le } /* - * rb_radixtree_retrieve(struct rb_radixtree *dtree, const char *key) + * rb_radixtree_retrieve(rb_radixtree *dtree, const char *key) * * Retrieves data from a patricia. * @@ -940,9 +944,9 @@ rb_radixtree_elem_delete(struct rb_radixtree *dict, struct rb_radixtree_leaf *le * - none */ void * -rb_radixtree_retrieve(struct rb_radixtree *dtree, const char *key) +rb_radixtree_retrieve(rb_radixtree *dtree, const char *key) { - struct rb_radixtree_leaf *delem = rb_radixtree_elem_find(dtree, key, 0); + rb_radixtree_leaf *delem = rb_radixtree_elem_find(dtree, key, 0); if (delem != NULL) return delem->data; @@ -951,7 +955,7 @@ rb_radixtree_retrieve(struct rb_radixtree *dtree, const char *key) } const char * -rb_radixtree_elem_get_key(struct rb_radixtree_leaf *leaf) +rb_radixtree_elem_get_key(rb_radixtree_leaf *leaf) { lrb_assert(leaf != NULL); @@ -959,7 +963,7 @@ rb_radixtree_elem_get_key(struct rb_radixtree_leaf *leaf) } void -rb_radixtree_elem_set_data(struct rb_radixtree_leaf *leaf, void *data) +rb_radixtree_elem_set_data(rb_radixtree_leaf *leaf, void *data) { lrb_assert(leaf != NULL); @@ -967,7 +971,7 @@ rb_radixtree_elem_set_data(struct rb_radixtree_leaf *leaf, void *data) } void * -rb_radixtree_elem_get_data(struct rb_radixtree_leaf *leaf) +rb_radixtree_elem_get_data(rb_radixtree_leaf *leaf) { lrb_assert(leaf != NULL); @@ -975,7 +979,7 @@ rb_radixtree_elem_get_data(struct rb_radixtree_leaf *leaf) } /* - * rb_radixtree_size(struct rb_radixtree *dict) + * rb_radixtree_size(rb_radixtree *dict) * * Returns the size of a patricia. * @@ -989,7 +993,7 @@ rb_radixtree_elem_get_data(struct rb_radixtree_leaf *leaf) * - none */ unsigned int -rb_radixtree_size(struct rb_radixtree *dict) +rb_radixtree_size(rb_radixtree *dict) { lrb_assert(dict != NULL); @@ -999,11 +1003,11 @@ rb_radixtree_size(struct rb_radixtree *dict) /* returns the sum of the depths of the subtree rooted in delem at depth depth */ /* there is no need for this to be recursive, but it is easier... */ static int -stats_recurse(union rb_radixtree_elem *delem, int depth, int *pmaxdepth) +stats_recurse(rb_radixtree_elem *delem, int depth, int *pmaxdepth) { int result = 0; int val; - union rb_radixtree_elem *next; + rb_radixtree_elem *next; if (depth > *pmaxdepth) *pmaxdepth = depth; @@ -1046,7 +1050,7 @@ stats_recurse(union rb_radixtree_elem *delem, int depth, int *pmaxdepth) } /* - * rb_radixtree_stats(struct rb_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata) + * rb_radixtree_stats(rb_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata) * * Returns the size of a patricia. * @@ -1062,7 +1066,7 @@ stats_recurse(union rb_radixtree_elem *delem, int depth, int *pmaxdepth) * - callback called with stats text */ void -rb_radixtree_stats(struct rb_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata) +rb_radixtree_stats(rb_radixtree *dict, void (*cb)(const char *line, void *privdata), void *privdata) { char str[256]; int sum, maxdepth; diff --git a/modules/m_list.c b/modules/m_list.c index 500d0f875..e8947cf8e 100644 --- a/modules/m_list.c +++ b/modules/m_list.c @@ -471,7 +471,7 @@ static void safelist_one_channel(struct Client *source_p, struct Channel *chptr, static void safelist_iterate_client(struct Client *source_p) { struct Channel *chptr; - struct rb_radixtree_iteration_state iter; + rb_radixtree_iteration_state iter; RB_RADIXTREE_FOREACH_FROM(chptr, &iter, channel_tree, source_p->localClient->safelist_data->chname) { diff --git a/modules/m_rehash.c b/modules/m_rehash.c index 2f0d8cf2f..e2563750a 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -197,7 +197,7 @@ static void rehash_tresvs(struct Client *source_p) { struct ConfItem *aconf; - struct rb_radixtree_iteration_state iter; + rb_radixtree_iteration_state iter; rb_dlink_node *ptr; rb_dlink_node *next_ptr; diff --git a/modules/m_stats.c b/modules/m_stats.c index 2ab458609..4cf728909 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -870,7 +870,7 @@ static void stats_tresv(struct Client *source_p) { struct ConfItem *aconf; - struct rb_radixtree_iteration_state state; + rb_radixtree_iteration_state state; rb_dlink_node *ptr; RB_DLINK_FOREACH(ptr, resv_conf_list.head) @@ -896,7 +896,7 @@ static void stats_resv(struct Client *source_p) { struct ConfItem *aconf; - struct rb_radixtree_iteration_state state; + rb_radixtree_iteration_state state; rb_dlink_node *ptr; RB_DLINK_FOREACH(ptr, resv_conf_list.head) From 86bab0c218ba8fcfe625b5ffc012a266583e6655 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:39:19 -0500 Subject: [PATCH 151/252] Update NEWS. --- NEWS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS.md b/NEWS.md index 71e3c6636..b190f0a9c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -42,6 +42,12 @@ See LICENSE for licensing details (GPL v2). stuff has been renamed and shuffled around to be more consistent. ### code +- irc_dictionary and irc_radixtree stuff is now in librb, prefixed accordingly. + Typedefs have been added for consistency reasons. For example, now you would + write `rb_dictionary \*foo` and `RB_DICTIONARY_FOREACH`. +- C99 bools have been added. Don't use ints as simple true/false flags anymore. + Don't use `YES`/`NO` or `TRUE`/`FALSE` macros (`TRUE`/`FALSE` has been removed + and `YES`/`NO` is awaiting the same fate). Use just `true` and `false`. - libratbox has been renamed to librb, as we have diverged from upstream long ago. - Almost all 2.8-style hashtable structures have been moved to dictionaries or From dfe18bf0a88fe78a3eb8151d528aef78cc64ef0a Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:40:21 -0500 Subject: [PATCH 152/252] NEWS: fix typo [skip ci] --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index b190f0a9c..3faf8899c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -44,7 +44,7 @@ See LICENSE for licensing details (GPL v2). ### code - irc_dictionary and irc_radixtree stuff is now in librb, prefixed accordingly. Typedefs have been added for consistency reasons. For example, now you would - write `rb_dictionary \*foo` and `RB_DICTIONARY_FOREACH`. + write `rb_dictionary *foo` and `RB_DICTIONARY_FOREACH`. - C99 bools have been added. Don't use ints as simple true/false flags anymore. Don't use `YES`/`NO` or `TRUE`/`FALSE` macros (`TRUE`/`FALSE` has been removed and `YES`/`NO` is awaiting the same fate). Use just `true` and `false`. From bd43a44469cb5634ab74cf21d66f8f3c2e1f5622 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:43:28 -0500 Subject: [PATCH 153/252] Remove more YES/NO usage. --- include/s_newconf.h | 2 +- ircd/restart.c | 4 ++-- ircd/s_newconf.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/s_newconf.h b/include/s_newconf.h index 55b3ec36f..b23c6364d 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -131,7 +131,7 @@ struct oper_conf extern struct remote_conf *make_remote_conf(void); extern void free_remote_conf(struct remote_conf *); -extern int find_shared_conf(const char *username, const char *host, +extern bool find_shared_conf(const char *username, const char *host, const char *server, int flags); extern void propagate_generic(struct Client *source_p, const char *command, const char *target, int cap, const char *format, ...); diff --git a/ircd/restart.c b/ircd/restart.c index 499b291d7..1a63b5726 100644 --- a/ircd/restart.c +++ b/ircd/restart.c @@ -37,11 +37,11 @@ extern char **myargv; void restart(const char *mesg) { - static int was_here = NO; /* redundant due to restarting flag below */ + static bool was_here = false; /* redundant due to restarting flag below */ if(was_here) abort(); - was_here = YES; + was_here = true; ilog(L_MAIN, "Restarting Server because: %s", mesg); diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index fc3fe43d5..b7a9768cd 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -174,7 +174,7 @@ free_remote_conf(struct remote_conf *remote_p) rb_free(remote_p); } -int +bool find_shared_conf(const char *username, const char *host, const char *server, int flags) { @@ -190,9 +190,9 @@ find_shared_conf(const char *username, const char *host, match(shared_p->server, server)) { if(shared_p->flags & flags) - return YES; + return true; else - return NO; + return false; } } From ab31d2b07eb1349f3cba1172128c00d395f50fcc Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 08:52:32 -0500 Subject: [PATCH 154/252] Send YES/NO to Davy Jones's Locker. --- bandb/bantool.c | 58 +++++++++++++++++++++++----------------------- include/common.h | 13 ----------- include/s_conf.h | 4 ++-- ircd/ircd.c | 6 ++--- ircd/s_conf.c | 12 +++++----- ircd/s_newconf.c | 2 +- modules/m_rehash.c | 2 +- 7 files changed, 42 insertions(+), 55 deletions(-) diff --git a/bandb/bantool.c b/bandb/bantool.c index 4cd53bd73..a3af93cc8 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.c @@ -93,16 +93,16 @@ struct counter /* flags set by command line options */ struct flags { - int none; - int export; - int import; - int verify; - int vacuum; - int pretend; - int verbose; - int wipe; - int dupes_ok; -} flag = {YES, NO, NO, NO, NO, NO, NO, NO, NO}; + bool none; + bool export; + bool import; + bool verify; + bool vacuum; + bool pretend; + bool verbose; + bool wipe; + bool dupes_ok; +} flag = {true, false, false, false, false, false, false, false, false}; /* *INDENT-ON* */ static int table_has_rows(const char *table); @@ -145,32 +145,32 @@ main(int argc, char *argv[]) print_help(EXIT_SUCCESS); break; case 'i': - flag.none = NO; - flag.import = YES; + flag.none = false; + flag.import = true; break; case 'e': - flag.none = NO; - flag.export = YES; + flag.none = false; + flag.export = true; break; case 'u': - flag.none = NO; - flag.verify = YES; + flag.none = false; + flag.verify = true; break; case 's': - flag.none = NO; - flag.vacuum = YES; + flag.none = false; + flag.vacuum = true; break; case 'p': - flag.pretend = YES; + flag.pretend = true; break; case 'v': - flag.verbose = YES; + flag.verbose = true; break; case 'w': - flag.wipe = YES; + flag.wipe = true; break; case 'd': - flag.dupes_ok = YES; + flag.dupes_ok = true; break; default: /* '?' */ print_help(EXIT_FAILURE); @@ -200,7 +200,7 @@ main(int argc, char *argv[]) fprintf(stdout, "* charybdis bantool v.%s\n", BT_VERSION); - if(flag.pretend == NO) + if(flag.pretend == false) { if(rsdb_init(db_error_cb) == -1) { @@ -214,7 +214,7 @@ main(int argc, char *argv[]) if(flag.import && flag.wipe) { - flag.dupes_ok = YES; /* dont check for dupes if we are wiping the db clean */ + flag.dupes_ok = true; /* dont check for dupes if we are wiping the db clean */ for(i = 0; i < 3; i++) fprintf(stdout, "* WARNING: YOU ARE ABOUT TO WIPE YOUR DATABASE!\n"); @@ -226,7 +226,7 @@ main(int argc, char *argv[]) wipe_schema(); } } - if(flag.verbose && flag.dupes_ok == YES) + if(flag.verbose && flag.dupes_ok == true) fprintf(stdout, "* Allowing duplicate bans...\n"); /* checking for our files to import or export */ @@ -235,7 +235,7 @@ main(int argc, char *argv[]) snprintf(conf, sizeof(conf), "%s/%s.conf%s", etc, bandb_table[i], bandb_suffix[i]); - if(flag.import && flag.pretend == NO) + if(flag.import && flag.pretend == false) rsdb_transaction(RSDB_TRANS_START); if(flag.import) @@ -244,7 +244,7 @@ main(int argc, char *argv[]) if(flag.export) export_config(conf, i); - if(flag.import && flag.pretend == NO) + if(flag.import && flag.pretend == false) rsdb_transaction(RSDB_TRANS_END); } @@ -497,9 +497,9 @@ import_config(const char *conf, int id) else snprintf(newreason, sizeof(newreason), "%s", f_reason); - if(flag.pretend == NO) + if(flag.pretend == false) { - if(flag.dupes_ok == NO) + if(flag.dupes_ok == false) drop_dupes(f_mask1, f_mask2, bandb_table[id]); rsdb_exec(NULL, diff --git a/include/common.h b/include/common.h index e674e1004..7754007ef 100644 --- a/include/common.h +++ b/include/common.h @@ -31,19 +31,6 @@ #endif -/* Blah. I use these a lot. -Dianora */ -#ifdef YES -#undef YES -#endif - -#define YES 1 - -#ifdef NO -#undef NO -#endif - -#define NO 0 - /* Just blindly define our own MIN/MAX macro */ #define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b)) diff --git a/include/s_conf.h b/include/s_conf.h index 49c713f42..49a0d1e85 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -373,8 +373,8 @@ extern void add_temp_dline(struct ConfItem *); extern void report_temp_klines(struct Client *); extern void show_temp_klines(struct Client *, rb_dlink_list *); -extern int rehash(int); -extern void rehash_bans(int); +extern bool rehash(bool); +extern void rehash_bans(void); extern int conf_add_server(struct ConfItem *, int); extern void conf_add_class_to_conf(struct ConfItem *); diff --git a/ircd/ircd.c b/ircd/ircd.c index f4d3d5353..1bd94f2ea 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -290,13 +290,13 @@ check_rehash(void *unused) */ if(dorehash) { - rehash(1); + rehash(true); dorehash = false; } if(dorehashbans) { - rehash_bans(1); + rehash_bans(); dorehashbans = false; } @@ -696,7 +696,7 @@ charybdis_main(int argc, char *argv[]) init_bandb(); init_ssld(); - rehash_bans(0); + rehash_bans(); initialize_server_capabs(); /* Set up default_server_capabs */ initialize_global_set_options(); diff --git a/ircd/s_conf.c b/ircd/s_conf.c index ae7675e40..ef5966c04 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -636,10 +636,10 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf) * as a result of an operator issuing this command, else assume it has been * called as a result of the server receiving a HUP signal. */ -int -rehash(int sig) +bool +rehash(bool sig) { - if(sig != 0) + if(sig) { sendto_realops_snomask(SNO_GENERAL, L_ALL, "Got signal SIGHUP, reloading ircd conf. file"); @@ -647,7 +647,7 @@ rehash(int sig) rehash_authd(); /* don't close listeners until we know we can go ahead with the rehash */ - read_conf_files(NO); + read_conf_files(false); if(ServerInfo.description != NULL) rb_strlcpy(me.info, ServerInfo.description, sizeof(me.info)); @@ -655,11 +655,11 @@ rehash(int sig) rb_strlcpy(me.info, "unknown", sizeof(me.info)); open_logfiles(); - return (0); + return false; } void -rehash_bans(int sig) +rehash_bans(void) { bandb_rehash_bans(); } diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index b7a9768cd..4b79f291b 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -196,7 +196,7 @@ find_shared_conf(const char *username, const char *host, } } - return NO; + return false; } void diff --git a/modules/m_rehash.c b/modules/m_rehash.c index e2563750a..4fc411614 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -73,7 +73,7 @@ rehash_bans_loc(struct Client *source_p) if (!MyConnect(source_p)) remote_rehash_oper_p = source_p; - rehash_bans(0); + rehash_bans(); } static void From aba29d5a19d0b3aa8448e35c8b20472c383ef11c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:03:37 -0500 Subject: [PATCH 155/252] authd/provider: incorporate new changes --- authd/provider.c | 4 ++-- authd/providers/ident.c | 4 ++-- authd/providers/rdns.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index ecbb45c5c..8888d28a9 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -50,7 +50,7 @@ rb_dlink_list auth_providers; /* Clients waiting */ -struct Dictionary *auth_clients; +rb_dictionary *auth_clients; /* Load a provider */ void load_provider(struct auth_provider *provider) @@ -81,7 +81,7 @@ void init_providers(void) void destroy_providers(void) { rb_dlink_node *ptr; - struct DictionaryIter iter; + rb_dictionary_iter iter; struct auth_client *auth; struct auth_provider *provider; diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 5a9376cc3..22ede8c9f 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -68,7 +68,7 @@ bool ident_init(void) void ident_destroy(void) { struct auth_client *auth; - struct DictionaryIter iter; + rb_dictionary_iter iter; /* Nuke all ident queries */ DICTIONARY_FOREACH(auth, &iter, auth_clients) @@ -142,7 +142,7 @@ void ident_cancel(struct auth_client *auth) static void timeout_ident_queries_event(void *notused) { struct auth_client *auth; - struct DictionaryIter iter; + rb_dictionary_iter iter; DICTIONARY_FOREACH(auth, &iter, auth_clients) { diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index 163be7961..6d0d7dfef 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -68,7 +68,7 @@ bool client_dns_init(void) void client_dns_destroy(void) { struct auth_client *auth; - struct DictionaryIter iter; + rb_dictionary_iter iter; DICTIONARY_FOREACH(auth, &iter, auth_clients) { @@ -123,7 +123,7 @@ get_dns_answer(const char *res, bool status, query_type type, void *data) static void timeout_dns_queries_event(void *notused) { struct auth_client *auth; - struct DictionaryIter iter; + rb_dictionary_iter iter; DICTIONARY_FOREACH(auth, &iter, auth_clients) { From b0f5f4007114f080d4e33d3c0567da90e32dc4de Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:06:47 -0500 Subject: [PATCH 156/252] Update NEWS --- NEWS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3faf8899c..9666a6f2d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -46,8 +46,7 @@ See LICENSE for licensing details (GPL v2). Typedefs have been added for consistency reasons. For example, now you would write `rb_dictionary *foo` and `RB_DICTIONARY_FOREACH`. - C99 bools have been added. Don't use ints as simple true/false flags anymore. - Don't use `YES`/`NO` or `TRUE`/`FALSE` macros (`TRUE`/`FALSE` has been removed - and `YES`/`NO` is awaiting the same fate). Use just `true` and `false`. + Accordingly, the `YES`/`NO` and `TRUE`/`FALSE` macros have been removed. - libratbox has been renamed to librb, as we have diverged from upstream long ago. - Almost all 2.8-style hashtable structures have been moved to dictionaries or From fa1b3a733ad88266773fe5fe3974f5ffb89ef066 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:11:20 -0500 Subject: [PATCH 157/252] common: don't even attempt to define NULL. stddef.h includes it, ISO C mandates NULL be in it, and if any platforms don't have it, *tough shit*. --- include/common.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/common.h b/include/common.h index 7754007ef..676b6b9cf 100644 --- a/include/common.h +++ b/include/common.h @@ -25,12 +25,6 @@ #ifndef INCLUDED_common_h #define INCLUDED_common_h - -#ifndef NULL -#define NULL 0 -#endif - - /* Just blindly define our own MIN/MAX macro */ #define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b)) From affc871dcbc9918af9c996c87d2dbaf60a43dd0b Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:11:20 -0500 Subject: [PATCH 158/252] common: don't even attempt to define NULL. stddef.h includes it, ISO C mandates NULL be in it, and if any platforms don't have it, *tough shit*. --- include/common.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/include/common.h b/include/common.h index 7754007ef..676b6b9cf 100644 --- a/include/common.h +++ b/include/common.h @@ -25,12 +25,6 @@ #ifndef INCLUDED_common_h #define INCLUDED_common_h - -#ifndef NULL -#define NULL 0 -#endif - - /* Just blindly define our own MIN/MAX macro */ #define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b)) From a52c7a8e693a11cbfd02c94e2ea0676b04d09343 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:15:18 -0500 Subject: [PATCH 159/252] authd/provider: really fix things for new changes. --- authd/provider.c | 2 +- authd/provider.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index 8888d28a9..31ef78164 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -86,7 +86,7 @@ void destroy_providers(void) struct auth_provider *provider; /* Cancel outstanding connections */ - DICTIONARY_FOREACH(auth, &iter, auth_clients) + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) { /* TBD - is this the right thing? */ reject_client(auth, 0, "Authentication system is down... try reconnecting in a few seconds"); diff --git a/authd/provider.h b/authd/provider.h index f9cb12f71..a3326cc50 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -74,7 +74,7 @@ struct auth_provider }; extern rb_dlink_list auth_providers; -extern struct Dictionary *auth_clients; +extern rb_dictionary *auth_clients; extern struct auth_provider rdns_provider; extern struct auth_provider ident_provider; From 82236a2a653ea3ea242a611b94457c6beb1c85ac Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:22:55 -0500 Subject: [PATCH 160/252] IRCD_BUFSIZE is redundant with BUFSIZE, so kill it. --- include/blacklist.h | 2 +- include/common.h | 3 --- include/s_conf.h | 2 +- ircd/blacklist.c | 2 +- ircd/newconf.c | 8 ++++---- ircd/s_user.c | 2 +- ircd/send.c | 4 ++-- modules/cap_server_time.c | 2 +- 8 files changed, 11 insertions(+), 14 deletions(-) diff --git a/include/blacklist.h b/include/blacklist.h index 652f12b40..7c8fc23ee 100644 --- a/include/blacklist.h +++ b/include/blacklist.h @@ -36,7 +36,7 @@ struct Blacklist { int ipv6; /* Does this blacklist support IPv6 lookups? */ char host[IRCD_RES_HOSTLEN + 1]; rb_dlink_list filters; /* Filters for queries */ - char reject_reason[IRCD_BUFSIZE]; + char reject_reason[BUFSIZE]; unsigned int hits; time_t lastwarning; }; diff --git a/include/common.h b/include/common.h index 676b6b9cf..58b52ac45 100644 --- a/include/common.h +++ b/include/common.h @@ -30,9 +30,6 @@ #define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b)) #define IRCD_MIN(a, b) ((a) < (b) ? (a) : (b)) -/* Right out of the RFC */ -#define IRCD_BUFSIZE 512 - /* readbuf size */ #define READBUF_SIZE 16384 diff --git a/include/s_conf.h b/include/s_conf.h index 49a0d1e85..b4bd821c2 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -389,7 +389,7 @@ extern int yylex(void); extern unsigned long cidr_to_bitmask[]; -extern char conffilebuf[IRCD_BUFSIZE + 1]; +extern char conffilebuf[BUFSIZE + 1]; extern int lineno; #define NOT_AUTHORISED (-1) diff --git a/ircd/blacklist.c b/ircd/blacklist.c index ae3f10ee0..47438438f 100644 --- a/ircd/blacklist.c +++ b/ircd/blacklist.c @@ -227,7 +227,7 @@ struct Blacklist *new_blacklist(char *name, char *reject_reason, int ipv4, int i blptr->status &= ~CONF_ILLEGAL; rb_strlcpy(blptr->host, name, IRCD_RES_HOSTLEN + 1); - rb_strlcpy(blptr->reject_reason, reject_reason, IRCD_BUFSIZE); + rb_strlcpy(blptr->reject_reason, reject_reason, BUFSIZE); blptr->ipv4 = ipv4; blptr->ipv6 = ipv6; diff --git a/ircd/newconf.c b/ircd/newconf.c index 974f798b5..827f6ed90 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -2030,10 +2030,10 @@ void conf_report_error(const char *fmt, ...) { va_list ap; - char msg[IRCD_BUFSIZE + 1] = { 0 }; + char msg[BUFSIZE + 1] = { 0 }; va_start(ap, fmt); - vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); + vsnprintf(msg, BUFSIZE, fmt, ap); va_end(ap); if (testing_conf) @@ -2050,10 +2050,10 @@ void conf_report_warning(const char *fmt, ...) { va_list ap; - char msg[IRCD_BUFSIZE + 1] = { 0 }; + char msg[BUFSIZE + 1] = { 0 }; va_start(ap, fmt); - vsnprintf(msg, IRCD_BUFSIZE, fmt, ap); + vsnprintf(msg, BUFSIZE, fmt, ap); va_end(ap); if (testing_conf) diff --git a/ircd/s_user.c b/ircd/s_user.c index 46a1ee61c..1f6a4cb40 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -219,7 +219,7 @@ register_local_user(struct Client *client_p, struct Client *source_p) { struct ConfItem *aconf, *xconf; struct User *user = source_p->user; - char tmpstr2[IRCD_BUFSIZE]; + char tmpstr2[BUFSIZE]; char ipaddr[HOSTIPLEN]; char myusername[USERLEN+1]; int status; diff --git a/ircd/send.c b/ircd/send.c index a733f0497..44cb04984 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -218,7 +218,7 @@ send_queued_write(rb_fde_t *F, void *data) static void linebuf_put_msgvbuf(struct MsgBuf *msgbuf, buf_head_t *linebuf, unsigned int capmask, const char *pattern, va_list *va) { - char buf[IRCD_BUFSIZE]; + char buf[BUFSIZE]; rb_linebuf_newbuf(linebuf); msgbuf_unparse_prefix(buf, sizeof buf, msgbuf, capmask); @@ -497,7 +497,7 @@ void sendto_channel_flags(struct Client *one, int type, struct Client *source_p, struct Channel *chptr, const char *pattern, ...) { - char buf[IRCD_BUFSIZE]; + char buf[BUFSIZE]; va_list args; buf_head_t rb_linebuf_local; buf_head_t rb_linebuf_id; diff --git a/modules/cap_server_time.c b/modules/cap_server_time.c index 3119319f9..73fce0170 100644 --- a/modules/cap_server_time.c +++ b/modules/cap_server_time.c @@ -52,7 +52,7 @@ mapi_cap_list_av2 cap_server_time_cap_list[] = { static void cap_server_time_process(hook_data *data) { - static char buf[IRCD_BUFSIZE]; + static char buf[BUFSIZE]; time_t ts = rb_current_time(); struct MsgBuf *msgbuf = data->arg1; From 7ac3261f9707ef5071410636906a55a434c6cff3 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:25:56 -0500 Subject: [PATCH 161/252] Ensure the parser/lexer don't use IRCD_BUFSIZE. --- ircd/ircd_lexer.l | 6 +++--- ircd/ircd_parser.y | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index b79825870..e993c88a3 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -53,8 +53,8 @@ void cinclude(void); void hashcomment(void); int ieof(void); int lineno_stack[MAX_INCLUDE_DEPTH]; -char conffile_stack[MAX_INCLUDE_DEPTH][IRCD_BUFSIZE]; -char conffilebuf[IRCD_BUFSIZE+1]; +char conffile_stack[MAX_INCLUDE_DEPTH][BUFSIZE]; +char conffilebuf[BUFSIZE+1]; char *current_file = conffilebuf; FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH]; @@ -195,7 +195,7 @@ void cinclude(void) if (tmp_fbfile_in == NULL) { /* if its not found in PREFIX, look in ETCPATH */ - char fnamebuf[IRCD_BUFSIZE]; + char fnamebuf[BUFSIZE]; snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ETCPATH, c); tmp_fbfile_in = fopen(fnamebuf, "r"); diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index eb49d7f84..bc5e3fccf 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -161,7 +161,7 @@ static void add_cur_list(int type, char *str, int number) %union { int number; - char string[IRCD_BUFSIZE + 1]; + char string[BUFSIZE + 1]; conf_parm_t * conf_parm; } From 79435744c7b57fa830b8e4e7c7c8a9adf63f52b5 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 09:33:56 -0500 Subject: [PATCH 162/252] =?UTF-8?q?common.h:=20raison=20d'=C3=AAtre=20is?= =?UTF-8?q?=20gone,=20so=20out=20it=20goes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fold whatever was left into ircd_defs.h --- extensions/m_identify.c | 1 - extensions/m_sendbans.c | 1 - include/common.h | 36 ------------------------------------ include/ircd_defs.h | 11 +++++++++++ include/s_conf.h | 1 - ircd/cache.c | 1 - ircd/channel.c | 1 - ircd/chmode.c | 3 +-- ircd/class.c | 1 - ircd/client.c | 1 - ircd/extban.c | 1 - ircd/hash.c | 1 - ircd/ircd.c | 1 - ircd/newconf.c | 1 - ircd/packet.c | 1 - ircd/parse.c | 1 - ircd/s_auth.c | 1 - ircd/s_conf.c | 1 - ircd/s_newconf.c | 1 - ircd/s_serv.c | 1 - ircd/s_user.c | 1 - ircd/scache.c | 1 - ircd/send.c | 1 - ircd/supported.c | 1 - modules/core/m_ban.c | 1 - modules/core/m_error.c | 1 - modules/core/m_join.c | 1 - modules/core/m_message.c | 1 - modules/core/m_nick.c | 1 - modules/core/m_part.c | 1 - modules/core/m_server.c | 1 - modules/core/m_squit.c | 1 - modules/m_certfp.c | 1 - modules/m_chghost.c | 1 - modules/m_dline.c | 1 - modules/m_encap.c | 1 - modules/m_etrace.c | 1 - modules/m_info.c | 1 - modules/m_invite.c | 1 - modules/m_kline.c | 1 - modules/m_names.c | 1 - modules/m_oper.c | 1 - modules/m_operspy.c | 1 - modules/m_privs.c | 1 - modules/m_rehash.c | 1 - modules/m_restart.c | 1 - modules/m_scan.c | 1 - modules/m_services.c | 1 - modules/m_set.c | 1 - modules/m_signon.c | 1 - modules/m_snote.c | 1 - modules/m_starttls.c | 1 - modules/m_stats.c | 1 - modules/m_svinfo.c | 1 - modules/m_tb.c | 1 - modules/m_testmask.c | 1 - modules/m_tginfo.c | 1 - modules/m_trace.c | 1 - modules/m_who.c | 1 - modules/m_whois.c | 1 - modules/m_whowas.c | 1 - modules/m_xline.c | 1 - 62 files changed, 12 insertions(+), 97 deletions(-) delete mode 100644 include/common.h diff --git a/extensions/m_identify.c b/extensions/m_identify.c index 156e6a9db..aebcd3616 100644 --- a/extensions/m_identify.c +++ b/extensions/m_identify.c @@ -31,7 +31,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "ircd.h" #include "match.h" #include "numeric.h" diff --git a/extensions/m_sendbans.c b/extensions/m_sendbans.c index 106cb6b77..a6e155122 100644 --- a/extensions/m_sendbans.c +++ b/extensions/m_sendbans.c @@ -31,7 +31,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "ircd.h" #include "match.h" #include "numeric.h" diff --git a/include/common.h b/include/common.h deleted file mode 100644 index 58b52ac45..000000000 --- a/include/common.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * ircd-ratbox: A slightly useful ircd. - * common.h: An ircd header common to most code. - * - * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center - * Copyright (C) 1996-2002 Hybrid Development Team - * Copyright (C) 2002-2004 ircd-ratbox development team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef INCLUDED_common_h -#define INCLUDED_common_h - -/* Just blindly define our own MIN/MAX macro */ - -#define IRCD_MAX(a, b) ((a) > (b) ? (a) : (b)) -#define IRCD_MIN(a, b) ((a) < (b) ? (a) : (b)) - -/* readbuf size */ -#define READBUF_SIZE 16384 - -#endif /* INCLUDED_common_h */ diff --git a/include/ircd_defs.h b/include/ircd_defs.h index 64245cd7c..40db53839 100644 --- a/include/ircd_defs.h +++ b/include/ircd_defs.h @@ -56,6 +56,14 @@ #define IRC_DEPRECATED #endif +#ifndef MAX +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef MIN +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + #define HOSTLEN 63 /* Length of hostname. Updated to */ /* comply with RFC1123 */ @@ -115,4 +123,7 @@ #define PATRICIA_BITS 32 #endif +/* Read buffer size */ +#define READBUF_SIZE 16384 + #endif /* INCLUDED_ircd_defs_h */ diff --git a/include/s_conf.h b/include/s_conf.h index b4bd821c2..9a0f55328 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -33,7 +33,6 @@ #include "ircd_defs.h" #include "class.h" #include "client.h" -#include "common.h" struct Client; struct DNSReply; diff --git a/ircd/cache.c b/ircd/cache.c index f596dfa54..1a2cb14fa 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -32,7 +32,6 @@ #include "stdinc.h" #include "ircd_defs.h" -#include "common.h" #include "s_conf.h" #include "client.h" #include "hash.h" diff --git a/ircd/channel.c b/ircd/channel.c index 77bb26c43..717df263e 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -26,7 +26,6 @@ #include "channel.h" #include "chmode.h" #include "client.h" -#include "common.h" #include "hash.h" #include "hook.h" #include "match.h" diff --git a/ircd/chmode.c b/ircd/chmode.c index 5616fc7c7..6ec2f497a 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -26,7 +26,6 @@ #include "stdinc.h" #include "channel.h" #include "client.h" -#include "common.h" #include "hash.h" #include "hook.h" #include "match.h" @@ -889,7 +888,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr, * also make sure it will always fit on a line with channel * name etc. */ - if(strlen(mask) > IRCD_MIN(BANLEN, MODEBUFLEN - 5)) + if(strlen(mask) > MIN(BANLEN, MODEBUFLEN - 5)) { sendto_one_numeric(source_p, ERR_INVALIDBAN, form_str(ERR_INVALIDBAN), diff --git a/ircd/class.c b/ircd/class.c index a882f405f..75db28d0a 100644 --- a/ircd/class.c +++ b/ircd/class.c @@ -27,7 +27,6 @@ #include "class.h" #include "client.h" -#include "common.h" #include "ircd.h" #include "numeric.h" #include "s_conf.h" diff --git a/ircd/client.c b/ircd/client.c index 3ae434f5c..f411848b3 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -27,7 +27,6 @@ #include "client.h" #include "class.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/ircd/extban.c b/ircd/extban.c index 037dfdb52..69603f140 100644 --- a/ircd/extban.c +++ b/ircd/extban.c @@ -23,7 +23,6 @@ #include "stdinc.h" #include "channel.h" #include "client.h" -#include "common.h" ExtbanFunc extban_table[256] = { NULL }; diff --git a/ircd/hash.c b/ircd/hash.c index f444a25c9..c1ef81cbc 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -27,7 +27,6 @@ #include "s_conf.h" #include "channel.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/ircd/ircd.c b/ircd/ircd.c index 1bd94f2ea..b3f1b5d0b 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -31,7 +31,6 @@ #include "channel.h" #include "class.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd_signal.h" diff --git a/ircd/newconf.c b/ircd/newconf.c index 827f6ed90..7a726db3a 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -10,7 +10,6 @@ #include "newconf.h" #include "ircd_defs.h" -#include "common.h" #include "logger.h" #include "s_conf.h" #include "s_user.h" diff --git a/ircd/packet.c b/ircd/packet.c index 2e838453c..ef8de04d6 100644 --- a/ircd/packet.c +++ b/ircd/packet.c @@ -25,7 +25,6 @@ #include "s_conf.h" #include "s_serv.h" #include "client.h" -#include "common.h" #include "ircd.h" #include "parse.h" #include "packet.h" diff --git a/ircd/parse.c b/ircd/parse.c index 76a3585de..74c5fddb2 100644 --- a/ircd/parse.c +++ b/ircd/parse.c @@ -27,7 +27,6 @@ #include "parse.h" #include "client.h" #include "channel.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/ircd/s_auth.c b/ircd/s_auth.c index d9cdadfa5..c30b9e140 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -38,7 +38,6 @@ #include "s_auth.h" #include "s_conf.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "numeric.h" diff --git a/ircd/s_conf.c b/ircd/s_conf.c index ef5966c04..87520538a 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -32,7 +32,6 @@ #include "channel.h" #include "class.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/ircd/s_newconf.c b/ircd/s_newconf.c index 4b79f291b..3815f839f 100644 --- a/ircd/s_newconf.c +++ b/ircd/s_newconf.c @@ -32,7 +32,6 @@ #include "stdinc.h" #include "ircd_defs.h" -#include "common.h" #include "s_conf.h" #include "s_newconf.h" #include "client.h" diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 9f4d37356..619ab51f1 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -31,7 +31,6 @@ #include "s_serv.h" #include "class.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/ircd/s_user.c b/ircd/s_user.c index 1f6a4cb40..86a8c7cd5 100644 --- a/ircd/s_user.c +++ b/ircd/s_user.c @@ -27,7 +27,6 @@ #include "channel.h" #include "class.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/ircd/scache.c b/ircd/scache.c index f418e36f8..93f5acdc7 100644 --- a/ircd/scache.c +++ b/ircd/scache.c @@ -24,7 +24,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "numeric.h" diff --git a/ircd/send.c b/ircd/send.c index 44cb04984..a8782112f 100644 --- a/ircd/send.c +++ b/ircd/send.c @@ -27,7 +27,6 @@ #include "channel.h" #include "class.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "numeric.h" diff --git a/ircd/supported.c b/ircd/supported.c index 94ebf3a29..c28ed9d03 100644 --- a/ircd/supported.c +++ b/ircd/supported.c @@ -72,7 +72,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "numeric.h" #include "ircd.h" #include "s_conf.h" diff --git a/modules/core/m_ban.c b/modules/core/m_ban.c index a9ffbce29..94c18f2dc 100644 --- a/modules/core/m_ban.c +++ b/modules/core/m_ban.c @@ -31,7 +31,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "ircd.h" #include "match.h" diff --git a/modules/core/m_error.c b/modules/core/m_error.c index 078dcbc48..d8a931482 100644 --- a/modules/core/m_error.c +++ b/modules/core/m_error.c @@ -24,7 +24,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "ircd.h" #include "numeric.h" #include "send.h" diff --git a/modules/core/m_join.c b/modules/core/m_join.c index d17850152..4018ff82b 100644 --- a/modules/core/m_join.c +++ b/modules/core/m_join.c @@ -25,7 +25,6 @@ #include "stdinc.h" #include "channel.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/core/m_message.c b/modules/core/m_message.c index d1b2da6e7..afc8e04fe 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -26,7 +26,6 @@ #include "client.h" #include "ircd.h" #include "numeric.h" -#include "common.h" #include "s_conf.h" #include "s_serv.h" #include "msg.h" diff --git a/modules/core/m_nick.c b/modules/core/m_nick.c index cd9dc9c0f..7930ddea9 100644 --- a/modules/core/m_nick.c +++ b/modules/core/m_nick.c @@ -40,7 +40,6 @@ #include "msg.h" #include "parse.h" #include "modules.h" -#include "common.h" #include "packet.h" #include "scache.h" #include "s_newconf.h" diff --git a/modules/core/m_part.c b/modules/core/m_part.c index 15357c00c..094f39f10 100644 --- a/modules/core/m_part.c +++ b/modules/core/m_part.c @@ -25,7 +25,6 @@ #include "stdinc.h" #include "channel.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/core/m_server.c b/modules/core/m_server.c index 992ede46e..3f16888aa 100644 --- a/modules/core/m_server.c +++ b/modules/core/m_server.c @@ -24,7 +24,6 @@ #include "stdinc.h" #include "client.h" /* client struct */ -#include "common.h" #include "hash.h" /* add_to_client_hash */ #include "match.h" #include "ircd.h" /* me */ diff --git a/modules/core/m_squit.c b/modules/core/m_squit.c index fb2ce5cce..ad2dc9652 100644 --- a/modules/core/m_squit.c +++ b/modules/core/m_squit.c @@ -24,7 +24,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_certfp.c b/modules/m_certfp.c index d5c1c558c..f6dc003af 100644 --- a/modules/m_certfp.c +++ b/modules/m_certfp.c @@ -29,7 +29,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "hash.h" #include "ircd.h" diff --git a/modules/m_chghost.c b/modules/m_chghost.c index 4a964620f..b6711f763 100644 --- a/modules/m_chghost.c +++ b/modules/m_chghost.c @@ -13,7 +13,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_dline.c b/modules/m_dline.c index 9c3a39882..9a056d05a 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -26,7 +26,6 @@ #include "channel.h" #include "class.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "hostmask.h" diff --git a/modules/m_encap.c b/modules/m_encap.c index afa4b239d..f87ed6558 100644 --- a/modules/m_encap.c +++ b/modules/m_encap.c @@ -31,7 +31,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_etrace.c b/modules/m_etrace.c index 7e5e3c049..064206ae5 100644 --- a/modules/m_etrace.c +++ b/modules/m_etrace.c @@ -35,7 +35,6 @@ #include "hook.h" #include "client.h" #include "hash.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/m_info.c b/modules/m_info.c index 60461e16c..81d69a969 100644 --- a/modules/m_info.c +++ b/modules/m_info.c @@ -26,7 +26,6 @@ #include "m_info.h" #include "channel.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "hook.h" diff --git a/modules/m_invite.c b/modules/m_invite.c index 3572c0e41..bd9aeefb6 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.c @@ -23,7 +23,6 @@ */ #include "stdinc.h" -#include "common.h" #include "channel.h" #include "client.h" #include "hash.h" diff --git a/modules/m_kline.c b/modules/m_kline.c index c1861ec3a..7c55fc55d 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.c @@ -26,7 +26,6 @@ #include "channel.h" #include "class.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "hostmask.h" diff --git a/modules/m_names.c b/modules/m_names.c index c7e142eb9..026dfd2d2 100644 --- a/modules/m_names.c +++ b/modules/m_names.c @@ -25,7 +25,6 @@ #include "stdinc.h" #include "channel.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/m_oper.c b/modules/m_oper.c index a6d5eca94..926af3fdc 100644 --- a/modules/m_oper.c +++ b/modules/m_oper.c @@ -24,7 +24,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_operspy.c b/modules/m_operspy.c index 241019509..32a1a96d9 100644 --- a/modules/m_operspy.c +++ b/modules/m_operspy.c @@ -31,7 +31,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_privs.c b/modules/m_privs.c index 402a4e019..d8a32ebbe 100644 --- a/modules/m_privs.c +++ b/modules/m_privs.c @@ -31,7 +31,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "numeric.h" #include "send.h" #include "msg.h" diff --git a/modules/m_rehash.c b/modules/m_rehash.c index 4fc411614..bd6670aaa 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -25,7 +25,6 @@ #include "stdinc.h" #include "client.h" #include "channel.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "s_serv.h" diff --git a/modules/m_restart.c b/modules/m_restart.c index cad6bd72d..3910e299b 100644 --- a/modules/m_restart.c +++ b/modules/m_restart.c @@ -24,7 +24,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_scan.c b/modules/m_scan.c index b144a06de..550717163 100644 --- a/modules/m_scan.c +++ b/modules/m_scan.c @@ -34,7 +34,6 @@ #include "hook.h" #include "client.h" #include "hash.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/m_services.c b/modules/m_services.c index 515ac735f..b8a1f363f 100644 --- a/modules/m_services.c +++ b/modules/m_services.c @@ -32,7 +32,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_set.c b/modules/m_set.c index 3ee08aecb..e28b7002e 100644 --- a/modules/m_set.c +++ b/modules/m_set.c @@ -31,7 +31,6 @@ #include "numeric.h" #include "s_serv.h" #include "send.h" -#include "common.h" #include "channel.h" #include "s_conf.h" #include "s_newconf.h" diff --git a/modules/m_signon.c b/modules/m_signon.c index ad866d968..9175c3579 100644 --- a/modules/m_signon.c +++ b/modules/m_signon.c @@ -32,7 +32,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_snote.c b/modules/m_snote.c index af23287db..b79afbd94 100644 --- a/modules/m_snote.c +++ b/modules/m_snote.c @@ -34,7 +34,6 @@ #include "hook.h" #include "client.h" #include "hash.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/m_starttls.c b/modules/m_starttls.c index 67f31d154..dbbc71391 100644 --- a/modules/m_starttls.c +++ b/modules/m_starttls.c @@ -20,7 +20,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "hash.h" #include "ircd.h" diff --git a/modules/m_stats.c b/modules/m_stats.c index 4cf728909..40082039a 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -25,7 +25,6 @@ #include "stdinc.h" #include "class.h" /* report_classes */ #include "client.h" /* Client */ -#include "common.h" #include "match.h" #include "ircd.h" /* me */ #include "listener.h" /* show_ports */ diff --git a/modules/m_svinfo.c b/modules/m_svinfo.c index 9faadc42d..c6042fe11 100644 --- a/modules/m_svinfo.c +++ b/modules/m_svinfo.c @@ -23,7 +23,6 @@ */ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "ircd.h" #include "numeric.h" diff --git a/modules/m_tb.c b/modules/m_tb.c index 2ca66a505..4dce456ce 100644 --- a/modules/m_tb.c +++ b/modules/m_tb.c @@ -32,7 +32,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "ircd.h" #include "match.h" diff --git a/modules/m_testmask.c b/modules/m_testmask.c index 4537d648e..46b431f87 100644 --- a/modules/m_testmask.c +++ b/modules/m_testmask.c @@ -34,7 +34,6 @@ /* List of ircd includes from ../include/ */ #include "stdinc.h" #include "client.h" -#include "common.h" #include "ircd.h" #include "match.h" #include "numeric.h" diff --git a/modules/m_tginfo.c b/modules/m_tginfo.c index dd9050a17..c30d65013 100644 --- a/modules/m_tginfo.c +++ b/modules/m_tginfo.c @@ -29,7 +29,6 @@ #include "stdinc.h" #include "client.h" -#include "common.h" #include "match.h" #include "hash.h" #include "ircd.h" diff --git a/modules/m_trace.c b/modules/m_trace.c index fb0fdb920..38550667a 100644 --- a/modules/m_trace.c +++ b/modules/m_trace.c @@ -27,7 +27,6 @@ #include "hook.h" #include "client.h" #include "hash.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/m_who.c b/modules/m_who.c index f0260830e..aa674582b 100644 --- a/modules/m_who.c +++ b/modules/m_who.c @@ -22,7 +22,6 @@ * USA */ #include "stdinc.h" -#include "common.h" #include "client.h" #include "channel.h" #include "hash.h" diff --git a/modules/m_whois.c b/modules/m_whois.c index 3caf1330d..5f7b42d13 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -23,7 +23,6 @@ */ #include "stdinc.h" -#include "common.h" #include "client.h" #include "hash.h" #include "channel.h" diff --git a/modules/m_whowas.c b/modules/m_whowas.c index 7f6e0926b..a5038cce8 100644 --- a/modules/m_whowas.c +++ b/modules/m_whowas.c @@ -25,7 +25,6 @@ #include "stdinc.h" #include "whowas.h" #include "client.h" -#include "common.h" #include "hash.h" #include "match.h" #include "ircd.h" diff --git a/modules/m_xline.c b/modules/m_xline.c index 52ef33218..8f557b496 100644 --- a/modules/m_xline.c +++ b/modules/m_xline.c @@ -32,7 +32,6 @@ #include "send.h" #include "channel.h" #include "client.h" -#include "common.h" #include "defaults.h" #include "class.h" #include "ircd.h" From cb5a8bf847ee265a0064d2cf0c1215abb8e1c14e Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 10:06:52 -0500 Subject: [PATCH 163/252] Remove common.h from here too. --- authd/authd.h | 2 +- authd/reslib.c | 1 - bandb/bandb.c | 2 +- bandb/bantool.c | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/authd/authd.h b/authd/authd.h index 771f797af..b44a85d96 100644 --- a/authd/authd.h +++ b/authd/authd.h @@ -25,7 +25,7 @@ #include #include "setup.h" -#include "common.h" +#include "ircd_defs.h" extern rb_helper *authd_helper; diff --git a/authd/reslib.c b/authd/reslib.c index ecfe0e84d..b3b437262 100644 --- a/authd/reslib.c +++ b/authd/reslib.c @@ -97,7 +97,6 @@ typedef struct rb_addrinfo rb_addrinfo; #include "stdinc.h" #include "ircd_defs.h" -#include "common.h" #include "ircd.h" #include "res.h" #include "reslib.h" diff --git a/bandb/bandb.c b/bandb/bandb.c index 7f7688d9e..71a425d77 100644 --- a/bandb/bandb.c +++ b/bandb/bandb.c @@ -31,7 +31,7 @@ #include #include #include "rsdb.h" -#include "common.h" +#include "ircd_defs.h" #define MAXPARA 10 diff --git a/bandb/bantool.c b/bandb/bantool.c index a3af93cc8..e89fa5b9e 100644 --- a/bandb/bantool.c +++ b/bandb/bantool.c @@ -40,7 +40,6 @@ #include #include "stdinc.h" -#include "common.h" #include "rsdb.h" #define EmptyString(x) ((x == NULL) || (*(x) == '\0')) From 28c94d65984042b6ae4b2e5c1d0bff3c83cf129a Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 10:09:53 -0500 Subject: [PATCH 164/252] Remove common.h from lexer and parser --- ircd/ircd_lexer.l | 1 - ircd/ircd_parser.y | 1 - 2 files changed, 2 deletions(-) diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index e993c88a3..4ccee128d 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -33,7 +33,6 @@ #include "stdinc.h" #include "ircd_defs.h" -#include "common.h" #include "defaults.h" #include "logger.h" #include "s_conf.h" diff --git a/ircd/ircd_parser.y b/ircd/ircd_parser.y index bc5e3fccf..900f5ea5e 100644 --- a/ircd/ircd_parser.y +++ b/ircd/ircd_parser.y @@ -13,7 +13,6 @@ #define WE_ARE_MEMORY_C #include "stdinc.h" #include "setup.h" -#include "common.h" #include "ircd_defs.h" #include "defaults.h" #include "client.h" From 757bab823c5b37d1a4dd344a59c10d3a1ceb3885 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 12:04:02 -0500 Subject: [PATCH 165/252] misc solaris fixes --- librb/src/openssl.c | 7 ++++--- librb/src/ports.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/librb/src/openssl.c b/librb/src/openssl.c index 9898bf80d..eea76c6f9 100644 --- a/librb/src/openssl.c +++ b/librb/src/openssl.c @@ -359,9 +359,10 @@ rb_init_ssl(void) SSL_CTX_set_session_cache_mode(ssl_server_ctx, SSL_SESS_CACHE_OFF); SSL_CTX_set_cipher_list(ssl_server_ctx, librb_ciphers); - /* Set ECDHE on OpenSSL 1.00+, but make sure it's actually available because redhat are dicks - and bastardise their OpenSSL for stupid reasons... */ - #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) && defined(NID_secp384r1) + /* Set ECDHE on OpenSSL 1.00+, but make sure it's actually available + * (it's not by default on Solaris or Red Hat... fuck Red Hat and Oracle) + */ + #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) && !defined(OPENSSL_NO_ECDH) EC_KEY *key = EC_KEY_new_by_curve_name(NID_secp384r1); if (key) { SSL_CTX_set_tmp_ecdh(ssl_server_ctx, key); diff --git a/librb/src/ports.c b/librb/src/ports.c index af0257189..bc2d85b64 100644 --- a/librb/src/ports.c +++ b/librb/src/ports.c @@ -123,7 +123,7 @@ rb_setselect_ports(rb_fde_t *F, unsigned int type, PF * handler, void *client_da int rb_select_ports(long delay) { - int i, fd; + int i; unsigned int nget = 1; struct timespec poll_time; struct timespec *p = NULL; From 3a1f645bedc102ad082477cf16a1ea5aa751e194 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 12:04:02 -0500 Subject: [PATCH 166/252] misc solaris fixes --- librb/src/openssl.c | 7 ++++--- librb/src/ports.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/librb/src/openssl.c b/librb/src/openssl.c index 9898bf80d..eea76c6f9 100644 --- a/librb/src/openssl.c +++ b/librb/src/openssl.c @@ -359,9 +359,10 @@ rb_init_ssl(void) SSL_CTX_set_session_cache_mode(ssl_server_ctx, SSL_SESS_CACHE_OFF); SSL_CTX_set_cipher_list(ssl_server_ctx, librb_ciphers); - /* Set ECDHE on OpenSSL 1.00+, but make sure it's actually available because redhat are dicks - and bastardise their OpenSSL for stupid reasons... */ - #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) && defined(NID_secp384r1) + /* Set ECDHE on OpenSSL 1.00+, but make sure it's actually available + * (it's not by default on Solaris or Red Hat... fuck Red Hat and Oracle) + */ + #if (OPENSSL_VERSION_NUMBER >= 0x10000000L) && !defined(OPENSSL_NO_ECDH) EC_KEY *key = EC_KEY_new_by_curve_name(NID_secp384r1); if (key) { SSL_CTX_set_tmp_ecdh(ssl_server_ctx, key); diff --git a/librb/src/ports.c b/librb/src/ports.c index af0257189..bc2d85b64 100644 --- a/librb/src/ports.c +++ b/librb/src/ports.c @@ -123,7 +123,7 @@ rb_setselect_ports(rb_fde_t *F, unsigned int type, PF * handler, void *client_da int rb_select_ports(long delay) { - int i, fd; + int i; unsigned int nget = 1; struct timespec poll_time; struct timespec *p = NULL; From 3d1df26cdd84fb8b874116a65bf85ab5a6c6895d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 12:06:26 -0500 Subject: [PATCH 167/252] librb/ports: ungimp thing. --- librb/src/ports.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/librb/src/ports.c b/librb/src/ports.c index bc2d85b64..2963aef0b 100644 --- a/librb/src/ports.c +++ b/librb/src/ports.c @@ -123,7 +123,7 @@ rb_setselect_ports(rb_fde_t *F, unsigned int type, PF * handler, void *client_da int rb_select_ports(long delay) { - int i; + int i, fd = -1; unsigned int nget = 1; struct timespec poll_time; struct timespec *p = NULL; From d57e2b624fce7d3f864c0bea3156b59588f80515 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 12:31:51 -0500 Subject: [PATCH 168/252] Update README --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d138e832e..8e0638833 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,8 @@ You will need to run `autogen.sh` to build the autotools files prior to building problems with ipv4 due to the way the socket code is written. To fix this you must: "sysctl net.inet6.ip6.v6only=0" - * SOLARIS USERS: this code appears to tickle a bug in older gcc and - egcs ONLY on 64-bit Solaris7. gcc-2.95 and SunPro C on 64bit should - work fine, and any gcc or SunPro compiled on 32bit. + * SOLARIS USERS: you may have to set your PATH to include /usr/gnu/bin before /usr/bin. Solaris versions + older than 10 are not supported. * SUPPORTED PLATFORMS: this code should compile without any warnings on: @@ -63,9 +62,8 @@ You will need to run `autogen.sh` to build the autotools files prior to building * OpenSuSE 11/12 * OpenSolaris 2008.x? * Solaris 10 sparc. + * Solaris 11 x86 Please let us know if you find otherwise. It may work on other platforms, but this is not guaranteed. * Please read NEWS for information about what is in this release. - - * Other files recommended for reading: BUGS, INSTALL From fea4e2d2a848ddba8c932cf84c382443081c6611 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 13:59:10 -0500 Subject: [PATCH 169/252] modules: libircd depends on librb, so no need to include it. This triggers multiple inclusion warnings on Solaris also. --- extensions/Makefile.am | 2 +- modules/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/Makefile.am b/extensions/Makefile.am index f3a5ecbb5..443c65570 100644 --- a/extensions/Makefile.am +++ b/extensions/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/librb/include $(LTDLINCL) AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared AM_LDFLAGS += -export-symbols-regex _mheader -LIBS += $(top_srcdir)/librb/src/librb.la $(top_srcdir)/ircd/libircd.la +LIBS += $(top_srcdir)/ircd/libircd.la extensiondir=@moduledir@/extensions diff --git a/modules/Makefile.am b/modules/Makefile.am index 7193e02bc..8c2fb9df0 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/librb/include $(LTDLINCL) AM_LDFLAGS = -module -export-dynamic -avoid-version -no-undefined -shared AM_LDFLAGS += -export-symbols-regex _mheader -LIBS += $(top_srcdir)/librb/src/librb.la $(top_srcdir)/ircd/libircd.la +LIBS += $(top_srcdir)/ircd/libircd.la auto_load_moddir=@moduledir@/autoload From ab33d608de2257a8984e86f3813d734becdb3d88 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 14:29:27 -0500 Subject: [PATCH 170/252] DICTIONARY_FOREACH -> RB_DICTIONARY_FOREACH [ci skip] --- authd/providers/ident.c | 4 ++-- authd/providers/rdns.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 22ede8c9f..0ba927c8c 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -71,7 +71,7 @@ void ident_destroy(void) rb_dictionary_iter iter; /* Nuke all ident queries */ - DICTIONARY_FOREACH(auth, &iter, auth_clients) + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) { if(auth->data[PROVIDER_IDENT] != NULL) client_fail(auth, REPORT_FAIL); @@ -144,7 +144,7 @@ static void timeout_ident_queries_event(void *notused) struct auth_client *auth; rb_dictionary_iter iter; - DICTIONARY_FOREACH(auth, &iter, auth_clients) + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) { struct ident_query *query = auth->data[PROVIDER_IDENT]; diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index 6d0d7dfef..d1dfbdc67 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -70,7 +70,7 @@ void client_dns_destroy(void) struct auth_client *auth; rb_dictionary_iter iter; - DICTIONARY_FOREACH(auth, &iter, auth_clients) + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) { if(auth->data[PROVIDER_RDNS] != NULL) client_fail(auth, REPORT_FAIL); @@ -125,7 +125,7 @@ static void timeout_dns_queries_event(void *notused) struct auth_client *auth; rb_dictionary_iter iter; - DICTIONARY_FOREACH(auth, &iter, auth_clients) + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) { struct user_query *query = auth->data[PROVIDER_RDNS]; From fcf13f6d32f7404ba4066bf460200074bfd42ea3 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 15:10:44 -0500 Subject: [PATCH 171/252] README: clearly outline levels of platform support --- README.md | 86 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 60 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 8e0638833..7d9c96454 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,62 @@ It is meant to be used with an IRCv3-capable services implementation such as [At # necessary requirements * A supported platform - * A working dynamic load library. - * A working lex. Solaris /usr/ccs/bin/lex appears to be broken, on this system flex should be used. + * A working dynamic library system + * A working lex and yacc - flex and bison should work + +# platforms + +Charybdis is designed with portability in mind, but does not target older systems nor those of solely academic +interest. + +Do note that operating systems are only supported if they are supported by their vendor. + +## Tier 1 + +These platforms are the best supported, and should always work. They are actively tested. If you encounter +problems, please file a bug. + +* FreeBSD 10.x and above (i386 and amd64) +* Linux 2.6.x and above with glibc or musl (i386, x86_64, and ARM) +* Mac OS X 10.7 and above +* Windows Vista/Server 2008 and above (x86 or x64) + +## Tier 2 + +These platforms are supported, and most features should work, but this is not guaranteed. If you find any +problems, file a bug, but as these are not regularly tested platforms, a timely resolution may not be +possible. + +* DragonflyBSD 4.4 and above (i386) +* Linux with uClibc (i386 or x86_64) +* NetBSD 6.1.x and above (i386, amd64) +* OpenBSD 5.6 and above (i386, amd64) +* Solaris 10 and above (i386) + +## Tier 3 + +These platforms should only be considered weakly supported, as they are either experimental or not actively +tested. These platforms have usually been tested in the past, but they may or may not be in a useful state. +Bugs for tier 3 architectures should have patches attached. + +* Solaris 10 and above (sparc64) +* Old operating system versions of tier 2 and above platforms + +## Tier 4 + +Platforms that are tier 4 are not supported at all. They include all platforms not included in tier 3 or +above. Bugs to tier 4 platforms **must** have patches attached or will be rejected, possibly without comment. + +# platform specific errata + +These are known issues and workarounds for supported platforms. + + * **FreeBSD**: if you are compiling with ipv6 you may experience + problems with ipv4 due to the way the socket code is written. To + fix this you must: "sysctl net.inet6.ip6.v6only=0" + + * **Solaris**: you may have to set your PATH to include /usr/gnu/bin and /usr/gnu/sbin before /usr/bin + and /usr/sbin. Solaris's default tools don't seem to play nicely with the configure script. # building from git @@ -31,9 +85,8 @@ You will need to run `autogen.sh` to build the autotools files prior to building (Using CHALLENGE is not recommended for new deployments, so if you want to use a different TLS library, feel free.) - * For ECDHE, OpenSSL 1.0.0 or newer is required. RHEL/Fedora and derivatives like CentOS - will need to compile OpenSSL from source, as ECC/ECDHE-functionality is removed from - the OpenSSL package in these distributions. + * For ECDHE, OpenSSL 1.0.0 or newer is required. Solaris; and RHEL/Fedora and its derivatives such as CentOS + have removed support for ECC/ECDHE. You will need to compile your own OpenSSL on these systems. # tips @@ -41,29 +94,10 @@ You will need to run `autogen.sh` to build the autotools files prior to building * Please read doc/index.txt to get an overview of the current documentation. + * Read the NEWS file for what's new in this release. + * The files, /etc/services, /etc/protocols, and /etc/resolv.conf, SHOULD be readable by the user running the server in order for ircd to start with the correct settings. If these files are wrong, charybdis will try to use 127.0.0.1 for a resolver as a last-ditch effort. - * FREEBSD USERS: if you are compiling with ipv6 you may experience - problems with ipv4 due to the way the socket code is written. To - fix this you must: "sysctl net.inet6.ip6.v6only=0" - - * SOLARIS USERS: you may have to set your PATH to include /usr/gnu/bin before /usr/bin. Solaris versions - older than 10 are not supported. - - * SUPPORTED PLATFORMS: this code should compile without any warnings on: - - * FreeBSD 10 - * Gentoo & Gentoo Hardened ~x86/~amd64/~fbsd - * RHEL 6 / 7 - * Debian Jessie - * OpenSuSE 11/12 - * OpenSolaris 2008.x? - * Solaris 10 sparc. - * Solaris 11 x86 - - Please let us know if you find otherwise. It may work on other platforms, but this is not guaranteed. - - * Please read NEWS for information about what is in this release. From b347989499968417c98030e4633f9d3efa774069 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 15:35:13 -0500 Subject: [PATCH 172/252] Add unlisted architectures to tier 3 [ci skip] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7d9c96454..1b802e929 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ These platforms should only be considered weakly supported, as they are either e tested. These platforms have usually been tested in the past, but they may or may not be in a useful state. Bugs for tier 3 architectures should have patches attached. -* Solaris 10 and above (sparc64) * Old operating system versions of tier 2 and above platforms +* Other architectures of the above operating systems ## Tier 4 From 6156682605f44fa46e7487b6c19fa4d56830a013 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 15:51:25 -0500 Subject: [PATCH 173/252] Remove tier 4 (tier 3 is basically "everything but") --- README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1b802e929..38463a031 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ problems, please file a bug. ## Tier 2 -These platforms are supported, and most features should work, but this is not guaranteed. If you find any -problems, file a bug, but as these are not regularly tested platforms, a timely resolution may not be -possible. +These platforms are supported and occasionally tested, and most features should work, but this is not +guaranteed. If you find any problems, file a bug, but as these are not regularly tested platforms, a timely +resolution may not be possible. * DragonflyBSD 4.4 and above (i386) * Linux with uClibc (i386 or x86_64) @@ -44,17 +44,7 @@ possible. ## Tier 3 -These platforms should only be considered weakly supported, as they are either experimental or not actively -tested. These platforms have usually been tested in the past, but they may or may not be in a useful state. -Bugs for tier 3 architectures should have patches attached. - -* Old operating system versions of tier 2 and above platforms -* Other architectures of the above operating systems - -## Tier 4 - -Platforms that are tier 4 are not supported at all. They include all platforms not included in tier 3 or -above. Bugs to tier 4 platforms **must** have patches attached or will be rejected, possibly without comment. +Anything else that hasn't been tested. Charybdis may or may not work on it; patches welcome if they don't. # platform specific errata From 8ed8e5cae841e650e9528a9d5390327adbca68e7 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 16:40:31 -0500 Subject: [PATCH 174/252] res: expose rDNS building functions This will be used by the blacklist code to avoid duplication of code. --- authd/res.c | 81 +++++++++++++++++++++++++++++++---------------------- authd/res.h | 1 + 2 files changed, 48 insertions(+), 34 deletions(-) diff --git a/authd/res.c b/authd/res.c index f9db7afdc..d68e402a6 100644 --- a/authd/res.c +++ b/authd/res.c @@ -465,6 +465,52 @@ static void do_query_name(struct DNSQuery *query, const char *name, struct resli query_name(request); } +/* Build an rDNS style query - if suffix is NULL, use the appropriate .arpa zone */ +void build_rdns(char *buf, size_t size, const struct rb_sockaddr_storage *addr, const char *suffix) +{ + const unsigned char *cp; + + if (GET_SS_FAMILY(addr) == AF_INET) + { + const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr; + cp = (const unsigned char *)&v4->sin_addr.s_addr; + + (void) snprintf(buf, size, "%u.%u.%u.%u.%s", + (unsigned int)(cp[3]), + (unsigned int)(cp[2]), + (unsigned int)(cp[1]), + (unsigned int)(cp[0]), + suffix == NULL ? "in-addr.arpa" : suffix); + } +#ifdef RB_IPV6 + else if (GET_SS_FAMILY(addr) == AF_INET6) + { + const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *)addr; + cp = (const unsigned char *)&v6->sin6_addr.s6_addr; + + (void) snprintf(buf, size, + "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%s", + (unsigned int)(cp[15] & 0xf), (unsigned int)(cp[15] >> 4), + (unsigned int)(cp[14] & 0xf), (unsigned int)(cp[14] >> 4), + (unsigned int)(cp[13] & 0xf), (unsigned int)(cp[13] >> 4), + (unsigned int)(cp[12] & 0xf), (unsigned int)(cp[12] >> 4), + (unsigned int)(cp[11] & 0xf), (unsigned int)(cp[11] >> 4), + (unsigned int)(cp[10] & 0xf), (unsigned int)(cp[10] >> 4), + (unsigned int)(cp[9] & 0xf), (unsigned int)(cp[9] >> 4), + (unsigned int)(cp[8] & 0xf), (unsigned int)(cp[8] >> 4), + (unsigned int)(cp[7] & 0xf), (unsigned int)(cp[7] >> 4), + (unsigned int)(cp[6] & 0xf), (unsigned int)(cp[6] >> 4), + (unsigned int)(cp[5] & 0xf), (unsigned int)(cp[5] >> 4), + (unsigned int)(cp[4] & 0xf), (unsigned int)(cp[4] >> 4), + (unsigned int)(cp[3] & 0xf), (unsigned int)(cp[3] >> 4), + (unsigned int)(cp[2] & 0xf), (unsigned int)(cp[2] >> 4), + (unsigned int)(cp[1] & 0xf), (unsigned int)(cp[1] >> 4), + (unsigned int)(cp[0] & 0xf), (unsigned int)(cp[0] >> 4), + suffix == NULL ? "ip6.arpa" : suffix); + } +#endif +} + /* * do_query_number - Use this to do reverse IP# lookups. */ @@ -480,40 +526,7 @@ static void do_query_number(struct DNSQuery *query, const struct rb_sockaddr_sto request->name = (char *)rb_malloc(IRCD_RES_HOSTLEN + 1); } - if (GET_SS_FAMILY(addr) == AF_INET) - { - const struct sockaddr_in *v4 = (const struct sockaddr_in *)addr; - cp = (const unsigned char *)&v4->sin_addr.s_addr; - - sprintf(request->queryname, "%u.%u.%u.%u.in-addr.arpa", (unsigned int)(cp[3]), - (unsigned int)(cp[2]), (unsigned int)(cp[1]), (unsigned int)(cp[0])); - } -#ifdef RB_IPV6 - else if (GET_SS_FAMILY(addr) == AF_INET6) - { - const struct sockaddr_in6 *v6 = (const struct sockaddr_in6 *)addr; - cp = (const unsigned char *)&v6->sin6_addr.s6_addr; - - (void)sprintf(request->queryname, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x." - "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa", - (unsigned int)(cp[15] & 0xf), (unsigned int)(cp[15] >> 4), - (unsigned int)(cp[14] & 0xf), (unsigned int)(cp[14] >> 4), - (unsigned int)(cp[13] & 0xf), (unsigned int)(cp[13] >> 4), - (unsigned int)(cp[12] & 0xf), (unsigned int)(cp[12] >> 4), - (unsigned int)(cp[11] & 0xf), (unsigned int)(cp[11] >> 4), - (unsigned int)(cp[10] & 0xf), (unsigned int)(cp[10] >> 4), - (unsigned int)(cp[9] & 0xf), (unsigned int)(cp[9] >> 4), - (unsigned int)(cp[8] & 0xf), (unsigned int)(cp[8] >> 4), - (unsigned int)(cp[7] & 0xf), (unsigned int)(cp[7] >> 4), - (unsigned int)(cp[6] & 0xf), (unsigned int)(cp[6] >> 4), - (unsigned int)(cp[5] & 0xf), (unsigned int)(cp[5] >> 4), - (unsigned int)(cp[4] & 0xf), (unsigned int)(cp[4] >> 4), - (unsigned int)(cp[3] & 0xf), (unsigned int)(cp[3] >> 4), - (unsigned int)(cp[2] & 0xf), (unsigned int)(cp[2] >> 4), - (unsigned int)(cp[1] & 0xf), (unsigned int)(cp[1] >> 4), - (unsigned int)(cp[0] & 0xf), (unsigned int)(cp[0] >> 4)); - } -#endif + build_rdns(request->queryname, IRCD_RES_HOSTLEN + 1, addr, NULL); request->type = T_PTR; query_name(request); diff --git a/authd/res.h b/authd/res.h index 5a1772570..1fabe0b22 100644 --- a/authd/res.h +++ b/authd/res.h @@ -32,5 +32,6 @@ extern void init_resolver(void); extern void restart_resolver(void); extern void gethost_byname_type(const char *, struct DNSQuery *, int); extern void gethost_byaddr(const struct rb_sockaddr_storage *, struct DNSQuery *); +extern void build_rdns(char *, size_t, const struct rb_sockaddr_storage *, const char *); #endif From 1d591813c3efe619ce1990ab0aa371fd4dcc99c7 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 17:44:56 -0500 Subject: [PATCH 175/252] providers/rdns: remove useless struct member --- authd/providers/rdns.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index d1dfbdc67..013d6d6c6 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -27,8 +27,6 @@ struct user_query { - rb_dlink_node node; - struct dns_query *query; /* Pending DNS query */ time_t timeout; /* When the request times out */ }; From 4b11f39115bedeb138377c2883675cafec574c2b Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Wed, 23 Mar 2016 19:11:42 -0400 Subject: [PATCH 176/252] Move away from BSD data types --- include/match.h | 4 ++-- ircd/chmode.c | 8 ++++---- ircd/match.c | 6 +++--- librb/src/crypt.c | 38 +++++++++++++++++++------------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/match.h b/include/match.h index c49e12e9f..151ad4bf6 100644 --- a/include/match.h +++ b/include/match.h @@ -46,8 +46,8 @@ extern int match_ips(const char *mask, const char *name); /* * comp_with_mask - compares to IP address */ -int comp_with_mask(void *addr, void *dest, u_int mask); -int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask); +int comp_with_mask(void *addr, void *dest, unsigned int mask); +int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, unsigned int mask); /* * collapse - collapse a string in place, converts multiple adjacent *'s diff --git a/ircd/chmode.c b/ircd/chmode.c index 6ec2f497a..cefcdbd31 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -535,9 +535,9 @@ check_forward(struct Client *source_p, struct Channel *chptr, static char * fix_key(char *arg) { - u_char *s, *t, c; + unsigned char *s, *t, c; - for(s = t = (u_char *) arg; (c = *s); s++) + for(s = t = (unsigned char *) arg; (c = *s); s++) { c &= 0x7f; if(c != ':' && c != ',' && c > ' ') @@ -558,9 +558,9 @@ fix_key(char *arg) static char * fix_key_remote(char *arg) { - u_char *s, *t, c; + unsigned char *s, *t, c; - for(s = t = (u_char *) arg; (c = *s); s++) + for(s = t = (unsigned char *) arg; (c = *s); s++) { c &= 0x7f; if((c != 0x0a) && (c != ':') && (c != ',') && (c != 0x0d) && (c != ' ')) diff --git a/ircd/match.c b/ircd/match.c index 87a1c7eff..66ffe2364 100644 --- a/ircd/match.c +++ b/ircd/match.c @@ -308,13 +308,13 @@ match_esc(const char *mask, const char *name) return 0; } -int comp_with_mask(void *addr, void *dest, u_int mask) +int comp_with_mask(void *addr, void *dest, unsigned int mask) { if (memcmp(addr, dest, mask / 8) == 0) { int n = mask / 8; int m = ((-1) << (8 - (mask % 8))); - if (mask % 8 == 0 || (((u_char *) addr)[n] & m) == (((u_char *) dest)[n] & m)) + if (mask % 8 == 0 || (((unsigned char *) addr)[n] & m) == (((unsigned char *) dest)[n] & m)) { return (1); } @@ -322,7 +322,7 @@ int comp_with_mask(void *addr, void *dest, u_int mask) return (0); } -int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, u_int mask) +int comp_with_mask_sock(struct sockaddr *addr, struct sockaddr *dest, unsigned int mask) { void *iaddr = NULL; void *idest = NULL; diff --git a/librb/src/crypt.c b/librb/src/crypt.c index 206027fda..4b807c7ef 100644 --- a/librb/src/crypt.c +++ b/librb/src/crypt.c @@ -1072,8 +1072,8 @@ rb_md5_crypt(const char *pw, const char *salt) MD5_CTX ctx,ctx1; unsigned long l; int sl, pl; - u_int i; - u_char final[MD5_SIZE]; + unsigned int i; + unsigned char final[MD5_SIZE]; static const char *sp, *ep; static char passwd[120], *p; static const char *magic = "$1$"; @@ -1095,23 +1095,23 @@ rb_md5_crypt(const char *pw, const char *salt) MD5Init(&ctx); /* The password first, since that is what is most unknown */ - MD5Update(&ctx, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx, (const unsigned char *)pw, strlen(pw)); /* Then our magic string */ - MD5Update(&ctx, (const u_char *)magic, strlen(magic)); + MD5Update(&ctx, (const unsigned char *)magic, strlen(magic)); /* Then the raw salt */ - MD5Update(&ctx, (const u_char *)sp, (u_int)sl); + MD5Update(&ctx, (const unsigned char *)sp, (unsigned int)sl); /* Then just as many characters of the MD5(pw,salt,pw) */ MD5Init(&ctx1); - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); - MD5Update(&ctx1, (const u_char *)sp, (u_int)sl); - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)sp, (unsigned int)sl); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); MD5Final(final, &ctx1); for(pl = (int)strlen(pw); pl > 0; pl -= MD5_SIZE) - MD5Update(&ctx, (const u_char *)final, - (u_int)(pl > MD5_SIZE ? MD5_SIZE : pl)); + MD5Update(&ctx, (const unsigned char *)final, + (unsigned int)(pl > MD5_SIZE ? MD5_SIZE : pl)); /* Don't leave anything around in vm they could use. */ memset(final, 0, sizeof(final)); @@ -1119,13 +1119,13 @@ rb_md5_crypt(const char *pw, const char *salt) /* Then something really weird... */ for (i = strlen(pw); i; i >>= 1) if(i & 1) - MD5Update(&ctx, (const u_char *)final, 1); + MD5Update(&ctx, (const unsigned char *)final, 1); else - MD5Update(&ctx, (const u_char *)pw, 1); + MD5Update(&ctx, (const unsigned char *)pw, 1); /* Now make the output string */ rb_strlcpy(passwd, magic, sizeof(passwd)); - strncat(passwd, sp, (u_int)sl); + strncat(passwd, sp, (unsigned int)sl); rb_strlcat(passwd, "$", sizeof(passwd)); MD5Final(final, &ctx); @@ -1138,20 +1138,20 @@ rb_md5_crypt(const char *pw, const char *salt) for(i = 0; i < 1000; i++) { MD5Init(&ctx1); if(i & 1) - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); else - MD5Update(&ctx1, (const u_char *)final, MD5_SIZE); + MD5Update(&ctx1, (const unsigned char *)final, MD5_SIZE); if(i % 3) - MD5Update(&ctx1, (const u_char *)sp, (u_int)sl); + MD5Update(&ctx1, (const unsigned char *)sp, (unsigned int)sl); if(i % 7) - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); if(i & 1) - MD5Update(&ctx1, (const u_char *)final, MD5_SIZE); + MD5Update(&ctx1, (const unsigned char *)final, MD5_SIZE); else - MD5Update(&ctx1, (const u_char *)pw, strlen(pw)); + MD5Update(&ctx1, (const unsigned char *)pw, strlen(pw)); MD5Final(final, &ctx1); } From 6e4bcf20ff05e2b557ee9bc40ff61328c5e7599c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 18:47:02 -0500 Subject: [PATCH 177/252] providers/ident: fix inet_ntop/inet_pton mixup --- authd/providers/ident.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 0ba927c8c..a610cfe50 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -97,8 +97,8 @@ bool ident_start(struct auth_client *auth) query->F = F; /* Build sockaddr_storages for rb_connect_tcp below */ - if(!rb_inet_ntop_sock((struct sockaddr *)&l_addr, auth->l_ip, sizeof(l_addr)) || - !rb_inet_ntop_sock((struct sockaddr *)&c_addr, auth->c_ip, sizeof(c_addr))) + if(!rb_inet_pton_sock(auth->l_ip, (struct sockaddr *)&l_addr, sizeof(l_addr)) || + !rb_inet_pton_sock(auth->c_ip, (struct sockaddr)&c_addr, sizeof(c_addr))) { client_fail(auth, REPORT_FAIL); return true; From 9c7498d5598daa92f1726edfbf04cea8aa43ee18 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 18:56:29 -0500 Subject: [PATCH 178/252] authd/provider: add c_addr/l_addr fields Some providers consume these directly, so it's better to have a "cached" version that's already generated. --- authd/provider.c | 16 ++++++++++++++++ authd/provider.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/authd/provider.c b/authd/provider.c index 31ef78164..016dfe122 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -205,9 +205,25 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip)); auth->l_port = (uint16_t)atoi(l_port); /* should be safe */ + (void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr, sizeof(auth->l_addr)); rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); auth->c_port = (uint16_t)atoi(c_port); + (void) rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_addr, sizeof(auth->c_addr)); + +#ifdef RB_IPV6 + if(GET_SS_FAMILY(&auth->l_addr) == AF_INET6) + ((struct sockaddr_in6 *)&l_addr)->sin6_port = htons(auth->l_port); + else +#endif + ((struct sockaddr_in *)&l_addr)->sin_port = htons(auth->l_port); + +#ifdef RB_IPV6 + if(GET_SS_FAMILY(&auth->c_addr) == AF_INET6) + ((struct sockaddr_in6 *)&c_addr)->sin6_port = htons(auth->c_port); + else +#endif + ((struct sockaddr_in *)&c_addr)->sin_port = htons(auth->c_port); rb_dictionary_add(auth_clients, RB_UINT_TO_POINTER(auth->cid), auth); diff --git a/authd/provider.h b/authd/provider.h index a3326cc50..5fa0962bd 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -40,9 +40,11 @@ struct auth_client char l_ip[HOSTIPLEN + 1]; /* Listener IP address */ uint16_t l_port; /* Listener port */ + struct rb_sockaddr_storage l_addr; /* Listener address/port */ char c_ip[HOSTIPLEN + 1]; /* Client IP address */ uint16_t c_port; /* Client port */ + struct rb_sockaddr_storage c_addr; /* Client address/port */ char hostname[HOSTLEN + 1]; /* Used for DNS lookup */ char username[USERLEN + 1]; /* Used for ident lookup */ From 6cd3964de7a2c90f9b9f9bde40ac7edd1179fbdf Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 18:58:56 -0500 Subject: [PATCH 179/252] ident: use new *_addr fields --- authd/providers/ident.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index a610cfe50..8c586bed7 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -97,12 +97,8 @@ bool ident_start(struct auth_client *auth) query->F = F; /* Build sockaddr_storages for rb_connect_tcp below */ - if(!rb_inet_pton_sock(auth->l_ip, (struct sockaddr *)&l_addr, sizeof(l_addr)) || - !rb_inet_pton_sock(auth->c_ip, (struct sockaddr)&c_addr, sizeof(c_addr))) - { - client_fail(auth, REPORT_FAIL); - return true; - } + memcpy(&l_addr, auth->l_addr, sizeof(l_addr)); + memcpy(&c_addr, auth->c_addr, sizeof(c_addr)); /* Set the ports correctly */ #ifdef RB_IPV6 From 32f8c78b55f0c8b6a0c361112ebf35e470a58432 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 19:06:33 -0500 Subject: [PATCH 180/252] stupidity fixes --- authd/provider.c | 12 ++++++------ authd/providers/ident.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index 016dfe122..3cd489c2b 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -205,25 +205,25 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip)); auth->l_port = (uint16_t)atoi(l_port); /* should be safe */ - (void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr, sizeof(auth->l_addr)); + (void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr); rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); auth->c_port = (uint16_t)atoi(c_port); - (void) rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_addr, sizeof(auth->c_addr)); + (void) rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_addr); #ifdef RB_IPV6 if(GET_SS_FAMILY(&auth->l_addr) == AF_INET6) - ((struct sockaddr_in6 *)&l_addr)->sin6_port = htons(auth->l_port); + ((struct sockaddr_in6 *)&auth->l_addr)->sin6_port = htons(auth->l_port); else #endif - ((struct sockaddr_in *)&l_addr)->sin_port = htons(auth->l_port); + ((struct sockaddr_in *)&auth->l_addr)->sin_port = htons(auth->l_port); #ifdef RB_IPV6 if(GET_SS_FAMILY(&auth->c_addr) == AF_INET6) - ((struct sockaddr_in6 *)&c_addr)->sin6_port = htons(auth->c_port); + ((struct sockaddr_in6 *)&auth->c_addr)->sin6_port = htons(auth->c_port); else #endif - ((struct sockaddr_in *)&c_addr)->sin_port = htons(auth->c_port); + ((struct sockaddr_in *)&auth->c_addr)->sin_port = htons(auth->c_port); rb_dictionary_add(auth_clients, RB_UINT_TO_POINTER(auth->cid), auth); diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 8c586bed7..3e77025ff 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -97,8 +97,8 @@ bool ident_start(struct auth_client *auth) query->F = F; /* Build sockaddr_storages for rb_connect_tcp below */ - memcpy(&l_addr, auth->l_addr, sizeof(l_addr)); - memcpy(&c_addr, auth->c_addr, sizeof(c_addr)); + memcpy(&l_addr, &auth->l_addr, sizeof(l_addr)); + memcpy(&c_addr, &auth->c_addr, sizeof(c_addr)); /* Set the ports correctly */ #ifdef RB_IPV6 From 3889fc11af15b5dd60394640962ac5b5bd3b1459 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Wed, 23 Mar 2016 20:07:21 -0400 Subject: [PATCH 181/252] authd: Change str_isnumber() to bool --- authd/getaddrinfo.c | 8 ++++---- authd/getaddrinfo.h | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.c index f76428752..e1c7ba6c9 100644 --- a/authd/getaddrinfo.c +++ b/authd/getaddrinfo.c @@ -94,7 +94,7 @@ static const struct explore explore[] = { #define PTON_MAX 16 -static int str_isnumber(const char *); +static bool str_isnumber(const char *); static int explore_null(const struct rb_addrinfo *, const char *, struct rb_addrinfo **); static int explore_numeric(const struct rb_addrinfo *, const char *, @@ -183,7 +183,7 @@ rb_freeaddrinfo(struct rb_addrinfo *ai) } while (ai); } -static int +static bool str_isnumber(const char *p) { char *ep; @@ -194,9 +194,9 @@ str_isnumber(const char *p) errno = 0; (void)strtoul(p, &ep, 10); if (errno == 0 && ep && *ep == '\0') - return YES; + return true; else - return NO; + return false; } int diff --git a/authd/getaddrinfo.h b/authd/getaddrinfo.h index 746db142a..290abd53c 100644 --- a/authd/getaddrinfo.h +++ b/authd/getaddrinfo.h @@ -94,8 +94,6 @@ void rb_freeaddrinfo(struct rb_addrinfo *ai); #define SUCCESS 0 #define ANY 0 -#define YES 1 -#define NO 0 #undef EAI_ADDRFAMILY #undef EAI_AGAIN From c056dba2330c08a4b71bf0586750f6ff77e2a49d Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Wed, 23 Mar 2016 20:10:44 -0400 Subject: [PATCH 182/252] Remove the rest of the SVN id tags --- authd/getaddrinfo.c | 6 ++---- authd/getaddrinfo.h | 1 - authd/getnameinfo.c | 2 -- authd/getnameinfo.h | 1 - librb/acinclude.m4 | 19 +++++++++---------- librb/include/commio-int.h | 1 - librb/include/commio-ssl.h | 1 - librb/include/event-int.h | 1 - librb/include/rb_balloc.h | 1 - librb/include/rb_commio.h | 1 - librb/include/rb_event.h | 1 - librb/include/rb_helper.h | 1 - librb/include/rb_linebuf.h | 1 - librb/include/rb_memory.h | 1 - librb/include/rb_patricia.h | 1 - librb/include/rb_rawbuf.h | 1 - librb/include/rb_tools.h | 1 - librb/src/Makefile.am | 1 - librb/src/arc4random.c | 1 - librb/src/balloc.c | 1 - librb/src/commio.c | 2 +- librb/src/devpoll.c | 2 +- librb/src/epoll.c | 2 +- librb/src/event.c | 1 - librb/src/gnutls.c | 1 - librb/src/helper.c | 2 +- librb/src/kqueue.c | 1 - librb/src/linebuf.c | 1 - librb/src/mbedtls.c | 1 - librb/src/nossl.c | 1 - librb/src/openssl.c | 1 - librb/src/patricia.c | 1 - librb/src/poll.c | 1 - librb/src/ports.c | 1 - librb/src/rawbuf.c | 1 - librb/src/rb_lib.c | 1 - librb/src/rb_memory.c | 1 - librb/src/select.c | 2 +- librb/src/sigio.c | 1 - librb/src/tools.c | 2 +- librb/src/unix.c | 2 +- librb/src/version.c.SH | 5 ++--- librb/src/win32.c | 1 - 43 files changed, 20 insertions(+), 58 deletions(-) diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.c index e1c7ba6c9..e0524b35e 100644 --- a/authd/getaddrinfo.c +++ b/authd/getaddrinfo.c @@ -31,8 +31,6 @@ #include #include "getaddrinfo.h" -/* $Id$ */ - static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in_loopback[] = { 127, 0, 0, 1 }; static const char in6_addrany[] = { @@ -497,7 +495,7 @@ get_ai(const struct rb_addrinfo *pai, const struct afd *afd, const char *addr) { char *p; struct rb_addrinfo *ai; - + ai = (struct rb_addrinfo *)rb_malloc(sizeof(struct rb_addrinfo) + (afd->a_socklen)); if (ai == NULL) @@ -517,7 +515,7 @@ static int get_portmatch(const struct rb_addrinfo *ai, const char *servname) { struct rb_addrinfo xai; - memcpy(&xai, ai, sizeof(struct rb_addrinfo)); + memcpy(&xai, ai, sizeof(struct rb_addrinfo)); return(get_port(&xai, servname, 1)); } diff --git a/authd/getaddrinfo.h b/authd/getaddrinfo.h index 290abd53c..9916629b2 100644 --- a/authd/getaddrinfo.h +++ b/authd/getaddrinfo.h @@ -26,7 +26,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ */ struct rb_addrinfo { diff --git a/authd/getnameinfo.c b/authd/getnameinfo.c index f34fffcf8..39e296af2 100644 --- a/authd/getnameinfo.c +++ b/authd/getnameinfo.c @@ -46,8 +46,6 @@ #include "getaddrinfo.h" #include "getnameinfo.h" -/* $Id$ */ - static const struct afd { int a_af; int a_addrlen; diff --git a/authd/getnameinfo.h b/authd/getnameinfo.h index 26b965ab4..d7a919a4d 100644 --- a/authd/getnameinfo.h +++ b/authd/getnameinfo.h @@ -26,7 +26,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ */ int rb_getnameinfo(const struct sockaddr *sa, rb_socklen_t salen, char *host, diff --git a/librb/acinclude.m4 b/librb/acinclude.m4 index e0474339b..eaa270e06 100644 --- a/librb/acinclude.m4 +++ b/librb/acinclude.m4 @@ -1,4 +1,3 @@ -# $Id: acinclude.m4 23020 2006-09-01 18:20:19Z androsyn $ - aclocal.m4 - Autoconf fun... AC_DEFUN([AC_DEFINE_DIR], [ test "x$prefix" = xNONE && prefix="$ac_default_prefix" test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' @@ -34,7 +33,7 @@ AC_DEFUN([AC_SUBST_DIR], [ dnl IPv6 support macros..pretty much swiped from wget dnl RB_PROTO_INET6 - + AC_DEFUN([RB_PROTO_INET6],[ AC_CACHE_CHECK([for INET6 protocol support], [rb_cv_proto_inet6],[ AC_TRY_CPP([ @@ -57,14 +56,14 @@ AC_DEFUN([RB_PROTO_INET6],[ ],[ rb_cv_proto_inet6=no ]) - ]) + ]) if test "X$rb_cv_proto_inet6" = "Xyes"; then : $1 else : - $2 - fi -]) + $2 + fi +]) AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ @@ -93,7 +92,7 @@ AC_DEFUN([RB_TYPE_STRUCT_SOCKADDR_IN6],[ AC_DEFUN([RB_CHECK_TIMER_CREATE], - [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], + [AC_CACHE_CHECK([for a working timer_create(CLOCK_REALTIME)], [rb__cv_timer_create_works], [AC_TRY_RUN([ #ifdef HAVE_TIME_H @@ -126,7 +125,7 @@ int main(int argc, char *argv[]) [rb__cv_timer_create_works=no]) ]) case $rb__cv_timer_create_works in - yes) AC_DEFINE([USE_TIMER_CREATE], 1, + yes) AC_DEFINE([USE_TIMER_CREATE], 1, [Define to 1 if we can use timer_create(CLOCK_REALTIME,...)]);; esac ]) @@ -134,7 +133,7 @@ esac AC_DEFUN([RB_CHECK_TIMERFD_CREATE], - [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], + [AC_CACHE_CHECK([for a working timerfd_create(CLOCK_REALTIME)], [rb__cv_timerfd_create_works], [AC_TRY_RUN([ #ifdef HAVE_TIME_H @@ -166,7 +165,7 @@ int main(int argc, char *argv[]) [rb__cv_timerfd_create_works=no]) ]) case $rb__cv_timerfd_create_works in - yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, + yes) AC_DEFINE([USE_TIMERFD_CREATE], 1, [Define to 1 if we can use timerfd_create(CLOCK_REALTIME,...)]);; esac ]) diff --git a/librb/include/commio-int.h b/librb/include/commio-int.h index 6a4bfb874..da2833a42 100644 --- a/librb/include/commio-int.h +++ b/librb/include/commio-int.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.h 24059 2007-07-24 17:25:41Z androsyn $ */ #ifndef _COMMIO_INT_H diff --git a/librb/include/commio-ssl.h b/librb/include/commio-ssl.h index 6e2bd69f0..adcce1ae3 100644 --- a/librb/include/commio-ssl.h +++ b/librb/include/commio-ssl.h @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio-ssl.h 26280 2008-12-10 20:25:29Z androsyn $ */ #ifndef _COMMIO_SSL_H diff --git a/librb/include/event-int.h b/librb/include/event-int.h index 993a78d00..4cabd3169 100644 --- a/librb/include/event-int.h +++ b/librb/include/event-int.h @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: event-int.h 26272 2008-12-10 05:55:10Z androsyn $ */ struct ev_entry diff --git a/librb/include/rb_balloc.h b/librb/include/rb_balloc.h index 7ca7857d6..ff6652001 100644 --- a/librb/include/rb_balloc.h +++ b/librb/include/rb_balloc.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_balloc.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_commio.h b/librb/include/rb_commio.h index 09317ce95..f51e04b17 100644 --- a/librb/include/rb_commio.h +++ b/librb/include/rb_commio.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_commio.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_event.h b/librb/include/rb_event.h index 61b6efaef..84d9d1725 100644 --- a/librb/include/rb_event.h +++ b/librb/include/rb_event.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_event.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_helper.h b/librb/include/rb_helper.h index 3287e8d9a..0b4a90865 100644 --- a/librb/include/rb_helper.h +++ b/librb/include/rb_helper.h @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_helper.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_linebuf.h b/librb/include/rb_linebuf.h index b1d8c847f..d0e0b9883 100644 --- a/librb/include/rb_linebuf.h +++ b/librb/include/rb_linebuf.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_linebuf.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_memory.h b/librb/include/rb_memory.h index d4dd6f0c2..1bc7af098 100644 --- a/librb/include/rb_memory.h +++ b/librb/include/rb_memory.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_memory.h 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_patricia.h b/librb/include/rb_patricia.h index 6ea803a96..6f2753af7 100644 --- a/librb/include/rb_patricia.h +++ b/librb/include/rb_patricia.h @@ -1,5 +1,4 @@ /* - * $Id: patricia.h 23020 2006-09-01 18:20:19Z androsyn $ * Dave Plonka * * This product includes software developed by the University of Michigan, diff --git a/librb/include/rb_rawbuf.h b/librb/include/rb_rawbuf.h index 523a17b10..91242e82a 100644 --- a/librb/include/rb_rawbuf.h +++ b/librb/include/rb_rawbuf.h @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id$ */ #ifndef RB_LIB_H diff --git a/librb/include/rb_tools.h b/librb/include/rb_tools.h index 31edb9f12..c60a483c0 100644 --- a/librb/include/rb_tools.h +++ b/librb/include/rb_tools.h @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_tools.h 26170 2008-10-26 20:59:07Z androsyn $ */ #ifndef RB_LIB_H diff --git a/librb/src/Makefile.am b/librb/src/Makefile.am index 7e1acd696..cd13ff69e 100644 --- a/librb/src/Makefile.am +++ b/librb/src/Makefile.am @@ -1,4 +1,3 @@ -# $Id: Makefile.am 26046 2008-09-09 16:37:30Z androsyn $ AUTOMAKE_OPTIONS = foreign diff --git a/librb/src/arc4random.c b/librb/src/arc4random.c index f65bab1be..f6f53c76f 100644 --- a/librb/src/arc4random.c +++ b/librb/src/arc4random.c @@ -1,4 +1,3 @@ -/* $Id: arc4random.c 26092 2008-09-19 15:13:52Z androsyn $ */ /* $$$: arc4random.c 2005/02/08 robert */ /* $NetBSD: arc4random.c,v 1.5.2.1 2004/03/26 22:52:50 jmc Exp $ */ /* $OpenBSD: arc4random.c,v 1.6 2001/06/05 05:05:38 pvalchev Exp $ */ diff --git a/librb/src/balloc.c b/librb/src/balloc.c index b7b036445..71b36cabf 100644 --- a/librb/src/balloc.c +++ b/librb/src/balloc.c @@ -28,7 +28,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: balloc.c 26100 2008-09-20 01:27:19Z androsyn $ */ /* diff --git a/librb/src/commio.c b/librb/src/commio.c index 1029d1caa..9fe8689c3 100644 --- a/librb/src/commio.c +++ b/librb/src/commio.c @@ -21,8 +21,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.c 26254 2008-12-10 04:04:38Z androsyn $ */ + #include #include #include diff --git a/librb/src/devpoll.c b/librb/src/devpoll.c index 2e99c092b..06d34ec04 100644 --- a/librb/src/devpoll.c +++ b/librb/src/devpoll.c @@ -22,8 +22,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: devpoll.c 26254 2008-12-10 04:04:38Z androsyn $ */ + #include #include #include diff --git a/librb/src/epoll.c b/librb/src/epoll.c index ac7c6be52..1d4d62723 100644 --- a/librb/src/epoll.c +++ b/librb/src/epoll.c @@ -23,8 +23,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: epoll.c 26294 2008-12-13 03:01:19Z androsyn $ */ + #define _GNU_SOURCE 1 #include diff --git a/librb/src/event.c b/librb/src/event.c index 1e1248305..cdf41474b 100644 --- a/librb/src/event.c +++ b/librb/src/event.c @@ -39,7 +39,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: event.c 26272 2008-12-10 05:55:10Z androsyn $ */ #include diff --git a/librb/src/gnutls.c b/librb/src/gnutls.c index 3bd65f80f..4038dc3dd 100644 --- a/librb/src/gnutls.c +++ b/librb/src/gnutls.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: gnutls.c 26296 2008-12-13 03:36:00Z androsyn $ */ #include diff --git a/librb/src/helper.c b/librb/src/helper.c index 0e653deaf..a8dabf3d9 100644 --- a/librb/src/helper.c +++ b/librb/src/helper.c @@ -19,8 +19,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: helper.c 26092 2008-09-19 15:13:52Z androsyn $ */ + #include #include #include diff --git a/librb/src/kqueue.c b/librb/src/kqueue.c index 7ab9cd72f..98e286b75 100644 --- a/librb/src/kqueue.c +++ b/librb/src/kqueue.c @@ -22,7 +22,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: kqueue.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include diff --git a/librb/src/linebuf.c b/librb/src/linebuf.c index 51c97cd95..f14d4a982 100644 --- a/librb/src/linebuf.c +++ b/librb/src/linebuf.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: linebuf.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include diff --git a/librb/src/mbedtls.c b/librb/src/mbedtls.c index a31b12e8e..0cf4330e0 100644 --- a/librb/src/mbedtls.c +++ b/librb/src/mbedtls.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id$ */ #include diff --git a/librb/src/nossl.c b/librb/src/nossl.c index 4cc9a06ef..e97843b93 100644 --- a/librb/src/nossl.c +++ b/librb/src/nossl.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.c 24808 2008-01-02 08:17:05Z androsyn $ */ diff --git a/librb/src/openssl.c b/librb/src/openssl.c index eea76c6f9..a8d998c4d 100644 --- a/librb/src/openssl.c +++ b/librb/src/openssl.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.c 24808 2008-01-02 08:17:05Z androsyn $ */ #include diff --git a/librb/src/patricia.c b/librb/src/patricia.c index 88f22077a..9db07138d 100644 --- a/librb/src/patricia.c +++ b/librb/src/patricia.c @@ -4,7 +4,6 @@ * This was then yanked out of the ratbox/devel/src tree and stuffed into * librb and had function names changed, but otherwise not really altered. * - * $Id: patricia.c 24244 2007-08-22 19:04:55Z androsyn $ * Dave Plonka * * This product includes software developed by the University of Michigan, diff --git a/librb/src/poll.c b/librb/src/poll.c index f53851b51..0356776cf 100644 --- a/librb/src/poll.c +++ b/librb/src/poll.c @@ -22,7 +22,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: poll.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include #include diff --git a/librb/src/ports.c b/librb/src/ports.c index 2963aef0b..1527a915b 100644 --- a/librb/src/ports.c +++ b/librb/src/ports.c @@ -23,7 +23,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: ports.c 26286 2008-12-10 23:28:53Z androsyn $ */ #include diff --git a/librb/src/rawbuf.c b/librb/src/rawbuf.c index 29b06fbfd..4e83270ba 100644 --- a/librb/src/rawbuf.c +++ b/librb/src/rawbuf.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id$ */ #include #include diff --git a/librb/src/rb_lib.c b/librb/src/rb_lib.c index 54fe3bf52..041200f91 100644 --- a/librb/src/rb_lib.c +++ b/librb/src/rb_lib.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_lib.c 26282 2008-12-10 20:33:21Z androsyn $ */ #include diff --git a/librb/src/rb_memory.c b/librb/src/rb_memory.c index 3caa06ca9..32b2689a0 100644 --- a/librb/src/rb_memory.c +++ b/librb/src/rb_memory.c @@ -21,7 +21,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: rb_memory.c 26092 2008-09-19 15:13:52Z androsyn $ */ #include #include diff --git a/librb/src/select.c b/librb/src/select.c index 6425e49d2..61d464a4e 100644 --- a/librb/src/select.c +++ b/librb/src/select.c @@ -22,8 +22,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: select.c 26092 2008-09-19 15:13:52Z androsyn $ */ + #define FD_SETSIZE 65535 #include #include diff --git a/librb/src/sigio.c b/librb/src/sigio.c index b847d0b02..d5faa171e 100644 --- a/librb/src/sigio.c +++ b/librb/src/sigio.c @@ -23,7 +23,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: sigio.c 26092 2008-09-19 15:13:52Z androsyn $ */ #ifndef _GNU_SOURCE diff --git a/librb/src/tools.c b/librb/src/tools.c index 03dd632e5..b42fdbaad 100644 --- a/librb/src/tools.c +++ b/librb/src/tools.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: tools.c 26170 2008-10-26 20:59:07Z androsyn $ * * Here is the original header: * @@ -32,6 +31,7 @@ * defined, tools.h will build inlined versions of the functions * on supported compilers */ + #define _GNU_SOURCE 1 #include #include diff --git a/librb/src/unix.c b/librb/src/unix.c index d1ae702e3..521f53298 100644 --- a/librb/src/unix.c +++ b/librb/src/unix.c @@ -21,8 +21,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: unix.c 26180 2008-11-11 00:00:12Z androsyn $ */ + #include #include diff --git a/librb/src/version.c.SH b/librb/src/version.c.SH index 6d0bf4426..22cb63f21 100644 --- a/librb/src/version.c.SH +++ b/librb/src/version.c.SH @@ -1,6 +1,5 @@ #!/bin/sh -# $Id: version.c.SH 24870 2008-01-10 16:51:01Z androsyn $ spitshell=cat package=librb @@ -21,7 +20,7 @@ $spitshell >version.c < From 52854df4ac5f189c4574b8a508017fb2d4be4d0b Mon Sep 17 00:00:00 2001 From: Andrew Wilcox Date: Wed, 23 Mar 2016 19:49:50 -0500 Subject: [PATCH 183/252] Invoke the standard system shell in autogen.sh This avoids a needless dependence on bash. --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 175e0ff53..fd14128a4 100755 --- a/autogen.sh +++ b/autogen.sh @@ -81,7 +81,7 @@ parse_options "$@" echo "Building librb autotools files." cd "$TOP_DIR"/librb -bash autogen.sh +sh autogen.sh echo "Building main autotools files." From 2e45f5d8086a3a0700e7926ea3f802ce8e13616d Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Wed, 23 Mar 2016 22:33:54 -0400 Subject: [PATCH 184/252] Cleanup more BSD-isms --- authd/reslib.h | 16 ++++++++-------- configure.ac | 30 ++---------------------------- include/hash.h | 8 ++++---- ircd/hash.c | 16 ++++++++-------- 4 files changed, 22 insertions(+), 48 deletions(-) diff --git a/authd/reslib.h b/authd/reslib.h index 38f7b8f39..e8917130c 100644 --- a/authd/reslib.h +++ b/authd/reslib.h @@ -78,24 +78,24 @@ typedef struct */ #define IRC_NS_GET16(s, cp) { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (s) = ((u_int16_t)t_cp[0] << 8) \ - | ((u_int16_t)t_cp[1]) \ + (s) = ((uint16_t)t_cp[0] << 8) \ + | ((uint16_t)t_cp[1]) \ ; \ (cp) += NS_INT16SZ; \ } #define IRC_NS_GET32(l, cp) { \ const unsigned char *t_cp = (const unsigned char *)(cp); \ - (l) = ((u_int32_t)t_cp[0] << 24) \ - | ((u_int32_t)t_cp[1] << 16) \ - | ((u_int32_t)t_cp[2] << 8) \ - | ((u_int32_t)t_cp[3]) \ + (l) = ((uint32_t)t_cp[0] << 24) \ + | ((uint32_t)t_cp[1] << 16) \ + | ((uint32_t)t_cp[2] << 8) \ + | ((uint32_t)t_cp[3]) \ ; \ (cp) += NS_INT32SZ; \ } #define IRC_NS_PUT16(s, cp) { \ - u_int16_t t_s = (u_int16_t)(s); \ + uint16_t t_s = (uint16_t)(s); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_s >> 8; \ *t_cp = t_s; \ @@ -103,7 +103,7 @@ typedef struct } #define IRC_NS_PUT32(l, cp) { \ - u_int32_t t_l = (u_int32_t)(l); \ + uint32_t t_l = (uint32_t)(l); \ unsigned char *t_cp = (unsigned char *)(cp); \ *t_cp++ = t_l >> 24; \ *t_cp++ = t_l >> 16; \ diff --git a/configure.ac b/configure.ac index 333a793d8..2911f973b 100644 --- a/configure.ac +++ b/configure.ac @@ -188,34 +188,8 @@ dnl Check for stdarg.h - if we can't find it, halt configure AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])]) AC_CHECK_FUNCS([strlcat strlcpy]) -AC_CHECK_TYPE([u_int32_t], [], -[ - AC_CHECK_TYPE([uint32_t], - [ - AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.]) - ], - [ - AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int]) - AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.]) - ]) -]) - -AC_CHECK_TYPE([u_int16_t], [], -[ - AC_CHECK_TYPE([uint16_t], - [ - AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute]) - ], - [ - AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int]) - AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.]) - ]) -]) - -AC_CHECK_TYPE([in_port_t], [], -[AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])], -[[#include -#include ]]) +AC_TYPE_INT16_T +AC_TYPE_INT32_T AC_CHECK_TYPE([sa_family_t], [], [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], diff --git a/include/hash.h b/include/hash.h index 4aba22ccf..c2d220dbb 100644 --- a/include/hash.h +++ b/include/hash.h @@ -65,10 +65,10 @@ struct ConfItem; struct cachefile; struct nd_entry; -extern u_int32_t fnv_hash_upper(const unsigned char *s, int bits); -extern u_int32_t fnv_hash(const unsigned char *s, int bits); -extern u_int32_t fnv_hash_len(const unsigned char *s, int bits, int len); -extern u_int32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len); +extern uint32_t fnv_hash_upper(const unsigned char *s, int bits); +extern uint32_t fnv_hash(const unsigned char *s, int bits); +extern uint32_t fnv_hash_len(const unsigned char *s, int bits, int len); +extern uint32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len); extern void init_hash(void); diff --git a/ircd/hash.c b/ircd/hash.c index c1ef81cbc..172734d3a 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -70,10 +70,10 @@ init_hash(void) hostname_tree = rb_radixtree_create("hostname", irccasecanon); } -u_int32_t +uint32_t fnv_hash_upper(const unsigned char *s, int bits) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; while (*s) { @@ -85,10 +85,10 @@ fnv_hash_upper(const unsigned char *s, int bits) return h; } -u_int32_t +uint32_t fnv_hash(const unsigned char *s, int bits) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; while (*s) { @@ -100,10 +100,10 @@ fnv_hash(const unsigned char *s, int bits) return h; } -u_int32_t +uint32_t fnv_hash_len(const unsigned char *s, int bits, int len) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; const unsigned char *x = s + len; while (*s && s < x) { @@ -115,10 +115,10 @@ fnv_hash_len(const unsigned char *s, int bits, int len) return h; } -u_int32_t +uint32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len) { - u_int32_t h = FNV1_32_INIT; + uint32_t h = FNV1_32_INIT; const unsigned char *x = s + len; while (*s && s < x) { From cf623e08025ebed7542cfc829e70fa1b9ded4b08 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Wed, 23 Mar 2016 22:51:03 -0400 Subject: [PATCH 185/252] authd: Fix windows build Replace stray NO with false --- authd/getaddrinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/authd/getaddrinfo.c b/authd/getaddrinfo.c index e0524b35e..43384c426 100644 --- a/authd/getaddrinfo.c +++ b/authd/getaddrinfo.c @@ -30,6 +30,7 @@ #ifdef _WIN32 #include #include "getaddrinfo.h" +#include "stdinc.h" static const char in_addrany[] = { 0, 0, 0, 0 }; static const char in_loopback[] = { 127, 0, 0, 1 }; @@ -187,7 +188,8 @@ str_isnumber(const char *p) char *ep; if (*p == '\0') - return NO; + return false; + ep = NULL; errno = 0; (void)strtoul(p, &ep, 10); From 410fcc233fd5ae0b8c58a1de845796bfb13cfd31 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 21:59:48 -0500 Subject: [PATCH 186/252] authd/rdns: rename a function --- authd/providers/rdns.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index 013d6d6c6..ff3768d3d 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -50,7 +50,7 @@ typedef enum static void client_fail(struct auth_client *auth, dns_message message); static void client_success(struct auth_client *auth); -static void get_dns_answer(const char *res, bool status, query_type type, void *data); +static void dns_answer_callback(const char *res, bool status, query_type type, void *data); static struct ev_entry *timeout_ev; static EVH timeout_dns_queries_event; @@ -85,7 +85,7 @@ bool client_dns_start(struct auth_client *auth) auth->data[PROVIDER_RDNS] = query; - query->query = lookup_hostname(auth->c_ip, get_dns_answer, auth); + query->query = lookup_hostname(auth->c_ip, dns_answer_callback, auth); notice_client(auth, messages[REPORT_LOOKUP]); set_provider(auth, PROVIDER_RDNS); @@ -101,7 +101,7 @@ void client_dns_cancel(struct auth_client *auth) } static void -get_dns_answer(const char *res, bool status, query_type type, void *data) +dns_answer_callback(const char *res, bool status, query_type type, void *data) { struct auth_client *auth = data; struct user_query *query = auth->data[PROVIDER_RDNS]; From 491b3b39d5e79a2dafe164c942383efa7dc6201d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 22:03:24 -0500 Subject: [PATCH 187/252] cleanup: u_long -> unsigned long --- librb/include/rb_lib.h | 2 +- librb/include/rb_patricia.h | 1 - librb/src/crypt.c | 2 +- librb/src/win32.c | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h index bc4eb502a..ed0a344fe 100644 --- a/librb/include/rb_lib.h +++ b/librb/include/rb_lib.h @@ -113,7 +113,7 @@ char *rb_strerror(int error); #define EAFNOSUPPORT WSAEAFNOSUPPORT #define pipe(x) _pipe(x, 1024, O_BINARY) -#define ioctl(x,y,z) ioctlsocket(x,y, (u_long *)z) +#define ioctl(x,y,z) ioctlsocket(x,y, (unsigned long *)z) #define WNOHANG 1 diff --git a/librb/include/rb_patricia.h b/librb/include/rb_patricia.h index 6f2753af7..79b9fecb4 100644 --- a/librb/include/rb_patricia.h +++ b/librb/include/rb_patricia.h @@ -24,7 +24,6 @@ #define INET6_ADDRSTRLEN 46 #endif -/* typedef unsigned int u_int; */ #define rb_prefix_touchar(prefix) ((unsigned char *)&(prefix)->add.sin) #define MAXLINE 1024 #define BIT_TEST(f, b) ((f) & (b)) diff --git a/librb/src/crypt.c b/librb/src/crypt.c index 4b807c7ef..9344e988d 100644 --- a/librb/src/crypt.c +++ b/librb/src/crypt.c @@ -754,7 +754,7 @@ rb_des_crypt(const char *key, const char *setting) #define MD5_SIZE 16 static void -_crypt_to64(char *s, u_long v, int n) +_crypt_to64(char *s, unsigned long v, int n) { while (--n >= 0) { *s++ = ascii64[v&0x3f]; diff --git a/librb/src/win32.c b/librb/src/win32.c index b43b8f6da..a3b8ceaaf 100644 --- a/librb/src/win32.c +++ b/librb/src/win32.c @@ -414,7 +414,7 @@ rb_setup_fd_win32(rb_fde_t *F) { case RB_FD_SOCKET: { - u_long nonb = 1; + unsigned long nonb = 1; if(ioctlsocket((SOCKET) F->fd, FIONBIO, &nonb) == -1) { rb_get_errno(); From 1346cd1151ccfc461b5d69a68ef2a28855de4bd7 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Wed, 23 Mar 2016 22:17:47 -0500 Subject: [PATCH 188/252] Add BlindSight to the credits --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 7db8cc560..af2df0bea 100644 --- a/CREDITS +++ b/CREDITS @@ -26,6 +26,7 @@ in nick-alphabetical order: AndroSyn, Aaron Sethman anfl, Lee Hardy beu, Elfyn McBratney +BlindSight, Matt Ullman Entrope, Michael Poole gxti, Michael Tharp Taros, Brett Greenham From 3a46803fef07dd1890f5a456a41089bb3831756d Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 01:54:39 -0400 Subject: [PATCH 189/252] channel: Move check_channel_name() to a boolean --- include/channel.h | 2 +- ircd/channel.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/channel.h b/include/channel.h index 9069296e1..5c266e911 100644 --- a/include/channel.h +++ b/include/channel.h @@ -231,7 +231,7 @@ extern void invalidate_bancache_user(struct Client *); extern void free_channel_list(rb_dlink_list *); -extern int check_channel_name(const char *name); +extern bool check_channel_name(const char *name); extern void channel_member_names(struct Channel *chptr, struct Client *, int show_eon); diff --git a/ircd/channel.c b/ircd/channel.c index 717df263e..07501bd31 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -336,23 +336,23 @@ invalidate_bancache_user(struct Client *client_p) /* check_channel_name() * * input - channel name - * output - 1 if valid channel name, else 0 + * output - true if valid channel name, else 0 * side effects - */ -int +bool check_channel_name(const char *name) { s_assert(name != NULL); if(name == NULL) - return 0; + return false; for (; *name; ++name) { if(!IsChanChar(*name)) - return 0; + return false; } - return 1; + return true; } /* free_channel_list() From 216f58a27c00a514c80c0db80e7d83cadd72f739 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 02:14:03 -0400 Subject: [PATCH 190/252] channel: Change check_channel_name() note to false [ci skip] --- ircd/channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/channel.c b/ircd/channel.c index 07501bd31..d4fe10e20 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -336,7 +336,7 @@ invalidate_bancache_user(struct Client *client_p) /* check_channel_name() * * input - channel name - * output - true if valid channel name, else 0 + * output - true if valid channel name, else false * side effects - */ bool From 3b9507d0e973da824335f01384aac8d367229969 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 02:19:30 -0400 Subject: [PATCH 191/252] channel: Move flood_attack_channel() to a boolean --- include/channel.h | 2 +- ircd/channel.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/channel.h b/include/channel.h index 5c266e911..a25f191e0 100644 --- a/include/channel.h +++ b/include/channel.h @@ -213,7 +213,7 @@ extern void destroy_channel(struct Channel *); extern int can_send(struct Channel *chptr, struct Client *who, struct membership *); -extern int flood_attack_channel(int p_or_n, struct Client *source_p, +extern bool flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, char *chname); extern int is_banned(struct Channel *chptr, struct Client *who, struct membership *msptr, const char *, const char *, const char **); diff --git a/ircd/channel.c b/ircd/channel.c index d4fe10e20..4609325ab 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -901,11 +901,11 @@ can_send(struct Channel *chptr, struct Client *source_p, struct membership *mspt * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC * says NOTICE must not auto reply * - pointer to source Client - * - pointer to target channel - * output - 1 if target is under flood attack + * - pointer to target channel + * output - true if target is under flood attack * side effects - check for flood attack on target chptr */ -int +bool flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, char *chname) { int delta; @@ -943,13 +943,13 @@ flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, sendto_one(source_p, ":%s NOTICE %s :*** Message to %s throttled due to flooding", me.name, source_p->name, chptr->chname); - return 1; + return true; } else chptr->received_number_of_privmsgs++; } - return 0; + return false; } /* find_bannickchange_channel() From 2a4b3ea648955867b316a6e504a154f24d005707 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 04:00:23 -0400 Subject: [PATCH 192/252] version.c.SH: Fix generation not incrementing --- ircd/version.c.SH | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ircd/version.c.SH b/ircd/version.c.SH index c02158a3b..ff055ffaa 100644 --- a/ircd/version.c.SH +++ b/ircd/version.c.SH @@ -7,7 +7,7 @@ echo "Extracting $package/src/version.c..." if test -r version.c.last then - generation=`sed -n 's/^char \*generation = \"\(.*\)\";/\1/p' < version.c.last` + generation=`sed -n 's/^const char \*generation = \"\(.*\)\";/\1/p' < version.c.last` if test ! "$generation" ; then generation=0; fi else generation=0 @@ -63,7 +63,7 @@ const char *infotext[] = "$package --", "Based on the original code written by Jarkko Oikarinen", "Copyright 1988, 1989, 1990, 1991 University of Oulu, Computing Center", - "Copyright (c) 1996-2001 Hybrid Development Team", + "Copyright (c) 1996-2001 Hybrid Development Team", "Copyright (c) 2002-2009 ircd-ratbox Development Team", "Copyright (c) 2005-2016 charybdis development team", " ", From 25a899651d1ebe92d8ccf850a68252372419b730 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 13:52:16 -0400 Subject: [PATCH 193/252] ssld: Move plain_check_cork() to a boolean --- ssld/ssld.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ssld/ssld.c b/ssld/ssld.c index 403a71a15..7a0dc20f5 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -459,7 +459,7 @@ common_zlib_inflate(conn_t * conn, void *buf, size_t len) } #endif -static int +static bool plain_check_cork(conn_t * conn) { if(rb_rawbuf_length(conn->modbuf_out) >= 4096) @@ -470,9 +470,9 @@ plain_check_cork(conn_t * conn) rb_setselect(conn->plain_fd, RB_SELECT_READ, NULL, NULL); /* try to write */ conn_mod_write_sendq(conn->mod_fd, conn); - return 1; + return true; } - return 0; + return false; } From 9aa639eddddf888b094204a7c77693b653ef334c Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 14:26:02 -0400 Subject: [PATCH 194/252] chmode: Move allow_mode_change() to a boolean --- ircd/chmode.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ircd/chmode.c b/ircd/chmode.c index cefcdbd31..27fc899db 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -202,10 +202,10 @@ get_channel_access(struct Client *source_p, struct Channel *chptr, struct member * Checks if mlock and chanops permit a mode change. * * inputs - client, channel, access level, errors pointer, mode char - * outputs - 0 on failure, 1 on success + * outputs - false on failure, true on success * side effects - error message sent on failure */ -static int +static bool allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel, int *errors, char c) { @@ -220,7 +220,7 @@ allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel, c, chptr->mode_lock); *errors |= SM_ERR_MLOCK; - return 0; + return false; } if(alevel < CHFL_CHANOP) { @@ -228,9 +228,9 @@ allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel, sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), me.name, source_p->name, chptr->chname); *errors |= SM_ERR_NOOPS; - return 0; + return false; } - return 1; + return true; } /* add_id() From a383180a0ae9c52d9976fe79e0881c8dbeec949c Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 14:37:52 -0400 Subject: [PATCH 195/252] chmode: Move add_id() to a boolean --- include/channel.h | 2 +- ircd/chmode.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/channel.h b/include/channel.h index a25f191e0..ddbb951df 100644 --- a/include/channel.h +++ b/include/channel.h @@ -264,7 +264,7 @@ extern void set_channel_mlock(struct Client *client_p, struct Client *source_p, extern struct ChannelMode chmode_table[256]; -extern int add_id(struct Client *source_p, struct Channel *chptr, const char *banid, +extern bool add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const char *forward, rb_dlink_list * list, long mode_type); extern struct Ban * del_id(struct Channel *chptr, const char *banid, rb_dlink_list * list, diff --git a/ircd/chmode.c b/ircd/chmode.c index 27fc899db..e203e386c 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -236,10 +236,10 @@ allow_mode_change(struct Client *source_p, struct Channel *chptr, int alevel, /* add_id() * * inputs - client, channel, id to add, type, forward - * outputs - 0 on failure, 1 on success + * outputs - false on failure, true on success * side effects - given id is added to the appropriate list */ -int +bool add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const char *forward, rb_dlink_list * list, long mode_type) { @@ -257,14 +257,14 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const { sendto_one(source_p, form_str(ERR_BANLISTFULL), me.name, source_p->name, chptr->chname, realban); - return 0; + return false; } RB_DLINK_FOREACH(ptr, list->head) { actualBan = ptr->data; if(mask_match(actualBan->banstr, realban)) - return 0; + return false; } } /* dont let remotes set duplicates */ @@ -274,7 +274,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const { actualBan = ptr->data; if(!irccmp(actualBan->banstr, realban)) - return 0; + return false; } } @@ -293,7 +293,7 @@ add_id(struct Client *source_p, struct Channel *chptr, const char *banid, const if(mode_type == CHFL_BAN || mode_type == CHFL_QUIET || mode_type == CHFL_EXCEPTION) chptr->bants++; - return 1; + return true; } /* del_id() From e0a9b5d3bf717b4f6b43b6632abc0ff302a53576 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Thu, 24 Mar 2016 14:42:54 -0400 Subject: [PATCH 196/252] chmode: Move check_forward() to a boolean --- ircd/chmode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ircd/chmode.c b/ircd/chmode.c index e203e386c..c3182d1fd 100644 --- a/ircd/chmode.c +++ b/ircd/chmode.c @@ -486,7 +486,7 @@ pretty_mask(const char *idmask) * output - true if forwarding should be allowed * side effects - numeric sent if not allowed */ -static int +static bool check_forward(struct Client *source_p, struct Channel *chptr, const char *forward) { @@ -497,20 +497,20 @@ check_forward(struct Client *source_p, struct Channel *chptr, (MyClient(source_p) && (strlen(forward) > LOC_CHANNELLEN || hash_find_resv(forward)))) { sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward); - return 0; + return false; } /* don't forward to inconsistent target -- jilles */ if(chptr->chname[0] == '#' && forward[0] == '&') { sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward); - return 0; + return false; } if(MyClient(source_p) && (targptr = find_channel(forward)) == NULL) { sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), forward); - return 0; + return false; } if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET)) { @@ -519,10 +519,10 @@ check_forward(struct Client *source_p, struct Channel *chptr, { sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), me.name, source_p->name, targptr->chname); - return 0; + return false; } } - return 1; + return true; } /* fix_key() From ac2f2189f961bd1d38f43ab37b1c7dcdbfdc8995 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 24 Mar 2016 18:21:11 -0500 Subject: [PATCH 197/252] librb: define RB_PATH_SEPARATOR --- librb/include/rb_lib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/librb/include/rb_lib.h b/librb/include/rb_lib.h index ed0a344fe..4003a832d 100644 --- a/librb/include/rb_lib.h +++ b/librb/include/rb_lib.h @@ -69,9 +69,11 @@ char *alloca(); #ifdef _WIN32 #define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0) typedef SOCKET rb_platform_fd_t; +#define RB_PATH_SEPARATOR '\\' #else #define rb_get_errno() typedef int rb_platform_fd_t; +#define RB_PATH_SEPARATOR '/' #endif #ifdef _WIN32 From 4d8cfacd95530550b075c38efa447d5673cb822e Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 24 Mar 2016 18:45:28 -0500 Subject: [PATCH 198/252] ircd: start staging for relocatable paths --- include/defaults.h | 21 +++++++++++++++++++++ ircd/authd.c | 14 +++++++------- ircd/bandbi.c | 10 +++++----- ircd/cache.c | 16 ++++++++-------- ircd/ircd.c | 29 ++++++++++++++++++++++++----- ircd/ircd_lexer.l | 4 ++-- ircd/modules.c | 12 ++++++------ ircd/restart.c | 4 ++-- ircd/sslproc.c | 8 ++++---- modules/m_rehash.c | 2 +- 10 files changed, 80 insertions(+), 40 deletions(-) diff --git a/include/defaults.h b/include/defaults.h index 29b05cfb3..599b2611f 100644 --- a/include/defaults.h +++ b/include/defaults.h @@ -36,6 +36,27 @@ * First, set other fd limits based on values from user */ +typedef enum { + IRCD_PATH_PREFIX, + IRCD_PATH_MODULES, + IRCD_PATH_AUTOLOAD_MODULES, + IRCD_PATH_ETC, + IRCD_PATH_LOG, + IRCD_PATH_USERHELP, + IRCD_PATH_OPERHELP, + IRCD_PATH_IRCD_EXEC, + IRCD_PATH_IRCD_CONF, + IRCD_PATH_IRCD_MOTD, + IRCD_PATH_IRCD_LOG, + IRCD_PATH_IRCD_PID, + IRCD_PATH_IRCD_OMOTD, + IRCD_PATH_BANDB, + IRCD_PATH_BIN, + IRCD_PATH_LIBEXEC, + IRCD_PATH_COUNT +} ircd_path_t; + +extern const char *ircd_paths[IRCD_PATH_COUNT]; #define MAXCONNECTIONS 65535 /* default max connections if getrlimit doesn't work */ /* class {} default values */ diff --git a/ircd/authd.c b/ircd/authd.c index 491d02379..30dd30cbb 100644 --- a/ircd/authd.c +++ b/ircd/authd.c @@ -55,20 +55,20 @@ start_authd(void) #endif if(authd_path == NULL) { - snprintf(fullpath, sizeof(fullpath), "%s/authd%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cauthd%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { - snprintf(fullpath, sizeof(fullpath), "%s/libexec/charybdis/authd%s", - ConfigFileEntry.dpath, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbin%cauthd%s", + ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { ilog(L_MAIN, - "Unable to execute authd in %s or %s/libexec/charybdis", - PKGLIBEXECDIR, ConfigFileEntry.dpath); + "Unable to execute authd in %s or %s/bin", + ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); sendto_realops_snomask(SNO_GENERAL, L_ALL, - "Unable to execute authd in %s or %s/libexec/charybdis", - PKGLIBEXECDIR, ConfigFileEntry.dpath); + "Unable to execute authd in %s or %s/bin", + ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); return 1; } diff --git a/ircd/bandbi.c b/ircd/bandbi.c index aa9410d29..15171b646 100644 --- a/ircd/bandbi.c +++ b/ircd/bandbi.c @@ -80,21 +80,21 @@ start_bandb(void) const char *suffix = ""; #endif - rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1); + rb_setenv("BANDB_DBPATH", ircd_paths[IRCD_PATH_BANDB], 1); if(bandb_path == NULL) { - snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbandb%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { - snprintf(fullpath, sizeof(fullpath), "%s/bin/bandb%s", - ConfigFileEntry.dpath, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbin%cbandb%s", + ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { ilog(L_MAIN, "Unable to execute bandb%s in %s or %s/bin", - suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath); + suffix, ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); return 0; } } diff --git a/ircd/cache.c b/ircd/cache.c index 1a2cb14fa..3e40eb368 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -64,8 +64,8 @@ init_cache(void) user_motd_changed[0] = '\0'; - user_motd = cache_file(MPATH, "ircd.motd", 0); - oper_motd = cache_file(OPATH, "opers.motd", 0); + user_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_MOTD], "ircd.motd", 0); + oper_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_OMOTD], "opers.motd", 0); memset(&links_cache_list, 0, sizeof(links_cache_list)); help_dict_oper = rb_dictionary_create("oper help", strcasecmp); @@ -253,7 +253,7 @@ load_help(void) free_cachefile(cacheptr); } - helpfile_dir = opendir(HPATH); + helpfile_dir = opendir(ircd_paths[IRCD_PATH_OPERHELP]); if(helpfile_dir == NULL) return; @@ -262,13 +262,13 @@ load_help(void) { if(ldirent->d_name[0] == '.') continue; - snprintf(filename, sizeof(filename), "%s/%s", HPATH, ldirent->d_name); + snprintf(filename, sizeof(filename), "%s%c%s", ircd_paths[IRCD_PATH_OPERHELP], RB_PATH_SEPARATOR, ldirent->d_name); cacheptr = cache_file(filename, ldirent->d_name, HELP_OPER); rb_dictionary_add(help_dict_oper, cacheptr->name, cacheptr); } closedir(helpfile_dir); - helpfile_dir = opendir(UHPATH); + helpfile_dir = opendir(ircd_path[IRCD_PATH_USERHELP]); if(helpfile_dir == NULL) return; @@ -277,7 +277,7 @@ load_help(void) { if(ldirent->d_name[0] == '.') continue; - snprintf(filename, sizeof(filename), "%s/%s", UHPATH, ldirent->d_name); + snprintf(filename, sizeof(filename), "%s%c%s", ircd_paths[IRCD_PATH_USERHELP], RB_PATH_SEPARATOR, ldirent->d_name); #if defined(S_ISLNK) && defined(HAVE_LSTAT) if(lstat(filename, &sb) < 0) @@ -341,7 +341,7 @@ cache_user_motd(void) struct stat sb; struct tm *local_tm; - if(stat(MPATH, &sb) == 0) + if(stat(ircd_paths[IRCD_PATH_IRCD_MOTD], &sb) == 0) { local_tm = localtime(&sb.st_mtime); @@ -355,7 +355,7 @@ cache_user_motd(void) } } free_cachefile(user_motd); - user_motd = cache_file(MPATH, "ircd.motd", 0); + user_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_MOTD], "ircd.motd", 0); } diff --git a/ircd/ircd.c b/ircd/ircd.c index b3f1b5d0b..2012ad372 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -94,9 +94,6 @@ rb_dlink_list global_serv_list; /* global servers on the network */ rb_dlink_list local_oper_list; /* our opers, duplicated in lclient_list */ rb_dlink_list oper_list; /* network opers */ -const char *logFileName = LPATH; -const char *pidFileName = PPATH; - char **myargv; bool dorehash = false; bool dorehashbans = false; @@ -118,6 +115,28 @@ int split_users; int split_servers; int eob_count; +const char *ircd_paths[IRCD_PATH_COUNT] = { + [IRCD_PATH_PREFIX] = DPATH, + [IRCD_PATH_MODULES] = MODPATH, + [IRCD_PATH_AUTOLOAD_MODULES] = AUTOMODPATH, + [IRCD_PATH_ETC] = ETCPATH, + [IRCD_PATH_LOG] = LOGPATH, + [IRCD_PATH_USERHELP] = UHPATH, + [IRCD_PATH_OPERHELP] = HPATH, + [IRCD_PATH_IRCD_EXEC] = SPATH, + [IRCD_PATH_IRCD_CONF] = CPATH, + [IRCD_PATH_IRCD_MOTD] = MPATH, + [IRCD_PATH_IRCD_LOG] = LPATH, + [IRCD_PATH_IRCD_PID] = PPATH, + [IRCD_PATH_IRCD_OMOTD] = OPATH, + [IRCD_PATH_BANDB] = DBPATH, + [IRCD_PATH_BIN] = BINPATH, + [IRCD_PATH_LIBEXEC] = PKGLIBEXECDIR, +}; + +const char *logFileName = LPATH; +const char *pidFileName = PPATH; + void ircd_shutdown(const char *reason) { @@ -562,8 +581,8 @@ charybdis_main(int argc, char *argv[]) init_sys(); - ConfigFileEntry.dpath = DPATH; - ConfigFileEntry.configfile = CPATH; /* Server configuration file */ + ConfigFileEntry.dpath = ircd_paths[IRCD_PATH_PREFIX]; + ConfigFileEntry.configfile = ircd_paths[IRCD_PATH_IRCD_CONF]; /* Server configuration file */ ConfigFileEntry.connect_timeout = 30; /* Default to 30 */ umask(077); /* better safe than sorry --SRB */ diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index 4ccee128d..ae96b407d 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -193,10 +193,10 @@ void cinclude(void) if (tmp_fbfile_in == NULL) { - /* if its not found in PREFIX, look in ETCPATH */ + /* if its not found in PREFIX, look in IRCD_PATH_ETC */ char fnamebuf[BUFSIZE]; - snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ETCPATH, c); + snprintf(fnamebuf, sizeof(fnamebuf), "%s%c%s", IRCD_PATH_ETC, RB_PATH_SEPARATOR, c); tmp_fbfile_in = fopen(fnamebuf, "r"); /* wasnt found there either.. error. */ diff --git a/ircd/modules.c b/ircd/modules.c index da3da9471..2173dd69f 100644 --- a/ircd/modules.c +++ b/ircd/modules.c @@ -129,8 +129,8 @@ modules_init(void) mod_add_cmd(&modrestart_msgtab); /* Add the default paths we look in to the module system --nenolod */ - mod_add_path(MODPATH); - mod_add_path(AUTOMODPATH); + mod_add_path(ircd_paths[IRCD_PATH_MODULES]); + mod_add_path(ircd_paths[IRCD_PATH_AUTOLOAD_MODULES]); } /* mod_find_path() @@ -243,11 +243,11 @@ load_all_modules(int warn) max_mods = MODS_INCREMENT; - system_module_dir = opendir(AUTOMODPATH); + system_module_dir = opendir(ircd_paths[IRCD_PATH_AUTOLOAD_MODULES]); if(system_module_dir == NULL) { - ilog(L_MAIN, "Could not load modules from %s: %s", AUTOMODPATH, strerror(errno)); + ilog(L_MAIN, "Could not load modules from %s: %s", ircd_paths[IRCD_PATH_AUTOLOAD_MODULES], strerror(errno)); return; } @@ -258,7 +258,7 @@ load_all_modules(int warn) len = strlen(ldirent->d_name); if(len > module_ext_len && !strcasecmp(ldirent->d_name + (len - module_ext_len), LT_MODULE_EXT)) { - (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s", AUTOMODPATH, ldirent->d_name); + (void) snprintf(module_fq_name, sizeof(module_fq_name), "%s%c%s", ircd_paths[IRCD_PATH_AUTOLOAD_MODULES], RB_PATH_SEPARATOR, ldirent->d_name); (void) load_a_module(module_fq_name, warn, MAPI_ORIGIN_CORE, 0); } @@ -281,7 +281,7 @@ load_core_modules(int warn) for (i = 0; core_module_table[i]; i++) { - snprintf(module_name, sizeof(module_name), "%s/%s%s", MODPATH, + snprintf(module_name, sizeof(module_name), "%s%c%s%s", ircd_paths[IRCD_PATH_MODULES], RB_PATH_SEPARATOR, core_module_table[i], LT_MODULE_EXT); if(load_a_module(module_name, warn, MAPI_ORIGIN_CORE, 1) == -1) diff --git a/ircd/restart.c b/ircd/restart.c index 1a63b5726..f91f9293c 100644 --- a/ircd/restart.c +++ b/ircd/restart.c @@ -72,10 +72,10 @@ server_reboot(void) close(i); unlink(pidFileName); - execv(SPATH, (void *)myargv); + execv(ircd_paths[IRCD_PATH_IRCD_EXEC], (void *)myargv); /* use this if execv of SPATH fails */ - snprintf(path, sizeof(path), "%s/bin/ircd", ConfigFileEntry.dpath); + snprintf(path, sizeof(path), "%s%cbin%circd", ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); execv(path, (void *)myargv); exit(-1); diff --git a/ircd/sslproc.c b/ircd/sslproc.c index 6d53caf3a..2edd091eb 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -278,17 +278,17 @@ start_ssldaemon(int count, const char *ssl_cert, const char *ssl_private_key, co if(ssld_path == NULL) { - snprintf(fullpath, sizeof(fullpath), "%s/ssld%s", PKGLIBEXECDIR, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cssld%s", ircd_paths[IRCD_PATH_LIBEXEC], RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { - snprintf(fullpath, sizeof(fullpath), "%s/bin/ssld%s", - ConfigFileEntry.dpath, suffix); + snprintf(fullpath, sizeof(fullpath), "%s%cbin%cssld%s", + ConfigFileEntry.dpath, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR, suffix); if(access(fullpath, X_OK) == -1) { ilog(L_MAIN, "Unable to execute ssld%s in %s or %s/bin", - suffix, PKGLIBEXECDIR, ConfigFileEntry.dpath); + suffix, ircd_paths[IRCD_PATH_LIBEXEC], ConfigFileEntry.dpath); return 0; } } diff --git a/modules/m_rehash.c b/modules/m_rehash.c index bd6670aaa..3151abfa8 100644 --- a/modules/m_rehash.c +++ b/modules/m_rehash.c @@ -117,7 +117,7 @@ rehash_omotd(struct Client *source_p) remote_rehash_oper_p = source_p; free_cachefile(oper_motd); - oper_motd = cache_file(OPATH, "opers.motd", 0); + oper_motd = cache_file(ircd_paths[IRCD_PATH_IRCD_OMOTD], "opers.motd", 0); } static void From 0d180487b456b0f68ea39429fe0d0f71a2e38a6d Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 24 Mar 2016 18:50:13 -0500 Subject: [PATCH 199/252] ircd: unbreak build --- ircd/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ircd/cache.c b/ircd/cache.c index 3e40eb368..b5581f520 100644 --- a/ircd/cache.c +++ b/ircd/cache.c @@ -268,7 +268,7 @@ load_help(void) } closedir(helpfile_dir); - helpfile_dir = opendir(ircd_path[IRCD_PATH_USERHELP]); + helpfile_dir = opendir(ircd_paths[IRCD_PATH_USERHELP]); if(helpfile_dir == NULL) return; From 80a0125f362ce7cab9a55ed8d919aafd3f366dca Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 24 Mar 2016 18:55:30 -0500 Subject: [PATCH 200/252] configure: define ENABLE_FHS_PATHS if built with --enable-fhs-paths, this will disable the path relocation code --- configure.ac | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 2911f973b..a36786254 100644 --- a/configure.ac +++ b/configure.ac @@ -121,7 +121,8 @@ AS_IF([test "x$enable_fhs_paths" = "xyes"], pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}' rundir=${rundir-'${prefix}/run'} pkgrundir='${rundir}/${PACKAGE_TARNAME}' - pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'], + pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}' + AC_DEFINE([ENABLE_FHS_PATHS], [1], [Uncomment if FHS pathnames are enabled])], [libexecdir='${bindir}' pkglibexecdir='${libexecdir}' rundir='${sysconfdir}' From 89d22b9af5597800fa9cb711f42daecfb6800029 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 24 Mar 2016 19:23:49 -0500 Subject: [PATCH 201/252] authd/provider: cleanups --- authd/provider.c | 35 +++++++++++++++++++++++++++++------ authd/provider.h | 12 +++++++----- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index 3cd489c2b..d227bed30 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -18,14 +18,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* So the basic design here is to have "authentication providers" that do - * things like query ident and blacklists and even open proxies. +/* The basic design here is to have "authentication providers" that do things + * like query ident and blacklists and even open proxies. * * Providers are registered in the auth_providers linked list. It is planned to * use a bitmap to store provider ID's later. * - * Providers can either return failure immediately, immediate acceptance, or - * do work in the background (calling set_provider to signal this). + * Providers can either return failure immediately, immediate acceptance, or do + * work in the background (calling set_provider to signal this). * * Provider-specific data for each client can be kept in an index of the data * struct member (using the provider's ID). @@ -40,6 +40,9 @@ * should call provider_done. Do NOT call this if you have accepted or rejected * the client. * + * Eventually, stuff like *:line handling will be moved here, but that means we + * have to talk to bandb directly first. + * * --Elizafox, 9 March 2016 */ @@ -185,9 +188,29 @@ void accept_client(struct auth_client *auth, provider_t id) } /* Send a notice to a client */ -void notice_client(struct auth_client *auth, const char *notice) +void notice_client(struct auth_client *auth, const char *fmt, ...) { - rb_helper_write(authd_helper, "N %x :%s", auth->cid, notice); + char buf[BUFSIZE]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + rb_helper_write(authd_helper, "N %x :%s", auth->cid, buf); +} + +/* Send a warning to the IRC daemon for logging, etc. */ +void warn_opers(provider_t id, const char *fmt, ...) +{ + char buf[BUFSIZE]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + rb_helper_write(authd_helper, "W %c :%s", id, buf); } /* Begin authenticating user */ diff --git a/authd/provider.h b/authd/provider.h index 5fa0962bd..84d623181 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -56,11 +56,12 @@ struct auth_client }; typedef bool (*provider_init_t)(void); -typedef bool (*provider_perform_t)(struct auth_client *); -typedef void (*provider_complete_t)(struct auth_client *, provider_t provider); -typedef void (*provider_cancel_t)(struct auth_client *); typedef void (*provider_destroy_t)(void); +typedef bool (*provider_start_t)(struct auth_client *); +typedef void (*provider_cancel_t)(struct auth_client *); +typedef void (*provider_complete_t)(struct auth_client *, provider_t provider); + struct auth_provider { rb_dlink_node node; @@ -70,7 +71,7 @@ struct auth_provider provider_init_t init; /* Initalise the provider */ provider_destroy_t destroy; /* Terminate the provider */ - provider_perform_t start; /* Perform authentication */ + provider_start_t start; /* Perform authentication */ provider_cancel_t cancel; /* Authentication cancelled */ provider_complete_t completed; /* Callback for when other performers complete (think dependency chains) */ }; @@ -92,7 +93,8 @@ void provider_done(struct auth_client *auth, provider_t id); void accept_client(struct auth_client *auth, provider_t id); void reject_client(struct auth_client *auth, provider_t id, const char *reason); -void notice_client(struct auth_client *auth, const char *notice); +void notice_client(struct auth_client *auth, const char *fmt, ...); +void warn_opers(provider_t id, const char *fmt, ...); void handle_new_connection(int parc, char *parv[]); From b2ede1aa71ccb604cde0ba38b2951ea72a99db11 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Thu, 24 Mar 2016 19:36:41 -0500 Subject: [PATCH 202/252] actually use warn_opers function --- authd/authd.c | 8 ++++++-- authd/provider.c | 11 ++++++++--- authd/provider.h | 10 +++++++++- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 335f55f51..e11451845 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -49,8 +49,10 @@ handle_stat(int parc, char *parv[]) authd_stat_handler handler; if(parc < 3) - /* XXX Should log this somehow */ + { + warn_opers(L_CRIT, "BUG: handle_stat received too few parameters (at least 3 expected, got %d)", parc); return; + } if (!(handler = authd_stat_handlers[(unsigned char)parv[2][0]])) return; @@ -64,8 +66,10 @@ handle_reload(int parc, char *parv[]) authd_reload_handler handler; if(parc < 2) - /* XXX Should log this somehow */ + { + warn_opers(L_CRIT, "BUG: handle_reload received too few parameters (at least 2 expected, got %d)", parc); return; + } if (!(handler = authd_reload_handlers[(unsigned char)parv[1][0]])) return; diff --git a/authd/provider.c b/authd/provider.c index d227bed30..f0000b1b0 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -59,8 +59,10 @@ rb_dictionary *auth_clients; void load_provider(struct auth_provider *provider) { if(rb_dlink_list_length(&auth_providers) >= MAX_PROVIDERS) - /* XXX should probably warn here */ + { + warn_opers(L_CRIT, "Exceeded maximum level of authd providers (%d max)", MAX_PROVIDERS); return; + } provider->init(); rb_dlinkAdd(provider, &provider->node, &auth_providers); @@ -201,7 +203,7 @@ void notice_client(struct auth_client *auth, const char *fmt, ...) } /* Send a warning to the IRC daemon for logging, etc. */ -void warn_opers(provider_t id, const char *fmt, ...) +void warn_opers(notice_level_t level, const char *fmt, ...) { char buf[BUFSIZE]; va_list args; @@ -210,7 +212,7 @@ void warn_opers(provider_t id, const char *fmt, ...) vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - rb_helper_write(authd_helper, "W %c :%s", id, buf); + rb_helper_write(authd_helper, "W %c :%s", level, buf); } /* Begin authenticating user */ @@ -272,7 +274,10 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co void handle_new_connection(int parc, char *parv[]) { if(parc < 7) + { + warn_opers(L_CRIT, "BUG: received too few params for new connection (7 expected, got %d)", parc); return; + } start_auth(parv[1], parv[2], parv[3], parv[4], parv[5]); } diff --git a/authd/provider.h b/authd/provider.h index 84d623181..9184e2fc0 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -34,6 +34,14 @@ typedef enum PROVIDER_BLACKLIST, } provider_t; +typedef enum +{ + L_DEBUG = 'D', + L_INFO = 'I', + L_WARN = 'W', + L_CRIT ='C', +} notice_level_t; + struct auth_client { uint16_t cid; /* Client ID */ @@ -94,7 +102,7 @@ void accept_client(struct auth_client *auth, provider_t id); void reject_client(struct auth_client *auth, provider_t id, const char *reason); void notice_client(struct auth_client *auth, const char *fmt, ...); -void warn_opers(provider_t id, const char *fmt, ...); +void warn_opers(notice_level_t level, const char *fmt, ...); void handle_new_connection(int parc, char *parv[]); From 704279e429bc7733b5c2e957449fee19c7149f1a Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 24 Mar 2016 20:33:54 -0500 Subject: [PATCH 203/252] starttls: use the client connid instead of the FD for opening the channel with ssld --- modules/m_starttls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/m_starttls.c b/modules/m_starttls.c index dbbc71391..f49abb46d 100644 --- a/modules/m_starttls.c +++ b/modules/m_starttls.c @@ -95,7 +95,7 @@ mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou sendto_one_numeric(client_p, RPL_STARTTLS, form_str(RPL_STARTTLS)); send_queued(client_p); - ctl = start_ssld_accept(client_p->localClient->F, F[1], rb_get_fd(F[0])); + ctl = start_ssld_accept(client_p->localClient->F, F[1], client_p->localClient->connid); if (ctl != NULL) { client_p->localClient->F = F[0]; From 2f545aad87fb456af860f8f3bcd2a0d53c8ee782 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 00:00:06 -0500 Subject: [PATCH 204/252] ircd: use ircd_paths for logFileName and pidFileName --- ircd/ircd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index 2012ad372..de40944ac 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -134,8 +134,8 @@ const char *ircd_paths[IRCD_PATH_COUNT] = { [IRCD_PATH_LIBEXEC] = PKGLIBEXECDIR, }; -const char *logFileName = LPATH; -const char *pidFileName = PPATH; +const char *logFileName = NULL; +const char *pidFileName = NULL; void ircd_shutdown(const char *reason) @@ -581,6 +581,9 @@ charybdis_main(int argc, char *argv[]) init_sys(); + logFileName = ircd_paths[IRCD_PATH_IRCD_LOG]; + pidFileName = ircd_paths[IRCD_PATH_IRCD_PID]; + ConfigFileEntry.dpath = ircd_paths[IRCD_PATH_PREFIX]; ConfigFileEntry.configfile = ircd_paths[IRCD_PATH_IRCD_CONF]; /* Server configuration file */ ConfigFileEntry.connect_timeout = 30; /* Default to 30 */ From d6c17e5de2dc5f3df5e6334eb2911ab6b1ae9769 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 01:57:25 -0500 Subject: [PATCH 205/252] ircd: implement path relocation --- ircd/ircd.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index de40944ac..627d469ba 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -389,6 +389,83 @@ initialize_server_capabs(void) default_server_capabs &= ~CAP_ZIP; } +/* + * relocate_paths + * + * inputs - none + * output - none + * side effects - items in ircd_paths[] array are relocated + */ +static void +relocate_paths(void) +{ + char prefix[PATH_MAX], workbuf[PATH_MAX]; + char *p; + + rb_strlcpy(prefix, rb_path_to_self(), sizeof prefix); + + ircd_paths[IRCD_PATH_IRCD_EXEC] = rb_strdup(prefix); + + /* if we're running from inside the source tree, we probably do not want to relocate any other paths */ + if (strstr(prefix, ".libs") != NULL) + return; + + /* prefix = /home/kaniini/ircd/bin/ircd */ + p = strrchr(prefix, RB_PATH_SEPARATOR); + if (rb_unlikely(p == NULL)) + return; + *p = 0; + + /* prefix = /home/kaniini/ircd/bin */ + p = strrchr(prefix, RB_PATH_SEPARATOR); + if (rb_unlikely(p == NULL)) + return; + *p = 0; + + /* prefix = /home/kaniini/ircd */ + ircd_paths[IRCD_PATH_PREFIX] = rb_strdup(prefix); + + /* now that we have our prefix, we can relocate the other paths... */ + snprintf(workbuf, sizeof workbuf, "%s%cmodules", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_MODULES] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cmodules%cautoload", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_AUTOLOAD_MODULES] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_ETC] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%clog", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_LOG] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%chelp%cusers", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_USERHELP] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%chelp%copers", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_OPERHELP] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.conf", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_CONF] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.motd", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_MOTD] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%copers.motd", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_OMOTD] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%cban.db", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_BANDB] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cetc%circd.pid", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_PID] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%clogs%circd.log", prefix, RB_PATH_SEPARATOR, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_IRCD_LOG] = rb_strdup(workbuf); + + snprintf(workbuf, sizeof workbuf, "%s%cbin", prefix, RB_PATH_SEPARATOR); + ircd_paths[IRCD_PATH_BIN] = rb_strdup(workbuf); + ircd_paths[IRCD_PATH_LIBEXEC] = rb_strdup(workbuf); +} /* * write_pidfile @@ -579,7 +656,9 @@ charybdis_main(int argc, char *argv[]) } #endif - init_sys(); +#ifndef ENABLE_FHS_PATHS + relocate_paths(); +#endif logFileName = ircd_paths[IRCD_PATH_IRCD_LOG]; pidFileName = ircd_paths[IRCD_PATH_IRCD_PID]; @@ -588,6 +667,8 @@ charybdis_main(int argc, char *argv[]) ConfigFileEntry.configfile = ircd_paths[IRCD_PATH_IRCD_CONF]; /* Server configuration file */ ConfigFileEntry.connect_timeout = 30; /* Default to 30 */ + init_sys(); + umask(077); /* better safe than sorry --SRB */ myargv = argv; From 42c5dd7e017b6fac26b869796afb7d1d016c3097 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 11:47:02 -0500 Subject: [PATCH 206/252] serno.h: remove it with make clean. --- Makefile.am | 3 +++ librb/Makefile.am | 2 ++ librb/include/serno.h | 2 -- 3 files changed, 5 insertions(+), 2 deletions(-) delete mode 100644 librb/include/serno.h diff --git a/Makefile.am b/Makefile.am index 4bc92d554..7463c147c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,3 +45,6 @@ install-exec-hook: rm -f ${DESTDIR}${moduledir}/*.dll.a rm -f ${DESTDIR}${moduledir}/autoload/*.dll.a rm -f ${DESTDIR}${moduledir}/extensions/*.dll.a + +clean-local: + rm -f include/serno.h diff --git a/librb/Makefile.am b/librb/Makefile.am index a21a3026f..cfddf5d73 100644 --- a/librb/Makefile.am +++ b/librb/Makefile.am @@ -16,3 +16,5 @@ include/serno.h: echo '#define DATECODE 0UL' >>include/serno.h; \ fi +clean-local: + rm -f include/serno.h diff --git a/librb/include/serno.h b/librb/include/serno.h deleted file mode 100644 index 7ab979503..000000000 --- a/librb/include/serno.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SERNO "20160307-81204be" -#define DATECODE 1457395822UL From 0aaa37f721c1cf0eb4e769fccbd220a04331d3d7 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 18:13:15 -0500 Subject: [PATCH 207/252] ircd: only relocate_paths on windows, no point on posix --- ircd/ircd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ircd/ircd.c b/ircd/ircd.c index 627d469ba..8a16ffa48 100644 --- a/ircd/ircd.c +++ b/ircd/ircd.c @@ -396,6 +396,7 @@ initialize_server_capabs(void) * output - none * side effects - items in ircd_paths[] array are relocated */ +#ifdef _WIN32 static void relocate_paths(void) { @@ -466,6 +467,7 @@ relocate_paths(void) ircd_paths[IRCD_PATH_BIN] = rb_strdup(workbuf); ircd_paths[IRCD_PATH_LIBEXEC] = rb_strdup(workbuf); } +#endif /* * write_pidfile @@ -656,7 +658,7 @@ charybdis_main(int argc, char *argv[]) } #endif -#ifndef ENABLE_FHS_PATHS +#ifdef _WIN32 relocate_paths(); #endif From 45c58544606c616c7b472bab33f84d5692a97db1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 18:25:00 -0500 Subject: [PATCH 208/252] appveyor: make the build less hacky --- .appveyor-build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.appveyor-build.sh b/.appveyor-build.sh index 7aa1682c9..8ea6283e9 100644 --- a/.appveyor-build.sh +++ b/.appveyor-build.sh @@ -1,8 +1,9 @@ set -v +export MSYSTEM=MINGW64 export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl sh ./autogen.sh -./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 --build=x86_64-pc-mingw64 --host=x86_64-pc-mingw64 +./configure --prefix=c:/projects/charybdis/build --enable-openssl=/mingw64 make -j2 make install From fdba4417dc375620864c6f10b7eb39d2e2c94173 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Fri, 25 Mar 2016 19:40:12 -0400 Subject: [PATCH 209/252] .gitignore: Ignore serno.h from librb as well --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 72de63ae1..355601506 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ librb/aclocal.m4 librb/include/librb_config.h librb/include/librb_config.h.in librb/include/librb-config.h +librb/include/serno.h librb/librb.pc librb/ltmain.sh librb/missing From afba2488ec133af3070e09c1eda7b5a750d4df35 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Fri, 25 Mar 2016 19:47:30 -0400 Subject: [PATCH 210/252] extb_combi: More int to bool conversion Cleanup whitespace in ircd_lexer.l --- extensions/extb_combi.c | 26 +++++++++++++------------- ircd/ircd_lexer.l | 20 ++++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/extensions/extb_combi.c b/extensions/extb_combi.c index 6b06fdb99..c9f356428 100644 --- a/extensions/extb_combi.c +++ b/extensions/extb_combi.c @@ -52,7 +52,7 @@ static int _modinit(void); static void _moddeinit(void); static int eb_or(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type); static int eb_and(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type); -static int eb_combi(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type, int is_and); +static int eb_combi(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type, bool is_and); static int recursion_depth = 0; DECLARE_MODULE_AV2(extb_extended, _modinit, _moddeinit, NULL, NULL, NULL, NULL, NULL, extb_desc); @@ -76,20 +76,20 @@ _moddeinit(void) static int eb_or(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type) { - return eb_combi(data, client_p, chptr, mode_type, FALSE); + return eb_combi(data, client_p, chptr, mode_type, false); } static int eb_and(const char *data, struct Client *client_p, struct Channel *chptr, long mode_type) { - return eb_combi(data, client_p, chptr, mode_type, TRUE); + return eb_combi(data, client_p, chptr, mode_type, true); } static int eb_combi(const char *data, struct Client *client_p, - struct Channel *chptr, long mode_type, int is_and) + struct Channel *chptr, long mode_type, bool is_and) { const char *p, *banend; - int have_result = FALSE; + bool have_result = false; int allowed_nodes = 11; size_t datalen; @@ -143,12 +143,12 @@ static int eb_combi(const char *data, struct Client *client_p, recursion_depth++; while (--allowed_nodes) { - int invert = FALSE; + bool invert = false; char *child_data, child_data_buf[BANLEN]; ExtbanFunc f; if (*p == '~') { - invert = TRUE; + invert = true; p++; if (p == banend) { MOD_DEBUG("combo invalid: no data after ~"); @@ -164,7 +164,7 @@ static int eb_combi(const char *data, struct Client *client_p, if (*p == ':') { unsigned int parencount = 0; - int escaped = FALSE, done = FALSE; + bool escaped = false, done = false; char *o; p++; @@ -173,7 +173,7 @@ static int eb_combi(const char *data, struct Client *client_p, * we already have_result. */ o = child_data = child_data_buf; - while (TRUE) { + while (true) { if (p == banend) { if (parencount) { MOD_DEBUG("combo invalid: EOD while in parens"); @@ -186,11 +186,11 @@ static int eb_combi(const char *data, struct Client *client_p, if (*p != '(' && *p != ')' && *p != '\\' && *p != ',') *o++ = '\\'; *o++ = *p++; - escaped = FALSE; + escaped = false; } else { switch (*p) { case '\\': - escaped = TRUE; + escaped = true; break; case '(': parencount++; @@ -208,7 +208,7 @@ static int eb_combi(const char *data, struct Client *client_p, if (parencount) *o++ = *p; else - done = TRUE; + done = true; break; default: *o++ = *p; @@ -239,7 +239,7 @@ static int eb_combi(const char *data, struct Client *client_p, child_result = child_result == EXTBAN_MATCH; if (is_and ? !child_result : child_result) - have_result = TRUE; + have_result = true; } if (p == banend) diff --git a/ircd/ircd_lexer.l b/ircd/ircd_lexer.l index ae96b407d..ccaf2e994 100644 --- a/ircd/ircd_lexer.l +++ b/ircd/ircd_lexer.l @@ -66,7 +66,7 @@ char linebuf[512]; #define YY_INPUT(buf,result,max_size) \ if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \ - YY_FATAL_ERROR("input in flex scanner failed"); + YY_FATAL_ERROR("input in flex scanner failed"); %} ws [ \t]* @@ -101,9 +101,9 @@ include \.include{ws}(\<.*\>|\".*\") { int i,j; yylval.string[yyleng-2] = '\0'; /* remove close - * quote + * quote */ - + for (j=i=0 ;yylval.string[i] != '\0'; i++,j++) { if (yylval.string[i] != '\\') @@ -113,7 +113,7 @@ include \.include{ws}(\<.*\>|\".*\") else { i++; - if (yylval.string[i] == '\0') /* XXX + if (yylval.string[i] == '\0') /* XXX * should not * happen */ @@ -133,7 +133,7 @@ include \.include{ws}(\<.*\>|\".*\") loadmodule { return LOADMODULE; } -{string} { +{string} { strcpy(yylval.string, yytext); yylval.string[yyleng] = '\0'; return STRING; @@ -148,7 +148,7 @@ loadmodule { return LOADMODULE; } void ccomment() { int c; - + /* log(L_NOTICE, "got comment"); */ while (1) { @@ -157,7 +157,7 @@ void ccomment() if (c == '*') { while ((c = input()) == '*'); - if (c == '/') + if (c == '/') break; if (c == '\n') ++lineno; } @@ -182,15 +182,15 @@ void cinclude(void) else *strchr(++c, '>') = 0; - /* do stacking and co. */ + /* do stacking and co. */ if (include_stack_ptr >= MAX_INCLUDE_DEPTH) conf_report_error("Includes nested too deep (max is %d)", MAX_INCLUDE_DEPTH); else { FILE *tmp_fbfile_in; - + tmp_fbfile_in = fopen(c, "r"); - + if (tmp_fbfile_in == NULL) { /* if its not found in PREFIX, look in IRCD_PATH_ETC */ From 14505c84009cf3f0347309a8dd7e58bbee810ed4 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 19:47:54 -0500 Subject: [PATCH 211/252] rdns: adjust timeout values --- authd/providers/rdns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index ff3768d3d..96bcea14b 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -54,12 +54,12 @@ static void dns_answer_callback(const char *res, bool status, query_type type, v static struct ev_entry *timeout_ev; static EVH timeout_dns_queries_event; -static int rdns_timeout = 30; +static int rdns_timeout = 15; bool client_dns_init(void) { - timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 5); + timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 1); return (timeout_ev != NULL); } From de7cf7e0091182dcef5d5a046bc1303a762c2877 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 19:49:01 -0500 Subject: [PATCH 212/252] ircd: client: substantially rework the connid registry system now connid's are allocated on demand and clients may have as many connid's as necessary. this allows us to build chains of helpers while ensuring the ircd properly tracks and GCs the resources. --- include/client.h | 10 +++-- include/hash.h | 7 +--- ircd/client.c | 89 +++++++++++++++++++++++++++++++++++++------- ircd/hash.c | 34 +++-------------- ircd/listener.c | 2 +- ircd/s_serv.c | 2 +- ircd/sslproc.c | 14 +------ modules/m_starttls.c | 2 +- ssld/ssld.c | 5 --- 9 files changed, 93 insertions(+), 72 deletions(-) diff --git a/include/client.h b/include/client.h index f844aac79..b9a612bff 100644 --- a/include/client.h +++ b/include/client.h @@ -166,7 +166,9 @@ struct Client struct LocalUser { - rb_dlink_node tnode; /* This is the node for the local list type the client is on*/ + rb_dlink_node tnode; /* This is the node for the local list type the client is on */ + rb_dlink_list connids; /* This is the list of connids to free */ + /* * The following fields are allocated only for local clients * (directly connected to *this* server with a socket. @@ -233,7 +235,6 @@ struct LocalUser time_t next_away; /* Don't allow next away before... */ time_t last; - uint32_t connid; /* clients allowed to talk through +g */ rb_dlink_list allow_list; @@ -272,7 +273,6 @@ struct LocalUser struct _ssl_ctl *ssl_ctl; /* which ssl daemon we're associate with */ struct _ssl_ctl *z_ctl; /* second ctl for ssl+zlib */ - uint32_t zconnid; uint32_t localflags; struct ZipStats *zipstats; /* zipstats */ uint16_t cork_count; /* used for corking/uncorking connections */ @@ -605,4 +605,8 @@ extern char *generate_uid(void); void allocate_away(struct Client *); void free_away(struct Client *); +uint32_t connid_get(struct Client *client_p); +void connid_put(uint32_t id); +void client_release_connids(struct Client *client_p); + #endif /* INCLUDED_client_h */ diff --git a/include/hash.h b/include/hash.h index c2d220dbb..aa0ef79e1 100644 --- a/include/hash.h +++ b/include/hash.h @@ -95,11 +95,8 @@ extern void del_from_resv_hash(const char *name, struct ConfItem *aconf); extern struct ConfItem *hash_find_resv(const char *name); extern void clear_resv_hash(void); -void add_to_cli_connid_hash(struct Client *client_p); -void del_from_cli_connid_hash(struct Client *client_p); +void add_to_cli_connid_hash(struct Client *client_p, uint32_t id); +void del_from_cli_connid_hash(uint32_t id); struct Client *find_cli_connid_hash(uint32_t connid); -void add_to_zconnid_hash(struct Client *client_p); -void del_from_zconnid_hash(struct Client *client_p); - #endif /* INCLUDED_hash_h */ diff --git a/ircd/client.c b/ircd/client.c index f411848b3..268f61b23 100644 --- a/ircd/client.c +++ b/ircd/client.c @@ -76,7 +76,7 @@ static rb_bh *pclient_heap = NULL; static rb_bh *user_heap = NULL; static rb_bh *away_heap = NULL; static char current_uid[IDLEN]; -static int32_t current_connid = 0; +static uint32_t current_connid = 0; rb_dictionary *nd_dict = NULL; @@ -129,6 +129,78 @@ init_client(void) nd_dict = rb_dictionary_create("nickdelay", irccmp); } +/* + * connid_get - allocate a connid + * + * inputs - none + * outputs - a connid token which is used to represent a logical circuit + * side effects - current_connid is incremented, possibly multiple times. + * the association of the connid to it's client is committed. + */ +uint32_t +connid_get(struct Client *client_p) +{ + s_assert(MyClient(client_p)); + if (!MyClient(client_p)) + return 0; + + /* find a connid that is available */ + while (find_cli_connid_hash(++current_connid) != NULL) + { + /* handle wraparound, current_connid must NEVER be 0 */ + if (current_connid == 0) + ++current_connid; + } + + add_to_cli_connid_hash(client_p, current_connid); + rb_dlinkAddAlloc(RB_UINT_TO_POINTER(current_connid), &client_p->localClient->connids); + + return current_connid; +} + +/* + * connid_put - free a connid + * + * inputs - connid to free + * outputs - nothing + * side effects - connid bookkeeping structures are freed + */ +void +connid_put(uint32_t id) +{ + struct Client *client_p; + + s_assert(id != 0); + if (id == 0) + return; + + client_p = find_cli_connid_hash(id); + if (client_p == NULL) + return; + + del_from_cli_connid_hash(id); + rb_dlinkFindDestroy(RB_UINT_TO_POINTER(id), &client_p->localClient->connids); +} + +/* + * client_release_connids - release any connids still attached to a client + * + * inputs - client to garbage collect + * outputs - none + * side effects - client's connids are garbage collected + */ +void +client_release_connids(struct Client *client_p) +{ + rb_dlink_node *ptr, *ptr2; + + s_assert(MyClient(client_p)); + if (!MyClient(client_p)) + return; + + RB_DLINK_FOREACH_SAFE(ptr, ptr2, client_p->localClient->connids.head) + connid_put(RB_POINTER_TO_UINT(ptr->data)); +} /* * make_client - create a new Client struct and set it to initial state. @@ -160,17 +232,6 @@ make_client(struct Client *from) client_p->localClient->F = NULL; - if(current_connid+1 == 0) - current_connid++; - - client_p->localClient->connid = ++current_connid; - - if(current_connid+1 == 0) - current_connid++; - - client_p->localClient->zconnid = ++current_connid; - add_to_cli_connid_hash(client_p); - client_p->preClient = rb_bh_alloc(pclient_heap); /* as good a place as any... */ @@ -229,7 +290,7 @@ free_local_client(struct Client *client_p) client_p->localClient->listener = 0; } - del_from_cli_connid_hash(client_p); + client_release_connids(client_p); if(client_p->localClient->F != NULL) { rb_close(client_p->localClient->F); @@ -1949,7 +2010,7 @@ close_connection(struct Client *client_p) else ServerStats.is_ni++; - del_from_cli_connid_hash(client_p); + client_release_connids(client_p); if(client_p->localClient->F != NULL) { diff --git a/ircd/hash.c b/ircd/hash.c index 172734d3a..0d3fb1287 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -40,7 +40,6 @@ #include "rb_radixtree.h" rb_dictionary *client_connid_tree = NULL; -rb_dictionary *client_zconnid_tree = NULL; rb_radixtree *client_id_tree = NULL; rb_radixtree *client_name_tree = NULL; @@ -60,7 +59,6 @@ void init_hash(void) { client_connid_tree = rb_dictionary_create("client connid", rb_uint32cmp); - client_zconnid_tree = rb_dictionary_create("client zconnid", rb_uint32cmp); client_id_tree = rb_radixtree_create("client id", NULL); client_name_tree = rb_radixtree_create("client name", irccasecanon); @@ -493,41 +491,19 @@ clear_resv_hash(void) } void -add_to_zconnid_hash(struct Client *client_p) +add_to_cli_connid_hash(struct Client *client_p, uint32_t id) { - rb_dictionary_add(client_zconnid_tree, RB_UINT_TO_POINTER(client_p->localClient->zconnid), client_p); + rb_dictionary_add(client_connid_tree, RB_UINT_TO_POINTER(id), client_p); } void -del_from_zconnid_hash(struct Client *client_p) +del_from_cli_connid_hash(uint32_t id) { - rb_dictionary_delete(client_zconnid_tree, RB_UINT_TO_POINTER(client_p->localClient->zconnid)); -} - -void -add_to_cli_connid_hash(struct Client *client_p) -{ - rb_dictionary_add(client_connid_tree, RB_UINT_TO_POINTER(client_p->localClient->connid), client_p); -} - -void -del_from_cli_connid_hash(struct Client *client_p) -{ - rb_dictionary_delete(client_connid_tree, RB_UINT_TO_POINTER(client_p->localClient->connid)); + rb_dictionary_delete(client_connid_tree, RB_UINT_TO_POINTER(id)); } struct Client * find_cli_connid_hash(uint32_t connid) { - struct Client *target_p; - - target_p = rb_dictionary_retrieve(client_connid_tree, RB_UINT_TO_POINTER(connid)); - if (target_p != NULL) - return target_p; - - target_p = rb_dictionary_retrieve(client_zconnid_tree, RB_UINT_TO_POINTER(connid)); - if (target_p != NULL) - return target_p; - - return NULL; + return rb_dictionary_retrieve(client_connid_tree, RB_UINT_TO_POINTER(connid)); } diff --git a/ircd/listener.c b/ircd/listener.c index a3d08cbaa..aeff94e90 100644 --- a/ircd/listener.c +++ b/ircd/listener.c @@ -481,7 +481,7 @@ add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, str free_client(new_client); return; } - new_client->localClient->ssl_ctl = start_ssld_accept(F, xF[1], new_client->localClient->connid); /* this will close F for us */ + new_client->localClient->ssl_ctl = start_ssld_accept(F, xF[1], connid_get(new_client)); /* this will close F for us */ if(new_client->localClient->ssl_ctl == NULL) { free_client(new_client); diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 619ab51f1..79a0a487c 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -1157,7 +1157,7 @@ serv_connect_ssl_callback(rb_fde_t *F, int status, void *data) } client_p->localClient->F = xF[0]; - client_p->localClient->ssl_ctl = start_ssld_connect(F, xF[1], rb_get_fd(xF[0])); + client_p->localClient->ssl_ctl = start_ssld_connect(F, xF[1], connid_get(client_p)); if(!client_p->localClient->ssl_ctl) { serv_connect_callback(client_p->localClient->F, RB_ERROR, data); diff --git a/ircd/sslproc.c b/ircd/sslproc.c index 2edd091eb..709504ac8 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -863,23 +863,11 @@ start_zlib_session(void *data) return; } - if(IsSSL(server)) - { - /* tell ssld the new connid for the ssl part*/ - buf2[0] = 'Y'; - uint32_to_buf(&buf2[1], rb_get_fd(server->localClient->F)); - uint32_to_buf(&buf2[5], rb_get_fd(xF2)); - ssl_cmd_write_queue(server->localClient->ssl_ctl, NULL, 0, buf2, sizeof(buf2)); - } - - F[0] = server->localClient->F; F[1] = xF1; - del_from_zconnid_hash(server); server->localClient->F = xF2; /* need to redo as what we did before isn't valid now */ - uint32_to_buf(&buf[1], server->localClient->zconnid); - add_to_zconnid_hash(server); + uint32_to_buf(&buf[1], connid_get(server)); server->localClient->z_ctl = which_ssld(); if(!server->localClient->z_ctl) diff --git a/modules/m_starttls.c b/modules/m_starttls.c index f49abb46d..62b7feb60 100644 --- a/modules/m_starttls.c +++ b/modules/m_starttls.c @@ -95,7 +95,7 @@ mr_starttls(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou sendto_one_numeric(client_p, RPL_STARTTLS, form_str(RPL_STARTTLS)); send_queued(client_p); - ctl = start_ssld_accept(client_p->localClient->F, F[1], client_p->localClient->connid); + ctl = start_ssld_accept(client_p->localClient->F, F[1], connid_get(client_p)); if (ctl != NULL) { client_p->localClient->F = F[0]; diff --git a/ssld/ssld.c b/ssld/ssld.c index 7a0dc20f5..6eb942c21 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -1067,11 +1067,6 @@ mod_process_cmd_recv(mod_ctl_t * ctl) process_stats(ctl, ctl_buf); break; } - case 'Y': - { - change_connid(ctl, ctl_buf); - break; - } #ifdef HAVE_LIBZ case 'Z': From add80afdcb888e8bcdb9ed006a01f996613840e5 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 20:07:36 -0500 Subject: [PATCH 213/252] authd/provider: add blacklist provider. This took way longer than it should have. --- authd/Makefile.am | 5 +- authd/provider.h | 1 + authd/providers/blacklist.c | 404 ++++++++++++++++++++++++++++++++++++ 3 files changed, 408 insertions(+), 2 deletions(-) create mode 100644 authd/providers/blacklist.c diff --git a/authd/Makefile.am b/authd/Makefile.am index d17e97d12..235061c4c 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -11,7 +11,8 @@ authd_SOURCES = \ getaddrinfo.c \ getnameinfo.c \ provider.c \ - providers/rdns.c \ - providers/ident.c + providers/blacklist.c \ + providers/ident.c \ + providers/rdns.c authd_LDADD = ../librb/src/librb.la diff --git a/authd/provider.h b/authd/provider.h index 9184e2fc0..01c71cf4b 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -89,6 +89,7 @@ extern rb_dictionary *auth_clients; extern struct auth_provider rdns_provider; extern struct auth_provider ident_provider; +extern struct auth_provider blacklist_provider; void load_provider(struct auth_provider *provider); void unload_provider(struct auth_provider *provider); diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c new file mode 100644 index 000000000..eaccc33bb --- /dev/null +++ b/authd/providers/blacklist.c @@ -0,0 +1,404 @@ +/* + * charybdis: A slightly useful ircd. + * blacklist.c: Manages DNS blacklist entries and lookups + * + * Copyright (C) 2006-2011 charybdis development team + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* Originally written for charybdis circa 2006 (by nenolod?). + * Tweaked for authd. Some functions and structs renamed. Public/private + * interfaces have been shifted around. Some code has been cleaned up too. + * -- Elizafox 24 March 2016 + */ + +#include "authd.h" +#include "provider.h" +#include "stdinc.h" +#include "dns.h" + +typedef enum filter_t +{ + FILTER_ALL = 1, + FILTER_LAST = 2, +} filter_t; + +/* Blacklist accepted IP types */ +#define IPTYPE_IPV4 1 +#define IPTYPE_IPV6 2 + +/* A configured DNSBL */ +struct blacklist +{ + char host[IRCD_RES_HOSTLEN + 1]; + char reason[BUFSIZE]; /* Reason template (ircd fills in the blanks) */ + unsigned char iptype; /* IP types supported */ + rb_dlink_list filters; /* Filters for queries */ + + bool delete; /* If true delete when no clients */ + int refcount; /* When 0 and delete is set, remove this blacklist */ + + time_t lastwarning; /* Last warning about garbage replies sent */ +}; + +/* A lookup in progress for a particular DNSBL for a particular client */ +struct blacklist_lookup +{ + struct blacklist *bl; /* Blacklist we're checking */ + struct auth_client *auth; /* Client */ + struct dns_query *query; /* DNS query pointer */ + + rb_dlink_node node; +}; + +/* A blacklist filter */ +struct blacklist_filter +{ + filter_t type; /* Type of filter */ + char filterstr[HOSTIPLEN]; /* The filter itself */ + + rb_dlink_node node; +}; + +/* Blacklist user data attached to auth_client instance */ +struct blacklist_user +{ + rb_dlink_list queries; /* Blacklist queries in flight */ + time_t timeout; /* When this times out */ +}; + +/* public interfaces */ +static bool blacklists_init(void); +static void blacklists_destroy(void); + +static bool blacklists_start(struct auth_client *); +static void blacklists_cancel(struct auth_client *); + +/* private interfaces */ +static void unref_blacklist(struct blacklist *); +static struct blacklist *new_blacklist(char *, char *, bool, bool, rb_dlink_list *); +static struct blacklist *find_blacklist(char *); +static bool blacklist_check_reply(struct blacklist_lookup *, const char *); +static void blacklist_dns_callback(const char *, bool, query_type, void *); +static void initiate_blacklist_dnsquery(struct blacklist *, struct auth_client *); +static void timeout_blacklist_queries_event(void *); + +/* Variables */ +static rb_dlink_list blacklist_list = { NULL, NULL, 0 }; +static struct ev_entry *timeout_ev; +static EVH timeout_blacklists; +static int blacklist_timeout = 15; + +/* private interfaces */ + +static void +unref_blacklist(struct blacklist *bl) +{ + rb_dlink_node *ptr, *nptr; + + bl->refcount--; + if (bl->delete && bl->refcount <= 0) + { + RB_DLINK_FOREACH_SAFE(ptr, nptr, bl->filters.head) + { + rb_dlinkDelete(ptr, &bl->filters); + rb_free(ptr); + } + + rb_dlinkFindDestroy(bl, &blacklist_list); + rb_free(bl); + } +} + +static struct blacklist * +new_blacklist(char *name, char *reason, bool ipv4, bool ipv6, rb_dlink_list *filters) +{ + struct blacklist *bl; + + if (name == NULL || reason == NULL || !(ipv4 || ipv6)) + return NULL; + + if((bl = find_blacklist(name)) == NULL) + { + bl = rb_malloc(sizeof(struct blacklist)); + rb_dlinkAddAlloc(bl, &blacklist_list); + } + else + bl->delete = false; + + rb_strlcpy(bl->host, name, IRCD_RES_HOSTLEN + 1); + rb_strlcpy(bl->reason, reason, BUFSIZE); + if(ipv4) + bl->iptype |= IPTYPE_IPV4; + if(ipv6) + bl->iptype |= IPTYPE_IPV6; + + rb_dlinkMoveList(filters, &bl->filters); + + bl->lastwarning = 0; + + return bl; +} + +static struct blacklist * +find_blacklist(char *name) +{ + rb_dlink_node *ptr; + + RB_DLINK_FOREACH(ptr, blacklist_list.head) + { + struct blacklist *bl = (struct blacklist *)ptr->data; + + if (!strcasecmp(bl->host, name)) + return bl; + } + + return NULL; +} + +static inline bool +blacklist_check_reply(struct blacklist_lookup *bllookup, const char *ipaddr) +{ + struct blacklist *bl = bllookup->bl; + const char *lastoctet; + rb_dlink_node *ptr; + + /* No filters and entry found - thus positive match */ + if (!rb_dlink_list_length(&bl->filters)) + return true; + + /* Below will prolly have to change if IPv6 address replies are sent back */ + if ((lastoctet = strrchr(ipaddr, '.')) == NULL || *(++lastoctet) == '\0') + goto blwarn; + + RB_DLINK_FOREACH(ptr, bl->filters.head) + { + struct blacklist_filter *filter = ptr->data; + const char *cmpstr; + + if (filter->type == FILTER_ALL) + cmpstr = ipaddr; + else if (filter->type == FILTER_LAST) + cmpstr = lastoctet; + else + { + warn_opers(L_CRIT, "BUG: Unknown blacklist filter type on blacklist %s: %d", + bl->host, filter->type); + continue; + } + + if (strcmp(cmpstr, filter->filterstr) == 0) + /* Match! */ + return true; + } + + return false; +blwarn: + if (bl->lastwarning + 3600 < rb_current_time()) + { + warn_opers(L_WARN, "Garbage/undecipherable reply received from blacklist %s (reply %s)", + bl->host, ipaddr); + bl->lastwarning = rb_current_time(); + } + return false; +} + +static void +blacklist_dns_callback(const char *result, bool status, query_type type, void *data) +{ + struct blacklist_lookup *bllookup = (struct blacklist_lookup *)data; + struct blacklist_user *bluser; + struct auth_client *auth; + + if (bllookup == NULL || bllookup->auth == NULL) + return; + + auth = bllookup->auth; + bluser = auth->data[PROVIDER_BLACKLIST]; + if(bluser == NULL) + return; + + if (result != NULL && status && blacklist_check_reply(bllookup, result)) + { + /* Match found, so proceed no further */ + blacklists_cancel(auth); + reject_client(auth, PROVIDER_BLACKLIST, bllookup->bl->reason); + return; + } + + unref_blacklist(bllookup->bl); + rb_dlinkDelete(&bllookup->node, &bluser->queries); + rb_free(bllookup); + + if(!rb_dlink_list_length(&bluser->queries)) + { + /* Done here */ + provider_done(auth, PROVIDER_BLACKLIST); + rb_free(bluser); + auth->data[PROVIDER_BLACKLIST] = NULL; + } +} + +static void +initiate_blacklist_dnsquery(struct blacklist *bl, struct auth_client *auth) +{ + struct blacklist_lookup *bllookup = rb_malloc(sizeof(struct blacklist_lookup)); + struct blacklist_user *bluser = auth->data[PROVIDER_BLACKLIST]; + char buf[IRCD_RES_HOSTLEN + 1]; + int aftype; + + bllookup->bl = bl; + bllookup->auth = auth; + + aftype = GET_SS_FAMILY(&auth->c_addr); + if((aftype == AF_INET && (bl->iptype & IPTYPE_IPV4) == 0) || + (aftype == AF_INET6 && (bl->iptype & IPTYPE_IPV6) == 0)) + /* Incorrect blacklist type for this IP... */ + return; + + build_rdns(buf, sizeof(buf), &auth->c_addr, bl->host); + + bllookup->query = lookup_ip(buf, AF_INET, blacklist_dns_callback, bllookup); + + rb_dlinkAdd(bllookup, &bllookup->node, &bluser->queries); + bl->refcount++; +} + +/* Timeout outstanding queries */ +static void +timeout_blacklist_queries_event(void *notused) +{ + struct auth_client *auth; + rb_dictionary_iter iter; + + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + { + struct blacklist_user *bluser = auth->data[PROVIDER_BLACKLIST]; + + if(bluser != NULL && bluser->timeout < rb_current_time()) + { + blacklists_cancel(auth); + provider_done(auth, PROVIDER_BLACKLIST); + } + } +} + +/* public interfaces */ +static bool +blacklists_start(struct auth_client *auth) +{ + struct blacklist_user *bluser; + rb_dlink_node *nptr; + + if(auth->data[PROVIDER_BLACKLIST] != NULL) + return true; + + if(!rb_dlink_list_length(&blacklist_list)) + /* Nothing to do... */ + return true; + + bluser = auth->data[PROVIDER_BLACKLIST] = rb_malloc(sizeof(struct blacklist_user)); + + RB_DLINK_FOREACH(nptr, blacklist_list.head) + { + struct blacklist *bl = (struct blacklist *) nptr->data; + + if (!bl->delete) + initiate_blacklist_dnsquery(bl, auth); + } + + bluser->timeout = rb_current_time() + blacklist_timeout; + + set_provider(auth, PROVIDER_BLACKLIST); + return true; +} + +static void +blacklists_cancel(struct auth_client *auth) +{ + rb_dlink_node *ptr, *nptr; + struct blacklist_user *bluser = auth->data[PROVIDER_BLACKLIST]; + + if(bluser == NULL) + return; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, bluser->queries.head) + { + struct blacklist_lookup *bllookup = ptr->data; + rb_dlinkDelete(&bllookup->node, &bluser->queries); + unref_blacklist(bllookup->bl); + cancel_query(bllookup->query); + rb_free(bllookup); + } + + rb_free(bluser); + auth->data[PROVIDER_BLACKLIST] = NULL; +} + +static bool +blacklists_init(void) +{ + timeout_ev = rb_event_addish("timeout_blacklist_queries_event", timeout_blacklist_queries_event, NULL, 1); + return (timeout_ev != NULL); +} + +static void +blacklists_destroy(void) +{ + rb_dlink_node *ptr, *nptr; + rb_dictionary_iter iter; + struct blacklist *bl; + struct auth_client *auth; + + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + { + blacklists_cancel(auth); + } + + RB_DLINK_FOREACH_SAFE(ptr, nptr, blacklist_list.head) + { + bl = ptr->data; + if (bl->refcount > 0) + bl->delete = true; + else + { + rb_free(ptr->data); + rb_dlinkDestroy(ptr, &blacklist_list); + } + } +} + +struct auth_provider blacklist_provider = +{ + .id = PROVIDER_BLACKLIST, + .init = blacklists_init, + .destroy = blacklists_destroy, + .start = blacklists_start, + .cancel = blacklists_cancel, + .completed = NULL, +}; From a7d5aea119599580803bf3e7a515bda730b447dc Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 20:46:58 -0500 Subject: [PATCH 214/252] provider: make blacklist queries come after ident/rdns. --- authd/provider.c | 11 ++++---- authd/provider.h | 18 ++++++++++-- authd/providers/blacklist.c | 56 ++++++++++++++++++++++++++----------- authd/providers/ident.c | 2 +- authd/providers/rdns.c | 2 +- 5 files changed, 63 insertions(+), 26 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index f0000b1b0..e7b07c504 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -116,7 +116,7 @@ void cancel_providers(struct auth_client *auth) { provider = ptr->data; - if(provider->cancel && is_provider(auth, provider->id)) + if(provider->cancel && is_provider_on(auth, provider->id)) /* Cancel if required */ provider->cancel(auth); } @@ -131,7 +131,8 @@ void provider_done(struct auth_client *auth, provider_t id) rb_dlink_node *ptr; struct auth_provider *provider; - unset_provider(auth, id); + set_provider_off(auth, id); + set_provider_done(auth, id); if(!auth->providers) { @@ -144,7 +145,7 @@ void provider_done(struct auth_client *auth, provider_t id) { provider = ptr->data; - if(provider->completed && is_provider(auth, provider->id)) + if(provider->completed && is_provider_on(auth, provider->id)) /* Notify pending clients who asked for it */ provider->completed(auth, id); } @@ -174,7 +175,7 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) /* TODO send back ident */ rb_helper_write(authd_helper, "R %x %c :%s", auth->cid, reject, reason); - unset_provider(auth, id); + set_provider_off(auth, id); cancel_providers(auth); } @@ -185,7 +186,7 @@ void accept_client(struct auth_client *auth, provider_t id) rb_helper_write(authd_helper, "A %x %s %s", auth->cid, auth->username, auth->hostname); - unset_provider(auth, id); + set_provider_off(auth, id); cancel_providers(auth); } diff --git a/authd/provider.h b/authd/provider.h index 01c71cf4b..ef96ca841 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -59,6 +59,7 @@ struct auth_client uint32_t providers; /* Providers at work, * none left when set to 0 */ + uint32_t providers_done; /* Providers completed */ void *data[MAX_PROVIDERS]; /* Provider-specific data slots */ }; @@ -108,21 +109,32 @@ void warn_opers(notice_level_t level, const char *fmt, ...); void handle_new_connection(int parc, char *parv[]); /* Provider is operating on this auth_client (set this if you have async work to do) */ -static inline void set_provider(struct auth_client *auth, provider_t provider) +static inline void set_provider_on(struct auth_client *auth, provider_t provider) { auth->providers |= (1 << provider); } /* Provider is no longer operating on this auth client (you should use provider_done) */ -static inline void unset_provider(struct auth_client *auth, provider_t provider) +static inline void set_provider_off(struct auth_client *auth, provider_t provider) { auth->providers &= ~(1 << provider); } +/* Set the provider to done (you should use provider_done) */ +static inline void set_provider_done(struct auth_client *auth, provider_t provider) +{ + auth->providers_done |= (1 << provider); +} + /* Check if provider is operating on this auth client */ -static inline bool is_provider(struct auth_client *auth, provider_t provider) +static inline bool is_provider_on(struct auth_client *auth, provider_t provider) { return auth->providers & (1 << provider); } +static inline bool is_provider_done(struct auth_client *auth, provider_t provider) +{ + return auth->providers_done & (1 << provider); +} + #endif /* __CHARYBDIS_AUTHD_PROVIDER_H__ */ diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index eaccc33bb..ae52bbdcf 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -258,7 +258,7 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d if(!rb_dlink_list_length(&bluser->queries)) { /* Done here */ - provider_done(auth, PROVIDER_BLACKLIST); + provider_done(auth, PROVIDER_BLACKLIST); rb_free(bluser); auth->data[PROVIDER_BLACKLIST] = NULL; } @@ -308,13 +308,27 @@ timeout_blacklist_queries_event(void *notused) } } +static inline void +lookup_all_blacklists(struct auth_client *auth) +{ + struct blacklist_user *bluser = auth->data[PROVIDER_BLACKLIST]; + rb_dlink_node *ptr; + + RB_DLINK_FOREACH(ptr, blacklist_list.head) + { + struct blacklist *bl = (struct blacklist *)ptr->data; + + if (!bl->delete) + initiate_blacklist_dnsquery(bl, auth); + } + + bluser->timeout = rb_current_time() + blacklist_timeout; +} + /* public interfaces */ static bool blacklists_start(struct auth_client *auth) { - struct blacklist_user *bluser; - rb_dlink_node *nptr; - if(auth->data[PROVIDER_BLACKLIST] != NULL) return true; @@ -322,22 +336,32 @@ blacklists_start(struct auth_client *auth) /* Nothing to do... */ return true; - bluser = auth->data[PROVIDER_BLACKLIST] = rb_malloc(sizeof(struct blacklist_user)); + auth->data[PROVIDER_BLACKLIST] = rb_malloc(sizeof(struct blacklist_user)); - RB_DLINK_FOREACH(nptr, blacklist_list.head) - { - struct blacklist *bl = (struct blacklist *) nptr->data; + if(is_provider_done(auth, PROVIDER_RDNS) && is_provider_done(auth, PROVIDER_IDENT)) + /* This probably can't happen but let's handle this case anyway */ + lookup_all_blacklists(auth); - if (!bl->delete) - initiate_blacklist_dnsquery(bl, auth); - } - - bluser->timeout = rb_current_time() + blacklist_timeout; - - set_provider(auth, PROVIDER_BLACKLIST); + set_provider_on(auth, PROVIDER_BLACKLIST); return true; } +/* This is called every time a provider is completed */ +static void +blacklists_initiate(struct auth_client *auth, provider_t provider) +{ + struct blacklist_user *bluser = auth->data[PROVIDER_BLACKLIST]; + + if(bluser == NULL || is_provider_done(auth, PROVIDER_BLACKLIST) || rb_dlink_list_length(&bluser->queries)) + /* Nothing to do */ + return; + else if(!is_provider_done(auth, PROVIDER_RDNS) && !is_provider_done(auth, PROVIDER_IDENT)) + /* Don't start until we've completed these */ + return; + else + lookup_all_blacklists(auth); +} + static void blacklists_cancel(struct auth_client *auth) { @@ -400,5 +424,5 @@ struct auth_provider blacklist_provider = .destroy = blacklists_destroy, .start = blacklists_start, .cancel = blacklists_cancel, - .completed = NULL, + .completed = blacklists_initiate, }; diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 3e77025ff..a19b289e8 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -121,7 +121,7 @@ bool ident_start(struct auth_client *auth) query, ident_timeout); notice_client(auth, messages[REPORT_LOOKUP]); - set_provider(auth, PROVIDER_IDENT); + set_provider_on(auth, PROVIDER_IDENT); return true; } diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index 96bcea14b..ddce08fbc 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -88,7 +88,7 @@ bool client_dns_start(struct auth_client *auth) query->query = lookup_hostname(auth->c_ip, dns_answer_callback, auth); notice_client(auth, messages[REPORT_LOOKUP]); - set_provider(auth, PROVIDER_RDNS); + set_provider_on(auth, PROVIDER_RDNS); return true; } From 6c88869f223eb49a69518a161d8785eaae08971e Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 20:55:10 -0500 Subject: [PATCH 215/252] providers/blacklist: change some checks to asserts. These should not really happen in reality... --- authd/providers/blacklist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index ae52bbdcf..22917c03d 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -346,16 +346,20 @@ blacklists_start(struct auth_client *auth) return true; } -/* This is called every time a provider is completed */ +/* This is called every time a provider is completed as long as we are marked not done */ static void blacklists_initiate(struct auth_client *auth, provider_t provider) { struct blacklist_user *bluser = auth->data[PROVIDER_BLACKLIST]; - if(bluser == NULL || is_provider_done(auth, PROVIDER_BLACKLIST) || rb_dlink_list_length(&bluser->queries)) + lrb_assert(provider != PROVIDER_BLACKLIST); + lrb_assert(!is_provider_done(auth, PROVIDER_BLACKLIST)); + lrb_assert(rb_dlink_list_length(&blacklist_list) > 0); + + if(bluser == NULL || rb_dlink_list_length(&bluser->queries)) /* Nothing to do */ return; - else if(!is_provider_done(auth, PROVIDER_RDNS) && !is_provider_done(auth, PROVIDER_IDENT)) + else if(!(is_provider_done(auth, PROVIDER_RDNS) && is_provider_done(auth, PROVIDER_IDENT))) /* Don't start until we've completed these */ return; else From 122ae255d7b0519be1618d602e4d194fe3b6b964 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 21:00:13 -0500 Subject: [PATCH 216/252] authd: change reload character to R from H. This is more in line with the specification @kaniini laid out. --- authd/authd.c | 9 +++++++-- ircd/dns.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 4e7c7eb6d..81c4b3402 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -28,7 +28,7 @@ static void handle_stat(int parc, char *parv[]); rb_helper *authd_helper = NULL; authd_cmd_handler authd_cmd_handlers[256] = { - ['H'] = handle_reload, + ['R'] = handle_reload, ['D'] = resolve_dns, ['S'] = handle_stat, }; @@ -62,8 +62,13 @@ handle_reload(int parc, char *parv[]) authd_reload_handler handler; if(parc < 2) - /* XXX Should log this somehow */ + { + /* Reload all handlers */ + for(size_t i = 0; i < sizeof(authd_reload_handlers); handler = authd_reload_handlers[i++]) + handler(parv[1][0]); + return; + } if (!(handler = authd_reload_handlers[(unsigned char)parv[1][0]])) return; diff --git a/ircd/dns.c b/ircd/dns.c index ce3cd6c29..a3a8077e1 100644 --- a/ircd/dns.c +++ b/ircd/dns.c @@ -303,7 +303,7 @@ void reload_nameservers(void) { check_authd(); - rb_helper_write(authd_helper, "H D"); + rb_helper_write(authd_helper, "R D"); (void)get_nameservers(stats_results_callback, NULL); } From caebeeca953239f345bdaf41694ca735e4dab891 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 21:03:17 -0500 Subject: [PATCH 217/252] wsockd: add skeleton for future websockets helper (ref #78) --- .gitignore | 1 + Makefile.am | 1 + configure.ac | 1 + wsockd/Makefile.am | 7 + wsockd/wsockd.c | 432 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 442 insertions(+) create mode 100644 wsockd/Makefile.am create mode 100644 wsockd/wsockd.c diff --git a/.gitignore b/.gitignore index 355601506..5166a02e8 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ ircd/ircd_lexer.c ircd/version.c ircd/version.c.last ssld/ssld +wsockd/wsockd tools/charybdis-mkpasswd tools/genssl tools/mkpasswd diff --git a/Makefile.am b/Makefile.am index 7463c147c..85513d2c0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,6 +9,7 @@ endif SUBDIRS += ircd \ ssld \ + wsockd \ authd \ bandb \ tools \ diff --git a/configure.ac b/configure.ac index a36786254..956ad882b 100644 --- a/configure.ac +++ b/configure.ac @@ -656,6 +656,7 @@ AC_CONFIG_FILES( \ authd/Makefile \ bandb/Makefile \ ssld/Makefile \ + wsockd/Makefile \ extensions/Makefile \ ircd/Makefile \ modules/Makefile \ diff --git a/wsockd/Makefile.am b/wsockd/Makefile.am new file mode 100644 index 000000000..d4524698d --- /dev/null +++ b/wsockd/Makefile.am @@ -0,0 +1,7 @@ +pkglibexec_PROGRAMS = wsockd +AM_CFLAGS=$(WARNFLAGS) +AM_CPPFLAGS = -I../include -I../librb/include + + +wsockd_SOURCES = wsockd.c +wsockd_LDADD = ../librb/src/librb.la diff --git a/wsockd/wsockd.c b/wsockd/wsockd.c new file mode 100644 index 000000000..5c5262cc7 --- /dev/null +++ b/wsockd/wsockd.c @@ -0,0 +1,432 @@ +/* + * wsockd.c: charybdis websockets helper + * Copyright (C) 2007 Aaron Sethman + * Copyright (C) 2007 ircd-ratbox development team + * Copyright (C) 2016 William Pitcock + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ + +#include "stdinc.h" + +#define MAXPASSFD 4 +#ifndef READBUF_SIZE +#define READBUF_SIZE 16384 +#endif + +static void setup_signals(void); +static pid_t ppid; + +static inline uint32_t +buf_to_uint32(uint8_t *buf) +{ + uint32_t x; + memcpy(&x, buf, sizeof(x)); + return x; +} + +static inline void +uint32_to_buf(uint8_t *buf, uint32_t x) +{ + memcpy(buf, &x, sizeof(x)); + return; +} + +typedef struct _mod_ctl_buf +{ + rb_dlink_node node; + uint8_t *buf; + size_t buflen; + rb_fde_t *F[MAXPASSFD]; + int nfds; +} mod_ctl_buf_t; + +typedef struct _mod_ctl +{ + rb_dlink_node node; + int cli_count; + rb_fde_t *F; + rb_fde_t *F_pipe; + rb_dlink_list readq; + rb_dlink_list writeq; +} mod_ctl_t; + +static mod_ctl_t *mod_ctl; + +typedef struct _conn +{ + rb_dlink_node node; + mod_ctl_t *ctl; + rawbuf_head_t *modbuf_out; + rawbuf_head_t *plainbuf_out; + + uint32_t id; + + rb_fde_t *mod_fd; + rb_fde_t *plain_fd; + uint64_t mod_out; + uint64_t mod_in; + uint64_t plain_in; + uint64_t plain_out; + uint8_t flags; + void *stream; +} conn_t; + +#define FLAG_CORK 0x01 +#define FLAG_DEAD 0x02 +#define FLAG_WSOCK 0x04 + +#define IsCork(x) ((x)->flags & FLAG_CORK) +#define IsDead(x) ((x)->flags & FLAG_DEAD) +#define IsWS(x) ((x)->flags & FLAG_WSOCK) + +#define SetCork(x) ((x)->flags |= FLAG_CORK) +#define SetDead(x) ((x)->flags |= FLAG_DEAD) +#define SetWS(x) ((x)->flags |= FLAG_WSOCK) + +#define ClearCork(x) ((x)->flags &= ~FLAG_CORK) +#define ClearDead(x) ((x)->flags &= ~FLAG_DEAD) +#define ClearWS(x) ((x)->flags &= ~FLAG_WSOCK) + +#define NO_WAIT 0x0 +#define WAIT_PLAIN 0x1 + +#define HASH_WALK_SAFE(i, max, ptr, next, table) for(i = 0; i < max; i++) { RB_DLINK_FOREACH_SAFE(ptr, next, table[i].head) +#define HASH_WALK_END } +#define CONN_HASH_SIZE 2000 +#define connid_hash(x) (&connid_hash_table[(x % CONN_HASH_SIZE)]) + +static rb_dlink_list connid_hash_table[CONN_HASH_SIZE]; +static rb_dlink_list dead_list; + +#ifndef _WIN32 +static void +dummy_handler(int sig) +{ + return; +} +#endif + +static void +setup_signals() +{ +#ifndef _WIN32 + struct sigaction act; + + act.sa_flags = 0; + act.sa_handler = SIG_IGN; + sigemptyset(&act.sa_mask); + sigaddset(&act.sa_mask, SIGPIPE); + sigaddset(&act.sa_mask, SIGALRM); +#ifdef SIGTRAP + sigaddset(&act.sa_mask, SIGTRAP); +#endif + +#ifdef SIGWINCH + sigaddset(&act.sa_mask, SIGWINCH); + sigaction(SIGWINCH, &act, 0); +#endif + sigaction(SIGPIPE, &act, 0); +#ifdef SIGTRAP + sigaction(SIGTRAP, &act, 0); +#endif + + act.sa_handler = dummy_handler; + sigaction(SIGALRM, &act, 0); +#endif +} + +static int +maxconn(void) +{ +#if defined(RLIMIT_NOFILE) && defined(HAVE_SYS_RESOURCE_H) + struct rlimit limit; + + if(!getrlimit(RLIMIT_NOFILE, &limit)) + { + return limit.rlim_cur; + } +#endif /* RLIMIT_FD_MAX */ + return MAXCONNECTIONS; +} + +static conn_t * +conn_find_by_id(uint32_t id) +{ + rb_dlink_node *ptr; + conn_t *conn; + + RB_DLINK_FOREACH(ptr, (connid_hash(id))->head) + { + conn = ptr->data; + if(conn->id == id && !IsDead(conn)) + return conn; + } + return NULL; +} + +static void +conn_add_id_hash(conn_t * conn, uint32_t id) +{ + conn->id = id; + rb_dlinkAdd(conn, &conn->node, connid_hash(id)); +} + +static void +free_conn(conn_t * conn) +{ + rb_free_rawbuffer(conn->modbuf_out); + rb_free_rawbuffer(conn->plainbuf_out); + rb_free(conn); +} + +static void +clean_dead_conns(void *unused) +{ + conn_t *conn; + rb_dlink_node *ptr, *next; + + RB_DLINK_FOREACH_SAFE(ptr, next, dead_list.head) + { + conn = ptr->data; + free_conn(conn); + } + + dead_list.tail = dead_list.head = NULL; +} + +static conn_t * +make_conn(mod_ctl_t * ctl, rb_fde_t *mod_fd, rb_fde_t *plain_fd) +{ + conn_t *conn = rb_malloc(sizeof(conn_t)); + conn->ctl = ctl; + conn->modbuf_out = rb_new_rawbuffer(); + conn->plainbuf_out = rb_new_rawbuffer(); + conn->mod_fd = mod_fd; + conn->plain_fd = plain_fd; + conn->id = -1; + conn->stream = NULL; + rb_set_nb(mod_fd); + rb_set_nb(plain_fd); + return conn; +} + +static void +cleanup_bad_message(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb) +{ + int i; + + /* XXX should log this somehow */ + for (i = 0; i < ctlb->nfds; i++) + rb_close(ctlb->F[i]); +} + +static void +wsock_process_accept(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb) +{ + conn_t *conn; + uint32_t id; + + conn = make_conn(ctl, ctlb->F[0], ctlb->F[1]); + + id = buf_to_uint32(&ctlb->buf[1]); + conn_add_id_hash(conn, id); + SetWS(conn); + + if(rb_get_type(conn->mod_fd) & RB_FD_UNKNOWN) + rb_set_type(conn->mod_fd, RB_FD_SOCKET); + + if(rb_get_type(conn->plain_fd) == RB_FD_UNKNOWN) + rb_set_type(conn->plain_fd, RB_FD_SOCKET); + + // XXX todo +} + +static void +mod_process_cmd_recv(mod_ctl_t * ctl) +{ + rb_dlink_node *ptr, *next; + mod_ctl_buf_t *ctl_buf; + + RB_DLINK_FOREACH_SAFE(ptr, next, ctl->readq.head) + { + ctl_buf = ptr->data; + + switch (*ctl_buf->buf) + { + case 'A': + { + if (ctl_buf->nfds != 2 || ctl_buf->buflen != 5) + { + cleanup_bad_message(ctl, ctl_buf); + break; + } + wsock_process_accept(ctl, ctl_buf); + break; + } + default: + break; + /* Log unknown commands */ + } + rb_dlinkDelete(ptr, &ctl->readq); + rb_free(ctl_buf->buf); + rb_free(ctl_buf); + } + +} + +static void +mod_read_ctl(rb_fde_t *F, void *data) +{ + mod_ctl_buf_t *ctl_buf; + mod_ctl_t *ctl = data; + int retlen; + int i; + + do + { + ctl_buf = rb_malloc(sizeof(mod_ctl_buf_t)); + ctl_buf->buf = rb_malloc(READBUF_SIZE); + ctl_buf->buflen = READBUF_SIZE; + retlen = rb_recv_fd_buf(ctl->F, ctl_buf->buf, ctl_buf->buflen, ctl_buf->F, + MAXPASSFD); + if(retlen <= 0) + { + rb_free(ctl_buf->buf); + rb_free(ctl_buf); + } + else + { + ctl_buf->buflen = retlen; + rb_dlinkAddTail(ctl_buf, &ctl_buf->node, &ctl->readq); + for (i = 0; i < MAXPASSFD && ctl_buf->F[i] != NULL; i++) + ; + ctl_buf->nfds = i; + } + } + while(retlen > 0); + + if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) + exit(0); + + mod_process_cmd_recv(ctl); + rb_setselect(ctl->F, RB_SELECT_READ, mod_read_ctl, ctl); +} + +static void +mod_write_ctl(rb_fde_t *F, void *data) +{ + mod_ctl_t *ctl = data; + mod_ctl_buf_t *ctl_buf; + rb_dlink_node *ptr, *next; + int retlen, x; + + RB_DLINK_FOREACH_SAFE(ptr, next, ctl->writeq.head) + { + ctl_buf = ptr->data; + retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, + ctl_buf->buflen, ppid); + if(retlen > 0) + { + rb_dlinkDelete(ptr, &ctl->writeq); + for(x = 0; x < ctl_buf->nfds; x++) + rb_close(ctl_buf->F[x]); + rb_free(ctl_buf->buf); + rb_free(ctl_buf); + + } + if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) + exit(0); + + } + if(rb_dlink_list_length(&ctl->writeq) > 0) + rb_setselect(ctl->F, RB_SELECT_WRITE, mod_write_ctl, ctl); +} + +static void +read_pipe_ctl(rb_fde_t *F, void *data) +{ + char inbuf[READBUF_SIZE]; + int retlen; + while((retlen = rb_read(F, inbuf, sizeof(inbuf))) > 0) + { + ;; /* we don't do anything with the pipe really, just care if the other process dies.. */ + } + if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) + exit(0); + rb_setselect(F, RB_SELECT_READ, read_pipe_ctl, NULL); +} + +int +main(int argc, char **argv) +{ + const char *s_ctlfd, *s_pipe, *s_pid; + int ctlfd, pipefd, x, maxfd; + maxfd = maxconn(); + + s_ctlfd = getenv("CTL_FD"); + s_pipe = getenv("CTL_PIPE"); + s_pid = getenv("CTL_PPID"); + + if(s_ctlfd == NULL || s_pipe == NULL || s_pid == NULL) + { + fprintf(stderr, + "This is the charybdis wsockd for internal ircd use.\n"); + fprintf(stderr, + "You aren't supposed to run me directly. Exiting.\n"); + exit(1); + } + + ctlfd = atoi(s_ctlfd); + pipefd = atoi(s_pipe); + ppid = atoi(s_pid); + x = 0; +#ifndef _WIN32 + for(x = 0; x < maxfd; x++) + { + if(x != ctlfd && x != pipefd && x > 2) + close(x); + } + x = open("/dev/null", O_RDWR); + + if(x >= 0) + { + if(ctlfd != 0 && pipefd != 0) + dup2(x, 0); + if(ctlfd != 1 && pipefd != 1) + dup2(x, 1); + if(ctlfd != 2 && pipefd != 2) + dup2(x, 2); + if(x > 2) + close(x); + } +#endif + setup_signals(); + rb_lib_init(NULL, NULL, NULL, 0, maxfd, 1024, 4096); + rb_init_rawbuffers(1024); + + mod_ctl = rb_malloc(sizeof(mod_ctl_t)); + mod_ctl->F = rb_open(ctlfd, RB_FD_SOCKET, "ircd control socket"); + mod_ctl->F_pipe = rb_open(pipefd, RB_FD_PIPE, "ircd pipe"); + rb_set_nb(mod_ctl->F); + rb_set_nb(mod_ctl->F_pipe); + rb_event_addish("clean_dead_conns", clean_dead_conns, NULL, 10); + read_pipe_ctl(mod_ctl->F_pipe, NULL); + mod_read_ctl(mod_ctl->F, mod_ctl); + + rb_lib_loop(0); + return 0; +} From a21a82b1b6f9e16bd45b177dad569f28da685c2d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 21:05:39 -0500 Subject: [PATCH 218/252] Fix dangling line from merge --- authd/authd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/authd/authd.c b/authd/authd.c index b4502a685..8097679b4 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -29,7 +29,6 @@ static void handle_stat(int parc, char *parv[]); rb_helper *authd_helper = NULL; authd_cmd_handler authd_cmd_handlers[256] = { -<<<<<<< HEAD ['C'] = handle_new_connection, ['D'] = resolve_dns, ['R'] = handle_reload, From ee658821e34d7daa7a01ce557c0746e19b43796c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 21:05:52 -0500 Subject: [PATCH 219/252] reject_client: send back ident and hostname with rejection. At the moment (possibly not in the future) ircd will want to override our decision whether or not to accept a client; we need to give them enough information back to ensure they can do it properly. --- authd/provider.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authd/provider.c b/authd/provider.c index e7b07c504..13b9a0a8d 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -173,7 +173,7 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) } /* TODO send back ident */ - rb_helper_write(authd_helper, "R %x %c :%s", auth->cid, reject, reason); + rb_helper_write(authd_helper, "R %x %c %s %s :%s", auth->cid, reject, auth->username, auth->hostname, reason); set_provider_off(auth, id); cancel_providers(auth); From 3ad21f61073225b93ce32e1af6c0caea9efc10ac Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 21:08:46 -0500 Subject: [PATCH 220/252] authd/provider: remove obsolete comment [ci skip] --- authd/provider.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authd/provider.c b/authd/provider.c index 13b9a0a8d..4e17793ee 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -172,7 +172,10 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) break; } - /* TODO send back ident */ + /* We send back username and hostname in case ircd wants to overrule our decision. + * In the future this may not be the case. + * --Elizafox + */ rb_helper_write(authd_helper, "R %x %c %s %s :%s", auth->cid, reject, auth->username, auth->hostname, reason); set_provider_off(auth, id); From 75844b15af33acd0e7877a7ff2229835309bf949 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 21:09:55 -0500 Subject: [PATCH 221/252] authd: fix undefined behaviour --- authd/authd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authd/authd.c b/authd/authd.c index 8097679b4..836d07a54 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -68,7 +68,7 @@ handle_reload(int parc, char *parv[]) if(parc < 2) { /* Reload all handlers */ - for(size_t i = 0; i < sizeof(authd_reload_handlers); handler = authd_reload_handlers[i++]) + for(size_t i = 0; i < 256; handler = authd_reload_handlers[i++]) handler(parv[1][0]); return; From c63cd21e6aa229c7fc0c855981c8e625931ad9de Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 21:10:34 -0500 Subject: [PATCH 222/252] authd: check if handler is NULL, ensure that we do not overflow --- authd/authd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 81c4b3402..8040406c8 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -64,8 +64,11 @@ handle_reload(int parc, char *parv[]) if(parc < 2) { /* Reload all handlers */ - for(size_t i = 0; i < sizeof(authd_reload_handlers); handler = authd_reload_handlers[i++]) - handler(parv[1][0]); + for(size_t i = 0; i < sizeof(authd_reload_handlers); i++) + { + if ((handler = authd_reload_handlers[(unsigned char) i]) != NULL) + handler(parv[1][0]); + } return; } From 58c343f4a85b8fcafc4e444e7a7f38a1f4293303 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Fri, 25 Mar 2016 21:12:28 -0500 Subject: [PATCH 223/252] authd: also check size correctly --- authd/authd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/authd/authd.c b/authd/authd.c index 8040406c8..202dae8c3 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -64,7 +64,7 @@ handle_reload(int parc, char *parv[]) if(parc < 2) { /* Reload all handlers */ - for(size_t i = 0; i < sizeof(authd_reload_handlers); i++) + for(size_t i = 0; i < 256; i++) { if ((handler = authd_reload_handlers[(unsigned char) i]) != NULL) handler(parv[1][0]); From db821ee9ba2c11b11316a1fc03002aaa68cd279d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 21:29:44 -0500 Subject: [PATCH 224/252] authd: split out notices stuff for backporting to master. --- authd/Makefile.am | 7 +++--- authd/authd.c | 1 + authd/notice.c | 48 +++++++++++++++++++++++++++++++++++++ authd/notice.h | 35 +++++++++++++++++++++++++++ authd/provider.c | 27 +-------------------- authd/provider.h | 11 --------- authd/providers/blacklist.c | 1 + authd/providers/ident.c | 7 +++--- authd/providers/rdns.c | 7 +++--- 9 files changed, 98 insertions(+), 46 deletions(-) create mode 100644 authd/notice.c create mode 100644 authd/notice.h diff --git a/authd/Makefile.am b/authd/Makefile.am index 235061c4c..ef2c44a44 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -4,13 +4,14 @@ AM_CPPFLAGS = -I../include -I../librb/include authd_SOURCES = \ authd.c \ - res.c \ - reslib.c \ - reslist.c \ dns.c \ getaddrinfo.c \ getnameinfo.c \ + notice.c \ provider.c \ + res.c \ + reslib.c \ + reslist.c \ providers/blacklist.c \ providers/ident.c \ providers/rdns.c diff --git a/authd/authd.c b/authd/authd.c index acd5bc1e2..d77d87b1b 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -21,6 +21,7 @@ #include "authd.h" #include "dns.h" #include "provider.h" +#include "notice.h" #define MAXPARA 10 diff --git a/authd/notice.c b/authd/notice.c new file mode 100644 index 000000000..3e1d3f8a7 --- /dev/null +++ b/authd/notice.c @@ -0,0 +1,48 @@ +/* authd/notice.c - send notices back to the ircd and to clients + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "authd.h" +#include "notice.h" + +/* Send a notice to a client */ +void notice_client(uint32_t cid, const char *fmt, ...) +{ + char buf[BUFSIZE]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + rb_helper_write(authd_helper, "N %x :%s", cid, buf); +} + +/* Send a warning to the IRC daemon for logging, etc. */ +void warn_opers(notice_level_t level, const char *fmt, ...) +{ + char buf[BUFSIZE]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + rb_helper_write(authd_helper, "W %c :%s", level, buf); +} diff --git a/authd/notice.h b/authd/notice.h new file mode 100644 index 000000000..1e48bccfe --- /dev/null +++ b/authd/notice.h @@ -0,0 +1,35 @@ +/* authd/notice.h - send notices back to the ircd and to clients + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __CHARYBDIS_AUTHD_NOTICE_H__ +#define __CHARYBDIS_AUTHD_NOTICE_H__ + +typedef enum +{ + L_DEBUG = 'D', + L_INFO = 'I', + L_WARN = 'W', + L_CRIT ='C', +} notice_level_t; + +void notice_client(uint32_t cid, const char *fmt, ...); +void warn_opers(notice_level_t level, const char *fmt, ...); + +#endif /* __CHARYBDIS_AUTHD_NOTICE_H__ */ diff --git a/authd/provider.c b/authd/provider.c index 4e17793ee..1a6c6517e 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -49,6 +49,7 @@ #include "rb_dictionary.h" #include "authd.h" #include "provider.h" +#include "notice.h" rb_dlink_list auth_providers; @@ -193,32 +194,6 @@ void accept_client(struct auth_client *auth, provider_t id) cancel_providers(auth); } -/* Send a notice to a client */ -void notice_client(struct auth_client *auth, const char *fmt, ...) -{ - char buf[BUFSIZE]; - va_list args; - - va_start(args, fmt); - vsnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - - rb_helper_write(authd_helper, "N %x :%s", auth->cid, buf); -} - -/* Send a warning to the IRC daemon for logging, etc. */ -void warn_opers(notice_level_t level, const char *fmt, ...) -{ - char buf[BUFSIZE]; - va_list args; - - va_start(args, fmt); - vsnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - - rb_helper_write(authd_helper, "W %c :%s", level, buf); -} - /* Begin authenticating user */ static void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port) { diff --git a/authd/provider.h b/authd/provider.h index ef96ca841..8fab21cf0 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -34,14 +34,6 @@ typedef enum PROVIDER_BLACKLIST, } provider_t; -typedef enum -{ - L_DEBUG = 'D', - L_INFO = 'I', - L_WARN = 'W', - L_CRIT ='C', -} notice_level_t; - struct auth_client { uint16_t cid; /* Client ID */ @@ -103,9 +95,6 @@ void provider_done(struct auth_client *auth, provider_t id); void accept_client(struct auth_client *auth, provider_t id); void reject_client(struct auth_client *auth, provider_t id, const char *reason); -void notice_client(struct auth_client *auth, const char *fmt, ...); -void warn_opers(notice_level_t level, const char *fmt, ...); - void handle_new_connection(int parc, char *parv[]); /* Provider is operating on this auth_client (set this if you have async work to do) */ diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index 22917c03d..df7d3974b 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -39,6 +39,7 @@ #include "authd.h" #include "provider.h" +#include "notice.h" #include "stdinc.h" #include "dns.h" diff --git a/authd/providers/ident.c b/authd/providers/ident.c index a19b289e8..2c5614620 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -21,6 +21,7 @@ #include "stdinc.h" #include "match.h" #include "authd.h" +#include "notice.h" #include "provider.h" #include "res.h" @@ -120,7 +121,7 @@ bool ident_start(struct auth_client *auth) GET_SS_LEN(&l_addr), ident_connected, query, ident_timeout); - notice_client(auth, messages[REPORT_LOOKUP]); + notice_client(auth->cid, messages[REPORT_LOOKUP]); set_provider_on(auth, PROVIDER_IDENT); return true; @@ -249,7 +250,7 @@ static void client_fail(struct auth_client *auth, ident_message report) rb_free(query); auth->data[PROVIDER_IDENT] = NULL; - notice_client(auth, messages[report]); + notice_client(auth->cid, messages[report]); provider_done(auth, PROVIDER_IDENT); } @@ -261,7 +262,7 @@ static void client_success(struct auth_client *auth) rb_free(query); auth->data[PROVIDER_IDENT] = NULL; - notice_client(auth, messages[REPORT_FOUND]); + notice_client(auth->cid, messages[REPORT_FOUND]); provider_done(auth, PROVIDER_IDENT); } diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index ddce08fbc..0b203740a 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -22,6 +22,7 @@ #include "rb_commio.h" #include "authd.h" #include "provider.h" +#include "notice.h" #include "res.h" #include "dns.h" @@ -87,7 +88,7 @@ bool client_dns_start(struct auth_client *auth) query->query = lookup_hostname(auth->c_ip, dns_answer_callback, auth); - notice_client(auth, messages[REPORT_LOOKUP]); + notice_client(auth->cid, messages[REPORT_LOOKUP]); set_provider_on(auth, PROVIDER_RDNS); return true; } @@ -144,7 +145,7 @@ static void client_fail(struct auth_client *auth, dns_message report) rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname)); - notice_client(auth, messages[report]); + notice_client(auth->cid, messages[report]); cancel_query(query->query); rb_free(query); @@ -157,7 +158,7 @@ static void client_success(struct auth_client *auth) { struct user_query *query = auth->data[PROVIDER_RDNS]; - notice_client(auth, messages[REPORT_FOUND]); + notice_client(auth->cid, messages[REPORT_FOUND]); cancel_query(query->query); rb_free(query); From 0a659bf0ab74e7f93840877eae51ac2d65a6fb6c Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 21:57:42 -0500 Subject: [PATCH 225/252] Port notice stuff over from authd-framework-2 and use it. This allows things like oper warnings from authd using the W message type also. --- authd/Makefile.am | 2 +- authd/authd.c | 5 ++++- authd/notice.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ authd/notice.h | 35 ++++++++++++++++++++++++++++++++++ ircd/authd.c | 33 ++++++++++++++++++++++++++++++++ 5 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 authd/notice.c create mode 100644 authd/notice.h diff --git a/authd/Makefile.am b/authd/Makefile.am index 1b8ebf710..a26fdb390 100644 --- a/authd/Makefile.am +++ b/authd/Makefile.am @@ -3,5 +3,5 @@ AM_CFLAGS=$(WARNFLAGS) AM_CPPFLAGS = -I../include -I../librb/include -authd_SOURCES = authd.c res.c reslib.c reslist.c getnameinfo.c getaddrinfo.c dns.c +authd_SOURCES = authd.c res.c reslib.c reslist.c getnameinfo.c getaddrinfo.c dns.c notice.c authd_LDADD = ../librb/src/librb.la diff --git a/authd/authd.c b/authd/authd.c index 202dae8c3..7f210f628 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -20,6 +20,7 @@ #include "authd.h" #include "dns.h" +#include "notice.h" #define MAXPARA 10 @@ -47,8 +48,10 @@ handle_stat(int parc, char *parv[]) authd_stat_handler handler; if(parc < 3) - /* XXX Should log this somehow */ + { + warn_opers(L_CRIT, "BUG: handle_stat received too few parameters (at least 3 expected, got %d)", parc); return; + } if (!(handler = authd_stat_handlers[(unsigned char)parv[2][0]])) return; diff --git a/authd/notice.c b/authd/notice.c new file mode 100644 index 000000000..3e1d3f8a7 --- /dev/null +++ b/authd/notice.c @@ -0,0 +1,48 @@ +/* authd/notice.c - send notices back to the ircd and to clients + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "authd.h" +#include "notice.h" + +/* Send a notice to a client */ +void notice_client(uint32_t cid, const char *fmt, ...) +{ + char buf[BUFSIZE]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + rb_helper_write(authd_helper, "N %x :%s", cid, buf); +} + +/* Send a warning to the IRC daemon for logging, etc. */ +void warn_opers(notice_level_t level, const char *fmt, ...) +{ + char buf[BUFSIZE]; + va_list args; + + va_start(args, fmt); + vsnprintf(buf, sizeof(buf), fmt, args); + va_end(args); + + rb_helper_write(authd_helper, "W %c :%s", level, buf); +} diff --git a/authd/notice.h b/authd/notice.h new file mode 100644 index 000000000..1e48bccfe --- /dev/null +++ b/authd/notice.h @@ -0,0 +1,35 @@ +/* authd/notice.h - send notices back to the ircd and to clients + * Copyright (c) 2016 Elizabeth Myers + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice is present in all copies. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __CHARYBDIS_AUTHD_NOTICE_H__ +#define __CHARYBDIS_AUTHD_NOTICE_H__ + +typedef enum +{ + L_DEBUG = 'D', + L_INFO = 'I', + L_WARN = 'W', + L_CRIT ='C', +} notice_level_t; + +void notice_client(uint32_t cid, const char *fmt, ...); +void warn_opers(notice_level_t level, const char *fmt, ...); + +#endif /* __CHARYBDIS_AUTHD_NOTICE_H__ */ diff --git a/ircd/authd.c b/ircd/authd.c index 30dd30cbb..9c657a3b3 100644 --- a/ircd/authd.c +++ b/ircd/authd.c @@ -114,6 +114,39 @@ parse_authd_reply(rb_helper * helper) } dns_results_callback(parv[1], parv[2], parv[3], parv[4]); break; + case 'W': + if(parc != 3) + { + ilog(L_MAIN, "authd sent a result with wrong number of arguments: got %d", parc); + restart_authd(); + return; + } + + switch(*parv[2]) + { + case 'D': + sendto_realops_snomask(SNO_DEBUG, L_ALL, "authd debug: %s", parv[3]); + break; + case 'I': + sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd info: %s", parv[3]); + inotice("authd info: %s", parv[3]); + break; + case 'W': + sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd WARNING: %s", parv[3]); + iwarn("authd warning: %s", parv[3]); + break; + case 'C': + sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd CRITICAL: %s", parv[3]); + ierror("authd critical: %s", parv[3]); + break; + default: + sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd sent us an unknown oper notice type (%s): %s", parv[2], parv[3]); + ilog(L_MAIN, "authd unknown oper notice type (%s): %s", parv[2], parv[3]); + break; + } + + /* NOTREACHED */ + break; case 'X': case 'Y': case 'Z': From a51487e0e721591dcedcf2f23cd5d3e567269860 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Fri, 25 Mar 2016 23:04:00 -0500 Subject: [PATCH 226/252] authd/provider: add options handlers for providers This allows providers to create handlers for changing their configuration. --- authd/authd.c | 35 ++++++++++++++++++++++++++++++++++- authd/authd.h | 16 ++++++++++++++-- authd/provider.c | 15 +++++++++++++++ authd/provider.h | 5 ++++- 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index d77d87b1b..c6ed0911c 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -27,11 +27,13 @@ static void handle_reload(int parc, char *parv[]); static void handle_stat(int parc, char *parv[]); +static void handle_options(int parc, char *parv[]); rb_helper *authd_helper = NULL; authd_cmd_handler authd_cmd_handlers[256] = { ['C'] = handle_new_connection, ['D'] = resolve_dns, + ['O'] = handle_options, ['R'] = handle_reload, ['S'] = handle_stat, }; @@ -44,6 +46,8 @@ authd_reload_handler authd_reload_handlers[256] = { ['D'] = reload_nameservers, }; +rb_dictionary *authd_option_handlers; + static void handle_stat(int parc, char *parv[]) { @@ -61,6 +65,32 @@ handle_stat(int parc, char *parv[]) handler(parv[1], parv[2][0]); } +static void +handle_options(int parc, char *parv[]) +{ + struct auth_opts_handler *handler; + + if(parc < 4) + { + warn_opers(L_CRIT, "BUG: handle_options received too few parameters (at least 4 expected, got %d)", parc); + return; + } + + if((handler = rb_dictionary_retrieve(authd_option_handlers, parv[1])) == NULL) + { + warn_opers(L_CRIT, "BUG: handle_options got a bad option type %s", parv[1]); + return; + } + + if((parc - 2) < handler->min_parc) + { + warn_opers(L_CRIT, "BUG: handle_options received too few parameters (at least %d expected, got %d)", handler->min_parc, parc); + return; + } + + handler->handler(parv[1], parc - 2, (const char **)(parv + 3)); +} + static void handle_reload(int parc, char *parv[]) { @@ -69,7 +99,7 @@ handle_reload(int parc, char *parv[]) if(parc < 2) { /* Reload all handlers */ - for(size_t i = 0; i < sizeof(authd_reload_handlers); i++) + for(size_t i = 0; i < 256; i++) { if ((handler = authd_reload_handlers[(unsigned char) i]) != NULL) handler(parv[1][0]); @@ -163,6 +193,9 @@ main(int argc, char *argv[]) rb_set_time(); setup_signals(); + + authd_option_handlers = rb_dictionary_create("authd options handlers", strcasecmp); + init_resolver(); init_providers(); rb_init_prng(NULL, RB_PRNG_DEFAULT); diff --git a/authd/authd.h b/authd/authd.h index b44a85d96..07c746ca6 100644 --- a/authd/authd.h +++ b/authd/authd.h @@ -21,12 +21,22 @@ #ifndef _AUTHD_H #define _AUTHD_H -#include -#include +#include "stdinc.h" +#include "rb_lib.h" +#include "rb_dictionary.h" #include "setup.h" #include "ircd_defs.h" +typedef void (*provider_opts_handler_t)(const char *, int, const char **); + +struct auth_opts_handler +{ + const char *option; + int min_parc; + provider_opts_handler_t handler; +}; + extern rb_helper *authd_helper; typedef void (*authd_cmd_handler)(int parc, char *parv[]); @@ -37,4 +47,6 @@ extern authd_cmd_handler authd_cmd_handlers[256]; extern authd_stat_handler authd_stat_handlers[256]; extern authd_reload_handler authd_reload_handlers[256]; +extern rb_dictionary *authd_option_handlers; + #endif diff --git a/authd/provider.c b/authd/provider.c index 1a6c6517e..dfabac955 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -65,12 +65,27 @@ void load_provider(struct auth_provider *provider) return; } + if(provider->opt_handlers != NULL) + { + struct auth_opts_handler *handler; + + for(handler = provider->opt_handlers; handler->option != NULL; handler++) + rb_dictionary_add(authd_option_handlers, handler->option, handler); + } + provider->init(); rb_dlinkAdd(provider, &provider->node, &auth_providers); } void unload_provider(struct auth_provider *provider) { + if(provider->opt_handlers != NULL) + { + struct auth_opts_handler *handler; + + for(handler = provider->opt_handlers; handler->option != NULL; handler++) + rb_dictionary_delete(authd_option_handlers, handler->option); + } provider->destroy(); rb_dlinkDelete(&provider->node, &auth_providers); } diff --git a/authd/provider.h b/authd/provider.h index 8fab21cf0..28deef649 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -22,6 +22,7 @@ #define __CHARYBDIS_AUTHD_PROVIDER_H__ #include "stdinc.h" +#include "authd.h" #include "rb_dictionary.h" #define MAX_PROVIDERS 32 /* This should be enough */ @@ -61,7 +62,7 @@ typedef void (*provider_destroy_t)(void); typedef bool (*provider_start_t)(struct auth_client *); typedef void (*provider_cancel_t)(struct auth_client *); -typedef void (*provider_complete_t)(struct auth_client *, provider_t provider); +typedef void (*provider_complete_t)(struct auth_client *, provider_t); struct auth_provider { @@ -75,6 +76,8 @@ struct auth_provider provider_start_t start; /* Perform authentication */ provider_cancel_t cancel; /* Authentication cancelled */ provider_complete_t completed; /* Callback for when other performers complete (think dependency chains) */ + + struct auth_opts_handler *opt_handlers; }; extern rb_dlink_list auth_providers; From 1fcba3740482e30e305a0fb281a3ea81672a7b96 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 26 Mar 2016 01:29:59 -0500 Subject: [PATCH 227/252] wsockd: conn_t.stream is not needed --- wsockd/wsockd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/wsockd/wsockd.c b/wsockd/wsockd.c index 5c5262cc7..40ded64c2 100644 --- a/wsockd/wsockd.c +++ b/wsockd/wsockd.c @@ -82,7 +82,6 @@ typedef struct _conn uint64_t plain_in; uint64_t plain_out; uint8_t flags; - void *stream; } conn_t; #define FLAG_CORK 0x01 @@ -218,7 +217,6 @@ make_conn(mod_ctl_t * ctl, rb_fde_t *mod_fd, rb_fde_t *plain_fd) conn->mod_fd = mod_fd; conn->plain_fd = plain_fd; conn->id = -1; - conn->stream = NULL; rb_set_nb(mod_fd); rb_set_nb(plain_fd); return conn; From 05e0aa9ac97e9598b1f8986ad670858ba2f74168 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 26 Mar 2016 05:30:52 -0500 Subject: [PATCH 228/252] wsockd: add some stub i/o code --- wsockd/wsockd.c | 184 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 151 insertions(+), 33 deletions(-) diff --git a/wsockd/wsockd.c b/wsockd/wsockd.c index 40ded64c2..7c6bbab24 100644 --- a/wsockd/wsockd.c +++ b/wsockd/wsockd.c @@ -111,6 +111,8 @@ typedef struct _conn static rb_dlink_list connid_hash_table[CONN_HASH_SIZE]; static rb_dlink_list dead_list; +static void conn_plain_read_shutdown_cb(rb_fde_t *fd, void *data); + #ifndef _WIN32 static void dummy_handler(int sig) @@ -207,6 +209,87 @@ clean_dead_conns(void *unused) dead_list.tail = dead_list.head = NULL; } +static void +mod_write_ctl(rb_fde_t *F, void *data) +{ + mod_ctl_t *ctl = data; + mod_ctl_buf_t *ctl_buf; + rb_dlink_node *ptr, *next; + int retlen, x; + + RB_DLINK_FOREACH_SAFE(ptr, next, ctl->writeq.head) + { + ctl_buf = ptr->data; + retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, + ctl_buf->buflen, ppid); + if(retlen > 0) + { + rb_dlinkDelete(ptr, &ctl->writeq); + for(x = 0; x < ctl_buf->nfds; x++) + rb_close(ctl_buf->F[x]); + rb_free(ctl_buf->buf); + rb_free(ctl_buf); + + } + if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) + exit(0); + + } + if(rb_dlink_list_length(&ctl->writeq) > 0) + rb_setselect(ctl->F, RB_SELECT_WRITE, mod_write_ctl, ctl); +} + +static void +mod_cmd_write_queue(mod_ctl_t * ctl, const void *data, size_t len) +{ + mod_ctl_buf_t *ctl_buf; + ctl_buf = rb_malloc(sizeof(mod_ctl_buf_t)); + ctl_buf->buf = rb_malloc(len); + ctl_buf->buflen = len; + memcpy(ctl_buf->buf, data, len); + ctl_buf->nfds = 0; + rb_dlinkAddTail(ctl_buf, &ctl_buf->node, &ctl->writeq); + mod_write_ctl(ctl->F, ctl); +} + +static void +close_conn(conn_t * conn, int wait_plain, const char *fmt, ...) +{ + va_list ap; + char reason[128]; /* must always be under 250 bytes */ + uint8_t buf[256]; + int len; + if(IsDead(conn)) + return; + + rb_rawbuf_flush(conn->modbuf_out, conn->mod_fd); + rb_rawbuf_flush(conn->plainbuf_out, conn->plain_fd); + rb_close(conn->mod_fd); + SetDead(conn); + + rb_dlinkDelete(&conn->node, connid_hash(conn->id)); + + if(!wait_plain || fmt == NULL) + { + rb_close(conn->plain_fd); + rb_dlinkAdd(conn, &conn->node, &dead_list); + return; + } + + rb_setselect(conn->plain_fd, RB_SELECT_READ, conn_plain_read_shutdown_cb, conn); + rb_setselect(conn->plain_fd, RB_SELECT_WRITE, NULL, NULL); + + va_start(ap, fmt); + vsnprintf(reason, sizeof(reason), fmt, ap); + va_end(ap); + + buf[0] = 'D'; + uint32_to_buf(&buf[1], conn->id); + rb_strlcpy((char *) &buf[5], reason, sizeof(buf) - 5); + len = (strlen(reason) + 1) + 5; + mod_cmd_write_queue(conn->ctl, buf, len); +} + static conn_t * make_conn(mod_ctl_t * ctl, rb_fde_t *mod_fd, rb_fde_t *plain_fd) { @@ -233,7 +316,72 @@ cleanup_bad_message(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb) } static void -wsock_process_accept(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb) +conn_mod_handshake_cb(rb_fde_t *fd, void *data) +{ + char inbuf[READBUF_SIZE]; + conn_t *conn = data; + int length = 0; + if (conn == NULL) + return; + + if (IsDead(conn)) + return; + + while (1) + { + if (IsDead(conn)) + return; + + length = rb_read(conn->plain_fd, inbuf, sizeof(inbuf)); + if (length == 0 || (length < 0 && !rb_ignore_errno(errno))) + { + close_conn(conn, NO_WAIT, "Connection closed"); + return; + } + } +} + +static void +conn_mod_read_cb(rb_fde_t *fd, void *data) +{ +} + +static void +conn_plain_read_cb(rb_fde_t *fd, void *data) +{ +} + +static void +conn_plain_read_shutdown_cb(rb_fde_t *fd, void *data) +{ + char inbuf[READBUF_SIZE]; + conn_t *conn = data; + int length = 0; + + if(conn == NULL) + return; + + while(1) + { + length = rb_read(conn->plain_fd, inbuf, sizeof(inbuf)); + + if(length == 0 || (length < 0 && !rb_ignore_errno(errno))) + { + rb_close(conn->plain_fd); + rb_dlinkAdd(conn, &conn->node, &dead_list); + return; + } + + if(length < 0) + { + rb_setselect(conn->plain_fd, RB_SELECT_READ, conn_plain_read_shutdown_cb, conn); + return; + } + } +} + +static void +wsock_process(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb) { conn_t *conn; uint32_t id; @@ -250,7 +398,7 @@ wsock_process_accept(mod_ctl_t * ctl, mod_ctl_buf_t * ctlb) if(rb_get_type(conn->plain_fd) == RB_FD_UNKNOWN) rb_set_type(conn->plain_fd, RB_FD_SOCKET); - // XXX todo + conn_mod_handshake_cb(conn->mod_fd, conn); } static void @@ -272,7 +420,7 @@ mod_process_cmd_recv(mod_ctl_t * ctl) cleanup_bad_message(ctl, ctl_buf); break; } - wsock_process_accept(ctl, ctl_buf); + wsock_process(ctl, ctl_buf); break; } default: @@ -324,36 +472,6 @@ mod_read_ctl(rb_fde_t *F, void *data) rb_setselect(ctl->F, RB_SELECT_READ, mod_read_ctl, ctl); } -static void -mod_write_ctl(rb_fde_t *F, void *data) -{ - mod_ctl_t *ctl = data; - mod_ctl_buf_t *ctl_buf; - rb_dlink_node *ptr, *next; - int retlen, x; - - RB_DLINK_FOREACH_SAFE(ptr, next, ctl->writeq.head) - { - ctl_buf = ptr->data; - retlen = rb_send_fd_buf(ctl->F, ctl_buf->F, ctl_buf->nfds, ctl_buf->buf, - ctl_buf->buflen, ppid); - if(retlen > 0) - { - rb_dlinkDelete(ptr, &ctl->writeq); - for(x = 0; x < ctl_buf->nfds; x++) - rb_close(ctl_buf->F[x]); - rb_free(ctl_buf->buf); - rb_free(ctl_buf); - - } - if(retlen == 0 || (retlen < 0 && !rb_ignore_errno(errno))) - exit(0); - - } - if(rb_dlink_list_length(&ctl->writeq) > 0) - rb_setselect(ctl->F, RB_SELECT_WRITE, mod_write_ctl, ctl); -} - static void read_pipe_ctl(rb_fde_t *F, void *data) { From 3f2695ac861d20ab0f18aa4fdca7447cb4c45dfe Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 15:27:57 -0500 Subject: [PATCH 229/252] providers/blacklist: add configuration interface --- authd/providers/blacklist.c | 111 ++++++++++++++++++++++++++++++++---- 1 file changed, 100 insertions(+), 11 deletions(-) diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index df7d3974b..07de493db 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -81,7 +81,7 @@ struct blacklist_lookup struct blacklist_filter { filter_t type; /* Type of filter */ - char filterstr[HOSTIPLEN]; /* The filter itself */ + char filter[HOSTIPLEN]; /* The filter itself */ rb_dlink_node node; }; @@ -102,8 +102,8 @@ static void blacklists_cancel(struct auth_client *); /* private interfaces */ static void unref_blacklist(struct blacklist *); -static struct blacklist *new_blacklist(char *, char *, bool, bool, rb_dlink_list *); -static struct blacklist *find_blacklist(char *); +static struct blacklist *new_blacklist(const char *, const char *, unsigned char, rb_dlink_list *); +static struct blacklist *find_blacklist(const char *); static bool blacklist_check_reply(struct blacklist_lookup *, const char *); static void blacklist_dns_callback(const char *, bool, query_type, void *); static void initiate_blacklist_dnsquery(struct blacklist *, struct auth_client *); @@ -137,11 +137,11 @@ unref_blacklist(struct blacklist *bl) } static struct blacklist * -new_blacklist(char *name, char *reason, bool ipv4, bool ipv6, rb_dlink_list *filters) +new_blacklist(const char *name, const char *reason, unsigned char iptype, rb_dlink_list *filters) { struct blacklist *bl; - if (name == NULL || reason == NULL || !(ipv4 || ipv6)) + if (name == NULL || reason == NULL || iptype == 0) return NULL; if((bl = find_blacklist(name)) == NULL) @@ -154,10 +154,7 @@ new_blacklist(char *name, char *reason, bool ipv4, bool ipv6, rb_dlink_list *fil rb_strlcpy(bl->host, name, IRCD_RES_HOSTLEN + 1); rb_strlcpy(bl->reason, reason, BUFSIZE); - if(ipv4) - bl->iptype |= IPTYPE_IPV4; - if(ipv6) - bl->iptype |= IPTYPE_IPV6; + bl->iptype = iptype; rb_dlinkMoveList(filters, &bl->filters); @@ -167,7 +164,7 @@ new_blacklist(char *name, char *reason, bool ipv4, bool ipv6, rb_dlink_list *fil } static struct blacklist * -find_blacklist(char *name) +find_blacklist(const char *name) { rb_dlink_node *ptr; @@ -213,7 +210,7 @@ blacklist_check_reply(struct blacklist_lookup *bllookup, const char *ipaddr) continue; } - if (strcmp(cmpstr, filter->filterstr) == 0) + if (strcmp(cmpstr, filter->filter) == 0) /* Match! */ return true; } @@ -422,6 +419,97 @@ blacklists_destroy(void) } } +static void +add_conf_blacklist(const char *key, int parc, const char **parv) +{ + rb_dlink_list filters; + char *tmp, *elemlist = rb_strdup(parv[2]); + unsigned char iptype; + + for(char *elem = rb_strtok_r(elemlist, ",", &tmp); elem; elem = rb_strtok_r(NULL, ",", &tmp)) + { + struct blacklist_filter *filter = rb_malloc(sizeof(struct blacklist_filter)); + int dot_c = 0; + filter_t type = FILTER_LAST; + bool valid = true; + + /* Check blacklist filter type and for validity */ + for(char *c = elem; *c != '\0'; c++) + { + if(*c == '.') + { + if(++dot_c > 3) + { + warn_opers(L_CRIT, "addr_conf_blacklist got a bad filter (too many octets)"); + valid = false; + break; + } + + type = FILTER_ALL; + } + else if(!isdigit(*c)) + { + warn_opers(L_CRIT, "addr_conf_blacklist got a bad filter (invalid character in blacklist filter: %c)", *c); + valid = false; + break; + } + } + + if(valid && dot_c > 0 && dot_c < 3) + { + warn_opers(L_CRIT, "addr_conf_blacklist got a bad filter (insufficient octets)"); + valid = false; + } + + if(!valid) + { + rb_free(filter); + continue; + } + + filter->type = type; + rb_strlcpy(filter->filter, elem, sizeof(filter->filter)); + rb_dlinkAdd(filter, &filter->node, &filters); + } + + rb_free(elemlist); + + iptype = atoi(parv[1]) & 0x3; + if(new_blacklist(parv[0], parv[3], iptype, &filters) == NULL) + { + rb_dlink_node *ptr, *nptr; + + warn_opers(L_CRIT, "addr_conf_blacklist got a malformed blacklist"); + + RB_DLINK_FOREACH_SAFE(ptr, nptr, filters.head) + { + rb_free(ptr->data); + rb_dlinkDelete(ptr, &filters); + } + } +} + +static void +add_conf_blacklist_timeout(const char *key, int parc, const char **parv) +{ + int timeout = atoi(parv[0]); + + if(timeout < 0) + { + warn_opers(L_CRIT, "BUG: timeout < 0 (value: %d)", timeout); + return; + } + + blacklist_timeout = timeout; +} + +struct auth_opts_handler blacklist_options[] = +{ + { "rbl", 4, add_conf_blacklist }, + { "rbl_timeout", 1, add_conf_blacklist_timeout }, + { NULL, 0, NULL }, +}; + struct auth_provider blacklist_provider = { .id = PROVIDER_BLACKLIST, @@ -430,4 +518,5 @@ struct auth_provider blacklist_provider = .start = blacklists_start, .cancel = blacklists_cancel, .completed = blacklists_initiate, + .opt_handlers = blacklist_options, }; From 646e6567c7454a9dd7eb85daeb1fc77006d6ca99 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 15:36:12 -0500 Subject: [PATCH 230/252] providers/rdns: add configuration interface for rDNS timeout --- authd/providers/blacklist.c | 2 +- authd/providers/rdns.c | 121 ++++++++++++++++++++++-------------- 2 files changed, 75 insertions(+), 48 deletions(-) diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index 07de493db..ad7b4a45a 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -496,7 +496,7 @@ add_conf_blacklist_timeout(const char *key, int parc, const char **parv) if(timeout < 0) { - warn_opers(L_CRIT, "BUG: timeout < 0 (value: %d)", timeout); + warn_opers(L_CRIT, "BUG: blacklist timeout < 0 (value: %d)", timeout); return; } diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index 0b203740a..6e99a6fc9 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -57,50 +57,6 @@ static struct ev_entry *timeout_ev; static EVH timeout_dns_queries_event; static int rdns_timeout = 15; - -bool client_dns_init(void) -{ - timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 1); - return (timeout_ev != NULL); -} - -void client_dns_destroy(void) -{ - struct auth_client *auth; - rb_dictionary_iter iter; - - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) - { - if(auth->data[PROVIDER_RDNS] != NULL) - client_fail(auth, REPORT_FAIL); - } - - rb_event_delete(timeout_ev); -} - -bool client_dns_start(struct auth_client *auth) -{ - struct user_query *query = rb_malloc(sizeof(struct user_query)); - - query->timeout = rb_current_time() + rdns_timeout; - - auth->data[PROVIDER_RDNS] = query; - - query->query = lookup_hostname(auth->c_ip, dns_answer_callback, auth); - - notice_client(auth->cid, messages[REPORT_LOOKUP]); - set_provider_on(auth, PROVIDER_RDNS); - return true; -} - -void client_dns_cancel(struct auth_client *auth) -{ - struct user_query *query = auth->data[PROVIDER_RDNS]; - - if(query != NULL) - client_fail(auth, REPORT_FAIL); -} - static void dns_answer_callback(const char *res, bool status, query_type type, void *data) { @@ -119,7 +75,8 @@ dns_answer_callback(const char *res, bool status, query_type type, void *data) } /* Timeout outstanding queries */ -static void timeout_dns_queries_event(void *notused) +static void +timeout_dns_queries_event(void *notused) { struct auth_client *auth; rb_dictionary_iter iter; @@ -136,7 +93,8 @@ static void timeout_dns_queries_event(void *notused) } } -static void client_fail(struct auth_client *auth, dns_message report) +static void +client_fail(struct auth_client *auth, dns_message report) { struct user_query *query = auth->data[PROVIDER_RDNS]; @@ -154,7 +112,8 @@ static void client_fail(struct auth_client *auth, dns_message report) provider_done(auth, PROVIDER_RDNS); } -static void client_success(struct auth_client *auth) +static void +client_success(struct auth_client *auth) { struct user_query *query = auth->data[PROVIDER_RDNS]; @@ -167,6 +126,73 @@ static void client_success(struct auth_client *auth) provider_done(auth, PROVIDER_RDNS); } +static bool +client_dns_init(void) +{ + timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 1); + return (timeout_ev != NULL); +} + +static void +client_dns_destroy(void) +{ + struct auth_client *auth; + rb_dictionary_iter iter; + + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + { + if(auth->data[PROVIDER_RDNS] != NULL) + client_fail(auth, REPORT_FAIL); + } + + rb_event_delete(timeout_ev); +} + +static bool +client_dns_start(struct auth_client *auth) +{ + struct user_query *query = rb_malloc(sizeof(struct user_query)); + + query->timeout = rb_current_time() + rdns_timeout; + + auth->data[PROVIDER_RDNS] = query; + + query->query = lookup_hostname(auth->c_ip, dns_answer_callback, auth); + + notice_client(auth->cid, messages[REPORT_LOOKUP]); + set_provider_on(auth, PROVIDER_RDNS); + return true; +} + +static void +client_dns_cancel(struct auth_client *auth) +{ + struct user_query *query = auth->data[PROVIDER_RDNS]; + + if(query != NULL) + client_fail(auth, REPORT_FAIL); +} + +static void +add_conf_dns_timeout(const char *key, int parc, const char **parv) +{ + int timeout = atoi(parv[0]); + + if(timeout < 0) + { + warn_opers(L_CRIT, "BUG: DNS timeout < 0 (value: %d)", timeout); + return; + } + + rdns_timeout = timeout; +} + +struct auth_opts_handler rdns_options[] = +{ + { "dns_timeout", 1, add_conf_dns_timeout }, + { NULL, 0, NULL }, +}; + struct auth_provider rdns_provider = { .id = PROVIDER_RDNS, @@ -175,4 +201,5 @@ struct auth_provider rdns_provider = .start = client_dns_start, .cancel = client_dns_cancel, .completed = NULL, + .opt_handlers = rdns_options, }; From 06f3496ab39dde778287d55cdcd6c1c1078bd2b8 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 15:39:55 -0500 Subject: [PATCH 231/252] providers/ident: cleanup things --- authd/providers/ident.c | 174 +++++++++++++++++++++------------------- 1 file changed, 93 insertions(+), 81 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 2c5614620..714102b7b 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -18,6 +18,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* Largely adapted from old s_auth.c, but reworked for authd. rDNS code + * moved to its own provider. + * + * --Elizafox 13 March 2016 + */ + #include "stdinc.h" #include "match.h" #include "authd.h" @@ -60,83 +66,9 @@ static struct ev_entry *timeout_ev; static int ident_timeout = 5; -bool ident_init(void) -{ - timeout_ev = rb_event_addish("timeout_ident_queries_event", timeout_ident_queries_event, NULL, 1); - return (timeout_ev != NULL); -} - -void ident_destroy(void) -{ - struct auth_client *auth; - rb_dictionary_iter iter; - - /* Nuke all ident queries */ - RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) - { - if(auth->data[PROVIDER_IDENT] != NULL) - client_fail(auth, REPORT_FAIL); - } -} - -bool ident_start(struct auth_client *auth) -{ - struct ident_query *query = rb_malloc(sizeof(struct ident_query)); - struct rb_sockaddr_storage l_addr, c_addr; - int family; - rb_fde_t *F; - - auth->data[PROVIDER_IDENT] = query; - query->timeout = rb_current_time() + ident_timeout; - - if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL) - { - client_fail(auth, REPORT_FAIL); - return true; /* Not a fatal error */ - } - - query->F = F; - - /* Build sockaddr_storages for rb_connect_tcp below */ - memcpy(&l_addr, &auth->l_addr, sizeof(l_addr)); - memcpy(&c_addr, &auth->c_addr, sizeof(c_addr)); - - /* Set the ports correctly */ -#ifdef RB_IPV6 - if(GET_SS_FAMILY(&l_addr) == AF_INET6) - ((struct sockaddr_in6 *)&l_addr)->sin6_port = 0; - else -#endif - ((struct sockaddr_in *)&l_addr)->sin_port = 0; - -#ifdef RB_IPV6 - if(GET_SS_FAMILY(&c_addr) == AF_INET6) - ((struct sockaddr_in6 *)&c_addr)->sin6_port = htons(113); - else -#endif - ((struct sockaddr_in *)&c_addr)->sin_port = htons(113); - - rb_connect_tcp(F, (struct sockaddr *)&c_addr, - (struct sockaddr *)&l_addr, - GET_SS_LEN(&l_addr), ident_connected, - query, ident_timeout); - - notice_client(auth->cid, messages[REPORT_LOOKUP]); - set_provider_on(auth, PROVIDER_IDENT); - - return true; -} - -void ident_cancel(struct auth_client *auth) -{ - struct ident_query *query = auth->data[PROVIDER_IDENT]; - - if(query != NULL) - client_fail(auth, REPORT_FAIL); -} - /* Timeout outstanding queries */ -static void timeout_ident_queries_event(void *notused) +static void +timeout_ident_queries_event(void *notused) { struct auth_client *auth; rb_dictionary_iter iter; @@ -161,7 +93,8 @@ static void timeout_ident_queries_event(void *notused) * a write buffer far greater than this message to store it in should * problems arise. -avalon */ -static void ident_connected(rb_fde_t *F, int error, void *data) +static void +ident_connected(rb_fde_t *F, int error, void *data) { struct auth_client *auth = data; struct ident_query *query = auth->data[PROVIDER_IDENT]; @@ -240,7 +173,8 @@ read_ident_reply(rb_fde_t *F, void *data) client_success(auth); } -static void client_fail(struct auth_client *auth, ident_message report) +static void +client_fail(struct auth_client *auth, ident_message report) { struct ident_query *query = auth->data[PROVIDER_IDENT]; @@ -254,7 +188,8 @@ static void client_fail(struct auth_client *auth, ident_message report) provider_done(auth, PROVIDER_IDENT); } -static void client_success(struct auth_client *auth) +static void +client_success(struct auth_client *auth) { struct ident_query *query = auth->data[PROVIDER_IDENT]; @@ -269,8 +204,7 @@ static void client_success(struct auth_client *auth) /* get_valid_ident * parse ident query reply from identd server * - * Torn out of old s_auth.c because there was nothing wrong with it - * --Elizafox + * Taken from old s_auth.c --Elizafox * * Inputs - pointer to ident buf * Outputs - NULL if no valid ident found, otherwise pointer to name @@ -331,6 +265,84 @@ get_valid_ident(char *buf) return (colon3Ptr); } +static bool +ident_init(void) +{ + timeout_ev = rb_event_addish("timeout_ident_queries_event", timeout_ident_queries_event, NULL, 1); + return (timeout_ev != NULL); +} + +static void +ident_destroy(void) +{ + struct auth_client *auth; + rb_dictionary_iter iter; + + /* Nuke all ident queries */ + RB_DICTIONARY_FOREACH(auth, &iter, auth_clients) + { + if(auth->data[PROVIDER_IDENT] != NULL) + client_fail(auth, REPORT_FAIL); + } +} + +static bool ident_start(struct auth_client *auth) +{ + struct ident_query *query = rb_malloc(sizeof(struct ident_query)); + struct rb_sockaddr_storage l_addr, c_addr; + int family; + rb_fde_t *F; + + auth->data[PROVIDER_IDENT] = query; + query->timeout = rb_current_time() + ident_timeout; + + if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL) + { + client_fail(auth, REPORT_FAIL); + return true; /* Not a fatal error */ + } + + query->F = F; + + /* Build sockaddr_storages for rb_connect_tcp below */ + memcpy(&l_addr, &auth->l_addr, sizeof(l_addr)); + memcpy(&c_addr, &auth->c_addr, sizeof(c_addr)); + + /* Set the ports correctly */ +#ifdef RB_IPV6 + if(GET_SS_FAMILY(&l_addr) == AF_INET6) + ((struct sockaddr_in6 *)&l_addr)->sin6_port = 0; + else +#endif + ((struct sockaddr_in *)&l_addr)->sin_port = 0; + +#ifdef RB_IPV6 + if(GET_SS_FAMILY(&c_addr) == AF_INET6) + ((struct sockaddr_in6 *)&c_addr)->sin6_port = htons(113); + else +#endif + ((struct sockaddr_in *)&c_addr)->sin_port = htons(113); + + rb_connect_tcp(F, (struct sockaddr *)&c_addr, + (struct sockaddr *)&l_addr, + GET_SS_LEN(&l_addr), ident_connected, + query, ident_timeout); + + notice_client(auth->cid, messages[REPORT_LOOKUP]); + set_provider_on(auth, PROVIDER_IDENT); + + return true; +} + +static void +ident_cancel(struct auth_client *auth) +{ + struct ident_query *query = auth->data[PROVIDER_IDENT]; + + if(query != NULL) + client_fail(auth, REPORT_FAIL); +} + struct auth_provider ident_provider = { From de8b3b7174f33d5ed7051cddaf211d9058230469 Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Sat, 26 Mar 2016 16:41:36 -0400 Subject: [PATCH 232/252] sslproc: Remove unused variable --- ircd/sslproc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ircd/sslproc.c b/ircd/sslproc.c index 709504ac8..55c7ba6dc 100644 --- a/ircd/sslproc.c +++ b/ircd/sslproc.c @@ -809,7 +809,6 @@ start_zlib_session(void *data) rb_fde_t *F[2]; rb_fde_t *xF1, *xF2; char *buf; - char buf2[9]; void *recvq_start; size_t hdr = (sizeof(uint8_t) * 2) + sizeof(uint32_t); From a0a218bac88652a27fc57b4973c9a73101dabd7f Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 16:36:14 -0500 Subject: [PATCH 233/252] authd/providers/blacklist: add configuration interface for deletion --- authd/providers/blacklist.c | 57 ++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index ad7b4a45a..a99f0c90e 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -323,6 +323,29 @@ lookup_all_blacklists(struct auth_client *auth) bluser->timeout = rb_current_time() + blacklist_timeout; } +static inline void +delete_blacklist(struct blacklist *bl) +{ + if (bl->refcount > 0) + bl->delete = true; + else + { + rb_dlinkFindDestroy(bl, &blacklist_list); + rb_free(bl); + } +} + +static void +delete_all_blacklists(void) +{ + rb_dlink_node *ptr, *nptr; + + RB_DLINK_FOREACH_SAFE(ptr, nptr, blacklist_list.head) + { + delete_blacklist(ptr->data); + } +} + /* public interfaces */ static bool blacklists_start(struct auth_client *auth) @@ -406,17 +429,8 @@ blacklists_destroy(void) blacklists_cancel(auth); } - RB_DLINK_FOREACH_SAFE(ptr, nptr, blacklist_list.head) - { - bl = ptr->data; - if (bl->refcount > 0) - bl->delete = true; - else - { - rb_free(ptr->data); - rb_dlinkDestroy(ptr, &blacklist_list); - } - } + delete_all_blacklists(); + rb_event_delete(timeout_ev); } static void @@ -489,6 +503,25 @@ add_conf_blacklist(const char *key, int parc, const char **parv) } } +static void +del_conf_blacklist(const char *key, int parc, const char **parv) +{ + struct blacklist *bl = find_blacklist(parv[0]); + if(bl == NULL) + { + warn_opers(L_CRIT, "BUG: tried to remove nonexistent blacklist %s", parv[0]); + return; + } + + delete_blacklist(bl); +} + +static void +del_conf_blacklist_all(const char *key, int parc, const char **parv) +{ + delete_all_blacklists(); +} + static void add_conf_blacklist_timeout(const char *key, int parc, const char **parv) { @@ -506,6 +539,8 @@ add_conf_blacklist_timeout(const char *key, int parc, const char **parv) struct auth_opts_handler blacklist_options[] = { { "rbl", 4, add_conf_blacklist }, + { "rbl_del", 1, del_conf_blacklist }, + { "rbl_del_all", 0, del_conf_blacklist_all }, { "rbl_timeout", 1, add_conf_blacklist_timeout }, { NULL, 0, NULL }, }; From 67acafca57ea211b3bcf5b7f84f982b2b632ee67 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 16:36:50 -0500 Subject: [PATCH 234/252] authd/providers/ident: add configuration interface --- authd/providers/ident.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 714102b7b..442a84ca0 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -343,6 +343,26 @@ ident_cancel(struct auth_client *auth) client_fail(auth, REPORT_FAIL); } +static void +add_conf_ident_timeout(const char *key, int parc, const char **parv) +{ + int timeout = atoi(parv[0]); + + if(timeout < 0) + { + warn_opers(L_CRIT, "BUG: ident timeout < 0 (value: %d)", timeout); + return; + } + + ident_timeout = timeout; +} + +struct auth_opts_handler ident_options[] = +{ + { "ident_timeout", 1, add_conf_ident_timeout }, + { NULL, 0, NULL }, +}; + struct auth_provider ident_provider = { @@ -352,4 +372,5 @@ struct auth_provider ident_provider = .start = ident_start, .cancel = ident_cancel, .completed = NULL, + .opt_handlers = ident_options, }; From 6ced6a1f1acfa1b04bedef65932d602caf1df63a Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 16:37:04 -0500 Subject: [PATCH 235/252] authd/providers/rdns: minor function renaming cleanup --- authd/providers/rdns.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/authd/providers/rdns.c b/authd/providers/rdns.c index 6e99a6fc9..e5e1f6ddc 100644 --- a/authd/providers/rdns.c +++ b/authd/providers/rdns.c @@ -127,14 +127,14 @@ client_success(struct auth_client *auth) } static bool -client_dns_init(void) +rdns_init(void) { timeout_ev = rb_event_addish("timeout_dns_queries_event", timeout_dns_queries_event, NULL, 1); return (timeout_ev != NULL); } static void -client_dns_destroy(void) +rdns_destroy(void) { struct auth_client *auth; rb_dictionary_iter iter; @@ -149,7 +149,7 @@ client_dns_destroy(void) } static bool -client_dns_start(struct auth_client *auth) +rdns_start(struct auth_client *auth) { struct user_query *query = rb_malloc(sizeof(struct user_query)); @@ -165,7 +165,7 @@ client_dns_start(struct auth_client *auth) } static void -client_dns_cancel(struct auth_client *auth) +rdns_cancel(struct auth_client *auth) { struct user_query *query = auth->data[PROVIDER_RDNS]; @@ -196,10 +196,10 @@ struct auth_opts_handler rdns_options[] = struct auth_provider rdns_provider = { .id = PROVIDER_RDNS, - .init = client_dns_init, - .destroy = client_dns_destroy, - .start = client_dns_start, - .cancel = client_dns_cancel, + .init = rdns_init, + .destroy = rdns_destroy, + .start = rdns_start, + .cancel = rdns_cancel, .completed = NULL, .opt_handlers = rdns_options, }; From 938f93f4bced4c7abd743211ac8381b02ac53236 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 16:44:41 -0500 Subject: [PATCH 236/252] ircd/authd: some comments --- ircd/authd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ircd/authd.c b/ircd/authd.c index 9c657a3b3..8b4533930 100644 --- a/ircd/authd.c +++ b/ircd/authd.c @@ -124,22 +124,22 @@ parse_authd_reply(rb_helper * helper) switch(*parv[2]) { - case 'D': + case 'D': /* debug */ sendto_realops_snomask(SNO_DEBUG, L_ALL, "authd debug: %s", parv[3]); break; - case 'I': + case 'I': /* Info */ sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd info: %s", parv[3]); inotice("authd info: %s", parv[3]); break; - case 'W': + case 'W': /* Warning */ sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd WARNING: %s", parv[3]); iwarn("authd warning: %s", parv[3]); break; - case 'C': + case 'C': /* Critical (error) */ sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd CRITICAL: %s", parv[3]); ierror("authd critical: %s", parv[3]); break; - default: + default: /* idk */ sendto_realops_snomask(SNO_GENERAL, L_ALL, "authd sent us an unknown oper notice type (%s): %s", parv[2], parv[3]); ilog(L_MAIN, "authd unknown oper notice type (%s): %s", parv[2], parv[3]); break; From cdf1592915ae34a74df2de13caca43e6927162d6 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 16:53:43 -0500 Subject: [PATCH 237/252] Check these out from authd-framework-2. --- authd/dns.h | 5 ----- authd/provider.h | 19 +------------------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/authd/dns.h b/authd/dns.h index 9db7ea97d..a21d98585 100644 --- a/authd/dns.h +++ b/authd/dns.h @@ -50,15 +50,10 @@ struct dns_query void *data; }; -<<<<<<< HEAD -extern void format_address(struct rb_sockaddr_storage *addr, char *buffer, size_t length); -extern bool sockcmp(struct rb_sockaddr_storage *addr, struct rb_sockaddr_storage *addr2, int family); -======= extern struct dns_query *lookup_hostname(const char *ip, DNSCB callback, void *data); extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); extern void cancel_query(struct dns_query *query); ->>>>>>> authd-framework-2 extern void resolve_dns(int parc, char *parv[]); extern void enumerate_nameservers(const char *rid, const char letter); extern void reload_nameservers(const char letter); diff --git a/authd/provider.h b/authd/provider.h index fc78903c8..28deef649 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -39,10 +39,6 @@ struct auth_client { uint16_t cid; /* Client ID */ -<<<<<<< HEAD - struct rb_sockaddr_storage l_addr; /* Listener IP address */ - struct rb_sockaddr_storage c_addr; /* Client IP address */ -======= char l_ip[HOSTIPLEN + 1]; /* Listener IP address */ uint16_t l_port; /* Listener port */ struct rb_sockaddr_storage l_addr; /* Listener address/port */ @@ -50,23 +46,10 @@ struct auth_client char c_ip[HOSTIPLEN + 1]; /* Client IP address */ uint16_t c_port; /* Client port */ struct rb_sockaddr_storage c_addr; /* Client address/port */ ->>>>>>> authd-framework-2 char hostname[HOSTLEN + 1]; /* Used for DNS lookup */ char username[USERLEN + 1]; /* Used for ident lookup */ -<<<<<<< HEAD - unsigned int providers; /* Providers at work, - * none left when set to 0 */ -}; - -typedef bool (*provider_init_t)(void); -typedef bool (*provider_perform_t)(struct auth_client *); -typedef void (*provider_complete_t)(struct auth_client *, provider_t provider); -typedef void (*provider_cancel_t)(struct auth_client *); -typedef void (*provider_destroy_t)(void); - -======= uint32_t providers; /* Providers at work, * none left when set to 0 */ uint32_t providers_done; /* Providers completed */ @@ -81,7 +64,6 @@ typedef bool (*provider_start_t)(struct auth_client *); typedef void (*provider_cancel_t)(struct auth_client *); typedef void (*provider_complete_t)(struct auth_client *, provider_t); ->>>>>>> authd-framework-2 struct auth_provider { rb_dlink_node node; @@ -118,6 +100,7 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason); void handle_new_connection(int parc, char *parv[]); +/* Provider is operating on this auth_client (set this if you have async work to do) */ static inline void set_provider_on(struct auth_client *auth, provider_t provider) { auth->providers |= (1 << provider); From 47ab6f6e6e2b471eb9c4d605fe25b5c1803ebbb5 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 17:35:48 -0500 Subject: [PATCH 238/252] authd/providers/ident: properly initialise variable --- authd/providers/ident.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 442a84ca0..30708e403 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -290,20 +290,20 @@ static bool ident_start(struct auth_client *auth) { struct ident_query *query = rb_malloc(sizeof(struct ident_query)); struct rb_sockaddr_storage l_addr, c_addr; - int family; - rb_fde_t *F; + int family = GET_SS_FAMILY(&auth->c_addr); + + notice_client(auth->cid, messages[REPORT_LOOKUP]); auth->data[PROVIDER_IDENT] = query; query->timeout = rb_current_time() + ident_timeout; - if((F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL) + if((query->F = rb_socket(family, SOCK_STREAM, 0, "ident")) == NULL) { + warn_opers(L_DEBUG, "Could not create ident socket: %s", strerror(errno)); client_fail(auth, REPORT_FAIL); return true; /* Not a fatal error */ } - query->F = F; - /* Build sockaddr_storages for rb_connect_tcp below */ memcpy(&l_addr, &auth->l_addr, sizeof(l_addr)); memcpy(&c_addr, &auth->c_addr, sizeof(c_addr)); @@ -323,12 +323,11 @@ static bool ident_start(struct auth_client *auth) #endif ((struct sockaddr_in *)&c_addr)->sin_port = htons(113); - rb_connect_tcp(F, (struct sockaddr *)&c_addr, + rb_connect_tcp(query->F, (struct sockaddr *)&c_addr, (struct sockaddr *)&l_addr, GET_SS_LEN(&l_addr), ident_connected, query, ident_timeout); - notice_client(auth->cid, messages[REPORT_LOOKUP]); set_provider_on(auth, PROVIDER_IDENT); return true; From f875cb848236bfa8956f1cb8fb350937d389781d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 18:01:14 -0500 Subject: [PATCH 239/252] providers/ident: more aggressive NULL checks --- authd/providers/ident.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 30708e403..082c95aa7 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -42,9 +42,9 @@ struct ident_query /* Goinked from old s_auth.c --Elizafox */ static const char *messages[] = { - ":*** Checking Ident", - ":*** Got Ident response", - ":*** No Ident response", + "*** Checking Ident", + "*** Got Ident response", + "*** No Ident response", }; typedef enum @@ -101,6 +101,9 @@ ident_connected(rb_fde_t *F, int error, void *data) char authbuf[32]; int authlen; + if(query == NULL) + return; + /* Check the error */ if(error != RB_OK) { @@ -133,6 +136,9 @@ read_ident_reply(rb_fde_t *F, void *data) int count; char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */ + if(query == NULL) + return; + len = rb_read(F, buf, IDENT_BUFSIZE); if(len < 0 && rb_ignore_errno(errno)) { @@ -178,9 +184,14 @@ client_fail(struct auth_client *auth, ident_message report) { struct ident_query *query = auth->data[PROVIDER_IDENT]; + if(query == NULL) + return; + rb_strlcpy(auth->username, "*", sizeof(auth->username)); - rb_close(query->F); + if(query->F != NULL) + rb_close(query->F); + rb_free(query); auth->data[PROVIDER_IDENT] = NULL; @@ -193,7 +204,12 @@ client_success(struct auth_client *auth) { struct ident_query *query = auth->data[PROVIDER_IDENT]; - rb_close(query->F); + if(query == NULL) + return; + + if(query->F != NULL) + rb_close(query->F); + rb_free(query); auth->data[PROVIDER_IDENT] = NULL; From 0cff7adb13278fa92b438390e7cb5be871262083 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 18:01:58 -0500 Subject: [PATCH 240/252] authd/provider: some fixes --- authd/provider.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index dfabac955..d048ae7ae 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -244,6 +244,8 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co #endif ((struct sockaddr_in *)&auth->c_addr)->sin_port = htons(auth->c_port); + memset(auth->data, 0, sizeof(auth->data)); + rb_dictionary_add(auth_clients, RB_UINT_TO_POINTER(auth->cid), auth); RB_DLINK_FOREACH(ptr, auth_providers.head) @@ -267,9 +269,9 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co /* Callback for the initiation */ void handle_new_connection(int parc, char *parv[]) { - if(parc < 7) + if(parc < 6) { - warn_opers(L_CRIT, "BUG: received too few params for new connection (7 expected, got %d)", parc); + warn_opers(L_CRIT, "BUG: received too few params for new connection (6 expected, got %d)", parc); return; } From d1b70e352451d33a54e0afe966bfe302834756a8 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 18:40:17 -0500 Subject: [PATCH 241/252] providers/ident: fix some nasty crashes --- authd/providers/ident.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 082c95aa7..c32d026f1 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -68,7 +68,7 @@ static int ident_timeout = 5; /* Timeout outstanding queries */ static void -timeout_ident_queries_event(void *notused) +timeout_ident_queries_event(void *notused __unused) { struct auth_client *auth; rb_dictionary_iter iter; @@ -94,13 +94,18 @@ timeout_ident_queries_event(void *notused) * problems arise. -avalon */ static void -ident_connected(rb_fde_t *F, int error, void *data) +ident_connected(rb_fde_t *F __unused, int error, void *data) { struct auth_client *auth = data; - struct ident_query *query = auth->data[PROVIDER_IDENT]; + struct ident_query *query; char authbuf[32]; int authlen; + if(auth == NULL) + return; + + query = auth->data[PROVIDER_IDENT]; + if(query == NULL) return; @@ -129,20 +134,25 @@ static void read_ident_reply(rb_fde_t *F, void *data) { struct auth_client *auth = data; - struct ident_query *query = auth->data[PROVIDER_IDENT]; + struct ident_query *query; char *s = NULL; char *t = NULL; int len; int count; char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */ + if(auth == NULL) + return; + + query = auth->data[PROVIDER_IDENT]; + if(query == NULL) return; len = rb_read(F, buf, IDENT_BUFSIZE); if(len < 0 && rb_ignore_errno(errno)) { - rb_setselect(F, RB_SELECT_READ, read_ident_reply, query); + rb_setselect(F, RB_SELECT_READ, read_ident_reply, auth); return; } @@ -342,7 +352,7 @@ static bool ident_start(struct auth_client *auth) rb_connect_tcp(query->F, (struct sockaddr *)&c_addr, (struct sockaddr *)&l_addr, GET_SS_LEN(&l_addr), ident_connected, - query, ident_timeout); + auth, ident_timeout); set_provider_on(auth, PROVIDER_IDENT); @@ -359,7 +369,7 @@ ident_cancel(struct auth_client *auth) } static void -add_conf_ident_timeout(const char *key, int parc, const char **parv) +add_conf_ident_timeout(const char *key __unused, int parc __unused, const char **parv) { int timeout = atoi(parv[0]); From 22946d30d5234787683021cbb89ad457735222d4 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 19:18:54 -0500 Subject: [PATCH 242/252] authd/providers/ident: fix up trailing lf/cr at end of username This bug existed in the original code too, but I have no idea how it didn't manifest. --- authd/providers/ident.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index c32d026f1..130c0e434 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -45,6 +45,7 @@ static const char *messages[] = "*** Checking Ident", "*** Got Ident response", "*** No Ident response", + "*** Cannot verify ident validity, ignoring ident", }; typedef enum @@ -52,6 +53,7 @@ typedef enum REPORT_LOOKUP, REPORT_FOUND, REPORT_FAIL, + REPORT_INVALID, } ident_message; static EVH timeout_ident_queries_event; @@ -135,11 +137,12 @@ read_ident_reply(rb_fde_t *F, void *data) { struct auth_client *auth = data; struct ident_query *query; + char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */ + ident_message message = REPORT_FAIL; char *s = NULL; char *t = NULL; - int len; + ssize_t len; int count; - char buf[IDENT_BUFSIZE + 1]; /* buffer to read auth reply into */ if(auth == NULL) return; @@ -158,9 +161,7 @@ read_ident_reply(rb_fde_t *F, void *data) if(len > 0) { - buf[len] = '\0'; - - if((s = get_valid_ident(buf))) + if((s = get_valid_ident(buf)) != NULL) { t = auth->username; @@ -169,10 +170,9 @@ read_ident_reply(rb_fde_t *F, void *data) for (count = USERLEN; *s && count; s++) { - if(*s == '@') - { + if(*s == '@' || *s == '\r' || *s == '\n') break; - } + if(*s != ' ' && *s != ':' && *s != '[') { *t++ = *s; @@ -181,10 +181,14 @@ read_ident_reply(rb_fde_t *F, void *data) } *t = '\0'; } + else + message = REPORT_INVALID; } + warn_opers(L_DEBUG, "Got username: '%s'", auth->username); + if(s == NULL) - client_fail(auth, REPORT_FAIL); + client_fail(auth, message); else client_success(auth); } @@ -252,39 +256,39 @@ get_valid_ident(char *buf) colon1Ptr = strchr(remotePortString, ':'); if(!colon1Ptr) - return 0; + return NULL; *colon1Ptr = '\0'; colon1Ptr++; colon2Ptr = strchr(colon1Ptr, ':'); if(!colon2Ptr) - return 0; + return NULL; *colon2Ptr = '\0'; colon2Ptr++; commaPtr = strchr(remotePortString, ','); if(!commaPtr) - return 0; + return NULL; *commaPtr = '\0'; commaPtr++; remp = atoi(remotePortString); if(!remp) - return 0; + return NULL; locp = atoi(commaPtr); if(!locp) - return 0; + return NULL; /* look for USERID bordered by first pair of colons */ if(!strstr(colon1Ptr, "USERID")) - return 0; + return NULL; colon3Ptr = strchr(colon2Ptr, ':'); if(!colon3Ptr) - return 0; + return NULL; *colon3Ptr = '\0'; colon3Ptr++; From 6950cc255a6575152ff3a4c7aeb8cccdd5a1c28d Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 19:19:52 -0500 Subject: [PATCH 243/252] authd/providers/blacklist: remove dead store. --- authd/providers/blacklist.c | 1 - 1 file changed, 1 deletion(-) diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index a99f0c90e..768d6b327 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -112,7 +112,6 @@ static void timeout_blacklist_queries_event(void *); /* Variables */ static rb_dlink_list blacklist_list = { NULL, NULL, 0 }; static struct ev_entry *timeout_ev; -static EVH timeout_blacklists; static int blacklist_timeout = 15; /* private interfaces */ From 4ac5b30e77a3df0602bbbc3f6631c1764325c27e Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 19:31:45 -0500 Subject: [PATCH 244/252] authd/providers/ident: remove debugging message --- authd/providers/ident.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index 130c0e434..f69a63a91 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -185,8 +185,6 @@ read_ident_reply(rb_fde_t *F, void *data) message = REPORT_INVALID; } - warn_opers(L_DEBUG, "Got username: '%s'", auth->username); - if(s == NULL) client_fail(auth, message); else From f5586c3abb392a7a14c35c8ac2968c179b91182b Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 19:50:09 -0500 Subject: [PATCH 245/252] authd: misc provider fixes --- authd/authd.c | 2 +- authd/provider.c | 1 + authd/providers/blacklist.c | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index c6ed0911c..f2b051907 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -88,7 +88,7 @@ handle_options(int parc, char *parv[]) return; } - handler->handler(parv[1], parc - 2, (const char **)(parv + 3)); + handler->handler(parv[1], parc - 2, (const char **)&parv[2]); } static void diff --git a/authd/provider.c b/authd/provider.c index d048ae7ae..c92fea26a 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -96,6 +96,7 @@ void init_providers(void) auth_clients = rb_dictionary_create("pending auth clients", rb_uint32cmp); load_provider(&rdns_provider); load_provider(&ident_provider); + load_provider(&blacklist_provider); } /* Terminate all providers */ diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index 768d6b327..7c59facc4 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -435,10 +435,13 @@ blacklists_destroy(void) static void add_conf_blacklist(const char *key, int parc, const char **parv) { - rb_dlink_list filters; + rb_dlink_list filters = { NULL, NULL, 0 }; char *tmp, *elemlist = rb_strdup(parv[2]); unsigned char iptype; + if(*elemlist == '*') + goto end; + for(char *elem = rb_strtok_r(elemlist, ",", &tmp); elem; elem = rb_strtok_r(NULL, ",", &tmp)) { struct blacklist_filter *filter = rb_malloc(sizeof(struct blacklist_filter)); @@ -485,6 +488,7 @@ add_conf_blacklist(const char *key, int parc, const char **parv) rb_dlinkAdd(filter, &filter->node, &filters); } +end: rb_free(elemlist); iptype = atoi(parv[1]) & 0x3; From 05fdc0301d415d5422f07d87d912036ea2ad8ec3 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 20:32:35 -0500 Subject: [PATCH 246/252] authd/provider: do not accept clients until all providers have had a chance to run --- authd/provider.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index c92fea26a..471e20d7a 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -153,8 +153,9 @@ void provider_done(struct auth_client *auth, provider_t id) if(!auth->providers) { - /* No more providers, done */ - accept_client(auth, 0); + if(!auth->providers_starting) + /* Only do this when there are no providers left */ + accept_client(auth, 0); return; } @@ -223,6 +224,15 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co auth->cid = (uint32_t)lcid; + if(rb_dictionary_find(auth_clients, RB_UINT_TO_POINTER(auth->cid)) == NULL) + rb_dictionary_add(auth_clients, RB_UINT_TO_POINTER(auth->cid), auth); + else + { + warn_opers(L_CRIT, "BUG: duplicate client added via start_auth: %x", auth->cid); + rb_free(auth); + return; + } + rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip)); auth->l_port = (uint16_t)atoi(l_port); /* should be safe */ (void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr); @@ -247,12 +257,13 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co memset(auth->data, 0, sizeof(auth->data)); - rb_dictionary_add(auth_clients, RB_UINT_TO_POINTER(auth->cid), auth); - + auth->providers_starting = true; RB_DLINK_FOREACH(ptr, auth_providers.head) { provider = ptr->data; + lrb_assert(provider->start != NULL); + /* Execute providers */ if(!provider->start(auth)) { @@ -261,6 +272,7 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co return; } } + auth->providers_starting = false; /* If no providers are running, accept the client */ if(!auth->providers) From 247b304f1f7d16162bdb14901b305fdfd09b50ad Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 20:33:21 -0500 Subject: [PATCH 247/252] authd/provider: forgot this file... --- authd/provider.h | 1 + 1 file changed, 1 insertion(+) diff --git a/authd/provider.h b/authd/provider.h index 28deef649..348788ec2 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -53,6 +53,7 @@ struct auth_client uint32_t providers; /* Providers at work, * none left when set to 0 */ uint32_t providers_done; /* Providers completed */ + bool providers_starting; /* Providers are still warming up */ void *data[MAX_PROVIDERS]; /* Provider-specific data slots */ }; From f681e277eb54e48102dcbb307aa49dc9663d6182 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 20:33:35 -0500 Subject: [PATCH 248/252] authd/providers/ident: perform check for valid auth_client data --- authd/providers/ident.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/authd/providers/ident.c b/authd/providers/ident.c index f69a63a91..e14fac43c 100644 --- a/authd/providers/ident.c +++ b/authd/providers/ident.c @@ -320,6 +320,9 @@ static bool ident_start(struct auth_client *auth) struct rb_sockaddr_storage l_addr, c_addr; int family = GET_SS_FAMILY(&auth->c_addr); + if(auth->data[PROVIDER_IDENT] != NULL) + return true; + notice_client(auth->cid, messages[REPORT_LOOKUP]); auth->data[PROVIDER_IDENT] = query; From e43e61f7a79f0d9e2b500622ff42e712f2554e3a Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 23:15:28 -0500 Subject: [PATCH 249/252] authd/providers/blacklist: fix use after free After calling provider_done, you must *always* assume your auth instance is freed. --- authd/providers/blacklist.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/authd/providers/blacklist.c b/authd/providers/blacklist.c index 7c59facc4..c05cb6305 100644 --- a/authd/providers/blacklist.c +++ b/authd/providers/blacklist.c @@ -73,7 +73,7 @@ struct blacklist_lookup struct blacklist *bl; /* Blacklist we're checking */ struct auth_client *auth; /* Client */ struct dns_query *query; /* DNS query pointer */ - + rb_dlink_node node; }; @@ -230,11 +230,13 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d { struct blacklist_lookup *bllookup = (struct blacklist_lookup *)data; struct blacklist_user *bluser; + struct blacklist *bl; struct auth_client *auth; if (bllookup == NULL || bllookup->auth == NULL) return; + bl = bllookup->bl; auth = bllookup->auth; bluser = auth->data[PROVIDER_BLACKLIST]; if(bluser == NULL) @@ -244,20 +246,21 @@ blacklist_dns_callback(const char *result, bool status, query_type type, void *d { /* Match found, so proceed no further */ blacklists_cancel(auth); - reject_client(auth, PROVIDER_BLACKLIST, bllookup->bl->reason); + reject_client(auth, PROVIDER_BLACKLIST, bl->reason); return; } - unref_blacklist(bllookup->bl); + unref_blacklist(bl); + cancel_query(bllookup->query); /* Ignore future responses */ rb_dlinkDelete(&bllookup->node, &bluser->queries); rb_free(bllookup); if(!rb_dlink_list_length(&bluser->queries)) { /* Done here */ - provider_done(auth, PROVIDER_BLACKLIST); rb_free(bluser); auth->data[PROVIDER_BLACKLIST] = NULL; + provider_done(auth, PROVIDER_BLACKLIST); } } @@ -398,9 +401,11 @@ blacklists_cancel(struct auth_client *auth) RB_DLINK_FOREACH_SAFE(ptr, nptr, bluser->queries.head) { struct blacklist_lookup *bllookup = ptr->data; - rb_dlinkDelete(&bllookup->node, &bluser->queries); - unref_blacklist(bllookup->bl); + cancel_query(bllookup->query); + unref_blacklist(bllookup->bl); + + rb_dlinkDelete(&bllookup->node, &bluser->queries); rb_free(bllookup); } From 420cfb677ce11aec5aca4fe35411f068ab1174b0 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 23:16:53 -0500 Subject: [PATCH 250/252] authd/provider: add notices in comments to certain functions not to use auth after calling --- authd/provider.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authd/provider.c b/authd/provider.c index 471e20d7a..6c49bc188 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -142,7 +142,7 @@ void cancel_providers(struct auth_client *auth) rb_free(auth); } -/* Provider is done */ +/* Provider is done - WARNING: do not use auth instance after calling! */ void provider_done(struct auth_client *auth, provider_t id) { rb_dlink_node *ptr; @@ -169,7 +169,7 @@ void provider_done(struct auth_client *auth, provider_t id) } } -/* Reject a client */ +/* Reject a client - WARNING: do not use auth instance after calling! */ void reject_client(struct auth_client *auth, provider_t id, const char *reason) { char reject; @@ -200,7 +200,7 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) cancel_providers(auth); } -/* Accept a client, cancel outstanding providers if any */ +/* Accept a client, cancel outstanding providers if any - WARNING: do nto use auth instance after calling! */ void accept_client(struct auth_client *auth, provider_t id) { uint32_t cid = auth->cid; From 0da2a404fab2f8e26164aa26733c570a2244c933 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 23:39:22 -0500 Subject: [PATCH 251/252] authd: try to destroy all providers on the way out. --- authd/authd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/authd/authd.c b/authd/authd.c index f2b051907..1432a5458 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -202,5 +202,7 @@ main(int argc, char *argv[]) rb_helper_loop(authd_helper, 0); + destroy_providers(); + return 0; } From 60374ac975b735fa9245cb107e5e976bfb107a93 Mon Sep 17 00:00:00 2001 From: Elizabeth Myers Date: Sat, 26 Mar 2016 23:54:21 -0500 Subject: [PATCH 252/252] authd: add abiltiy to cancel connection --- authd/authd.c | 3 ++- authd/dns.c | 2 +- authd/dns.h | 2 +- authd/provider.c | 57 +++++++++++++++++++++++++++++++++++++++--------- authd/provider.h | 16 +++++++++----- 5 files changed, 62 insertions(+), 18 deletions(-) diff --git a/authd/authd.c b/authd/authd.c index 1432a5458..6f500a9db 100644 --- a/authd/authd.c +++ b/authd/authd.c @@ -32,7 +32,8 @@ static void handle_options(int parc, char *parv[]); rb_helper *authd_helper = NULL; authd_cmd_handler authd_cmd_handlers[256] = { ['C'] = handle_new_connection, - ['D'] = resolve_dns, + ['D'] = handle_resolve_dns, + ['E'] = handle_cancel_connection, ['O'] = handle_options, ['R'] = handle_reload, ['S'] = handle_stat, diff --git a/authd/dns.c b/authd/dns.c index 45db36a28..19b3efcbd 100644 --- a/authd/dns.c +++ b/authd/dns.c @@ -221,7 +221,7 @@ submit_dns_answer(const char *reply, bool status, query_type type, void *data) } void -resolve_dns(int parc, char *parv[]) +handle_resolve_dns(int parc, char *parv[]) { char *id = rb_strdup(parv[1]); char qtype = *parv[2]; diff --git a/authd/dns.h b/authd/dns.h index a21d98585..b4eae8c66 100644 --- a/authd/dns.h +++ b/authd/dns.h @@ -54,7 +54,7 @@ extern struct dns_query *lookup_hostname(const char *ip, DNSCB callback, void *d extern struct dns_query *lookup_ip(const char *host, int aftype, DNSCB callback, void *data); extern void cancel_query(struct dns_query *query); -extern void resolve_dns(int parc, char *parv[]); +extern void handle_resolve_dns(int parc, char *parv[]); extern void enumerate_nameservers(const char *rid, const char letter); extern void reload_nameservers(const char letter); diff --git a/authd/provider.c b/authd/provider.c index 6c49bc188..fcd9490a6 100644 --- a/authd/provider.c +++ b/authd/provider.c @@ -57,7 +57,8 @@ rb_dlink_list auth_providers; rb_dictionary *auth_clients; /* Load a provider */ -void load_provider(struct auth_provider *provider) +void +load_provider(struct auth_provider *provider) { if(rb_dlink_list_length(&auth_providers) >= MAX_PROVIDERS) { @@ -77,7 +78,8 @@ void load_provider(struct auth_provider *provider) rb_dlinkAdd(provider, &provider->node, &auth_providers); } -void unload_provider(struct auth_provider *provider) +void +unload_provider(struct auth_provider *provider) { if(provider->opt_handlers != NULL) { @@ -91,7 +93,8 @@ void unload_provider(struct auth_provider *provider) } /* Initalise all providers */ -void init_providers(void) +void +init_providers(void) { auth_clients = rb_dictionary_create("pending auth clients", rb_uint32cmp); load_provider(&rdns_provider); @@ -100,7 +103,8 @@ void init_providers(void) } /* Terminate all providers */ -void destroy_providers(void) +void +destroy_providers(void) { rb_dlink_node *ptr; rb_dictionary_iter iter; @@ -124,7 +128,8 @@ void destroy_providers(void) } /* Cancel outstanding providers for a client */ -void cancel_providers(struct auth_client *auth) +void +cancel_providers(struct auth_client *auth) { rb_dlink_node *ptr; struct auth_provider *provider; @@ -143,7 +148,8 @@ void cancel_providers(struct auth_client *auth) } /* Provider is done - WARNING: do not use auth instance after calling! */ -void provider_done(struct auth_client *auth, provider_t id) +void +provider_done(struct auth_client *auth, provider_t id) { rb_dlink_node *ptr; struct auth_provider *provider; @@ -170,7 +176,8 @@ void provider_done(struct auth_client *auth, provider_t id) } /* Reject a client - WARNING: do not use auth instance after calling! */ -void reject_client(struct auth_client *auth, provider_t id, const char *reason) +void +reject_client(struct auth_client *auth, provider_t id, const char *reason) { char reject; @@ -201,7 +208,8 @@ void reject_client(struct auth_client *auth, provider_t id, const char *reason) } /* Accept a client, cancel outstanding providers if any - WARNING: do nto use auth instance after calling! */ -void accept_client(struct auth_client *auth, provider_t id) +void +accept_client(struct auth_client *auth, provider_t id) { uint32_t cid = auth->cid; @@ -212,7 +220,8 @@ void accept_client(struct auth_client *auth, provider_t id) } /* Begin authenticating user */ -static void start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port) +static void +start_auth(const char *cid, const char *l_ip, const char *l_port, const char *c_ip, const char *c_port) { struct auth_provider *provider; struct auth_client *auth = rb_malloc(sizeof(struct auth_client)); @@ -280,7 +289,8 @@ static void start_auth(const char *cid, const char *l_ip, const char *l_port, co } /* Callback for the initiation */ -void handle_new_connection(int parc, char *parv[]) +void +handle_new_connection(int parc, char *parv[]) { if(parc < 6) { @@ -290,3 +300,30 @@ void handle_new_connection(int parc, char *parv[]) start_auth(parv[1], parv[2], parv[3], parv[4], parv[5]); } + +void +handle_cancel_connection(int parc, char *parv[]) +{ + struct auth_client *auth; + long lcid; + + if(parc < 2) + { + warn_opers(L_CRIT, "BUG: received too few params for new connection (2 expected, got %d)", parc); + return; + } + + if((lcid = strtol(parv[1], NULL, 16)) > UINT32_MAX) + { + warn_opers(L_CRIT, "BUG: got a request to cancel a connection that can't exist: %lx", lcid); + return; + } + + if((auth = rb_dictionary_retrieve(auth_clients, RB_UINT_TO_POINTER((uint32_t)lcid))) == NULL) + { + warn_opers(L_CRIT, "BUG: tried to cancel nonexistent connection %lx", lcid); + return; + } + + cancel_providers(auth); +} diff --git a/authd/provider.h b/authd/provider.h index 348788ec2..a9e99e2c7 100644 --- a/authd/provider.h +++ b/authd/provider.h @@ -100,32 +100,38 @@ void accept_client(struct auth_client *auth, provider_t id); void reject_client(struct auth_client *auth, provider_t id, const char *reason); void handle_new_connection(int parc, char *parv[]); +void handle_cancel_connection(int parc, char *parv[]); /* Provider is operating on this auth_client (set this if you have async work to do) */ -static inline void set_provider_on(struct auth_client *auth, provider_t provider) +static inline void +set_provider_on(struct auth_client *auth, provider_t provider) { auth->providers |= (1 << provider); } /* Provider is no longer operating on this auth client (you should use provider_done) */ -static inline void set_provider_off(struct auth_client *auth, provider_t provider) +static inline void +set_provider_off(struct auth_client *auth, provider_t provider) { auth->providers &= ~(1 << provider); } /* Set the provider to done (you should use provider_done) */ -static inline void set_provider_done(struct auth_client *auth, provider_t provider) +static inline void +set_provider_done(struct auth_client *auth, provider_t provider) { auth->providers_done |= (1 << provider); } /* Check if provider is operating on this auth client */ -static inline bool is_provider_on(struct auth_client *auth, provider_t provider) +static inline bool +is_provider_on(struct auth_client *auth, provider_t provider) { return auth->providers & (1 << provider); } -static inline bool is_provider_done(struct auth_client *auth, provider_t provider) +static inline bool +is_provider_done(struct auth_client *auth, provider_t provider) { return auth->providers_done & (1 << provider); }