From f3410da7f0bd208a5f2d792131b215454e782e93 Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Sun, 5 Feb 2012 19:04:33 +0000 Subject: Imported Upstream version 0.7.3 --- Makefile.in | 6 +- NEWS | 98 ++ README | 5 + THANKS | 14 +- about_scr.c | 50 +- aplst_scr.c | 134 -- conf.c | 216 +-- conf_scr.c | 156 +- configure | 4757 ++++++++++++++++++++++++++++------------------------------ configure.ac | 14 +- error.c | 63 +- help_scr.c | 29 +- info_scr.c | 375 +++-- iw_if.c | 391 ++--- iw_if.h | 250 ++- iw_scan.c | 671 +++++++++ lhist_scr.c | 58 +- scan_scr.c | 203 +++ ui.c | 10 +- wavemon.1 | 174 ++- wavemon.c | 231 ++- wavemon.h | 162 +- wavemonrc.5 | 114 +- 23 files changed, 4684 insertions(+), 3497 deletions(-) delete mode 100644 aplst_scr.c create mode 100644 iw_scan.c create mode 100644 scan_scr.c diff --git a/Makefile.in b/Makefile.in index 7c81ad5..b7d8ece 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5,6 +5,8 @@ bindir = @bindir@ datarootdir = $(prefix)/share mandir = @mandir@ datadir = $(datarootdir)/@PACKAGE_NAME@ +exec_perms = 0755 +install-suid-root: exec_perms = 4755 CC = @CC@ CFLAGS = @CFLAGS@ @@ -41,9 +43,9 @@ tags: $(MAIN) $(PURESRC) $(HEADERS) install: install-binaries install-docs -install-binaries: all +install-suid-root install-binaries: all $(INSTALL) -m 0755 -d $(DESTDIR)$(bindir) - $(INSTALL) -m 0755 @PACKAGE_NAME@ $(DESTDIR)$(bindir) + $(INSTALL) -m $(exec_perms) @PACKAGE_NAME@ $(DESTDIR)$(bindir) install-docs: @PACKAGE_NAME@.1 @PACKAGE_NAME@rc.5 $(DOCS) $(INSTALL) -m 0755 -d $(DESTDIR)$(mandir)/man1 diff --git a/NEWS b/NEWS index 947fdd4..4de1a2e 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,104 @@ NEWS ==== +-------------------- +0.7.3 (2011-12-22) +-------------------- + * Scan window: + - items are now sorted first by channel (ascending) then by signal + strength (descending), as before + - using one line per entry doubled the capacity of the scan window + - refresh interval is made configurable (via 'Statistics updates') + * Configuration screen: + - memorizes the last-changed item to ease longer configuration tasks + * Fixes: + - better (cleaner) termination on error + - fixed clear-line refresh in info screen + - fixed bug in generator for random link quality (causing negative values) + - reverted using separate process group (problems when running under sudo) + - miscellaneous code reordering to decouple functional units + +-------------------- +0.7.2 (2011-02-25) +-------------------- + * General: + - support SIGWINCH for resizing (thanks to Koniu) + - reorganized screen handling to support resizing + - make geometry checking optional and off by default + - allow suspending wavemon (CTRL-Z) on most screens + * Info screen: + - suppress obvious broadcast address (deriving from prefix) + - special case for "no interface address assigned" + - display interface MTU if different from the default value + - show interface flags and TX queue length if enough space + * Scan window: + - set up enable interface if it is down (otherwise no scan) + - drop support for wireless extensions < 18 (minimum requirement) + - clean up child scan process on error (avoid garbled screen) + * Configuration screen: + - support 'Cisco-style' MAC addresses (dots rather than colons) + * Fixes: + - do not report zero bitrates (Info screen, 802.11n interface) + - remove unused timer in Scan window (data sampling is now + confined to info/histogram screens) + - fixed various compiler warnings + - fixed several problems in and improved the random generator + - use sigaction() rather than signal() + - miscellaneous reorganization of the configuration menu code + +-------------------- +0.7.1 (2010-12-24) +-------------------- + * Scan window: + - improved and more consistent formatting of entries + - better responsiveness by running scan operation as child process + * Security capabilities: + - display capabilities supported by the driver + - display current and available key sizes + - decode relevant IE information + * check and warn about insufficient permissions (CAP_NET_ADMIN) that + are required for several wireless operations (e.g. scanning) + * Bug Fixes: + - avoid triggering assertion on large screens + - require minimum version (18) of the wireless extensions + - better clearing of info screen + - various cleanups + * overhaul of manpages + +-------------------- +0.7.0 (2010-10-18) +-------------------- + * NEW Scan Window: this replaces the old access point screen. It displays + a sorted list (in descending order of signal quality) of access points + and other wireless clients within range, periodically refreshed at a + configurable rate. + * Access Point screen: finally deprecated this - the SIOCGIWAPLIST + ioctl itself is deprecated and works only on some older kernels. + * Info Window: clear screen to erase stale data. + * Bug Fixes: fixed a compiler warning in string-tolower operation. + +-------------------- +0.6.11 (2010-06-14) +-------------------- + * Info screen: + - fixed a bug in the freq/channel display: some drivers, such as ipw2100, + only return the channel number, requiring to look up the frequency; + - added a warning to indicate the absence of data from the interface. + * Histogram screen: + Tag the grid lines with the corresponding dBm levels: + - no levels are shown if there is no valid interface data (screen empty); + - level tags are restricted to the signal level graph only: + o if both signal and noise level data are valid, there are three graphs + (signal level, noise level, SNR), which would cause ambiguity, + o many cards (e.g. ath5k, rt73usb, iwl3945) do not supply noise data, + so that the histogram screen will then only contain the level graph; + - since the scale is adjustable, while the grid lines are fixed, the tags + are dynamically recomputed based on the y position and current scale; + - the min/max bounds of the scale are also shown. + Thanks to Sean Muir for this suggestion. + * Updated manpage regarding access point screen; as soon there is time, the + outdated and restricted SIOCGIWAPLIST ioctl should be replaced by a scan. + -------------------- 0.6.10 (2009-10-25) -------------------- diff --git a/README b/README index 41b1d5a..4f29849 100644 --- a/README +++ b/README @@ -31,6 +31,11 @@ wavemon uses autoconf, so that in most cases you can simply run to build and install the package. Type 'make uninstall' if not happy. Refer to the file INSTALL for generic installation instructions. +To grant users access to restricted networking operations (e.g. reading WEP +keys or performing scan operations), use additionally + + sudo make install-suid-root + If you have changed some of the autoconf files or use a git version, run ./config/bootstrap (requires a recent installation of 'autotools'). diff --git a/THANKS b/THANKS index 689b4d5..0569651 100644 --- a/THANKS +++ b/THANKS @@ -1,6 +1,6 @@ Many people contribute to wavemon by reporting problems, suggesting various improvements, or submitting actual code. Here is a list of these people. Help -me (gerrit@erg.abdn.ac.uk) keep it complete and exempt of errors. +me (gerrit@erg.abdn.ac.uk) keep it complete and accurate. Christoph J. Thompson (cjsthompson@gmail.com) provided DESTDIR support for the installation process and contributed a Slackware build script, found in @@ -18,3 +18,15 @@ parser backward-compatible (0.6.7). Jonathan Lovelace provided a patch to enable build on Gentoo (0.6.10). Hanno Boeck supplied a patch to improve the linking process (0.6.10). + +Sean Muir helped improve the overall design through several really useful +suggestions (histogram levels, scan window) leading up to 0.7.0. + +Jean Tourrilhes helped with the scan window in 0.7.0 (most of the code to +extract the scan data is from wireless tools 30) and also kindly provided +an earlier wavemon prototype with scanning support. + +Thanks to Matt who helped fixing several bugs in 0.7.0. + +Robert M. Stockmann and Koniu helped with bug fixes in 0.7.1; thanks to Koniu +support for window resizing got started. diff --git a/about_scr.c b/about_scr.c index 6c64c8e..31ac37b 100644 --- a/about_scr.c +++ b/about_scr.c @@ -20,6 +20,8 @@ #include "wavemon.h" /* GLOBALS */ +static WINDOW *w_about; + static char *about_lines[] = { "wavemon - status monitor for wireless network devices", "version " PACKAGE_VERSION " (built " BUILD_DATE ")", @@ -33,14 +35,14 @@ static char *about_lines[] = { "please send suggestions and bug reports to ", PACKAGE_BUGREPORT, "", - "http://eden-feed.erg.abdn.ac.uk/wavemon", + PACKAGE_URL }; -static int *linecd[ARRAY_SIZE(about_lines)]; +static int *linecd[ARRAY_SIZE(about_lines)], i, j; -static void init_scramble(void) +void scr_about_init(void) { - int i, j; + w_about = newwin_title(0, WAV_HEIGHT, "About", false); for (i = 0; i < ARRAY_SIZE(about_lines); i++) { linecd[i] = malloc(strlen(about_lines[i]) * sizeof(int)); @@ -49,17 +51,8 @@ static void init_scramble(void) } } -static void free_scramble(void) +int scr_about_loop(WINDOW *w_menu) { - int i; - - for (i = 0; i < ARRAY_SIZE(about_lines); i++) - free(linecd[i]); -} - -static void draw_lines(WINDOW *w_about) -{ - int i, j; char buf[0x100]; for (i = 0; i < ARRAY_SIZE(about_lines); i++) { @@ -78,33 +71,12 @@ static void draw_lines(WINDOW *w_about) waddstr_center(w_about, (WAV_HEIGHT - ARRAY_SIZE(about_lines))/2 + i, buf); } wrefresh(w_about); + return wgetch(w_menu); } -enum wavemon_screen scr_about(WINDOW *w_menu) +void scr_about_fini(void) { - WINDOW *w_about; - int key = 0; - - w_about = newwin_title(0, WAV_HEIGHT, "About", false); - - init_scramble(); - - while (key < KEY_F(1) || key > KEY_F(10)) { - do { - draw_lines(w_about); - key = wgetch(w_menu); - usleep(5000); - } while (key <= 0); - - /* Keyboard shortcuts */ - if (key == 'q') - key = KEY_F(10); - else if (key == 'i') - key = KEY_F(1); - } - - free_scramble(); delwin(w_about); - - return key - KEY_F(1); + for (i = 0; i < ARRAY_SIZE(about_lines); i++) + free(linecd[i]); } diff --git a/aplst_scr.c b/aplst_scr.c deleted file mode 100644 index c0f868f..0000000 --- a/aplst_scr.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * wavemon - a wireless network monitoring aplication - * - * Copyright (c) 2001-2002 Jan Morgenstern - * - * wavemon 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, or (at your option) any later - * version. - * - * wavemon 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 wavemon; see the file COPYING. If not, write to the Free Software - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -#include "iw_if.h" - -static void display_aplist(WINDOW *w_aplst) -{ - uint8_t buf[(sizeof(struct iw_quality) + - sizeof(struct sockaddr)) * IW_MAX_AP]; - char s[0x100]; - int i, j, line = 2; - struct iw_quality *qual, qual_pivot; - struct sockaddr *hwa, hwa_pivot; - struct iw_range range; - struct iw_levelstat dbm; - struct iwreq iwr; - int skfd = socket(AF_INET, SOCK_DGRAM, 0); - - if (skfd < 0) - err_sys("%s: can not open socket", __func__); - - iw_getinf_range(conf.ifname, &range); - for (i = 1; i <= MAXYLEN; i++) - mvwclrtoborder(w_aplst, i, 1); - - strncpy(iwr.ifr_name, conf.ifname, IFNAMSIZ); - iwr.u.data.pointer = (caddr_t) buf; - iwr.u.data.length = IW_MAX_AP; - iwr.u.data.flags = 0; - - if (ioctl(skfd, SIOCGIWAPLIST, &iwr) < 0) { - sprintf(s, "%s does not have a list of peers/access points", - conf.ifname); - waddstr_center(w_aplst, WAV_HEIGHT/2 - 1, s); - goto done; - } - - if (iwr.u.data.length == 0) { - sprintf(s, "%s: no peer/access point in range", conf.ifname); - waddstr_center(w_aplst, WAV_HEIGHT/2 - 1, s); - } else if (iwr.u.data.length == 1) { - mvwaddstr(w_aplst, line, 1, "Peer/access point:"); - } else { - sprintf(s, "%d peers/access points in range:", iwr.u.data.length); - mvwaddstr(w_aplst, line, 1, s); - } - - hwa = (struct sockaddr *) buf; - qual = (struct iw_quality *) (hwa + iwr.u.data.length); - - /* - * Show access points in descending order of signal quality by - * sorting both lists in parallel, using simple insertion sort. - */ - for (i = 0; i < iwr.u.data.length; i++) { - - qual_pivot = qual[i]; - hwa_pivot = hwa[i]; - - for (j = i; j > 0 && qual[j-1].qual < qual_pivot.qual; j--) { - qual[j] = qual[j-1]; - hwa[j] = hwa[j-1]; - } - - qual[j] = qual_pivot; - hwa[j] = hwa_pivot; - } - - line += 2; - - /* Truncate overly long access point lists to match screen height */ - for (i = 0; i < iwr.u.data.length && line < MAXYLEN; i++, line++) { - - mvwaddstr(w_aplst, line++, 1, " "); - waddstr_b(w_aplst, mac_addr(&hwa[i])); - - if (iwr.u.data.flags) { - iw_sanitize(&range, &qual[i], &dbm); - sprintf(s, "Quality%c %2d/%d, Signal%c %.0f dBm (%s), Noise%c %.0f dBm", - qual[i].updated & IW_QUAL_QUAL_UPDATED ? ':' : '=', - qual[i].qual, range.max_qual.qual, - qual[i].updated & IW_QUAL_LEVEL_UPDATED ? ':' : '=', - dbm.signal, dbm2units(dbm.signal), - qual[i].updated & IW_QUAL_NOISE_UPDATED ? ':' : '=', - dbm.noise); - mvwaddstr(w_aplst, line++, 5, s); - } - } -done: - close(skfd); - wrefresh(w_aplst); -} - -enum wavemon_screen scr_aplst(WINDOW *w_menu) -{ - WINDOW *w_aplst; - struct timer t1; - int key = 0; - - w_aplst = newwin_title(0, WAV_HEIGHT, "Access point list", false); - - while (key < KEY_F(1) || key > KEY_F(10)) { - display_aplist(w_aplst); - start_timer(&t1, 50000); - while (!end_timer(&t1) && (key = wgetch(w_menu)) <= 0) - usleep(5000); - - /* Keyboard shortcuts */ - if (key == 'q') - key = KEY_F(10); - else if (key == 'i') - key = KEY_F(1); - } - - delwin(w_aplst); - - return key - KEY_F(1); -} diff --git a/conf.c b/conf.c index 0d8c396..45fa42e 100644 --- a/conf.c +++ b/conf.c @@ -22,9 +22,50 @@ #include /* GLOBALS */ -struct wavemon_conf conf; +static char **if_list; /* array of WiFi interface names */ int conf_items; /* index into array storing menu items */ -static int if_list; /* index into array of WiFi interface names */ + +static char *on_off_names[] = { [false] = "Off", [true] = "On", NULL }; +static char *action_items[] = { + [TA_DISABLED] = "Disabled", + [TA_BEEP] = "Beep", + [TA_FLASH] = "Flash", + [TA_BEEP_FLASH] = "Beep+Flash", + NULL +}; + +static char *screen_names[] = { + [SCR_INFO] = "Info screen", + [SCR_LHIST] = "Histogram", + [SCR_APLIST] = "Scan window", + NULL +}; + +struct wavemon_conf conf = { + .if_idx = 0, + + .stat_iv = 100, + .info_iv = 10, + .slotsize = 4, + .meter_decay = 0, + + .check_geometry = false, + .cisco_mac = false, + .override_bounds = false, + .random = false, + + .sig_min = -102, + .sig_max = 10, + .noise_min = -102, + .noise_max = 10, + + .lthreshold_action = TA_DISABLED, + .lthreshold = -80, + .hthreshold_action = TA_DISABLED, + .hthreshold = -10, + + .startup_scr = 0, +}; static void version(void) { @@ -36,6 +77,7 @@ static void usage(void) { printf("Usage: wavemon [ -dhlrv ] [ -i ifname ]\n\n"); printf(" -d Dump the current device status to stdout and exit\n"); + printf(" -g Ensure screen is sufficiently dimensioned\n"); printf(" -h This help screen\n"); printf(" -i Use specified network interface (default: auto)\n"); printf(" -r Generate random levels (for testing purposes)\n"); @@ -44,23 +86,25 @@ static void usage(void) static void getargs(int argc, char *argv[]) { - int arg, tmp; + int arg; - while ((arg = getopt(argc, argv, "dhi:rv")) >= 0) + while ((arg = getopt(argc, argv, "dghi:rv")) >= 0) switch (arg) { case 'd': dump_parameters(); exit(EXIT_SUCCESS); + case 'g': + conf.check_geometry = true; + break; case 'h': usage(); exit(EXIT_SUCCESS); case 'i': - if ((tmp = ll_scan(if_list, "S", optarg)) >= 0) { - strncpy(conf.ifname, ll_get(if_list, tmp), - sizeof(conf.ifname)); - break; - } - err_quit("no wireless extensions found on '%s'", optarg); + conf.if_idx = argv_find(if_list, optarg); + if (conf.if_idx < 0) + err_quit("no wireless extensions found on '%s'", + optarg); + break; case 'r': conf.random = true; break; @@ -73,6 +117,39 @@ static void getargs(int argc, char *argv[]) } } +/** Populate interface list */ +void conf_get_interface_list(void) +{ + char *old_if = NULL; + int idx; + + if (if_list) { + for (idx = 0; if_list[idx]; idx++) + if (idx == conf.if_idx) + old_if = if_list[idx]; + else + free(if_list[idx]); + free(if_list); + } + if_list = iw_get_interface_list(); + if (if_list == NULL) + err_quit("no wireless interfaces found!"); + + conf.if_idx = 0; + if (old_if) { + idx = argv_find(if_list, old_if); + if (idx > 0) + conf.if_idx = idx; + free(old_if); + } +} + +/** Return currently selected interface name */ +const char *conf_ifname(void) +{ + return if_list ? if_list[conf.if_idx] : "(none)"; +} + /* Return full path of rcfile. Allocates string which must bee free()-d. */ static char *get_confname(void) { @@ -162,38 +239,13 @@ static void read_cf(void) *ci->v.i = v_int; } break; - case t_string: - if (strlen(rv) > ci->max) - err_quit("parse error in %s, line %d: argument too long (max %d chars)", - cfname, lnum, ci->max); - strncpy(ci->v.s, rv, LISTVAL_MAX); - break; - case t_switch: - if (!strcasecmp(rv, "on") || !strcasecmp(rv, "yes") || - !strcasecmp(rv, "enabled") || !strcasecmp(rv, "1")) { - *(ci->v.b) = 1; - } else if (!strcasecmp(rv, "off") || !strcasecmp(rv, "no") || - !strcasecmp(rv, "disabled") || !strcasecmp(rv, "0")) { - *(ci->v.b) = 0; - } else { - err_quit("parse error in %s, line %d: boolean expected, '%s' found instead", - cfname, lnum, rv); - } - break; case t_list: - v_int = ll_scan(ci->list, "S", rv); - if (v_int < 0) - err_quit("parse error in %s, line %d: '%s' is not a valid argument here", - cfname, lnum, rv); - *ci->v.b = v_int; - break; - case t_listval: - v_int = ll_scan(ci->list, "S", rv); + v_int = argv_find(ci->list, rv); if (v_int < 0) - err_quit("parse error in %s, line %d: '%s' is not a valid argument here", - cfname, lnum, rv); - strncpy(ci->v.s, ll_get(ci->list, v_int), LISTVAL_MAX); - break; + err_msg("%s, line %d: '%s = %s' is not valid - using defaults", + cfname, lnum, lv, rv); + else + *ci->v.i = v_int; case t_sep: /* These two cases are missing from the enum, they are not handled */ case t_func: /* To pacify gcc -Wall, fall through here */ break; @@ -230,15 +282,8 @@ static void write_cf(void) case t_int: sprintf(rv, "%d", *ci->v.i); break; - case t_string: /* fall through */ - case t_listval: - strcpy(rv, ci->v.s); - break; - case t_switch: - sprintf(rv, "%s", *ci->v.b ? "on" : "off"); - break; case t_list: - sprintf(rv, "%s", (char *)ll_get(ci->list, *ci->v.b)); + sprintf(rv, "%s", ci->list[*ci->v.i]); str_tolower(rv); break; /* Fall through, the rest are dummy statements to pacify gcc -Wall */ @@ -305,12 +350,19 @@ static void init_conf_items(void) item = calloc(1, sizeof(*item)); item->name = strdup("Interface"); item->cfname = strdup("interface"); - item->type = t_listval; - item->v.s = conf.ifname; - item->max = 10; + item->type = t_list; + item->v.i = &conf.if_idx; item->list = if_list; ll_push(conf_items, "*", item); + item = calloc(1, sizeof(*item)); + item->name = strdup("Cisco-style MAC addresses"); + item->cfname = strdup("cisco_mac"); + item->type = t_list; + item->v.i = &conf.cisco_mac; + item->list = on_off_names; + ll_push(conf_items, "*", item); + item = calloc(1, sizeof(*item)); item->name = strdup("Statistics updates"); item->cfname = strdup("stat_updates"); @@ -367,8 +419,9 @@ static void init_conf_items(void) item = calloc(1, sizeof(*item)); item->name = strdup("Override scale autodetect"); item->cfname = strdup("override_auto_scale"); - item->type = t_switch; - item->v.b = &conf.override_bounds; + item->type = t_list; + item->v.i = &conf.override_bounds; + item->list = on_off_names; ll_push(conf_items, "*", item); item = calloc(1, sizeof(*item)); @@ -422,8 +475,9 @@ static void init_conf_items(void) item = calloc(1, sizeof(*item)); item->name = strdup("Random signals"); item->cfname = strdup("random"); - item->type = t_switch; - item->v.b = &conf.random; + item->type = t_list; + item->v.i = &conf.random; + item->list = on_off_names; ll_push(conf_items, "*", item); /* thresholds */ @@ -431,12 +485,8 @@ static void init_conf_items(void) item->name = strdup("Low threshold action"); item->cfname = strdup("lo_threshold_action"); item->type = t_list; - item->v.b = &conf.lthreshold_action; - item->list = ll_create(); - ll_push(item->list, "s", "Disabled"); - ll_push(item->list, "s", "Beep"); - ll_push(item->list, "s", "Flash"); - ll_push(item->list, "s", "Beep+Flash"); + item->v.i = &conf.lthreshold_action; + item->list = action_items; ll_push(conf_items, "*", item); item = calloc(1, sizeof(*item)); @@ -455,12 +505,8 @@ static void init_conf_items(void) item->name = strdup("High threshold action"); item->cfname = strdup("hi_threshold_action"); item->type = t_list; - item->v.b = &conf.hthreshold_action; - item->list = ll_create(); - ll_push(item->list, "s", "Disabled"); - ll_push(item->list, "s", "Beep"); - ll_push(item->list, "s", "Flash"); - ll_push(item->list, "s", "Beep+Flash"); + item->v.i = &conf.hthreshold_action; + item->list = action_items; ll_push(conf_items, "*", item); item = calloc(1, sizeof(*item)); @@ -489,11 +535,8 @@ static void init_conf_items(void) item->name = strdup("Startup screen"); item->cfname = strdup("startup_screen"); item->type = t_list; - item->v.b = &conf.startup_scr; - item->list = ll_create(); - ll_push(item->list, "s", "Info"); - ll_push(item->list, "s", "Histogram"); - ll_push(item->list, "s", "Access points"); + item->v.i = &conf.startup_scr; + item->list = screen_names; ll_push(conf_items, "*", item); /* separator (dummy entry) */ @@ -509,36 +552,9 @@ static void init_conf_items(void) ll_push(conf_items, "*", item); } -static void set_defaults(void) -{ - strncpy(conf.ifname, ll_get(if_list, 0), sizeof(conf.ifname)); - - conf.stat_iv = 100; - conf.info_iv = 10; - conf.slotsize = 4; - conf.meter_decay = 0; - - conf.override_bounds = false; - conf.random = false; - - conf.sig_min = -102; - conf.sig_max = 10; - conf.noise_min = -102; - conf.noise_max = 10; - - - conf.lthreshold_action = TA_DISABLED; - conf.lthreshold = -80; - conf.hthreshold_action = TA_DISABLED; - conf.hthreshold = -10; - - conf.startup_scr = 0; -} - void getconf(int argc, char *argv[]) { - if_list = iw_get_interface_list(); - set_defaults(); + conf_get_interface_list(); init_conf_items(); read_cf(); getargs(argc, argv); diff --git a/conf_scr.c b/conf_scr.c index ecf13a0..674137c 100644 --- a/conf_scr.c +++ b/conf_scr.c @@ -27,6 +27,14 @@ */ #define MAX_NUM_CONF_ROWS (MAXYLEN - 1) +/* GLOBALS */ +extern int conf_items; /* index into array storing menu items */ + +static WINDOW *w_conf, *w_confpad; +static int first_item, active_item; +static int num_items, list_offset; +static struct conf_item *item; + static void waddstr_item(WINDOW *w, int y, struct conf_item *item, char hilight) { char s[0x40]; @@ -42,17 +50,9 @@ static void waddstr_item(WINDOW *w, int y, struct conf_item *item, char hilight) case t_int: sprintf(s, "%d", *item->v.i); break; - case t_string: - strncpy(s, item->v.s, item->max); - break; - case t_switch: - strcpy(s, *item->v.b ? "Enabled" : "Disabled"); - break; case t_list: - strncpy(s, ll_get(item->list, *item->v.b), LISTVAL_MAX); - break; - case t_listval: - strncpy(s, item->v.s, LISTVAL_MAX); + assert(item->list && item->list[*item->v.i]); + strncpy(s, item->list[*item->v.i], sizeof(s)); /* Fall through, dummy statements to pacify gcc -Wall */ case t_sep: case t_func: @@ -102,32 +102,14 @@ static void change_item(int inum, char sign) *item->v.i + item->inc * sign >= item->min) *item->v.i += item->inc * sign; break; - case t_switch: - *item->v.b = *item->v.b == 0 ? 1 : 0; - break; case t_list: - *item->v.b = *item->v.b + sign; - if (*item->v.b >= ll_size(item->list)) - *item->v.b = 0; - else if (*item->v.b < 0) - *item->v.b = ll_size(item->list) - 1; - break; - case t_listval: - tmp = ll_scan(item->list, "s", item->v.s); - if (tmp == -1) { - tmp = 0; - } else { - tmp += sign; - if (tmp >= ll_size(item->list)) { - tmp = 0; - } else if (tmp < 0) { - tmp = ll_size(item->list) - 1; - } - } - strncpy(item->v.s, ll_get(item->list, tmp), LISTVAL_MAX); - break; - /* Dummy statements to pacify gcc -Wall */ - case t_string: + *item->v.i = *item->v.i + sign; + tmp = argv_count(item->list); + if (*item->v.i >= tmp) + *item->v.i = 0; + else if (*item->v.i < 0) + *item->v.i = tmp - 1; + /* Fall through, dummy statements to pacify gcc -Wall */ case t_sep: case t_func: break; @@ -175,68 +157,64 @@ static int m_pref(WINDOW *w_conf, int list_offset, int active_item, int num_item return list_offset; } -enum wavemon_screen scr_conf(WINDOW *w_menu) +void scr_conf_init(void) { - WINDOW *w_conf, *w_confpad; - int first_item, active_item = 0; - int num_items = ll_size(conf_items); - int list_offset = 0; - int key = 0; - struct conf_item *item; + conf_get_interface_list(); /* may have changed in the meantime */ + num_items = ll_size(conf_items); w_conf = newwin_title(0, WAV_HEIGHT, "Preferences", false); w_confpad = newpad(num_items + 1, CONF_SCREEN_WIDTH); - while ((item = ll_get(conf_items, active_item)) && item->type == t_sep) - active_item++; - first_item = active_item; - - while (key < KEY_F(1) || key > KEY_F(10)) { - list_offset = m_pref(w_confpad, list_offset, active_item, num_items); - - prefresh(w_confpad, list_offset, 0, - 1, (WAV_WIDTH - CONF_SCREEN_WIDTH)/2, - MAXYLEN, (WAV_WIDTH + CONF_SCREEN_WIDTH)/2); - wrefresh(w_conf); - - key = wgetch(w_menu); - switch (key) { - case KEY_DOWN: - active_item = select_item(active_item, 1); - if (active_item >= num_items) { - active_item = first_item; - list_offset = 0; - } - break; - case KEY_UP: - active_item = select_item(active_item, -1); - if (active_item < first_item) - active_item = num_items - 1; - break; - case KEY_LEFT: - change_item(active_item, -1); - break; - case KEY_RIGHT: - change_item(active_item, 1); - break; - case '\r': - item = ll_get(conf_items, active_item); - if (item->type == t_func) { - flash(); - (*item->v.fp)(); - } - break; - /* Keyboard shortcuts */ - case 'q': - key = KEY_F(10); - break; - case 'i': - key = KEY_F(1); + if (first_item) /* already initialized */ + return; + while ((item = ll_get(conf_items, first_item)) && item->type == t_sep) + first_item++; + active_item = first_item; +} + +int scr_conf_loop(WINDOW *w_menu) +{ + int key; + + list_offset = m_pref(w_confpad, list_offset, active_item, num_items); + + prefresh(w_confpad, list_offset, 0, + 1, (WAV_WIDTH - CONF_SCREEN_WIDTH)/2, + MAXYLEN, (WAV_WIDTH + CONF_SCREEN_WIDTH)/2); + wrefresh(w_conf); + + key = wgetch(w_menu); + switch (key) { + case KEY_DOWN: + active_item = select_item(active_item, 1); + if (active_item >= num_items) { + active_item = first_item; + list_offset = 0; + } + break; + case KEY_UP: + active_item = select_item(active_item, -1); + if (active_item < first_item) + active_item = num_items - 1; + break; + case KEY_LEFT: + change_item(active_item, -1); + break; + case KEY_RIGHT: + change_item(active_item, 1); + break; + case '\r': + item = ll_get(conf_items, active_item); + if (item->type == t_func) { + flash(); + (*item->v.fp)(); } } + return key; +} +void scr_conf_fini(void) +{ delwin(w_conf); delwin(w_confpad); - - return key - KEY_F(1); } diff --git a/configure b/configure index 3c32cd8..927beac 100755 --- a/configure +++ b/configure @@ -1,62 +1,85 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for wavemon 0.6.10. +# Generated by GNU Autoconf 2.68 for wavemon 0.7.3. # # Report bugs to . # +# # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -65,20 +88,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -89,354 +111,329 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE # CDPATH. -$as_unset CDPATH - +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST else - as_have_required=no + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : -if as_func_ret_success; then - : else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes else - exitcode=1 - echo positional parameters were not saved. + as_have_required=no fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : -test \$exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=\$LINENO - as_lineno_2=\$LINENO - test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && - test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } -") 2> /dev/null; then - : else - as_candidate_shells= - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - case $as_dir in + as_found=: + case $as_dir in #( /*) for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi done;; esac + as_found=false done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } IFS=$as_save_IFS - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: gerrit@erg.abdn.ac.uk about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} } +as_unset=as_fn_unset -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ -if as_func_ret_success; then - : + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -( - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error -exitcode=0 -if as_func_success; then - : +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. + as_expr=false fi -if as_func_ret_success; then - : +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. + as_basename=false fi -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname else - exitcode=1 - echo positional parameters were not saved. + as_dirname=false fi -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= @@ -453,8 +450,7 @@ test \$exitcode = 0") || { s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the @@ -464,49 +460,40 @@ test \$exitcode = 0") || { exit } - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + fi else as_ln_s='cp -p' fi @@ -514,7 +501,7 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -531,12 +518,12 @@ else as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else - case $1 in - -*)set "./$1";; + case $1 in #( + -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -550,11 +537,11 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -exec 7<&0 &1 +test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -569,14 +556,14 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='wavemon' PACKAGE_TARNAME='wavemon-current' -PACKAGE_VERSION='0.6.10' -PACKAGE_STRING='wavemon 0.6.10' +PACKAGE_VERSION='0.7.3' +PACKAGE_STRING='wavemon 0.7.3' PACKAGE_BUGREPORT='gerrit@erg.abdn.ac.uk' +PACKAGE_URL='http://eden-feed.erg.abdn.ac.uk/wavemon' # Factoring default headers for most tests. ac_includes_default="\ @@ -614,67 +601,71 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -build -build_cpu -build_vendor -build_os -host -host_cpu -host_vendor -host_os -CC -CFLAGS -LDFLAGS -CPPFLAGS -ac_ct_CC -EXEEXT -OBJEXT -CPP -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -GREP -EGREP +ac_subst_vars='LTLIBOBJS LIBOBJS -LTLIBOBJS' +EGREP +GREP +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' +ac_user_opts=' +enable_option_checking +' ac_precious_vars='build_alias host_alias target_alias @@ -689,6 +680,8 @@ CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -744,8 +737,9 @@ do fi case $ac_option in - *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *) ac_optarg=yes ;; + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -787,13 +781,20 @@ do datarootdir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=no ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; @@ -806,13 +807,20 @@ do dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` - eval enable_$ac_feature=\$ac_optarg ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -1003,22 +1011,36 @@ do ac_init_version=: ;; -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=\$ac_optarg ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/[-.]/_/g'` - eval with_$ac_package=no ;; + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. @@ -1038,26 +1060,26 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1065,23 +1087,36 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "missing argument to $ac_option" fi -# Be sure to have absolute directory names. +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' @@ -1095,8 +1130,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1111,23 +1146,21 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { echo "$as_me: error: Working directory cannot be determined" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { echo "$as_me: error: pwd does not report name of working directory" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$0" || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X"$0" | + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1154,13 +1187,11 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 - { (exit 1); exit 1; }; } + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1186,7 +1217,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures wavemon 0.6.10 to adapt to many kinds of systems. +\`configure' configures wavemon 0.7.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1200,7 +1231,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages + -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1208,9 +1239,9 @@ Configuration: Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1220,25 +1251,25 @@ for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/wavemon-current] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/wavemon-current] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -1251,7 +1282,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of wavemon 0.6.10:";; + short | recursive ) echo "Configuration of wavemon 0.7.3:";; esac cat <<\_ACEOF @@ -1261,90 +1292,502 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . -_ACEOF -ac_status=$? +Report bugs to . +wavemon home page: . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +wavemon configure 0.7.3 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------ ## +## Report this to gerrit@erg.abdn.ac.uk ## +## ------------------------------------ ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || continue - ac_builddir=. +} # ac_fn_c_try_link -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi +#ifdef __STDC__ +# include +#else +# include +#endif -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -wavemon configure 0.6.10 -generated by GNU Autoconf 2.61 +#undef $2 -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} _ACEOF - exit +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by wavemon $as_me 0.6.10, which was -generated by GNU Autoconf 2.61. Invocation command line was +It was created by wavemon $as_me 0.7.3, which was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -1380,8 +1823,8 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done + $as_echo "PATH: $as_dir" + done IFS=$as_save_IFS } >&5 @@ -1415,12 +1858,12 @@ do | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" + as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -1436,13 +1879,13 @@ do -* ) ac_must_keep_next=true ;; esac fi - ac_configure_args="$ac_configure_args '$ac_arg'" + as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -1454,11 +1897,9 @@ trap 'exit_status=$? { echo - cat <<\_ASBOX -## ---------------- ## + $as_echo "## ---------------- ## ## Cache variables. ## -## ---------------- ## -_ASBOX +## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( @@ -1467,12 +1908,13 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -1491,128 +1933,136 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; ) echo - cat <<\_ASBOX -## ----------------- ## + $as_echo "## ----------------- ## ## Output variables. ## -## ----------------- ## -_ASBOX +## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------------- ## + $as_echo "## ------------------- ## ## File substitutions. ## -## ------------------- ## -_ASBOX +## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - echo "$ac_var='\''$ac_val'\''" + $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## + $as_echo "## ----------- ## ## confdefs.h. ## -## ----------- ## -_ASBOX +## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h +$as_echo "/* confdefs.h */" > confdefs.h + # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF - cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + # Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - set x "$CONFIG_SITE" + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac elif test "x$prefix" != xNONE; then - set x "$prefix/share/config.site" "$prefix/etc/config.site" + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site else - set x "$ac_default_prefix/share/config.site" \ - "$ac_default_prefix/etc/config.site" + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site fi -shift -for ac_site_file +for ac_site_file in "$ac_site_file1" "$ac_site_file2" do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1626,68 +2076,56 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi - - - - - - - - - - - - - - - - - - - - - - - - +## -------------------- ## +## Main body of script. ## +## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -1716,9 +2154,7 @@ for ac_dir in config "$srcdir"/config; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "cannot find install-sh, install.sh, or shtool in config \"$srcdir\"/config" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -1743,35 +2179,27 @@ CFLAGS="-O2 -Wall" # wavemon is only supported on Linux, warn user about futile compilations # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 -echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} - { (exit 1); exit 1; }; } - -{ echo "$as_me:$LINENO: checking build system type" >&5 -echo $ECHO_N "checking build system type... $ECHO_C" >&6; } -if test "${ac_cv_build+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 -echo "$as_me: error: cannot guess build type; you must specify one" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi -{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 -echo "${ECHO_T}$ac_cv_build" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 -echo "$as_me: error: invalid value of canonical build" >&2;} - { (exit 1); exit 1; }; };; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -1787,28 +2215,24 @@ IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6; } -if test "${ac_cv_host+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 -echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 -echo "$as_me: error: invalid value of canonical host" >&2;} - { (exit 1); exit 1; }; };; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -1826,9 +2250,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac case "$host_os" in *linux*|*LINUX*) ;; - *) { { echo "$as_me:$LINENO: error: incompatible OS '$host_os' - required is Linux with wireless extensions." >&5 -echo "$as_me: error: incompatible OS '$host_os' - required is Linux with wireless extensions." >&2;} - { (exit 1); exit 1; }; } + *) as_fn_error $? "incompatible OS '$host_os' - required is Linux with wireless extensions." "$LINENO" 5 esac # Checks for programs. @@ -1840,10 +2262,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1853,25 +2275,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1880,10 +2302,10 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -1893,25 +2315,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -1919,12 +2341,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -1937,10 +2355,10 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1950,25 +2368,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -1977,10 +2395,10 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -1991,18 +2409,18 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -2021,11 +2439,11 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2036,10 +2454,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2049,25 +2467,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2080,10 +2498,10 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2093,25 +2511,25 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do + for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done -done + done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } else - { echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi @@ -2123,12 +2541,8 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2138,51 +2552,37 @@ fi fi -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. -echo "$as_me:$LINENO: checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (ac_try="$ac_compiler --version >&5" +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler --version >&5") 2>&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -v >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -v >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (ac_try="$ac_compiler -V >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compiler -V >&5") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2194,42 +2594,38 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -# -# List of possible output files, starting from the most likely. -# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) -# only as a last resort. b.out is created by i960 compilers. -ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' -# -# The IRIX 6 linker writes into existing files which may not be -# executable, retaining their permissions. Remove them first so a -# subsequent execution test works. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + ac_rmfiles= for ac_file in $ac_files do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles -if { (ac_try="$ac_link_default" +if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -2239,14 +2635,14 @@ for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -2265,78 +2661,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi - -{ echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6; } -if test -z "$ac_file"; then - echo "$as_me: failed program was:" >&5 +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -{ echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; } - -rm -f a.out a.exe conftest$ac_cv_exeext b.out +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } -{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6; } - -{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } -if { (ac_try="$ac_link" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -2344,37 +2703,90 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } fi - -rm -f conftest$ac_cv_exeext -{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6; } +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2386,51 +2798,46 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (ac_try="$ac_compile" +if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - echo "$as_me: failed program was:" >&5 + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } fi - rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2444,92 +2851,49 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_compiler_gnu=no + ac_compiler_gnu=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } -GCC=`test $ac_compiler_gnu = yes && echo yes` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - CFLAGS="" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +int +main () +{ + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2540,35 +2904,12 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_compile "$LINENO"; then : - ac_c_werror_flag=$ac_save_c_werror_flag +else + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -2579,42 +2920,18 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -2630,18 +2947,14 @@ else CFLAGS= fi fi -{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -2698,31 +3011,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then + if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -2733,17 +3024,19 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; xno) - { echo "$as_me:$LINENO: result: unsupported" >&5 -echo "${ECHO_T}unsupported" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac +if test "x$ac_cv_prog_cc_c89" != xno; then : +fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2756,15 +3049,15 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -2778,11 +3071,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2791,76 +3080,34 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : break fi @@ -2872,8 +3119,8 @@ fi else ac_cv_prog_CPP=$CPP fi -{ echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -2883,11 +3130,7 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include @@ -2896,83 +3139,40 @@ cat >>conftest.$ac_ext <<_ACEOF #endif Syntax error _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +if ac_fn_c_try_cpp "$LINENO"; then : +else # Broken: fails on valid input. continue fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then +if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - # Passes both tests. ac_preproc_ok=: break fi - -rm -f conftest.err conftest.$ac_ext +rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -2994,22 +3194,23 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -3027,17 +3228,29 @@ case $as_dir/ in # program-specific install script used by HP pwplus--don't use. : else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi fi fi done done ;; esac -done + + done IFS=$as_save_IFS +rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then @@ -3050,8 +3263,8 @@ fi INSTALL=$ac_install_sh fi fi -{ echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -3065,45 +3278,40 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Checks for header files. -{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Extract the first word of "grep ggrep" to use in msg output -if test -z "$GREP"; then -set dummy grep ggrep; ac_prog_name=$2 -if test "${ac_cv_path_GREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 else + if test -z "$GREP"; then ac_path_GREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue - # Check for GNU ac_path_GREP and select it if it is found. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'GREP' >> "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -3115,77 +3323,61 @@ case `"$ac_path_GREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_GREP_found && break 3 + $ac_path_GREP_found && break 3 + done + done done -done - -done IFS=$as_save_IFS - - -fi - -GREP="$ac_cv_path_GREP" -if test -z "$GREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else ac_cv_path_GREP=$GREP fi - fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -echo "${ECHO_T}$ac_cv_path_GREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else - # Extract the first word of "egrep" to use in msg output -if test -z "$EGREP"; then -set dummy egrep; ac_prog_name=$2 -if test "${ac_cv_path_EGREP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + if test -z "$EGREP"; then ac_path_EGREP_found=false -# Loop through the user's path and test for each of PROGNAME-LIST -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue - # Check for GNU ac_path_EGREP and select it if it is found. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - echo 'EGREP' >> "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` + as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -3197,46 +3389,31 @@ case `"$ac_path_EGREP" --version 2>&1` in rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac - - $ac_path_EGREP_found && break 3 + $ac_path_EGREP_found && break 3 + done + done done -done - -done IFS=$as_save_IFS - - -fi - -EGREP="$ac_cv_path_EGREP" -if test -z "$EGREP"; then - { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } -fi - + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi else ac_cv_path_EGREP=$EGREP fi - fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3251,47 +3428,23 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no + ac_cv_header_stdc=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : + $EGREP "memchr" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3301,18 +3454,14 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : + $EGREP "free" >/dev/null 2>&1; then : + else ac_cv_header_stdc=no fi @@ -3322,14 +3471,10 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then + if test "$cross_compiling" = yes; then : : else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include @@ -3353,338 +3498,92 @@ main () if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } -if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_time=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_time=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6; } -if test $ac_cv_header_time = yes; then - -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 + return 0; +} _ACEOF +if ac_fn_c_try_run "$LINENO"; then : +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -done - - - - - - - - +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then +$as_echo "#define STDC_HEADERS 1" >>confdefs.h +fi -for ac_header in ncurses.h fcntl.h netdb.h sys/ioctl.h sys/time.h unistd.h\ - net/if_arp.h netinet/ether.h net/ethernet.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 else - # Is the header compilable? -{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -#include <$ac_header> +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_compiler=no + ac_cv_header_time=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then -# Is the header present? -{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <$ac_header> -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext -{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6; } +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to gerrit@erg.abdn.ac.uk ## -## ------------------------------------ ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -fi -if test `eval echo '${'$as_ac_Header'}'` = yes; then +done + + +for ac_header in ncurses.h fcntl.h netdb.h sys/ioctl.h sys/time.h unistd.h\ + net/if_arp.h netinet/ether.h net/ethernet.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else - { { echo "$as_me:$LINENO: error: $ac_header not found" >&5 -echo "$as_me: error: $ac_header not found" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "$ac_header not found" "$LINENO" 5 fi done @@ -3692,86 +3591,59 @@ done # linux/if.h needs 'struct sockaddr' # linux/wireless.h in turn depends on linux/if.h - - - for ac_header in sys/socket.h linux/if.h linux/wireless.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if HAVE_SYS_SOCKET_H +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "#if HAVE_SYS_SOCKET_H # include #endif #if HAVE_LINUX_IF_H # include #endif - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval echo '${'$as_ac_Header'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_Header'}'` = yes; then +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else - { { echo "$as_me:$LINENO: error: can not use $ac_header" >&5 -echo "$as_me: error: can not use $ac_header" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "can not use $ac_header" "$LINENO" 5 fi done -{ echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5 -echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; } -if test "${ac_cv_header_stdbool_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ +# require minimum version of the wireless extensions +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #if WIRELESS_EXT < 18 + #error "Need minimum version WIRELESS_EXT = 18" + #endif +int +main () +{ + + ; + return 0; +} _ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "linux/wireless.h is too old, need WE >= 18 +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if ${ac_cv_header_stdbool_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -3800,34 +3672,17 @@ cat >>conftest.$ac_ext <<_ACEOF char b[false == 0 ? 1 : -1]; char c[__bool_true_false_are_defined == 1 ? 1 : -1]; char d[(bool) 0.5 == true ? 1 : -1]; - bool e = &s; + /* See body of main program for 'e'. */ char f[(_Bool) 0.0 == false ? 1 : -1]; char g[true]; char h[sizeof (_Bool)]; char i[sizeof s.t]; enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ _Bool n[m]; char o[sizeof n == m * sizeof n[0] ? 1 : -1]; char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; -# if defined __xlc__ || defined __GNUC__ - /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0 - reported by James Lemley on 2005-10-05; see - http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html - This test is not quite right, since xlc is allowed to - reject this program, as the initializer for xlcbug is - not one of the forms that C requires support for. - However, doing the test right would require a runtime - test, and that would make cross-compilation harder. - Let us hope that IBM fixes the xlc bug, and also adds - support for this kind of constant expression. In the - meantime, this test will reject xlc, which is OK, since - our stdbool.h substitute should suffice. We also test - this with GCC, where it should work, to detect more - quickly whether someone messes up the test in the - future. */ - char digs[] = "0123456789"; - int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1); -# endif /* Catch a bug in an HP-UX C compiler. See http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html @@ -3839,6 +3694,7 @@ int main () { + bool e = &s; *pq |= q; *pq |= ! q; /* Refer to every declared value, to avoid compiler optimizations. */ @@ -3849,89 +3705,17 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdbool_h=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdbool_h=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5 -echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; } -{ echo "$as_me:$LINENO: checking for _Bool" >&5 -echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; } -if test "${ac_cv_type__Bool+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -typedef _Bool ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type__Bool=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type__Bool=no + ac_cv_header_stdbool_h=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 -echo "${ECHO_T}$ac_cv_type__Bool" >&6; } -if test $ac_cv_type__Bool = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } +ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE__BOOL 1 @@ -3942,27 +3726,20 @@ fi if test $ac_cv_header_stdbool_h = yes; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_STDBOOL_H 1 -_ACEOF +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h fi # Tests involving libraries - -{ echo "$as_me:$LINENO: checking for pow in -lm" >&5 -echo $ECHO_N "checking for pow in -lm... $ECHO_C" >&6; } -if test "${ac_cv_lib_m_pow+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pow in -lm" >&5 +$as_echo_n "checking for pow in -lm... " >&6; } +if ${ac_cv_lib_m_pow+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -3980,39 +3757,18 @@ return pow (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_m_pow=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_m_pow=no + ac_cv_lib_m_pow=no fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5 -echo "${ECHO_T}$ac_cv_lib_m_pow" >&6; } -if test $ac_cv_lib_m_pow = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_pow" >&5 +$as_echo "$ac_cv_lib_m_pow" >&6; } +if test "x$ac_cv_lib_m_pow" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBM 1 _ACEOF @@ -4021,19 +3777,14 @@ _ACEOF fi - -{ echo "$as_me:$LINENO: checking for waddstr in -lncurses" >&5 -echo $ECHO_N "checking for waddstr in -lncurses... $ECHO_C" >&6; } -if test "${ac_cv_lib_ncurses_waddstr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for waddstr in -lncurses" >&5 +$as_echo_n "checking for waddstr in -lncurses... " >&6; } +if ${ac_cv_lib_ncurses_waddstr+:} false; then : + $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lncurses $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -4051,39 +3802,18 @@ return waddstr (); return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then +if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ncurses_waddstr=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_lib_ncurses_waddstr=no + ac_cv_lib_ncurses_waddstr=no fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_waddstr" >&5 -echo "${ECHO_T}$ac_cv_lib_ncurses_waddstr" >&6; } -if test $ac_cv_lib_ncurses_waddstr = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_waddstr" >&5 +$as_echo "$ac_cv_lib_ncurses_waddstr" >&6; } +if test "x$ac_cv_lib_ncurses_waddstr" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBNCURSES 1 _ACEOF @@ -4092,57 +3822,15 @@ _ACEOF fi - - -# Testing library functions - - - - - - - - - - - - - -for ac_func in modf log10 gettimeofday \ - memmove memset strdup \ - strchr strspn strcspn \ - strcasecmp strncasecmp \ - strtol \ - ether_ntohost -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cap_get_flag in -lcap" >&5 +$as_echo_n "checking for cap_get_flag in -lcap... " >&6; } +if ${ac_cv_lib_cap_cap_get_flag+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcap $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC @@ -4150,86 +3838,73 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func -choke me -#endif - +char cap_get_flag (); int main () { -return $ac_func (); +return cap_get_flag (); ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_link") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && - $as_test_x conftest$ac_exeext; then - eval "$as_ac_var=yes" +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_cap_cap_get_flag=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_var=no" + ac_cv_lib_cap_cap_get_flag=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_cap_cap_get_flag" >&5 +$as_echo "$ac_cv_lib_cap_cap_get_flag" >&6; } +if test "x$ac_cv_lib_cap_cap_get_flag" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBCAP 1 +_ACEOF + + LIBS="-lcap $LIBS" -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then + + + +# Testing library functions +for ac_func in modf log10 gettimeofday \ + memmove memset strdup \ + strchr strspn strcspn \ + strcasecmp strncasecmp \ + strtol \ + ether_ntohost +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else - { { echo "$as_me:$LINENO: error: function '$ac_func' not supported" >&5 -echo "$as_me: error: function '$ac_func' not supported" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "function '$ac_func' not supported" "$LINENO" 5 fi done # Checks for typedefs, structures, and compiler characteristics. if test $ac_cv_c_compiler_gnu = yes; then - { echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6; } -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +$as_echo_n "checking whether $CC needs -traditional... " >&6; } +if ${ac_cv_prog_gcc_traditional+:} false; then : + $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no @@ -4238,40 +3913,32 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then + $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi -{ echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +$as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi -{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int @@ -4331,55 +3998,29 @@ main () return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_const=no + ac_cv_c_const=no fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF +$as_echo "#define const /**/" >>confdefs.h fi -{ echo "$as_me:$LINENO: checking for inline" >&5 -echo $ECHO_N "checking for inline... $ECHO_C" >&6; } -if test "${ac_cv_c_inline+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; @@ -4388,39 +4029,16 @@ $ac_kw foo_t foo () {return 0; } #endif _ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then +if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5 -echo "${ECHO_T}$ac_cv_c_inline" >&6; } - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; @@ -4465,12 +4083,13 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - *) $as_unset $ac_var ;; + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done @@ -4478,8 +4097,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -4501,13 +4120,24 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && - { echo "$as_me:$LINENO: updating cache $cache_file" >&5 -echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else - { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -4524,6 +4154,12 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g @@ -4550,14 +4186,15 @@ DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= +U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`echo "$ac_i" | sed "$ac_script"` + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -4565,12 +4202,14 @@ LTLIBOBJS=$ac_ltlibobjs -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -4580,59 +4219,79 @@ cat >$CONFIG_STATUS <<_ACEOF debug=false ac_cs_recheck=false ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' else - PATH_SEPARATOR=: + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' fi - rm -f conf$$.sh + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi @@ -4641,20 +4300,19 @@ fi # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) -as_nl=' -' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +as_myself= +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; @@ -4665,32 +4323,111 @@ if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then - echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 fi -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi -done + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + -# Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -4704,13 +4441,17 @@ else as_basename=false fi +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi -# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -echo X/"$0" | +$as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -4725,104 +4466,103 @@ echo X/"$0" | } s/.*/./; q'` -# CDPATH. -$as_unset CDPATH - - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line after each line using $LINENO; the second 'sed' - # does the real work. The second script uses 'N' to pair each - # line-number line with the line containing $LINENO, and appends - # trailing '-' during substitution so that $LINENO is not a special - # case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # scripts with optimization help from Paolo Bonzini. Blame Lee - # E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in +case `echo -n x` in #((((( -n*) - case `echo 'x\c'` in + case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - *) ECHO_C='\c';; + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir -fi -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else as_ln_s='cp -p' -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln + fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p=: + as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false @@ -4839,12 +4579,12 @@ else as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else - case $1 in - -*)set "./$1";; + case $1 in #( + -*)set "./$1";; esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' @@ -4859,13 +4599,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -# Save the log message, to keep $[0] and so on meaningful, and to +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by wavemon $as_me 0.6.10, which was -generated by GNU Autoconf 2.61. Invocation command line was +This file was extended by wavemon $as_me 0.7.3, which was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4878,60 +4624,76 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE Configuration files: $config_files -Report bugs to ." +Report bugs to . +wavemon home page: ." _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -wavemon config.status 0.6.10 -configured by $0, generated by GNU Autoconf 2.61, - with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +wavemon config.status 0.7.3 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" -Copyright (C) 2006 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in - --*=*) + --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; *) ac_option=$1 ac_optarg=$2 @@ -4944,25 +4706,30 @@ do -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - echo "$ac_cs_version"; exit ;; + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) - echo "$ac_cs_usage"; exit ;; + $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } ;; + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; - *) ac_config_targets="$ac_config_targets $1" + *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac @@ -4977,30 +4744,32 @@ if $ac_cs_silent; then fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - CONFIG_SHELL=$SHELL + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' export CONFIG_SHELL - exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + exec "\$@" fi _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - echo "$ac_log" + $as_echo "$ac_log" } >&5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets @@ -5008,9 +4777,7 @@ do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -5031,171 +4798,194 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 + trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -# -# Set up the sed scripts for CONFIG_FILES section. -# +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then -_ACEOF +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do - cat >conf$$subs.sed <<_ACEOF -SHELL!$SHELL$ac_delim -PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim -PACKAGE_NAME!$PACKAGE_NAME$ac_delim -PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim -PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim -PACKAGE_STRING!$PACKAGE_STRING$ac_delim -PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim -exec_prefix!$exec_prefix$ac_delim -prefix!$prefix$ac_delim -program_transform_name!$program_transform_name$ac_delim -bindir!$bindir$ac_delim -sbindir!$sbindir$ac_delim -libexecdir!$libexecdir$ac_delim -datarootdir!$datarootdir$ac_delim -datadir!$datadir$ac_delim -sysconfdir!$sysconfdir$ac_delim -sharedstatedir!$sharedstatedir$ac_delim -localstatedir!$localstatedir$ac_delim -includedir!$includedir$ac_delim -oldincludedir!$oldincludedir$ac_delim -docdir!$docdir$ac_delim -infodir!$infodir$ac_delim -htmldir!$htmldir$ac_delim -dvidir!$dvidir$ac_delim -pdfdir!$pdfdir$ac_delim -psdir!$psdir$ac_delim -libdir!$libdir$ac_delim -localedir!$localedir$ac_delim -mandir!$mandir$ac_delim -DEFS!$DEFS$ac_delim -ECHO_C!$ECHO_C$ac_delim -ECHO_N!$ECHO_N$ac_delim -ECHO_T!$ECHO_T$ac_delim -LIBS!$LIBS$ac_delim -build_alias!$build_alias$ac_delim -host_alias!$host_alias$ac_delim -target_alias!$target_alias$ac_delim -build!$build$ac_delim -build_cpu!$build_cpu$ac_delim -build_vendor!$build_vendor$ac_delim -build_os!$build_os$ac_delim -host!$host$ac_delim -host_cpu!$host_cpu$ac_delim -host_vendor!$host_vendor$ac_delim -host_os!$host_os$ac_delim -CC!$CC$ac_delim -CFLAGS!$CFLAGS$ac_delim -LDFLAGS!$LDFLAGS$ac_delim -CPPFLAGS!$CPPFLAGS$ac_delim -ac_ct_CC!$ac_ct_CC$ac_delim -EXEEXT!$EXEEXT$ac_delim -OBJEXT!$OBJEXT$ac_delim -CPP!$CPP$ac_delim -INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim -INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim -INSTALL_DATA!$INSTALL_DATA$ac_delim -GREP!$GREP$ac_delim -EGREP!$EGREP$ac_delim -LIBOBJS!$LIBOBJS$ac_delim -LTLIBOBJS!$LTLIBOBJS$ac_delim -_ACEOF + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 60; then + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done +rm -f conf$$subs.sh -ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` -if test -n "$ac_eof"; then - ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` - ac_eof=`expr $ac_eof + 1` -fi +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} -cat >>$CONFIG_STATUS <<_ACEOF -cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACAWK _ACEOF -sed ' -s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g -s/^/s,@/; s/!/@,|#_!!_#|/ -:n -t n -s/'"$ac_delim"'$/,g/; t -s/$/\\/; p -N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n -' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF -:end -s/|#_!!_#|//g -CEOF$ac_eof +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/ -s/:*\${srcdir}:*/:/ -s/:*@srcdir@:*/:/ -s/^\([^=]*=[ ]*\):*/\1/ + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// s/^[^=]*=[ ]*$// }' fi -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" -for ac_tag in :F $CONFIG_FILES +eval set X " :F $CONFIG_FILES " +shift +for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -echo "$as_me: error: Invalid tag $ac_tag." >&2;} - { (exit 1); exit 1; }; };; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -5214,7 +5004,7 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -5223,26 +5013,34 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;} [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -echo "$as_me: error: cannot find input file: $ac_f" >&2;} - { (exit 1); exit 1; }; };; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac - ac_file_inputs="$ac_file_inputs $ac_f" + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ - configure_input="Generated from "`IFS=: - echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin";; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -5252,42 +5050,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - { as_dir="$ac_dir" - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -echo X"$as_dir" | +$as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -5305,20 +5068,15 @@ echo X"$as_dir" | q } s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -echo "$as_me: error: cannot create directory $as_dir" >&2;} - { (exit 1); exit 1; }; }; } + as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -5358,12 +5116,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix esac _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= - -case `sed -n '/datarootdir/ { +ac_sed_dataroot=' +/datarootdir/ { p q } @@ -5371,36 +5129,37 @@ case `sed -n '/datarootdir/ { /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p -' $ac_file_inputs` in +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s&@configure_input@&$configure_input&;t t +s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t @@ -5410,21 +5169,25 @@ s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&5 -echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined." >&2;} - - rm -f "$tmp/stdin" + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" case $ac_file in - -) cat "$tmp/out"; rm -f "$tmp/out";; - *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; - esac + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; @@ -5434,11 +5197,13 @@ which seems to be undefined. Please make sure it is defined." >&2;} done # for ac_tag -{ (exit 0); exit 0; } +as_fn_exit 0 _ACEOF -chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -5458,6 +5223,10 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/configure.ac b/configure.ac index b66b40b..62666fe 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,7 @@ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.50) -AC_INIT([wavemon], [0.6.10], [gerrit@erg.abdn.ac.uk], [wavemon-current]) +AC_PREREQ(2.64) +AC_INIT([wavemon], [0.7.3], [gerrit@erg.abdn.ac.uk], [wavemon-current], + [http://eden-feed.erg.abdn.ac.uk/wavemon]) # Variables @@ -41,11 +42,20 @@ AC_CHECK_HEADERS([sys/socket.h linux/if.h linux/wireless.h], [], # include #endif ]) +# require minimum version of the wireless extensions +AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [#include + #include + #if WIRELESS_EXT < 18 + #error "Need minimum version WIRELESS_EXT = 18" + #endif])],[], + [AC_MSG_FAILURE([linux/wireless.h is too old, need WE >= 18])]) AC_HEADER_STDBOOL # Tests involving libraries AC_CHECK_LIB([m], [pow]) AC_CHECK_LIB([ncurses], [waddstr]) +AC_CHECK_LIB([cap], [cap_get_flag]) # Testing library functions diff --git a/error.c b/error.c index 4c8a1ff..5408c07 100644 --- a/error.c +++ b/error.c @@ -19,6 +19,31 @@ */ #include "wavemon.h" #include +#if HAVE_LIBCAP +#include + +static bool has_capability(cap_value_t cap) +{ + cap_t cap_proc = cap_get_proc(); + cap_flag_value_t cur_val; + + if (cap_get_flag(cap_proc, cap, CAP_EFFECTIVE, &cur_val)) + err_sys("cap_get_flag(CAP_EFFECTIVE)"); + cap_free(cap_proc); + + return cur_val == CAP_SET; +} + +bool has_net_admin_capability(void) +{ + return has_capability(CAP_NET_ADMIN); +} +#else /* !HAVE_LIBCAP */ +bool has_net_admin_capability(void) +{ + return geteuid() == 0; +} +#endif /* * For displaying warning messages that are unrelated to system calls, @@ -34,6 +59,34 @@ void err_msg(const char *format, ...) sleep(WARN_DISPLAY_DELAY); } +/** + * terminate_all_processes - terminate wavemon and reset screen + * @fmt: printf-like format string + * @strerr: set to non-0 if termination is due to failed system call + * @ap: argument list for @fmt + */ +static void terminate_all_processes(const char *fmt, int strerr, va_list ap) +{ + int saved_errno = strerr ? errno : 0; + /* + * wavemon runs in its own process group. Block TERM in this process, + * but send to all others (parent or child), which by default do not + * block TERM. + */ + xsignal(SIGTERM, SIG_IGN); + endwin(); + kill(0, SIGTERM); + reset_shell_mode(); + if (saved_errno) { + errno = saved_errno; + vwarn(fmt, ap); + } else { + vwarnx(fmt, ap); + } + va_end(ap); + exit(EXIT_FAILURE); +} + /* * Abort on fatal error unrelated to system call. */ @@ -41,11 +94,8 @@ void err_quit(const char *format, ...) { va_list argp; - endwin(); - va_start(argp, format); - verrx(EXIT_FAILURE, format, argp); - va_end(argp); + terminate_all_processes(format, false, argp); } /* @@ -55,9 +105,6 @@ void err_sys(const char *format, ...) { va_list argp; - endwin(); - va_start(argp, format); - verr(EXIT_FAILURE, format, argp); - va_end(argp); + terminate_all_processes(format, true, argp); } diff --git a/help_scr.c b/help_scr.c index 3f69e6c..5cde8c2 100644 --- a/help_scr.c +++ b/help_scr.c @@ -19,29 +19,22 @@ */ #include "wavemon.h" -enum wavemon_screen scr_help(WINDOW *w_menu) -{ - WINDOW *w_help; - int key = 0; +/* GLOBALS */ +static WINDOW *w_help; +void scr_help_init(void) +{ w_help = newwin_title(0, WAV_HEIGHT, "Help", false); - waddstr_center(w_help, WAV_HEIGHT/2 - 1, "don't panic."); - wrefresh(w_help); +} - while (key < KEY_F(1) || key > KEY_F(10)) { - while ((key = wgetch(w_menu)) <= 0) - usleep(5000); - - /* Keyboard shortcuts */ - if (key == 'q') - key = KEY_F(10); - else if (key == 'i') - key = KEY_F(1); - } +int scr_help_loop(WINDOW *w_menu) +{ + return wgetch(w_menu); +} +void scr_help_fini(void) +{ delwin(w_help); - - return key - KEY_F(1); } diff --git a/info_scr.c b/info_scr.c index 1b4974d..0b8eace 100644 --- a/info_scr.c +++ b/info_scr.c @@ -20,45 +20,29 @@ #include "iw_if.h" /* GLOBALS */ -static WINDOW *w_levels, *w_stats; - +static WINDOW *w_levels, *w_stats, *w_if, *w_info, *w_net; +static struct timer dyn_updates; static struct iw_stat cur; -void (*iw_stat_redraw) (void); -/* - * Statistics handler for period polling - */ -static void sampling_handler(int signum) -{ - iw_getstat(&cur); - iw_cache_update(&cur); - - if (iw_stat_redraw) - iw_stat_redraw(); -} - -static void init_stat_iv(void) +void sampling_init(void (*sampling_handler)(int)) { struct itimerval i; div_t d = div(conf.stat_iv, 1000); /* conf.stat_iv in msec */ + xsignal(SIGALRM, SIG_IGN); + iw_getinf_range(conf_ifname(), &cur.range); i.it_interval.tv_sec = i.it_value.tv_sec = d.quot; i.it_interval.tv_usec = i.it_value.tv_usec = d.rem * 1000; + xsignal(SIGALRM, sampling_handler); + (*sampling_handler)(0); setitimer(ITIMER_REAL, &i, NULL); - - signal(SIGALRM, sampling_handler); } -void reinit_on_changes(void) +void sampling_do_poll(void) { - static int stat_iv = 0; - - if (conf.stat_iv != stat_iv) { - iw_getinf_range(conf.ifname, &cur.range); - init_stat_iv(); - stat_iv = conf.stat_iv; - } + iw_getstat(&cur); + iw_cache_update(&cur); } static void display_levels(void) @@ -67,66 +51,86 @@ static void display_levels(void) lvlscale[2] = { -40, -20}, snrscale[2] = { 6, 12 }; char tmp[0x100]; - static float qual, noise, signal, ssnr; - /* Spread out 'quality' and 'signal' if 'noise' is undefined */ - const bool offset = (cur.stat.qual.updated & IW_QUAL_NOISE_INVALID) != 0; - int line = 1; + static float qual, signal, noise, ssnr; + int line; - if (!(cur.stat.qual.updated & IW_QUAL_QUAL_INVALID)) { - line += offset; + for (line = 1; line <= WH_LEVEL; line++) + mvwclrtoborder(w_levels, line, 1); - mvwaddstr(w_levels, line++, 1, "link quality: "); + if ((cur.stat.qual.updated & IW_QUAL_ALL_INVALID) == IW_QUAL_ALL_INVALID) { + wattron(w_levels, A_BOLD); + waddstr_center(w_levels, (WH_LEVEL + 1)/2, "NO INTERFACE DATA"); + goto done_levels; + } + + line = 1; + /* Noise data is rare. Use the space for spreading out. */ + if (cur.stat.qual.updated & IW_QUAL_NOISE_INVALID) + line++; + + if (cur.stat.qual.updated & IW_QUAL_QUAL_INVALID) { + line++; + } else { qual = ewma(qual, cur.stat.qual.qual, conf.meter_decay / 100.0); + + mvwaddstr(w_levels, line++, 1, "link quality: "); sprintf(tmp, "%0.f/%d ", qual, cur.range.max_qual.qual); waddstr_b(w_levels, tmp); + waddbar(w_levels, line++, qual, 0, cur.range.max_qual.qual, lvlscale, true); } - if (!(cur.stat.qual.updated & IW_QUAL_LEVEL_INVALID)) { + if (cur.stat.qual.updated & IW_QUAL_NOISE_INVALID) + line++; + + if (cur.stat.qual.updated & IW_QUAL_LEVEL_INVALID) { + line++; + } else { signal = ewma(signal, cur.dbm.signal, conf.meter_decay / 100.0); - line += offset; mvwaddstr(w_levels, line++, 1, "signal level: "); - sprintf(tmp, "%.0f dBm (%s) ", signal, dbm2units(signal)); waddstr_b(w_levels, tmp); + waddbar(w_levels, line, signal, conf.sig_min, conf.sig_max, lvlscale, true); - if (conf.lthreshold_action) waddthreshold(w_levels, line, signal, conf.lthreshold, conf.sig_min, conf.sig_max, lvlscale, '>'); if (conf.hthreshold_action) waddthreshold(w_levels, line, signal, conf.hthreshold, conf.sig_min, conf.sig_max, lvlscale, '<'); + line++; } - if (!offset) { + if (! (cur.stat.qual.updated & IW_QUAL_NOISE_INVALID)) { noise = ewma(noise, cur.dbm.noise, conf.meter_decay / 100.0); - line += 1; mvwaddstr(w_levels, line++, 1, "noise level: "); - sprintf(tmp, "%.0f dBm (%s) ", noise, dbm2units(noise)); waddstr_b(w_levels, tmp); + waddbar(w_levels, line++, noise, conf.noise_min, conf.noise_max, nscale, false); /* - * Since we make sure (in iw_if.c) that invalid noise levels always + * Since we make sure (in iw_if.c) that invalid signal levels always * imply invalid noise levels, we can display a valid SNR here. */ - mvwaddstr(w_levels, line++, 1, "signal-to-noise ratio: "); - ssnr = ewma(ssnr, cur.dbm.signal - cur.dbm.noise, conf.meter_decay / 100.0); + + mvwaddstr(w_levels, line++, 1, "signal-to-noise ratio: "); if (ssnr > 0) waddstr_b(w_levels, "+"); sprintf(tmp, "%.0f dB ", ssnr); waddstr_b(w_levels, tmp); - waddbar(w_levels, 8, ssnr, 0, 110, snrscale, true); + + waddbar(w_levels, line, ssnr, 0, 110, snrscale, true); } + +done_levels: wrefresh(w_levels); } @@ -135,7 +139,7 @@ static void display_stats(void) struct if_stat nstat; char tmp[0x100]; - if_getstat(conf.ifname, &nstat); + if_getstat(conf_ifname(), &nstat); /* * Interface RX stats @@ -156,14 +160,14 @@ static void display_stats(void) waddstr_b(w_stats, tmp); waddstr(w_stats, " crypt, "); - if (cur.range.we_version_compiled > 11) { - sprintf(tmp, "%'u", cur.stat.discard.fragment); - waddstr_b(w_stats, tmp); - waddstr(w_stats, " frag, "); - } + sprintf(tmp, "%'u", cur.stat.discard.fragment); + waddstr_b(w_stats, tmp); + waddstr(w_stats, " frag, "); + sprintf(tmp, "%'u", cur.stat.discard.misc); waddstr_b(w_stats, tmp); waddstr(w_stats, " misc"); + wclrtoborder(w_stats); /* @@ -175,39 +179,37 @@ static void display_stats(void) byte_units(nstat.tx_bytes)); waddstr_b(w_stats, tmp); - if (cur.range.we_version_compiled > 11) { - waddstr(w_stats, ", mac retries: "); - sprintf(tmp, "%'u", cur.stat.discard.retries); - waddstr_b(w_stats, tmp); + waddstr(w_stats, ", mac retries: "); + sprintf(tmp, "%'u", cur.stat.discard.retries); + waddstr_b(w_stats, tmp); + + waddstr(w_stats, ", missed beacons: "); + sprintf(tmp, "%'u", cur.stat.miss.beacon); + waddstr_b(w_stats, tmp); - waddstr(w_stats, ", missed beacons: "); - sprintf(tmp, "%'u", cur.stat.miss.beacon); - waddstr_b(w_stats, tmp); - } wclrtoborder(w_stats); wrefresh(w_stats); } -static void redraw_stats(void) -{ - display_levels(); - display_stats(); -} - static void display_info(WINDOW *w_if, WINDOW *w_info) { struct iw_dyn_info info; char tmp[0x100]; int i; - iw_getinf_dyn(conf.ifname, &info); + dyn_info_get(&info, conf_ifname(), &cur.range); wmove(w_if, 1, 1); - sprintf(tmp, "%s (%s)", conf.ifname, info.name); - waddstr_b(w_if, tmp); + waddstr_b(w_if, conf_ifname()); + if (cur.range.enc_capa & IW_WPA_MASK) + sprintf(tmp, " (%s, %s)", info.name, format_wpa(&cur.range)); + else + sprintf(tmp, " (%s)", info.name); + waddstr(w_if, tmp); if (info.cap_essid) { - waddstr(w_if, ", ESSID: "); + waddstr_b(w_if, ","); + waddstr(w_if, " ESSID: "); if (info.essid_ct > 1) sprintf(tmp, "\"%s\" [%d]", info.essid, info.essid_ct); @@ -264,13 +266,16 @@ static void display_info(WINDOW *w_if, WINDOW *w_info) cur.range.sensitivity); waddstr_b(w_info, tmp); } - + wclrtoborder(w_info); wmove(w_info, 2, 1); - if (info.cap_freq) { + if (info.cap_freq && info.freq < 256) + info.freq = channel_to_freq(info.freq, &cur.range); + if (info.cap_freq && info.freq > 1e3) { waddstr(w_info, "freq: "); sprintf(tmp, "%g GHz", info.freq / 1.0e9); waddstr_b(w_info, tmp); + i = freq_to_channel(info.freq, &cur.range); if (i >= 0) { waddstr(w_info, ", channel: "); @@ -283,12 +288,13 @@ static void display_info(WINDOW *w_if, WINDOW *w_info) if (! (info.mode >= IW_MODE_MASTER && info.mode <= IW_MODE_MONITOR)) { waddstr(w_info, ", bitrate: "); - if (info.cap_bitrate) { + if (info.bitrate) { sprintf(tmp, "%g Mbit/s", info.bitrate / 1.0e6); waddstr_b(w_info, tmp); } else waddstr(w_info, "n/a"); } + wclrtoborder(w_info); wmove(w_info, 3, 1); waddstr(w_info, "power mgt: "); @@ -310,6 +316,7 @@ static void display_info(WINDOW *w_if, WINDOW *w_info) waddstr(w_info, ", TX-power: "); waddstr_b(w_info, format_txpower(&info.txpower)); } + wclrtoborder(w_info); wmove(w_info, 4, 1); waddstr(w_info, "retry: "); @@ -326,8 +333,9 @@ static void display_info(WINDOW *w_if, WINDOW *w_info) else sprintf(tmp, "%d B", info.rts.value); waddstr_b(w_info, tmp); - } else + } else { waddstr(w_info, "rts/cts: n/a"); + } waddstr(w_info, ", "); if (info.cap_frag) { @@ -337,32 +345,68 @@ static void display_info(WINDOW *w_if, WINDOW *w_info) else sprintf(tmp, "%d B", info.frag.value); waddstr_b(w_info, tmp); - } else + } else { waddstr(w_info, "frag: n/a"); + } + wclrtoborder(w_info); wmove(w_info, 5, 1); waddstr(w_info, "encryption: "); - if (info.cap_key) { - if (info.key_flags & IW_ENCODE_DISABLED || info.key_size == 0) { - waddstr_b(w_info, "off"); - } else { - char *key = format_key(info.key, info.key_size); + if (info.keys) { + int cnt = dyn_info_active_keys(&info); - waddstr_b(w_info, curtail(key, "..", MAXXLEN / 2)); + if (cnt == 0) { + waddstr_b(w_info, "off (no key set)"); + } else if (info.active_key) { + i = info.active_key - 1; + waddstr_b(w_info, curtail(format_key(info.keys + i), + "..", MAXXLEN/2)); - i = info.key_flags & IW_ENCODE_INDEX; - if (i > 1) { - sprintf(tmp, " [%d]", i); - waddstr_b(w_info, tmp); - } - if (info.key_flags & IW_ENCODE_RESTRICTED) + if (info.keys[i].flags & IW_ENCODE_RESTRICTED) waddstr(w_info, ", restricted"); - if (info.key_flags & IW_ENCODE_OPEN) + if (info.keys[i].flags & IW_ENCODE_OPEN) waddstr(w_info, ", open"); + + /* First key = default */ + if (cnt > 1 || info.active_key != 1) { + sprintf(tmp, " [%d]", info.active_key); + waddstr_b(w_info, tmp); + } + if (cnt > 1) { + sprintf(tmp, " (%d other key%s)", cnt - 1, + cnt == 2 ? "" : "s"); + waddstr(w_info, tmp); + } + } else if (dyn_info_wep_keys(&info) == cnt) { + waddstr_b(w_info, "off "); + sprintf(tmp, "(%d disabled WEP key%s)", cnt, + cnt == 1 ? "" : "s"); + waddstr(w_info, tmp); + } else { + uint8_t j = 0, k = 0; + + do if (info.keys[j].size && + !(info.keys[j].flags & IW_ENCODE_DISABLED)) + info.keys[k++].size = info.keys[j].size; + while (k < cnt && ++j < info.nkeys); + + if (cnt == 1) + j = sprintf(tmp, "1 key (index #%u), ", j + 1); + else + j = sprintf(tmp, "%d keys with ", k); + for (i = 0; i < k; i++) + j += sprintf(tmp + j, "%s%d", i ? "/" : "", + info.keys[i].size * 8); + sprintf(tmp + j, " bits"); + waddstr_b(w_info, tmp); } - } else - waddstr(w_info, "n/a"); + } else if (has_net_admin_capability()) { + waddstr(w_info, "no information available"); + } else { + waddstr(w_info, "n/a (requires CAP_NET_ADMIN permissions)"); + } + dyn_info_cleanup(&info); wclrtoborder(w_info); wrefresh(w_info); } @@ -372,62 +416,139 @@ static void display_netinfo(WINDOW *w_net) struct if_info info; char tmp[0x40]; - if_getinf(conf.ifname, &info); + if_getinf(conf_ifname(), &info); - mvwaddstr(w_net, 1, 1, "ip: "); - sprintf(tmp, "%s/%u", inet_ntoa(info.addr), - prefix_len(&info.netmask)); - waddstr_b(w_net, tmp); + wmove(w_net, 1, 1); + wclrtoborder(w_net); + if (getmaxy(w_net) == WH_NET_MAX) { + waddstr(w_net, conf_ifname()); + + waddstr_b(w_net, " ("); + waddstr(w_net, info.flags & IFF_UP ? "UP" : "DOWN"); + if (info.flags & IFF_RUNNING) /* Interface RFC2863 OPER_UP */ + waddstr(w_net, " RUNNING"); +#ifdef IFF_LOWER_UP /* Linux 2.6.17 */ + if (info.flags & IFF_LOWER_UP) /* Driver signals L1 up */ + waddstr(w_net, " LOWER_UP"); +#endif +#ifdef IFF_DORMANT /* Linux 2.6.17 */ + if (info.flags & IFF_DORMANT) /* Driver signals dormant */ + waddstr(w_net, " DORMANT"); +#endif + if (info.flags & IFF_MASTER) /* Master of a load balancer */ + waddstr(w_net, " MASTER"); + if (info.flags & IFF_SLAVE) /* Slave of a load balancer */ + waddstr(w_net, " SLAVE"); + if (info.flags & IFF_POINTOPOINT) /* Is a point-to-point link */ + waddstr(w_net, " POINTOPOINT"); + if (info.flags & IFF_DYNAMIC) /* Address is volatile */ + waddstr(w_net, " DYNAMIC"); + if (info.flags & IFF_BROADCAST) /* Valid broadcast address set */ + waddstr(w_net, " BROADCAST"); + if (info.flags & IFF_MULTICAST) /* Supports multicast */ + waddstr(w_net, " MULTICAST"); + if (info.flags & IFF_ALLMULTI) /* Receive all mcast packets */ + waddstr(w_net, " ALLMULTI"); + if (info.flags & IFF_NOARP) /* No ARP protocol */ + waddstr(w_net, " NOARP"); + if (info.flags & IFF_NOTRAILERS) /* Avoid use of trailers */ + waddstr(w_net, " NOTRAILERS"); + if (info.flags & IFF_PROMISC) /* Is in promiscuous mode */ + waddstr(w_net, " PROMISC"); + if (info.flags & IFF_DEBUG) /* Internal debugging flag */ + waddstr(w_net, " DEBUG"); + waddstr_b(w_net, ")"); + + wmove(w_net, 2, 1); + wclrtoborder(w_net); + } + waddstr(w_net, "mac: "); + waddstr_b(w_net, ether_lookup(&info.hwaddr)); - waddstr(w_net, ", bcast: "); - waddstr_b(w_net, inet_ntoa(info.bcast)); + if (getmaxy(w_net) == WH_NET_MAX) { + waddstr(w_net, ", qlen: "); + sprintf(tmp, "%u", info.txqlen); + waddstr_b(w_net, tmp); - waddstr(w_net, ", mac: "); - waddstr_b(w_net, ether_addr(&info.hwaddr)); + wmove(w_net, 3, 1); + wclrtoborder(w_net); + } else { + waddstr(w_net, ", "); + } + waddstr(w_net, "ip: "); + + if (!info.addr.s_addr) { + waddstr_b(w_net, "n/a"); + } else { + sprintf(tmp, "%s/%u", inet_ntoa(info.addr), + prefix_len(&info.netmask)); + waddstr_b(w_net, tmp); + + /* only show bcast address if not set to the obvious default */ + if (info.bcast.s_addr != + (info.addr.s_addr | ~info.netmask.s_addr)) { + waddstr(w_net, ", bcast: "); + waddstr_b(w_net, inet_ntoa(info.bcast)); + } + } + + /* 802.11 MTU may be greater than Ethernet MTU (1500) */ + if (info.mtu && info.mtu != ETH_DATA_LEN) { + waddstr(w_net, ", mtu: "); + sprintf(tmp, "%u", info.mtu); + waddstr_b(w_net, tmp); + } - wclrtoborder(w_net); wrefresh(w_net); } -enum wavemon_screen scr_info(WINDOW *w_menu) +static void redraw_stat_levels(int signum) { - WINDOW *w_if, *w_info, *w_net; - struct timer t1; - int key = 0; + sampling_do_poll(); + display_levels(); + display_stats(); +} - w_if = newwin_title(0, 2, "Interface", true); - w_levels = newwin_title(2, 9, "Levels", true); - w_stats = newwin_title(11, 3, "Statistics", true); - w_info = newwin_title(14, 6, "Info", true); - w_net = newwin_title(20, 3, "Network", false); +void scr_info_init(void) +{ + int line = 0; + + w_if = newwin_title(line, WH_IFACE, "Interface", true); + line += WH_IFACE; + w_levels = newwin_title(line, WH_LEVEL, "Levels", true); + line += WH_LEVEL; + w_stats = newwin_title(line, WH_STATS, "Statistics", true); + line += WH_STATS; + w_info = newwin_title(line, WH_INFO_MIN, "Info", true); + line += WH_INFO_MIN; + if (LINES >= WH_INFO_SCR_MIN + (WH_NET_MAX - WH_NET_MIN)) + w_net = newwin_title(line, WH_NET_MAX, "Network", false); + else + w_net = newwin_title(line, WH_NET_MIN, "Network", false); display_info(w_if, w_info); display_netinfo(w_net); + start_timer(&dyn_updates, conf.info_iv * 1000000); + sampling_init(redraw_stat_levels); +} - iw_stat_redraw = redraw_stats; - - while (key < KEY_F(1) || key > KEY_F(10)) { +int scr_info_loop(WINDOW *w_menu) +{ + if (end_timer(&dyn_updates)) { display_info(w_if, w_info); display_netinfo(w_net); - - start_timer(&t1, conf.info_iv * 1000000); - while (!end_timer(&t1) && (key = wgetch(w_menu)) <= 0) - sleep(1); - - /* Keyboard shortcuts */ - if (key == 'q') - key = KEY_F(10); - else if (key == 'i') - key = KEY_F(1); + start_timer(&dyn_updates, conf.info_iv * 1000000); } + return wgetch(w_menu); +} - iw_stat_redraw = NULL; +void scr_info_fini(void) +{ + sampling_stop(); - delwin(w_if); - delwin(w_levels); - delwin(w_stats); - delwin(w_info); delwin(w_net); - - return key - KEY_F(1); + delwin(w_info); + delwin(w_stats); + delwin(w_levels); + delwin(w_if); } diff --git a/iw_if.c b/iw_if.c index 2e22454..708ff85 100644 --- a/iw_if.c +++ b/iw_if.c @@ -19,12 +19,50 @@ */ #include "iw_if.h" +/* Determine the artificial spreading of random samples (best: 1..10) */ +#define WAVE_RAND_SPREAD 1 +/* Fallback maximum quality level when using random samples. */ +#define WAVE_RAND_QUAL_MAX 100 + /* * Obtain network device information */ +static int if_get_flags(int skfd, const char *ifname) +{ + struct ifreq ifr; + + memset(&ifr, 0, sizeof(struct ifreq)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); + + if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) + err_sys("can not get interface flags for %s", ifname); + return ifr.ifr_flags; +} + +/* Return true if @ifname is known to be up */ +bool if_is_up(int skfd, const char *ifname) +{ + return if_get_flags(skfd, ifname) & IFF_UP; +} + +/** Bring @ifname up if not already up. Return 0 if ok, < 0 on error. */ +int if_set_up(int skfd, const char *ifname) +{ + struct ifreq ifr; + + memset(&ifr, 0, sizeof(ifr)); + strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); + + ifr.ifr_flags = if_get_flags(skfd, ifname); + if (ifr.ifr_flags & IFF_UP) + return 0; + + ifr.ifr_flags |= IFF_UP; + return ioctl(skfd, SIOCSIFFLAGS, &ifr); +} /* Interface information */ -void if_getinf(char *ifname, struct if_info *info) +void if_getinf(const char *ifname, struct if_info *info) { struct ifreq ifr; int skfd = socket(AF_INET, SOCK_DGRAM, 0); @@ -35,12 +73,20 @@ void if_getinf(char *ifname, struct if_info *info) memset(&ifr, 0, sizeof(struct ifreq)); memset(info, 0, sizeof(struct if_info)); - /* Copy the 6 byte Ethernet address and the 4 byte struct in_addrs */ + info->flags = if_get_flags(skfd, ifname); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ); - if (ioctl(skfd, SIOCGIFADDR, &ifr) >= 0) - memcpy(&info->addr, &ifr.ifr_addr.sa_data[2], 4); + if (ioctl(skfd, SIOCGIFMTU, &ifr) == 0) + info->mtu = ifr.ifr_mtu; + + if (ioctl(skfd, SIOCGIFTXQLEN, &ifr) >= 0) + info->txqlen = ifr.ifr_qlen; + + /* Copy the 6 byte Ethernet address and the 4 byte struct in_addrs */ if (ioctl(skfd, SIOCGIFHWADDR, &ifr) >= 0) memcpy(&info->hwaddr, &ifr.ifr_hwaddr.sa_data, 6); + if (ioctl(skfd, SIOCGIFADDR, &ifr) >= 0) + memcpy(&info->addr, &ifr.ifr_addr.sa_data[2], 4); if (ioctl(skfd, SIOCGIFNETMASK, &ifr) >= 0) memcpy(&info->netmask, &ifr.ifr_netmask.sa_data[2], 4); if (ioctl(skfd, SIOCGIFBRDADDR, &ifr) >= 0) @@ -64,29 +110,28 @@ static FILE *open_proc_net(const char *filename) return fp; } -/* - * Populate list of available wireless interfaces - * Return index into array-of-lists ld. +/** + * iw_get_interface_list - Return NULL-terminated array of WiFi interfaces. */ -int iw_get_interface_list(void) +char **iw_get_interface_list(void) { - char *lp, tmp[LISTVAL_MAX]; - int ld = ll_create(); + char **if_list = NULL, *p, tmp[BUFSIZ]; + int nifs = 1; /* if_list[nifs-1] = NULL */ FILE *fp = open_proc_net("wireless"); - while (fgets(tmp, LISTVAL_MAX, fp)) - if ((lp = strchr(tmp, ':'))) { - *lp = '\0'; - ll_push(ld, "s", tmp + strspn(tmp, " ")); + while (fgets(tmp, sizeof(tmp), fp)) + if ((p = strchr(tmp, ':'))) { + if_list = realloc(if_list, sizeof(char *) * (nifs + 1)); + for (*p = '\0', p = tmp; isspace(*p); ) + p++; + if_list[nifs-1] = strdup(p); + if_list[nifs++] = NULL; } fclose(fp); - - if (ll_size(ld) == 0) - err_quit("no wireless interfaces found!"); - return ld; + return if_list; } -void if_getstat(char *ifname, struct if_stat *stat) +void if_getstat(const char *ifname, struct if_stat *stat) { char line[0x100]; unsigned long d; @@ -111,22 +156,26 @@ void if_getstat(char *ifname, struct if_stat *stat) fclose(fp); } -/* - * obtain dynamic device information +/** + * iw_dyn_info_get - populate dynamic information + * @info: information to populate + * @ifname: interface name + * @if: range information to use (number of encryption keys) */ -void iw_getinf_dyn(char *ifname, struct iw_dyn_info *info) +void dyn_info_get(struct iw_dyn_info *info, + const char *ifname, struct iw_range *ir) { struct iwreq iwr; - int skfd = socket(AF_INET, SOCK_DGRAM, 0); + int i, skfd = socket(AF_INET, SOCK_DGRAM, 0); if (skfd < 0) err_sys("%s: can not open socket", __func__); memset(info, 0, sizeof(struct iw_dyn_info)); - strncpy(iwr.ifr_name, ifname, IFNAMSIZ); + if (ioctl(skfd, SIOCGIWNAME, &iwr) < 0) - err_sys("can not open device '%s'", iwr.u.name); + err_sys("can not open device '%s'", ifname); strncpy(info->name, iwr.u.name, IFNAMSIZ); iwr.u.essid.pointer = (caddr_t) info->essid; @@ -136,7 +185,7 @@ void iw_getinf_dyn(char *ifname, struct iw_dyn_info *info) info->cap_essid = 1; /* Convert potential ESSID index to count > 0 */ info->essid_ct = iwr.u.essid.flags & IW_ENCODE_INDEX ? : 1; - strncpy(info->essid, iwr.u.essid.pointer, IW_ESSID_MAX_SIZE); + info->essid[iwr.u.essid.length] = '\0'; } if (ioctl(skfd, SIOCGIWNWID, &iwr) >= 0) { @@ -161,10 +210,8 @@ void iw_getinf_dyn(char *ifname, struct iw_dyn_info *info) info->sens = iwr.u.sens.value; } - if (ioctl(skfd, SIOCGIWRATE, &iwr) >= 0) { - info->cap_bitrate = 1; - info->bitrate = iwr.u.bitrate.value; - } + if (ioctl(skfd, SIOCGIWRATE, &iwr) >= 0) + info->bitrate = iwr.u.bitrate.value; if (ioctl(skfd, SIOCGIWTXPOW, &iwr) >= 0) { info->cap_txpower = 1; @@ -196,13 +243,41 @@ void iw_getinf_dyn(char *ifname, struct iw_dyn_info *info) info->mode = iwr.u.mode; } - iwr.u.data.pointer = (caddr_t) info->key; - iwr.u.data.length = sizeof(info->key); - iwr.u.data.flags = 0; - if (ioctl(skfd, SIOCGIWENCODE, &iwr) >= 0) { - info->cap_key = 1; - info->key_flags = iwr.u.data.flags; - info->key_size = iwr.u.data.length; + info->nkeys = ir->max_encoding_tokens; + if (info->nkeys) { + info->keys = calloc(info->nkeys, sizeof(*info->keys)); + if (info->keys == NULL) + err_sys("malloc(key array)"); + + /* Get index of default key first */ + iwr.u.data.pointer = info->keys[0].key; + iwr.u.data.length = sizeof(info->keys[0].key); + iwr.u.data.flags = 0; + if (ioctl(skfd, SIOCGIWENCODE, &iwr) < 0) { + free(info->keys); + info->keys = NULL; + info->nkeys = 0; + } else { + info->active_key = iwr.u.data.flags & IW_ENCODE_INDEX; + } + } + /* If successful, populate the key array */ + for (i = 0; i < info->nkeys; i++) { + iwr.u.data.pointer = info->keys[i].key; + iwr.u.data.length = sizeof(info->keys->key); + iwr.u.data.flags = i + 1; /* counts 1..n instead of 0..n-1 */ + if (ioctl(skfd, SIOCGIWENCODE, &iwr) < 0) { + free(info->keys); + info->nkeys = 0; + break; + } + info->keys[i].size = iwr.u.data.length; + info->keys[i].flags = iwr.u.data.flags; + + /* Validate whether the current key is indeed active */ + if (i + 1 == info->active_key && (info->keys[i].size == 0 || + (info->keys[i].flags & IW_ENCODE_DISABLED))) + info->active_key = 0; } if (ioctl(skfd, SIOCGIWAP, &iwr) >= 0) { @@ -212,10 +287,17 @@ void iw_getinf_dyn(char *ifname, struct iw_dyn_info *info) close(skfd); } +void dyn_info_cleanup(struct iw_dyn_info *info) +{ + if (info) + free(info->keys); +} + + /* * get range information */ -void iw_getinf_range(char *ifname, struct iw_range *range) +void iw_getinf_range(const char *ifname, struct iw_range *range) { struct iwreq iwr; int skfd = socket(AF_INET, SOCK_DGRAM, 0); @@ -224,10 +306,7 @@ void iw_getinf_range(char *ifname, struct iw_range *range) err_sys("%s: can not open socket", __func__); memset(range, 0, sizeof(struct iw_range)); - strncpy(iwr.ifr_name, ifname, IFNAMSIZ); - if (ioctl(skfd, SIOCGIWNAME, &iwr) < 0) - err_sys("can not open device '%s'", iwr.u.name); iwr.u.data.pointer = (caddr_t) range; iwr.u.data.length = sizeof(struct iw_range); @@ -240,121 +319,48 @@ void iw_getinf_range(char *ifname, struct iw_range *range) /* * Obtain periodic IW statistics */ -static int rnd_signal(int min, int max) +static int rand_wave(float *rlvl, float *step, float *rlvl_next, float range) { - static float rlvl, rlvl_next; - static float step = 1.0; int i; - for (i = 0; i < 1; i++) - if (rlvl < rlvl_next) { - if (rlvl_next - rlvl < step) - step /= 2; - rlvl += step; - } else if (rlvl > rlvl_next) { - if (rlvl - rlvl_next < step) - step /= 2; - rlvl -= step; + for (i = 0; i < WAVE_RAND_SPREAD; i++) + if (*rlvl < *rlvl_next) { + if (*rlvl_next - *rlvl < *step) + *step /= 2.0; + *rlvl += *step; + } else if (*rlvl > *rlvl_next) { + if (*rlvl - *rlvl_next < *step) + *step /= 2.0; + *rlvl -= *step; } - step += (rand() / (float)RAND_MAX) - 0.5; - if ((rlvl == rlvl_next) || (step < 0.05)) { - rlvl_next = (rand() / (float)RAND_MAX) * (max - min) + min; - step = rand() / (float)RAND_MAX; + *step += (random() / (float)RAND_MAX) - 0.5; + if (*rlvl == *rlvl_next || *step < 0.05) { + *rlvl_next = (range * random()) / RAND_MAX; + *step = random() / (float)RAND_MAX; } - return rlvl; + return *rlvl; } -static int rnd_noise(int min, int max) +/* Random signal/noise/quality levels */ +static void iw_getstat_random(struct iw_stat *iw) { - static float rlvl, rlvl_next; - static float step = 1.0; - int i; + static float rnd_sig, snext, sstep = 1.0, rnd_noise, nnext, nstep = 1.0; - for (i = 0; i < 1; i++) - if (rlvl < rlvl_next) { - if (rlvl_next - rlvl < step) - step /= 2; - rlvl += step; - } else if (rlvl > rlvl_next) { - if (rlvl - rlvl_next < step) - step /= 2; - rlvl -= step; - } - step += (rand() / (float)RAND_MAX) - 0.5; - if ((rlvl == rlvl_next) || (step < 0.05)) { - rlvl_next = (rand() / (float)RAND_MAX) * (max - min) + min; - step = rand() / (float)RAND_MAX; - } - return rlvl; -} + rand_wave(&rnd_sig, &sstep, &snext, conf.sig_max - conf.sig_min); + rand_wave(&rnd_noise, &nstep, &nnext, conf.noise_max - conf.noise_min); -/* Random signal/noise */ -static void iw_getstat_random(struct iw_statistics *stat) -{ - stat->qual.level = rnd_signal(-102, 10); - stat->qual.noise = rnd_noise(-102, -30); -} + if (iw->range.max_qual.qual == 0) + iw->range.max_qual.qual = WAVE_RAND_QUAL_MAX; -/* Code in part taken from wireless extensions #30 */ -static void iw_getstat_old_style(struct iw_statistics *stat) -{ - char line[0x100], *lp; - int tmp; - FILE *fp = open_proc_net("wireless"); - - while (fgets(line, sizeof(line), fp)) { - for (lp = line; *lp && isspace(*lp); lp++) - ; - if (strncmp(lp, conf.ifname, strlen(conf.ifname)) == 0 && - lp[strlen(conf.ifname)] == ':') { - lp += strlen(conf.ifname) + 1; - - /* status */ - lp = strtok(lp, " "); - sscanf(lp, "%X", &tmp); - stat->status = (unsigned short)tmp; - - /* link quality */ - lp = strtok(NULL, " "); - if (strchr(lp, '.') != NULL) - stat->qual.updated |= IW_QUAL_QUAL_UPDATED; - sscanf(lp, "%d", &tmp); - stat->qual.qual = (unsigned char)tmp; - - /* signal level */ - lp = strtok(NULL, " "); - if (strchr(lp, '.') != NULL) - stat->qual.updated |= IW_QUAL_LEVEL_UPDATED; - sscanf(lp, "%d", &tmp); - stat->qual.level = (unsigned char)tmp; - - /* noise level */ - lp = strtok(NULL, " "); - if (strchr(lp, '.') != NULL) - stat->qual.updated |= IW_QUAL_NOISE_UPDATED; - sscanf(lp, "%d", &tmp); - stat->qual.noise = (unsigned char)tmp; - - /* # of packets w/ invalid nwid */ - lp = strtok(NULL, " "); - sscanf(lp, "%u", &stat->discard.nwid); - - /* # of packets w/ invalid key */ - lp = strtok(NULL, " "); - sscanf(lp, "%u", &stat->discard.code); - - /* # of packets w/ bad attitude */ - lp = strtok(NULL, " "); - sscanf(lp, "%u", &stat->discard.misc); - - /* each interface appears just once */ - break; - } - } - fclose(fp); + iw->stat.qual.level = dbm_to_u8(conf.sig_min + rnd_sig); + iw->stat.qual.noise = dbm_to_u8(conf.noise_min + rnd_noise); + iw->stat.qual.updated = IW_QUAL_DBM; + iw->stat.qual.qual = map_range(conf.sig_min + rnd_sig, + conf.sig_min, conf.sig_max, + 0, iw->range.max_qual.qual); } -static void iw_getstat_new_style(struct iw_statistics *stat) +static void iw_getstat_real(struct iw_statistics *stat) { struct iwreq wrq; int skfd = socket(AF_INET, SOCK_DGRAM, 0); @@ -365,7 +371,7 @@ static void iw_getstat_new_style(struct iw_statistics *stat) wrq.u.data.pointer = (caddr_t) stat; wrq.u.data.length = sizeof(*stat); wrq.u.data.flags = 0; - strncpy(wrq.ifr_name, conf.ifname, IFNAMSIZ); + strncpy(wrq.ifr_name, conf_ifname(), IFNAMSIZ); if (ioctl(skfd, SIOCGIWSTATS, &wrq) < 0) { /* @@ -405,22 +411,11 @@ void iw_sanitize(struct iw_range *range, struct iw_quality *qual, dbm->noise = (double)(qual->noise / 2.0) - 110.0; } else if ((qual->updated & IW_QUAL_DBM) || - /* - * Statistics in dBm (absolute power measurement) - * These are encoded in the range -192 .. 63 - */ qual->level > range->max_qual.level) { - - if (!(qual->updated & IW_QUAL_LEVEL_INVALID)) { - dbm->signal = qual->level; - if (qual->level >= 64) - dbm->signal -= 0x100; - } - if (!(qual->updated & IW_QUAL_NOISE_INVALID)) { - dbm->noise = qual->noise; - if (qual->noise >= 64) - dbm->noise -= 0x100; - } + if (!(qual->updated & IW_QUAL_LEVEL_INVALID)) + dbm->signal = u8_to_dbm(qual->level); + if (!(qual->updated & IW_QUAL_NOISE_INVALID)) + dbm->noise = u8_to_dbm(qual->noise); } else { /* * Relative values (0 -> max) @@ -457,11 +452,9 @@ void iw_getstat(struct iw_stat *iw) memset(&iw->stat, 0, sizeof(iw->stat)); if (conf.random) - iw_getstat_random(&iw->stat); - else if (iw->range.we_version_compiled > 11) - iw_getstat_new_style(&iw->stat); + iw_getstat_random(iw); else - iw_getstat_old_style(&iw->stat); + iw_getstat_real(&iw->stat); iw_sanitize(&iw->range, &iw->stat.qual, &iw->dbm); } @@ -473,13 +466,32 @@ void dump_parameters(void) struct if_stat nstat; int i; - iw_getinf_dyn(conf.ifname, &info); - iw_getinf_range(conf.ifname, &iw.range); + iw_getinf_range(conf_ifname(), &iw.range); + dyn_info_get(&info, conf_ifname(), &iw.range); iw_getstat(&iw); - if_getstat(conf.ifname, &nstat); + if_getstat(conf_ifname(), &nstat); printf("\n"); - printf("Configured device: %s\n", conf.ifname); + printf("Configured device: %s (%s)\n", conf_ifname(), info.name); + printf(" Security: %s\n", iw.range.enc_capa ? + format_enc_capab(iw.range.enc_capa, ", ") : "WEP"); + if (iw.range.num_encoding_sizes && + iw.range.num_encoding_sizes < IW_MAX_ENCODING_SIZES) { + + printf(" Key sizes: "); + for (i = 0; i < iw.range.num_encoding_sizes; i++) { + if (i) + printf(", "); + if (iw.range.encoding_size[i] == 5) + printf("WEP-40"); + else if (iw.range.encoding_size[i] == 13) + printf("WEP-104"); + else + printf("%u bits", + iw.range.encoding_size[i] * 8); + } + printf("\n"); + } printf(" WE version: %d (source version %d)\n\n", iw.range.we_version_compiled, iw.range.we_version_source); @@ -503,7 +515,10 @@ void dump_parameters(void) printf(" nwid: %X\n", info.nwid.value); } - if (info.cap_freq) { + /* Some drivers only return the channel (e.g. ipw2100) */ + if (info.cap_freq && info.freq < 256) + info.freq = channel_to_freq(info.freq, &iw.range); + if (info.cap_freq && info.freq > 1e3) { i = freq_to_channel(info.freq, &iw.range); if (i >= 0) printf(" channel: %d\n", i); @@ -531,7 +546,7 @@ void dump_parameters(void) if (info.mode != 1 && info.cap_ap) printf(" access point: %s\n", format_bssid(&info.ap_addr)); - if (info.cap_bitrate) + if (info.bitrate) printf(" bitrate: %g Mbit/s\n", info.bitrate / 1.0e6); else printf(" bitrate: n/a\n"); @@ -564,24 +579,28 @@ void dump_parameters(void) } printf(" encryption: "); - if (info.cap_key) { - if (info.key_flags & IW_ENCODE_DISABLED || info.key_size == 0) { - printf("off"); + if (!info.nkeys && has_net_admin_capability()) + printf("no information available\n"); + else if (!info.nkeys) + printf("n/a (requires CAP_NET_ADMIN permissions)\n"); + for (i = 0; i < info.nkeys; i++) { + if (i) + printf(" "); + /* Current key is marked by `=' sign */ + printf("[%u]%s ", i + 1, i + 1 == info.active_key ? "=" : ":"); + + if (info.keys[i].flags & IW_ENCODE_DISABLED || !info.keys[i].size) { + printf("off\n"); } else { - printf("%s", format_key(info.key, info.key_size)); - i = info.key_flags & IW_ENCODE_INDEX; - if (i > 1) - printf(" [%d]", i); - if (info.key_flags & IW_ENCODE_RESTRICTED) + printf("%s", format_key(info.keys + i)); + if (info.keys[i].flags & IW_ENCODE_RESTRICTED) printf(", restricted"); - if (info.key_flags & IW_ENCODE_OPEN) + if (info.keys[i].flags & IW_ENCODE_OPEN) printf(", open"); + printf("\n"); } - } else { - printf("n/a"); } - printf("\n"); printf(" power management: "); if (info.cap_power) printf("%s\n", format_power(&info.power, &iw.range)); @@ -602,17 +621,15 @@ void dump_parameters(void) byte_units(nstat.rx_bytes)); printf(" invalid nwid: %'u\n", iw.stat.discard.nwid); printf(" invalid key: %'u\n", iw.stat.discard.code); - if (iw.range.we_version_compiled > 11) { - printf(" invalid fragm.: %'u\n", iw.stat.discard.fragment); - printf(" missed beacons: %'u\n", iw.stat.miss.beacon); - } + printf(" invalid fragm.: %'u\n", iw.stat.discard.fragment); + printf(" missed beacons: %'u\n", iw.stat.miss.beacon); printf(" misc errors: %'u\n", iw.stat.discard.misc); /* TX stats */ printf(" TX total: %'llu packets (%s)\n", nstat.tx_packets, byte_units(nstat.tx_bytes)); - if (iw.range.we_version_compiled > 11) - printf(" exc. MAC retries: %'u\n", iw.stat.discard.retries); + printf(" exc. MAC retries: %'u\n", iw.stat.discard.retries); printf("\n"); + dyn_info_cleanup(&info); } diff --git a/iw_if.h b/iw_if.h index 2a81496..0aab63f 100644 --- a/iw_if.h +++ b/iw_if.h @@ -49,14 +49,41 @@ */ #define NOISE_DBM_SANE_MIN -127 -/* Static network interface information - see netdevice(7) */ -struct if_info { /* modified ifreq */ +/** + * struct if_info - wireless interface network information + * @hwaddr: MAC address + * @addr: IPv4 interface address + * @netmask: IPv4 interface netmask + * @bcast: IPv4 interface broadcast address + * @mtu: interface MTU + * @txqlen: tx queue length + * @flags: interface flags + * See also netdevice(7) + */ +struct if_info { struct ether_addr hwaddr; struct in_addr addr, netmask, bcast; + uint16_t mtu; + short txqlen; + short flags; +}; +extern bool if_is_up(int skfd, const char *ifname); +extern int if_set_up(int skfd, const char *ifname); +extern void if_getinf(const char *ifname, struct if_info *info); + +/** + * struct iw_key - Encoding information + * @key: encryption key + * @size: length of @key in bytes + * @flags: flags reported by SIOCGIWENCODE + */ +struct iw_key { + uint8_t key[IW_ENCODING_TOKEN_MAX]; + uint16_t size; + uint16_t flags; }; -extern void if_getinf(char *ifname, struct if_info *info); /** * struct iw_dyn_info - modified iw_req @@ -81,9 +108,9 @@ extern void if_getinf(char *ifname, struct if_info *info); * @sens: sensitivity threshold of the card * @bitrate: bitrate (client mode) * - * @key: encryption key - * @key_size: length of @key in bytes - * @key_flags: bitmask with information about @key + * @keys: array of encryption keys + * @nkeys: length of @keys + * @active_key: index of current key into @keys (counting from 1) * */ struct iw_dyn_info { @@ -95,14 +122,12 @@ struct iw_dyn_info { cap_nickname:1, cap_freq:1, cap_sens:1, - cap_bitrate:1, cap_txpower:1, cap_retry:1, cap_rts:1, cap_frag:1, cap_mode:1, cap_ap:1, - cap_key:1, cap_power:1, cap_aplist:1; @@ -122,11 +147,41 @@ struct iw_dyn_info { int32_t sens; unsigned long bitrate; - char key[IW_ENCODING_TOKEN_MAX]; - uint16_t key_size; - uint16_t key_flags; + struct iw_key *keys; + uint8_t nkeys; + uint8_t active_key; }; +/* Return the number of encryption keys marked 'active' in @info */ +static inline uint8_t dyn_info_active_keys(struct iw_dyn_info *info) +{ + int i, num_active = 0; + + for (i = 0; i < info->nkeys; i++) + num_active += info->keys[i].size && + !(info->keys[i].flags & IW_ENCODE_DISABLED); + return num_active; +} + +/* Return the number of 40-bit/104-bit keys in @info */ +static inline uint8_t dyn_info_wep_keys(struct iw_dyn_info *info) +{ + int i, num_wep = 0; + + for (i = 0; i < info->nkeys; i++) + if (!(info->keys[i].flags & IW_ENCODE_DISABLED)) + num_wep += info->keys[i].size == 5 || + info->keys[i].size == 13; + return num_wep; +} +extern void dyn_info_get(struct iw_dyn_info *info, + const char *ifname, struct iw_range *ir); +extern void dyn_info_cleanup(struct iw_dyn_info *info); + + +/** + * struct if_stat - Packet/byte counts for interfaces + */ struct if_stat { unsigned long long rx_packets, tx_packets; @@ -134,7 +189,7 @@ struct if_stat { tx_bytes; }; -extern void if_getstat(char *ifname, struct if_stat *stat); +extern void if_getstat(const char *ifname, struct if_stat *stat); /* * Structs to communicate WiFi statistics @@ -146,6 +201,7 @@ struct iw_levelstat { }; #define IW_LSTAT_INIT { 0, 0, IW_QUAL_LEVEL_INVALID | IW_QUAL_NOISE_INVALID } +extern void iw_getinf_range(const char *ifname, struct iw_range *range); extern void iw_sanitize(struct iw_range *range, struct iw_quality *qual, struct iw_levelstat *dbm); @@ -162,52 +218,82 @@ struct iw_stat { struct iw_levelstat dbm; }; +/* + * Periodic sampling of wireless statistics via timer alarm + */ extern void iw_getstat(struct iw_stat *stat); extern void iw_cache_update(struct iw_stat *stat); -extern void iw_getinf_dyn(char *ifname, struct iw_dyn_info *info); -extern void iw_getinf_range(char *ifname, struct iw_range *range); +extern void sampling_init(void (*sampling_handler)(int)); +extern void sampling_do_poll(void); +static inline void sampling_stop(void) { alarm(0); } + +/* + * Organization of scan results + */ +/** + * struct scan_result - Ranked list of scan results + * @ap_addr: MAC address + * @essid: station SSID (may be empty) + * @mode: operation mode (type of station) + * @freq: frequency/channel information + * @qual: signal quality information + * @has_key: whether using encryption or not + * @flags: properties gathered from Information Elements + * @next: next, lower-ranking entry + */ +struct scan_result { + struct ether_addr ap_addr; + char essid[IW_ESSID_MAX_SIZE + 2]; + int mode; + double freq; + struct iw_quality qual; + + int has_key:1; + uint32_t flags; + + struct scan_result *next; +}; -extern void (*iw_stat_redraw) (void); +typedef int (*scan_cmp_func)(const struct scan_result *, const struct scan_result *); +extern int cmp_sig(const struct scan_result *a, const struct scan_result *b); +extern int cmp_freq_sig(const struct scan_result *a, const struct scan_result *b); + +extern struct scan_result *get_scan_list(int skfd, const char *ifname, int we_version, + scan_cmp_func cmp_scan_result); +extern void free_scan_result(struct scan_result *head); /* - * Helper routines + * General helper routines */ static inline const char *iw_opmode(const uint8_t mode) { - static char *modes[] = { "Auto", - "Ad-Hoc", - "Managed", - "Master", - "Repeater", - "Secondary", - "Monitor", - "Mesh" + static char *modes[] = { + [IW_MODE_AUTO] = "Auto", + [IW_MODE_ADHOC] = "Ad-Hoc", + [IW_MODE_INFRA] = "Managed", + [IW_MODE_MASTER] = "Master", + [IW_MODE_REPEAT] = "Repeater", + [IW_MODE_SECOND] = "Secondary", + [IW_MODE_MONITOR] = "Monitor", + [IW_MODE_MESH] = "Mesh" }; return mode < ARRAY_SIZE(modes) ? modes[mode] : "Unknown/bug"; } -static inline bool is_zero_ether_addr(const uint8_t *mac) -{ - return ! (mac[0] | mac[1] | mac[2] | mac[3] | mac[4] | mac[5]); -} - -static inline bool is_broadcast_ether_addr(const uint8_t *mac) -{ - return (mac[0] & mac[1] & mac[2] & mac[3] & mac[4] & mac[5]) == 0xff; -} - /* Print a mac-address, include leading zeroes (unlike ether_ntoa(3)) */ static inline char *ether_addr(const struct ether_addr *ea) { - static char str[MAC_ADDR_MAX]; - - sprintf(str, "%02X:%02X:%02X:%02X:%02X:%02X", - ea->ether_addr_octet[0], ea->ether_addr_octet[1], - ea->ether_addr_octet[2], ea->ether_addr_octet[3], - ea->ether_addr_octet[4], ea->ether_addr_octet[5]); - return str; + static char mac[MAC_ADDR_MAX]; + char *d = mac, *a = ether_ntoa(ea); +next_chunk: + if (a[0] == '\0' || a[1] == '\0' || a[1] == ':') + *d++ = '0'; + while ((*d++ = conf.cisco_mac ? (*a == ':' ? '.' : *a) : toupper(*a))) + if (*a++ == ':') + goto next_chunk; + return mac; } /* Print mac-address translation from /etc/ethers if available */ @@ -223,21 +309,20 @@ static inline char *ether_lookup(const struct ether_addr *ea) /* Format an Ethernet mac address */ static inline char *mac_addr(const struct sockaddr *sa) { - struct ether_addr zero = { {0} }; - if (sa->sa_family != ARPHRD_ETHER) - return ether_addr(&zero); - return ether_lookup((struct ether_addr *)sa->sa_data); + return "00:00:00:00:00:00"; + return ether_lookup((const struct ether_addr *)sa->sa_data); } /* Format a (I)BSSID */ static inline char *format_bssid(const struct sockaddr *ap) { - const struct ether_addr *bssid = (struct ether_addr *)ap->sa_data; + uint8_t bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + uint8_t zero_addr[ETH_ALEN] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - if (is_zero_ether_addr(bssid->ether_addr_octet)) + if (memcmp(ap->sa_data, zero_addr, ETH_ALEN) == 0) return "Not-Associated"; - if (is_broadcast_ether_addr(bssid->ether_addr_octet)) + if (memcmp(ap->sa_data, bcast_addr, ETH_ALEN) == 0) return "Invalid"; return mac_addr(ap); } @@ -259,6 +344,16 @@ static inline uint8_t prefix_len(const struct in_addr *netmask) return bit_count(netmask->s_addr); } +/* Absolute power measurement in dBm (IW_QUAL_DBM): map into -192 .. 63 range */ +static inline int u8_to_dbm(const int power) +{ + return power > 63 ? power - 0x100 : power; +} +static inline uint8_t dbm_to_u8(const int dbm) +{ + return dbm < 0 ? dbm + 0x100 : dbm; +} + /* Convert log dBm values to linear mW */ static inline double dbm2mw(const double in) { @@ -366,6 +461,18 @@ static inline float freq_to_hz(const struct iw_freq *freq) return freq->m * pow(10, freq->e); } +/* Return frequency or 0 on error. Based on iw_channel_to_freq() */ +static inline double channel_to_freq(uint8_t chan, const struct iw_range *range) +{ + int c; + + for (c = 0; c < range->num_frequency; c++) + /* Check if it actually has stored a frequency */ + if (range->freq[c].i == chan && range->freq[c].m > 1000) + return freq_to_hz(&range->freq[c]); + return 0.0; +} + /* Return channel number or -1 on error. Based on iw_freq_to_channel() */ static inline int freq_to_channel(double freq, const struct iw_range *range) { @@ -381,32 +488,62 @@ static inline int freq_to_channel(double freq, const struct iw_range *range) } /* print @key in cleartext if it is in ASCII format, use hex format otherwise */ -static inline char *format_key(char *key, uint8_t key_len) +static inline char *format_key(const struct iw_key *const iwk) { static char buf[128]; - int len = 0, i, is_printable; + int i, is_printable = 0, len = 0; - for (i = 0, is_printable = 1; i < key_len && is_printable; i++) - is_printable = isprint(key[i]); + /* Over-estimate key size: 2 chars per hex digit plus '-' */ + assert(iwk != NULL && iwk->size * 3 < sizeof(buf)); + + for (i = 0; i < iwk->size && (is_printable = isprint(iwk->key[i])); i++) + ; if (is_printable) len += sprintf(buf, "\""); - for (i = 0; i < key_len; i++) + for (i = 0; i < iwk->size; i++) if (is_printable) { - len += sprintf(buf + len, "%c", key[i]); + len += sprintf(buf + len, "%c", iwk->key[i]); } else { if (i > 0 && (i & 1) == 0) len += sprintf(buf + len, "-"); - len += sprintf(buf + len, "%2X", key[i]); + len += sprintf(buf + len, "%02X", iwk->key[i]); } if (is_printable) - sprintf(buf + len, "\""); + len += sprintf(buf + len, "\""); + + sprintf(buf + len, " (%u bits)", iwk->size * 8); + + return buf; +} +/* Human-readable representation of IW_ENC_CAPA_ types */ +static inline const char *format_enc_capab(const uint32_t capa, const char *sep) +{ + static char buf[32]; + size_t len = 0, max = sizeof(buf); + + if (capa & IW_ENC_CAPA_WPA) + len = snprintf(buf, max, "WPA"); + if (capa & IW_ENC_CAPA_WPA2) + len += snprintf(buf + len, max - len, "%sWPA2", len ? sep : ""); + if (capa & IW_ENC_CAPA_CIPHER_TKIP) + len += snprintf(buf + len, max - len, "%sTKIP", len ? sep : ""); + if (capa & IW_ENC_CAPA_CIPHER_CCMP) + len += snprintf(buf + len, max - len, "%sCCMP", len ? sep : ""); + buf[len] = '\0'; return buf; } +/* Display only the supported WPA type */ +#define IW_WPA_MASK (IW_ENC_CAPA_WPA|IW_ENC_CAPA_WPA2) +static inline const char *format_wpa(struct iw_range *ir) +{ + return format_enc_capab(ir->enc_capa & IW_WPA_MASK, "/"); +} + static inline char *format_retry(const struct iw_param *retry, const struct iw_range *range) { @@ -448,4 +585,3 @@ static inline char *format_retry(const struct iw_param *retry, return buf; } - diff --git a/iw_scan.c b/iw_scan.c new file mode 100644 index 0000000..e055acb --- /dev/null +++ b/iw_scan.c @@ -0,0 +1,671 @@ +/* + * Auxiliary declarations and functions imported from iwlib in order to + * process and parse scan events. This code is copied with little change + * from wireless tools 30. It remains here until the wext code will be + * replaced by corresponding netlink calls. + */ +#include "iw_if.h" + +#define MAX_SCAN_WAIT 10000 /* maximum milliseconds spent waiting */ + +/* + * Meta-data about all the additional standard Wireless Extension events + * we know about. + */ +/* Type of headers we know about (basically union iwreq_data) */ +#define IW_HEADER_TYPE_NULL 0 /* Not available */ +#define IW_HEADER_TYPE_CHAR 2 /* char [IFNAMSIZ] */ +#define IW_HEADER_TYPE_UINT 4 /* __u32 */ +#define IW_HEADER_TYPE_FREQ 5 /* struct iw_freq */ +#define IW_HEADER_TYPE_ADDR 6 /* struct sockaddr */ +#define IW_HEADER_TYPE_POINT 8 /* struct iw_point */ +#define IW_HEADER_TYPE_PARAM 9 /* struct iw_param */ +#define IW_HEADER_TYPE_QUAL 10 /* struct iw_quality */ + +/* Size (in bytes) of various events */ +static const int event_type_size[] = { + [IW_HEADER_TYPE_NULL] = IW_EV_LCP_PK_LEN, + [IW_HEADER_TYPE_CHAR] = IW_EV_CHAR_PK_LEN, + [IW_HEADER_TYPE_UINT] = IW_EV_UINT_PK_LEN, + [IW_HEADER_TYPE_FREQ] = IW_EV_FREQ_PK_LEN, + [IW_HEADER_TYPE_ADDR] = IW_EV_ADDR_PK_LEN, + /* + * Fix IW_EV_POINT_PK_LEN: some wireless.h versions define this + * erroneously as IW_EV_LCP_LEN + 4 (e.g. ESSID will disappear). + * The value below is from wireless tools 30. + */ + [IW_HEADER_TYPE_POINT] = IW_EV_LCP_PK_LEN + 4, + [IW_HEADER_TYPE_PARAM] = IW_EV_PARAM_PK_LEN, + [IW_HEADER_TYPE_QUAL] = IW_EV_QUAL_PK_LEN +}; + +/* Handling flags */ +#define IW_DESCR_FLAG_NONE 0x0000 /* Obvious */ +/* Wrapper level flags */ +#define IW_DESCR_FLAG_DUMP 0x0001 /* Not part of the dump command */ +#define IW_DESCR_FLAG_EVENT 0x0002 /* Generate an event on SET */ +#define IW_DESCR_FLAG_RESTRICT 0x0004 /* GET : request is ROOT only */ + /* SET : Omit payload from generated iwevent */ +#define IW_DESCR_FLAG_NOMAX 0x0008 /* GET : no limit on request size */ +/* Driver level flags */ +#define IW_DESCR_FLAG_WAIT 0x0100 /* Wait for driver event */ + +struct iw_ioctl_description { + __u8 header_type; /* NULL, iw_point or other */ + __u8 token_type; /* Future */ + __u16 token_size; /* Granularity of payload */ + __u16 min_tokens; /* Min acceptable token number */ + __u16 max_tokens; /* Max acceptable token number */ + __u32 flags; /* Special handling of the request */ +}; + +/* + * Meta-data about all the standard Wireless Extension request we + * know about. + */ +static const struct iw_ioctl_description standard_ioctl_descr[] = { + [SIOCSIWCOMMIT - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_NULL, + }, + [SIOCGIWNAME - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_CHAR, + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWNWID - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + .flags = IW_DESCR_FLAG_EVENT, + }, + [SIOCGIWNWID - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWFREQ - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_FREQ, + .flags = IW_DESCR_FLAG_EVENT, + }, + [SIOCGIWFREQ - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_FREQ, + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWMODE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_UINT, + .flags = IW_DESCR_FLAG_EVENT, + }, + [SIOCGIWMODE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_UINT, + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWSENS - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWSENS - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCSIWRANGE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_NULL, + }, + [SIOCGIWRANGE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = sizeof(struct iw_range), + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWPRIV - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_NULL, + }, + [SIOCGIWPRIV - SIOCIWFIRST] = { /* (handled directly by us) */ + .header_type = IW_HEADER_TYPE_NULL, + }, + [SIOCSIWSTATS - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_NULL, + }, + [SIOCGIWSTATS - SIOCIWFIRST] = { /* (handled directly by us) */ + .header_type = IW_HEADER_TYPE_NULL, + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWSPY - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = sizeof(struct sockaddr), + .max_tokens = IW_MAX_SPY, + }, + [SIOCGIWSPY - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = sizeof(struct sockaddr) + + sizeof(struct iw_quality), + .max_tokens = IW_MAX_SPY, + }, + [SIOCSIWTHRSPY - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = sizeof(struct iw_thrspy), + .min_tokens = 1, + .max_tokens = 1, + }, + [SIOCGIWTHRSPY - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = sizeof(struct iw_thrspy), + .min_tokens = 1, + .max_tokens = 1, + }, + [SIOCSIWAP - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_ADDR, + }, + [SIOCGIWAP - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_ADDR, + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWMLME - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .min_tokens = sizeof(struct iw_mlme), + .max_tokens = sizeof(struct iw_mlme), + }, + [SIOCGIWAPLIST - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = sizeof(struct sockaddr) + + sizeof(struct iw_quality), + .max_tokens = IW_MAX_AP, + .flags = IW_DESCR_FLAG_NOMAX, + }, + [SIOCSIWSCAN - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .min_tokens = 0, + .max_tokens = sizeof(struct iw_scan_req), + }, + [SIOCGIWSCAN - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_SCAN_MAX_DATA, + .flags = IW_DESCR_FLAG_NOMAX, + }, + [SIOCSIWESSID - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_ESSID_MAX_SIZE + 1, + .flags = IW_DESCR_FLAG_EVENT, + }, + [SIOCGIWESSID - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_ESSID_MAX_SIZE + 1, + .flags = IW_DESCR_FLAG_DUMP, + }, + [SIOCSIWNICKN - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_ESSID_MAX_SIZE + 1, + }, + [SIOCGIWNICKN - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_ESSID_MAX_SIZE + 1, + }, + [SIOCSIWRATE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWRATE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCSIWRTS - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWRTS - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCSIWFRAG - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWFRAG - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCSIWTXPOW - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWTXPOW - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCSIWRETRY - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWRETRY - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCSIWENCODE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_ENCODING_TOKEN_MAX, + .flags = IW_DESCR_FLAG_EVENT | IW_DESCR_FLAG_RESTRICT, + }, + [SIOCGIWENCODE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_ENCODING_TOKEN_MAX, + .flags = IW_DESCR_FLAG_DUMP | IW_DESCR_FLAG_RESTRICT, + }, + [SIOCSIWPOWER - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWPOWER - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, +#ifdef SIOCSIWMODUL + [SIOCSIWMODUL - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, +#endif +#ifdef SIOCGIWMODUL + [SIOCGIWMODUL - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, +#endif + [SIOCSIWGENIE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_GENERIC_IE_MAX, + }, + [SIOCGIWGENIE - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_GENERIC_IE_MAX, + }, + [SIOCSIWAUTH - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCGIWAUTH - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_PARAM, + }, + [SIOCSIWENCODEEXT - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .min_tokens = sizeof(struct iw_encode_ext), + .max_tokens = sizeof(struct iw_encode_ext) + + IW_ENCODING_TOKEN_MAX, + }, + [SIOCGIWENCODEEXT - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .min_tokens = sizeof(struct iw_encode_ext), + .max_tokens = sizeof(struct iw_encode_ext) + + IW_ENCODING_TOKEN_MAX, + }, + [SIOCSIWPMKSA - SIOCIWFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .min_tokens = sizeof(struct iw_pmksa), + .max_tokens = sizeof(struct iw_pmksa), + }, +}; + +static const struct iw_ioctl_description standard_event_descr[] = { + [IWEVTXDROP - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_ADDR, + }, + [IWEVQUAL - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_QUAL, + }, + [IWEVCUSTOM - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_CUSTOM_MAX, + }, + [IWEVREGISTERED - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_ADDR, + }, + [IWEVEXPIRED - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_ADDR, + }, + [IWEVGENIE - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_GENERIC_IE_MAX, + }, + [IWEVMICHAELMICFAILURE - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = sizeof(struct iw_michaelmicfailure), + }, + [IWEVASSOCREQIE - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_GENERIC_IE_MAX, + }, + [IWEVASSOCRESPIE - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = IW_GENERIC_IE_MAX, + }, + [IWEVPMKIDCAND - IWEVFIRST] = { + .header_type = IW_HEADER_TYPE_POINT, + .token_size = 1, + .max_tokens = sizeof(struct iw_pmkid_cand), + }, +}; + +struct stream_descr { + char *current; /* Current event in stream of events */ + char *value; /* Current value in event */ + char *end; /* End of the stream */ +}; + +/* + * Extract the next event from the event stream. + */ +static int iw_extract_event_stream(struct stream_descr *stream, + struct iw_event *iwe, int we_version) +{ + const struct iw_ioctl_description *descr = NULL; + int event_type; + unsigned int event_len = 1; /* Invalid */ + unsigned cmd_index; /* *MUST* be unsigned */ + char *pointer; + + if (stream->current + IW_EV_LCP_PK_LEN > stream->end) + return 0; + + /* Extract the event header to get the event id. + * Note : the event may be unaligned, therefore copy... */ + memcpy((char *)iwe, stream->current, IW_EV_LCP_PK_LEN); + + if (iwe->len <= IW_EV_LCP_PK_LEN) + return -1; + + /* Get the type and length of that event */ + if (iwe->cmd <= SIOCIWLAST) { + cmd_index = iwe->cmd - SIOCIWFIRST; + if (cmd_index < ARRAY_SIZE(standard_ioctl_descr)) + descr = standard_ioctl_descr + cmd_index; + } else { + cmd_index = iwe->cmd - IWEVFIRST; + if (cmd_index < ARRAY_SIZE(standard_event_descr)) + descr = standard_event_descr + cmd_index; + } + + /* Unknown events -> event_type = 0 => IW_EV_LCP_PK_LEN */ + event_type = descr ? descr->header_type : 0; + event_len = event_type_size[event_type]; + + /* Check if we know about this event */ + if (event_len <= IW_EV_LCP_PK_LEN) { + stream->current += iwe->len; /* Skip to next event */ + return 2; + } + event_len -= IW_EV_LCP_PK_LEN; + + /* Fixup for earlier version of WE */ + if (we_version <= 18 && event_type == IW_HEADER_TYPE_POINT) + event_len += IW_EV_POINT_OFF; + + if (stream->value != NULL) + pointer = stream->value; /* Next value in event */ + else + pointer = stream->current + IW_EV_LCP_PK_LEN; /* First value in event */ + + /* Copy the rest of the event (at least, fixed part) */ + if (pointer + event_len > stream->end) { + stream->current += iwe->len; /* Skip to next event */ + return -2; + } + + /* Fixup for WE-19 and later: pointer no longer in the stream */ + /* Beware of alignment. Dest has local alignment, not packed */ + if (we_version > 18 && event_type == IW_HEADER_TYPE_POINT) + memcpy((char *)iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, pointer, event_len); + else + memcpy((char *)iwe + IW_EV_LCP_LEN, pointer, event_len); + + /* Skip event in the stream */ + pointer += event_len; + + /* Special processing for iw_point events */ + if (event_type == IW_HEADER_TYPE_POINT) { + unsigned int extra_len = iwe->len - (event_len + IW_EV_LCP_PK_LEN); + + if (extra_len > 0) { + /* Set pointer on variable part (warning : non aligned) */ + iwe->u.data.pointer = pointer; + + /* Check that we have a descriptor for the command */ + if (descr == NULL) { + /* Can't check payload -> unsafe... */ + iwe->u.data.pointer = NULL; /* Discard paylod */ + } else { + unsigned int token_len = iwe->u.data.length * descr->token_size; + /* + * Ugly fixup for alignment issues. + * If the kernel is 64 bits and userspace 32 bits, we have an extra 4 + 4 + * bytes. Fixing that in the kernel would break 64 bits userspace. + */ + if (token_len != extra_len && extra_len >= 4) { + union iw_align_u16 { + __u16 value; + unsigned char byte[2]; + } alt_dlen; + unsigned int alt_token_len; + + /* Userspace seems to not always like unaligned access, + * so be careful and make sure to align value. + * I hope gcc won't play any of its aliasing tricks... */ + alt_dlen.byte[0] = *(pointer); + alt_dlen.byte[1] = *(pointer + 1); + alt_token_len = alt_dlen.value * descr->token_size; + + /* Verify that data is consistent if assuming 64 bit alignment... */ + if (alt_token_len + 8 == extra_len) { + + /* Ok, let's redo everything */ + pointer -= event_len; + pointer += 4; + + /* Dest has local alignment, not packed */ + memcpy((char *)iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF, pointer, event_len); + pointer += event_len + 4; + token_len = alt_token_len; + + /* We may have no payload */ + if (alt_token_len) + iwe->u.data.pointer = pointer; + else + iwe->u.data.pointer = NULL; + } + } + + /* Discard bogus events which advertise more tokens than they carry ... */ + if (token_len > extra_len) + iwe->u.data.pointer = NULL; /* Discard paylod */ + + /* Check that the advertised token size is not going to + * produce buffer overflow to our caller... */ + if (iwe->u.data.length > descr->max_tokens + && !(descr->flags & IW_DESCR_FLAG_NOMAX)) + iwe->u.data.pointer = NULL; /* Discard payload */ + + /* Same for underflows... */ + if (iwe->u.data.length < descr->min_tokens) + iwe->u.data.pointer = NULL; /* Discard paylod */ + } + } else { + /* No data */ + iwe->u.data.pointer = NULL; + } + + stream->current += iwe->len; /* Go to next event */ + } else { + /* + * Ugly fixup for alignment issues. + * If the kernel is 64 bits and userspace 32 bits, we have an extra 4 bytes. + * Fixing that in the kernel would break 64 bits userspace. + */ + if (stream->value == NULL && + ((iwe->len - IW_EV_LCP_PK_LEN) % event_len == 4 || + (iwe->len == 12 && (event_type == IW_HEADER_TYPE_UINT || + event_type == IW_HEADER_TYPE_QUAL)))) { + + pointer -= event_len; + pointer += 4; + + /* Beware of alignment. Dest has local alignment, not packed */ + memcpy((char *)iwe + IW_EV_LCP_LEN, pointer, event_len); + pointer += event_len; + } + + if (pointer + event_len <= stream->current + iwe->len) { + stream->value = pointer; /* Go to next value */ + } else { + stream->value = NULL; + stream->current += iwe->len; /* Go to next event */ + } + } + return 1; +} + +static void iw_extract_ie(struct iw_event *iwe, struct scan_result *sr) +{ + const uint8_t wpa1_oui[3] = { 0x00, 0x50, 0xf2 }; + uint8_t *buffer = iwe->u.data.pointer; + int ielen = 0, ietype, i; + + /* Loop on each IE, each is min. 2 bytes TLV: IE-ID - Length - Value */ + for (i = 0; i <= iwe->u.data.length - 2; i += ielen + 2) { + ietype = buffer[i]; + ielen = buffer[i + 1]; + + switch (ietype) { + case 0x30: + if (ielen < 4) /* make sure we have enough data */ + continue; + sr->flags |= IW_ENC_CAPA_WPA2; + break; + case 0xdd: + /* Not all IEs that start with 0xdd are WPA1 */ + if (ielen < 8 || memcmp(buffer + i + 2, wpa1_oui, 3) || + buffer[i + 5] != 1) + continue; + sr->flags |= IW_ENC_CAPA_WPA; + break; + } + } +} +/*----------------- End of code copied from iwlib -----------------------*/ + +/* Order by descending signal strength. */ +extern int cmp_sig(const struct scan_result *a, const struct scan_result *b) +{ + return a->qual.level - b->qual.level; +} + +/* Order by ascending frequency first, then by descending signal strength. */ +extern int cmp_freq_sig(const struct scan_result *a, const struct scan_result *b) +{ + return a->freq == b->freq ? cmp_sig(a, b) : a->freq < b->freq; +} + +struct scan_result *get_scan_list(int skfd, const char *ifname, int we_version, + scan_cmp_func cmp_scan_result) +{ + struct scan_result *head = NULL; + struct iwreq wrq; + int wait, waited = 0; + + /* + * Some drivers may return very large scan results, either because there + * are many cells, or there are many large elements. Do not bother to + * guess buffer size, use maximum u16 wrq.u.data.length size. + */ + char scan_buf[0xffff]; + + /* We are checking errno when returning NULL, so reset it here */ + errno = 0; + + memset(&wrq, 0, sizeof(wrq)); + strncpy(wrq.ifr_ifrn.ifrn_name, ifname, IFNAMSIZ); + if (ioctl(skfd, SIOCSIWSCAN, &wrq) < 0) + return NULL; + + /* Larger initial timeout of 250ms between set and first get */ + for (wait = 250; (waited += wait) < MAX_SCAN_WAIT; wait = 100) { + struct timeval tv = { 0, wait * 1000 }; + + while (select(0, NULL, NULL, NULL, &tv) < 0) + if (errno != EINTR && errno != EAGAIN) + return NULL; + + wrq.u.data.pointer = scan_buf; + wrq.u.data.length = sizeof(scan_buf); + wrq.u.data.flags = 0; + + if (ioctl(skfd, SIOCGIWSCAN, &wrq) == 0) + break; + } + + if (wrq.u.data.length) { + struct iw_event iwe; + struct stream_descr stream; + struct scan_result *new = NULL; + int f = 0; /* Idea taken from waproamd */ + + memset(&stream, 0, sizeof(stream)); + stream.current = scan_buf; + stream.end = scan_buf + wrq.u.data.length; + + while (iw_extract_event_stream(&stream, &iwe, we_version) > 0) { + if (!new) + new = calloc(1, sizeof(*new)); + + switch (iwe.cmd) { + case SIOCGIWAP: + f = 1; + memcpy(&new->ap_addr, &iwe.u.ap_addr.sa_data, sizeof(new->ap_addr)); + break; + case SIOCGIWESSID: + f |= 2; + memset(new->essid, 0, sizeof(new->essid)); + + if (iwe.u.essid.flags && iwe.u.essid.pointer && iwe.u.essid.length) + memcpy(new->essid, iwe.u.essid.pointer, iwe.u.essid.length); + break; + case SIOCGIWMODE: + new->mode = iwe.u.mode; + f |= 4; + break; + case SIOCGIWFREQ: + f |= 8; + new->freq = freq_to_hz(&iwe.u.freq); + break; + case SIOCGIWENCODE: + f |= 16; + new->has_key = !(iwe.u.data.flags & IW_ENCODE_DISABLED); + break; + case IWEVQUAL: + f |= 32; + memcpy(&new->qual, &iwe.u.qual, sizeof(struct iw_quality)); + break; + case IWEVGENIE: + f |= 64; + iw_extract_ie(&iwe, new); + break; + } + if (f == 127) { + struct scan_result *cur = head, **prev = &head; + + f = 0; + + while (cur && cmp_scan_result(cur, new) > 0) + prev = &cur->next, cur = cur->next; + + *prev = new; + new->next = cur; + new = NULL; + } + } + free(new); /* may have been allocated but not filled in */ + } + return head; +} + +void free_scan_result(struct scan_result *head) +{ + if (head) { + free_scan_result(head->next); + free(head); + } +} diff --git a/lhist_scr.c b/lhist_scr.c index c09e48e..e93359f 100644 --- a/lhist_scr.c +++ b/lhist_scr.c @@ -19,8 +19,6 @@ */ #include "iw_if.h" -/* CONSTANTS */ - /* Number of lines in the key window at the bottom */ #define KEY_WIN_HEIGHT 3 @@ -34,6 +32,9 @@ */ #define HIST_MAXYLEN (HIST_WIN_HEIGHT - 1) +/* Position (relative to right border) and maximum length of dBm level tags. */ +#define LEVEL_TAG_POS 5 + /* GLOBALS */ static WINDOW *w_lhist, *w_key; @@ -160,6 +161,11 @@ static double hist_level(double val, int min, int max) return map_range(val, min, max, 1, HIST_MAXYLEN); } +static double hist_level_inverse(int y_level, int min, int max) +{ + return map_range(y_level, 1, HIST_MAXYLEN, min, max); +} + /* Order needs to be reversed as y-coordinates grow downwards */ static int hist_y(int yval) { @@ -239,6 +245,24 @@ static void display_lhist(void) noise_level = hist_level(iwl.noise, conf.noise_min, conf.noise_max); plot_colour = noise_level > snr_level ? CP_STATNOISE : CP_STATNOISE_S; hist_plot(noise_level, x, plot_colour); + + } else if (x == LEVEL_TAG_POS && ! (iwl.flags & IW_QUAL_LEVEL_INVALID)) { + char tmp[LEVEL_TAG_POS + 1]; + int len; + /* + * Tag the horizontal grid lines with dBm levels. + * This is only supported for signal levels, when the screen is not + * shared by several graphs (each having a different scale). + */ + wattrset(w_lhist, COLOR_PAIR(CP_STATSIG)); + for (y = 1; y <= HIST_MAXYLEN; y++) { + if (y != 1 && (y % 5) && y != HIST_MAXYLEN) + continue; + len = snprintf(tmp, sizeof(tmp), "%.0f", + hist_level_inverse(y, conf.sig_min, + conf.sig_max)); + mvwaddstr(w_lhist, hist_y(y), hist_x(len), tmp); + } } if (! (iwl.flags & IW_QUAL_LEVEL_INVALID)) { @@ -280,10 +304,11 @@ static void display_key(WINDOW *w_key) wrefresh(w_key); } -static void redraw_lhist(void) +static void redraw_lhist(int signum) { static int vcount = 1; + sampling_do_poll(); if (!--vcount) { vcount = conf.slotsize; display_lhist(); @@ -291,34 +316,27 @@ static void redraw_lhist(void) } } -enum wavemon_screen scr_lhist(WINDOW *w_menu) +void scr_lhist_init(void) { - int key = 0; - w_lhist = newwin_title(0, HIST_WIN_HEIGHT, "Level histogram", true); w_key = newwin_title(HIST_MAXYLEN + 1, KEY_WIN_HEIGHT, "Key", false); init_extrema(&e_signal); init_extrema(&e_noise); init_extrema(&e_snr); + sampling_init(redraw_lhist); display_key(w_key); +} - iw_stat_redraw = redraw_lhist; - while (key < KEY_F(1) || key > KEY_F(10)) { - while ((key = wgetch(w_menu)) <= 0) - usleep(5000); - - /* Keyboard shortcuts */ - if (key == 'q') - key = KEY_F(10); - else if (key == 'i') - key = KEY_F(1); - } - iw_stat_redraw = NULL; +int scr_lhist_loop(WINDOW *w_menu) +{ + return wgetch(w_menu); +} +void scr_lhist_fini(void) +{ + sampling_stop(); delwin(w_lhist); delwin(w_key); - - return key - KEY_F(1); } diff --git a/scan_scr.c b/scan_scr.c new file mode 100644 index 0000000..ab6b433 --- /dev/null +++ b/scan_scr.c @@ -0,0 +1,203 @@ +/* + * wavemon - a wireless network monitoring aplication + * + * Copyright (c) 2001-2002 Jan Morgenstern + * + * wavemon 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, or (at your option) any later + * version. + * + * wavemon 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 wavemon; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +#include "iw_if.h" + +#define START_LINE 2 /* where to begin the screen */ + +/* GLOBALS */ +static WINDOW *w_aplst; +static pid_t pid; +static void (*sig_tstp)(int); + +static char *fmt_scan_result(struct scan_result *cur, struct iw_range *iw_range, + char buf[], size_t buflen) +{ + struct iw_levelstat dbm; + size_t len = 0; + int channel = freq_to_channel(cur->freq, iw_range); + + iw_sanitize(iw_range, &cur->qual, &dbm); + + if (!(cur->qual.updated & (IW_QUAL_QUAL_INVALID|IW_QUAL_LEVEL_INVALID))) + len += snprintf(buf + len, buflen - len, "%3.0f%%, %.0f dBm", + 1E2 * cur->qual.qual / iw_range->max_qual.qual, + dbm.signal); + else if (!(cur->qual.updated & IW_QUAL_QUAL_INVALID)) + len += snprintf(buf + len, buflen - len, "%2d/%d", + cur->qual.qual, iw_range->max_qual.qual); + else if (!(cur->qual.updated & IW_QUAL_LEVEL_INVALID)) + len += snprintf(buf + len, buflen - len, "%.0f dBm", + dbm.signal); + else + len += snprintf(buf + len, buflen - len, "? dBm"); + + + if (cur->freq < 1e3) + len += snprintf(buf + len, buflen - len, ", Chan %2.0f", + cur->freq); + else if (channel >= 0) + len += snprintf(buf + len, buflen - len, ", Ch %2d, %g MHz", + channel, cur->freq / 1e6); + else + len += snprintf(buf + len, buflen - len, ", %g GHz", + cur->freq / 1e9); + + /* Access Points are marked by CP_SCAN_CRYPT/CP_SCAN_UNENC already */ + if (cur->mode != IW_MODE_MASTER) + len += snprintf(buf + len, buflen - len, " %s", + iw_opmode(cur->mode)); + if (cur->flags) + len += snprintf(buf + len, buflen - len, ", %s", + format_enc_capab(cur->flags, "/")); + return buf; +} + +static void display_aplist(WINDOW *w_aplst) +{ + char s[IW_ESSID_MAX_SIZE << 3]; + int max_essid_len = 0; + int i, line = START_LINE; + struct iw_range range; + struct scan_result *head, *cur; + int skfd = socket(AF_INET, SOCK_DGRAM, 0); + + if (skfd < 0) + err_sys("%s: can not open socket", __func__); + + iw_getinf_range(conf_ifname(), &range); + + head = get_scan_list(skfd, conf_ifname(), + range.we_version_compiled, cmp_freq_sig); + if (head) { + ; + } else if (errno == EPERM || !has_net_admin_capability()) { + /* + * Don't try to read leftover results, it does not work reliably + */ + sprintf(s, "This screen requires CAP_NET_ADMIN permissions"); + } else if (errno == EINTR || errno == EAGAIN || errno == EBUSY) { + /* Ignore temporary errors */ + goto done; + } else if (!if_is_up(skfd, conf_ifname())) { + sprintf(s, "Interface '%s' is down ", conf_ifname()); + if (!has_net_admin_capability()) + strcat(s, "- can not scan"); + else if (if_set_up(skfd, conf_ifname()) < 0) + sprintf(s, "Can not bring up '%s' for scanning: %s", + conf_ifname(), strerror(errno)); + else + strcat(s, "- setting it up ..."); + } else if (errno == EFAULT) { + /* + * EFAULT can occur after a window resizing event and is temporary. + * It may also occur when the interface is down, hence we need to + * test the interface status first. + */ + goto done; + } else if (errno) { + sprintf(s, "No scan on %s: %s", conf_ifname(), strerror(errno)); + } else { + sprintf(s, "No scan results on %s", conf_ifname()); + } + + for (i = 1; i <= MAXYLEN; i++) + mvwclrtoborder(w_aplst, i, 1); + + if (!head) + waddstr_center(w_aplst, WAV_HEIGHT/2 - 1, s); + + for (cur = head; cur; cur = cur->next) { + if (str_is_ascii(cur->essid)) + max_essid_len = clamp(strlen(cur->essid), + max_essid_len, IW_ESSID_MAX_SIZE); + } + + /* Truncate overly long access point lists to match screen height */ + for (cur = head; cur && line < MAXYLEN; line++, cur = cur->next) { + int col = CP_SCAN_NON_AP; + + if (cur->mode == IW_MODE_MASTER) + col = cur->has_key ? CP_SCAN_CRYPT : CP_SCAN_UNENC; + + wmove(w_aplst, line, 1); + if (!*cur->essid) { + sprintf(s, "%-*s ", max_essid_len, ""); + wattron(w_aplst, COLOR_PAIR(col)); + waddstr(w_aplst, s); + } else if (str_is_ascii(cur->essid)) { + sprintf(s, "%-*s ", max_essid_len, cur->essid); + waddstr_b(w_aplst, s); + wattron(w_aplst, COLOR_PAIR(col)); + } else { + sprintf(s, "%-*s ", max_essid_len, ""); + wattron(w_aplst, COLOR_PAIR(col)); + waddstr(w_aplst, s); + } + waddstr(w_aplst, ether_addr(&cur->ap_addr)); + + wattroff(w_aplst, COLOR_PAIR(col)); + + fmt_scan_result(cur, &range, s, sizeof(s)); + waddstr(w_aplst, " "); + waddstr(w_aplst, s); + } + free_scan_result(head); +done: + close(skfd); + wrefresh(w_aplst); +} + +void scr_aplst_init(void) +{ + w_aplst = newwin_title(0, WAV_HEIGHT, "Scan window", false); + /* + * Both parent and child process write to the terminal, updating + * different areas of the screen. Suspending wavemon brings the + * terminal state out of order, messing up the screen. The choice + * is between a more complicated (sophisticated) handling of + * signals, and to keep it simple by not allowing to suspend. + */ + sig_tstp = xsignal(SIGTSTP, SIG_IGN); + + /* Gathering scan data can take seconds. Inform user. */ + mvwaddstr(w_aplst, START_LINE, 1, "Waiting for scan data ..."); + wrefresh(w_aplst); + + pid = fork(); + if (pid < 0) { + err_sys("could not fork scan process"); + } else if (pid == 0) { + do display_aplist(w_aplst); + while (usleep(conf.stat_iv * 1000) == 0); + exit(EXIT_SUCCESS); + } +} + +int scr_aplst_loop(WINDOW *w_menu) +{ + return wgetch(w_menu); +} + +void scr_aplst_fini(void) +{ + kill(pid, SIGTERM); + delwin(w_aplst); + xsignal(SIGTSTP, sig_tstp); +} diff --git a/ui.c b/ui.c index 979cb00..194f20d 100644 --- a/ui.c +++ b/ui.c @@ -84,12 +84,16 @@ const char *curtail(const char *str, const char *sep, int len) const char fallback_sep[] = "~"; int l = 0, front, mid, back; - assert(len < sizeof(out_buf)); + if (len >= sizeof(out_buf)) + len = sizeof(out_buf) - 1; - if (sep == NULL) + if (sep == NULL || *sep == '\0') sep = fallback_sep; mid = strlen(sep); - assert(len >= mid); + if (mid > len) { + sep = fallback_sep; + mid = strlen(sep); + } if (str != NULL) l = strlen(str); diff --git a/wavemon.1 b/wavemon.1 index 5987f84..57c41d3 100644 --- a/wavemon.1 +++ b/wavemon.1 @@ -1,98 +1,144 @@ -.TH WAVEMON 1 "JANUARY 2009" Linux "User Manuals" +.TH wavemon 1 "February 2011" Linux "User Manuals" .SH NAME -wavemon \- a wireless network monitor application +wavemon \- a wireless network monitor .SH SYNOPSIS .B wavemon [-h] [-i .I ifname .B ] [-l] [-r] [-v] .SH DESCRIPTION -.B wavemon -is a ncurses-based monitoring application for wireless network devices. It displays continuously updated information about signal levels as well as wireless-specific and general network information. Currently, wavemon can be used for monitoring devices supported by the wireless extensions by Jean Tourrilhes , included in kernels version 2.4 and higher. +\fIwavemon\fR is a ncurses-based monitoring application for wireless network +devices. It plots levels in real-time as well as showing wireless and network +related device information. Currently, wavemon is still based on the wireless +extensions by Jean Tourrilhes . -The wavemon interface is separated into several different sections, hereby referred to as "screens". Every screen displays information about distinct parameter types and/or in a special manner. For example, the "info" screen shows the current signal and noise levels as bargraphs, while the level histogram shows the exact same values as a level plot, so their development over time can be seen. -On startup, you'll see one of the different monitor screens (which of the screens will actually be displayed depends on your configuration). On the bottom, you'll see a bar showing the available screens along with function key strokes. -.LP -These screens are currently implemented: +The \fIwavemon\fR interface splits into different "screens". +Each screen presents information in a specific manner. For example, the +"info" screen shows current levels as bargraphs, whereas the "level" screen +represents the same levels as a moving histogram. + +On startup, you'll see (depending on configuration) one of the different +monitor screens. At the bottom, you'll find a \fImenu-bar\fR listing the +screens and their function key names. The following screens can be selected: .TP .B Info (F1) -This is the most "conclusive" of the monitor screens. It displays a condensed overview of all available wireless-specific parameters and network statistics, as well as bar graphs of the current signal and noise levels. There are several sub-sections to further separate the information. +This is the most comprehensive screen. It displays a condensed overview of +wireless-specific parameters and network statistics, as well as bar graphs. +The layout is arranged into several sub-sections. -At the +The .B Interface -section, the name, ESSID and nickname of the current wireless interface are shown. +section at the top shows information about the monitoring interface, +including interface name, type, ESSID, and available encryption formats. -Below, at the +Below, in the .B Levels -section, you can see four bargraphs showing the quality of the link to the next station (if established), the level of the received signal, the current receiver's noise level and the signal-to-noise ration, which gives a good approximation of the overall signal quality. The colour of the signal level bargraph changes from red to yellow and green at fixed levels, while the colour of the noise level graph is adapted to the current signal level (it turns red when the signal-to-noise-ratio gets below 0dB). If the thresholds are associated with any actions, two arrows on the signal level graph will show the positions of the current thresholds. More on this topic later. +section, you can see up to four bargraphs showing (1) relative signal quality +and (2) signal level in dBm. If the wireless driver also supports noise level +information, additionally (3) noise level in dBm and (4) Signal-Noise-Ratio +(SNR) in dB are shown. The colour of the signal level bargraph changes +from red to yellow and green at fixed levels. If thresholds have been set, +two arrows on the signal level graph will show the positions of the current +thresholds. The .B Statistics -section displays packet and byte counters. The first four values, preceded RX and TX, show the current total number of packets received and transceived since the initialization of the interface. The following three values display the number of packets that were discarded from the interface because of invalid network ids, wrong encryption keys and other errors. +section displays packet and byte counters and a few other packet-related +statistics. -Below, at the +The subsequent .B Info -subsection, various wireless-specific parameters of the interface are displayed. What parameters are actually shown may vary and depends on the capabilities and the operation mode of your network device. The top line shows the current frequency the interface operates on, the sensitivity threshold of the receiver and the transmission power. Below, the operation mode of the interface (managed, ad-hoc...) and, if appropriate, the MAC address of the current access point are displayed. The third line shows the current data transfer speed in Mbit/s and the retransmission and fragmentation thresholds. Whether or not the details about encryption show up in the next line depends on the permissions of the user. Finally, the last line displays the power management parameters, if this feature is available and active. +subsection lists the current operational mode and configuration of the +wireless interface. What parameters are actually shown depends on the +capabilities and selected mode of your network device. -The last section, titled -.B Network, -shows - you guessed it - network parameters, such as the interface name and hardware address as well as the interface, netmask and broadcast IP addresses. These parameters are not wireless-related. +Lastly, the +.B Network +section shows network-level parameters. The MAC-address is resolved from +\fBethers\fR(5). The IPv4 address is shown in CIDR notation (RFC\ 4632 +\fIaddress\fR\fB/\fR\fIprefix_len\fR format). Since often those two values +also determine the broadcast address (last 32 \- \fIprefix_len\fR bits set +to 1), that address is shown only if it does not derive from the interface +address and prefix length. Likewise, the interface MTU is shown only if it +differs from the default Ethernet MTU of 1500 bytes. -Another keyboard shortcut for this screen is 'i'. +Another keyboard shortcut for this screen is '\fIi\fR'. .TP .B Level histogram (F2) -This is a full-screen histogram plot of the signal/noise levels and the signal-to-noise levels. It shows the level changes with time. Below the plot, the key is shown. If available, the terminfo scanline chars are used in order to enhance the precision of the level plots, i.e. this screen will particularly look nifty in a xterm. +This is a full-screen histogram plot showing the evolution of levels with time. +The screen is partitioned into a grid, with dBm levels shown in green at +the right hand side (depending on configuration). At the very minimum, +the evolution of the signal-level is shown. If the wireless driver also +supports noise-level information, additionally a noise graph and associated +SNR graph appear. .TP -.B Access point list (F3) -This screen provides a list of MAC addresses specifying the access points within range. This feature is currently _very_ rudimentary and may not even work for you. Stay tuned, as a more useable access point list is on its way. +.B Scan window (F3) +A periodically updated network scan, showing access points and other +wireless clients, ordered by frequency and then descending order of signal +quality. Each entry starts with the ESSID, followed by the colour-coded MAC +address and the signal/channel information. A green/red MAC address indicates +an (un-)encrypted access point, the colour changes to yellow for non-access +points (in this case the mode is shown at the end of the line). The +uncoloured information following the MAC address lists relative and +absolute signal strengths, channel, frequency, and the mode if the node +is not an access point. + +Please note that gathering meaningful scan data can take several seconds. Partly +for this reason, the Scan window is the only screen that can not be suspended +(CTRL-Z). .TP .B Preferences (F7) -This screen allows you to change all program options such as interface and level scale parameters, and to save the new settings to the configuration file. Select a parameter with and , then change the value with and . Please refer to the -.B wavemonrc -man page for an in-depth description of all available settings. +This screen allows you to change all program options such as interface and +level scale parameters, and to save the new settings to the configuration +file. Select a parameter with and , then change the value with + and . Please refer to \fBwavemonrc\fR(5) for an in-depth +description of applicable settings. .TP .B Help (F8) -This page will show an online-help in the near future; it is currently not implemented. +This page might show an online-help. .TP .B About (F9) -This screen contains information about the current -.B wavemon -release. +Release information and contact URLs. .TP -.B Quit (F10) -The associated function key will immediately exit -.B wavemon. -An alternative keyboard shortcut for quitting is 'q'. -.SH OPTIONS -.IP -h -print a short explanation of the command line arguments and exit. -.IP "-i interface" -override autodetection and use the specified interface. -.IP -r +\fBQuit (F10) +Exit \fIwavemon\fR. An alternative shortcut for quitting is '\fIq\fR'. +.LP +\fBNote:\fR some operations, such as displaying encryption information or performing scans, require +\fBCAP_NET_ADMIN\fR privileges (see \fBcapabilities\fR(7)). For non-root users, these can be +enabled by installing \fIwavemon\fR setuid-root. +.SH "OPTIONS" +.IP "\fB\-i \fIinterface\fR\fR" +override autodetection and use the specified \fIinterface\fR. +.IP "\fB\-d\fR" +dump interface parameters to stdout and exit. +.IP "\fB\-g\fR" +check screen \fIgeometry\fR: a minimum size is required for proper display; this flag +adds a check to ensure it is sufficiently large. Enable this if window does not display +properly. +.IP "\fB\-r\fR" generate random levels (for testing purposes). -.IP -v -dump the version number to stdout and exit. +.IP "\fB\-h\fR" +print help and exit. +.IP "\fB\-v\fR" +print version information and exit. -.SH ENVIRONMENT VARIABLES +.SH "ENVIRONMENT VARIABLES" .IP "LC_NUMERIC" -Influences the grouping of numbers if set. See also -.BR locale (1). - +Influences the grouping of numbers if set. See also \fBlocale\fR(1). .SH FILES -.I ~/.wavemonrc -is the local configuration file for the user. Refer to the -.B wavemonrc -man page for an in-depth explanation of available settings. -.SH BUGS -While each release has been tested, bugs are sometimes inevitable. -Please help to further improve the state of wavemon by sending all bug reports, -and any suggestions or comments, to . Thanks! -.SH AUTHOR -The original author of wavemon is Jan Morgenstern -.LP -The current maintainer is Gerrit Renker -.SH COPYRIGHT -wavemon 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, or (at your option) any later version. -.LP -wavemon 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. -.LP -You should have received a copy of the GNU General Public License along with wavemon; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +.I $HOME/.wavemonrc +\ the local per-user configuration file. +.br +.I /proc/net/wireless +\ wireless extensions /proc interface +.SH "AUTHOR" +Written by Jan Morgenstern . +.SH "REPORTING BUGS" +Send bug reports and/or suggestions to Gerrit Renker . +.SH "COPYRIGHT" +This is free software with ABSOLUTELY NO WARRANTY. See file COPYING for details. +.SH "SEE ALSO" +.BR wavemonrc (5), +.BR wireless (7), +.BR ethers (5), +.BR locale (1), +.BR capabilities (7) diff --git a/wavemon.c b/wavemon.c index 6c9b689..6c3196e 100644 --- a/wavemon.c +++ b/wavemon.c @@ -19,29 +19,96 @@ */ #include "wavemon.h" #include +#include /* GLOBALS */ + +/** + * screen switching table + * @key_name: name under which the screen appears in the menu bar + * @init: screen initialisation function pointer + * @loop: screen update function pointer (connected to menu) + * @fini: screen cleanup function pointer + */ static const struct { - char key_name[6]; - enum wavemon_screen (*screen_func)(WINDOW *); + const char *const key_name; + void (*init)(void); + int (*loop)(WINDOW *); + void (*fini)(void); } screens[] = { - [SCR_INFO] = { "info", scr_info }, - [SCR_LHIST] = { "lhist", scr_lhist }, - [SCR_APLIST] = { "aplst", scr_aplst }, - [SCR_EMPTY_F4] = { "", NULL }, - [SCR_EMPTY_F5] = { "", NULL }, - [SCR_EMPTY_F6] = { "", NULL }, - [SCR_CONF] = { "prefs", scr_conf }, - [SCR_HELP] = { "help", scr_help }, - [SCR_ABOUT] = { "about", scr_about }, - [SCR_QUIT] = { "quit", NULL } + [SCR_INFO] = { + .key_name = "info", + .init = scr_info_init, + .loop = scr_info_loop, + .fini = scr_info_fini + }, + [SCR_LHIST] = { + .key_name = "lhist", + .init = scr_lhist_init, + .loop = scr_lhist_loop, + .fini = scr_lhist_fini + }, + [SCR_APLIST] = { + .key_name = "scan", + .init = scr_aplst_init, + .loop = scr_aplst_loop, + .fini = scr_aplst_fini + }, + [SCR_EMPTY_F4] = { + .key_name = "", + }, + [SCR_EMPTY_F5] = { + .key_name = "", + }, + [SCR_EMPTY_F6] = { + .key_name = "", + }, + [SCR_CONF] = { + .key_name = "prefs", + .init = scr_conf_init, + .loop = scr_conf_loop, + .fini = scr_conf_fini + }, + [SCR_HELP] = { + .key_name = "help", + .init = scr_help_init, + .loop = scr_help_loop, + .fini = scr_help_fini + }, + [SCR_ABOUT] = { + .key_name = "about", + .init = scr_about_init, + .loop = scr_about_loop, + .fini = scr_about_fini + }, + [SCR_QUIT] = { + .key_name = "quit", + } }; -static void update_menubar(WINDOW *menu, const enum wavemon_screen active) +/* + * SIGWINCH handling with buffer synchronisation variable + */ +static sigjmp_buf env_winch; +static volatile sig_atomic_t env_winch_ready; + +static void sig_winch(int signo) { + if (env_winch_ready) { + env_winch_ready = false; + siglongjmp(env_winch, 1); + } +} + +static WINDOW *init_menubar(const enum wavemon_screen active) +{ + WINDOW *menu = newwin(1, WAV_WIDTH, WAV_HEIGHT, 0); enum wavemon_screen cur; - for (cur = SCR_INFO, wmove(menu, 0, 0); cur <= SCR_QUIT; cur++) { + nodelay(menu, TRUE); + keypad(menu, TRUE); + wmove(menu, 0, 0); + for (cur = SCR_INFO; cur <= SCR_QUIT; cur++) { wattrset(menu, A_REVERSE | A_BOLD); wprintw(menu, "F%d", cur + 1); @@ -50,32 +117,35 @@ static void update_menubar(WINDOW *menu, const enum wavemon_screen active) wprintw(menu, "%-6s", screens[cur].key_name); } wrefresh(menu); + + return menu; } -static void sig_winch(int signo) +static void check_geometry(void) { - endwin(); - errx(1, "under the pain of death, thou shaltst not resize thyne window"); + if (conf.check_geometry && + (LINES < MIN_SCREEN_LINES || COLS < MIN_SCREEN_COLS)) + err_quit("need at least a screen of %ux%u, have only %ux%u", + MIN_SCREEN_LINES, MIN_SCREEN_COLS, LINES, COLS); } int main(int argc, char *argv[]) { WINDOW *w_menu; enum wavemon_screen cur, next; + sigset_t blockmask, oldmask; getconf(argc, argv); - if (signal(SIGWINCH, sig_winch) == SIG_ERR) - err(1, "cannot install handler for window changes"); + if (!isatty(STDIN_FILENO)) + errx(1, "input is not from a terminal"); /* honour numeric separators if the environment defines them */ setlocale(LC_NUMERIC, ""); /* initialize the ncurses interface */ initscr(); - if (LINES < MIN_SCREEN_LINES || COLS < MIN_SCREEN_COLS) - err_quit("need at least a screen of %ux%u, have only %ux%u", - MIN_SCREEN_LINES, MIN_SCREEN_COLS, LINES, COLS); + check_geometry(); cbreak(); noecho(); nonl(); @@ -83,36 +153,93 @@ int main(int argc, char *argv[]) curs_set(0); start_color(); - init_pair(CP_STANDARD, COLOR_WHITE, COLOR_BLACK); - init_pair(CP_SCALEHI, COLOR_RED, COLOR_BLACK); - init_pair(CP_SCALEMID, COLOR_YELLOW, COLOR_BLACK); - init_pair(CP_SCALELOW, COLOR_GREEN, COLOR_BLACK); - init_pair(CP_WTITLE, COLOR_CYAN, COLOR_BLACK); - init_pair(CP_INACTIVE, COLOR_CYAN, COLOR_BLACK); - init_pair(CP_ACTIVE, COLOR_CYAN, COLOR_BLUE); - init_pair(CP_STATSIG, COLOR_GREEN, COLOR_BLACK); - init_pair(CP_STATNOISE, COLOR_RED, COLOR_BLACK); - init_pair(CP_STATSNR, COLOR_BLUE, COLOR_BLUE); - init_pair(CP_STATBKG, COLOR_BLUE, COLOR_BLACK); - init_pair(CP_STATSIG_S, COLOR_GREEN, COLOR_BLUE); - init_pair(CP_STATNOISE_S, COLOR_RED, COLOR_BLUE); - init_pair(CP_PREF_NORMAL, COLOR_WHITE, COLOR_BLACK); - init_pair(CP_PREF_SELECT, COLOR_WHITE, COLOR_BLUE); - init_pair(CP_PREF_ARROW, COLOR_RED, COLOR_BLACK); - - w_menu = newwin(1, WAV_WIDTH, WAV_HEIGHT, 0); - nodelay(w_menu, TRUE); - keypad(w_menu, TRUE); - - for (cur = SCR_HELP, next = conf.startup_scr; next != SCR_QUIT; ) { - - if (screens[next].screen_func != NULL) - cur = next; - - reinit_on_changes(); - update_menubar(w_menu, cur); - next = (*screens[cur].screen_func)(w_menu); - + init_pair(CP_STANDARD, COLOR_WHITE, COLOR_BLACK); + init_pair(CP_SCALEHI, COLOR_RED, COLOR_BLACK); + init_pair(CP_SCALEMID, COLOR_YELLOW, COLOR_BLACK); + init_pair(CP_SCALELOW, COLOR_GREEN, COLOR_BLACK); + init_pair(CP_WTITLE, COLOR_CYAN, COLOR_BLACK); + init_pair(CP_INACTIVE, COLOR_CYAN, COLOR_BLACK); + init_pair(CP_ACTIVE, COLOR_CYAN, COLOR_BLUE); + + init_pair(CP_STATSIG, COLOR_GREEN, COLOR_BLACK); + init_pair(CP_STATNOISE, COLOR_RED, COLOR_BLACK); + init_pair(CP_STATSNR, COLOR_BLUE, COLOR_BLUE); + init_pair(CP_STATBKG, COLOR_BLUE, COLOR_BLACK); + init_pair(CP_STATSIG_S, COLOR_GREEN, COLOR_BLUE); + init_pair(CP_STATNOISE_S, COLOR_RED, COLOR_BLUE); + + init_pair(CP_PREF_NORMAL, COLOR_WHITE, COLOR_BLACK); + init_pair(CP_PREF_SELECT, COLOR_WHITE, COLOR_BLUE); + init_pair(CP_PREF_ARROW, COLOR_RED, COLOR_BLACK); + + init_pair(CP_SCAN_CRYPT, COLOR_RED, COLOR_BLACK); + init_pair(CP_SCAN_UNENC, COLOR_GREEN, COLOR_BLACK); + init_pair(CP_SCAN_NON_AP, COLOR_YELLOW, COLOR_BLACK); + + /* Override signal handlers installed during ncurses initialisation. */ + xsignal(SIGCHLD, SIG_IGN); + xsignal(SIGWINCH, sig_winch); /* triggers only when env_winch_ready */ + sigemptyset(&blockmask); + sigaddset(&blockmask, SIGWINCH); + + for (cur = conf.startup_scr; cur != SCR_QUIT; cur = next) { + + if (sigprocmask(SIG_BLOCK, &blockmask, &oldmask) < 0) + err_sys("cannot block SIGWINCH"); + + next = cur; + w_menu = init_menubar(cur); + (*screens[cur].init)(); + + if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) + err_sys("cannot unblock SIGWINCH"); + + if (sigsetjmp(env_winch, true) == 0) { + env_winch_ready = true; + + do { + int key = (*screens[cur].loop)(w_menu); + + if (key <= 0) + usleep(5000); + switch (key) { + case KEY_F(1): + case KEY_F(2): + case KEY_F(3): + case KEY_F(7): + case KEY_F(8): + case KEY_F(9): + case KEY_F(10): + next = key - KEY_F(1); + break; + case 'i': + next = SCR_INFO; + break; + case 'q': + next = SCR_QUIT; + break; + default: + continue; + } + } while (next == cur); + } + + delwin(w_menu); + (*screens[cur].fini)(); + + /* + * next = cur is set in the protected critical section before + * sigsetjmp. Due to the loop condition, it can not occur when + * no SIGWINCH occurred, hence it indicates a resizing event. + */ + if (next == cur) { + struct winsize size; + + if (ioctl(STDIN_FILENO, TIOCGWINSZ, &size) < 0) + err_sys("can not determine terminal size"); + resizeterm(size.ws_row, size.ws_col); + check_geometry(); + } clear(); refresh(); } diff --git a/wavemon.h b/wavemon.h index 608a609..ad0b488 100644 --- a/wavemon.h +++ b/wavemon.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -40,14 +41,25 @@ #define CFNAME ".wavemonrc" /* * Minimum screen dimensions. - * The number of lines depends on the size requirements of scr_info(), which - * is 23 + 1 lines (1 line is needed for the menubar). The number of columns - * comes from the menubar length (10 items of length 6 plus the 'Fxx'). - * This value was also chosen since 24x80 is a very common screen size, so - * that wavemon can also be used without restrictions on the console. + * The number of lines depends on the size requirements of scr_info(). The + * number of columns comes from the menubar length (10 items of length 6 + * plus the 'Fxx'). This value was also chosen since 24x80 is a very common + * screen size, in particular allowing the use on the console. */ -#define MIN_SCREEN_LINES 24 -#define MIN_SCREEN_COLS 80 +enum info_screen_geometry { + WH_IFACE = 2, /* 'Interface' area at the top */ + WH_LEVEL = 9, /* Level meters (signal/noise/SNR) */ + WH_STATS = 3, /* WiFi statistics area */ + WH_INFO_MIN = 6, /* WiFi information area */ + WH_NET_MIN = 3, /* Network interface information area */ + WH_NET_MAX = 5, /* Network interface information area */ + WH_MENU = 1 /* Menu bar at the bottom */ +}; +#define WH_INFO_SCR_BASE (WH_IFACE + WH_LEVEL + WH_STATS + WH_MENU) +#define WH_INFO_SCR_MIN (WH_INFO_SCR_BASE + WH_INFO_MIN + WH_NET_MIN) + +#define MIN_SCREEN_LINES WH_INFO_SCR_MIN +#define MIN_SCREEN_COLS 80 /* * Screen layout constants. * @@ -91,7 +103,7 @@ static inline void threshold_action(enum threshold_action action) * Global in-memory representation of current wavemon configuration state */ extern struct wavemon_conf { - char ifname[LISTVAL_MAX]; + int if_idx; /* Index into interface list */ int stat_iv, info_iv; @@ -105,53 +117,42 @@ extern struct wavemon_conf { int slotsize, meter_decay; - /* Boolean values which are 'char' for consistency with item->dep */ - char random, - override_bounds; + /* Boolean values */ + int check_geometry, /* ensure window is large enough */ + cisco_mac, /* Cisco-style MAC addresses */ + random, /* random signals */ + override_bounds; /* override autodetection */ - char lthreshold_action, /* disabled|beep|flash|beep+flash */ - hthreshold_action; - - char startup_scr; /* info|histogram|aplist */ + /* Enumerated values */ + int lthreshold_action, /* disabled|beep|flash|beep+flash */ + hthreshold_action, /* disabled|beep|flash|beep+flash */ + startup_scr; /* info|histogram|aplist */ } conf; /* - * Initialisation & Configuration functions + * Initialisation & Configuration */ extern void getconf(int argc, char *argv[]); -extern void reinit_on_changes(void); -/* - * Configuration items to manipulate the current configuration - */ +/* Configuration items to manipulate the current configuration */ struct conf_item { char *name, /* name for preferences screen */ *cfname; /* name for ~/.wavemonrc */ enum { /* type of parameter */ - t_int, - t_string, - t_listval, - t_switch, - t_list, - t_sep, /* dummy */ + t_int, /* @v.i is interpreted as raw value */ + t_list, /* @v.i is an index into @list */ + t_sep, /* dummy, separator entry */ t_func /* void (*fp) (void) */ } type; union { /* type-dependent container for value */ - int *i; /* t_int */ - char *s; /* t_string, t_listval */ - char *b; /* - * t_switch: a boolean type - * t_list: an enum type where 0 means "off" - * A pointer is needed to propagate the changes. See - * the 'char' types in the above wavemon_conf struct. - */ + int *i; /* t_int and t_list index into @list */ void (*fp)(); /* t_func */ } v; - int list; /* list of available settings (for t_list) */ - char *dep; /* dependency (must be t_switch) */ + char **list; /* t_list: NULL-terminated array of strings */ + int *dep; /* dependency */ double min, /* value boundaries */ max, @@ -160,11 +161,6 @@ struct conf_item { char *unit; /* name of units to display */ }; -/* - * Handling of Configuration Items - */ -extern int conf_items; - /* * Screen functions */ @@ -181,12 +177,29 @@ enum wavemon_screen { SCR_QUIT /* F10 */ }; -extern enum wavemon_screen scr_info(WINDOW *w_menu); -extern enum wavemon_screen scr_lhist(WINDOW *w_menu); -extern enum wavemon_screen scr_aplst(WINDOW *w_menu); -extern enum wavemon_screen scr_conf(WINDOW *w_menu); -extern enum wavemon_screen scr_help(WINDOW *w_menu); -extern enum wavemon_screen scr_about(WINDOW *w_menu); +extern void scr_info_init(void); +extern int scr_info_loop(WINDOW *w_menu); +extern void scr_info_fini(void); + +extern void scr_lhist_init(void); +extern int scr_lhist_loop(WINDOW *w_menu); +extern void scr_lhist_fini(void); + +extern void scr_aplst_init(void); +extern int scr_aplst_loop(WINDOW *w_menu); +extern void scr_aplst_fini(void); + +extern void scr_conf_init(void); +extern int scr_conf_loop(WINDOW *w_menu); +extern void scr_conf_fini(void); + +extern void scr_help_init(void); +extern int scr_help_loop(WINDOW *w_menu); +extern void scr_help_fini(void); + +extern void scr_about_init(void); +extern int scr_about_loop(WINDOW *w_menu); +extern void scr_about_fini(void); /* * Ncurses definitions and functions @@ -220,7 +233,10 @@ enum colour_pair { CP_STATNOISE_S, CP_PREF_NORMAL, CP_PREF_SELECT, - CP_PREF_ARROW + CP_PREF_ARROW, + CP_SCAN_CRYPT, + CP_SCAN_UNENC, + CP_SCAN_NON_AP }; static inline int cp_from_scale(float value, const char *cscale, bool reverse) @@ -240,7 +256,9 @@ static inline int cp_from_scale(float value, const char *cscale, bool reverse) /* * Wireless interfaces */ -extern int iw_get_interface_list(void); +extern const char *conf_ifname(void); +extern void conf_get_interface_list(void); +extern char **iw_get_interface_list(void); extern void dump_parameters(void); /* @@ -257,6 +275,7 @@ extern int end_timer(struct timer *t); /* * Error handling */ +extern bool has_net_admin_capability(void); extern void err_msg(const char *format, ...); extern void err_quit(const char *format, ...); extern void err_sys(const char *format, ...); @@ -266,10 +285,51 @@ extern void err_sys(const char *format, ...); */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +static inline void (*xsignal(int signo, void (*handler)(int)))(int) +{ + struct sigaction old_sa, sa = { .sa_handler = handler, .sa_flags = 0 }; + + if (sigemptyset(&sa.sa_mask) < 0 || sigaction(signo, &sa, &old_sa) < 0) + err_sys("xsignal(%d) failed", signo); + return old_sa.sa_handler; +} + +static inline size_t argv_count(char **argv) +{ + int cnt = 0; + + assert(argv != NULL); + while (*argv++) + cnt++; + return cnt; +} + +static inline int argv_find(char **argv, const char *what) +{ + int cnt = argv_count(argv), len, i; + + assert(what != NULL); + for (i = 0, len = strlen(what); i < cnt; i++) + if (strncasecmp(argv[i], what, len) == 0) + return i; + return -1; +} + static inline void str_tolower(char *s) { - while (s && *s != '\0') - *s++ = tolower(*s); + for (; s && *s; s++) + *s = tolower(*s); +} + +/* Check if @str is printable (compare iw_essid_escape()) */ +static inline bool str_is_ascii(char *s) +{ + if (!s || !*s) + return false; + for (; *s; s++) + if (!isascii(*s) || iscntrl(*s)) + return false; + return true; } /* number of digits needed to display integer part of @val */ diff --git a/wavemonrc.5 b/wavemonrc.5 index ba1151b..67dea89 100644 --- a/wavemonrc.5 +++ b/wavemonrc.5 @@ -1,131 +1,147 @@ -.TH WAVEMON 1 "JANUARY 2009" Linux "User Manuals" +.TH wavemonrc 5 "December 2010" Linux "User Manuals" .SH NAME -wavemonrc \- wavemon configuration file -.SH SYNOPSIS -.B wavemon [-h] [-i -.I ifname -.B ] [-l] [-r] [-v] +$HOME/.wavemonrc \- wavemon configuration file .SH DESCRIPTION -.B wavemon -stores its configuration parameters within the file ~/.wavemonrc in every user's home directory. This manpage provides an in-depth description of the available options. Every setting corresponds to a configuration item you'll find on the preferences screen within the program (F7 key). +\fIwavemonrc\fR is the per-user configuration file for \fBwavemon\fR(1). +This page describes its individual configuration options. Each corresponds +to a configuration item of the \fIPreferences\fR screen (F7 key), whose +on-screen name is shown in parentheses. .P .B interface = .RS .RE -.B (Interface) +.R (Interface) .RS -This parameter specifies, you guessed it, the name of the interface wavemon uses for operation. Only valid identifiers of existing wireless network devices are allowed, otherwise the program launch will fail. +Selects the wireless interface to use. +.P +.RE +.B cisco_mac = (on|off) +.RS +.RE +.R (Cisco-style MAC addresses) +.RS +If enabled, display MAC addresses using lower-case hex digits separated by dots +rather than colons. .P .RE .B stat_updates = .RS .RE -.B (Statistics updates) +.R (Statistics updates) .RS -This controls the intervals between updates of the statistics data. Range: 10..4000ms. +Time interval for polling new statistics (including scan refresh). Range: 10..4000ms. .P .RE .B lhist_slot_size = .RS .RE -.B (Histogram update cycles) +.R (Histogram update cycles) .RS -This determines how many obtained statistics values are averaged into one level histogram slot. So, if your statistics update interval is 50ms and your histogram slot size is 4, the histogram is moved one slot further every 2 seconds. Range: 1..64. +Number of samples used per each histogram slot. For example, if the stat_updates +interval is 500ms and the histogram slot size is 4, the histogram is moved +one slot further every 2 seconds. Range: 1..64. .P .RE .B meter_smoothness = .RS .RE -.B (Level meter smoothness) +.R (Level meter smoothness) .RS -Determines the responsiveness of level meters, tracking the moving average rather than following each new sample. The given value specifies the percentage of the history (the 'inertia') of preceding samples. A value of 0 disables this option. Range: 0..99%. +Determines the responsiveness of level meters, tracking the moving average +rather than following each new sample. The given value specifies the percentage +of the history (the 'inertia') of preceding samples. A value of 0 disables +this option. Range: 0..99%. .P .RE .B info_updates = .RS .RE -.B (Dynamic info updates) +.R (Dynamic info updates) .RS -With this setting, you can control the intervals between updates of the dynamic device parameters, i.e. those values that may change, but not frequently. Dynamic parameters are for example the current bitrate of your wireless link. Range: 1..60s. +Sets refresh rate for dynamic device parameters (e.g. bitrate) and the +refresh interval for the Scan window (F3). Range: 1..60s. .P .RE -.B override_auto_scale = (enabled|disabled) +.B override_auto_scale = (on|off) .RS .RE -.B (Override scale autodetect) +.R (Override scale autodetect) .RS -Setting this parameter to "enabled" overrides the auto-detection of the bar graph and histogram scale boundaries, allowing you to specify your own scales. +Override the auto-scaling of the bar graphs and histogram, allowing you to set your own scales. .P .RE .B min_signal_level, max_signal_level = .RS .RE -.B (Minimum signal level, Maximum signal level) +.R (Minimum signal level, Maximum signal level) .RS -These parameters allow you to set the left and right boundaries of the signal level scales. Ranges: -128..-60dBm (minimum), -59..120dBm (maximum). +Set the left and right boundaries of the signal level scales. Ranges: -128..-60dBm (minimum) and -59..120dBm (maximum). .P .RE .B min_noise_level, max_noise_level = .RS .RE -.B (Minimum noise level, Maximum noise level) +.R (Minimum noise level, Maximum noise level) .RS -These work similar to the signal boundary settings. Ranges: -128..-60dBm (minimum), -60..120dBm (maximum). +These work similar to the signal boundary settings. Ranges: -128..-60dBm +(minimum) and -60..120dBm (maximum). .P .RE -.B random = (enabled|disabled) +.B random = (on|off) .RS .RE -.B (Random signals) +.R (Random signals) .RS -This switch controls a fancy random generator you can use for testing functions and scales. +Switches on a fancy random generator for testing. .P .RE .B lo_threshold_action = (disabled|beep|flash|beep+flash) .RS .RE -.B (Low threshold action) +.R (Low threshold action) .RS -This function allows you to assign a warning facility to a defineable threshold at the lower end of the signal scale. It is meant for alarming you when a signal appears at the receiver. +Issue a warning at a given threshold at the lower end of the signal +scale. It is meant for alarming you when a signal appears at the receiver. .P .RE .B lo_threshold = .RS .RE -.B (Low threshold) +.R (Low threshold) .RS -This defines the low threshold. Makes only sense when the above setting is active. Range: -120..-60dBm. +Sets the threshold value for the 'Low threshold action'. +Range: -120..-60dBm. .P .RE .B hi_threshold_action = (disabled|beep|flash|beep+flash) .RS .RE -.B (High threshold action) +.R (High threshold action) .RS -This is similar to lo_threshold_action, only this time the threshold is at the upper end of the scale and the action is performed when the signal level drops below it. The acoustic signal is also different in order to be easily distinguishable from the lower one. Correctly adjusted, this little fellow will tell you when you should move closer to the base station. +Analogous to lo_threshold_action, only this time the threshold is at +the upper end of the scale and the action is performed when the signal level +drops below it. The acoustic signal is also different in order to be easily +distinguishable from the lower one. Correctly adjusted, this little fellow +will tell you when you should move closer to the base station. .P .RE .B hi_threshold = .RS .RE -.B (High threshold) +.R (High threshold) .RS -This defines the high threshold. Makes only sense when the above setting is active. Range: -59..120dBm. +Sets the threshold for the 'High threshold action'. Range: -59..120dBm. .P .RE -.B startup_screen = (info|histogram|access points) +.B startup_screen = (info|histogram|scan window) .RS .RE -.B (Startup screen) +.R (Startup screen) .RS -This setting determines which of the screens will be shown at program startup. -.SH AUTHOR -Jan Morgenstern -.P -The current maintainer is Gerrit Renker -.SH COPYRIGHT -wavemon 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, or (at your option) any later version. -.LP -wavemon 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. -.LP -You should have received a copy of the GNU General Public License along with wavemon; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +Which of the screens appears at program startup. +.SH "AUTHOR" +Written by Jan Morgenstern . +.SH "REPORTING BUGS" +Send bug reports and/or suggestions to Gerrit Renker . +.SH "COPYRIGHT" +This is free software with ABSOLUTELY NO WARRANTY. See file COPYING for details. -- cgit v1.2.3