]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Remove chan_usbradio and app_rpt.
authorRussell Bryant <russell@russellbryant.com>
Tue, 13 Mar 2012 23:38:01 +0000 (23:38 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 13 Mar 2012 23:38:01 +0000 (23:38 +0000)
These modules are being maintained outside of the tree and have been for a long
time now, so it doesn't make sense to keep them here.

Review: https://reviewboard.asterisk.org/r/1764/
........

Merged revisions 359050 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@359051 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_rpt.c [deleted file]
build_tools/menuselect-deps.in
channels/chan_usbradio.c [deleted file]
channels/xpmr/sinetabx.h [deleted file]
channels/xpmr/xpmr.c [deleted file]
channels/xpmr/xpmr.h [deleted file]
channels/xpmr/xpmr_coef.h [deleted file]
configure
configure.ac
include/asterisk/autoconfig.h.in
makeopts.in

diff --git a/apps/app_rpt.c b/apps/app_rpt.c
deleted file mode 100644 (file)
index 609caac..0000000
+++ /dev/null
@@ -1,15229 +0,0 @@
-#define        NEW_ASTERISK
-/* #define OLD_ASTERISK */
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 2002-2008, Jim Dixon, WB6NIL
- *
- * Jim Dixon, WB6NIL <jim@lambdatel.com>
- * Serious contributions by Steve RoDgers, WA6ZFT <hwstar@rodgers.sdcoxmail.com>
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
- */
-/*! \file
- *
- * \brief Radio Repeater / Remote Base program 
- *  version 0.115 5/12/08 2055 EDT
- * 
- * \author Jim Dixon, WB6NIL <jim@lambdatel.com>
- *
- * \note Serious contributions by Steve RoDgers, WA6ZFT <hwstar@rodgers.sdcoxmail.com>
- * \note Steven Henke, W9SH, <w9sh@arrl.net> added a few features here and there.
- *
- * See http://www.zapatatelephony.org/app_rpt.html
- *
- *
- * Repeater / Remote Functions:
- * "Simple" Mode:  * - autopatch access, # - autopatch hangup
- * Normal mode:
- * See the function list in rpt.conf (autopatchup, autopatchdn)
- * autopatchup can optionally take comma delimited setting=value pairs:
- *  
- *
- * context=string              :       Override default context with "string"
- * dialtime=ms                 :       Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second)
- * farenddisconnect=1          :       Automatically disconnect when called party hangs up
- * noct=1                      :       Don't send repeater courtesy tone during autopatch calls
- * quiet=1                     :       Don't send dial tone, or connect messages. Do not send patch down message when called party hangs up
- *
- *
- * Example: 123=autopatchup,dialtime=20000,noct=1,farenddisconnect=1
- *
- *  To send an asterisk (*) while dialing or talking on phone,
- *  use the autopatch acess code.
- *
- *
- * status cmds:
- *
- *  1 - Force ID (global)
- *  2 - Give Time of Day (global)
- *  3 - Give software Version (global)
- *  11 - Force ID (local only)
- *  12 - Give Time of Day (local only)
- *
- * cop (control operator) cmds:
- *
- *  1 - System warm boot
- *  2 - System enable
- *  3 - System disable
- *  4 - Test Tone On/Off
- *  5 - Dump System Variables on Console (debug)
- *  6 - PTT (phone mode only)
- *  7 - Time out timer enable
- *  8 - Time out timer disable
- *  9 - Autopatch enable
- *  10 - Autopatch disable
- *  11 - Link enable
- *  12 - Link disable
- *  13 - Query System State
- *  14 - Change System State
- *  15 - Scheduler Enable
- *  16 - Scheduler Disable
- *  17 - User functions (time, id, etc) enable
- *  18 - User functions (time, id, etc) disable
- *  19 - Select alternate hang timer
- *  20 - Select standard hang timer 
- *  21 - Enable Parrot Mode
- *  22 - Disable Parrot Mode
- *  23 - Birdbath (Current Parrot Cleanup/Flush)
- *  24 - Flush all telemetry
- *  25 - Query last node un-keyed
- *  26 - Query all nodes keyed/unkeyed
- *  30 - Recall Memory Setting in Attached Xcvr
- *  31 - Channel Selector for Parallel Programmed Xcvr
- *  32 - Touchtone pad test: command + Digit string + # to playback all digits pressed
- *
- * ilink cmds:
- *
- *  1 - Disconnect specified link
- *  2 - Connect specified link -- monitor only
- *  3 - Connect specified link -- tranceive
- *  4 - Enter command mode on specified link
- *  5 - System status
- *  6 - Disconnect all links
- *  11 - Disconnect a previously permanently connected link
- *  12 - Permanently connect specified link -- monitor only
- *  13 - Permanently connect specified link -- tranceive
- *  15 - Full system status (all nodes)
- *  16 - Reconnect links disconnected with "disconnect all links"
- *  200 thru 215 - (Send DTMF 0-9,*,#,A-D) (200=0, 201=1, 210=*, etc)
- *
- * remote cmds:
- *
- *  1 - Recall Memory MM  (*000-*099) (Gets memory from rpt.conf)
- *  2 - Set VFO MMMMM*KKK*O   (Mhz digits, Khz digits, Offset)
- *  3 - Set Rx PL Tone HHH*D*
- *  4 - Set Tx PL Tone HHH*D* (Not currently implemented with DHE RBI-1)
- *  5 - Link Status (long)
- *  6 - Set operating mode M (FM, USB, LSB, AM, etc)
- *  100 - RX PL off (Default)
- *  101 - RX PL On
- *  102 - TX PL Off (Default)
- *  103 - TX PL On
- *  104 - Low Power
- *  105 - Med Power
- *  106 - Hi Power
- *  107 - Bump Down 20 Hz
- *  108 - Bump Down 100 Hz
- *  109 - Bump Down 500 Hz
- *  110 - Bump Up 20 Hz
- *  111 - Bump Up 100 Hz
- *  112 - Bump Up 500 Hz
- *  113 - Scan Down Slow
- *  114 - Scan Down Medium
- *  115 - Scan Down Fast
- *  116 - Scan Up Slow
- *  117 - Scan Up Medium
- *  118 - Scan Up Fast
- *  119 - Transmit allowing auto-tune
- *  140 - Link Status (brief)
- *  200 thru 215 - (Send DTMF 0-9,*,#,A-D) (200=0, 201=1, 210=*, etc)
- *
- * playback cmds:
- *  specify the name of the file to be played (for example, 25=rpt/foo)
- *
- *
- * 'duplex' modes:  (defaults to duplex=2)
- *
- * 0 - Only remote links key Tx and no main repeat audio.
- * 1 - Everything other then main Rx keys Tx, no main repeat audio.
- * 2 - Normal mode
- * 3 - Normal except no main repeat audio.
- * 4 - Normal except no main repeat audio during autopatch only
- *
-*/
-
-/*** MODULEINFO
-       <depend>dahdi</depend>
-       <depend>tonezone</depend>
-       <defaultenabled>no</defaultenabled>
-       <support_level>extended</support_level>
- ***/
-
-/* Un-comment the following to include support for MDC-1200 digital tone
-   signalling protocol (using KA6SQG's GPL'ed implementation) */
-/* #include "mdc_decode.c" */
-
-/* Un-comment the following to include support for notch filters in the
-   rx audio stream (using Tony Fisher's mknotch (mkfilter) implementation) */
-/* #include "rpt_notch.c" */
-
-/* maximum digits in DTMF buffer, and seconds after * for DTMF command timeout */
-
-#ifdef OLD_ASTERISK
-#define ast_free free
-#define ast_malloc malloc
-#define ast_strdup strdup
-#endif
-
-
-#define        MAXDTMF 32
-#define        MAXMACRO 2048
-#define        MAXLINKLIST 512
-#define        LINKLISTTIME 10000
-#define        LINKLISTSHORTTIME 200
-#define        LINKPOSTTIME 30000
-#define        LINKPOSTSHORTTIME 200
-#define        KEYPOSTTIME 30000
-#define        KEYPOSTSHORTTIME 200
-#define        MACROTIME 100
-#define        MACROPTIME 500
-#define        DTMF_TIMEOUT 3
-#define        KENWOOD_RETRIES 5
-#define        TOPKEYN 32
-#define        TOPKEYWAIT 3
-#define        TOPKEYMAXSTR 30
-
-#define        AUTHTELLTIME 7000
-#define        AUTHTXTIME 1000
-#define        AUTHLOGOUTTIME 25000
-
-#ifdef __RPT_NOTCH
-#define        MAXFILTERS 10
-#endif
-
-#define        DISC_TIME 10000  /* report disc after 10 seconds of no connect */
-#define        MAX_RETRIES 5
-#define        MAX_RETRIES_PERM 1000000000
-
-#define        REDUNDANT_TX_TIME 2000
-
-#define        RETRY_TIMER_MS 5000
-
-#define        PATCH_DIALPLAN_TIMEOUT 1500
-
-#ifdef OLD_ASTERISK
-#define        START_DELAY 10
-#else
-#define        START_DELAY 2
-#endif
-
-#define        RPT_LOCKOUT_SECS 10
-
-#define MAXPEERSTR 31
-#define        MAXREMSTR 15
-
-#define        DELIMCHR ','
-#define        QUOTECHR 34
-
-#define        MONITOR_DISK_BLOCKS_PER_MINUTE 38
-
-#define        DEFAULT_MONITOR_MIN_DISK_BLOCKS 10000
-#define        DEFAULT_REMOTE_INACT_TIMEOUT (15 * 60)
-#define        DEFAULT_REMOTE_TIMEOUT (60 * 60)
-#define        DEFAULT_REMOTE_TIMEOUT_WARNING (3 * 60)
-#define        DEFAULT_REMOTE_TIMEOUT_WARNING_FREQ 30
-
-#define        NODES "nodes"
-#define        EXTNODES "extnodes"
-#define MEMORY "memory"
-#define MACRO "macro"
-#define        FUNCTIONS "functions"
-#define TELEMETRY "telemetry"
-#define MORSE "morse"
-#define        TONEMACRO "tonemacro"
-#define        FUNCCHAR '*'
-#define        ENDCHAR '#'
-#define        EXTNODEFILE "/var/lib/asterisk/rpt_extnodes"
-#define        NODENAMES "rpt/nodenames"
-#define        PARROTFILE "/tmp/parrot_%s_%u"
-
-#define        PARROTTIME 1000
-
-#define        DEFAULT_IOBASE 0x378
-
-#define        DEFAULT_CIV_ADDR 0x58
-
-#define        MAXCONNECTTIME 5000
-
-#define MAXNODESTR 300
-
-#define MAXNODELEN 16
-
-#define MAXIDENTLEN 32
-
-#define MAXPATCHCONTEXT 100
-
-#define ACTIONSIZE 32
-
-#define TELEPARAMSIZE 256
-
-#define REM_SCANTIME 100
-
-#define        DTMF_LOCAL_TIME 250
-#define        DTMF_LOCAL_STARTTIME 500
-
-#define        IC706_PL_MEMORY_OFFSET 50
-
-#define        VOX_ON_DEBOUNCE_COUNT 3
-#define        VOX_OFF_DEBOUNCE_COUNT 20
-#define        VOX_MAX_THRESHOLD 10000.0
-#define        VOX_MIN_THRESHOLD 3000.0
-#define        VOX_TIMEOUT_MS 5000
-#define        VOX_RECOVER_MS 500
-#define        SIMPLEX_PATCH_DELAY 25
-#define        SIMPLEX_PHONE_DELAY 25
-
-#define        STATPOST_PROGRAM "/usr/bin/wget,-q,--output-document=/dev/null,--no-check-certificate"
-
-#define        ALLOW_LOCAL_CHANNELS
-
-enum {REM_OFF,REM_MONITOR,REM_TX};
-
-enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
-       CONNECTED,CONNFAIL,STATUS,TIMEOUT,ID1, STATS_TIME, PLAYBACK,
-       STATS_VERSION, IDTALKOVER, ARB_ALPHA, TEST_TONE, REV_PATCH,
-       TAILMSG, MACRO_NOTFOUND, MACRO_BUSY, LASTNODEKEY, FULLSTATUS,
-       MEMNOTFOUND, INVFREQ, REMMODE, REMLOGIN, REMXXX, REMSHORTSTATUS,
-       REMLONGSTATUS, LOGINREQ, SCAN, SCANSTAT, TUNE, SETREMOTE, TOPKEY,
-       TIMEOUT_WARNING, ACT_TIMEOUT_WARNING, LINKUNKEY, UNAUTHTX, PARROT,
-       STATS_TIME_LOCAL};
-
-
-enum {REM_SIMPLEX,REM_MINUS,REM_PLUS};
-
-enum {REM_LOWPWR,REM_MEDPWR,REM_HIPWR};
-
-enum {DC_INDETERMINATE, DC_REQ_FLUSH, DC_ERROR, DC_COMPLETE, DC_COMPLETEQUIET, DC_DOKEY};
-
-enum {SOURCE_RPT, SOURCE_LNK, SOURCE_RMT, SOURCE_PHONE, SOURCE_DPHONE, SOURCE_ALT};
-
-enum {DLY_TELEM, DLY_ID, DLY_UNKEY, DLY_CALLTERM, DLY_COMP, DLY_LINKUNKEY, DLY_PARROT};
-
-enum {REM_MODE_FM,REM_MODE_USB,REM_MODE_LSB,REM_MODE_AM};
-
-enum {HF_SCAN_OFF,HF_SCAN_DOWN_SLOW,HF_SCAN_DOWN_QUICK,
-      HF_SCAN_DOWN_FAST,HF_SCAN_UP_SLOW,HF_SCAN_UP_QUICK,HF_SCAN_UP_FAST};
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include <signal.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <search.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <dirent.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#ifdef HAVE_SYS_IO_H
-#include <sys/io.h>
-#endif
-#include <sys/vfs.h>
-#include <math.h>
-#include <dahdi/user.h>
-#include <dahdi/tonezone.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include "asterisk/utils.h"
-#include "asterisk/lock.h"
-#include "asterisk/file.h"
-#include "asterisk/logger.h"
-#include "asterisk/channel.h"
-#include "asterisk/callerid.h"
-#include "asterisk/pbx.h"
-#include "asterisk/module.h"
-#include "asterisk/translate.h"
-#include "asterisk/features.h"
-#include "asterisk/options.h"
-#include "asterisk/cli.h"
-#include "asterisk/config.h"
-#include "asterisk/say.h"
-#include "asterisk/localtime.h"
-#include "asterisk/cdr.h"
-#include "asterisk/options.h"
-#include "asterisk/manager.h"
-#include "asterisk/app.h"
-
-#include <termios.h>
-
-#ifdef NEW_ASTERISK
-struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
-#endif
-
-
-/* Start a tone-list going */
-int ast_playtones_start(struct ast_channel *chan, int vol, const char* tonelist, int interruptible);
-/*! Stop the tones from playing */
-void ast_playtones_stop(struct ast_channel *chan);
-
-static  char *tdesc = "Radio Repeater / Remote Base  version 0.115  5/12/2008";
-
-static char *app = "Rpt";
-
-static char *synopsis = "Radio Repeater/Remote Base Control System";
-
-static char *descrip = 
-"  Rpt(nodename[|options][|M][|*]):  \n"
-"    Radio Remote Link or Remote Base Link Endpoint Process.\n"
-"\n"
-"    Not specifying an option puts it in normal endpoint mode (where source\n"
-"    IP and nodename are verified).\n"
-"\n"
-"    Options are as follows:\n"
-"\n"
-"        X - Normal endpoint mode WITHOUT security check. Only specify\n"
-"            this if you have checked security already (like with an IAX2\n"
-"            user/password or something).\n"
-"\n"
-"        Rannounce-string[|timeout[|timeout-destination]] - Amateur Radio\n"
-"            Reverse Autopatch. Caller is put on hold, and announcement (as\n"
-"            specified by the 'announce-string') is played on radio system.\n"
-"            Users of radio system can access autopatch, dial specified\n"
-"            code, and pick up call. Announce-string is list of names of\n"
-"            recordings, or \"PARKED\" to substitute code for un-parking,\n"
-"            or \"NODE\" to substitute node number.\n"
-"\n"
-"        P - Phone Control mode. This allows a regular phone user to have\n"
-"            full control and audio access to the radio system. For the\n"
-"            user to have DTMF control, the 'phone_functions' parameter\n"
-"            must be specified for the node in 'rpt.conf'. An additional\n"
-"            function (cop,6) must be listed so that PTT control is available.\n"
-"\n"
-"        D - Dumb Phone Control mode. This allows a regular phone user to\n"
-"            have full control and audio access to the radio system. In this\n"
-"            mode, the PTT is activated for the entire length of the call.\n"
-"            For the user to have DTMF control (not generally recomended in\n"
-"            this mode), the 'dphone_functions' parameter must be specified\n"
-"            for the node in 'rpt.conf'. Otherwise no DTMF control will be\n"
-"            available to the phone user.\n"
-"\n"
-"        S - Simplex Dumb Phone Control mode. This allows a regular phone user\n"
-"            audio-only access to the radio system. In this mode, the\n"
-"            transmitter is toggled on and off when the phone user presses the\n"
-"            funcchar (*) key on the telephone set. In addition, the transmitter\n"
-"            will turn off if the endchar (#) key is pressed. When a user first\n"
-"            calls in, the transmitter will be off, and the user can listen for\n"
-"            radio traffic. When the user wants to transmit, they press the *\n" 
-"            key, start talking, then press the * key again or the # key to turn\n"
-"            the transmitter off.  No other functions can be executed by the\n"
-"            user on the phone when this mode is selected. Note: If your\n"
-"            radio system is full-duplex, we recommend using either P or D\n"
-"            modes as they provide more flexibility.\n"
-"\n"
-"        q - Query Status. Sets channel variables and returns + 101 in plan.\n"
-"\n"
-"        M - Memory Channel Steer as MXX where XX is the memory channel number.\n"
-"\n"
-"        * - Alt Macro to execute (e.g. *7 for status)\n"
-"\n";
-;
-
-static int debug = 0;  /* Set this >0 for extra debug output */
-static int nrpts = 0;
-
-static const char remdtmfstr[] = "0123456789*#ABCD";
-
-enum {TOP_TOP,TOP_WON,WON_BEFREAD,BEFREAD_AFTERREAD};
-
-int max_chan_stat [] = {22000,1000,22000,100,22000,2000,22000};
-
-#define NRPTSTAT 7
-
-struct rpt_chan_stat
-{
-       struct timeval last;
-       long long total;
-       unsigned long count;
-       unsigned long largest;
-       struct timeval largest_time;
-};
-
-char *discstr = "!!DISCONNECT!!";
-char *newkeystr = "!NEWKEY!";
-static char *remote_rig_ft897="ft897";
-static char *remote_rig_rbi="rbi";
-static char *remote_rig_kenwood="kenwood";
-static char *remote_rig_tm271="tm271";
-static char *remote_rig_ic706="ic706";
-static char *remote_rig_rtx150="rtx150";
-static char *remote_rig_rtx450="rtx450";
-static char *remote_rig_ppp16="ppp16";                 // parallel port programmable 16 channels
-
-#define ISRIG_RTX(x) ((!strcmp(x,remote_rig_rtx150)) || (!strcmp(x,remote_rig_rtx450)))
-#define        IS_XPMR(x) (!strncasecmp(x->rxchanname,"rad",3))
-
-#ifdef OLD_ASTERISK
-STANDARD_LOCAL_USER;
-LOCAL_USER_DECL;
-#endif
-
-#define        MSWAIT 200
-#define        HANGTIME 5000
-#define        TOTIME 180000
-#define        IDTIME 300000
-#define        MAXRPTS 20
-#define MAX_STAT_LINKS 32
-#define POLITEID 30000
-#define FUNCTDELAY 1500
-
-#define        MAXXLAT 20
-#define        MAXXLATTIME 3
-
-#define MAX_SYSSTATES 10
-
-struct vox {
-       float   speech_energy;
-       float   noise_energy;
-       int     enacount;
-       char    voxena;
-       char    lastvox;
-       int     offdebcnt;
-       int     ondebcnt;
-} ;
-
-#define        mymax(x,y) ((x > y) ? x : y)
-#define        mymin(x,y) ((x < y) ? x : y)
-
-struct rpt_topkey
-{
-char   node[TOPKEYMAXSTR];
-int    timesince;
-int    keyed;
-} ;
-
-struct rpt_xlat
-{
-char   funccharseq[MAXXLAT];
-char   endcharseq[MAXXLAT];
-char   passchars[MAXXLAT];
-int    funcindex;
-int    endindex;
-time_t lastone;
-} ;
-
-static time_t  starttime = 0;
-
-static  pthread_t rpt_master_thread;
-
-struct rpt;
-
-struct rpt_link
-{
-       struct rpt_link *next;
-       struct rpt_link *prev;
-       char    mode;                   /* 1 if in tx mode */
-       char    isremote;
-       char    phonemode;
-       char    phonevox;               /* vox the phone */
-       char    name[MAXNODESTR];       /* identifier (routing) string */
-       char    lasttx;
-       char    lasttx1;
-       char    lastrx;
-       char    lastrealrx;
-       char    lastrx1;
-       char    connected;
-       char    hasconnected;
-       char    perma;
-       char    thisconnected;
-       char    outbound;
-       char    disced;
-       char    killme;
-       long    elaptime;
-       long    disctime;
-       long    retrytimer;
-       long    retxtimer;
-       long    rerxtimer;
-       int     retries;
-       int     max_retries;
-       int     reconnects;
-       long long connecttime;
-       struct ast_channel *chan;       
-       struct ast_channel *pchan;      
-       char    linklist[MAXLINKLIST];
-       time_t  linklistreceived;
-       long    linklisttimer;
-       int     dtmfed;
-       int linkunkeytocttimer;
-       struct timeval lastlinktv;
-       struct  ast_frame *lastf1,*lastf2;
-       struct  rpt_chan_stat chan_stat[NRPTSTAT];
-       struct vox vox;
-       char wasvox;
-       int voxtotimer;
-       char voxtostate;
-       char newkey;
-#ifdef OLD_ASTERISK
-        AST_LIST_HEAD(, ast_frame) rxq;
-#else
-       AST_LIST_HEAD_NOLOCK(, ast_frame) rxq;
-#endif
-} ;
-
-struct rpt_lstat
-{
-       struct  rpt_lstat *next;
-       struct  rpt_lstat *prev;
-       char    peer[MAXPEERSTR];
-       char    name[MAXNODESTR];
-       char    mode;
-       char    outbound;
-       char    reconnects;
-       char    thisconnected;
-       long long       connecttime;
-       struct  rpt_chan_stat chan_stat[NRPTSTAT];
-} ;
-
-struct rpt_tele
-{
-       struct rpt_tele *next;
-       struct rpt_tele *prev;
-       struct rpt *rpt;
-       struct ast_channel *chan;
-       int     mode;
-       struct rpt_link mylink;
-       char param[TELEPARAMSIZE];
-       intptr_t submode;
-       uintptr_t  parrot;
-       pthread_t threadid;
-} ;
-
-struct function_table_tag
-{
-       char action[ACTIONSIZE];
-       int (*function)(struct rpt *myrpt, char *param, char *digitbuf, 
-               int command_source, struct rpt_link *mylink);
-} ;
-
-/* Used to store the morse code patterns */
-
-struct morse_bits
-{                
-       int len;
-       int ddcomb;
-} ;
-
-struct telem_defaults
-{
-       char name[20];
-       char value[80];
-} ;
-
-
-struct sysstate
-{
-       char txdisable;
-       char totdisable;
-       char linkfundisable;
-       char autopatchdisable;
-       char schedulerdisable;
-       char userfundisable;
-       char alternatetail;
-};
-
-/* rpt cmd support */
-#define CMD_DEPTH 1
-#define CMD_STATE_IDLE 0
-#define CMD_STATE_BUSY 1
-#define CMD_STATE_READY 2
-#define CMD_STATE_EXECUTING 3
-
-struct rpt_cmd_struct
-{
-    int state;
-    int functionNumber;
-    char param[MAXDTMF];
-    char digits[MAXDTMF];
-    int command_source;
-};
-
-static struct rpt
-{
-       ast_mutex_t lock;
-       ast_mutex_t remlock;
-       ast_mutex_t statpost_lock;
-       struct ast_config *cfg;
-       char reload;
-       char xlink;                                                                     // cross link state of a share repeater/remote radio
-       unsigned int statpost_seqno;
-
-       char *name;
-       char *rxchanname;
-       char *txchanname;
-       char remote;
-       char *remoterig;
-       struct  rpt_chan_stat chan_stat[NRPTSTAT];
-       unsigned int scram;
-
-       struct {
-               char *ourcontext;
-               char *ourcallerid;
-               char *acctcode;
-               char *ident;
-               char *tonezone;
-               char simple;
-               char *functions;
-               char *link_functions;
-               char *phone_functions;
-               char *dphone_functions;
-               char *alt_functions;
-               char *nodes;
-               char *extnodes;
-               char *extnodefile;
-               int hangtime;
-               int althangtime;
-               int totime;
-               int idtime;
-               int tailmessagetime;
-               int tailsquashedtime;
-               int duplex;
-               int politeid;
-               char *tailmessages[500];
-               int tailmessagemax;
-               char    *memory;
-               char    *macro;
-               char    *tonemacro;
-               char    *startupmacro;
-               int iobase;
-               char *ioport;
-               char funcchar;
-               char endchar;
-               char nobusyout;
-               char notelemtx;
-               char propagate_dtmf;
-               char propagate_phonedtmf;
-               char linktolink;
-               unsigned char civaddr;
-               struct rpt_xlat inxlat;
-               struct rpt_xlat outxlat;
-               char *archivedir;
-               int authlevel;
-               char *csstanzaname;
-               char *skedstanzaname;
-               char *txlimitsstanzaname;
-               long monminblocks;
-               int remoteinacttimeout;
-               int remotetimeout;
-               int remotetimeoutwarning;
-               int remotetimeoutwarningfreq;
-               int sysstate_cur;
-               struct sysstate s[MAX_SYSSTATES];
-               char parrotmode;
-               int parrottime;
-               char *rptnode;
-               char remote_mars;
-               int voxtimeout_ms;
-               int voxrecover_ms;
-               int simplexpatchdelay;
-               int simplexphonedelay;
-               char *statpost_program;
-               char *statpost_url;
-       } p;
-       struct rpt_link links;
-       int unkeytocttimer;
-       time_t lastkeyedtime;
-       time_t lasttxkeyedtime;
-       char keyed;
-       char txkeyed;
-       char exttx;
-       char localtx;
-       char remoterx;
-       char remotetx;
-       char remoteon;
-       char remtxfreqok;
-       char tounkeyed;
-       char tonotify;
-       char dtmfbuf[MAXDTMF];
-       char macrobuf[MAXMACRO];
-       char rem_dtmfbuf[MAXDTMF];
-       char lastdtmfcommand[MAXDTMF];
-       char cmdnode[50];
-       char nowchan;                                           // channel now
-       char waschan;                                           // channel selected initially or by command
-       char bargechan;                                         // barge in channel
-       char macropatch;                                        // autopatch via tonemacro state
-       char parrotstate;
-       int  parrottimer;
-       unsigned int parrotcnt;
-       struct ast_channel *rxchannel,*txchannel, *monchannel, *parrotchannel;
-       struct ast_channel *pchannel,*txpchannel, *dahdirxchannel, *dahditxchannel;
-       struct ast_channel *voxchannel;
-       struct ast_frame *lastf1,*lastf2;
-       struct rpt_tele tele;
-       struct timeval lasttv,curtv;
-       pthread_t rpt_call_thread,rpt_thread;
-       time_t dtmf_time,rem_dtmf_time,dtmf_time_rem;
-       int calldigittimer;
-       int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx,scantimer,tmsgtimer,skedtimer;
-       int mustid,tailid;
-       int tailevent;
-       int telemrefcount;
-       int dtmfidx,rem_dtmfidx;
-       int dailytxtime,dailykerchunks,totalkerchunks,dailykeyups,totalkeyups,timeouts;
-       int totalexecdcommands, dailyexecdcommands;
-       long    retxtimer;
-       long    rerxtimer;
-       long long totaltxtime;
-       char mydtmf;
-       char exten[AST_MAX_EXTENSION];
-       char freq[MAXREMSTR],rxpl[MAXREMSTR],txpl[MAXREMSTR];
-       char offset;
-       char powerlevel;
-       char txplon;
-       char rxplon;
-       char remmode;
-       char tunerequest;
-       char hfscanmode;
-       int hfscanstatus;
-       char hfscanstop;
-       char lastlinknode[MAXNODESTR];
-       char savednodes[MAXNODESTR];
-       int stopgen;
-       char patchfarenddisconnect;
-       char patchnoct;
-       char patchquiet;
-       char patchcontext[MAXPATCHCONTEXT];
-       int patchdialtime;
-       int macro_longest;
-       int phone_longestfunc;
-       int alt_longestfunc;
-       int dphone_longestfunc;
-       int link_longestfunc;
-       int longestfunc;
-       int longestnode;
-       int threadrestarts;             
-       int tailmessagen;
-       time_t disgorgetime;
-       time_t lastthreadrestarttime;
-       long    macrotimer;
-       char    lastnodewhichkeyedusup[MAXNODESTR];
-       int     dtmf_local_timer;
-       char    dtmf_local_str[100];
-       struct ast_filestream *monstream,*parrotstream;
-       char    loginuser[50];
-       char    loginlevel[10];
-       long    authtelltimer;
-       long    authtimer;
-       int iofd;
-       time_t start_time,last_activity_time;
-       char    lasttone[32];
-       struct rpt_tele *active_telem;
-       struct  rpt_topkey topkey[TOPKEYN];
-       int topkeystate;
-       time_t topkeytime;
-       int topkeylong;
-       struct vox vox;
-       char wasvox;
-       int voxtotimer;
-       char voxtostate;
-       int linkposttimer;                      
-       int keyposttimer;                       
-       char newkey;
-       char inpadtest;
-#ifdef OLD_ASTERISK
-       AST_LIST_HEAD(, ast_frame) txq;
-#else
-       AST_LIST_HEAD_NOLOCK(, ast_frame) txq;
-#endif
-       char txrealkeyed;
-#ifdef __RPT_NOTCH
-       struct rptfilter
-       {
-               char    desc[100];
-               float   x0;
-               float   x1;
-               float   x2;
-               float   y0;
-               float   y1;
-               float   y2;
-               float   gain;
-               float   const0;
-               float   const1;
-               float   const2;
-       } filters[MAXFILTERS];
-#endif
-#ifdef _MDC_DECODE_H_
-       mdc_decoder_t *mdc;
-       unsigned short lastunit;
-#endif
-       struct rpt_cmd_struct cmdAction;
-} rpt_vars[MAXRPTS];   
-
-struct nodelog {
-struct nodelog *next;
-struct nodelog *prev;
-time_t timestamp;
-char archivedir[MAXNODESTR];
-char str[MAXNODESTR * 2];
-} nodelog;
-
-static int service_scan(struct rpt *myrpt);
-static int set_mode_ft897(struct rpt *myrpt, char newmode);
-static int set_mode_ic706(struct rpt *myrpt, char newmode);
-static int simple_command_ft897(struct rpt *myrpt, char command);
-static int setrem(struct rpt *myrpt);
-static int setrtx_check(struct rpt *myrpt);
-static int channel_revert(struct rpt *myrpt);
-static int channel_steer(struct rpt *myrpt, char *data);
-static struct ast_format_cap *get_slin_cap(struct ast_format_cap *cap);
-
-AST_MUTEX_DEFINE_STATIC(nodeloglock);
-
-AST_MUTEX_DEFINE_STATIC(nodelookuplock);
-
-#ifdef APP_RPT_LOCK_DEBUG
-
-#warning COMPILING WITH LOCK-DEBUGGING ENABLED!!
-
-#define        MAXLOCKTHREAD 100
-
-#define rpt_mutex_lock(x) _rpt_mutex_lock(x,myrpt,__LINE__)
-#define rpt_mutex_unlock(x) _rpt_mutex_unlock(x,myrpt,__LINE__)
-
-struct lockthread
-{
-       pthread_t id;
-       int lockcount;
-       int lastlock;
-       int lastunlock;
-} lockthreads[MAXLOCKTHREAD];
-
-
-struct by_lightning
-{
-       int line;
-       struct timeval tv;
-       struct rpt *rpt;
-       struct lockthread lockthread;
-} lock_ring[32];
-
-int lock_ring_index = 0;
-
-AST_MUTEX_DEFINE_STATIC(locklock);
-
-static struct lockthread *get_lockthread(pthread_t id)
-{
-int    i;
-
-       for(i = 0; i < MAXLOCKTHREAD; i++)
-       {
-               if (lockthreads[i].id == id) return(&lockthreads[i]);
-       }
-       return(NULL);
-}
-
-static struct lockthread *put_lockthread(pthread_t id)
-{
-int    i;
-
-       for(i = 0; i < MAXLOCKTHREAD; i++)
-       {
-               if (lockthreads[i].id == id)
-                       return(&lockthreads[i]);
-       }
-       for(i = 0; i < MAXLOCKTHREAD; i++)
-       {
-               if (!lockthreads[i].id)
-               {
-                       lockthreads[i].lockcount = 0;
-                       lockthreads[i].lastlock = 0;
-                       lockthreads[i].lastunlock = 0;
-                       lockthreads[i].id = id;
-                       return(&lockthreads[i]);
-               }
-       }
-       return(NULL);
-}
-
-static void rpt_mutex_spew(void)
-{
-       struct by_lightning lock_ring_copy[32];
-       int lock_ring_index_copy;
-       int i,j;
-       long long diff;
-       char a[100];
-       struct timeval lasttv;
-
-       ast_mutex_lock(&locklock);
-       memcpy(&lock_ring_copy, &lock_ring, sizeof(lock_ring_copy));
-       lock_ring_index_copy = lock_ring_index;
-       ast_mutex_unlock(&locklock);
-
-       lasttv.tv_sec = lasttv.tv_usec = 0;
-       for(i = 0 ; i < 32 ; i++)
-       {
-               j = (i + lock_ring_index_copy) % 32;
-               strftime(a,sizeof(a) - 1,"%m/%d/%Y %H:%M:%S",
-                       localtime(&lock_ring_copy[j].tv.tv_sec));
-               diff = 0;
-               if(lasttv.tv_sec)
-               {
-                       diff = (lock_ring_copy[j].tv.tv_sec - lasttv.tv_sec)
-                               * 1000000;
-                       diff += (lock_ring_copy[j].tv.tv_usec - lasttv.tv_usec);
-               }
-               lasttv.tv_sec = lock_ring_copy[j].tv.tv_sec;
-               lasttv.tv_usec = lock_ring_copy[j].tv.tv_usec;
-               if (!lock_ring_copy[j].tv.tv_sec) continue;
-               if (lock_ring_copy[j].line < 0)
-               {
-                       ast_log(LOG_NOTICE,"LOCKDEBUG [#%d] UNLOCK app_rpt.c:%d node %s pid %x diff %lld us at %s.%06d\n",
-                               i - 31,-lock_ring_copy[j].line,lock_ring_copy[j].rpt->name,(int) lock_ring_copy[j].lockthread.id,diff,a,(int)lock_ring_copy[j].tv.tv_usec);
-               }
-               else
-               {
-                       ast_log(LOG_NOTICE,"LOCKDEBUG [#%d] LOCK app_rpt.c:%d node %s pid %x diff %lld us at %s.%06d\n",
-                               i - 31,lock_ring_copy[j].line,lock_ring_copy[j].rpt->name,(int) lock_ring_copy[j].lockthread.id,diff,a,(int)lock_ring_copy[j].tv.tv_usec);
-               }
-       }
-}
-
-
-static void _rpt_mutex_lock(ast_mutex_t *lockp, struct rpt *myrpt, int line)
-{
-struct lockthread *t;
-pthread_t id;
-
-       id = pthread_self();
-       ast_mutex_lock(&locklock);
-       t = put_lockthread(id);
-       if (!t)
-       {
-               ast_mutex_unlock(&locklock);
-               return;
-       }
-       if (t->lockcount)
-       {
-               int lastline = t->lastlock;
-               ast_mutex_unlock(&locklock);
-               ast_log(LOG_NOTICE,"rpt_mutex_lock: Double lock request line %d node %s pid %x, last lock was line %d\n",line,myrpt->name,(int) t->id,lastline);
-               rpt_mutex_spew();
-               return;
-       }
-       t->lastlock = line;
-       t->lockcount = 1;
-       gettimeofday(&lock_ring[lock_ring_index].tv, NULL);
-       lock_ring[lock_ring_index].rpt = myrpt;
-       memcpy(&lock_ring[lock_ring_index].lockthread,t,sizeof(struct lockthread));
-       lock_ring[lock_ring_index++].line = line;
-       if(lock_ring_index == 32)
-               lock_ring_index = 0;
-       ast_mutex_unlock(&locklock);
-       ast_mutex_lock(lockp);
-}
-
-
-static void _rpt_mutex_unlock(ast_mutex_t *lockp, struct rpt *myrpt, int line)
-{
-struct lockthread *t;
-pthread_t id;
-
-       id = pthread_self();
-       ast_mutex_lock(&locklock);
-       t = put_lockthread(id);
-       if (!t)
-       {
-               ast_mutex_unlock(&locklock);
-               return;
-       }
-       if (!t->lockcount)
-       {
-               int lastline = t->lastunlock;
-               ast_mutex_unlock(&locklock);
-               ast_log(LOG_NOTICE,"rpt_mutex_lock: Double un-lock request line %d node %s pid %x, last un-lock was line %d\n",line,myrpt->name,(int) t->id,lastline);
-               rpt_mutex_spew();
-               return;
-       }
-       t->lastunlock = line;
-       t->lockcount = 0;
-       gettimeofday(&lock_ring[lock_ring_index].tv, NULL);
-       lock_ring[lock_ring_index].rpt = myrpt;
-       memcpy(&lock_ring[lock_ring_index].lockthread,t,sizeof(struct lockthread));
-       lock_ring[lock_ring_index++].line = -line;
-       if(lock_ring_index == 32)
-               lock_ring_index = 0;
-       ast_mutex_unlock(&locklock);
-       ast_mutex_unlock(lockp);
-}
-
-#else  /* APP_RPT_LOCK_DEBUG */
-
-#define rpt_mutex_lock(x) ast_mutex_lock(x)
-#define rpt_mutex_unlock(x) ast_mutex_unlock(x)
-
-#endif  /* APP_RPT_LOCK_DEBUG */
-
-static struct ast_format_cap *get_slin_cap(struct ast_format_cap *cap)
-{
-       struct ast_format tmp;
-       cap = ast_format_cap_alloc_nolock();
-       if (!cap) {
-               return NULL;
-       }
-       ast_format_cap_add(cap, ast_format_set(&tmp, AST_FORMAT_SLINEAR, 0));
-
-       return cap;
-}
-
-/*
-* Return 1 if rig is multimode capable
-*/
-
-static int multimode_capable(struct rpt *myrpt)
-{
-       if(!strcmp(myrpt->remoterig, remote_rig_ft897))
-               return 1;
-       if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-               return 1;
-       return 0;
-}      
-
-static void voxinit_rpt(struct rpt *myrpt,char enable)
-{
-
-       myrpt->vox.speech_energy = 0.0;
-       myrpt->vox.noise_energy = 0.0;
-       myrpt->vox.enacount = 0;
-       myrpt->vox.voxena = 0;
-       if (!enable) myrpt->vox.voxena = -1;
-       myrpt->vox.lastvox = 0;
-       myrpt->vox.ondebcnt = VOX_ON_DEBOUNCE_COUNT;
-       myrpt->vox.offdebcnt = VOX_OFF_DEBOUNCE_COUNT;
-       myrpt->wasvox = 0;
-       myrpt->voxtotimer = 0;
-       myrpt->voxtostate = 0;
-}
-
-static void voxinit_link(struct rpt_link *mylink,char enable)
-{
-
-       mylink->vox.speech_energy = 0.0;
-       mylink->vox.noise_energy = 0.0;
-       mylink->vox.enacount = 0;
-       mylink->vox.voxena = 0;
-       if (!enable) mylink->vox.voxena = -1;
-       mylink->vox.lastvox = 0;
-       mylink->vox.ondebcnt = VOX_ON_DEBOUNCE_COUNT;
-       mylink->vox.offdebcnt = VOX_OFF_DEBOUNCE_COUNT;
-       mylink->wasvox = 0;
-       mylink->voxtotimer = 0;
-       mylink->voxtostate = 0;
-}
-
-static int dovox(struct vox *v,short *buf,int bs)
-{
-
-       int i;
-       float   esquare = 0.0;
-       float   energy = 0.0;
-       float   threshold = 0.0;
-       
-       if (v->voxena < 0) return(v->lastvox);
-       for(i = 0; i < bs; i++)
-       {
-               esquare += (float) buf[i] * (float) buf[i];
-       }
-       energy = sqrt(esquare);
-
-       if (energy >= v->speech_energy)
-               v->speech_energy += (energy - v->speech_energy) / 4;
-       else
-               v->speech_energy += (energy - v->speech_energy) / 64;
-
-       if (energy >= v->noise_energy)
-               v->noise_energy += (energy - v->noise_energy) / 64;
-       else
-               v->noise_energy += (energy - v->noise_energy) / 4;
-       
-       if (v->voxena) threshold = v->speech_energy / 8;
-       else
-       {
-               threshold = mymax(v->speech_energy / 16,v->noise_energy * 2);
-               threshold = mymin(threshold,VOX_MAX_THRESHOLD);
-       }
-       threshold = mymax(threshold,VOX_MIN_THRESHOLD);
-       if (energy > threshold)
-       {
-               if (v->voxena) v->noise_energy *= 0.75;
-               v->voxena = 1;
-       } else  v->voxena = 0;
-       if (v->lastvox != v->voxena)
-       {
-               if (v->enacount++ >= ((v->lastvox) ? v->offdebcnt : v->ondebcnt))
-               {
-                       v->lastvox = v->voxena;
-                       v->enacount = 0;
-               }
-       } else v->enacount = 0;
-       return(v->lastvox);
-}
-
-
-
-
-/*
-* CLI extensions
-*/
-
-/* Debug mode */
-static int rpt_do_debug(int fd, int argc, const char * const *argv);
-static int rpt_do_dump(int fd, int argc, const char * const *argv);
-static int rpt_do_stats(int fd, int argc, const char * const *argv);
-static int rpt_do_lstats(int fd, int argc, const char * const *argv);
-static int rpt_do_nodes(int fd, int argc, const char * const *argv);
-static int rpt_do_local_nodes(int fd, int argc, const char * const *argv);
-static int rpt_do_reload(int fd, int argc, const char * const *argv);
-static int rpt_do_restart(int fd, int argc, const char * const *argv);
-static int rpt_do_fun(int fd, int argc, const char * const *argv);
-static int rpt_do_fun1(int fd, int argc, const char * const *argv);
-static int rpt_do_cmd(int fd, int argc, const char * const *argv);
-
-static char debug_usage[] =
-"Usage: rpt debug level {0-7}\n"
-"       Enables debug messages in app_rpt\n";
-
-static char dump_usage[] =
-"Usage: rpt dump <nodename>\n"
-"       Dumps struct debug info to log\n";
-
-static char dump_stats[] =
-"Usage: rpt stats <nodename>\n"
-"       Dumps node statistics to console\n";
-
-static char dump_lstats[] =
-"Usage: rpt lstats <nodename>\n"
-"       Dumps link statistics to console\n";
-
-static char dump_nodes[] =
-"Usage: rpt nodes <nodename>\n"
-"       Dumps a list of directly and indirectly connected nodes to the console\n";
-
-static char usage_local_nodes[] =
-"Usage: rpt localnodes\n"
-"       Dumps a list of the locally configured node numbers to the console.\n";
-
-static char reload_usage[] =
-"Usage: rpt reload\n"
-"       Reloads app_rpt running config parameters\n";
-
-static char restart_usage[] =
-"Usage: rpt restart\n"
-"       Restarts app_rpt\n";
-
-static char fun_usage[] =
-"Usage: rpt fun <nodename> <command>\n"
-"       Send a DTMF function to a node\n";
-
-static char cmd_usage[] =
-"Usage: rpt cmd <nodename> <cmd-name> <cmd-index> <cmd-args.\n"
-"       Send a command to a node.\n        i.e. rpt cmd 2000 ilink 3 2001\n";
-
-#ifndef        NEW_ASTERISK
-
-static struct ast_cli_entry  cli_debug =
-        { { "rpt", "debug", "level" }, rpt_do_debug, 
-               "Enable app_rpt debugging", debug_usage };
-
-static struct ast_cli_entry  cli_dump =
-        { { "rpt", "dump" }, rpt_do_dump,
-               "Dump app_rpt structs for debugging", dump_usage };
-
-static struct ast_cli_entry  cli_stats =
-        { { "rpt", "stats" }, rpt_do_stats,
-               "Dump node statistics", dump_stats };
-
-static struct ast_cli_entry  cli_nodes =
-        { { "rpt", "nodes" }, rpt_do_nodes,
-               "Dump node list", dump_nodes };
-
-static struct ast_cli_entry  cli_local_nodes =
-        { { "rpt", "localnodes" }, rpt_do_local_nodes,
-               "Dump list of local node numbers", usage_local_nodes };
-
-static struct ast_cli_entry  cli_lstats =
-        { { "rpt", "lstats" }, rpt_do_lstats,
-               "Dump link statistics", dump_lstats };
-
-static struct ast_cli_entry  cli_reload =
-        { { "rpt", "reload" }, rpt_do_reload,
-               "Reload app_rpt config", reload_usage };
-
-static struct ast_cli_entry  cli_restart =
-        { { "rpt", "restart" }, rpt_do_restart,
-               "Restart app_rpt", restart_usage };
-
-static struct ast_cli_entry  cli_fun =
-        { { "rpt", "fun" }, rpt_do_fun,
-               "Execute a DTMF function", fun_usage };
-
-static struct ast_cli_entry  cli_fun1 =
-        { { "rpt", "fun1" }, rpt_do_fun1,
-               "Execute a DTMF function", fun_usage };
-
-static struct ast_cli_entry  cli_cmd =
-        { { "rpt", "cmd" }, rpt_do_cmd,
-               "Execute a DTMF function", cmd_usage };
-
-#endif
-
-/*
-* Telemetry defaults
-*/
-
-
-static struct telem_defaults tele_defs[] = {
-       {"ct1","|t(350,0,100,3072)(500,0,100,3072)(660,0,100,3072)"},
-       {"ct2","|t(660,880,150,3072)"},
-       {"ct3","|t(440,0,150,3072)"},
-       {"ct4","|t(550,0,150,3072)"},
-       {"ct5","|t(660,0,150,3072)"},
-       {"ct6","|t(880,0,150,3072)"},
-       {"ct7","|t(660,440,150,3072)"},
-       {"ct8","|t(700,1100,150,3072)"},
-       {"remotemon","|t(1600,0,75,2048)"},
-       {"remotetx","|t(2000,0,75,2048)(0,0,75,0)(1600,0,75,2048)"},
-       {"cmdmode","|t(900,904,200,2048)"},
-       {"functcomplete","|t(1000,0,100,2048)(0,0,100,0)(1000,0,100,2048)"}
-} ;
-
-/*
-* Forward decl's - these suppress compiler warnings when funcs coded further down the file than thier invokation
-*/
-
-static int setrbi(struct rpt *myrpt);
-static int set_ft897(struct rpt *myrpt);
-static int set_ic706(struct rpt *myrpt);
-static int setkenwood(struct rpt *myrpt);
-static int set_tm271(struct rpt *myrpt);
-static int setrbi_check(struct rpt *myrpt);
-
-
-
-/*
-* Define function protos for function table here
-*/
-
-static int function_ilink(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_autopatchup(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_autopatchdn(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_status(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_cop(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_remote(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_macro(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-static int function_playback(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink);
-/*
-* Function table
-*/
-
-static struct function_table_tag function_table[] = {
-       {"cop", function_cop},
-       {"autopatchup", function_autopatchup},
-       {"autopatchdn", function_autopatchdn},
-       {"ilink", function_ilink},
-       {"status", function_status},
-       {"remote", function_remote},
-       {"macro", function_macro},
-       {"playback", function_playback}
-} ;
-
-static long diskavail(struct rpt *myrpt)
-{
-struct statfs statfsbuf;
-
-       if (!myrpt->p.archivedir) return(0);
-       if (statfs(myrpt->p.archivedir,&statfsbuf) == -1)
-       {
-               ast_log(LOG_WARNING,"Cannot get filesystem size for %s node %s\n",
-                       myrpt->p.archivedir,myrpt->name);
-               return(-1);
-       }
-       return(statfsbuf.f_bavail);
-}
-
-static void flush_telem(struct rpt *myrpt)
-{
-       struct rpt_tele *telem;
-       if(debug > 2)
-               ast_log(LOG_NOTICE, "flush_telem()!!");
-       rpt_mutex_lock(&myrpt->lock);
-       telem = myrpt->tele.next;
-       while(telem != &myrpt->tele)
-       {
-               if (telem->mode != SETREMOTE) ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV);
-               telem = telem->next;
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-}
-/*
-       return via error priority
-*/
-static int priority_jump(struct rpt *myrpt, struct ast_channel *chan)
-{
-       int res=0;
-
-       // if (ast_test_flag(&flags,OPT_JUMP) && ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101) == 0){
-       if (ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101) == 0){
-               res = 0;
-       } else {
-               res = -1;
-       }
-       return res;
-}
-/*
-*/
-static int linkcount(struct rpt *myrpt)
-{
-       struct  rpt_link *l;
-       int numoflinks;
-
-       numoflinks = 0;
-       l = myrpt->links.next;
-       while(l && (l != &myrpt->links)){
-               if(numoflinks >= MAX_STAT_LINKS){
-                       ast_log(LOG_WARNING,
-                       "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS);
-                       break;
-               }
-               numoflinks++;
-
-               l = l->next;
-       }
-       ast_log(LOG_NOTICE, "numoflinks=%i\n",numoflinks);
-       return numoflinks;
-}
-/*
- * Retrieve a memory channel
- * Return 0 if sucessful,
- * -1 if channel not found,
- *  1 if parse error
- */
-static int retreive_memory(struct rpt *myrpt, char *memory)
-{
-       char tmp[30], *s, *s1, *val;
-
-       if (debug)ast_log(LOG_NOTICE, "memory=%s block=%s\n",memory,myrpt->p.memory);
-
-       val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.memory, memory);
-       if (!val){
-               return -1;
-       }                       
-       strncpy(tmp,val,sizeof(tmp) - 1);
-       tmp[sizeof(tmp)-1] = 0;
-
-       s = strchr(tmp,',');
-       if (!s)
-               return 1; 
-       *s++ = 0;
-       s1 = strchr(s,',');
-       if (!s1)
-               return 1;
-       *s1++ = 0;
-       strncpy(myrpt->freq, tmp, sizeof(myrpt->freq) - 1);
-       strncpy(myrpt->rxpl, s, sizeof(myrpt->rxpl) - 1);
-       strncpy(myrpt->txpl, s, sizeof(myrpt->rxpl) - 1);
-       myrpt->remmode = REM_MODE_FM;
-       myrpt->offset = REM_SIMPLEX;
-       myrpt->powerlevel = REM_MEDPWR;
-       myrpt->txplon = myrpt->rxplon = 0;
-       while(*s1){
-               switch(*s1++){
-                       case 'A':
-                       case 'a':
-                               strcpy(myrpt->rxpl, "100.0");
-                               strcpy(myrpt->txpl, "100.0");
-                               myrpt->remmode = REM_MODE_AM;   
-                               break;
-                       case 'B':
-                       case 'b':
-                               strcpy(myrpt->rxpl, "100.0");
-                               strcpy(myrpt->txpl, "100.0");
-                               myrpt->remmode = REM_MODE_LSB;
-                               break;
-                       case 'F':
-                               myrpt->remmode = REM_MODE_FM;
-                               break;
-                       case 'L':
-                       case 'l':
-                               myrpt->powerlevel = REM_LOWPWR;
-                               break;                                  
-                       case 'H':
-                       case 'h':
-                               myrpt->powerlevel = REM_HIPWR;
-                               break;
-                                       
-                       case 'M':
-                       case 'm':
-                               myrpt->powerlevel = REM_MEDPWR;
-                               break;
-                                               
-                       case '-':
-                               myrpt->offset = REM_MINUS;
-                               break;
-                                               
-                       case '+':
-                               myrpt->offset = REM_PLUS;
-                               break;
-                                               
-                       case 'S':
-                       case 's':
-                               myrpt->offset = REM_SIMPLEX;
-                               break;
-                                               
-                       case 'T':
-                       case 't':
-                               myrpt->txplon = 1;
-                               break;
-                                               
-                       case 'R':
-                       case 'r':
-                               myrpt->rxplon = 1;
-                               break;
-
-                       case 'U':
-                       case 'u':
-                               strcpy(myrpt->rxpl, "100.0");
-                               strcpy(myrpt->txpl, "100.0");
-                               myrpt->remmode = REM_MODE_USB;
-                               break;
-                       default:
-                               return 1;
-               }
-       }
-       return 0;
-}
-/*
-
-*/
-static void birdbath(struct rpt *myrpt)
-{
-       struct rpt_tele *telem;
-       if(debug > 2)
-               ast_log(LOG_NOTICE, "birdbath!!");
-       rpt_mutex_lock(&myrpt->lock);
-       telem = myrpt->tele.next;
-       while(telem != &myrpt->tele)
-       {
-               if (telem->mode == PARROT) ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV);
-               telem = telem->next;
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-}
-
-static void do_dtmf_phone(struct rpt *myrpt, struct rpt_link *mylink, char c)
-{
-struct        rpt_link *l;
-
-       l = myrpt->links.next;
-       /* go thru all the links */
-       while(l != &myrpt->links)
-       {
-               if (!l->phonemode)
-               {
-                       l = l->next;
-                       continue;
-               }
-               /* don't send to self */
-               if (mylink && (l == mylink))
-               {
-                       l = l->next;
-                       continue;
-               }
-#ifdef NEW_ASTERISK
-               if (l->chan) ast_senddigit(l->chan,c,0);
-#else
-               if (l->chan) ast_senddigit(l->chan,c);
-#endif
-               l = l->next;
-       }
-       return;
-}
-
-/* node logging function */
-static void donodelog(struct rpt *myrpt,char *str)
-{
-struct nodelog *nodep;
-char   datestr[100];
-
-       if (!myrpt->p.archivedir) return;
-       nodep = (struct nodelog *)ast_malloc(sizeof(struct nodelog));
-       if (nodep == NULL)
-       {
-               ast_log(LOG_ERROR,"Cannot get memory for node log");
-               return;
-       }
-       time(&nodep->timestamp);
-       strncpy(nodep->archivedir,myrpt->p.archivedir,
-               sizeof(nodep->archivedir) - 1);
-       strftime(datestr,sizeof(datestr) - 1,"%Y%m%d%H%M%S",
-               localtime(&nodep->timestamp));
-       snprintf(nodep->str,sizeof(nodep->str) - 1,"%s %s,%s\n",
-               myrpt->name,datestr,str);
-       ast_mutex_lock(&nodeloglock);
-       insque((struct qelem *) nodep, (struct qelem *) nodelog.prev);
-       ast_mutex_unlock(&nodeloglock);
-}
-
-/* must be called locked */
-static void do_dtmf_local(struct rpt *myrpt, char c)
-{
-int    i;
-char   digit;
-static const char* dtmf_tones[] = {
-       "!941+1336/200,!0/200", /* 0 */
-       "!697+1209/200,!0/200", /* 1 */
-       "!697+1336/200,!0/200", /* 2 */
-       "!697+1477/200,!0/200", /* 3 */
-       "!770+1209/200,!0/200", /* 4 */
-       "!770+1336/200,!0/200", /* 5 */
-       "!770+1477/200,!0/200", /* 6 */
-       "!852+1209/200,!0/200", /* 7 */
-       "!852+1336/200,!0/200", /* 8 */
-       "!852+1477/200,!0/200", /* 9 */
-       "!697+1633/200,!0/200", /* A */
-       "!770+1633/200,!0/200", /* B */
-       "!852+1633/200,!0/200", /* C */
-       "!941+1633/200,!0/200", /* D */
-       "!941+1209/200,!0/200", /* * */
-       "!941+1477/200,!0/200" };       /* # */
-
-
-       if (c)
-       {
-               snprintf(myrpt->dtmf_local_str + strlen(myrpt->dtmf_local_str),sizeof(myrpt->dtmf_local_str) - 1,"%c",c);
-               if (!myrpt->dtmf_local_timer) 
-                        myrpt->dtmf_local_timer = DTMF_LOCAL_STARTTIME;
-       }
-       /* if at timeout */
-       if (myrpt->dtmf_local_timer == 1)
-       {
-               if(debug > 6)
-                       ast_log(LOG_NOTICE,"time out dtmf_local_timer=%i\n",myrpt->dtmf_local_timer);
-
-               /* if anything in the string */
-               if (myrpt->dtmf_local_str[0])
-               {
-                       digit = myrpt->dtmf_local_str[0];
-                       myrpt->dtmf_local_str[0] = 0;
-                       for(i = 1; myrpt->dtmf_local_str[i]; i++)
-                       {
-                               myrpt->dtmf_local_str[i - 1] =
-                                       myrpt->dtmf_local_str[i];
-                       }
-                       myrpt->dtmf_local_str[i - 1] = 0;
-                       myrpt->dtmf_local_timer = DTMF_LOCAL_TIME;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       if (digit >= '0' && digit <='9')
-                               ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[digit-'0'], 0);
-                       else if (digit >= 'A' && digit <= 'D')
-                               ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[digit-'A'+10], 0);
-                       else if (digit == '*')
-                               ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[14], 0);
-                       else if (digit == '#')
-                               ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[15], 0);
-                       else {
-                               /* not handled */
-                               ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name);
-                       }
-                       rpt_mutex_lock(&myrpt->lock);
-               }
-               else
-               {
-                       myrpt->dtmf_local_timer = 0;
-               }
-       }
-}
-
-static int setdtr(int fd, int enable)
-{
-struct termios mode;
-
-       if (fd < 0) return -1;
-       if (tcgetattr(fd, &mode)) {
-               ast_log(LOG_WARNING, "Unable to get serial parameters for dtr: %s\n", strerror(errno));
-               return -1;
-       }
-       if (enable)
-       {
-               cfsetspeed(&mode, B9600);
-       }
-       else
-       {
-               cfsetspeed(&mode, B0);
-               usleep(100000);
-       }
-       if (tcsetattr(fd, TCSADRAIN, &mode)) {
-               ast_log(LOG_WARNING, "Unable to set serial parameters for dtr: %s\n", strerror(errno));
-               return -1;
-       }
-       if (enable) usleep(100000);
-       return 0;
-}
-
-static int openserial(struct rpt *myrpt,char *fname)
-{
-       struct termios mode;
-       int fd;
-
-       fd = open(fname,O_RDWR);
-       if (fd == -1)
-       {
-               ast_log(LOG_WARNING,"Cannot open serial port %s\n",fname);
-               return -1;
-       }
-       memset(&mode, 0, sizeof(mode));
-       if (tcgetattr(fd, &mode)) {
-               ast_log(LOG_WARNING, "Unable to get serial parameters on %s: %s\n", fname, strerror(errno));
-               return -1;
-       }
-#ifndef        SOLARIS
-       cfmakeraw(&mode);
-#else
-        mode.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
-                        |INLCR|IGNCR|ICRNL|IXON);
-        mode.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
-        mode.c_cflag &= ~(CSIZE|PARENB|CRTSCTS);
-        mode.c_cflag |= CS8;
-       mode.c_cc[VTIME] = 3;
-       mode.c_cc[VMIN] = 1; 
-#endif
-
-       cfsetispeed(&mode, B9600);
-       cfsetospeed(&mode, B9600);
-       if (tcsetattr(fd, TCSANOW, &mode)) 
-               ast_log(LOG_WARNING, "Unable to set serial parameters on %s: %s\n", fname, strerror(errno));
-       if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) setdtr(fd,0); 
-       usleep(100000);
-       if (debug)ast_log(LOG_NOTICE,"Opened serial port %s\n",fname);
-       return(fd);     
-}
-
-static void mdc1200_notify(struct rpt *myrpt,char *fromnode, unsigned int unit)
-{
-       if (!fromnode)
-       {
-               ast_verbose("Got MDC-1200 ID %04X from local system (%s)\n",
-                       unit,myrpt->name);
-       }
-       else
-       {
-               ast_verbose("Got MDC-1200 ID %04X from node %s (%s)\n",
-                       unit,fromnode,myrpt->name);
-       }
-}
-
-#ifdef _MDC_DECODE_H_
-
-static void mdc1200_send(struct rpt *myrpt, unsigned int unit)
-{
-struct rpt_link *l;
-struct ast_frame wf;
-char   str[200];
-
-
-       sprintf(str,"I %s %04X",myrpt->name,unit);
-
-       wf.frametype = AST_FRAME_TEXT;
-       wf.subclass.integer = 0;
-       wf.offset = 0;
-       wf.mallocd = 0;
-       wf.datalen = strlen(str) + 1;
-       wf.samples = 0;
-
-
-       l = myrpt->links.next;
-       /* otherwise, send it to all of em */
-       while(l != &myrpt->links)
-       {
-               if (l->name[0] == '0') 
-               {
-                       l = l->next;
-                       continue;
-               }
-               wf.data = str;
-               if (l->chan) ast_write(l->chan,&wf); 
-               l = l->next;
-       }
-       return;
-}
-
-#endif
-
-static char func_xlat(struct rpt *myrpt,char c,struct rpt_xlat *xlat)
-{
-time_t now;
-int    gotone;
-
-       time(&now);
-       gotone = 0;
-       /* if too much time, reset the skate machine */
-       if ((now - xlat->lastone) > MAXXLATTIME)
-       {
-               xlat->funcindex = xlat->endindex = 0;
-       }
-       if (xlat->funccharseq[0] && (c == xlat->funccharseq[xlat->funcindex++]))
-       {
-               time(&xlat->lastone);
-               gotone = 1;
-               if (!xlat->funccharseq[xlat->funcindex])
-               {
-                       xlat->funcindex = xlat->endindex = 0;
-                       return(myrpt->p.funcchar);
-               }
-       } else xlat->funcindex = 0;
-       if (xlat->endcharseq[0] && (c == xlat->endcharseq[xlat->endindex++]))
-       {
-               time(&xlat->lastone);
-               gotone = 1;
-               if (!xlat->endcharseq[xlat->endindex])
-               {
-                       xlat->funcindex = xlat->endindex = 0;
-                       return(myrpt->p.endchar);
-               }
-       } else xlat->endindex = 0;
-       /* if in middle of decode seq, send nothing back */
-       if (gotone) return(0);
-       /* if no pass chars specified, return em all */
-       if (!xlat->passchars[0]) return(c);
-       /* if a "pass char", pass it */
-       if (strchr(xlat->passchars,c)) return(c);
-       return(0);
-}
-
-/*
- * Return a pointer to the first non-whitespace character
- */
-
-static char *eatwhite(char *s)
-{
-       while((*s == ' ') || (*s == 0x09)){ /* get rid of any leading white space */
-               if(!*s)
-                       break;
-               s++;
-       }
-       return s;
-}
-
-/*
-* Break up a delimited string into a table of substrings
-*
-* str - delimited string ( will be modified )
-* strp- list of pointers to substrings (this is built by this function), NULL will be placed at end of list
-* limit- maximum number of substrings to process
-*/
-       
-
-
-static int finddelim(char *str, char *strp[], int limit)
-{
-int     i,l,inquo;
-
-        inquo = 0;
-        i = 0;
-        strp[i++] = str;
-        if (!*str)
-           {
-                strp[0] = 0;
-                return(0);
-           }
-        for(l = 0; *str && (l < limit) ; str++)
-           {
-                if (*str == QUOTECHR)
-                   {
-                        if (inquo)
-                           {
-                                *str = 0;
-                                inquo = 0;
-                           }
-                        else
-                           {
-                                strp[i - 1] = str + 1;
-                                inquo = 1;
-                           }
-               }
-                if ((*str == DELIMCHR) && (!inquo))
-                {
-                        *str = 0;
-                       l++;
-                        strp[i++] = str + 1;
-                }
-           }
-        strp[i] = 0;
-        return(i);
-
-}
-/*
-       send asterisk frame text message on the current tx channel
-*/
-static int send_usb_txt(struct rpt *myrpt, char *txt) 
-{
-       struct ast_frame wf;
-       if (debug)ast_log(LOG_NOTICE, "send_usb_txt %s\n",txt);
-       wf.frametype = AST_FRAME_TEXT;
-       wf.subclass.integer = 0;
-       wf.offset = 0;
-       wf.mallocd = 0;
-       wf.datalen = strlen(txt) + 1;
-       wf.data.ptr = txt;
-       wf.samples = 0;
-       ast_write(myrpt->txchannel,&wf); 
-       return 0;
-}
-/* must be called locked */
-static void __mklinklist(struct rpt *myrpt, struct rpt_link *mylink, char *buf)
-{
-struct rpt_link *l;
-char mode;
-int    i,spos;
-
-       buf[0] = 0; /* clear output buffer */
-       if (myrpt->remote) return;
-       /* go thru all links */
-       for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
-       {
-               /* if is not a real link, ignore it */
-               if (l->name[0] == '0') continue;
-               /* don't count our stuff */
-               if (l == mylink) continue;
-               if (mylink && (!strcmp(l->name,mylink->name))) continue;
-               /* figure out mode to report */
-               mode = 'T'; /* use Tranceive by default */
-               if (!l->mode) mode = 'R'; /* indicate RX for our mode */
-               if (!l->thisconnected)  mode = 'C'; /* indicate connecting */
-               spos = strlen(buf); /* current buf size (b4 we add our stuff) */
-               if (spos)
-               {
-                       strcat(buf,",");
-                       spos++;
-               }
-               /* add nodes into buffer */
-               if (l->linklist[0])
-               {
-                       snprintf(buf + spos,MAXLINKLIST - spos,
-                               "%c%s,%s",mode,l->name,l->linklist);
-               }
-               else /* if no nodes, add this node into buffer */
-               {
-                       snprintf(buf + spos,MAXLINKLIST - spos,
-                               "%c%s",mode,l->name);
-               }
-               /* if we are in tranceive mode, let all modes stand */
-               if (mode == 'T') continue;
-               /* downgrade everyone on this node if appropriate */
-               for(i = spos; buf[i]; i++)
-               {
-                       if (buf[i] == 'T') buf[i] = mode;
-                       if ((buf[i] == 'R') && (mode == 'C')) buf[i] = mode;
-               }
-       }
-       return;
-}
-
-/* must be called locked */
-static void __kickshort(struct rpt *myrpt)
-{
-struct rpt_link *l;
-
-       for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
-       {
-               /* if is not a real link, ignore it */
-               if (l->name[0] == '0') continue;
-               l->linklisttimer = LINKLISTSHORTTIME;
-       }
-       myrpt->linkposttimer = LINKPOSTSHORTTIME;
-       return;
-}
-
-static void statpost(struct rpt *myrpt,char *pairs)
-{
-char *str,*astr;
-char *astrs[100];
-int    n,pid;
-time_t now;
-unsigned int seq;
-
-       if (!myrpt->p.statpost_url) return;
-       str = ast_malloc(strlen(pairs) + strlen(myrpt->p.statpost_url) + 200);
-       astr = ast_strdup(myrpt->p.statpost_program);
-       if ((!str) || (!astr)) {
-               ast_free(str);
-               ast_free(astr);
-               return;
-       }
-       n = finddelim(astr,astrs,100);
-       if (n < 1) {
-               ast_free(str);
-               ast_free(astr);
-               return;
-       }
-       ast_mutex_lock(&myrpt->statpost_lock);
-       seq = ++myrpt->statpost_seqno;
-       ast_mutex_unlock(&myrpt->statpost_lock);
-       astrs[n++] = str;
-       astrs[n] = NULL;
-       time(&now);
-       sprintf(str,"%s?node=%s&time=%u&seqno=%u",myrpt->p.statpost_url,
-               myrpt->name,(unsigned int) now,seq);
-       if (pairs) sprintf(str + strlen(str),"&%s",pairs);
-       if (!(pid = ast_safe_fork(0)))
-       {
-               execv(astrs[0],astrs);
-               ast_log(LOG_ERROR, "exec of %s failed.\n", astrs[0]);
-               perror("asterisk");
-               exit(0);
-       }
-       ast_free(astr);
-       ast_free(str);
-       return;
-}
-
-static char *node_lookup(struct rpt *myrpt,char *digitbuf)
-{
-
-char *val;
-int longestnode,j;
-struct stat mystat;
-static time_t last = 0;
-static struct ast_config *ourcfg = NULL;
-struct ast_variable *vp;
-
-       /* try to look it up locally first */
-       val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.nodes, digitbuf);
-       if (val) return(val);
-       ast_mutex_lock(&nodelookuplock);
-       /* if file does not exist */
-       if (stat(myrpt->p.extnodefile,&mystat) == -1)
-       {
-               if (ourcfg) ast_config_destroy(ourcfg);
-               ourcfg = NULL;
-               ast_mutex_unlock(&nodelookuplock);
-               return(NULL);
-       }
-       /* if we need to reload */
-       if (mystat.st_mtime > last)
-       {
-               if (ourcfg) ast_config_destroy(ourcfg);
-#ifdef NEW_ASTERISK
-               ourcfg = ast_config_load(myrpt->p.extnodefile,config_flags);
-#else
-               ourcfg = ast_config_load(myrpt->p.extnodefile);
-#endif
-               /* if file not there, just bail */
-               if (!ourcfg || ourcfg == CONFIG_STATUS_FILEINVALID)
-               {
-                       ast_mutex_unlock(&nodelookuplock);
-                       return(NULL);
-               }
-               /* reset "last" time */
-               last = mystat.st_mtime;
-
-               /* determine longest node length again */               
-               longestnode = 0;
-               vp = ast_variable_browse(myrpt->cfg, myrpt->p.nodes);
-               while(vp){
-                       j = strlen(vp->name);
-                       if (j > longestnode)
-                               longestnode = j;
-                       vp = vp->next;
-               }
-
-               vp = ast_variable_browse(ourcfg, myrpt->p.extnodes);
-               while(vp){
-                       j = strlen(vp->name);
-                       if (j > longestnode)
-                               longestnode = j;
-                       vp = vp->next;
-               }
-
-               myrpt->longestnode = longestnode;
-       }
-       val = NULL;
-       if (ourcfg)
-               val = (char *) ast_variable_retrieve(ourcfg, myrpt->p.extnodes, digitbuf);
-       ast_mutex_unlock(&nodelookuplock);
-       return(val);
-}
-
-/*
-* Match a keyword in a list, and return index of string plus 1 if there was a match,* else return 0.
-* If param is passed in non-null, then it will be set to the first character past the match
-*/
-
-static int matchkeyword(char *string, char **param, char *keywords[])
-{
-int    i,ls;
-       for( i = 0 ; keywords[i] ; i++){
-               ls = strlen(keywords[i]);
-               if(!ls){
-                       *param = NULL;
-                       return 0;
-               }
-               if(!strncmp(string, keywords[i], ls)){
-                       if(param)
-                               *param = string + ls;
-                       return i + 1; 
-               }
-       }
-       *param = NULL;
-       return 0;
-}
-
-/*
-* Skip characters in string which are in charlist, and return a pointer to the
-* first non-matching character
-*/
-
-static char *skipchars(char *string, char *charlist)
-{
-int i; 
-       while(*string){
-               for(i = 0; charlist[i] ; i++){
-                       if(*string == charlist[i]){
-                               string++;
-                               break;
-                       }
-               }
-               if(!charlist[i])
-                       return string;
-       }
-       return string;
-}
-
-static int myatoi(const char *str)
-{
-       int     ret;
-
-       if (!str) {
-               return -1;
-       }
-
-       /* leave this %i alone, non-base-10 input is useful here */
-       if (sscanf(str, "%30i", &ret) != 1) {
-               return -1;
-       }
-
-       return ret;
-}
-
-static int mycompar(const void *a, const void *b)
-{
-char   **x = (char **) a;
-char   **y = (char **) b;
-int    xoff,yoff;
-
-       if ((**x < '0') || (**x > '9')) xoff = 1; else xoff = 0;
-       if ((**y < '0') || (**y > '9')) yoff = 1; else yoff = 0;
-       return(strcmp((*x) + xoff,(*y) + yoff));
-}
-
-static int topcompar(const void *a, const void *b)
-{
-struct rpt_topkey *x = (struct rpt_topkey *) a;
-struct rpt_topkey *y = (struct rpt_topkey *) b;
-
-       return(x->timesince - y->timesince);
-}
-
-#ifdef __RPT_NOTCH
-
-/* rpt filter routine */
-static void rpt_filter(struct rpt *myrpt, volatile short *buf, int len)
-{
-int    i,j;
-struct rptfilter *f;
-
-       for(i = 0; i < len; i++)
-       {
-               for(j = 0; j < MAXFILTERS; j++)
-               {
-                       f = &myrpt->filters[j];
-                       if (!*f->desc) continue;
-                       f->x0 = f->x1; f->x1 = f->x2;
-                       f->x2 = ((float)buf[i]) / f->gain;
-                       f->y0 = f->y1; f->y1 = f->y2;
-                       f->y2 =   (f->x0 + f->x2) +   f->const0 * f->x1
-                                    + (f->const1 * f->y0) + (f->const2 * f->y1);
-                       buf[i] = (short)f->y2;
-               }
-       }
-}
-
-#endif
-
-
-/*
- Get the time for the machine's time zone
- Note: Asterisk requires a copy of localtime
- in the /etc directory for this to work properly.
- If /etc/localtime is not present, you will get
- GMT time! This is especially important on systems
- running embedded linux distributions as they don't usually
- have support for locales. 
-
- If OLD_ASTERISK is defined, then the older localtime_r
- function will be used. The /etc/localtime file is not
- required in this case. This provides backward compatibility
- with Asterisk 1.2 systems.
-
-*/
-
-#ifdef NEW_ASTERISK
-static void rpt_localtime( time_t * t, struct ast_tm *lt)
-{
-       struct timeval when;
-
-       when.tv_sec = *t;
-       when.tv_usec = 0;
-       ast_localtime(&when, lt, NULL);
-}
-
-#else
-static void rpt_localtime( time_t * t, struct tm *lt)
-{
-#ifdef OLD_ASTERISK
-       localtime_r(t, lt);
-#else
-       ast_localtime(t, lt, NULL);
-#endif
-}
-#endif
-
-
-/* Retrieve an int from a config file */
-                                                                                
-static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int min, int max, int defl)
-{
-        char *var;
-        int ret;
-       char include_zero = 0;
-
-       if(min < 0){ /* If min is negative, this means include 0 as a valid entry */
-               min = -min;
-               include_zero = 1;
-       }           
-                                                                     
-        var = (char *) ast_variable_retrieve(myrpt->cfg, category, name);
-        if(var){
-                ret = myatoi(var);
-               if(include_zero && !ret)
-                       return 0;
-                if(ret < min)
-                        ret = min;
-                if(ret > max)
-                        ret = max;
-        }
-        else
-                ret = defl;
-        return ret;
-}
-
-
-static void load_rpt_vars(int n,int init)
-{
-char *this,*val;
-int    i,j,longestnode;
-struct ast_variable *vp;
-struct ast_config *cfg;
-char *strs[100];
-char s1[256];
-static char *cs_keywords[] = {"rptena","rptdis","apena","apdis","lnkena","lnkdis","totena","totdis","skena","skdis",
-                               "ufena","ufdis","atena","atdis",NULL};
-
-       if (option_verbose > 2)
-               ast_verbose(VERBOSE_PREFIX_3 "%s config for repeater %s\n",
-                       (init) ? "Loading initial" : "Re-Loading",rpt_vars[n].name);
-       ast_mutex_lock(&rpt_vars[n].lock);
-       if (rpt_vars[n].cfg) ast_config_destroy(rpt_vars[n].cfg);
-#ifdef NEW_ASTERISK
-       cfg = ast_config_load("rpt.conf",config_flags);
-#else
-       cfg = ast_config_load("rpt.conf");
-#endif
-       if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
-               ast_mutex_unlock(&rpt_vars[n].lock);
-               ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf.  Radio Repeater disabled.\n");
-               pthread_exit(NULL);
-       }
-       rpt_vars[n].cfg = cfg; 
-       this = rpt_vars[n].name;
-       memset(&rpt_vars[n].p,0,sizeof(rpt_vars[n].p));
-       if (init)
-       {
-               char *cp;
-               int savearea = (char *)&rpt_vars[n].p - (char *)&rpt_vars[n];
-
-               cp = (char *) &rpt_vars[n].p;
-               memset(cp + sizeof(rpt_vars[n].p),0,
-                       sizeof(rpt_vars[n]) - (sizeof(rpt_vars[n].p) + savearea));
-               rpt_vars[n].tele.next = &rpt_vars[n].tele;
-               rpt_vars[n].tele.prev = &rpt_vars[n].tele;
-               rpt_vars[n].rpt_thread = AST_PTHREADT_NULL;
-               rpt_vars[n].tailmessagen = 0;
-       }
-#ifdef __RPT_NOTCH
-       /* zot out filters stuff */
-       memset(&rpt_vars[n].filters,0,sizeof(rpt_vars[n].filters));
-#endif
-       val = (char *) ast_variable_retrieve(cfg,this,"context");
-       if (val) rpt_vars[n].p.ourcontext = val;
-       else rpt_vars[n].p.ourcontext = this;
-       val = (char *) ast_variable_retrieve(cfg,this,"callerid");
-       if (val) rpt_vars[n].p.ourcallerid = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"accountcode");
-       if (val) rpt_vars[n].p.acctcode = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"idrecording");
-       if (val) rpt_vars[n].p.ident = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"hangtime");
-       if (val) rpt_vars[n].p.hangtime = atoi(val);
-               else rpt_vars[n].p.hangtime = HANGTIME;
-       val = (char *) ast_variable_retrieve(cfg,this,"althangtime");
-       if (val) rpt_vars[n].p.althangtime = atoi(val);
-               else rpt_vars[n].p.althangtime = HANGTIME;
-       val = (char *) ast_variable_retrieve(cfg,this,"totime");
-       if (val) rpt_vars[n].p.totime = atoi(val);
-               else rpt_vars[n].p.totime = TOTIME;
-       val = (char *) ast_variable_retrieve(cfg,this,"voxtimeout");
-       if (val) rpt_vars[n].p.voxtimeout_ms = atoi(val);
-               else rpt_vars[n].p.voxtimeout_ms = VOX_TIMEOUT_MS;
-       val = (char *) ast_variable_retrieve(cfg,this,"voxrecover");
-       if (val) rpt_vars[n].p.voxrecover_ms = atoi(val);
-               else rpt_vars[n].p.voxrecover_ms = VOX_RECOVER_MS;
-       val = (char *) ast_variable_retrieve(cfg,this,"simplexpatchdelay");
-       if (val) rpt_vars[n].p.simplexpatchdelay = atoi(val);
-               else rpt_vars[n].p.simplexpatchdelay = SIMPLEX_PATCH_DELAY;
-       val = (char *) ast_variable_retrieve(cfg,this,"simplexphonedelay");
-       if (val) rpt_vars[n].p.simplexphonedelay = atoi(val);
-               else rpt_vars[n].p.simplexphonedelay = SIMPLEX_PHONE_DELAY;
-       val = (char *) ast_variable_retrieve(cfg,this,"statpost_program");
-       if (val) rpt_vars[n].p.statpost_program = val;
-               else rpt_vars[n].p.statpost_program = STATPOST_PROGRAM;
-       rpt_vars[n].p.statpost_url = 
-               (char *) ast_variable_retrieve(cfg,this,"statpost_url");
-       rpt_vars[n].p.tailmessagetime = retrieve_astcfgint(&rpt_vars[n],this, "tailmessagetime", 0, 2400000, 0);                
-       rpt_vars[n].p.tailsquashedtime = retrieve_astcfgint(&rpt_vars[n],this, "tailsquashedtime", 0, 2400000, 0);              
-       rpt_vars[n].p.duplex = retrieve_astcfgint(&rpt_vars[n],this,"duplex",0,4,2);
-       rpt_vars[n].p.idtime = retrieve_astcfgint(&rpt_vars[n],this, "idtime", -60000, 2400000, IDTIME);        /* Enforce a min max including zero */
-       rpt_vars[n].p.politeid = retrieve_astcfgint(&rpt_vars[n],this, "politeid", 30000, 300000, POLITEID); /* Enforce a min max */
-       val = (char *) ast_variable_retrieve(cfg,this,"tonezone");
-       if (val) rpt_vars[n].p.tonezone = val;
-       rpt_vars[n].p.tailmessages[0] = 0;
-       rpt_vars[n].p.tailmessagemax = 0;
-       val = (char *) ast_variable_retrieve(cfg,this,"tailmessagelist");
-       if (val) rpt_vars[n].p.tailmessagemax = finddelim(val, rpt_vars[n].p.tailmessages, 500);
-       val = (char *) ast_variable_retrieve(cfg,this,"memory");
-       if (!val) val = MEMORY;
-       rpt_vars[n].p.memory = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"macro");
-       if (!val) val = MACRO;
-       rpt_vars[n].p.macro = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"tonemacro");
-       if (!val) val = TONEMACRO;
-       rpt_vars[n].p.tonemacro = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"startup_macro");
-       if (val) rpt_vars[n].p.startupmacro = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"iobase");
-       /* do not use atoi() here, we need to be able to have
-               the input specified in hex or decimal so we use
-               sscanf with a %i */
-       if ((!val) || (sscanf(val,"%30i",&rpt_vars[n].p.iobase) != 1))
-               rpt_vars[n].p.iobase = DEFAULT_IOBASE;
-       val = (char *) ast_variable_retrieve(cfg,this,"ioport");
-       rpt_vars[n].p.ioport = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"functions");
-       if (!val)
-               {
-                       val = FUNCTIONS;
-                       rpt_vars[n].p.simple = 1;
-               } 
-       rpt_vars[n].p.functions = val;
-       val =  (char *) ast_variable_retrieve(cfg,this,"link_functions");
-       if (val) rpt_vars[n].p.link_functions = val;
-       else 
-               rpt_vars[n].p.link_functions = rpt_vars[n].p.functions;
-       val = (char *) ast_variable_retrieve(cfg,this,"phone_functions");
-       if (val) rpt_vars[n].p.phone_functions = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"dphone_functions");
-       if (val) rpt_vars[n].p.dphone_functions = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"alt_functions");
-       if (val) rpt_vars[n].p.alt_functions = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"funcchar");
-       if (!val) rpt_vars[n].p.funcchar = FUNCCHAR; else 
-               rpt_vars[n].p.funcchar = *val;          
-       val = (char *) ast_variable_retrieve(cfg,this,"endchar");
-       if (!val) rpt_vars[n].p.endchar = ENDCHAR; else 
-               rpt_vars[n].p.endchar = *val;           
-       val = (char *) ast_variable_retrieve(cfg,this,"nobusyout");
-       if (val) rpt_vars[n].p.nobusyout = ast_true(val);
-       val = (char *) ast_variable_retrieve(cfg,this,"notelemtx");
-       if (val) rpt_vars[n].p.notelemtx = ast_true(val);
-       val = (char *) ast_variable_retrieve(cfg,this,"propagate_dtmf");
-       if (val) rpt_vars[n].p.propagate_dtmf = ast_true(val);
-       val = (char *) ast_variable_retrieve(cfg,this,"propagate_phonedtmf");
-       if (val) rpt_vars[n].p.propagate_phonedtmf = ast_true(val);
-       val = (char *) ast_variable_retrieve(cfg,this,"linktolink");
-       if (val) rpt_vars[n].p.linktolink = ast_true(val);
-       val = (char *) ast_variable_retrieve(cfg,this,"nodes");
-       if (!val) val = NODES;
-       rpt_vars[n].p.nodes = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"extnodes");
-       if (!val) val = EXTNODES;
-       rpt_vars[n].p.extnodes = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"extnodefile");
-       if (!val) val = EXTNODEFILE;
-       rpt_vars[n].p.extnodefile = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"archivedir");
-       if (val) rpt_vars[n].p.archivedir = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"authlevel");
-       if (val) rpt_vars[n].p.authlevel = atoi(val); 
-       else rpt_vars[n].p.authlevel = 0;
-       val = (char *) ast_variable_retrieve(cfg,this,"parrot");
-       if (val) rpt_vars[n].p.parrotmode = ast_true(val) * 2;
-       else rpt_vars[n].p.parrotmode = 0;
-       val = (char *) ast_variable_retrieve(cfg,this,"parrottime");
-       if (val) rpt_vars[n].p.parrottime = atoi(val); 
-       else rpt_vars[n].p.parrottime = PARROTTIME;
-       val = (char *) ast_variable_retrieve(cfg,this,"rptnode");
-       rpt_vars[n].p.rptnode = val;
-       val = (char *) ast_variable_retrieve(cfg,this,"mars");
-       if (val) rpt_vars[n].p.remote_mars = atoi(val); 
-       else rpt_vars[n].p.remote_mars = 0;
-       val = (char *) ast_variable_retrieve(cfg,this,"monminblocks");
-       if (val) rpt_vars[n].p.monminblocks = atol(val); 
-       else rpt_vars[n].p.monminblocks = DEFAULT_MONITOR_MIN_DISK_BLOCKS;
-       val = (char *) ast_variable_retrieve(cfg,this,"remote_inact_timeout");
-       if (val) rpt_vars[n].p.remoteinacttimeout = atoi(val); 
-       else rpt_vars[n].p.remoteinacttimeout = DEFAULT_REMOTE_INACT_TIMEOUT;
-       val = (char *) ast_variable_retrieve(cfg,this,"civaddr");
-       if (val) rpt_vars[n].p.civaddr = atoi(val); 
-       else rpt_vars[n].p.civaddr = DEFAULT_CIV_ADDR;
-       val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout");
-       if (val) rpt_vars[n].p.remotetimeout = atoi(val); 
-       else rpt_vars[n].p.remotetimeout = DEFAULT_REMOTE_TIMEOUT;
-       val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning");
-       if (val) rpt_vars[n].p.remotetimeoutwarning = atoi(val); 
-       else rpt_vars[n].p.remotetimeoutwarning = DEFAULT_REMOTE_TIMEOUT_WARNING;
-       val = (char *) ast_variable_retrieve(cfg,this,"remote_timeout_warning_freq");
-       if (val) rpt_vars[n].p.remotetimeoutwarningfreq = atoi(val); 
-       else rpt_vars[n].p.remotetimeoutwarningfreq = DEFAULT_REMOTE_TIMEOUT_WARNING_FREQ;
-#ifdef __RPT_NOTCH
-       val = (char *) ast_variable_retrieve(cfg,this,"rxnotch");
-       if (val) {
-               i = finddelim(val,strs,MAXFILTERS * 2);
-               i &= ~1; /* force an even number, rounded down */
-               if (i >= 2) for(j = 0; j < i; j += 2)
-               {
-                       rpt_mknotch(atof(strs[j]),atof(strs[j + 1]),
-                         &rpt_vars[n].filters[j >> 1].gain,
-                           &rpt_vars[n].filters[j >> 1].const0,
-                               &rpt_vars[n].filters[j >> 1].const1,
-                                   &rpt_vars[n].filters[j >> 1].const2);
-                       sprintf(rpt_vars[n].filters[j >> 1].desc,"%s Hz, BW = %s",
-                               strs[j],strs[j + 1]);
-               }
-
-       }
-#endif
-       val = (char *) ast_variable_retrieve(cfg,this,"inxlat");
-       if (val) {
-               memset(&rpt_vars[n].p.inxlat,0,sizeof(struct rpt_xlat));
-               i = finddelim(val,strs,3);
-               if (i) strncpy(rpt_vars[n].p.inxlat.funccharseq,strs[0],MAXXLAT - 1);
-               if (i > 1) strncpy(rpt_vars[n].p.inxlat.endcharseq,strs[1],MAXXLAT - 1);
-               if (i > 2) strncpy(rpt_vars[n].p.inxlat.passchars,strs[2],MAXXLAT - 1);
-       }
-       val = (char *) ast_variable_retrieve(cfg,this,"outxlat");
-       if (val) {
-               memset(&rpt_vars[n].p.outxlat,0,sizeof(struct rpt_xlat));
-               i = finddelim(val,strs,3);
-               if (i) strncpy(rpt_vars[n].p.outxlat.funccharseq,strs[0],MAXXLAT - 1);
-               if (i > 1) strncpy(rpt_vars[n].p.outxlat.endcharseq,strs[1],MAXXLAT - 1);
-               if (i > 2) strncpy(rpt_vars[n].p.outxlat.passchars,strs[2],MAXXLAT - 1);
-       }
-       /* retreive the stanza name for the control states if there is one */
-       val = (char *) ast_variable_retrieve(cfg,this,"controlstates");
-       rpt_vars[n].p.csstanzaname = val;
-               
-       /* retreive the stanza name for the scheduler if there is one */
-       val = (char *) ast_variable_retrieve(cfg,this,"scheduler");
-       rpt_vars[n].p.skedstanzaname = val;
-
-       /* retreive the stanza name for the txlimits */
-       val = (char *) ast_variable_retrieve(cfg,this,"txlimits");
-       rpt_vars[n].p.txlimitsstanzaname = val;
-
-       longestnode = 0;
-
-       vp = ast_variable_browse(cfg, rpt_vars[n].p.nodes);
-               
-       while(vp){
-               j = strlen(vp->name);
-               if (j > longestnode)
-                       longestnode = j;
-               vp = vp->next;
-       }
-
-       rpt_vars[n].longestnode = longestnode;
-               
-       /*
-       * For this repeater, Determine the length of the longest function 
-       */
-       rpt_vars[n].longestfunc = 0;
-       vp = ast_variable_browse(cfg, rpt_vars[n].p.functions);
-       while(vp){
-               j = strlen(vp->name);
-               if (j > rpt_vars[n].longestfunc)
-                       rpt_vars[n].longestfunc = j;
-               vp = vp->next;
-       }
-       /*
-       * For this repeater, Determine the length of the longest function 
-       */
-       rpt_vars[n].link_longestfunc = 0;
-       vp = ast_variable_browse(cfg, rpt_vars[n].p.link_functions);
-       while(vp){
-               j = strlen(vp->name);
-               if (j > rpt_vars[n].link_longestfunc)
-                       rpt_vars[n].link_longestfunc = j;
-               vp = vp->next;
-       }
-       rpt_vars[n].phone_longestfunc = 0;
-       if (rpt_vars[n].p.phone_functions)
-       {
-               vp = ast_variable_browse(cfg, rpt_vars[n].p.phone_functions);
-               while(vp){
-                       j = strlen(vp->name);
-                       if (j > rpt_vars[n].phone_longestfunc)
-                               rpt_vars[n].phone_longestfunc = j;
-                       vp = vp->next;
-               }
-       }
-       rpt_vars[n].dphone_longestfunc = 0;
-       if (rpt_vars[n].p.dphone_functions)
-       {
-               vp = ast_variable_browse(cfg, rpt_vars[n].p.dphone_functions);
-               while(vp){
-                       j = strlen(vp->name);
-                       if (j > rpt_vars[n].dphone_longestfunc)
-                               rpt_vars[n].dphone_longestfunc = j;
-                       vp = vp->next;
-               }
-       }
-       rpt_vars[n].alt_longestfunc = 0;
-       if (rpt_vars[n].p.alt_functions)
-       {
-               vp = ast_variable_browse(cfg, rpt_vars[n].p.alt_functions);
-               while(vp){
-                       j = strlen(vp->name);
-                       if (j > rpt_vars[n].alt_longestfunc)
-                               rpt_vars[n].alt_longestfunc = j;
-                       vp = vp->next;
-               }
-       }
-       rpt_vars[n].macro_longest = 1;
-       vp = ast_variable_browse(cfg, rpt_vars[n].p.macro);
-       while(vp){
-               j = strlen(vp->name);
-               if (j > rpt_vars[n].macro_longest)
-                       rpt_vars[n].macro_longest = j;
-               vp = vp->next;
-       }
-       
-       /* Browse for control states */
-       if(rpt_vars[n].p.csstanzaname)
-               vp = ast_variable_browse(cfg, rpt_vars[n].p.csstanzaname);
-       else
-               vp = NULL;
-       for( i = 0 ; vp && (i < MAX_SYSSTATES) ; i++){ /* Iterate over the number of control state lines in the stanza */
-               int k,nukw,statenum;
-               statenum=atoi(vp->name);
-               strncpy(s1, vp->value, 255);
-               s1[255] = 0;
-               nukw  = finddelim(s1,strs,32);
-               
-               for (k = 0 ; k < nukw ; k++){ /* for each user specified keyword */     
-                       for(j = 0 ; cs_keywords[j] != NULL ; j++){ /* try to match to one in our internal table */
-                               if(!strcmp(strs[k],cs_keywords[j])){
-                                       switch(j){
-                                               case 0: /* rptena */
-                                                       rpt_vars[n].p.s[statenum].txdisable = 0;
-                                                       break;
-                                               case 1: /* rptdis */
-                                                       rpt_vars[n].p.s[statenum].txdisable = 1;
-                                                       break;
-                       
-                                               case 2: /* apena */
-                                                       rpt_vars[n].p.s[statenum].autopatchdisable = 0;
-                                                       break;
-
-                                               case 3: /* apdis */
-                                                       rpt_vars[n].p.s[statenum].autopatchdisable = 1;
-                                                       break;
-
-                                               case 4: /* lnkena */
-                                                       rpt_vars[n].p.s[statenum].linkfundisable = 0;
-                                                       break;
-       
-                                               case 5: /* lnkdis */
-                                                       rpt_vars[n].p.s[statenum].linkfundisable = 1;
-                                                       break;
-
-                                               case 6: /* totena */
-                                                       rpt_vars[n].p.s[statenum].totdisable = 0;
-                                                       break;
-                                       
-                                               case 7: /* totdis */
-                                                       rpt_vars[n].p.s[statenum].totdisable = 1;
-                                                       break;
-
-                                               case 8: /* skena */
-                                                       rpt_vars[n].p.s[statenum].schedulerdisable = 0;
-                                                       break;
-
-                                               case 9: /* skdis */
-                                                       rpt_vars[n].p.s[statenum].schedulerdisable = 1;
-                                                       break;
-
-                                               case 10: /* ufena */
-                                                       rpt_vars[n].p.s[statenum].userfundisable = 0;
-                                                       break;
-
-                                               case 11: /* ufdis */
-                                                       rpt_vars[n].p.s[statenum].userfundisable = 1;
-                                                       break;
-
-                                               case 12: /* atena */
-                                                       rpt_vars[n].p.s[statenum].alternatetail = 1;
-                                                       break;
-
-                                               case 13: /* atdis */
-                                                       rpt_vars[n].p.s[statenum].alternatetail = 0;
-                                                       break;
-                       
-                                               default:
-                                                       ast_log(LOG_WARNING,
-                                                               "Unhandled control state keyword %s", cs_keywords[i]);
-                                                       break;
-                                       }
-                               }
-                       }
-               }
-               vp = vp->next;
-       }
-       ast_mutex_unlock(&rpt_vars[n].lock);
-}
-
-/*
-* Enable or disable debug output at a given level at the console
-*/
-static int rpt_do_debug(int fd, int argc, const char * const *argv)
-{
-       int newlevel;
-
-       if (argc != 4) {
-               return RESULT_SHOWUSAGE;
-       }
-
-       newlevel = myatoi(argv[3]);
-
-       if (newlevel < 0 || newlevel > 7) {
-               return RESULT_SHOWUSAGE;
-       }
-
-       if (newlevel) {
-               ast_cli(fd, "app_rpt Debugging enabled, previous level: %d, new level: %d\n", debug, newlevel);
-       } else {
-               ast_cli(fd, "app_rpt Debugging disabled\n");
-       }
-
-       debug = newlevel;
-
-       return RESULT_SUCCESS;
-}
-
-/*
-* Dump rpt struct debugging onto console
-*/
-                                                                                                                                 
-static int rpt_do_dump(int fd, int argc, const char * const *argv)
-{
-       int i;
-
-        if (argc != 3)
-                return RESULT_SHOWUSAGE;
-
-       for(i = 0; i < nrpts; i++)
-       {
-               if (!strcmp(argv[2],rpt_vars[i].name))
-               {
-                       rpt_vars[i].disgorgetime = time(NULL) + 10; /* Do it 10 seconds later */
-                       ast_cli(fd, "app_rpt struct dump requested for node %s\n",argv[2]);
-                       return RESULT_SUCCESS;
-               }
-       }
-       return RESULT_FAILURE;
-}
-
-/*
-* Dump statistics onto console
-*/
-
-static int rpt_do_stats(int fd, int argc, const char * const *argv)
-{
-       int i,j,numoflinks;
-       int dailytxtime, dailykerchunks;
-       time_t now;
-       int totalkerchunks, dailykeyups, totalkeyups, timeouts;
-       int totalexecdcommands, dailyexecdcommands, hours, minutes, seconds;
-       int uptime;
-       long long totaltxtime;
-       struct  rpt_link *l;
-       char *listoflinks[MAX_STAT_LINKS];      
-       char *lastdtmfcommand,*parrot_ena;
-       char *tot_state, *ider_state, *patch_state;
-       char *reverse_patch_state, *sys_ena, *tot_ena, *link_ena, *patch_ena;
-       char *sch_ena, *input_signal, *called_number, *user_funs, *tail_type;
-       struct rpt *myrpt;
-
-       static char *not_applicable = "N/A";
-
-       if(argc != 3)
-               return RESULT_SHOWUSAGE;
-
-       tot_state = ider_state = 
-       patch_state = reverse_patch_state = 
-       input_signal = not_applicable;
-       called_number = lastdtmfcommand = NULL;
-
-       time(&now);
-       for(i = 0; i < nrpts; i++)
-       {
-               if (!strcmp(argv[2],rpt_vars[i].name)){
-                       /* Make a copy of all stat variables while locked */
-                       myrpt = &rpt_vars[i];
-                       rpt_mutex_lock(&myrpt->lock); /* LOCK */
-                       uptime = (int)(now - starttime);
-                       dailytxtime = myrpt->dailytxtime;
-                       totaltxtime = myrpt->totaltxtime;
-                       dailykeyups = myrpt->dailykeyups;
-                       totalkeyups = myrpt->totalkeyups;
-                       dailykerchunks = myrpt->dailykerchunks;
-                       totalkerchunks = myrpt->totalkerchunks;
-                       dailyexecdcommands = myrpt->dailyexecdcommands;
-                       totalexecdcommands = myrpt->totalexecdcommands;
-                       timeouts = myrpt->timeouts;
-
-                       /* Traverse the list of connected nodes */
-                       reverse_patch_state = "DOWN";
-                       numoflinks = 0;
-                       l = myrpt->links.next;
-                       while(l && (l != &myrpt->links)){
-                               if(numoflinks >= MAX_STAT_LINKS){
-                                       ast_log(LOG_NOTICE,
-                                       "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS);
-                                       break;
-                               }
-                               if (l->name[0] == '0'){ /* Skip '0' nodes */
-                                       reverse_patch_state = "UP";
-                                       l = l->next;
-                                       continue;
-                               }
-                               listoflinks[numoflinks] = ast_strdup(l->name);
-                               if(listoflinks[numoflinks] == NULL){
-                                       break;
-                               }
-                               else{
-                                       numoflinks++;
-                               }
-                               l = l->next;
-                       }
-
-                       if(myrpt->keyed)
-                               input_signal = "YES";
-                       else
-                               input_signal = "NO";
-
-                       if(myrpt->p.parrotmode)
-                               parrot_ena = "ENABLED";
-                       else
-                               parrot_ena = "DISABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable)
-                               sys_ena = "DISABLED";
-                       else
-                               sys_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].totdisable)
-                               tot_ena = "DISABLED";
-                       else
-                               tot_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable)
-                               link_ena = "DISABLED";
-                       else
-                               link_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
-                               patch_ena = "DISABLED";
-                       else
-                               patch_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable)
-                               sch_ena = "DISABLED";
-                       else
-                               sch_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].userfundisable)
-                               user_funs = "DISABLED";
-                       else
-                               user_funs = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].alternatetail)
-                               tail_type = "ALTERNATE";
-                       else
-                               tail_type = "STANDARD";
-
-                       if(!myrpt->totimer)
-                               tot_state = "TIMED OUT!";
-                       else if(myrpt->totimer != myrpt->p.totime)
-                               tot_state = "ARMED";
-                       else
-                               tot_state = "RESET";
-
-                       if(myrpt->tailid)
-                               ider_state = "QUEUED IN TAIL";
-                       else if(myrpt->mustid)
-                               ider_state = "QUEUED FOR CLEANUP";
-                       else
-                               ider_state = "CLEAN";
-
-                       switch(myrpt->callmode){
-                               case 1:
-                                       patch_state = "DIALING";
-                                       break;
-                               case 2:
-                                       patch_state = "CONNECTING";
-                                       break;
-                               case 3:
-                                       patch_state = "UP";
-                                       break;
-
-                               case 4:
-                                       patch_state = "CALL FAILED";
-                                       break;
-
-                               default:
-                                       patch_state = "DOWN";
-                       }
-
-                       if(strlen(myrpt->exten)){
-                               called_number = ast_strdup(myrpt->exten);
-                       }
-
-                       if(strlen(myrpt->lastdtmfcommand)){
-                               lastdtmfcommand = ast_strdup(myrpt->lastdtmfcommand);
-                       }
-                       rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-
-                       ast_cli(fd, "************************ NODE %s STATISTICS *************************\n\n", myrpt->name);
-                       ast_cli(fd, "Selected system state............................: %d\n", myrpt->p.sysstate_cur);
-                       ast_cli(fd, "Signal on input..................................: %s\n", input_signal);
-                       ast_cli(fd, "System...........................................: %s\n", sys_ena);
-                       ast_cli(fd, "Parrot Mode......................................: %s\n", parrot_ena);
-                       ast_cli(fd, "Scheduler........................................: %s\n", sch_ena);
-                       ast_cli(fd, "Tail Time........................................: %s\n", tail_type);
-                       ast_cli(fd, "Time out timer...................................: %s\n", tot_ena);
-                       ast_cli(fd, "Time out timer state.............................: %s\n", tot_state);
-                       ast_cli(fd, "Time outs since system initialization............: %d\n", timeouts);
-                       ast_cli(fd, "Identifier state.................................: %s\n", ider_state);
-                       ast_cli(fd, "Kerchunks today..................................: %d\n", dailykerchunks);
-                       ast_cli(fd, "Kerchunks since system initialization............: %d\n", totalkerchunks);
-                       ast_cli(fd, "Keyups today.....................................: %d\n", dailykeyups);
-                       ast_cli(fd, "Keyups since system initialization...............: %d\n", totalkeyups);
-                       ast_cli(fd, "DTMF commands today..............................: %d\n", dailyexecdcommands);
-                       ast_cli(fd, "DTMF commands since system initialization........: %d\n", totalexecdcommands);
-                       ast_cli(fd, "Last DTMF command executed.......................: %s\n", 
-                       (lastdtmfcommand && strlen(lastdtmfcommand)) ? lastdtmfcommand : not_applicable);
-                       hours = dailytxtime/3600000;
-                       dailytxtime %= 3600000;
-                       minutes = dailytxtime/60000;
-                       dailytxtime %= 60000;
-                       seconds = dailytxtime/1000;
-                       dailytxtime %= 1000;
-
-                       ast_cli(fd, "TX time today....................................: %02d:%02d:%02d.%d\n",
-                               hours, minutes, seconds, dailytxtime);
-
-                       hours = (int) totaltxtime/3600000;
-                       totaltxtime %= 3600000;
-                       minutes = (int) totaltxtime/60000;
-                       totaltxtime %= 60000;
-                       seconds = (int)  totaltxtime/1000;
-                       totaltxtime %= 1000;
-
-                       ast_cli(fd, "TX time since system initialization..............: %02d:%02d:%02d.%d\n",
-                                hours, minutes, seconds, (int) totaltxtime);
-
-                               hours = uptime/3600;
-                        uptime %= 3600;
-                        minutes = uptime/60;
-                        uptime %= 60;
-
-                        ast_cli(fd, "Uptime...........................................: %02d:%02d:%02d\n",
-                                hours, minutes, uptime);
-
-                       ast_cli(fd, "Nodes currently connected to us..................: ");
-                        if(!numoflinks){
-                             ast_cli(fd,"<NONE>");
-                        }
-                       else{
-                               for(j = 0 ;j < numoflinks; j++){
-                                       ast_cli(fd, "%s", listoflinks[j]);
-                                       if(j % 4 == 3){
-                                               ast_cli(fd, "\n");
-                                               ast_cli(fd, "                                                 : ");
-                                       }       
-                                       else{
-                                               if((numoflinks - 1) - j  > 0)
-                                                       ast_cli(fd, ", ");
-                                       }
-                               }
-                       }
-                       ast_cli(fd,"\n");
-
-                       ast_cli(fd, "Autopatch........................................: %s\n", patch_ena);
-                       ast_cli(fd, "Autopatch state..................................: %s\n", patch_state);
-                       ast_cli(fd, "Autopatch called number..........................: %s\n",
-                       (called_number && strlen(called_number)) ? called_number : not_applicable);
-                       ast_cli(fd, "Reverse patch/IAXRPT connected...................: %s\n", reverse_patch_state);
-                       ast_cli(fd, "User linking commands............................: %s\n", link_ena);
-                       ast_cli(fd, "User functions...................................: %s\n\n", user_funs);
-
-                       for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */
-                               ast_free(listoflinks[j]);
-                       }
-                       ast_free(called_number);
-                       ast_free(lastdtmfcommand);
-                       return RESULT_SUCCESS;
-               }
-       }
-       return RESULT_FAILURE;
-}
-
-/*
-* Link stats function
-*/
-
-static int rpt_do_lstats(int fd, int argc, const char * const *argv)
-{
-       int i;
-       char *connstate;
-       struct rpt *myrpt;
-       struct rpt_link *l;
-       struct rpt_lstat *s,*t;
-       struct rpt_lstat s_head;
-       if(argc != 3)
-               return RESULT_SHOWUSAGE;
-
-       s = NULL;
-       s_head.next = &s_head;
-       s_head.prev = &s_head;
-
-       for(i = 0; i < nrpts; i++)
-       {
-               if (!strcmp(argv[2],rpt_vars[i].name)){
-                       /* Make a copy of all stat variables while locked */
-                       myrpt = &rpt_vars[i];
-                       rpt_mutex_lock(&myrpt->lock); /* LOCK */
-                       /* Traverse the list of connected nodes */
-                       l = myrpt->links.next;
-                       while(l && (l != &myrpt->links)){
-                               if (l->name[0] == '0'){ /* Skip '0' nodes */
-                                       l = l->next;
-                                       continue;
-                               }
-                               if((s = (struct rpt_lstat *) ast_malloc(sizeof(struct rpt_lstat))) == NULL){
-                                       ast_log(LOG_ERROR, "Malloc failed in rpt_do_lstats\n");
-                                       rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-                                       return RESULT_FAILURE;
-                               }
-                               memset(s, 0, sizeof(struct rpt_lstat));
-                               strncpy(s->name, l->name, MAXREMSTR - 1);
-                               if (l->chan) pbx_substitute_variables_helper(l->chan, "${IAXPEER(CURRENTCHANNEL)}", s->peer, MAXPEERSTR - 1);
-                               else strcpy(s->peer,"(none)");
-                               s->mode = l->mode;
-                               s->outbound = l->outbound;
-                               s->reconnects = l->reconnects;
-                               s->connecttime = l->connecttime;
-                               s->thisconnected = l->thisconnected;
-                               memcpy(s->chan_stat,l->chan_stat,NRPTSTAT * sizeof(struct rpt_chan_stat));
-                               insque((struct qelem *) s, (struct qelem *) s_head.next);
-                               memset(l->chan_stat,0,NRPTSTAT * sizeof(struct rpt_chan_stat));
-                               l = l->next;
-                       }
-                       rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-                       ast_cli(fd, "NODE      PEER                RECONNECTS  DIRECTION  CONNECT TIME        CONNECT STATE\n");
-                       ast_cli(fd, "----      ----                ----------  ---------  ------------        -------------\n");
-
-                       for(s = s_head.next; s != &s_head; s = s->next){
-                               int hours, minutes, seconds;
-                               long long connecttime = s->connecttime;
-                               char conntime[21];
-                               hours = (int) connecttime/3600000;
-                               connecttime %= 3600000;
-                               minutes = (int) connecttime/60000;
-                               connecttime %= 60000;
-                               seconds = (int)  connecttime/1000;
-                               connecttime %= 1000;
-                               snprintf(conntime, 20, "%02d:%02d:%02d.%d",
-                                       hours, minutes, seconds, (int) connecttime);
-                               conntime[20] = 0;
-                               if(s->thisconnected)
-                                       connstate  = "ESTABLISHED";
-                               else
-                                       connstate = "CONNECTING";
-                               ast_cli(fd, "%-10s%-20s%-12d%-11s%-20s%-20s\n",
-                                       s->name, s->peer, s->reconnects, (s->outbound)? "OUT":"IN", conntime, connstate);
-                       }       
-                       /* destroy our local link queue */
-                       s = s_head.next;
-                       while(s != &s_head){
-                               t = s;
-                               s = s->next;
-                               remque((struct qelem *)t);
-                               ast_free(t);
-                       }                       
-                       return RESULT_SUCCESS;
-               }
-       }
-       return RESULT_FAILURE;
-}
-
-/*
-* List all nodes connected, directly or indirectly
-*/
-
-static int rpt_do_nodes(int fd, int argc, const char * const *argv)
-{
-       int i,j;
-       char ns;
-       char lbuf[MAXLINKLIST],*strs[MAXLINKLIST];
-       struct rpt *myrpt;
-       if(argc != 3)
-               return RESULT_SHOWUSAGE;
-
-       for(i = 0; i < nrpts; i++)
-       {
-               if (!strcmp(argv[2],rpt_vars[i].name)){
-                       /* Make a copy of all stat variables while locked */
-                       myrpt = &rpt_vars[i];
-                       rpt_mutex_lock(&myrpt->lock); /* LOCK */
-                       __mklinklist(myrpt,NULL,lbuf);
-                       rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-                       /* parse em */
-                       ns = finddelim(lbuf,strs,MAXLINKLIST);
-                       /* sort em */
-                       if (ns) qsort((void *)strs,ns,sizeof(char *),mycompar);
-                       ast_cli(fd,"\n");
-                       ast_cli(fd, "************************* CONNECTED NODES *************************\n\n");
-                       for(j = 0 ;; j++){
-                               if(!strs[j]){
-                                       if(!j){
-                                               ast_cli(fd,"<NONE>");
-                                       }
-                                       break;
-                               }
-                               ast_cli(fd, "%s", strs[j]);
-                               if(j % 8 == 7){
-                                       ast_cli(fd, "\n");
-                               }
-                               else{
-                                       if(strs[j + 1])
-                                               ast_cli(fd, ", ");
-                               }
-                       }
-                       ast_cli(fd,"\n\n");
-                       return RESULT_SUCCESS;
-               }
-       }
-       return RESULT_FAILURE;
-}
-
-/*
-* List all locally configured nodes
-*/
-
-static int rpt_do_local_nodes(int fd, int argc, const char * const *argv)
-{
-
-    int i;
-    ast_cli(fd, "\nNode\n----\n");
-    for (i=0; i< nrpts; i++)
-    {
-        ast_cli(fd, "%s\n", rpt_vars[i].name);        
-    } /* for i */
-    ast_cli(fd,"\n");
-    return RESULT_SUCCESS;
-} 
-
-
-/*
-* reload vars 
-*/
-
-static int rpt_do_reload(int fd, int argc, const char * const *argv)
-{
-int    n;
-
-        if (argc > 2) return RESULT_SHOWUSAGE;
-
-       for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1;
-
-       return RESULT_FAILURE;
-}
-
-/*
-* restart app_rpt
-*/
-                                                                                                                                 
-static int rpt_do_restart(int fd, int argc, const char * const *argv)
-{
-int    i;
-
-        if (argc > 2) return RESULT_SHOWUSAGE;
-       for(i = 0; i < nrpts; i++)
-       {
-               if (rpt_vars[i].rxchannel) ast_softhangup(rpt_vars[i].rxchannel,AST_SOFTHANGUP_DEV);
-       }
-       return RESULT_FAILURE;
-}
-
-
-/*
-* send an app_rpt DTMF function from the CLI
-*/
-                                                                                                                                 
-static int rpt_do_fun(int fd, int argc, const char * const *argv)
-{
-       int     i,busy=0;
-
-        if (argc != 4) return RESULT_SHOWUSAGE;
-
-       for(i = 0; i < nrpts; i++){
-               if(!strcmp(argv[2], rpt_vars[i].name)){
-                       struct rpt *myrpt = &rpt_vars[i];
-                       rpt_mutex_lock(&myrpt->lock);
-                       if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(argv[3])){
-                               rpt_mutex_unlock(&myrpt->lock);
-                               busy=1;
-                       }
-                       if(!busy){
-                               myrpt->macrotimer = MACROTIME;
-                               strncat(myrpt->macrobuf,argv[3],MAXMACRO - 1);
-                       }
-                       rpt_mutex_unlock(&myrpt->lock);
-               }
-       }
-       if(busy){
-               ast_cli(fd, "Function decoder busy");
-       }
-       return RESULT_FAILURE;
-}
-/*
-       the convention is that macros in the data from the rpt() application
-       are all at the end of the data, separated by the | and start with a *
-       when put into the macro buffer, the characters have their high bit
-       set so the macro processor knows they came from the application data
-       and to use the alt-functions table.
-       sph:
-*/
-static int rpt_push_alt_macro(struct rpt *myrpt, char *sptr)
-{
-       int     busy=0;
-
-       rpt_mutex_lock(&myrpt->lock);
-       if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(sptr)){
-               rpt_mutex_unlock(&myrpt->lock);
-               busy=1;
-       }
-       if(!busy){
-               int x;
-               if (debug)ast_log(LOG_NOTICE, "rpt_push_alt_macro %s\n",sptr);
-               myrpt->macrotimer = MACROTIME;
-               for(x = 0; *(sptr + x); x++)
-                   myrpt->macrobuf[x] = *(sptr + x) | 0x80;
-               *(sptr + x) = 0;
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-
-       if(busy)ast_log(LOG_WARNING, "Function decoder busy on app_rpt command macro.\n");
-
-       return busy;
-}
-/*
-       allows us to test rpt() application data commands
-*/
-static int rpt_do_fun1(int fd, int argc, const char * const *argv)
-{
-       int     i;
-
-    if (argc != 4) return RESULT_SHOWUSAGE;
-
-       for(i = 0; i < nrpts; i++){
-               if(!strcmp(argv[2], rpt_vars[i].name)){
-                       struct rpt *myrpt = &rpt_vars[i];
-                       rpt_push_alt_macro(myrpt, (char *) argv[3]);
-               }
-       }
-       return RESULT_FAILURE;
-}
-/*
-* send an app_rpt **command** from the CLI
-*/
-
-static int rpt_do_cmd(int fd, int argc, const char * const *argv)
-{
-       int i, l;
-       int busy=0;
-       int maxActions = sizeof(function_table)/sizeof(struct function_table_tag);
-
-       int thisRpt = -1;
-       int thisAction = -1;
-       struct rpt *myrpt = NULL;
-       if (argc != 6) return RESULT_SHOWUSAGE;
-       
-       for(i = 0; i < nrpts; i++)
-       {
-               if(!strcmp(argv[2], rpt_vars[i].name))
-               {
-                       thisRpt = i;
-                       myrpt = &rpt_vars[i];
-                       break;
-               } /* if !strcmp... */
-       } /* for i */
-
-       if (thisRpt < 0)
-       {
-               ast_cli(fd, "Unknown node number %s.\n", argv[2]);
-               return RESULT_FAILURE;
-       } /* if thisRpt < 0 */
-       
-       /* Look up the action */
-       l = strlen(argv[3]);
-       for(i = 0 ; i < maxActions; i++)
-       {
-               if(!strncasecmp(argv[3], function_table[i].action, l))
-               {
-                       thisAction = i;
-                       break;
-               } /* if !strncasecmp... */
-       } /* for i */
-       
-       if (thisAction < 0)
-       {
-               ast_cli(fd, "Unknown action name %s.\n", argv[3]);
-               return RESULT_FAILURE;
-       } /* if thisAction < 0 */
-
-       /* at this point, it looks like all the arguments make sense... */
-
-       rpt_mutex_lock(&myrpt->lock);
-
-       if (rpt_vars[thisRpt].cmdAction.state == CMD_STATE_IDLE)
-       {
-               rpt_vars[thisRpt].cmdAction.state = CMD_STATE_BUSY;
-               rpt_vars[thisRpt].cmdAction.functionNumber = thisAction;
-               strncpy(rpt_vars[thisRpt].cmdAction.param, argv[4], MAXDTMF);
-               strncpy(rpt_vars[thisRpt].cmdAction.digits, argv[5], MAXDTMF);
-               rpt_vars[thisRpt].cmdAction.command_source = SOURCE_RPT;
-               rpt_vars[thisRpt].cmdAction.state = CMD_STATE_READY;
-       } /* if (rpt_vars[thisRpt].cmdAction.state == CMD_STATE_IDLE */
-       else
-       {
-               busy = 1;
-       } /* if (rpt_vars[thisRpt].cmdAction.state == CMD_STATE_IDLE */
-       rpt_mutex_unlock(&myrpt->lock);
-
-       return (busy ? RESULT_FAILURE : RESULT_SUCCESS);
-} /* rpt_do_cmd() */
-
-static int play_tone_pair(struct ast_channel *chan, int f1, int f2, int duration, int amplitude)
-{
-       int res;
-
-        if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude)))
-                return res;
-                                                                                                                                            
-        while(chan->generatordata) {
-               if (ast_safe_sleep(chan,1)) return -1;
-       }
-
-        return 0;
-}
-
-static int play_tone(struct ast_channel *chan, int freq, int duration, int amplitude)
-{
-       return play_tone_pair(chan, freq, 0, duration, amplitude);
-}
-
-static int play_silence(struct ast_channel *chan, int duration)
-{
-       return play_tone_pair(chan, 0, 0, duration, 0);
-}
-
-#ifdef NEW_ASTERISK
-
-static char *res2cli(int r)
-
-{
-       switch (r)
-       {
-           case RESULT_SUCCESS:
-               return(CLI_SUCCESS);
-           case RESULT_SHOWUSAGE:
-               return(CLI_SHOWUSAGE);
-           default:
-               return(CLI_FAILURE);
-       }
-}
-
-static char *handle_cli_debug(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt debug level";
-                e->usage = debug_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_debug(a->fd, a->argc, a->argv));
-}
-
-static char *handle_cli_dump(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt dump level";
-                e->usage = dump_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_dump(a->fd,a->argc,a->argv));
-}
-
-
-static char *handle_cli_stats(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt stats";
-                e->usage = dump_stats;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_stats(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_nodes(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt nodes";
-                e->usage = dump_nodes;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_nodes(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_local_nodes(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt localnodes";
-                e->usage = usage_local_nodes;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_local_nodes(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_lstats(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt lstats";
-                e->usage = dump_lstats;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_lstats(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_reload(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt reload";
-                e->usage = reload_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_reload(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_restart(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt restart";
-                e->usage = restart_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_restart(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_fun(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt fun";
-                e->usage = fun_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_fun(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_fun1(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt fun1";
-                e->usage = fun_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_fun1(a->fd,a->argc,a->argv));
-}
-
-static char *handle_cli_cmd(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "rpt cmd";
-                e->usage = cmd_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(rpt_do_cmd(a->fd,a->argc,a->argv));
-}
-
-static struct ast_cli_entry rpt_cli[] = {
-       AST_CLI_DEFINE(handle_cli_debug,"Enable app_rpt debugging"),
-       AST_CLI_DEFINE(handle_cli_dump,"Dump app_rpt structs for debugging"),
-       AST_CLI_DEFINE(handle_cli_stats,"Dump node statistics"),
-       AST_CLI_DEFINE(handle_cli_nodes,"Dump node list"),
-       AST_CLI_DEFINE(handle_cli_local_nodes,  "Dump list of local node numbers"),
-       AST_CLI_DEFINE(handle_cli_lstats,"Dump link statistics"),
-       AST_CLI_DEFINE(handle_cli_reload,"Reload app_rpt config"),
-       AST_CLI_DEFINE(handle_cli_restart,"Restart app_rpt"),
-       AST_CLI_DEFINE(handle_cli_fun,"Execute a DTMF function"),
-       AST_CLI_DEFINE(handle_cli_fun1,"Execute a DTMF function"),
-       AST_CLI_DEFINE(handle_cli_cmd,"Execute a DTMF function")
-};
-
-#endif
-
-static int send_morse(struct ast_channel *chan, char *string, int speed, int freq, int amplitude)
-{
-
-static struct morse_bits mbits[] = {
-               {0, 0}, /* SPACE */
-               {0, 0}, 
-               {6, 18},/* " */
-               {0, 0},
-               {7, 72},/* $ */
-               {0, 0},
-               {0, 0},
-               {6, 30},/* ' */
-               {5, 13},/* ( */
-               {6, 29},/* ) */
-               {0, 0},
-               {5, 10},/* + */
-               {6, 51},/* , */
-               {6, 33},/* - */
-               {6, 42},/* . */
-               {5, 9}, /* / */
-               {5, 31},/* 0 */
-               {5, 30},/* 1 */
-               {5, 28},/* 2 */
-               {5, 24},/* 3 */
-               {5, 16},/* 4 */
-               {5, 0}, /* 5 */
-               {5, 1}, /* 6 */
-               {5, 3}, /* 7 */
-               {5, 7}, /* 8 */
-               {5, 15},/* 9 */
-               {6, 7}, /* : */
-               {6, 21},/* ; */
-               {0, 0},
-               {5, 33},/* = */
-               {0, 0},
-               {6, 12},/* ? */
-               {0, 0},
-               {2, 2}, /* A */
-               {4, 1}, /* B */
-               {4, 5}, /* C */
-               {3, 1}, /* D */
-               {1, 0}, /* E */
-               {4, 4}, /* F */
-               {3, 3}, /* G */
-               {4, 0}, /* H */
-               {2, 0}, /* I */
-               {4, 14},/* J */
-               {3, 5}, /* K */
-               {4, 2}, /* L */
-               {2, 3}, /* M */
-               {2, 1}, /* N */
-               {3, 7}, /* O */
-               {4, 6}, /* P */
-               {4, 11},/* Q */
-               {3, 2}, /* R */
-               {3, 0}, /* S */
-               {1, 1}, /* T */
-               {3, 4}, /* U */
-               {4, 8}, /* V */
-               {3, 6}, /* W */
-               {4, 9}, /* X */
-               {4, 13},/* Y */
-               {4, 3}  /* Z */
-       };
-
-
-       int dottime;
-       int dashtime;
-       int intralettertime;
-       int interlettertime;
-       int interwordtime;
-       int len, ddcomb;
-       int res;
-       int c;
-       int i;
-       int flags;
-                       
-       res = 0;
-       
-       /* Approximate the dot time from the speed arg. */
-       
-       dottime = 900/speed;
-       
-       /* Establish timing releationships */
-       
-       dashtime = 3 * dottime;
-       intralettertime = dottime;
-       interlettertime = dottime * 4 ;
-       interwordtime = dottime * 7;
-       
-       for(;(*string) && (!res); string++){
-       
-               c = *string;
-               
-               /* Convert lower case to upper case */
-               
-               if((c >= 'a') && (c <= 'z'))
-                       c -= 0x20;
-               
-               /* Can't deal with any char code greater than Z, skip it */
-               
-               if(c  > 'Z')
-                       continue;
-               
-               /* If space char, wait the inter word time */
-                                       
-               if(c == ' '){
-                       if(!res)
-                               res = play_silence(chan, interwordtime);
-                       continue;
-               }
-               
-               /* Subtract out control char offset to match our table */
-               
-               c -= 0x20;
-               
-               /* Get the character data */
-               
-               len = mbits[c].len;
-               ddcomb = mbits[c].ddcomb;
-               
-               /* Send the character */
-               
-               for(; len ; len--){
-                       if(!res)
-                               res = play_tone(chan, freq, (ddcomb & 1) ? dashtime : dottime, amplitude);
-                       if(!res)
-                               res = play_silence(chan, intralettertime);
-                       ddcomb >>= 1;
-               }
-               
-               /* Wait the interletter time */
-               
-               if(!res)
-                       res = play_silence(chan, interlettertime - intralettertime);
-       }
-       
-       /* Wait for all the frames to be sent */
-       
-       if (!res) 
-               res = ast_waitstream(chan, "");
-       ast_stopstream(chan);
-       
-       /*
-       * Wait for the DAHDI driver to physically write the tone blocks to the hardware
-       */
-
-       for(i = 0; i < 20 ; i++){
-               flags =  DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; 
-               res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
-               if(flags & DAHDI_IOMUX_WRITEEMPTY)
-                       break;
-               if( ast_safe_sleep(chan, 50)){
-                       res = -1;
-                       break;
-               }
-       }
-
-       
-       return res;
-}
-
-static int send_tone_telemetry(struct ast_channel *chan, char *tonestring)
-{
-       char *p,*stringp;
-       char *tonesubset;
-       int f1,f2;
-       int duration;
-       int amplitude;
-       int res;
-       int i;
-       int flags;
-       
-       res = 0;
-
-       if(!tonestring)
-               return res;
-       
-       p = stringp = ast_strdup(tonestring);
-
-       for(;tonestring;){
-               tonesubset = strsep(&stringp,")");
-               if(!tonesubset)
-                       break;
-               if(sscanf(tonesubset,"(%30d,%30d,%30d,%30d", &f1, &f2, &duration, &amplitude) != 4)
-                       break;
-               res = play_tone_pair(chan, f1, f2, duration, amplitude);
-               if(res)
-                       break;
-       }
-       ast_free(p);
-       if(!res)
-               res = play_tone_pair(chan, 0, 0, 100, 0); /* This is needed to ensure the last tone segment is timed correctly */
-       
-       if (!res) 
-               res = ast_waitstream(chan, "");
-
-       ast_stopstream(chan);
-
-       /*
-       * Wait for the DAHDI driver to physically write the tone blocks to the hardware
-       */
-
-       for(i = 0; i < 20 ; i++){
-               flags =  DAHDI_IOMUX_WRITEEMPTY | DAHDI_IOMUX_NOWAIT; 
-               res = ioctl(chan->fds[0], DAHDI_IOMUX, &flags);
-               if(flags & DAHDI_IOMUX_WRITEEMPTY)
-                       break;
-               if( ast_safe_sleep(chan, 50)){
-                       res = -1;
-                       break;
-               }
-       }
-               
-       return res;
-               
-}
-
-static int sayfile(struct ast_channel *mychannel,char *fname)
-{
-int    res;
-
-       res = ast_streamfile(mychannel, fname, mychannel->language);
-       if (!res) 
-               res = ast_waitstream(mychannel, "");
-       else
-                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-       ast_stopstream(mychannel);
-       return res;
-}
-
-static int saycharstr(struct ast_channel *mychannel,char *str)
-{
-int    res;
-
-       res = ast_say_character_str(mychannel,str,NULL,mychannel->language);
-       if (!res) 
-               res = ast_waitstream(mychannel, "");
-       else
-                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-       ast_stopstream(mychannel);
-       return res;
-}
-
-static int saynum(struct ast_channel *mychannel, int num)
-{
-       int res;
-       res = ast_say_number(mychannel, num, NULL, mychannel->language, NULL);
-       if(!res)
-               res = ast_waitstream(mychannel, "");
-       else
-               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-       ast_stopstream(mychannel);
-       return res;
-}
-
-/* say a node and nodename. Try to look in dir referred to by nodenames in
-config, and see if there's a custom node file to play, and if so, play it */
-
-static int saynode(struct rpt *myrpt, struct ast_channel *mychannel, char *name)
-{
-int    res;
-char   *val,fname[300];
-
-       val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "nodenames");
-       if (!val) val = NODENAMES;
-       snprintf(fname,sizeof(fname) - 1,"%s/%s",val,name);
-       if (ast_fileexists(fname,NULL,mychannel->language) > 0)
-               return(sayfile(mychannel,fname));
-       res = sayfile(mychannel,"rpt/node");
-       if (!res) 
-               res = ast_say_character_str(mychannel,name,NULL,mychannel->language);
-       return res;
-}
-
-static int telem_any(struct rpt *myrpt,struct ast_channel *chan, char *entry)
-{
-       int res;
-       char c;
-       
-       static int morsespeed;
-       static int morsefreq;
-       static int morseampl;
-       static int morseidfreq = 0;
-       static int morseidampl;
-       static char mcat[] = MORSE;
-       
-       res = 0;
-       
-       if(!morseidfreq){ /* Get the morse parameters if not already loaded */
-               morsespeed = retrieve_astcfgint(myrpt, mcat, "speed", 5, 20, 20);
-               morsefreq = retrieve_astcfgint(myrpt, mcat, "frequency", 300, 3000, 800);
-               morseampl = retrieve_astcfgint(myrpt, mcat, "amplitude", 200, 8192, 4096);
-               morseidampl = retrieve_astcfgint(myrpt, mcat, "idamplitude", 200, 8192, 2048);
-               morseidfreq = retrieve_astcfgint(myrpt, mcat, "idfrequency", 300, 3000, 330);   
-       }
-       
-       /* Is it a file, or a tone sequence? */
-                       
-       if(entry[0] == '|'){
-               c = entry[1];
-               if((c >= 'a')&&(c <= 'z'))
-                       c -= 0x20;
-       
-               switch(c){
-                       case 'I': /* Morse ID */
-                               res = send_morse(chan, entry + 2, morsespeed, morseidfreq, morseidampl);
-                               break;
-                       
-                       case 'M': /* Morse Message */
-                               res = send_morse(chan, entry + 2, morsespeed, morsefreq, morseampl);
-                               break;
-                       
-                       case 'T': /* Tone sequence */
-                               res = send_tone_telemetry(chan, entry + 2);
-                               break;
-                       default:
-                               res = -1;
-               }
-       }
-       else
-               res = sayfile(chan, entry); /* File */
-       return res;
-}
-
-/*
-* This function looks up a telemetry name in the config file, and does a telemetry response as configured.
-*
-* 4 types of telemtry are handled: Morse ID, Morse Message, Tone Sequence, and a File containing a recording.
-*/
-
-static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, char *name)
-{
-       
-       int res;
-       int i;
-       char *entry;
-       char *telemetry;
-       char *telemetry_save;
-
-       res = 0;
-       telemetry_save = NULL;
-       entry = NULL;
-       
-       /* Retrieve the section name for telemetry from the node section */
-       telemetry = (char *) ast_variable_retrieve(myrpt->cfg, node, TELEMETRY);
-       if(telemetry ){
-               telemetry_save = ast_strdup(telemetry);
-               if(!telemetry_save){
-                       ast_log(LOG_WARNING,"ast_strdup() failed in telem_lookup()\n");
-                       return res;
-               }
-               entry = (char *) ast_variable_retrieve(myrpt->cfg, telemetry_save, name);
-       }
-       
-       /* Try to look up the telemetry name */ 
-
-       if(!entry){
-               /* Telemetry name wasn't found in the config file, use the default */
-               for(i = 0; i < sizeof(tele_defs)/sizeof(struct telem_defaults) ; i++){
-                       if(!strcasecmp(tele_defs[i].name, name))
-                               entry = tele_defs[i].value;
-               }
-       }
-       if(entry){      
-               if(strlen(entry))
-                       if (chan) telem_any(myrpt,chan, entry);
-       }
-       else{
-               res = -1;
-       }
-       ast_free(telemetry_save);
-       return res;
-}
-
-/*
-* Retrieve a wait interval
-*/
-
-static int get_wait_interval(struct rpt *myrpt, int type)
-{
-        int interval;
-        char *wait_times;
-        char *wait_times_save;
-                                                                                                                  
-        wait_times_save = NULL;
-        wait_times = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "wait_times");
-                                                                                                                  
-        if(wait_times){
-                wait_times_save = ast_strdup(wait_times);
-                if(!wait_times_save)
-                       return 0;
-                
-        }
-                                                                                                                  
-        switch(type){
-                case DLY_TELEM:
-                        if(wait_times)
-                                interval = retrieve_astcfgint(myrpt,wait_times_save, "telemwait", 500, 5000, 1000);
-                        else
-                                interval = 1000;
-                        break;
-                                                                                                                  
-                case DLY_ID:
-                        if(wait_times)
-                                interval = retrieve_astcfgint(myrpt,wait_times_save, "idwait",250,5000,500);
-                        else
-                                interval = 500;
-                        break;
-                                                                                                                  
-                case DLY_UNKEY:
-                        if(wait_times)
-                                interval = retrieve_astcfgint(myrpt,wait_times_save, "unkeywait",50,5000,1000);
-                        else
-                                interval = 1000;
-                        break;
-                                                                                                                  
-                case DLY_LINKUNKEY:
-                        if(wait_times)
-                                interval = retrieve_astcfgint(myrpt,wait_times_save, "linkunkeywait",500,5000,1000);
-                        else
-                                interval = 1000;
-                        break;
-                                                                                                                  
-                case DLY_CALLTERM:
-                        if(wait_times)
-                                interval = retrieve_astcfgint(myrpt,wait_times_save, "calltermwait",500,5000,1500);
-                        else
-                                interval = 1500;
-                        break;
-                                                                                                                  
-                case DLY_COMP:
-                        if(wait_times)
-                                interval = retrieve_astcfgint(myrpt,wait_times_save, "compwait",500,5000,200);
-                        else
-                                interval = 200;
-                        break;
-                                                                                                                  
-                case DLY_PARROT:
-                        if(wait_times)
-                                interval = retrieve_astcfgint(myrpt,wait_times_save, "parrotwait",500,5000,200);
-                        else
-                                interval = 200;
-                        break;
-                                                                                                                  
-                default:
-                       interval = 0;
-                       break;
-        }
-       ast_free(wait_times_save);
-       return interval;
-}                                                                                                                  
-
-
-/*
-* Wait a configurable interval of time 
-*/
-static void wait_interval(struct rpt *myrpt, int type, struct ast_channel *chan)
-{
-       int interval;
-       interval = get_wait_interval(myrpt, type);
-       if(debug)
-               ast_log(LOG_NOTICE,"Delay interval = %d\n", interval);
-       if(interval)
-               ast_safe_sleep(chan,interval);
-       if(debug)
-               ast_log(LOG_NOTICE,"Delay complete\n");
-       return;
-}
-
-static int split_freq(char *mhz, char *decimals, char *freq);
-
-static void *rpt_tele_thread(void *this)
-{
-struct dahdi_confinfo ci;  /* conference info */
-int    res = 0,haslink,hastx,hasremote,imdone = 0, unkeys_queued, x;
-struct rpt_tele *mytele = (struct rpt_tele *)this;
-struct  rpt_tele *tlist;
-struct rpt *myrpt;
-struct rpt_link *l,*l1,linkbase;
-struct ast_channel *mychannel;
-int vmajor, vminor, m;
-char *p,*ct,*ct_copy,*ident, *nodename;
-time_t t;
-#ifdef NEW_ASTERISK
-struct ast_tm localtm;
-#else
-struct tm localtm;
-#endif
-char lbuf[MAXLINKLIST],*strs[MAXLINKLIST];
-int    i,ns,rbimode;
-char mhz[MAXREMSTR];
-char decimals[MAXREMSTR];
-char   mystr[200];
-struct dahdi_params par;
-struct ast_format_cap *cap = NULL;
-
-       /* get a pointer to myrpt */
-       myrpt = mytele->rpt;
-
-       /* Snag copies of a few key myrpt variables */
-       rpt_mutex_lock(&myrpt->lock);
-       nodename = ast_strdup(myrpt->name);
-       if(!nodename)
-       {
-           fprintf(stderr,"rpt:Sorry unable strdup nodename\n");
-           rpt_mutex_lock(&myrpt->lock);
-           remque((struct qelem *)mytele);
-           ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
-           rpt_mutex_unlock(&myrpt->lock);
-           ast_free(mytele);
-           pthread_exit(NULL);
-       }
-
-       if (myrpt->p.ident){
-               ident = ast_strdup(myrpt->p.ident);
-               if(!ident)
-               {
-                       fprintf(stderr,"rpt:Sorry unable strdup ident\n");
-                       rpt_mutex_lock(&myrpt->lock);
-                       remque((struct qelem *)mytele);
-                       ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",
-                       __LINE__, mytele->mode); /*@@@@@@@@@@@*/
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_free(nodename);
-                       ast_free(mytele);
-                       pthread_exit(NULL);
-               }
-       }
-       else
-       {
-               ident = "";
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-               
-
-
-       /* allocate a pseudo-channel thru asterisk */
-       mychannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!mychannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               rpt_mutex_lock(&myrpt->lock);
-               remque((struct qelem *)mytele);
-               ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_free(nodename);
-               ast_free(ident);
-               ast_free(mytele);               
-               pthread_exit(NULL);
-       }
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (mychannel->cdr) 
-               ast_set_flag(mychannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       rpt_mutex_lock(&myrpt->lock);
-       mytele->chan = mychannel;
-       rpt_mutex_unlock(&myrpt->lock);
-
-       while((mytele->mode != SETREMOTE) && (mytele->mode != UNKEY) &&
-               (mytele->mode != LINKUNKEY))
-       {       
-                rpt_mutex_lock(&myrpt->lock);
-               if (!myrpt->active_telem)
-               {
-                       myrpt->active_telem = mytele;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       break;
-               }
-                rpt_mutex_unlock(&myrpt->lock);
-               usleep(100000);
-       }
-
-       /* make a conference for the tx */
-       ci.chan = 0;
-       /* If the telemetry is only intended for a local audience, */
-       /* only connect the ID audio to the local tx conference so */
-       /* linked systems can't hear it */
-       ci.confno = (((mytele->mode == ID) || (mytele->mode == IDTALKOVER) || (mytele->mode == UNKEY) || 
-               (mytele->mode == TAILMSG) || (mytele->mode == LINKUNKEY) || (mytele->mode == TIMEOUT) || 
-               (mytele->mode == PARROT) || (mytele->mode == STATS_TIME_LOCAL)) ? 
-                       myrpt->txconf : myrpt->conf);
-       ci.confmode = DAHDI_CONF_CONFANN;
-       /* first put the channel on the conference in announce mode */
-       if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               rpt_mutex_lock(&myrpt->lock);
-               myrpt->active_telem = NULL;
-               remque((struct qelem *)mytele);
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
-               ast_free(nodename);
-               ast_free(ident);
-               ast_free(mytele);               
-               ast_hangup(mychannel);
-               pthread_exit(NULL);
-       }
-       ast_stopstream(mychannel);
-       switch(mytele->mode)
-       {
-           case ID:
-           case ID1:
-               /* wait a bit */
-               wait_interval(myrpt, (mytele->mode == ID) ? DLY_ID : DLY_TELEM,mychannel);
-               res = telem_any(myrpt,mychannel, ident); 
-               imdone=1;       
-               break;
-               
-           case TAILMSG:
-               res = ast_streamfile(mychannel, myrpt->p.tailmessages[myrpt->tailmessagen], mychannel->language); 
-               break;
-               
-           case IDTALKOVER:
-               p = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "idtalkover");
-               if(p)
-                       res = telem_any(myrpt,mychannel, p); 
-               imdone=1;       
-               break;
-                       
-           case PROC:
-               /* wait a little bit longer */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = telem_lookup(myrpt, mychannel, myrpt->name, "patchup");
-               if(res < 0){ /* Then default message */
-                       res = ast_streamfile(mychannel, "rpt/callproceeding", mychannel->language);
-               }
-               break;
-           case TERM:
-               /* wait a little bit longer */
-               wait_interval(myrpt, DLY_CALLTERM, mychannel);
-               res = telem_lookup(myrpt, mychannel, myrpt->name, "patchdown");
-               if(res < 0){ /* Then default message */
-                       res = ast_streamfile(mychannel, "rpt/callterminated", mychannel->language);
-               }
-               break;
-           case COMPLETE:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
-               break;
-           case MACRO_NOTFOUND:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/macro_notfound", mychannel->language);
-               break;
-           case MACRO_BUSY:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/macro_busy", mychannel->language);
-               break;
-           case UNKEY:
-               if(myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */
-                       imdone = 1;
-                       break;
-               }
-                       
-               /*
-               * Reset the Unkey to CT timer
-               */
-
-               x = get_wait_interval(myrpt, DLY_UNKEY);
-               rpt_mutex_lock(&myrpt->lock);
-               myrpt->unkeytocttimer = x; /* Must be protected as it is changed below */
-               rpt_mutex_unlock(&myrpt->lock);
-
-               /*
-               * If there's one already queued, don't do another
-               */
-
-               tlist = myrpt->tele.next;
-               unkeys_queued = 0;
-                if (tlist != &myrpt->tele)
-                {
-                        rpt_mutex_lock(&myrpt->lock);
-                        while(tlist != &myrpt->tele){
-                                if (tlist->mode == UNKEY) unkeys_queued++;
-                                tlist = tlist->next;
-                        }
-                        rpt_mutex_unlock(&myrpt->lock);
-               }
-               if( unkeys_queued > 1){
-                       imdone = 1;
-                       break;
-               }
-
-               /* Wait for the telemetry timer to expire */
-               /* Periodically check the timer since it can be re-initialized above */
-               while(myrpt->unkeytocttimer)
-               {
-                       int ctint;
-                       if(myrpt->unkeytocttimer > 100)
-                               ctint = 100;
-                       else
-                               ctint = myrpt->unkeytocttimer;
-                       ast_safe_sleep(mychannel, ctint);
-                       rpt_mutex_lock(&myrpt->lock);
-                       if(myrpt->unkeytocttimer < ctint)
-                               myrpt->unkeytocttimer = 0;
-                       else
-                               myrpt->unkeytocttimer -= ctint;
-                       rpt_mutex_unlock(&myrpt->lock);
-               }
-       
-               /*
-               * Now, the carrier on the rptr rx should be gone. 
-               * If it re-appeared, then forget about sending the CT
-               */
-               if(myrpt->keyed){
-                       imdone = 1;
-                       break;
-               }
-               
-               rpt_mutex_lock(&myrpt->lock); /* Update the kerchunk counters */
-               myrpt->dailykerchunks++;
-               myrpt->totalkerchunks++;
-               rpt_mutex_unlock(&myrpt->lock);
-       
-               haslink = 0;
-               hastx = 0;
-               hasremote = 0;          
-               l = myrpt->links.next;
-               if (l != &myrpt->links)
-               {
-                       rpt_mutex_lock(&myrpt->lock);
-                       while(l != &myrpt->links)
-                       {
-                               if (l->name[0] == '0')
-                               {
-                                       l = l->next;
-                                       continue;
-                               }
-                               haslink = 1;
-                               if (l->mode) {
-                                       hastx++;
-                                       if (l->isremote) hasremote++;
-                               }
-                               l = l->next;
-                       }
-                       rpt_mutex_unlock(&myrpt->lock);
-               }
-               if (haslink)
-               {
-
-                       res = telem_lookup(myrpt,mychannel, myrpt->name, (!hastx) ? "remotemon" : "remotetx");
-                       if(res)
-                               ast_log(LOG_WARNING, "telem_lookup:remotexx failed on %s\n", mychannel->name);
-                       
-               
-                       /* if in remote cmd mode, indicate it */
-                       if (myrpt->cmdnode[0])
-                       {
-                               ast_safe_sleep(mychannel,200);
-                               res = telem_lookup(myrpt,mychannel, myrpt->name, "cmdmode");
-                               if(res)
-                                       ast_log(LOG_WARNING, "telem_lookup:cmdmode failed on %s\n", mychannel->name);
-                               ast_stopstream(mychannel);
-                       }
-               }
-               else if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "unlinkedct"))){ /* Unlinked Courtesy Tone */
-                       ct_copy = ast_strdup(ct);
-                       if(ct_copy)
-                       {
-                               res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy);
-                               ast_free(ct_copy);
-                       }
-                       else
-                               res = -1;
-                       if(res)
-                               ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name);               
-               }       
-               if (hasremote && (!myrpt->cmdnode[0]))
-               {
-                       /* set for all to hear */
-                       ci.chan = 0;
-                       ci.confno = myrpt->conf;
-                       ci.confmode = DAHDI_CONF_CONFANN;
-                       /* first put the channel on the conference in announce mode */
-                       if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-                       {
-                               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-                               rpt_mutex_lock(&myrpt->lock);
-                               myrpt->active_telem = NULL;
-                               remque((struct qelem *)mytele);
-                               rpt_mutex_unlock(&myrpt->lock);
-                               ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
-                               ast_free(nodename);
-                               ast_free(ident);
-                               ast_free(mytele);               
-                               ast_hangup(mychannel);
-                               pthread_exit(NULL);
-                       }
-                       if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "remotect"))){ /* Unlinked Courtesy Tone */
-                               ast_safe_sleep(mychannel,200);
-                               ct_copy = ast_strdup(ct);
-                               if(ct_copy)
-                               {
-                                       res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy);
-                                       ast_free(ct_copy);
-                               }
-                               else
-                                       res = -1;
-               
-                               if(res)
-                                       ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name);               
-                       }       
-               }
-#if    defined(_MDC_DECODE_H_) && defined(MDC_SAY_WHEN_DOING_CT)
-               if (myrpt->lastunit)
-               {
-                       char mystr[10];
-
-                       ast_safe_sleep(mychannel,200);
-                       /* set for all to hear */
-                       ci.chan = 0;
-                       ci.confno = myrpt->txconf;
-                       ci.confmode = DAHDI_CONF_CONFANN;
-                       /* first put the channel on the conference in announce mode */
-                       if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-                       {
-                               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-                               rpt_mutex_lock(&myrpt->lock);
-                               myrpt->active_telem = NULL;
-                               remque((struct qelem *)mytele);
-                               rpt_mutex_unlock(&myrpt->lock);
-                               ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
-                               ast_free(nodename);
-                               ast_free(ident);
-                               ast_free(mytele);               
-                               ast_hangup(mychannel);
-                               pthread_exit(NULL);
-                       }
-                       sprintf(mystr,"%04x",myrpt->lastunit);
-                       myrpt->lastunit = 0;
-                       ast_say_character_str(mychannel,mystr,NULL,mychannel->language);
-                       break;
-               }
-#endif
-               imdone = 1;
-               break;
-           case LINKUNKEY:
-               if(myrpt->patchnoct && myrpt->callmode){ /* If no CT during patch configured, then don't send one */
-                       imdone = 1;
-                       break;
-               }
-                       
-               /*
-               * Reset the Unkey to CT timer
-               */
-
-               x = get_wait_interval(myrpt, DLY_LINKUNKEY);
-               mytele->mylink.linkunkeytocttimer = x; /* Must be protected as it is changed below */
-
-               /*
-               * If there's one already queued, don't do another
-               */
-
-               tlist = myrpt->tele.next;
-               unkeys_queued = 0;
-                if (tlist != &myrpt->tele)
-                {
-                        rpt_mutex_lock(&myrpt->lock);
-                        while(tlist != &myrpt->tele){
-                                if (tlist->mode == LINKUNKEY) unkeys_queued++;
-                                tlist = tlist->next;
-                        }
-                        rpt_mutex_unlock(&myrpt->lock);
-               }
-               if( unkeys_queued > 1){
-                       imdone = 1;
-                       break;
-               }
-
-               /* Wait for the telemetry timer to expire */
-               /* Periodically check the timer since it can be re-initialized above */
-               while(mytele->mylink.linkunkeytocttimer)
-               {
-                       int ctint;
-                       if(mytele->mylink.linkunkeytocttimer > 100)
-                               ctint = 100;
-                       else
-                               ctint = mytele->mylink.linkunkeytocttimer;
-                       ast_safe_sleep(mychannel, ctint);
-                       rpt_mutex_lock(&myrpt->lock);
-                       if(mytele->mylink.linkunkeytocttimer < ctint)
-                               mytele->mylink.linkunkeytocttimer = 0;
-                       else
-                               mytele->mylink.linkunkeytocttimer -= ctint;
-                       rpt_mutex_unlock(&myrpt->lock);
-               }
-       
-               if((ct = (char *) ast_variable_retrieve(myrpt->cfg, nodename, "linkunkeyct"))){ /* Unlinked Courtesy Tone */
-                       ct_copy = ast_strdup(ct);
-                       if(ct_copy){
-                               res = telem_lookup(myrpt,mychannel, myrpt->name, ct_copy);
-                               ast_free(ct_copy);
-                       }
-                       else
-                               res = -1;
-                       if(res)
-                               ast_log(LOG_WARNING, "telem_lookup:ctx failed on %s\n", mychannel->name);               
-               }       
-               imdone = 1;
-               break;
-           case REMDISC:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               l = myrpt->links.next;
-               haslink = 0;
-               /* don't report if a link for this one still on system */
-               if (l != &myrpt->links)
-               {
-                       rpt_mutex_lock(&myrpt->lock);
-                       while(l != &myrpt->links)
-                       {
-                               if (l->name[0] == '0')
-                               {
-                                       l = l->next;
-                                       continue;
-                               }
-                               if (!strcmp(l->name,mytele->mylink.name))
-                               {
-                                       haslink = 1;
-                                       break;
-                               }
-                               l = l->next;
-                       }
-                       rpt_mutex_unlock(&myrpt->lock);
-               }
-               if (haslink)
-               {
-                       imdone = 1;
-                       break;
-               }
-               res = saynode(myrpt,mychannel,mytele->mylink.name);
-               if (!res) 
-                   res = ast_streamfile(mychannel, ((mytele->mylink.hasconnected) ? 
-                       "rpt/remote_disc" : "rpt/remote_busy"), mychannel->language);
-               break;
-           case REMALREADY:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/remote_already", mychannel->language);
-               break;
-           case REMNOTFOUND:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/remote_notfound", mychannel->language);
-               break;
-           case REMGO:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/remote_go", mychannel->language);
-               break;
-           case CONNECTED:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM,  mychannel);
-               res = saynode(myrpt,mychannel,mytele->mylink.name);
-               if (!res)
-                   res = ast_streamfile(mychannel, "rpt/connected", mychannel->language);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-               ast_stopstream(mychannel);
-               res = ast_streamfile(mychannel, "digits/2", mychannel->language);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-               ast_stopstream(mychannel);
-               res = saynode(myrpt,mychannel,myrpt->name);
-               imdone = 1;
-               break;
-           case CONNFAIL:
-               res = saynode(myrpt,mychannel,mytele->mylink.name);
-               if (!res) 
-                   res = ast_streamfile(mychannel, "rpt/connection_failed", mychannel->language);
-               break;
-           case MEMNOTFOUND:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/memory_notfound", mychannel->language);
-               break;
-           case PLAYBACK:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, mytele->param, mychannel->language);
-               break;
-           case TOPKEY:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               for(i = 0; i < TOPKEYN; i++)
-               {
-                       if (!myrpt->topkey[i].node[0]) continue;
-                       if ((!myrpt->topkeylong) && (myrpt->topkey[i].keyed)) continue;
-                       res = saynode(myrpt, mychannel, myrpt->topkey[i].node);
-                       if (!res) res = sayfile(mychannel,(myrpt->topkey[i].keyed) ?
-                               "rpt/keyedfor" : "rpt/unkeyedfor");
-                       if (!res) res = saynum(mychannel,
-                               myrpt->topkey[i].timesince);
-                       if (!res) res = sayfile(mychannel,"rpt/seconds");
-                       if (!myrpt->topkeylong) break;
-               }
-               imdone = 1;
-               break;
-           case SETREMOTE:
-               ast_mutex_lock(&myrpt->remlock);
-               res = 0;
-               if(!strcmp(myrpt->remoterig, remote_rig_ft897))
-               {
-                       res = set_ft897(myrpt);
-               }
-               else if(!strcmp(myrpt->remoterig, remote_rig_tm271))
-               {
-                       res = set_tm271(myrpt);
-               }
-               else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-               {
-                       res = set_ic706(myrpt);
-               }
-#ifdef HAVE_IOPERM
-               else if(!strcmp(myrpt->remoterig, remote_rig_rbi)||!strcmp(myrpt->remoterig, remote_rig_ppp16))
-               {
-                       if (ioperm(myrpt->p.iobase,1,1) == -1)
-                       {
-                               rpt_mutex_unlock(&myrpt->lock);
-                               ast_log(LOG_WARNING, "Cant get io permission on IO port %x hex\n",myrpt->p.iobase);
-                               res = -1;
-                       }
-                       else res = setrbi(myrpt);
-               }
-#endif
-               else if(!strcmp(myrpt->remoterig, remote_rig_kenwood))
-               {
-                       if (myrpt->iofd >= 0) setdtr(myrpt->iofd,1);
-                       res = setkenwood(myrpt);
-                       if (myrpt->iofd >= 0) setdtr(myrpt->iofd,0);
-                       if (ast_safe_sleep(mychannel,200) == -1)
-                       {
-                               ast_mutex_unlock(&myrpt->remlock);
-                               res = -1;
-                               break;
-                       }
-                       if (myrpt->iofd < 0)
-                       {
-                               i = DAHDI_FLUSH_EVENT;
-                               if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_FLUSH,&i) == -1)
-                               {
-                                       ast_mutex_unlock(&myrpt->remlock);
-                                       ast_log(LOG_ERROR,"Cant flush events");
-                                       res = -1;
-                                       break;
-                               }
-                               if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_GET_PARAMS,&par) == -1)
-                               {
-                                       ast_mutex_unlock(&myrpt->remlock);
-                                       ast_log(LOG_ERROR,"Cant get params");
-                                       res = -1;
-                                       break;
-                               }
-                               myrpt->remoterx = 
-                                       (par.rxisoffhook || (myrpt->tele.next != &myrpt->tele));
-                       }
-               }
-
-               ast_mutex_unlock(&myrpt->remlock);
-               if (!res)
-               {
-                       imdone = 1;
-                       break;
-               }
-               /* fall thru to invalid freq */
-           case INVFREQ:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/invalid-freq", mychannel->language);
-               break;
-           case REMMODE:
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               switch(myrpt->remmode)
-               {
-                   case REM_MODE_FM:
-                       saycharstr(mychannel,"FM");
-                       break;
-                   case REM_MODE_USB:
-                       saycharstr(mychannel,"USB");
-                       break;
-                   case REM_MODE_LSB:
-                       saycharstr(mychannel,"LSB");
-                       break;
-                   case REM_MODE_AM:
-                       saycharstr(mychannel,"AM");
-                       break;
-               }
-               wait_interval(myrpt, DLY_COMP, mychannel);
-               if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
-               break;
-           case LOGINREQ:
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               sayfile(mychannel,"rpt/login");
-               saycharstr(mychannel,myrpt->name);
-               break;
-           case REMLOGIN:
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               saycharstr(mychannel,myrpt->loginuser);
-               saynode(myrpt,mychannel,myrpt->name);
-               wait_interval(myrpt, DLY_COMP, mychannel);
-               if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
-               break;
-           case REMXXX:
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = 0;
-               switch(mytele->submode)
-               {
-                   case 100: /* RX PL Off */
-                       sayfile(mychannel, "rpt/rxpl");
-                       sayfile(mychannel, "rpt/off");
-                       break;
-                   case 101: /* RX PL On */
-                       sayfile(mychannel, "rpt/rxpl");
-                       sayfile(mychannel, "rpt/on");
-                       break;
-                   case 102: /* TX PL Off */
-                       sayfile(mychannel, "rpt/txpl");
-                       sayfile(mychannel, "rpt/off");
-                       break;
-                   case 103: /* TX PL On */
-                       sayfile(mychannel, "rpt/txpl");
-                       sayfile(mychannel, "rpt/on");
-                       break;
-                   case 104: /* Low Power */
-                       sayfile(mychannel, "rpt/lopwr");
-                       break;
-                   case 105: /* Medium Power */
-                       sayfile(mychannel, "rpt/medpwr");
-                       break;
-                   case 106: /* Hi Power */
-                       sayfile(mychannel, "rpt/hipwr");
-                       break;
-                   case 113: /* Scan down slow */
-                       sayfile(mychannel,"rpt/down");
-                       sayfile(mychannel, "rpt/slow");
-                       break;
-                   case 114: /* Scan down quick */
-                       sayfile(mychannel,"rpt/down");
-                       sayfile(mychannel, "rpt/quick");
-                       break;
-                   case 115: /* Scan down fast */
-                       sayfile(mychannel,"rpt/down");
-                       sayfile(mychannel, "rpt/fast");
-                       break;
-                   case 116: /* Scan up slow */
-                       sayfile(mychannel,"rpt/up");
-                       sayfile(mychannel, "rpt/slow");
-                       break;
-                   case 117: /* Scan up quick */
-                       sayfile(mychannel,"rpt/up");
-                       sayfile(mychannel, "rpt/quick");
-                       break;
-                   case 118: /* Scan up fast */
-                       sayfile(mychannel,"rpt/up");
-                       sayfile(mychannel, "rpt/fast");
-                       break;
-                   default:
-                       res = -1;
-               }
-               wait_interval(myrpt, DLY_COMP, mychannel);
-               if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
-               break;
-           case SCAN:
-               ast_mutex_lock(&myrpt->remlock);
-               if (myrpt->hfscanstop)
-               {
-                       myrpt->hfscanstatus = 0;
-                       myrpt->hfscanmode = 0;
-                       myrpt->hfscanstop = 0;
-                       mytele->mode = SCANSTAT;
-                       ast_mutex_unlock(&myrpt->remlock);
-                       if (ast_safe_sleep(mychannel,1000) == -1) break;
-                       sayfile(mychannel, "rpt/stop"); 
-                       imdone = 1;
-                       break;
-               }
-               if (myrpt->hfscanstatus > -2) service_scan(myrpt);
-               i = myrpt->hfscanstatus;
-               myrpt->hfscanstatus = 0;
-               if (i) mytele->mode = SCANSTAT;
-               ast_mutex_unlock(&myrpt->remlock);
-               if (i < 0) sayfile(mychannel, "rpt/stop"); 
-               else if (i > 0) saynum(mychannel,i);
-               imdone = 1;
-               break;
-           case TUNE:
-               ast_mutex_lock(&myrpt->remlock);
-               if (!strcmp(myrpt->remoterig,remote_rig_ic706))
-               {
-                       set_mode_ic706(myrpt, REM_MODE_AM);
-                       if(play_tone(mychannel, 800, 6000, 8192) == -1) break;
-                       ast_safe_sleep(mychannel,500);
-                       set_mode_ic706(myrpt, myrpt->remmode);
-                       myrpt->tunerequest = 0;
-                       ast_mutex_unlock(&myrpt->remlock);
-                       imdone = 1;
-                       break;
-               }
-               set_mode_ft897(myrpt, REM_MODE_AM);
-               simple_command_ft897(myrpt, 8);
-               if(play_tone(mychannel, 800, 6000, 8192) == -1) break;
-               simple_command_ft897(myrpt, 0x88);
-               ast_safe_sleep(mychannel,500);
-               set_mode_ft897(myrpt, myrpt->remmode);
-               myrpt->tunerequest = 0;
-               ast_mutex_unlock(&myrpt->remlock);
-               imdone = 1;
-               break;
-           case REMSHORTSTATUS:
-           case REMLONGSTATUS: 
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = saynode(myrpt,mychannel,myrpt->name);
-               if(!res)
-                       res = sayfile(mychannel,"rpt/frequency");
-               if(!res)
-                       res = split_freq(mhz, decimals, myrpt->freq);
-               if (!multimode_capable(myrpt)) decimals[3] = 0;
-               if(!res){
-                       m = atoi(mhz);
-                       if(m < 100)
-                               res = saynum(mychannel, m);
-                       else
-                               res = saycharstr(mychannel, mhz);
-               }
-               if(!res)
-                       res = sayfile(mychannel, "letters/dot");
-               if(!res)
-                       res = saycharstr(mychannel, decimals);
-       
-               if(res) break;
-               if(myrpt->remmode == REM_MODE_FM){ /* Mode FM? */
-                       switch(myrpt->offset){
-       
-                               case REM_MINUS:
-                                       res = sayfile(mychannel,"rpt/minus");
-                                       break;
-                               
-                               case REM_SIMPLEX:
-                                       res = sayfile(mychannel,"rpt/simplex");
-                                       break;
-                                       
-                               case REM_PLUS:
-                                       res = sayfile(mychannel,"rpt/plus");
-                                       break;
-                                       
-                               default:
-                                       break;
-                       }
-               }
-               else{ /* Must be USB, LSB, or AM */
-                       switch(myrpt->remmode){
-
-                               case REM_MODE_USB:
-                                       res = saycharstr(mychannel, "USB");
-                                       break;
-
-                               case REM_MODE_LSB:
-                                       res = saycharstr(mychannel, "LSB");
-                                       break;
-
-                               case REM_MODE_AM:
-                                       res = saycharstr(mychannel, "AM");
-                                       break;
-
-
-                               default:
-                                       break;
-                       }
-               }
-
-               if (res == -1) break;
-
-               if(mytele->mode == REMSHORTSTATUS){ /* Short status? */
-                       wait_interval(myrpt, DLY_COMP, mychannel);
-                       if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
-                       break;
-               }
-
-               if (strcmp(myrpt->remoterig,remote_rig_ic706))
-               {
-                       switch(myrpt->powerlevel){
-
-                               case REM_LOWPWR:
-                                       res = sayfile(mychannel,"rpt/lopwr") ;
-                                       break;
-                               case REM_MEDPWR:
-                                       res = sayfile(mychannel,"rpt/medpwr");
-                                       break;
-                               case REM_HIPWR:
-                                       res = sayfile(mychannel,"rpt/hipwr"); 
-                                       break;
-                               }
-               }
-
-               rbimode = ((!strncmp(myrpt->remoterig,remote_rig_rbi,3))
-                 || (!strncmp(myrpt->remoterig,remote_rig_ic706,3)));
-               if (res || (sayfile(mychannel,"rpt/rxpl") == -1)) break;
-               if (rbimode && (sayfile(mychannel,"rpt/txpl") == -1)) break;
-               if ((sayfile(mychannel,"rpt/frequency") == -1) ||
-                       (saycharstr(mychannel,myrpt->rxpl) == -1)) break;
-               if ((!rbimode) && ((sayfile(mychannel,"rpt/txpl") == -1) ||
-                       (sayfile(mychannel,"rpt/frequency") == -1) ||
-                       (saycharstr(mychannel,myrpt->txpl) == -1))) break;
-               if(myrpt->remmode == REM_MODE_FM){ /* Mode FM? */
-                       if ((sayfile(mychannel,"rpt/rxpl") == -1) ||
-                               (sayfile(mychannel,((myrpt->rxplon) ? "rpt/on" : "rpt/off")) == -1) ||
-                               (sayfile(mychannel,"rpt/txpl") == -1) ||
-                               (sayfile(mychannel,((myrpt->txplon) ? "rpt/on" : "rpt/off")) == -1))
-                               {
-                                       break;
-                               }
-               }
-               wait_interval(myrpt, DLY_COMP, mychannel);
-               if (!res) res = telem_lookup(myrpt,mychannel, myrpt->name, "functcomplete");
-               break;
-           case STATUS:
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               hastx = 0;
-               linkbase.next = &linkbase;
-               linkbase.prev = &linkbase;
-               rpt_mutex_lock(&myrpt->lock);
-               /* make our own list of links */
-               l = myrpt->links.next;
-               while(l != &myrpt->links)
-               {
-                       if (l->name[0] == '0')
-                       {
-                               l = l->next;
-                               continue;
-                       }
-                       l1 = ast_malloc(sizeof(struct rpt_link));
-                       if (!l1)
-                       {
-                               ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", mychannel->name);
-                               remque((struct qelem *)mytele);
-                               myrpt->active_telem = NULL;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               ast_log(LOG_NOTICE,"Telemetry thread aborted at line %d, mode: %d\n",__LINE__, mytele->mode); /*@@@@@@@@@@@*/
-                               ast_free(nodename);
-                               ast_free(ident);
-                               ast_free(mytele);               
-                               ast_hangup(mychannel);
-                               pthread_exit(NULL);
-                       }
-                       memcpy(l1,l,sizeof(struct rpt_link));
-                       l1->next = l1->prev = NULL;
-                       insque((struct qelem *)l1,(struct qelem *)linkbase.next);
-                       l = l->next;
-               }
-               rpt_mutex_unlock(&myrpt->lock);
-               res = saynode(myrpt,mychannel,myrpt->name);
-               if (myrpt->callmode)
-               {
-                       hastx = 1;
-                       res = ast_streamfile(mychannel, "rpt/autopatch_on", mychannel->language);
-                       if (!res) 
-                               res = ast_waitstream(mychannel, "");
-                       else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-                       ast_stopstream(mychannel);
-               }
-               l = linkbase.next;
-               while(l != &linkbase)
-               {
-                       char *s;
-
-                       hastx = 1;
-                       res = saynode(myrpt,mychannel,l->name);
-                       s = "rpt/tranceive";
-                       if (!l->mode) s = "rpt/monitor";
-                       if (!l->thisconnected) s = "rpt/connecting";
-                       res = ast_streamfile(mychannel, s, mychannel->language);
-                       if (!res) 
-                               res = ast_waitstream(mychannel, "");
-                       else
-                               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-                       ast_stopstream(mychannel);
-                       l = l->next;
-               }                       
-               if (!hastx)
-               {
-                       res = ast_streamfile(mychannel, "rpt/repeat_only", mychannel->language);
-                       if (!res) 
-                               res = ast_waitstream(mychannel, "");
-                       else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-                       ast_stopstream(mychannel);
-               }
-               /* destroy our local link queue */
-               l = linkbase.next;
-               while(l != &linkbase)
-               {
-                       l1 = l;
-                       l = l->next;
-                       remque((struct qelem *)l1);
-                       ast_free(l1);
-               }                       
-               imdone = 1;
-               break;
-           case FULLSTATUS:
-               rpt_mutex_lock(&myrpt->lock);
-               /* get all the nodes */
-               __mklinklist(myrpt,NULL,lbuf);
-               rpt_mutex_unlock(&myrpt->lock);
-               /* parse em */
-               ns = finddelim(lbuf,strs,MAXLINKLIST);
-               /* sort em */
-               if (ns) qsort((void *)strs,ns,sizeof(char *),mycompar);
-               /* wait a little bit */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               hastx = 0;
-               res = saynode(myrpt,mychannel,myrpt->name);
-               if (myrpt->callmode)
-               {
-                       hastx = 1;
-                       res = ast_streamfile(mychannel, "rpt/autopatch_on", mychannel->language);
-                       if (!res) 
-                               res = ast_waitstream(mychannel, "");
-                       else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-                       ast_stopstream(mychannel);
-               }
-               /* go thru all the nodes in list */
-               for(i = 0; i < ns; i++)
-               {
-                       char *s,mode = 'T';
-
-                       /* if a mode spec at first, handle it */
-                       if ((*strs[i] < '0') || (*strs[i] > '9'))
-                       {
-                               mode = *strs[i];
-                               strs[i]++;
-                       }
-
-                       hastx = 1;
-                       res = saynode(myrpt,mychannel,strs[i]);
-                       s = "rpt/tranceive";
-                       if (mode == 'R') s = "rpt/monitor";
-                       if (mode == 'C') s = "rpt/connecting";
-                       res = ast_streamfile(mychannel, s, mychannel->language);
-                       if (!res) 
-                               res = ast_waitstream(mychannel, "");
-                       else
-                               ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-                       ast_stopstream(mychannel);
-               }                       
-               if (!hastx)
-               {
-                       res = ast_streamfile(mychannel, "rpt/repeat_only", mychannel->language);
-                       if (!res) 
-                               res = ast_waitstream(mychannel, "");
-                       else
-                                ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-                       ast_stopstream(mychannel);
-               }
-               imdone = 1;
-               break;
-
-           case LASTNODEKEY: /* Identify last node which keyed us up */
-               rpt_mutex_lock(&myrpt->lock);
-               if(myrpt->lastnodewhichkeyedusup){
-                       p = ast_strdup(myrpt->lastnodewhichkeyedusup); /* Make a local copy of the node name */
-                       if(!p){
-                               ast_log(LOG_WARNING, "ast_strdup failed in telemetery LASTNODEKEY");
-                               imdone = 1;
-                               break;
-                       }
-               }
-               else
-                       p = NULL;
-               rpt_mutex_unlock(&myrpt->lock);
-               if(!p){
-                       imdone = 1; /* no node previously keyed us up, or the node which did has been disconnected */
-                       break;
-               }
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = saynode(myrpt,mychannel,p);
-               ast_free(p);
-               imdone = 1;
-               break;          
-
-           case UNAUTHTX: /* Say unauthorized transmit frequency */
-               wait_interval(myrpt, DLY_TELEM, mychannel);
-               res = ast_streamfile(mychannel, "rpt/unauthtx", mychannel->language);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-               ast_stopstream(mychannel);
-               imdone = 1;
-               break;
-
-           case PARROT: /* Repeat stuff */
-
-               sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
-               if (ast_fileexists(mystr,NULL,mychannel->language) <= 0)
-               {
-                       imdone = 1;
-                       myrpt->parrotstate = 0;
-                       break;
-               }
-               wait_interval(myrpt, DLY_PARROT, mychannel);
-               sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
-               res = ast_streamfile(mychannel, mystr, mychannel->language);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-               ast_stopstream(mychannel);
-               sprintf(mystr,PARROTFILE,myrpt->name,(unsigned int)mytele->parrot);
-               strcat(mystr,".wav");
-               unlink(mystr);                  
-               imdone = 1;
-               myrpt->parrotstate = 0;
-               break;
-
-           case TIMEOUT:
-               res = saynode(myrpt,mychannel,myrpt->name);
-               if (!res)
-                  res = ast_streamfile(mychannel, "rpt/timeout", mychannel->language);
-               break;
-               
-           case TIMEOUT_WARNING:
-               time(&t);
-               res = saynode(myrpt,mychannel,myrpt->name);
-               if (!res)
-                  res = ast_streamfile(mychannel, "rpt/timeout-warning", mychannel->language);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-               ast_stopstream(mychannel);
-               if(!res) /* Say number of seconds */
-                       ast_say_number(mychannel, myrpt->p.remotetimeout - 
-                           (t - myrpt->last_activity_time), 
-                               "", mychannel->language, (char *) NULL);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               ast_stopstream(mychannel);      
-               res = ast_streamfile(mychannel, "queue-seconds", mychannel->language);
-               break;
-
-           case ACT_TIMEOUT_WARNING:
-               time(&t);
-               res = saynode(myrpt,mychannel,myrpt->name);
-               if (!res)
-                   res = ast_streamfile(mychannel, "rpt/act-timeout-warning", mychannel->language);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-               ast_stopstream(mychannel);
-               if(!res) /* Say number of seconds */
-                       ast_say_number(mychannel, myrpt->p.remoteinacttimeout - 
-                           (t - myrpt->last_activity_time), 
-                               "", mychannel->language, (char *) NULL);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               ast_stopstream(mychannel);      
-               res = ast_streamfile(mychannel, "queue-seconds", mychannel->language);
-               break;
-               
-           case STATS_TIME:
-            case STATS_TIME_LOCAL:
-               wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
-               t = time(NULL);
-               rpt_localtime(&t, &localtm);
-               /* Say the phase of the day is before the time */
-               if((localtm.tm_hour >= 0) && (localtm.tm_hour < 12))
-                       p = "rpt/goodmorning";
-               else if((localtm.tm_hour >= 12) && (localtm.tm_hour < 18))
-                       p = "rpt/goodafternoon";
-               else
-                       p = "rpt/goodevening";
-               if (sayfile(mychannel,p) == -1)
-               {
-                       imdone = 1;
-                       break;
-               }
-               /* Say the time is ... */               
-               if (sayfile(mychannel,"rpt/thetimeis") == -1)
-               {
-                       imdone = 1;
-                       break;
-               }
-               /* Say the time */                              
-               res = ast_say_time(mychannel, t, "", mychannel->language);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               ast_stopstream(mychannel);              
-               imdone = 1;
-               break;
-           case STATS_VERSION:
-               p = strstr(tdesc, "version");   
-               if(!p)
-                       break;  
-               if(sscanf(p, "version %30d.%30d", &vmajor, &vminor) != 2)
-                       break;
-               wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
-               /* Say "version" */
-               if (sayfile(mychannel,"rpt/version") == -1)
-               {
-                       imdone = 1;
-                       break;
-               }
-               if(!res) /* Say "X" */
-                       ast_say_number(mychannel, vmajor, "", mychannel->language, (char *) NULL);
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               ast_stopstream(mychannel);      
-               if (saycharstr(mychannel,".") == -1)
-               {
-                       imdone = 1;
-                       break;
-               }
-               if(!res) /* Say "Y" */
-                       ast_say_number(mychannel, vminor, "", mychannel->language, (char *) NULL);
-               if (!res){
-                       res = ast_waitstream(mychannel, "");
-                       ast_stopstream(mychannel);
-               }       
-               else
-                        ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-               imdone = 1;
-               break;
-           case ARB_ALPHA:
-               wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
-               if(mytele->param)
-                       saycharstr(mychannel, mytele->param);
-               imdone = 1;
-               break;
-           case REV_PATCH:
-               wait_interval(myrpt, DLY_TELEM, mychannel); /* Wait a little bit */
-               if(mytele->param) {
-
-                       /* Parts of this section taken from app_parkandannounce */
-                       char *tpl_working, *tpl_current;
-                       char *tmp[100], *myparm;
-                       int looptemp=0,idx=0, dres = 0;
-       
-
-                       tpl_working = ast_strdup(mytele->param);
-                       myparm = strsep(&tpl_working,",");
-                       tpl_current=strsep(&tpl_working, ":");
-
-                       while(tpl_current && looptemp < sizeof(tmp)) {
-                               tmp[looptemp]=tpl_current;
-                               looptemp++;
-                               tpl_current=strsep(&tpl_working,":");
-                       }
-
-                       for(idx=0; idx<looptemp; idx++) {
-                               if(!strcmp(tmp[idx], "PARKED")) {
-                                       ast_say_digits(mychannel, atoi(myparm), "", mychannel->language);
-                               } else if(!strcmp(tmp[idx], "NODE")) {
-                                       ast_say_digits(mychannel, atoi(myrpt->name), "", mychannel->language);
-                               } else {
-                                       dres = ast_streamfile(mychannel, tmp[idx], mychannel->language);
-                                       if(!dres) {
-                                               dres = ast_waitstream(mychannel, "");
-                                       } else {
-                                               ast_log(LOG_WARNING, "ast_streamfile of %s failed on %s\n", tmp[idx], mychannel->name);
-                                               dres = 0;
-                                       }
-                               }
-                       }
-                       ast_free(tpl_working);
-               }
-               imdone = 1;
-               break;
-           case TEST_TONE:
-               imdone = 1;
-               if (myrpt->stopgen) break;
-               myrpt->stopgen = -1;
-               if ((res = ast_tonepair_start(mychannel, 1004.0, 0, 99999999, 7200.0))) 
-               {
-                       myrpt->stopgen = 0;
-                       break;
-               }
-               while(mychannel->generatordata && (myrpt->stopgen <= 0)) {
-                       if (ast_safe_sleep(mychannel,1)) break;
-                       imdone = 1;
-                       }
-               myrpt->stopgen = 0;
-               break;
-           default:
-               break;
-       }
-       if (!imdone)
-       {
-               if (!res) 
-                       res = ast_waitstream(mychannel, "");
-               else {
-                       ast_log(LOG_WARNING, "ast_streamfile failed on %s\n", mychannel->name);
-                       res = 0;
-               }
-       }
-       ast_stopstream(mychannel);
-       rpt_mutex_lock(&myrpt->lock);
-       if (mytele->mode == TAILMSG)
-       {
-               if (!res)
-               {
-                       myrpt->tailmessagen++;
-                       if(myrpt->tailmessagen >= myrpt->p.tailmessagemax) myrpt->tailmessagen = 0;
-               }
-               else
-               {
-                       myrpt->tmsgtimer = myrpt->p.tailsquashedtime;
-               }
-       }
-       remque((struct qelem *)mytele);
-       myrpt->active_telem = NULL;
-       rpt_mutex_unlock(&myrpt->lock);
-       ast_free(nodename);
-       ast_free(ident);
-       ast_free(mytele);               
-       ast_hangup(mychannel);
-#ifdef  APP_RPT_LOCK_DEBUG
-       {
-               struct lockthread *t;
-
-               sleep(5);
-               ast_mutex_lock(&locklock);
-               t = get_lockthread(pthread_self());
-               if (t) memset(t,0,sizeof(struct lockthread));
-               ast_mutex_unlock(&locklock);
-       }                       
-#endif
-       pthread_exit(NULL);
-}
-
-static void rpt_telemetry(struct rpt *myrpt,int mode, void *data)
-{
-struct rpt_tele *tele;
-struct rpt_link *mylink = NULL;
-int res;
-pthread_attr_t attr;
-char *v1, *v2;
-
-       if(debug > 6)
-               ast_log(LOG_NOTICE,"mode=%i  data=%s\n",mode, (char *)data);
-
-       switch(mode)
-       {
-           case UNKEY:
-               /* if any of the following are defined, go ahead and do it,
-                  otherwise, don't bother */
-               v1 = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, 
-                       "unlinkedct");
-               v2 = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, 
-                       "remotect");
-               if (telem_lookup(myrpt,NULL, myrpt->name, "remotemon") &&
-                 telem_lookup(myrpt,NULL, myrpt->name, "remotetx") &&
-                 telem_lookup(myrpt,NULL, myrpt->name, "cmdmode") &&
-                 (!(v1 && telem_lookup(myrpt,NULL, myrpt->name, v1))) && 
-                 (!(v2 && telem_lookup(myrpt,NULL, myrpt->name, v2)))) return;
-               break;
-           case LINKUNKEY:
-               if (!ast_variable_retrieve(myrpt->cfg, myrpt->name, "linkunkeyct"))
-                       return;
-               break;
-           default:
-               break;
-       }
-       tele = ast_malloc(sizeof(struct rpt_tele));
-       if (!tele)
-       {
-               ast_log(LOG_WARNING, "Unable to allocate memory\n");
-               pthread_exit(NULL);
-               return;
-       }
-       /* zero it out */
-       memset((char *)tele,0,sizeof(struct rpt_tele));
-       tele->rpt = myrpt;
-       tele->mode = mode;
-       if (mode == PARROT) tele->parrot = (uintptr_t) data;
-       else mylink = (struct rpt_link *) data;
-       rpt_mutex_lock(&myrpt->lock);
-       if((mode == CONNFAIL) || (mode == REMDISC) || (mode == CONNECTED) ||
-           (mode == LINKUNKEY)){
-               memset(&tele->mylink,0,sizeof(struct rpt_link));
-               if (mylink){
-                       memcpy(&tele->mylink,mylink,sizeof(struct rpt_link));
-               }
-       }
-       else if ((mode == ARB_ALPHA) || (mode == REV_PATCH) || (mode == PLAYBACK)) {
-               strncpy(tele->param, (char *) data, TELEPARAMSIZE - 1);
-               tele->param[TELEPARAMSIZE - 1] = 0;
-       }
-       if (mode == REMXXX) tele->submode = (intptr_t) data;
-       insque((struct qelem *)tele, (struct qelem *)myrpt->tele.next);
-       rpt_mutex_unlock(&myrpt->lock);
-        pthread_attr_init(&attr);
-        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-       res = ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
-       if(res < 0){
-               rpt_mutex_lock(&myrpt->lock);
-               remque((struct qlem *) tele); /* We don't like stuck transmitters, remove it from the queue */
-               rpt_mutex_unlock(&myrpt->lock); 
-               ast_log(LOG_WARNING, "Could not create telemetry thread: %s",strerror(res));
-       }
-       return;
-}
-
-static void *rpt_call(void *this)
-{
-struct dahdi_confinfo ci;  /* conference info */
-struct rpt *myrpt = (struct rpt *)this;
-int    res;
-int stopped,congstarted,dialtimer,lastcidx,aborted;
-struct ast_channel *mychannel,*genchannel;
-struct ast_format_cap *cap = NULL;
-
-       myrpt->mydtmf = 0;
-       /* allocate a pseudo-channel thru asterisk */
-       mychannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!mychannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               pthread_exit(NULL);
-       }
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (mychannel->cdr)
-               ast_set_flag(mychannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       ci.chan = 0;
-       ci.confno = myrpt->conf; /* use the pseudo conference */
-#if    0
-       ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER
-               | DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER; 
-#endif
-       ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER;
-       /* first put the channel on the conference */
-       if (ioctl(mychannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               ast_hangup(mychannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       /* allocate a pseudo-channel thru asterisk */
-       genchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!genchannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               ast_hangup(mychannel);
-               pthread_exit(NULL);
-       }
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (genchannel->cdr)
-               ast_set_flag(genchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       ci.chan = 0;
-       ci.confno = myrpt->conf;
-       ci.confmode = DAHDI_CONF_REALANDPSEUDO | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER
-               | DAHDI_CONF_PSEUDO_TALKER | DAHDI_CONF_PSEUDO_LISTENER; 
-       /* first put the channel on the conference */
-       if (ioctl(genchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               ast_hangup(mychannel);
-               ast_hangup(genchannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       if (myrpt->p.tonezone && (tone_zone_set_zone(mychannel->fds[0],myrpt->p.tonezone) == -1))
-       {
-               ast_log(LOG_WARNING, "Unable to set tone zone %s\n",myrpt->p.tonezone);
-               ast_hangup(mychannel);
-               ast_hangup(genchannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       if (myrpt->p.tonezone && (tone_zone_set_zone(genchannel->fds[0],myrpt->p.tonezone) == -1))
-       {
-               ast_log(LOG_WARNING, "Unable to set tone zone %s\n",myrpt->p.tonezone);
-               ast_hangup(mychannel);
-               ast_hangup(genchannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       /* start dialtone if patchquiet is 0. Special patch modes don't send dial tone */
-       if ((!myrpt->patchquiet) && (tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_DIALTONE) < 0))
-       {
-               ast_log(LOG_WARNING, "Cannot start dialtone\n");
-               ast_hangup(mychannel);
-               ast_hangup(genchannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       stopped = 0;
-       congstarted = 0;
-       dialtimer = 0;
-       lastcidx = 0;
-       myrpt->calldigittimer = 0;
-       aborted = 0;
-
-       while ((myrpt->callmode == 1) || (myrpt->callmode == 4))
-       {
-               if((myrpt->patchdialtime)&&(myrpt->callmode == 1)&&(myrpt->cidx != lastcidx)){
-                       dialtimer = 0;
-                       lastcidx = myrpt->cidx;
-               }               
-
-               if((myrpt->patchdialtime)&&(dialtimer >= myrpt->patchdialtime)){ 
-                   if(debug)
-                       ast_log(LOG_NOTICE, "dialtimer %i > patchdialtime %i\n", dialtimer,myrpt->patchdialtime);
-                       rpt_mutex_lock(&myrpt->lock);
-                       aborted = 1;
-                       myrpt->callmode = 0;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       break;
-               }
-       
-               if ((!myrpt->patchquiet) && (!stopped) && (myrpt->callmode == 1) && (myrpt->cidx > 0))
-               {
-                       stopped = 1;
-                       /* stop dial tone */
-                       tone_zone_play_tone(genchannel->fds[0],-1);
-               }
-               if (myrpt->callmode == 1)
-               {
-                       if(myrpt->calldigittimer > PATCH_DIALPLAN_TIMEOUT)
-                       {
-                               myrpt->callmode = 2;
-                               break;
-                       }
-                       /* bump timer if active */
-                       if (myrpt->calldigittimer) 
-                               myrpt->calldigittimer += MSWAIT;
-               }
-               if (myrpt->callmode == 4)
-               {
-                       if(!congstarted){
-                               congstarted = 1;
-                               /* start congestion tone */
-                               tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_CONGESTION);
-                       }
-               }
-               res = ast_safe_sleep(mychannel, MSWAIT);
-               if (res < 0)
-               {
-                   if(debug)
-                       ast_log(LOG_NOTICE, "ast_safe_sleep=%i\n", res);
-                       ast_hangup(mychannel);
-                       ast_hangup(genchannel);
-                       rpt_mutex_lock(&myrpt->lock);
-                       myrpt->callmode = 0;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       pthread_exit(NULL);
-               }
-               dialtimer += MSWAIT;
-       }
-       /* stop any tone generation */
-       tone_zone_play_tone(genchannel->fds[0],-1);
-       /* end if done */
-       if (!myrpt->callmode)
-       {
-               if(debug)
-                       ast_log(LOG_NOTICE, "callmode==0\n");
-               ast_hangup(mychannel);
-               ast_hangup(genchannel);
-               rpt_mutex_lock(&myrpt->lock);
-               myrpt->callmode = 0;
-               myrpt->macropatch=0;
-               channel_revert(myrpt);
-               rpt_mutex_unlock(&myrpt->lock);
-               if((!myrpt->patchquiet) && aborted)
-                       rpt_telemetry(myrpt, TERM, NULL);
-               pthread_exit(NULL);                     
-       }
-
-       if (myrpt->p.ourcallerid && *myrpt->p.ourcallerid){
-               char *name, *loc, *instr;
-               instr = ast_strdup(myrpt->p.ourcallerid);
-               if(instr){
-                       ast_callerid_parse(instr, &name, &loc);
-                       if(loc){
-                               mychannel->caller.id.number.valid = 1;
-                               ast_free(mychannel->caller.id.number.str);
-                               mychannel->caller.id.number.str = ast_strdup(loc);
-                       }
-                       if(name){
-                               mychannel->caller.id.name.valid = 1;
-                               ast_free(mychannel->caller.id.name.str);
-                               mychannel->caller.id.name.str = ast_strdup(name);
-                       }
-                       ast_free(instr);
-               }
-       }
-
-       ast_copy_string(mychannel->exten, myrpt->exten, sizeof(mychannel->exten) - 1);
-       ast_copy_string(mychannel->context, myrpt->patchcontext, sizeof(mychannel->context) - 1);
-       
-       if (myrpt->p.acctcode)
-               ast_cdr_setaccount(mychannel,myrpt->p.acctcode);
-       mychannel->priority = 1;
-       ast_channel_undefer_dtmf(mychannel);
-       if (ast_pbx_start(mychannel) < 0)
-       {
-               ast_log(LOG_WARNING, "Unable to start PBX!!\n");
-               ast_hangup(mychannel);
-               ast_hangup(genchannel);
-               rpt_mutex_lock(&myrpt->lock);
-               myrpt->callmode = 0;
-               rpt_mutex_unlock(&myrpt->lock);
-               pthread_exit(NULL);
-       }
-       usleep(10000);
-       rpt_mutex_lock(&myrpt->lock);
-       myrpt->callmode = 3;
-       /* set appropriate conference for the pseudo */
-       ci.chan = 0;
-       ci.confno = myrpt->conf;
-       ci.confmode = (myrpt->p.duplex == 2) ? DAHDI_CONF_CONFANNMON :
-               (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
-       /* first put the channel on the conference in announce mode */
-       if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               ast_hangup(mychannel);
-               ast_hangup(genchannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       /* get its channel number */
-       if (ioctl(mychannel->fds[0],DAHDI_CHANNO,&res) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to get autopatch channel number\n");
-               ast_hangup(mychannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       ci.chan = 0;
-       ci.confno = res;
-       ci.confmode = DAHDI_CONF_MONITOR;
-       /* put vox channel monitoring on the channel  */
-       if (ioctl(myrpt->voxchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               ast_hangup(mychannel);
-               myrpt->callmode = 0;
-               pthread_exit(NULL);
-       }
-       while(myrpt->callmode)
-       {
-               if ((!mychannel->pbx) && (myrpt->callmode != 4))
-               {
-                   /* If patch is setup for far end disconnect */
-                       if(myrpt->patchfarenddisconnect || (myrpt->p.duplex < 2)){ 
-                               if(debug)ast_log(LOG_NOTICE,"callmode=%i, patchfarenddisconnect=%i, duplex=%i\n",\
-                                               myrpt->callmode,myrpt->patchfarenddisconnect,myrpt->p.duplex);
-                               myrpt->callmode = 0;
-                               myrpt->macropatch=0;
-                               if(!myrpt->patchquiet){
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       rpt_telemetry(myrpt, TERM, NULL);
-                                       rpt_mutex_lock(&myrpt->lock);
-                               }
-                       }
-                       else{ /* Send congestion until patch is downed by command */
-                               myrpt->callmode = 4;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               /* start congestion tone */
-                               tone_zone_play_tone(genchannel->fds[0],DAHDI_TONE_CONGESTION);
-                               rpt_mutex_lock(&myrpt->lock);
-                       }
-               }
-               if (myrpt->mydtmf)
-               {
-                       struct ast_frame wf = {AST_FRAME_DTMF, } ;
-                       wf.subclass.integer = myrpt->mydtmf;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_queue_frame(mychannel,&wf);
-#ifdef NEW_ASTERISK
-                       ast_senddigit(genchannel,myrpt->mydtmf,0);
-#else
-                       ast_senddigit(genchannel,myrpt->mydtmf);
-#endif
-                       rpt_mutex_lock(&myrpt->lock);
-                       myrpt->mydtmf = 0;
-               }
-               rpt_mutex_unlock(&myrpt->lock);
-               usleep(MSWAIT * 1000);
-               rpt_mutex_lock(&myrpt->lock);
-       }
-       if(debug)
-               ast_log(LOG_NOTICE, "exit channel loop\n");
-       rpt_mutex_unlock(&myrpt->lock);
-       tone_zone_play_tone(genchannel->fds[0],-1);
-       if (mychannel->pbx) ast_softhangup(mychannel,AST_SOFTHANGUP_DEV);
-       ast_hangup(genchannel);
-       rpt_mutex_lock(&myrpt->lock);
-       myrpt->callmode = 0;
-       myrpt->macropatch=0;
-       channel_revert(myrpt);
-       rpt_mutex_unlock(&myrpt->lock);
-       /* set appropriate conference for the pseudo */
-       ci.chan = 0;
-       ci.confno = myrpt->conf;
-       ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON :
-               (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
-       /* first put the channel on the conference in announce mode */
-       if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-       }
-       pthread_exit(NULL);
-}
-
-static void send_link_dtmf(struct rpt *myrpt,char c)
-{
-char   str[300];
-struct ast_frame wf;
-struct rpt_link *l;
-
-       snprintf(str, sizeof(str), "D %s %s %d %c", myrpt->cmdnode, myrpt->name, ++(myrpt->dtmfidx), c);
-       wf.frametype = AST_FRAME_TEXT;
-       wf.subclass.integer = 0;
-       wf.offset = 0;
-       wf.mallocd = 0;
-       wf.datalen = strlen(str) + 1;
-       wf.samples = 0;
-       l = myrpt->links.next;
-       /* first, see if our dude is there */
-       while(l != &myrpt->links)
-       {
-               if (l->name[0] == '0') 
-               {
-                       l = l->next;
-                       continue;
-               }
-               /* if we found it, write it and were done */
-               if (!strcmp(l->name,myrpt->cmdnode))
-               {
-                       wf.data.ptr = str;
-                       if (l->chan) ast_write(l->chan,&wf);
-                       return;
-               }
-               l = l->next;
-       }
-       l = myrpt->links.next;
-       /* if not, give it to everyone */
-       while(l != &myrpt->links)
-       {
-               wf.data.ptr = str;
-               if (l->chan) ast_write(l->chan,&wf);
-               l = l->next;
-       }
-       return;
-}
-
-static void send_link_keyquery(struct rpt *myrpt)
-{
-char   str[300];
-struct ast_frame wf;
-struct rpt_link *l;
-
-       rpt_mutex_lock(&myrpt->lock);
-       memset(myrpt->topkey,0,sizeof(myrpt->topkey));
-       myrpt->topkeystate = 1;
-       time(&myrpt->topkeytime);
-       rpt_mutex_unlock(&myrpt->lock);
-       snprintf(str, sizeof(str), "K? * %s 0 0", myrpt->name);
-       wf.frametype = AST_FRAME_TEXT;
-       wf.subclass.integer = 0;
-       wf.offset = 0;
-       wf.mallocd = 0;
-       wf.datalen = strlen(str) + 1;
-       wf.samples = 0;
-       l = myrpt->links.next;
-       /* give it to everyone */
-       while(l != &myrpt->links)
-       {
-               wf.data.ptr = str;
-               if (l->chan) ast_write(l->chan,&wf);
-               l = l->next;
-       }
-       return;
-}
-
-/* send newkey request */
-
-static void send_newkey(struct ast_channel *chan)
-{
-
-       /* ast_safe_sleep(chan,10); */
-       ast_sendtext(chan,newkeystr);
-       return;
-}
-
-
-/* 
- * Connect a link 
- *
- * Return values:
- * -2: Attempt to connect to self 
- * -1: No such node
- *  0: Success
- *  1: No match yet
- *  2: Already connected to this node
- */
-
-static int connect_link(struct rpt *myrpt, char* node, int mode, int perma)
-{
-       char *val, *s, *s1, *tele;
-       char lstr[MAXLINKLIST],*strs[MAXLINKLIST];
-       char tmp[300], deststr[300] = "",modechange = 0;
-       char sx[320],*sy;
-       struct rpt_link *l;
-       int reconnects = 0;
-       int i,n;
-       struct dahdi_confinfo ci;  /* conference info */
-       struct ast_format_cap *cap = NULL;
-
-       val = node_lookup(myrpt,node);
-       if (!val){
-               if(strlen(node) >= myrpt->longestnode)
-                       return -1; /* No such node */
-               return 1; /* No match yet */
-       }
-
-       if(!strcmp(myrpt->name,node)) /* Do not allow connections to self */
-               return -2;
-               
-       if(debug > 3){
-               ast_log(LOG_NOTICE,"Connect attempt to node %s\n", node);
-               ast_log(LOG_NOTICE,"Mode: %s\n",(mode)?"Transceive":"Monitor");
-               ast_log(LOG_NOTICE,"Connection type: %s\n",(perma)?"Permalink":"Normal");
-       }
-
-       strncpy(tmp,val,sizeof(tmp) - 1);
-       s = tmp;
-       s1 = strsep(&s,",");
-       if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
-       {
-               sy = strchr(s1,'/');            
-               *sy = 0;
-               sprintf(sx,"%s:4569/%s",s1,sy + 1);
-               s1 = sx;
-       }
-       strsep(&s,",");
-       rpt_mutex_lock(&myrpt->lock);
-       l = myrpt->links.next;
-       /* try to find this one in queue */
-       while(l != &myrpt->links){
-               if (l->name[0] == '0') 
-               {
-                       l = l->next;
-                       continue;
-               }
-       /* if found matching string */
-               if (!strcmp(l->name, node))
-                       break;
-               l = l->next;
-       }
-       /* if found */
-       if (l != &myrpt->links){ 
-       /* if already in this mode, just ignore */
-               if ((l->mode) || (!l->chan)) {
-                       rpt_mutex_unlock(&myrpt->lock);
-                       return 2; /* Already linked */
-               }
-               reconnects = l->reconnects;
-               rpt_mutex_unlock(&myrpt->lock);
-               if (l->chan) ast_softhangup(l->chan, AST_SOFTHANGUP_DEV);
-               l->retries = l->max_retries + 1;
-               l->disced = 2;
-               modechange = 1;
-       } else
-       {
-               __mklinklist(myrpt,NULL,lstr);
-               rpt_mutex_unlock(&myrpt->lock);
-               n = finddelim(lstr,strs,MAXLINKLIST);
-               for(i = 0; i < n; i++)
-               {
-                       if ((*strs[i] < '0') || 
-                           (*strs[i] > '9')) strs[i]++;
-                       if (!strcmp(strs[i],node))
-                       {
-                               return 2; /* Already linked */
-                       }
-               }
-       }
-       strncpy(myrpt->lastlinknode,node,MAXNODESTR - 1);
-       /* establish call */
-       l = ast_malloc(sizeof(struct rpt_link));
-       if (!l)
-       {
-               ast_log(LOG_WARNING, "Unable to malloc\n");
-               return -1;
-       }
-       /* zero the silly thing */
-       memset((char *)l,0,sizeof(struct rpt_link));
-       l->mode = mode;
-       l->outbound = 1;
-       l->thisconnected = 0;
-       voxinit_link(l,1);
-       strncpy(l->name, node, MAXNODESTR - 1);
-       l->isremote = (s && ast_true(s));
-       if (modechange) l->connected = 1;
-       l->hasconnected = l->perma = perma;
-#ifdef ALLOW_LOCAL_CHANNELS
-       if ((strncasecmp(s1,"iax2/", 5) == 0) || (strncasecmp(s1, "local/", 6) == 0))
-               strncpy(deststr, s1, sizeof(deststr));
-       else
-               snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
-#else
-       snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
-#endif
-       tele = strchr(deststr, '/');
-       if (!tele){
-               ast_log(LOG_WARNING,"link3:Dial number (%s) must be in format tech/number\n",deststr);
-               ast_free(l);
-               return -1;
-       }
-       *tele++ = 0;
-       l->chan = ast_request(deststr, get_slin_cap(cap), NULL, tele, NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (l->chan){
-               ast_set_read_format_by_id(l->chan, AST_FORMAT_SLINEAR);
-               ast_set_write_format_by_id(l->chan, AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-               if (l->chan->cdr)
-                       ast_set_flag(l->chan->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef        NEW_ASTERISK
-               l->chan->whentohangup = 0;
-#endif
-               l->chan->appl = "Apprpt";
-               l->chan->data = "(Remote Rx)";
-               if (debug > 3)
-                       ast_log(LOG_NOTICE, "rpt (remote) initiating call to %s/%s on %s\n",
-               deststr, tele, l->chan->name);
-               l->chan->caller.id.number.valid = 1;
-               ast_free(l->chan->caller.id.number.str);
-               l->chan->caller.id.number.str = ast_strdup(myrpt->name);
-               ast_call(l->chan,tele,999);
-       }
-       else {
-               if(debug > 3) 
-                       ast_log(LOG_NOTICE, "Unable to place call to %s/%s on %s\n",
-               deststr,tele,l->chan->name);
-               if (myrpt->p.archivedir)
-               {
-                       char str[100];
-                       sprintf(str,"LINKFAIL,%s",l->name);
-                       donodelog(myrpt,str);
-               }
-               ast_free(l);
-               return -1;
-       }
-       /* allocate a pseudo-channel thru asterisk */
-       l->pchan = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!l->pchan){
-               ast_log(LOG_WARNING,"rpt connect: Sorry unable to obtain pseudo channel\n");
-               ast_hangup(l->chan);
-               ast_free(l);
-               return -1;
-       }
-       ast_set_read_format_by_id(l->pchan, AST_FORMAT_SLINEAR);
-       ast_set_write_format_by_id(l->pchan, AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (l->pchan->cdr)
-               ast_set_flag(l->pchan->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       /* make a conference for the tx */
-       ci.chan = 0;
-       ci.confno = myrpt->conf;
-       ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER;
-       /* first put the channel on the conference in proper mode */
-       if (ioctl(l->pchan->fds[0], DAHDI_SETCONF, &ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               ast_hangup(l->chan);
-               ast_hangup(l->pchan);
-               ast_free(l);
-               return -1;
-       }
-       rpt_mutex_lock(&myrpt->lock);
-       l->reconnects = reconnects;
-       /* insert at end of queue */
-       l->max_retries = MAX_RETRIES;
-       if (perma)
-               l->max_retries = MAX_RETRIES_PERM;
-       if (l->isremote) l->retries = l->max_retries + 1;
-       insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
-       __kickshort(myrpt);
-       rpt_mutex_unlock(&myrpt->lock);
-       if (!l->phonemode) send_newkey(l->chan);
-       return 0;
-}
-
-
-
-/*
-* Internet linking function 
-*/
-
-static int function_ilink(struct rpt *myrpt, char *param, char *digits, int command_source, struct rpt_link *mylink)
-{
-
-       char *val, *s, *s1;
-       char tmp[300];
-       char digitbuf[MAXNODESTR],*strs[MAXLINKLIST];
-       char mode,perma;
-       char sx[320],*sy;
-       struct rpt_link *l;
-       int i,r;
-
-       if(!param)
-               return DC_ERROR;
-               
-                       
-       if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable )
-               return DC_ERROR;
-
-       strncpy(digitbuf,digits,MAXNODESTR - 1);
-
-       if(debug > 6)
-               printf("@@@@ ilink param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-               
-       switch(myatoi(param)){
-               case 11: /* Perm Link off */
-               case 1: /* Link off */
-                       if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
-                               strcpy(digitbuf,myrpt->lastlinknode);
-                       val = node_lookup(myrpt,digitbuf);
-                       if (!val){
-                               if(strlen(digitbuf) >= myrpt->longestnode)
-                                       return DC_ERROR;
-                               break;
-                       }
-                       strncpy(tmp,val,sizeof(tmp) - 1);
-                       s = tmp;
-                       s1 = strsep(&s,",");
-                       if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
-                       {
-                               sy = strchr(s1,'/');            
-                               *sy = 0;
-                               sprintf(sx,"%s:4569/%s",s1,sy + 1);
-                               s1 = sx;
-                       }
-                       strsep(&s,",");
-                       rpt_mutex_lock(&myrpt->lock);
-                       l = myrpt->links.next;
-                       /* try to find this one in queue */
-                       while(l != &myrpt->links){
-                               if (l->name[0] == '0') 
-                               {
-                                       l = l->next;
-                                       continue;
-                               }
-                               /* if found matching string */
-                               if (!strcmp(l->name, digitbuf))
-                                       break;
-                               l = l->next;
-                       }
-                       if (l != &myrpt->links){ /* if found */
-                               struct  ast_frame wf;
-
-                               /* must use perm command on perm link */
-                               if ((myatoi(param) < 10) && 
-                                   (l->max_retries > MAX_RETRIES))
-                               {
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       return DC_COMPLETE;
-                               }
-                               strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
-                               l->retries = l->max_retries + 1;
-                               l->disced = 1;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               wf.frametype = AST_FRAME_TEXT;
-                               wf.subclass.integer = 0;
-                               wf.offset = 0;
-                               wf.mallocd = 0;
-                               wf.datalen = strlen(discstr) + 1;
-                               wf.samples = 0;
-                               wf.data.ptr = discstr;
-                               if (l->chan)
-                               {
-                                       ast_write(l->chan,&wf);
-                                       if (ast_safe_sleep(l->chan,250) == -1) return DC_ERROR;
-                                       ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
-                               }
-                               rpt_telemetry(myrpt, COMPLETE, NULL);
-                               return DC_COMPLETE;
-                       }
-                       rpt_mutex_unlock(&myrpt->lock); 
-                       return DC_COMPLETE;
-               case 2: /* Link Monitor */
-               case 3: /* Link transceive */
-               case 12: /* Link Monitor permanent */
-               case 13: /* Link transceive permanent */
-                       if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
-                               strcpy(digitbuf,myrpt->lastlinknode);
-                       /* Attempt connection  */
-                       perma = (atoi(param) > 10) ? 1 : 0;
-                       mode = (atoi(param) & 1) ? 1 : 0;
-                       r = connect_link(myrpt, digitbuf, mode, perma);
-                       switch(r){
-                               case -2: /* Attempt to connect to self */
-                                       return DC_COMPLETE; /* Silent error */
-
-                               case 0:
-                                       rpt_telemetry(myrpt, COMPLETE, NULL);
-                                       return DC_COMPLETE;
-
-                               case 1:
-                                       break;
-                               
-                               case 2:
-                                       rpt_telemetry(myrpt, REMALREADY, NULL);
-                                       return DC_COMPLETE;
-                               
-                               default:
-                                       rpt_telemetry(myrpt, CONNFAIL, NULL);
-                                       return DC_COMPLETE;
-                       }
-                       break;
-
-               case 4: /* Enter Command Mode */
-               
-                       /* if doesnt allow link cmd, or no links active, return */
-                       if (((command_source != SOURCE_RPT) && 
-                               (command_source != SOURCE_PHONE) &&
-                               (command_source != SOURCE_ALT) &&
-                               (command_source != SOURCE_DPHONE)) ||
-                                (myrpt->links.next == &myrpt->links))
-                               return DC_COMPLETE;
-                       
-                       /* if already in cmd mode, or selected self, fughetabahtit */
-                       if ((myrpt->cmdnode[0]) || (!strcmp(myrpt->name, digitbuf))){
-                       
-                               rpt_telemetry(myrpt, REMALREADY, NULL);
-                               return DC_COMPLETE;
-                       }
-                       if ((digitbuf[0] == '0') && (myrpt->lastlinknode[0]))
-                               strcpy(digitbuf,myrpt->lastlinknode);
-                       /* node must at least exist in list */
-                       val = node_lookup(myrpt,digitbuf);
-                       if (!val){
-                               if(strlen(digitbuf) >= myrpt->longestnode)
-                                       return DC_ERROR;
-                               break;
-                       
-                       }
-                       rpt_mutex_lock(&myrpt->lock);
-                       strcpy(myrpt->lastlinknode,digitbuf);
-                       strncpy(myrpt->cmdnode, digitbuf, sizeof(myrpt->cmdnode) - 1);
-                       rpt_mutex_unlock(&myrpt->lock);
-                       rpt_telemetry(myrpt, REMGO, NULL);      
-                       return DC_COMPLETE;
-                       
-               case 5: /* Status */
-                       rpt_telemetry(myrpt, STATUS, NULL);
-                       return DC_COMPLETE;
-
-               case 15: /* Full Status */
-                       rpt_telemetry(myrpt, FULLSTATUS, NULL);
-                       return DC_COMPLETE;
-                       
-                       
-               case 6: /* All Links Off, including permalinks */
-                       rpt_mutex_lock(&myrpt->lock);
-                       myrpt->savednodes[0] = 0;
-                        l = myrpt->links.next;
-                        /* loop through all links */
-                        while(l != &myrpt->links){
-                               struct  ast_frame wf;
-                                if (l->name[0] == '0') /* Skip any IAXRPT monitoring */
-                                {
-                                        l = l->next;
-                                        continue;
-                                }
-                               /* Make a string of disconnected nodes for possible restoration */
-                               sprintf(tmp,"%c%c%s",(l->mode) ? 'X' : 'M',(l->perma) ? 'P':'T',l->name);
-                               if(strlen(tmp) + strlen(myrpt->savednodes) + 1 < MAXNODESTR){ 
-                                       if(myrpt->savednodes[0])
-                                               strcat(myrpt->savednodes, ",");
-                                       strcat(myrpt->savednodes, tmp);
-                               }
-                               l->retries = l->max_retries + 1;
-                                l->disced = 2; /* Silently disconnect */
-                                rpt_mutex_unlock(&myrpt->lock);
-                               /* ast_log(LOG_NOTICE,"dumping link %s\n",l->name); */
-                                
-                                wf.frametype = AST_FRAME_TEXT;
-                                wf.subclass.integer = 0;
-                                wf.offset = 0;
-                                wf.mallocd = 0;
-                                wf.datalen = strlen(discstr) + 1;
-                                wf.samples = 0;
-                                wf.data.ptr = discstr;
-                                if (l->chan)
-                                {
-                                        ast_write(l->chan,&wf);
-                                        ast_safe_sleep(l->chan,250); /* It's dead already, why check the return value? */
-                                        ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
-                                }
-                               rpt_mutex_lock(&myrpt->lock);
-                                l = l->next;
-                        }
-                       rpt_mutex_unlock(&myrpt->lock);
-                       if(debug > 3)
-                               ast_log(LOG_NOTICE,"Nodes disconnected: %s\n",myrpt->savednodes);
-                        rpt_telemetry(myrpt, COMPLETE, NULL);
-                       return DC_COMPLETE;
-
-               case 7: /* Identify last node which keyed us up */
-                       rpt_telemetry(myrpt, LASTNODEKEY, NULL);
-                       break;
-
-
-#ifdef _MDC_DECODE_H_
-               case 8:
-                       myrpt->lastunit = 0xd00d; 
-                       mdc1200_notify(myrpt,NULL,myrpt->lastunit);
-                       mdc1200_send(myrpt,myrpt->lastunit);
-                       break;
-#endif
-
-               case 16: /* Restore links disconnected with "disconnect all links" command */
-                       strcpy(tmp, myrpt->savednodes); /* Make a copy */
-                       finddelim(tmp, strs, MAXLINKLIST); /* convert into substrings */
-                       for(i = 0; tmp[0] && strs[i] != NULL && i < MAXLINKLIST; i++){
-                               s1 = strs[i];
-                               mode = (s1[0] == 'X') ? 1 : 0;
-                               perma = (s1[1] == 'P') ? 1 : 0;
-                               connect_link(myrpt, s1 + 2, mode, perma); /* Try to reconnect */
-                       }
-                        rpt_telemetry(myrpt, COMPLETE, NULL);
-                       break;
-       
-               case 200:
-               case 201:
-               case 202:
-               case 203:
-               case 204:
-               case 205:
-               case 206:
-               case 207:
-               case 208:
-               case 209:
-               case 210:
-               case 211:
-               case 212:
-               case 213:
-               case 214:
-               case 215:
-                       if (((myrpt->p.propagate_dtmf) && 
-                            (command_source == SOURCE_LNK)) ||
-                           ((myrpt->p.propagate_phonedtmf) &&
-                               ((command_source == SOURCE_PHONE) ||
-                                 (command_source == SOURCE_ALT) ||
-                                   (command_source == SOURCE_DPHONE))))
-                                       do_dtmf_local(myrpt,
-                                               remdtmfstr[myatoi(param) - 200]);
-               default:
-                       return DC_ERROR;
-                       
-       }
-       
-       return DC_INDETERMINATE;
-}      
-
-/*
-* Autopatch up
-*/
-
-static int function_autopatchup(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-       pthread_attr_t attr;
-       int i, idx, paramlength;
-       char *lparam;
-       char *value = NULL;
-       char *paramlist[20];
-
-       static char *keywords[] = {
-       "context",
-       "dialtime",
-       "farenddisconnect",
-       "noct",
-       "quiet",
-       NULL
-       };
-               
-       if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
-               return DC_ERROR;
-               
-       if(debug)
-               printf("@@@@ Autopatch up\n");
-
-       if(!myrpt->callmode){
-               /* Set defaults */
-               myrpt->patchnoct = 0;
-               myrpt->patchdialtime = 0;
-               myrpt->patchfarenddisconnect = 0;
-               myrpt->patchquiet = 0;
-               strncpy(myrpt->patchcontext, myrpt->p.ourcontext, MAXPATCHCONTEXT);
-
-               if(param){
-                       /* Process parameter list */
-                       lparam = ast_strdup(param);
-                       if(!lparam){
-                               ast_log(LOG_ERROR,"App_rpt out of memory on line %d\n",__LINE__);
-                               return DC_ERROR;        
-                       }
-                       paramlength = finddelim(lparam, paramlist, 20);                         
-                       for(i = 0; i < paramlength; i++){
-                               idx = matchkeyword(paramlist[i], &value, keywords);
-                               if(value)
-                                       value = skipchars(value, "= ");
-                               switch(idx){
-
-                                       case 1: /* context */
-                                               strncpy(myrpt->patchcontext, value, MAXPATCHCONTEXT - 1) ;
-                                               break;
-                                               
-                                       case 2: /* dialtime */
-                                               myrpt->patchdialtime = atoi(value);
-                                               break;
-
-                                       case 3: /* farenddisconnect */
-                                               myrpt->patchfarenddisconnect = atoi(value);
-                                               break;
-
-                                       case 4: /* noct */
-                                               myrpt->patchnoct = atoi(value);
-                                               break;
-
-                                       case 5: /* quiet */
-                                               myrpt->patchquiet = atoi(value);
-                                               break;
-                                                                       
-                                       default:
-                                               break;
-                               }
-                       }
-               ast_free(lparam);
-               }
-       }
-                                       
-       rpt_mutex_lock(&myrpt->lock);
-
-       /* if on call, force * into current audio stream */
-       
-       if ((myrpt->callmode == 2) || (myrpt->callmode == 3)){
-               myrpt->mydtmf = myrpt->p.endchar;
-       }
-       if (myrpt->callmode){
-               rpt_mutex_unlock(&myrpt->lock);
-               return DC_COMPLETE;
-       }
-       myrpt->callmode = 1;
-       myrpt->cidx = 0;
-       myrpt->exten[myrpt->cidx] = 0;
-       rpt_mutex_unlock(&myrpt->lock);
-       pthread_attr_init(&attr);
-       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-       ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *) myrpt);
-       return DC_COMPLETE;
-}
-
-/*
-* Autopatch down
-*/
-
-static int function_autopatchdn(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-       if (myrpt->p.s[myrpt->p.sysstate_cur].txdisable || myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
-               return DC_ERROR;
-       
-       if(debug)
-               printf("@@@@ Autopatch down\n");
-               
-       rpt_mutex_lock(&myrpt->lock);
-       
-       myrpt->macropatch=0;
-
-       if (!myrpt->callmode){
-               rpt_mutex_unlock(&myrpt->lock);
-               return DC_COMPLETE;
-       }
-       
-       myrpt->callmode = 0;
-       channel_revert(myrpt);
-       rpt_mutex_unlock(&myrpt->lock);
-       rpt_telemetry(myrpt, TERM, NULL);
-       return DC_COMPLETE;
-}
-
-/*
-* Status
-*/
-
-static int function_status(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-
-       if (!param)
-               return DC_ERROR;
-
-       if ((myrpt->p.s[myrpt->p.sysstate_cur].txdisable) || (myrpt->p.s[myrpt->p.sysstate_cur].userfundisable))
-               return DC_ERROR;
-
-       if(debug)
-               printf("@@@@ status param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-       
-       switch(myatoi(param)){
-               case 1: /* System ID */
-                       rpt_telemetry(myrpt, ID1, NULL);
-                       return DC_COMPLETE;
-               case 2: /* System Time */
-                       rpt_telemetry(myrpt, STATS_TIME, NULL);
-                       return DC_COMPLETE;
-               case 3: /* app_rpt.c version */
-                       rpt_telemetry(myrpt, STATS_VERSION, NULL);
-                       return DC_COMPLETE;
-               case 11: /* System ID (local only)*/
-                   rpt_telemetry(myrpt, ID , NULL);
-            return DC_COMPLETE;
-        case 12: /* System Time (local only)*/
-            rpt_telemetry(myrpt, STATS_TIME_LOCAL, NULL);
-            return DC_COMPLETE;
-               default:
-                       return DC_ERROR;
-       }
-       return DC_INDETERMINATE;
-}
-/*
-*  Macro-oni (without Salami)
-*/
-static int function_macro(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-char   *val;
-int    i;
-       if (myrpt->remote)
-               return DC_ERROR;
-
-       if(debug) 
-               printf("@@@@ macro-oni param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-       
-       if(strlen(digitbuf) < 1) /* needs 1 digit */
-               return DC_INDETERMINATE;
-                       
-       for(i = 0 ; i < digitbuf[i] ; i++) {
-               if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
-                       return DC_ERROR;
-       }
-   
-       if (*digitbuf == '0') val = myrpt->p.startupmacro;
-       else val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.macro, digitbuf);
-       /* param was 1 for local buf */
-       if (!val){
-                if (strlen(digitbuf) < myrpt->macro_longest)
-                        return DC_INDETERMINATE;
-               rpt_telemetry(myrpt, MACRO_NOTFOUND, NULL);
-               return DC_COMPLETE;
-       }                       
-       rpt_mutex_lock(&myrpt->lock);
-       if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(val))
-       {
-               rpt_mutex_unlock(&myrpt->lock);
-               rpt_telemetry(myrpt, MACRO_BUSY, NULL);
-               return DC_ERROR;
-       }
-       myrpt->macrotimer = MACROTIME;
-       strncat(myrpt->macrobuf,val,MAXMACRO - 1);
-       rpt_mutex_unlock(&myrpt->lock);
-       return DC_COMPLETE;     
-}
-
-/*
-*  Playback a recording
-*/
-
-static int function_playback(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-
-       if (myrpt->remote)
-               return DC_ERROR;
-
-       if(debug) 
-               printf("@@@@ playback param = %s, digitbuf = %s\n", (param)? param : "(null)", digitbuf);
-       
-       if (ast_fileexists(param,NULL,myrpt->rxchannel->language) <= 0)
-               return DC_ERROR;
-
-       rpt_telemetry(myrpt,PLAYBACK,param);
-       return DC_COMPLETE;
-}
-
-/*
-* COP - Control operator
-*/
-
-static int function_cop(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-       char string[16];
-
-       int i, r;
-
-       if(!param)
-               return DC_ERROR;
-       
-       switch(myatoi(param)){
-               case 1: /* System reset */
-                       return system("killall -9 asterisk");
-
-               case 2:
-                       myrpt->p.s[myrpt->p.sysstate_cur].txdisable = 0;
-                       rpt_telemetry(myrpt, ARB_ALPHA, (void *) "RPTENA");
-                       return DC_COMPLETE;
-                       
-               case 3:
-                       myrpt->p.s[myrpt->p.sysstate_cur].txdisable = 1;
-                       return DC_COMPLETE;
-                       
-               case 4: /* test tone on */
-                       if (myrpt->stopgen < 0) 
-                       {
-                               myrpt->stopgen = 1;
-                       }
-                       else 
-                       {
-                               myrpt->stopgen = 0;
-                               rpt_telemetry(myrpt, TEST_TONE, NULL);
-                       }
-                       return DC_COMPLETE;
-
-               case 5: /* Disgorge variables to log for debug purposes */
-                       myrpt->disgorgetime = time(NULL) + 10; /* Do it 10 seconds later */
-                       return DC_COMPLETE;
-
-               case 6: /* Simulate COR being activated (phone only) */
-                       if (command_source != SOURCE_PHONE) return DC_INDETERMINATE;
-                       return DC_DOKEY;        
-
-
-               case 7: /* Time out timer enable */
-                       myrpt->p.s[myrpt->p.sysstate_cur].totdisable = 0;
-                       rpt_telemetry(myrpt, ARB_ALPHA, (void *) "TOTENA");
-                       return DC_COMPLETE;
-                       
-               case 8: /* Time out timer disable */
-                       myrpt->p.s[myrpt->p.sysstate_cur].totdisable = 1;
-                       rpt_telemetry(myrpt, ARB_ALPHA, (void *) "TOTDIS");
-                       return DC_COMPLETE;
-
-                case 9: /* Autopatch enable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable = 0;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "APENA");
-                        return DC_COMPLETE;
-
-                case 10: /* Autopatch disable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable = 1;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "APDIS");
-                        return DC_COMPLETE;
-
-                case 11: /* Link Enable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable = 0;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "LNKENA");
-                        return DC_COMPLETE;
-
-                case 12: /* Link Disable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable = 1;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "LNKDIS");
-                        return DC_COMPLETE;
-
-               case 13: /* Query System State */
-                       string[0] = string[1] = 'S';
-                       string[2] = myrpt->p.sysstate_cur + '0';
-                       string[3] = '\0';
-                       rpt_telemetry(myrpt, ARB_ALPHA, (void *) string);
-                       return DC_COMPLETE;
-
-               case 14: /* Change System State */
-                       if(strlen(digitbuf) == 0)
-                               break;
-                       if((digitbuf[0] < '0') || (digitbuf[0] > '9'))
-                               return DC_ERROR;
-                       myrpt->p.sysstate_cur = digitbuf[0] - '0';
-                        string[0] = string[1] = 'S';
-                        string[2] = myrpt->p.sysstate_cur + '0';
-                        string[3] = '\0';
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) string);
-                        return DC_COMPLETE;
-
-                case 15: /* Scheduler Enable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable = 0;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "SKENA");
-                        return DC_COMPLETE;
-
-                case 16: /* Scheduler Disable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable = 1;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "SKDIS");
-                        return DC_COMPLETE;
-
-                case 17: /* User functions Enable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].userfundisable = 0;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "UFENA");
-                        return DC_COMPLETE;
-
-                case 18: /* User Functions Disable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].userfundisable = 1;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "UFDIS");
-                        return DC_COMPLETE;
-
-                case 19: /* Alternate Tail Enable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].alternatetail = 1;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "ATENA");
-                        return DC_COMPLETE;
-
-                case 20: /* Alternate Tail Disable */
-                        myrpt->p.s[myrpt->p.sysstate_cur].alternatetail = 0;
-                        rpt_telemetry(myrpt, ARB_ALPHA, (void *) "ATDIS");
-                        return DC_COMPLETE;
-
-                case 21: /* Parrot Mode Disable */
-                       birdbath(myrpt);
-                       if (myrpt->p.parrotmode < 2)
-                       {
-                               myrpt->p.parrotmode = 0;
-                               rpt_telemetry(myrpt,COMPLETE,NULL);
-                               return DC_COMPLETE;
-                       }
-                       break;
-
-                case 22: /* Parrot Mode Enable */
-                       birdbath(myrpt);
-                       if (myrpt->p.parrotmode < 2)
-                       {
-                               myrpt->p.parrotmode = 1;
-                               rpt_telemetry(myrpt,COMPLETE,NULL);
-                               return DC_COMPLETE;
-                       }
-                       break;
-               case 23: /* flush parrot in progress */
-                       birdbath(myrpt);
-                       rpt_telemetry(myrpt,COMPLETE,NULL);
-                       return DC_COMPLETE;
-               case 24: /* flush all telemetry */
-                       flush_telem(myrpt);
-                       rpt_telemetry(myrpt,COMPLETE,NULL);
-                       return DC_COMPLETE;
-               case 25: /* request keying info (brief) */
-                       send_link_keyquery(myrpt);
-                       myrpt->topkeylong = 0;
-                       rpt_telemetry(myrpt,COMPLETE,NULL);
-                       return DC_COMPLETE;
-               case 26: /* request keying info (full) */
-                       send_link_keyquery(myrpt);
-                       myrpt->topkeylong = 1;
-                       rpt_telemetry(myrpt,COMPLETE,NULL);
-                       return DC_COMPLETE;
-
-               case 30: /* recall memory location on programmable radio */
-
-                       if(strlen(digitbuf) < 2) /* needs 2 digits */
-                               break;
-                       
-                       for(i = 0 ; i < 2 ; i++){
-                               if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
-                                       return DC_ERROR;
-                       }
-           
-                       r = retreive_memory(myrpt, digitbuf);
-                       if (r < 0){
-                               rpt_telemetry(myrpt,MEMNOTFOUND,NULL);
-                               return DC_COMPLETE;
-                       }
-                       if (r > 0){
-                               return DC_ERROR;
-                       }
-                       if (setrem(myrpt) == -1) return DC_ERROR;
-                       return DC_COMPLETE;     
-
-               case 31: 
-                   /* set channel. note that it's going to change channel 
-                      then confirm on the new channel! */
-                       if(strlen(digitbuf) < 2) /* needs 2 digits */
-                               break;
-                       
-                       for(i = 0 ; i < 2 ; i++){
-                               if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
-                                       return DC_ERROR;
-                       }
-                       channel_steer(myrpt,digitbuf);
-                       return DC_COMPLETE;     
-
-               case 32: /* Touch Tone Pad Test */
-                       i = strlen(digitbuf);
-                       if(!i){
-                               if(debug > 3)
-                               ast_log(LOG_NOTICE,"Padtest entered");
-                               myrpt->inpadtest = 1;
-                       }
-                       else{
-                               if(debug > 3)
-                                       ast_log(LOG_NOTICE,"Padtest len= %d digits=%s",i,digitbuf);
-                               if(digitbuf[i-1] != myrpt->p.endchar)
-                                       break;
-                               rpt_telemetry(myrpt, ARB_ALPHA, digitbuf);
-                               myrpt->inpadtest = 0;
-                               if(debug > 3)
-                                       ast_log(LOG_NOTICE,"Padtest exited");
-                               return DC_COMPLETE;
-                       }
-       }       
-       return DC_INDETERMINATE;
-}
-/*
-* Collect digits one by one until something matches
-*/
-static int collect_function_digits(struct rpt *myrpt, char *digits, 
-       int command_source, struct rpt_link *mylink)
-{
-       int i,rv;
-       char *stringp,*action,*param,*functiondigits;
-       char function_table_name[30] = "";
-       char workstring[200];
-       
-       struct ast_variable *vp;
-       
-       if (debug > 6) ast_log(LOG_NOTICE,"digits=%s  source=%d\n",digits, command_source);
-
-       //if(debug)     
-       //      printf("@@@@ Digits collected: %s, source: %d\n", digits, command_source);
-       
-       if (command_source == SOURCE_DPHONE) {
-               if (!myrpt->p.dphone_functions) return DC_INDETERMINATE;
-               strncpy(function_table_name, myrpt->p.dphone_functions, sizeof(function_table_name) - 1);
-               }
-       else if (command_source == SOURCE_ALT) {
-               if (!myrpt->p.alt_functions) return DC_INDETERMINATE;
-               strncpy(function_table_name, myrpt->p.alt_functions, sizeof(function_table_name) - 1);
-               }
-       else if (command_source == SOURCE_PHONE) {
-               if (!myrpt->p.phone_functions) return DC_INDETERMINATE;
-               strncpy(function_table_name, myrpt->p.phone_functions, sizeof(function_table_name) - 1);
-               }
-       else if (command_source == SOURCE_LNK)
-               strncpy(function_table_name, myrpt->p.link_functions, sizeof(function_table_name) - 1);
-       else
-               strncpy(function_table_name, myrpt->p.functions, sizeof(function_table_name) - 1);
-    /* find context for function table in rpt.conf file */
-       vp = ast_variable_browse(myrpt->cfg, function_table_name);
-       while(vp) {
-               if(!strncasecmp(vp->name, digits, strlen(vp->name)))
-                       break;
-               vp = vp->next;
-       }       
-       /* if function context not found */
-       if(!vp) {
-               int n;
-
-               n = myrpt->longestfunc;
-               if (command_source == SOURCE_LNK) n = myrpt->link_longestfunc;
-               else 
-               if (command_source == SOURCE_PHONE) n = myrpt->phone_longestfunc;
-               else 
-               if (command_source == SOURCE_ALT) n = myrpt->alt_longestfunc;
-               else 
-               if (command_source == SOURCE_DPHONE) n = myrpt->dphone_longestfunc;
-               
-               if(strlen(digits) >= n)
-                       return DC_ERROR;
-               else
-                       return DC_INDETERMINATE;
-       }       
-       /* Found a match, retrieve value part and parse */
-       strncpy(workstring, vp->value, sizeof(workstring) - 1 );
-       stringp = workstring;
-       action = strsep(&stringp, ",");
-       param = stringp;
-       if(debug)
-               printf("@@@@ action: %s, param = %s\n",action, (param) ? param : "(null)");
-       /* Look up the action */
-       for(i = 0 ; i < (sizeof(function_table)/sizeof(struct function_table_tag)); i++){
-               if(!strncasecmp(action, function_table[i].action, strlen(action)))
-                       break;
-       }
-       if(debug)
-               printf("@@@@ table index i = %d\n",i);
-       if(i == (sizeof(function_table)/sizeof(struct function_table_tag))){
-               /* Error, action not in table */
-               return DC_ERROR;
-       }
-       if(function_table[i].function == NULL){
-               /* Error, function undefined */
-               if(debug)
-                       printf("@@@@ NULL for action: %s\n",action);
-               return DC_ERROR;
-       }
-       functiondigits = digits + strlen(vp->name);
-       rv=(*function_table[i].function)(myrpt, param, functiondigits, command_source, mylink);
-       if (debug > 6) ast_log(LOG_NOTICE,"rv=%i\n",rv);
-       return(rv);
-}
-
-
-static void handle_link_data(struct rpt *myrpt, struct rpt_link *mylink,
-       char *str)
-{
-/* XXX ATTENTION: if you change the size of these arrays you MUST
- * change the limits in corresponding sscanf() calls below. */
-char   tmp[512],tmp1[512],cmd[300] = "",dest[300],src[300],c;
-int    i,seq, res, ts;
-struct rpt_link *l;
-struct ast_frame wf;
-
-       wf.frametype = AST_FRAME_TEXT;
-       wf.subclass.integer = 0;
-       wf.offset = 0;
-       wf.mallocd = 0;
-       wf.datalen = strlen(str) + 1;
-       wf.samples = 0;
-       /* put string in our buffer */
-       strncpy(tmp,str,sizeof(tmp) - 1);
-
-        if (!strcmp(tmp,discstr))
-        {
-                mylink->disced = 1;
-               mylink->retries = mylink->max_retries + 1;
-                ast_softhangup(mylink->chan,AST_SOFTHANGUP_DEV);
-                return;
-        }
-        if (!strcmp(tmp,newkeystr))
-        {
-               mylink->newkey = 1;
-                return;
-        }
-       if (tmp[0] == 'L')
-       {
-               rpt_mutex_lock(&myrpt->lock);
-               strcpy(mylink->linklist,tmp + 2);
-               time(&mylink->linklistreceived);
-               rpt_mutex_unlock(&myrpt->lock);
-               if (debug > 6) ast_log(LOG_NOTICE,"@@@@ node %s received node list %s from node %s\n",
-                       myrpt->name,tmp,mylink->name);
-               return;
-       }
-       if (tmp[0] == 'K')
-       {
-               if (sscanf(tmp, "%299s %299s %299s %30d %30d", cmd, dest, src, &seq, &ts) != 5)
-               {
-                       ast_log(LOG_WARNING, "Unable to parse keying string %s\n",str);
-                       return;
-               }
-               if (dest[0] == '0')
-               {
-                       strcpy(dest,myrpt->name);
-               }               
-               /* if not for me, redistribute to all links */
-               if (strcmp(dest,myrpt->name))
-               {
-                       l = myrpt->links.next;
-                       /* see if this is one in list */
-                       while(l != &myrpt->links)
-                       {
-                               if (l->name[0] == '0') 
-                               {
-                                       l = l->next;
-                                       continue;
-                               }
-                               /* don't send back from where it came */
-                               if ((l == mylink) || (!strcmp(l->name,mylink->name)))
-                               {
-                                       l = l->next;
-                                       continue;
-                               }
-                               /* if it is, send it and we're done */
-                               if (!strcmp(l->name,dest))
-                               {
-                                       /* send, but not to src */
-                                       if (strcmp(l->name,src)) {
-                                               wf.data.ptr = str;
-                                               if (l->chan) ast_write(l->chan,&wf);
-                                       }
-                                       return;
-                               }
-                               l = l->next;
-                       }
-               }
-               /* if not for me, or is broadcast, redistribute to all links */
-               if ((strcmp(dest,myrpt->name)) || (dest[0] == '*'))
-               {
-                       l = myrpt->links.next;
-                       /* otherwise, send it to all of em */
-                       while(l != &myrpt->links)
-                       {
-                               if (l->name[0] == '0') 
-                               {
-                                       l = l->next;
-                                       continue;
-                               }
-                               /* don't send back from where it came */
-                               if ((l == mylink) || (!strcmp(l->name,mylink->name)))
-                               {
-                                       l = l->next;
-                                       continue;
-                               }
-                               /* send, but not to src */
-                               if (strcmp(l->name,src)) {
-                                       wf.data.ptr = str;
-                                       if (l->chan) ast_write(l->chan,&wf); 
-                               }
-                               l = l->next;
-                       }
-               }
-               /* if not for me, end here */
-               if (strcmp(dest,myrpt->name) && (dest[0] != '*')) return;
-               if (cmd[1] == '?')
-               {
-                       time_t now;
-                       int n = 0;
-
-                       time(&now);
-                       if (myrpt->lastkeyedtime)
-                       {
-                               n = (int)(now - myrpt->lastkeyedtime);
-                       }
-                       sprintf(tmp1,"K %s %s %d %d",src,myrpt->name,myrpt->keyed,n);
-                       wf.data.ptr = tmp1;
-                       wf.datalen = strlen(tmp1) + 1;
-                       if (mylink->chan) ast_write(mylink->chan,&wf); 
-                       return;
-               }
-               if (myrpt->topkeystate != 1) return;
-               rpt_mutex_lock(&myrpt->lock);
-               for(i = 0; i < TOPKEYN; i++)
-               {
-                       if (!strcmp(myrpt->topkey[i].node,src)) break;
-               }
-               if (i >= TOPKEYN)
-               {
-                       for(i = 0; i < TOPKEYN; i++)
-                       {
-                               if (!myrpt->topkey[i].node[0]) break;
-                       }
-               }
-               if (i < TOPKEYN)
-               {
-                       strncpy(myrpt->topkey[i].node,src,TOPKEYMAXSTR - 1);
-                       myrpt->topkey[i].timesince = ts;
-                       myrpt->topkey[i].keyed = seq;
-               }
-               rpt_mutex_unlock(&myrpt->lock);
-               return;
-       }
-       if (tmp[0] == 'I')
-       {
-               /* XXX WARNING: be very careful with the limits on the folowing
-                * sscanf() call, make sure they match the values defined above */
-               if (sscanf(tmp,"%299s %299s %30x",cmd,src,&seq) != 3)
-               {
-                       ast_log(LOG_WARNING, "Unable to parse ident string %s\n",str);
-                       return;
-               }
-               mdc1200_notify(myrpt,src,seq);
-               strcpy(dest,"*");
-       }
-       else
-       {
-               /* XXX WARNING: be very careful with the limits on the folowing
-                * sscanf() call, make sure they match the values defined above */
-               if (sscanf(tmp,"%299s %299s %299s %30d %1c",cmd,dest,src,&seq,&c) != 5)
-               {
-                       ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
-                       return;
-               }
-               if (strcmp(cmd,"D"))
-               {
-                       ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
-                       return;
-               }
-       }
-       if (dest[0] == '0')
-       {
-               strcpy(dest,myrpt->name);
-       }               
-
-       /* if not for me, redistribute to all links */
-       if (strcmp(dest,myrpt->name))
-       {
-               l = myrpt->links.next;
-               /* see if this is one in list */
-               while(l != &myrpt->links)
-               {
-                       if (l->name[0] == '0') 
-                       {
-                               l = l->next;
-                               continue;
-                       }
-                       /* don't send back from where it came */
-                       if ((l == mylink) || (!strcmp(l->name,mylink->name)))
-                       {
-                               l = l->next;
-                               continue;
-                       }
-                       /* if it is, send it and we're done */
-                       if (!strcmp(l->name,dest))
-                       {
-                               /* send, but not to src */
-                               if (strcmp(l->name,src)) {
-                                       wf.data.ptr = str;
-                                       if (l->chan) ast_write(l->chan,&wf);
-                               }
-                               return;
-                       }
-                       l = l->next;
-               }
-               l = myrpt->links.next;
-               /* otherwise, send it to all of em */
-               while(l != &myrpt->links)
-               {
-                       if (l->name[0] == '0') 
-                       {
-                               l = l->next;
-                               continue;
-                       }
-                       /* don't send back from where it came */
-                       if ((l == mylink) || (!strcmp(l->name,mylink->name)))
-                       {
-                               l = l->next;
-                               continue;
-                       }
-                       /* send, but not to src */
-                       if (strcmp(l->name,src)) {
-                               wf.data.ptr = str;
-                               if (l->chan) ast_write(l->chan,&wf); 
-                       }
-                       l = l->next;
-               }
-               return;
-       }
-       if (myrpt->p.archivedir)
-       {
-               char dtmfstr[100];
-
-               sprintf(dtmfstr,"DTMF,%s,%c",mylink->name,c);
-               donodelog(myrpt,dtmfstr);
-       }
-       c = func_xlat(myrpt,c,&myrpt->p.outxlat);
-       if (!c) return;
-       rpt_mutex_lock(&myrpt->lock);
-       if (c == myrpt->p.endchar) myrpt->stopgen = 1;
-       if (myrpt->callmode == 1)
-       {
-               myrpt->exten[myrpt->cidx++] = c;
-               myrpt->exten[myrpt->cidx] = 0;
-               /* if this exists */
-               if (ast_exists_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
-               {
-                       /* if this really it, end now */
-                       if (!ast_matchmore_extension(myrpt->pchannel,myrpt->patchcontext,
-                               myrpt->exten,1,NULL)) 
-                       {
-                               myrpt->callmode = 2;
-                               if(!myrpt->patchquiet)
-                               {
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       rpt_telemetry(myrpt,PROC,NULL); 
-                                       rpt_mutex_lock(&myrpt->lock);
-                               }
-                       }
-                       else /* othewise, reset timer */
-                       {
-                               myrpt->calldigittimer = 1;
-                       }
-               }
-               /* if can continue, do so */
-               if (!ast_canmatch_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
-               {
-                       /* call has failed, inform user */
-                       myrpt->callmode = 4;
-               }
-       }
-       if ((!myrpt->inpadtest) &&(c == myrpt->p.funcchar))
-       {
-               myrpt->rem_dtmfidx = 0;
-               myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
-               time(&myrpt->rem_dtmf_time);
-               rpt_mutex_unlock(&myrpt->lock);
-               return;
-       } 
-       else if (myrpt->rem_dtmfidx < 0)
-       {
-               if ((myrpt->callmode == 2) || (myrpt->callmode == 3))
-               {
-                       myrpt->mydtmf = c;
-               }
-               if (myrpt->p.propagate_dtmf) do_dtmf_local(myrpt,c);
-               if (myrpt->p.propagate_phonedtmf) do_dtmf_phone(myrpt,mylink,c);
-               rpt_mutex_unlock(&myrpt->lock);
-               return;
-       }
-       else if (((myrpt->inpadtest) || (c != myrpt->p.endchar)) && (myrpt->rem_dtmfidx >= 0))
-       {
-               time(&myrpt->rem_dtmf_time);
-               if (myrpt->rem_dtmfidx < MAXDTMF)
-               {
-                       myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx++] = c;
-                       myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
-                       
-                       rpt_mutex_unlock(&myrpt->lock);
-                       strncpy(cmd, myrpt->rem_dtmfbuf, sizeof(cmd) - 1);
-                       res = collect_function_digits(myrpt, cmd, SOURCE_LNK, mylink);
-                       rpt_mutex_lock(&myrpt->lock);
-                       
-                       switch(res){
-
-                               case DC_INDETERMINATE:
-                                       break;
-                               
-                               case DC_REQ_FLUSH:
-                                       myrpt->rem_dtmfidx = 0;
-                                       myrpt->rem_dtmfbuf[0] = 0;
-                                       break;
-                               
-                               
-                               case DC_COMPLETE:
-                               case DC_COMPLETEQUIET:
-                                       myrpt->totalexecdcommands++;
-                                       myrpt->dailyexecdcommands++;
-                                       strncpy(myrpt->lastdtmfcommand, cmd, MAXDTMF-1);
-                                       myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
-                                       myrpt->rem_dtmfbuf[0] = 0;
-                                       myrpt->rem_dtmfidx = -1;
-                                       myrpt->rem_dtmf_time = 0;
-                                       break;
-                               
-                               case DC_ERROR:
-                               default:
-                                       myrpt->rem_dtmfbuf[0] = 0;
-                                       myrpt->rem_dtmfidx = -1;
-                                       myrpt->rem_dtmf_time = 0;
-                                       break;
-                       }
-               }
-
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-       return;
-}
-
-static void handle_link_phone_dtmf(struct rpt *myrpt, struct rpt_link *mylink,
-       char c)
-{
-
-char   cmd[300];
-int    res;
-
-       if (myrpt->p.archivedir)
-       {
-               char str[100];
-
-               sprintf(str,"DTMF(P),%s,%c",mylink->name,c);
-               donodelog(myrpt,str);
-       }
-       rpt_mutex_lock(&myrpt->lock);
-
-       if (mylink->phonemode == 3) /*If in simplex dumb phone mode */
-       {
-               if(c == myrpt->p.endchar) /* If end char */
-               {
-                       mylink->lastrealrx = 0; /* Keying state = off */
-                       rpt_mutex_unlock(&myrpt->lock);
-                       return;
-               }
-
-               if(c == myrpt->p.funcchar) /* If lead-in char */
-               {
-                       mylink->lastrealrx = !mylink->lastrealrx; /* Toggle keying state */
-                       rpt_mutex_unlock(&myrpt->lock);
-                       return;
-               }
-       }
-       else
-       {
-               if (c == myrpt->p.endchar)
-               {
-                       if (mylink->lastrx)
-                       {
-                               mylink->lastrealrx = 0;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               return;
-                       }
-                       myrpt->stopgen = 1;
-                       if (myrpt->cmdnode[0])
-                       {
-                               myrpt->cmdnode[0] = 0;
-                               myrpt->dtmfidx = -1;
-                               myrpt->dtmfbuf[0] = 0;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               rpt_telemetry(myrpt,COMPLETE,NULL);
-                               return;
-                       }
-               }
-       }
-       if (myrpt->cmdnode[0])
-       {
-               rpt_mutex_unlock(&myrpt->lock);
-               send_link_dtmf(myrpt,c);
-               return;
-       }
-       if (myrpt->callmode == 1)
-       {
-               myrpt->exten[myrpt->cidx++] = c;
-               myrpt->exten[myrpt->cidx] = 0;
-               /* if this exists */
-               if (ast_exists_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
-               {
-                       /* if this really it, end now */
-                       if (!ast_matchmore_extension(myrpt->pchannel,myrpt->patchcontext,
-                               myrpt->exten,1,NULL)) 
-                       {
-                               myrpt->callmode = 2;
-                               if(!myrpt->patchquiet)
-                               {
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       rpt_telemetry(myrpt,PROC,NULL); 
-                                       rpt_mutex_lock(&myrpt->lock);
-                               }
-                       }
-                       else /* othewise, reset timer */
-                       {
-                               myrpt->calldigittimer = 1;
-                       }
-               }
-               /* if can continue, do so */
-               if (!ast_canmatch_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
-               {
-                       /* call has failed, inform user */
-                       myrpt->callmode = 4;
-               }
-       }
-       if ((myrpt->callmode == 2) || (myrpt->callmode == 3))
-       {
-               myrpt->mydtmf = c;
-       }
-       if ((!myrpt->inpadtest) && (c == myrpt->p.funcchar))
-       {
-               myrpt->rem_dtmfidx = 0;
-               myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
-               time(&myrpt->rem_dtmf_time);
-               rpt_mutex_unlock(&myrpt->lock);
-               return;
-       } 
-       else if (((myrpt->inpadtest) || (c != myrpt->p.endchar)) && (myrpt->rem_dtmfidx >= 0))
-       {
-               time(&myrpt->rem_dtmf_time);
-               if (myrpt->rem_dtmfidx < MAXDTMF)
-               {
-                       myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx++] = c;
-                       myrpt->rem_dtmfbuf[myrpt->rem_dtmfidx] = 0;
-                       
-                       rpt_mutex_unlock(&myrpt->lock);
-                       strncpy(cmd, myrpt->rem_dtmfbuf, sizeof(cmd) - 1);
-                       switch(mylink->phonemode)
-                       {
-                           case 1:
-                               res = collect_function_digits(myrpt, cmd, 
-                                       SOURCE_PHONE, mylink);
-                               break;
-                           case 2:
-                               res = collect_function_digits(myrpt, cmd, 
-                                       SOURCE_DPHONE,mylink);
-                               break;
-                           case 4:
-                               res = collect_function_digits(myrpt, cmd, 
-                                       SOURCE_ALT,mylink);
-                               break;
-                           default:
-                               res = collect_function_digits(myrpt, cmd, 
-                                       SOURCE_LNK, mylink);
-                               break;
-                       }
-
-                       rpt_mutex_lock(&myrpt->lock);
-                       
-                       switch(res){
-
-                               case DC_INDETERMINATE:
-                                       break;
-                               
-                               case DC_DOKEY:
-                                       mylink->lastrealrx = 1;
-                                       break;
-                               
-                               case DC_REQ_FLUSH:
-                                       myrpt->rem_dtmfidx = 0;
-                                       myrpt->rem_dtmfbuf[0] = 0;
-                                       break;
-                               
-                               
-                               case DC_COMPLETE:
-                               case DC_COMPLETEQUIET:
-                                       myrpt->totalexecdcommands++;
-                                       myrpt->dailyexecdcommands++;
-                                       strncpy(myrpt->lastdtmfcommand, cmd, MAXDTMF-1);
-                                       myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
-                                       myrpt->rem_dtmfbuf[0] = 0;
-                                       myrpt->rem_dtmfidx = -1;
-                                       myrpt->rem_dtmf_time = 0;
-                                       break;
-                               
-                               case DC_ERROR:
-                               default:
-                                       myrpt->rem_dtmfbuf[0] = 0;
-                                       myrpt->rem_dtmfidx = -1;
-                                       myrpt->rem_dtmf_time = 0;
-                                       break;
-                       }
-               }
-
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-       return;
-}
-
-/* Doug Hall RBI-1 serial data definitions:
- *
- * Byte 0: Expansion external outputs 
- * Byte 1: 
- *     Bits 0-3 are BAND as follows:
- *     Bits 4-5 are POWER bits as follows:
- *             00 - Low Power
- *             01 - Hi Power
- *             02 - Med Power
- *     Bits 6-7 are always set
- * Byte 2:
- *     Bits 0-3 MHZ in BCD format
- *     Bits 4-5 are offset as follows:
- *             00 - minus
- *             01 - plus
- *             02 - simplex
- *             03 - minus minus (whatever that is)
- *     Bit 6 is the 0/5 KHZ bit
- *     Bit 7 is always set
- * Byte 3:
- *     Bits 0-3 are 10 KHZ in BCD format
- *     Bits 4-7 are 100 KHZ in BCD format
- * Byte 4: PL Tone code and encode/decode enable bits
- *     Bits 0-5 are PL tone code (comspec binary codes)
- *     Bit 6 is encode enable/disable
- *     Bit 7 is decode enable/disable
- */
-
-/* take the frequency from the 10 mhz digits (and up) and convert it
-   to a band number */
-
-static int rbi_mhztoband(char *str)
-{
-int    i;
-
-       i = atoi(str) / 10; /* get the 10's of mhz */
-       switch(i)
-       {
-           case 2:
-               return 10;
-           case 5:
-               return 11;
-           case 14:
-               return 2;
-           case 22:
-               return 3;
-           case 44:
-               return 4;
-           case 124:
-               return 0;
-           case 125:
-               return 1;
-           case 126:
-               return 8;
-           case 127:
-               return 5;
-           case 128:
-               return 6;
-           case 129:
-               return 7;
-           default:
-               break;
-       }
-       return -1;
-}
-
-/* take a PL frequency and turn it into a code */
-static int rbi_pltocode(char *str)
-{
-int i;
-char *s;
-
-       s = strchr(str,'.');
-       i = 0;
-       if (s) i = atoi(s + 1);
-       i += atoi(str) * 10;
-       switch(i)
-       {
-           case 670:
-               return 0;
-           case 719:
-               return 1;
-           case 744:
-               return 2;
-           case 770:
-               return 3;
-           case 797:
-               return 4;
-           case 825:
-               return 5;
-           case 854:
-               return 6;
-           case 885:
-               return 7;
-           case 915:
-               return 8;
-           case 948:
-               return 9;
-           case 974:
-               return 10;
-           case 1000:
-               return 11;
-           case 1035:
-               return 12;
-           case 1072:
-               return 13;
-           case 1109:
-               return 14;
-           case 1148:
-               return 15;
-           case 1188:
-               return 16;
-           case 1230:
-               return 17;
-           case 1273:
-               return 18;
-           case 1318:
-               return 19;
-           case 1365:
-               return 20;
-           case 1413:
-               return 21;
-           case 1462:
-               return 22;
-           case 1514:
-               return 23;
-           case 1567:
-               return 24;
-           case 1622:
-               return 25;
-           case 1679:
-               return 26;
-           case 1738:
-               return 27;
-           case 1799:
-               return 28;
-           case 1862:
-               return 29;
-           case 1928:
-               return 30;
-           case 2035:
-               return 31;
-           case 2107:
-               return 32;
-           case 2181:
-               return 33;
-           case 2257:
-               return 34;
-           case 2336:
-               return 35;
-           case 2418:
-               return 36;
-           case 2503:
-               return 37;
-       }
-       return -1;
-}
-
-/*
-* Shift out a formatted serial bit stream
-*/
-
-static void rbi_out_parallel(struct rpt *myrpt,unsigned char *data)
-    {
-#ifdef __i386__
-    int i,j;
-    unsigned char od,d;
-    static volatile long long delayvar;
-
-    for(i = 0 ; i < 5 ; i++){
-        od = *data++; 
-        for(j = 0 ; j < 8 ; j++){
-            d = od & 1;
-            outb(d,myrpt->p.iobase);
-           /* >= 15 us */
-           for(delayvar = 1; delayvar < 15000; delayvar++); 
-            od >>= 1;
-            outb(d | 2,myrpt->p.iobase);
-           /* >= 30 us */
-           for(delayvar = 1; delayvar < 30000; delayvar++); 
-            outb(d,myrpt->p.iobase);
-           /* >= 10 us */
-           for(delayvar = 1; delayvar < 10000; delayvar++); 
-            }
-        }
-       /* >= 50 us */
-        for(delayvar = 1; delayvar < 50000; delayvar++); 
-#endif
-    }
-
-static void rbi_out(struct rpt *myrpt,unsigned char *data)
-{
-struct dahdi_radio_param r;
-
-       memset(&r,0,sizeof(struct dahdi_radio_param));
-       r.radpar = DAHDI_RADPAR_REMMODE;
-       r.data = DAHDI_RADPAR_REM_RBI1;
-       /* if setparam ioctl fails, its probably not a pciradio card */
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
-       {
-               rbi_out_parallel(myrpt,data);
-               return;
-       }
-       r.radpar = DAHDI_RADPAR_REMCOMMAND;
-       memcpy(&r.data,data,5);
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&r) == -1)
-       {
-               ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",myrpt->dahdirxchannel->name);
-               return;
-       }
-}
-
-static int serial_remote_io(struct rpt *myrpt, unsigned char *txbuf, int txbytes, 
-       unsigned char *rxbuf, int rxmaxbytes, int asciiflag)
-{
-       int i,j,idx,oldmode,olddata;
-       struct dahdi_radio_param prm;
-       char c;
-
-        if(debug) {
-           ast_log(LOG_NOTICE, "ioport=%s  iofd=0x%x\n",myrpt->p.ioport,myrpt->iofd);
-               printf("String output was:\n");
-               for(i = 0; i < txbytes; i++)
-                       printf("%02X ", (unsigned char ) txbuf[i]);
-               printf("\n");
-       }
-
-       if (myrpt->iofd >= 0)  /* if to do out a serial port */
-       {
-               if (write(myrpt->iofd,txbuf,txbytes) != txbytes)
-               {
-                       return -1;
-               }
-               if ((!rxmaxbytes) || (rxbuf == NULL)) 
-               {
-                       return(0);
-               }
-               memset(rxbuf,0,rxmaxbytes);
-               for(i = 0; i < rxmaxbytes; i++)
-               {
-                       j = read(myrpt->iofd,&c,1);
-                       if (j < 1) 
-                       {
-                               return(i);
-                       }
-                       rxbuf[i] = c;
-                       if (asciiflag & 1)
-                       {
-                               rxbuf[i + 1] = 0;
-                               if (c == '\r') break;
-                       }
-               }                                       
-               if(debug) {
-                       printf("String returned was:\n");
-                       for(j = 0; j < i; j++)
-                               printf("%02X ", (unsigned char ) rxbuf[j]);
-                       printf("\n");
-               }
-               return(i);
-       }
-
-       /* if not a DAHDI channel, cant use pciradio stuff */
-       if (myrpt->rxchannel != myrpt->dahdirxchannel) return -1;       
-
-       prm.radpar = DAHDI_RADPAR_UIOMODE;
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_GETPARAM,&prm) == -1) return -1;
-       oldmode = prm.data;
-       prm.radpar = DAHDI_RADPAR_UIODATA;
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_GETPARAM,&prm) == -1) return -1;
-       olddata = prm.data;
-        prm.radpar = DAHDI_RADPAR_REMMODE;
-        if (asciiflag & 1)  prm.data = DAHDI_RADPAR_REM_SERIAL_ASCII;
-        else prm.data = DAHDI_RADPAR_REM_SERIAL;
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
-       if (asciiflag & 2)
-       {
-               i = DAHDI_ONHOOK;
-               if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_HOOK,&i) == -1) return -1;
-               usleep(100000);
-       }
-        prm.radpar = DAHDI_RADPAR_REMCOMMAND;
-        prm.data = rxmaxbytes;
-        memcpy(prm.buf,txbuf,txbytes);
-        prm.index = txbytes;
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
-        if (rxbuf)
-        {
-                *rxbuf = 0;
-                memcpy(rxbuf,prm.buf,prm.index);
-        }
-       idx = prm.index;
-        prm.radpar = DAHDI_RADPAR_REMMODE;
-        prm.data = DAHDI_RADPAR_REM_NONE;
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
-       if (asciiflag & 2)
-       {
-               i = DAHDI_OFFHOOK;
-               if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_HOOK,&i) == -1) return -1;
-       }
-       prm.radpar = DAHDI_RADPAR_UIOMODE;
-       prm.data = oldmode;
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
-       prm.radpar = DAHDI_RADPAR_UIODATA;
-       prm.data = olddata;
-       if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_RADIO_SETPARAM,&prm) == -1) return -1;
-        return(idx);
-}
-
-static int civ_cmd(struct rpt *myrpt,unsigned char *cmd, int cmdlen)
-{
-unsigned char rxbuf[100];
-int    i,rv ;
-
-       rv = serial_remote_io(myrpt,cmd,cmdlen,rxbuf,cmdlen + 6,0);
-       if (rv == -1) return(-1);
-       if (rv != (cmdlen + 6)) return(1);
-       for(i = 0; i < 6; i++)
-               if (rxbuf[i] != cmd[i]) return(1);
-       if (rxbuf[cmdlen] != 0xfe) return(1);
-       if (rxbuf[cmdlen + 1] != 0xfe) return(1);
-       if (rxbuf[cmdlen + 4] != 0xfb) return(1);
-       if (rxbuf[cmdlen + 5] != 0xfd) return(1);
-       return(0);
-}
-
-static int sendkenwood(struct rpt *myrpt,char *txstr, char *rxstr)
-{
-int    i;
-
-ast_log(LOG_NOTICE,"Sent to kenwood: %s\n",txstr);
-       if (debug) printf("Send to kenwood: %s\n",txstr);
-       i = serial_remote_io(myrpt, (unsigned char *)txstr, strlen(txstr), 
-               (unsigned char *)rxstr,RAD_SERIAL_BUFLEN - 1,3);
-       if (i < 0) return -1;
-       if ((i > 0) && (rxstr[i - 1] == '\r'))
-               rxstr[i-- - 1] = 0;
-       if (debug) printf("Got from kenwood: %s\n",rxstr);
-ast_log(LOG_NOTICE,"Got from kenwood: %s\n",rxstr);
-       return(i);
-}
-
-/* take a PL frequency and turn it into a code */
-static int kenwood_pltocode(char *str)
-{
-int i;
-char *s;
-
-       s = strchr(str,'.');
-       i = 0;
-       if (s) i = atoi(s + 1);
-       i += atoi(str) * 10;
-       switch(i)
-       {
-           case 670:
-               return 1;
-           case 719:
-               return 3;
-           case 744:
-               return 4;
-           case 770:
-               return 5;
-           case 797:
-               return 6;
-           case 825:
-               return 7;
-           case 854:
-               return 8;
-           case 885:
-               return 9;
-           case 915:
-               return 10;
-           case 948:
-               return 11;
-           case 974:
-               return 12;
-           case 1000:
-               return 13;
-           case 1035:
-               return 14;
-           case 1072:
-               return 15;
-           case 1109:
-               return 16;
-           case 1148:
-               return 17;
-           case 1188:
-               return 18;
-           case 1230:
-               return 19;
-           case 1273:
-               return 20;
-           case 1318:
-               return 21;
-           case 1365:
-               return 22;
-           case 1413:
-               return 23;
-           case 1462:
-               return 24;
-           case 1514:
-               return 25;
-           case 1567:
-               return 26;
-           case 1622:
-               return 27;
-           case 1679:
-               return 28;
-           case 1738:
-               return 29;
-           case 1799:
-               return 30;
-           case 1862:
-               return 31;
-           case 1928:
-               return 32;
-           case 2035:
-               return 33;
-           case 2107:
-               return 34;
-           case 2181:
-               return 35;
-           case 2257:
-               return 36;
-           case 2336:
-               return 37;
-           case 2418:
-               return 38;
-           case 2503:
-               return 39;
-       }
-       return -1;
-}
-
-static int sendrxkenwood(struct rpt *myrpt, char *txstr, char *rxstr, 
-       char *cmpstr)
-{
-int    i,j;
-
-       for(i = 0;i < KENWOOD_RETRIES;i++)
-       {
-               j = sendkenwood(myrpt,txstr,rxstr);
-               if (j < 0) return(j);
-               if (j == 0) continue;
-               if (!strncmp(rxstr,cmpstr,strlen(cmpstr))) return(0);
-       }
-       return(-1);
-}              
-
-static int setkenwood(struct rpt *myrpt)
-{
-char rxstr[RAD_SERIAL_BUFLEN],txstr[RAD_SERIAL_BUFLEN],freq[20];
-char mhz[MAXREMSTR],offset[20],band,decimals[MAXREMSTR],band1,band2;
-int myrxpl;
-       
-int offsets[] = {0,2,1};
-int powers[] = {2,1,0};
-
-       if (sendrxkenwood(myrpt,"VMC 0,0\r",rxstr,"VMC") < 0) return -1;
-       split_freq(mhz, decimals, myrpt->freq);
-       if (atoi(mhz) > 400)
-       {
-               band = '6';
-               band1 = '1';
-               band2 = '5';
-               strcpy(offset,"005000000");
-       }
-       else
-       {
-               band = '2';
-               band1 = '0';
-               band2 = '2';
-               strcpy(offset,"000600000");
-       }
-       strcpy(freq,"000000");
-       strncpy(freq,decimals,strlen(decimals));
-       myrxpl = myrpt->rxplon;
-       if (IS_XPMR(myrpt)) myrxpl = 0;
-       sprintf(txstr,"VW %c,%05d%s,0,%d,0,%d,%d,,%02d,,%02d,%s\r",
-               band,atoi(mhz),freq,offsets[(int)myrpt->offset],
-               (myrpt->txplon != 0),myrxpl,
-               kenwood_pltocode(myrpt->txpl),kenwood_pltocode(myrpt->rxpl),
-               offset);
-       if (sendrxkenwood(myrpt,txstr,rxstr,"VW") < 0) return -1;
-       sprintf(txstr,"RBN %c\r",band2);
-       if (sendrxkenwood(myrpt,txstr,rxstr,"RBN") < 0) return -1;
-       sprintf(txstr,"PC %c,%d\r",band1,powers[(int)myrpt->powerlevel]);
-       if (sendrxkenwood(myrpt,txstr,rxstr,"PC") < 0) return -1;
-       return 0;
-}
-
-static int set_tm271(struct rpt *myrpt)
-{
-char rxstr[RAD_SERIAL_BUFLEN],txstr[RAD_SERIAL_BUFLEN],freq[20];
-char mhz[MAXREMSTR],decimals[MAXREMSTR];
-       
-int offsets[] = {0,2,1};
-int powers[] = {2,1,0};
-
-       split_freq(mhz, decimals, myrpt->freq);
-       strcpy(freq,"000000");
-       strncpy(freq,decimals,strlen(decimals));
-
-       sprintf(txstr,"VF %04d%s,4,%d,0,%d,0,0,%d,%d,000,00600000,0,0\r",
-               atoi(mhz),freq,offsets[(int)myrpt->offset],
-               (myrpt->txplon != 0),kenwood_pltocode(myrpt->txpl),
-               kenwood_pltocode(myrpt->rxpl));
-
-       if (sendrxkenwood(myrpt,txstr,rxstr,"VF") < 0) return -1;
-       if (sendrxkenwood(myrpt,"VM 0\r",rxstr,"VM") < 0) return -1;
-       sprintf(txstr,"PC %d\r",powers[(int)myrpt->powerlevel]);
-       if (sendrxkenwood(myrpt,txstr,rxstr,"PC") < 0) return -1;
-       return 0;
-}
-
-static int setrbi(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s;
-unsigned char rbicmd[5];
-int    band,txoffset = 0,txpower = 0,rxpl;
-
-       /* must be a remote system */
-       if (!myrpt->remoterig) return(0);
-       if (!myrpt->remoterig[0]) return(0);
-       /* must have rbi hardware */
-       if (strncmp(myrpt->remoterig,remote_rig_rbi,3)) return(0);
-       if (setrbi_check(myrpt) == -1) return(-1);
-       strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
-       s = strchr(tmp,'.');
-       /* if no decimal, is invalid */
-       
-       if (s == NULL){
-               if(debug)
-                       printf("@@@@ Frequency needs a decimal\n");
-               return -1;
-       }
-       
-       *s++ = 0;
-       if (strlen(tmp) < 2){
-               if(debug)
-                       printf("@@@@ Bad MHz digits: %s\n", tmp);
-               return -1;
-       }
-        
-       if (strlen(s) < 3){
-               if(debug)
-                       printf("@@@@ Bad KHz digits: %s\n", s);
-               return -1;
-       }
-
-       if ((s[2] != '0') && (s[2] != '5')){
-               if(debug)
-                       printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
-               return -1;
-       }
-        
-       band = rbi_mhztoband(tmp);
-       if (band == -1){
-               if(debug)
-                       printf("@@@@ Bad Band: %s\n", tmp);
-               return -1;
-       }
-       
-       rxpl = rbi_pltocode(myrpt->rxpl);
-       
-       if (rxpl == -1){
-               if(debug)
-                       printf("@@@@ Bad TX PL: %s\n", myrpt->rxpl);
-               return -1;
-       }
-
-       
-       switch(myrpt->offset)
-       {
-           case REM_MINUS:
-               txoffset = 0;
-               break;
-           case REM_PLUS:
-               txoffset = 0x10;
-               break;
-           case REM_SIMPLEX:
-               txoffset = 0x20;
-               break;
-       }
-       switch(myrpt->powerlevel)
-       {
-           case REM_LOWPWR:
-               txpower = 0;
-               break;
-           case REM_MEDPWR:
-               txpower = 0x20;
-               break;
-           case REM_HIPWR:
-               txpower = 0x10;
-               break;
-       }
-       rbicmd[0] = 0;
-       rbicmd[1] = band | txpower | 0xc0;
-       rbicmd[2] = (*(s - 2) - '0') | txoffset | 0x80;
-       if (s[2] == '5') rbicmd[2] |= 0x40;
-       rbicmd[3] = ((*s - '0') << 4) + (s[1] - '0');
-       rbicmd[4] = rxpl;
-       if (myrpt->txplon) rbicmd[4] |= 0x40;
-       if (myrpt->rxplon) rbicmd[4] |= 0x80;
-       rbi_out(myrpt,rbicmd);
-       return 0;
-}
-
-static int setrtx(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s,rigstr[200],pwr,res = 0;
-int    band,rxpl,txpl;
-float ofac;
-double txfreq;
-
-       /* must be a remote system */
-       if (!myrpt->remoterig) return(0);
-       if (!myrpt->remoterig[0]) return(0);
-       /* must have rtx hardware */
-       if (!ISRIG_RTX(myrpt->remoterig)) return(0);
-       /* must be a usbradio interface type */
-       if (!IS_XPMR(myrpt)) return(0);
-       strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
-       s = strchr(tmp,'.');
-       /* if no decimal, is invalid */
-       
-       if(debug)printf("setrtx() %s %s\n",myrpt->name,myrpt->remoterig);
-
-       if (s == NULL){
-               if(debug)
-                       printf("@@@@ Frequency needs a decimal\n");
-               return -1;
-       }
-       *s++ = 0;
-       if (strlen(tmp) < 2){
-               if(debug)
-                       printf("@@@@ Bad MHz digits: %s\n", tmp);
-               return -1;
-       }
-        
-       if (strlen(s) < 3){
-               if(debug)
-                       printf("@@@@ Bad KHz digits: %s\n", s);
-               return -1;
-       }
-
-       if ((s[2] != '0') && (s[2] != '5')){
-               if(debug)
-                       printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
-               return -1;
-       }
-        
-       band = rbi_mhztoband(tmp);
-       if (band == -1){
-               if(debug)
-                       printf("@@@@ Bad Band: %s\n", tmp);
-               return -1;
-       }
-       
-       rxpl = rbi_pltocode(myrpt->rxpl);
-       
-       if (rxpl == -1){
-               if(debug)
-                       printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl);
-               return -1;
-       }
-
-       txpl = rbi_pltocode(myrpt->txpl);
-       
-       if (txpl == -1){
-               if(debug)
-                       printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
-               return -1;
-       }
-
-       res = setrtx_check(myrpt);
-       if (res < 0) return res;
-       ofac = 0.0;
-       if (myrpt->offset == REM_MINUS) ofac = -1.0;
-       if (myrpt->offset == REM_PLUS) ofac = 1.0;
-
-       if (!strcmp(myrpt->remoterig,remote_rig_rtx450))
-               txfreq = atof(myrpt->freq) +  (ofac * 5.0);
-       else
-               txfreq = atof(myrpt->freq) +  (ofac * 0.6);
-
-       pwr = 'L';
-       if (myrpt->powerlevel == REM_HIPWR) pwr = 'H';
-       if (!res)
-       {
-               sprintf(rigstr,"SETFREQ %s %f %s %s %c",myrpt->freq,txfreq,
-                       (myrpt->rxplon) ? myrpt->rxpl : "0.0",
-                       (myrpt->txplon) ? myrpt->txpl : "0.0",pwr);
-               send_usb_txt(myrpt,rigstr);
-               rpt_telemetry(myrpt,COMPLETE,NULL);
-               res = 0;
-       }
-       return 0;
-}
-#if 0
-/*
-       sets current signaling code for xpmr routines
-       under development for new radios.
-*/
-static int setxpmr(struct rpt *myrpt)
-{
-       char rigstr[200];
-       int rxpl,txpl;
-
-       /* must be a remote system */
-       if (!myrpt->remoterig) return(0);
-       if (!myrpt->remoterig[0]) return(0);
-       /* must not have rtx hardware */
-       if (ISRIG_RTX(myrpt->remoterig)) return(0);
-       /* must be a usbradio interface type */
-       if (!IS_XPMR(myrpt)) return(0);
-       
-       if(debug)printf("setxpmr() %s %s\n",myrpt->name,myrpt->remoterig );
-
-       rxpl = rbi_pltocode(myrpt->rxpl);
-       
-       if (rxpl == -1){
-               if(debug)
-                       printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl);
-               return -1;
-       }
-
-       txpl = rbi_pltocode(myrpt->txpl);
-       if (txpl == -1){
-               if(debug)
-                       printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
-               return -1;
-       }
-       sprintf(rigstr,"SETFREQ 0.0 0.0 %s %s L",
-               (myrpt->rxplon) ? myrpt->rxpl : "0.0",
-               (myrpt->txplon) ? myrpt->txpl : "0.0");
-       send_usb_txt(myrpt,rigstr);
-       return 0;
-}
-#endif
-
-static int setrbi_check(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s;
-int    band,txpl;
-
-       /* must be a remote system */
-       if (!myrpt->remote) return(0);
-       /* must have rbi hardware */
-       if (strncmp(myrpt->remoterig,remote_rig_rbi,3)) return(0);
-       strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
-       s = strchr(tmp,'.');
-       /* if no decimal, is invalid */
-       
-       if (s == NULL){
-               if(debug)
-                       printf("@@@@ Frequency needs a decimal\n");
-               return -1;
-       }
-       
-       *s++ = 0;
-       if (strlen(tmp) < 2){
-               if(debug)
-                       printf("@@@@ Bad MHz digits: %s\n", tmp);
-               return -1;
-       }
-        
-       if (strlen(s) < 3){
-               if(debug)
-                       printf("@@@@ Bad KHz digits: %s\n", s);
-               return -1;
-       }
-
-       if ((s[2] != '0') && (s[2] != '5')){
-               if(debug)
-                       printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
-               return -1;
-       }
-        
-       band = rbi_mhztoband(tmp);
-       if (band == -1){
-               if(debug)
-                       printf("@@@@ Bad Band: %s\n", tmp);
-               return -1;
-       }
-       
-       txpl = rbi_pltocode(myrpt->txpl);
-       
-       if (txpl == -1){
-               if(debug)
-                       printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
-               return -1;
-       }
-       return 0;
-}
-
-static int setrtx_check(struct rpt *myrpt)
-{
-char tmp[MAXREMSTR] = "",*s;
-int    band,txpl,rxpl;
-
-       /* must be a remote system */
-       if (!myrpt->remote) return(0);
-       /* must have rbi hardware */
-       if (strncmp(myrpt->remoterig,remote_rig_rbi,3)) return(0);
-       strncpy(tmp, myrpt->freq, sizeof(tmp) - 1);
-       s = strchr(tmp,'.');
-       /* if no decimal, is invalid */
-       
-       if (s == NULL){
-               if(debug)
-                       printf("@@@@ Frequency needs a decimal\n");
-               return -1;
-       }
-       
-       *s++ = 0;
-       if (strlen(tmp) < 2){
-               if(debug)
-                       printf("@@@@ Bad MHz digits: %s\n", tmp);
-               return -1;
-       }
-        
-       if (strlen(s) < 3){
-               if(debug)
-                       printf("@@@@ Bad KHz digits: %s\n", s);
-               return -1;
-       }
-
-       if ((s[2] != '0') && (s[2] != '5')){
-               if(debug)
-                       printf("@@@@ KHz must end in 0 or 5: %c\n", s[2]);
-               return -1;
-       }
-        
-       band = rbi_mhztoband(tmp);
-       if (band == -1){
-               if(debug)
-                       printf("@@@@ Bad Band: %s\n", tmp);
-               return -1;
-       }
-       
-       txpl = rbi_pltocode(myrpt->txpl);
-       
-       if (txpl == -1){
-               if(debug)
-                       printf("@@@@ Bad TX PL: %s\n", myrpt->txpl);
-               return -1;
-       }
-
-       rxpl = rbi_pltocode(myrpt->rxpl);
-       
-       if (rxpl == -1){
-               if(debug)
-                       printf("@@@@ Bad RX PL: %s\n", myrpt->rxpl);
-               return -1;
-       }
-       return 0;
-}
-
-static int check_freq_kenwood(int m, int d, int *defmode)
-{
-       int dflmd = REM_MODE_FM;
-
-       if (m == 144){ /* 2 meters */
-               if(d < 10100)
-                       return -1;
-       }
-       else if((m >= 145) && (m < 148)){
-               ;
-       }
-       else if((m >= 430) && (m < 450)){ /* 70 centimeters */
-               ;
-       }
-       else
-               return -1;
-       
-       if(defmode)
-               *defmode = dflmd;       
-
-
-       return 0;
-}
-
-
-static int check_freq_tm271(int m, int d, int *defmode)
-{
-       int dflmd = REM_MODE_FM;
-
-       if (m == 144){ /* 2 meters */
-               if(d < 10100)
-                       return -1;
-       }
-       else if((m >= 145) && (m < 148)){
-               ;
-       }
-               return -1;
-       
-       if(defmode)
-               *defmode = dflmd;       
-
-
-       return 0;
-}
-
-
-/* Check for valid rbi frequency */
-/* Hard coded limits now, configurable later, maybe? */
-
-static int check_freq_rbi(int m, int d, int *defmode)
-{
-       int dflmd = REM_MODE_FM;
-
-       if(m == 50){ /* 6 meters */
-               if(d < 10100)
-                       return -1;
-       }
-       else if((m >= 51) && ( m < 54)){
-                ;
-       }
-       else if(m == 144){ /* 2 meters */
-               if(d < 10100)
-                       return -1;
-       }
-       else if((m >= 145) && (m < 148)){
-               ;
-       }
-       else if((m >= 222) && (m < 225)){ /* 1.25 meters */
-               ;
-       }
-       else if((m >= 430) && (m < 450)){ /* 70 centimeters */
-               ;
-       }
-       else if((m >= 1240) && (m < 1300)){ /* 23 centimeters */
-               ;
-       }
-       else
-               return -1;
-       
-       if(defmode)
-               *defmode = dflmd;       
-
-
-       return 0;
-}
-
-/* Check for valid rtx frequency */
-/* Hard coded limits now, configurable later, maybe? */
-
-static int check_freq_rtx(int m, int d, int *defmode, struct rpt *myrpt)
-{
-       int dflmd = REM_MODE_FM;
-
-       if (!strcmp(myrpt->remoterig,remote_rig_rtx150))
-       {
-
-               if(m == 144){ /* 2 meters */
-                       if(d < 10100)
-                               return -1;
-               }
-               else if((m >= 145) && (m < 148)){
-                       ;
-               }
-               else
-                       return -1;
-       }
-       else 
-       {
-               if((m >= 430) && (m < 450)){ /* 70 centimeters */
-                       ;
-               }
-               else
-                       return -1;
-       }
-       if(defmode)
-               *defmode = dflmd;       
-
-
-       return 0;
-}
-
-/*
- * Convert decimals of frequency to int
- */
-
-static int decimals2int(char *fraction)
-{
-       int i;
-       char len = strlen(fraction);
-       int multiplier = 100000;
-       int res = 0;
-
-       if(!len)
-               return 0;
-       for( i = 0 ; i < len ; i++, multiplier /= 10)
-               res += (fraction[i] - '0') * multiplier;
-       return res;
-}
-
-
-/*
-* Split frequency into mhz and decimals
-*/
-static int split_freq(char *mhz, char *decimals, char *freq)
-{
-       char freq_copy[MAXREMSTR];
-       char *decp;
-
-       decp = strchr(strncpy(freq_copy, freq, MAXREMSTR),'.');
-       if(decp){
-               *decp++ = 0;
-               strncpy(mhz, freq_copy, MAXREMSTR);
-               strcpy(decimals, "00000");
-               strncpy(decimals, decp, strlen(decp));
-               decimals[5] = 0;
-               return 0;
-       }
-       else
-               return -1;
-
-}
-       
-/*
-* Split ctcss frequency into hertz and decimal
-*/
-static int split_ctcss_freq(char *hertz, char *decimal, char *freq)
-{
-       char freq_copy[MAXREMSTR];
-       char *decp;
-
-       decp = strchr(strncpy(freq_copy, freq, MAXREMSTR),'.');
-       if(decp){
-               *decp++ = 0;
-               strncpy(hertz, freq_copy, MAXREMSTR);
-               strncpy(decimal, decp, strlen(decp));
-               decimal[strlen(decp)] = '\0';
-               return 0;
-       }
-       else
-               return -1;
-}
-
-
-
-/*
-* FT-897 I/O handlers
-*/
-
-/* Check to see that the frequency is valid */
-/* Hard coded limits now, configurable later, maybe? */
-
-
-static int check_freq_ft897(int m, int d, int *defmode)
-{
-       int dflmd = REM_MODE_FM;
-
-       if(m == 1){ /* 160 meters */
-               dflmd = REM_MODE_LSB; 
-               if(d < 80000)
-                       return -1;
-       }
-       else if(m == 3){ /* 80 meters */
-               dflmd = REM_MODE_LSB;
-               if(d < 50000)
-                       return -1;
-       }
-       else if(m == 7){ /* 40 meters */
-               dflmd = REM_MODE_LSB;
-               if(d > 30000)
-                       return -1;
-       }
-       else if(m == 14){ /* 20 meters */
-               dflmd = REM_MODE_USB;
-               if(d > 35000)
-                       return -1;
-       }
-       else if(m == 18){ /* 17 meters */
-               dflmd = REM_MODE_USB;
-               if((d < 6800) || (d > 16800))
-                       return -1;
-       }
-       else if(m == 21){ /* 15 meters */
-               dflmd = REM_MODE_USB;
-               if((d < 20000) || (d > 45000))
-                       return -1;
-       }
-       else if(m == 24){ /* 12 meters */
-               dflmd = REM_MODE_USB;
-               if((d < 89000) || (d > 99000))
-                       return -1;
-       }
-       else if(m == 28){ /* 10 meters */
-               dflmd = REM_MODE_USB;
-       }
-       else if(m == 29){ 
-               if(d >= 51000)
-                       dflmd = REM_MODE_FM;
-               else
-                       dflmd = REM_MODE_USB;
-               if(d > 70000)
-                       return -1;
-       }
-       else if(m == 50){ /* 6 meters */
-               if(d >= 30000)
-                       dflmd = REM_MODE_FM;
-               else
-                       dflmd = REM_MODE_USB;
-
-       }
-       else if((m >= 51) && ( m < 54)){
-               dflmd = REM_MODE_FM;
-       }
-       else if(m == 144){ /* 2 meters */
-               if(d >= 30000)
-                       dflmd = REM_MODE_FM;
-               else
-                       dflmd = REM_MODE_USB;
-       }
-       else if((m >= 145) && (m < 148)){
-               dflmd = REM_MODE_FM;
-       }
-       else if((m >= 430) && (m < 450)){ /* 70 centimeters */
-               if(m  < 438)
-                       dflmd = REM_MODE_USB;
-               else
-                       dflmd = REM_MODE_FM;
-               ;
-       }
-       else
-               return -1;
-
-       if(defmode)
-               *defmode = dflmd;
-
-       return 0;
-}
-
-/*
-* Set a new frequency for the FT897
-*/
-
-static int set_freq_ft897(struct rpt *myrpt, char *newfreq)
-{
-       unsigned char cmdstr[5];
-       int m,d;
-       char mhz[MAXREMSTR];
-       char decimals[MAXREMSTR];
-
-       if(debug) 
-               printf("New frequency: %s\n",newfreq);
-
-       if(split_freq(mhz, decimals, newfreq))
-               return -1; 
-
-       m = atoi(mhz);
-       d = atoi(decimals);
-
-       /* The FT-897 likes packed BCD frequencies */
-
-       cmdstr[0] = ((m / 100) << 4) + ((m % 100)/10);                  /* 100MHz 10Mhz */
-       cmdstr[1] = ((m % 10) << 4) + (d / 10000);                      /* 1MHz 100KHz */
-       cmdstr[2] = (((d % 10000)/1000) << 4) + ((d % 1000)/ 100);      /* 10KHz 1KHz */
-       cmdstr[3] = (((d % 100)/10) << 4) + (d % 10);                   /* 100Hz 10Hz */
-       cmdstr[4] = 0x01;                                               /* command */
-
-       return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-
-}
-
-/* ft-897 simple commands */
-
-static int simple_command_ft897(struct rpt *myrpt, char command)
-{
-       unsigned char cmdstr[5];
-       
-       memset(cmdstr, 0, 5);
-
-       cmdstr[4] = command;    
-
-       return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-
-}
-
-/* ft-897 offset */
-
-static int set_offset_ft897(struct rpt *myrpt, char offset)
-{
-       unsigned char cmdstr[5];
-       
-       memset(cmdstr, 0, 5);
-
-       switch(offset){
-               case    REM_SIMPLEX:
-                       cmdstr[0] = 0x89;
-                       break;
-
-               case    REM_MINUS:
-                       cmdstr[0] = 0x09;
-                       break;
-               
-               case    REM_PLUS:
-                       cmdstr[0] = 0x49;
-                       break;  
-
-               default:
-                       return -1;
-       }
-
-       cmdstr[4] = 0x09;       
-
-       return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}
-
-/* ft-897 mode */
-
-static int set_mode_ft897(struct rpt *myrpt, char newmode)
-{
-       unsigned char cmdstr[5];
-       
-       memset(cmdstr, 0, 5);
-       
-       switch(newmode){
-               case    REM_MODE_FM:
-                       cmdstr[0] = 0x08;
-                       break;
-
-               case    REM_MODE_USB:
-                       cmdstr[0] = 0x01;
-                       break;
-
-               case    REM_MODE_LSB:
-                       cmdstr[0] = 0x00;
-                       break;
-
-               case    REM_MODE_AM:
-                       cmdstr[0] = 0x04;
-                       break;
-               
-               default:
-                       return -1;
-       }
-       cmdstr[4] = 0x07;       
-
-       return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}
-
-/* Set tone encode and decode modes */
-
-static int set_ctcss_mode_ft897(struct rpt *myrpt, char txplon, char rxplon)
-{
-       unsigned char cmdstr[5];
-       
-       memset(cmdstr, 0, 5);
-       
-       if(rxplon && txplon)
-               cmdstr[0] = 0x2A; /* Encode and Decode */
-       else if (!rxplon && txplon)
-               cmdstr[0] = 0x4A; /* Encode only */
-       else if (rxplon && !txplon)
-               cmdstr[0] = 0x3A; /* Encode only */
-       else
-               cmdstr[0] = 0x8A; /* OFF */
-
-       cmdstr[4] = 0x0A;       
-
-       return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}
-
-
-/* Set transmit and receive ctcss tone frequencies */
-
-static int set_ctcss_freq_ft897(struct rpt *myrpt, char *txtone, char *rxtone)
-{
-       unsigned char cmdstr[5];
-       char hertz[MAXREMSTR],decimal[MAXREMSTR];
-       int h,d;        
-
-       memset(cmdstr, 0, 5);
-
-       if(split_ctcss_freq(hertz, decimal, txtone))
-               return -1; 
-
-       h = atoi(hertz);
-       d = atoi(decimal);
-       
-       cmdstr[0] = ((h / 100) << 4) + (h % 100)/ 10;
-       cmdstr[1] = ((h % 10) << 4) + (d % 10);
-       
-       if(rxtone){
-       
-               if(split_ctcss_freq(hertz, decimal, rxtone))
-                       return -1; 
-
-               h = atoi(hertz);
-               d = atoi(decimal);
-       
-               cmdstr[2] = ((h / 100) << 4) + (h % 100)/ 10;
-               cmdstr[3] = ((h % 10) << 4) + (d % 10);
-       }
-       cmdstr[4] = 0x0B;       
-
-       return serial_remote_io(myrpt, cmdstr, 5, NULL, 0, 0);
-}      
-
-
-
-static int set_ft897(struct rpt *myrpt)
-{
-       int res;
-       
-       if(debug)
-               printf("@@@@ lock on\n");
-
-       res = simple_command_ft897(myrpt, 0x00);        /* LOCK on */   
-
-       if(debug)
-               printf("@@@@ ptt off\n");
-
-       if(!res)
-               res = simple_command_ft897(myrpt, 0x88);                /* PTT off */
-
-       if(debug)
-               printf("Modulation mode\n");
-
-       if(!res)
-               res = set_mode_ft897(myrpt, myrpt->remmode);            /* Modulation mode */
-
-       if(debug)
-               printf("Split off\n");
-
-       if(!res)
-               simple_command_ft897(myrpt, 0x82);                      /* Split off */
-
-       if(debug)
-               printf("Frequency\n");
-
-       if(!res)
-               res = set_freq_ft897(myrpt, myrpt->freq);               /* Frequency */
-       if((myrpt->remmode == REM_MODE_FM)){
-               if(debug)
-                       printf("Offset\n");
-               if(!res)
-                       res = set_offset_ft897(myrpt, myrpt->offset);   /* Offset if FM */
-               if((!res)&&(myrpt->rxplon || myrpt->txplon)){
-                       if(debug)
-                               printf("CTCSS tone freqs.\n");
-                       res = set_ctcss_freq_ft897(myrpt, myrpt->txpl, myrpt->rxpl); /* CTCSS freqs if CTCSS is enabled */
-               }
-               if(!res){
-                       if(debug)
-                               printf("CTCSS mode\n");
-                       res = set_ctcss_mode_ft897(myrpt, myrpt->txplon, myrpt->rxplon); /* CTCSS mode */
-               }
-       }
-       if((myrpt->remmode == REM_MODE_USB)||(myrpt->remmode == REM_MODE_LSB)){
-               if(debug)
-                       printf("Clarifier off\n");
-               simple_command_ft897(myrpt, 0x85);                      /* Clarifier off if LSB or USB */
-       }
-       return res;
-}
-
-static int closerem_ft897(struct rpt *myrpt)
-{
-       simple_command_ft897(myrpt, 0x88); /* PTT off */
-       return 0;
-}      
-
-/*
-* Bump frequency up or down by a small amount 
-* Return 0 if the new frequnecy is valid, or -1 if invalid
-* Interval is in Hz, resolution is 10Hz 
-*/
-
-static int multimode_bump_freq_ft897(struct rpt *myrpt, int interval)
-{
-       int m,d;
-       char mhz[MAXREMSTR], decimals[MAXREMSTR];
-
-       if(debug)
-               printf("Before bump: %s\n", myrpt->freq);
-
-       if(split_freq(mhz, decimals, myrpt->freq))
-               return -1;
-       
-       m = atoi(mhz);
-       d = atoi(decimals);
-
-       d += (interval / 10); /* 10Hz resolution */
-       if(d < 0){
-               m--;
-               d += 100000;
-       }
-       else if(d >= 100000){
-               m++;
-               d -= 100000;
-       }
-
-       if(check_freq_ft897(m, d, NULL)){
-               if(debug)
-                       printf("Bump freq invalid\n");
-               return -1;
-       }
-
-       snprintf(myrpt->freq, MAXREMSTR, "%d.%05d", m, d);
-
-       if(debug)
-               printf("After bump: %s\n", myrpt->freq);
-
-       return set_freq_ft897(myrpt, myrpt->freq);      
-}
-
-
-
-/*
-* IC-706 I/O handlers
-*/
-
-/* Check to see that the frequency is valid */
-/* returns 0 if frequency is valid          */
-
-static int check_freq_ic706(int m, int d, int *defmode, char mars)
-{
-       int dflmd = REM_MODE_FM;
-       int rv=0;
-
-       if(debug > 6)
-               ast_log(LOG_NOTICE,"(%i,%i,%i,%i)\n",m,d,*defmode,mars);
-
-       /* first test for standard amateur radio bands */
-
-       if(m == 1){                                     /* 160 meters */
-               dflmd = REM_MODE_LSB; 
-               if(d < 80000)rv=-1;
-       }
-       else if(m == 3){                                /* 80 meters */
-               dflmd = REM_MODE_LSB;
-               if(d < 50000)rv=-1;
-       }
-       else if(m == 7){                                /* 40 meters */
-               dflmd = REM_MODE_LSB;
-               if(d > 30000)rv=-1;
-       }
-       else if(m == 14){                               /* 20 meters */
-               dflmd = REM_MODE_USB;
-               if(d > 35000)rv=-1;
-       }
-       else if(m == 18){                                                       /* 17 meters */
-               dflmd = REM_MODE_USB;
-               if((d < 6800) || (d > 16800))rv=-1;
-       }
-       else if(m == 21){ /* 15 meters */
-               dflmd = REM_MODE_USB;
-               if((d < 20000) || (d > 45000))rv=-1;
-       }
-       else if(m == 24){ /* 12 meters */
-               dflmd = REM_MODE_USB;
-               if((d < 89000) || (d > 99000))rv=-1;
-       }
-       else if(m == 28){                                                       /* 10 meters */
-               dflmd = REM_MODE_USB;
-       }
-       else if(m == 29){ 
-               if(d >= 51000)
-                       dflmd = REM_MODE_FM;
-               else
-                       dflmd = REM_MODE_USB;
-               if(d > 70000)rv=-1;
-       }
-       else if(m == 50){                                                       /* 6 meters */
-               if(d >= 30000)
-                       dflmd = REM_MODE_FM;
-               else
-                       dflmd = REM_MODE_USB;
-       }
-       else if((m >= 51) && ( m < 54)){
-               dflmd = REM_MODE_FM;
-       }
-       else if(m == 144){ /* 2 meters */
-               if(d >= 30000)
-                       dflmd = REM_MODE_FM;
-               else
-                       dflmd = REM_MODE_USB;
-       }
-       else if((m >= 145) && (m < 148)){
-               dflmd = REM_MODE_FM;
-       }
-       else if((m >= 430) && (m < 450)){                       /* 70 centimeters */
-               if(m  < 438)
-                       dflmd = REM_MODE_USB;
-               else
-                       dflmd = REM_MODE_FM;
-       }
-
-       /* check expanded coverage */
-       if(mars && rv<0){
-               if((m >= 450) && (m < 470)){                    /* LMR */
-                       dflmd = REM_MODE_FM;
-                       rv=0;
-               }
-               else if((m >= 148) && (m < 174)){               /* LMR */
-                       dflmd = REM_MODE_FM;
-                       rv=0;
-               }
-               else if((m >= 138) && (m < 144)){               /* VHF-AM AIRCRAFT */
-                       dflmd = REM_MODE_AM;
-                       rv=0;
-               }
-               else if((m >= 108) && (m < 138)){               /* VHF-AM AIRCRAFT */
-                       dflmd = REM_MODE_AM;
-                       rv=0;
-               }
-               else if( (m==0 && d>=55000) || (m==1 && d<=75000) ){    /* AM BCB*/
-                       dflmd = REM_MODE_AM;
-                       rv=0;
-               }
-               else if( (m == 1 && d>75000) || (m>1 && m<30) ){                /* HF SWL*/
-                       dflmd = REM_MODE_AM;
-                       rv=0;
-               }
-       }
-
-       if(defmode)
-               *defmode = dflmd;
-
-       if(debug > 1)
-               ast_log(LOG_NOTICE,"(%i,%i,%i,%i) returning %i\n",m,d,*defmode,mars,rv);
-
-       return rv;
-}
-
-/* take a PL frequency and turn it into a code */
-static int ic706_pltocode(char *str)
-{
-       int i;
-       char *s;
-       int rv=-1;
-
-       s = strchr(str,'.');
-       i = 0;
-       if (s) i = atoi(s + 1);
-       i += atoi(str) * 10;
-       switch(i)
-       {
-           case 670:
-                       rv=0;
-           case 693:
-                       rv=1;
-           case 719:
-                       rv=2;
-           case 744:
-                       rv=3;
-           case 770:
-                       rv=4;
-           case 797:
-                       rv=5;
-           case 825:
-                       rv=6;
-           case 854:
-                       rv=7;
-           case 885:
-                       rv=8;
-           case 915:
-                       rv=9;
-           case 948:
-                       rv=10;
-           case 974:
-                       rv=11;
-           case 1000:
-                       rv=12;
-           case 1035:
-                       rv=13;
-           case 1072:
-                       rv=14;
-           case 1109:
-                       rv=15;
-           case 1148:
-                       rv=16;
-           case 1188:
-                       rv=17;
-           case 1230:
-                       rv=18;
-           case 1273:
-                       rv=19;
-           case 1318:
-                       rv=20;
-           case 1365:
-                       rv=21;
-           case 1413:
-                       rv=22;
-           case 1462:
-                       rv=23;
-           case 1514:
-                       rv=24;
-           case 1567:
-                       rv=25;
-           case 1598:
-                       rv=26;
-           case 1622:
-                       rv=27;
-           case 1655:
-                       rv=28;          
-           case 1679:
-                       rv=29;
-           case 1713:
-                       rv=30;
-           case 1738:
-                       rv=31;
-           case 1773:
-                       rv=32;
-           case 1799:
-                       rv=33;
-        case 1835:
-                       rv=34;
-           case 1862:
-                       rv=35;
-           case 1899:
-                       rv=36;
-           case 1928:
-                       rv=37;
-           case 1966:
-                       rv=38;
-           case 1995:
-                       rv=39;
-           case 2035:
-                       rv=40;
-           case 2065:
-                       rv=41;
-           case 2107:
-                       rv=42;
-           case 2181:
-                       rv=43;
-           case 2257:
-                       rv=44;
-           case 2291:
-                       rv=45;
-           case 2336:
-                       rv=46;
-           case 2418:
-                       rv=47;
-           case 2503:
-                       rv=48;
-           case 2541:
-                       rv=49;
-       }
-       if(debug > 1)
-               ast_log(LOG_NOTICE,"%i  rv=%i\n",i, rv);
-
-       return rv;
-}
-
-/* ic-706 simple commands */
-
-static int simple_command_ic706(struct rpt *myrpt, char command, char subcommand)
-{
-       unsigned char cmdstr[10];
-       
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = command;
-       cmdstr[5] = subcommand;
-       cmdstr[6] = 0xfd;
-
-       return(civ_cmd(myrpt,cmdstr,7));
-}
-
-/*
-* Set a new frequency for the ic706
-*/
-
-static int set_freq_ic706(struct rpt *myrpt, char *newfreq)
-{
-       unsigned char cmdstr[20];
-       char mhz[MAXREMSTR], decimals[MAXREMSTR];
-       int m,d;
-
-       if(debug) 
-               ast_log(LOG_NOTICE,"newfreq:%s\n",newfreq);                     
-
-       if(split_freq(mhz, decimals, newfreq))
-               return -1; 
-
-       m = atoi(mhz);
-       d = atoi(decimals);
-
-       /* The ic-706 likes packed BCD frequencies */
-
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 5;
-       cmdstr[5] = ((d % 10) << 4);
-       cmdstr[6] = (((d % 1000)/ 100) << 4) + ((d % 100)/10);
-       cmdstr[7] = ((d / 10000) << 4) + ((d % 10000)/1000);
-       cmdstr[8] = (((m % 100)/10) << 4) + (m % 10);
-       cmdstr[9] = (m / 100);
-       cmdstr[10] = 0xfd;
-
-       return(civ_cmd(myrpt,cmdstr,11));
-}
-
-/* ic-706 offset */
-
-static int set_offset_ic706(struct rpt *myrpt, char offset)
-{
-       unsigned char c;
-
-       if(debug > 6)
-               ast_log(LOG_NOTICE,"offset=%i\n",offset);
-
-       switch(offset){
-               case    REM_SIMPLEX:
-                       c = 0x10;
-                       break;
-
-               case    REM_MINUS:
-                       c = 0x11;
-                       break;
-               
-               case    REM_PLUS:
-                       c = 0x12;
-                       break;  
-
-               default:
-                       return -1;
-       }
-
-       return simple_command_ic706(myrpt,0x0f,c);
-
-}
-
-/* ic-706 mode */
-
-static int set_mode_ic706(struct rpt *myrpt, char newmode)
-{
-       unsigned char c;
-       
-       if(debug > 6)
-               ast_log(LOG_NOTICE,"newmode=%i\n",newmode);
-
-       switch(newmode){
-               case    REM_MODE_FM:
-                       c = 5;
-                       break;
-
-               case    REM_MODE_USB:
-                       c = 1;
-                       break;
-
-               case    REM_MODE_LSB:
-                       c = 0;
-                       break;
-
-               case    REM_MODE_AM:
-                       c = 2;
-                       break;
-               
-               default:
-                       return -1;
-       }
-       return simple_command_ic706(myrpt,6,c);
-}
-
-/* Set tone encode and decode modes */
-
-static int set_ctcss_mode_ic706(struct rpt *myrpt, char txplon, char rxplon)
-{
-       unsigned char cmdstr[10];
-       int rv;
-
-       if(debug > 6)
-               ast_log(LOG_NOTICE,"txplon=%i  rxplon=%i \n",txplon,rxplon);
-
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 0x16;
-       cmdstr[5] = 0x42;
-       cmdstr[6] = (txplon != 0);
-       cmdstr[7] = 0xfd;
-
-       rv = civ_cmd(myrpt,cmdstr,8);
-       if (rv) return(-1);
-
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 0x16;
-       cmdstr[5] = 0x43;
-       cmdstr[6] = (rxplon != 0);
-       cmdstr[7] = 0xfd;
-
-       return(civ_cmd(myrpt,cmdstr,8));
-}
-
-#if 0
-/* Set transmit and receive ctcss tone frequencies */
-
-static int set_ctcss_freq_ic706(struct rpt *myrpt, char *txtone, char *rxtone)
-{
-       unsigned char cmdstr[10];
-       char hertz[MAXREMSTR],decimal[MAXREMSTR];
-       int h,d,rv;
-
-       memset(cmdstr, 0, 5);
-
-       if(debug > 6)
-               ast_log(LOG_NOTICE,"txtone=%s  rxtone=%s \n",txtone,rxtone);
-
-       if(split_ctcss_freq(hertz, decimal, txtone))
-               return -1; 
-
-       h = atoi(hertz);
-       d = atoi(decimal);
-       
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 0x1b;
-       cmdstr[5] = 0;
-       cmdstr[6] = ((h / 100) << 4) + (h % 100)/ 10;
-       cmdstr[7] = ((h % 10) << 4) + (d % 10);
-       cmdstr[8] = 0xfd;
-
-       rv = civ_cmd(myrpt,cmdstr,9);
-       if (rv) return(-1);
-
-       if (!rxtone) return(0);
-
-       if(split_ctcss_freq(hertz, decimal, rxtone))
-               return -1; 
-
-       h = atoi(hertz);
-       d = atoi(decimal);
-
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 0x1b;
-       cmdstr[5] = 1;
-       cmdstr[6] = ((h / 100) << 4) + (h % 100)/ 10;
-       cmdstr[7] = ((h % 10) << 4) + (d % 10);
-       cmdstr[8] = 0xfd;
-       return(civ_cmd(myrpt,cmdstr,9));
-}      
-#endif
-
-static int vfo_ic706(struct rpt *myrpt)
-{
-       unsigned char cmdstr[10];
-       
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 7;
-       cmdstr[5] = 0xfd;
-
-       return(civ_cmd(myrpt,cmdstr,6));
-}
-
-static int mem2vfo_ic706(struct rpt *myrpt)
-{
-       unsigned char cmdstr[10];
-       
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 0x0a;
-       cmdstr[5] = 0xfd;
-
-       return(civ_cmd(myrpt,cmdstr,6));
-}
-
-static int select_mem_ic706(struct rpt *myrpt, int slot)
-{
-       unsigned char cmdstr[10];
-       
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 8;
-       cmdstr[5] = 0;
-       cmdstr[6] = ((slot / 10) << 4) + (slot % 10);
-       cmdstr[7] = 0xfd;
-
-       return(civ_cmd(myrpt,cmdstr,8));
-}
-
-static int set_ic706(struct rpt *myrpt)
-{
-       int res = 0,i;
-       
-       if(debug)ast_log(LOG_NOTICE, "Set to VFO A iobase=%i\n",myrpt->p.iobase);
-
-       if (!res)
-               res = simple_command_ic706(myrpt,7,0);
-
-       if((myrpt->remmode == REM_MODE_FM))
-       {
-               i = ic706_pltocode(myrpt->rxpl);
-               if (i == -1) return -1;
-               if(debug)
-                       printf("Select memory number\n");
-               if (!res)
-                       res = select_mem_ic706(myrpt,i + IC706_PL_MEMORY_OFFSET);
-               if(debug)
-                       printf("Transfer memory to VFO\n");
-               if (!res)
-                       res = mem2vfo_ic706(myrpt);
-       }
-               
-       if(debug)
-               printf("Set to VFO\n");
-
-       if (!res)
-               res = vfo_ic706(myrpt);
-
-       if(debug)
-               printf("Modulation mode\n");
-
-       if (!res)
-               res = set_mode_ic706(myrpt, myrpt->remmode);            /* Modulation mode */
-
-       if(debug)
-               printf("Split off\n");
-
-       if(!res)
-               simple_command_ic706(myrpt, 0x82,0);                    /* Split off */
-
-       if(debug)
-               printf("Frequency\n");
-
-       if(!res)
-               res = set_freq_ic706(myrpt, myrpt->freq);               /* Frequency */
-       if((myrpt->remmode == REM_MODE_FM)){
-               if(debug)
-                       printf("Offset\n");
-               if(!res)
-                       res = set_offset_ic706(myrpt, myrpt->offset);   /* Offset if FM */
-               if(!res){
-                       if(debug)
-                               printf("CTCSS mode\n");
-                       res = set_ctcss_mode_ic706(myrpt, myrpt->txplon, myrpt->rxplon); /* CTCSS mode */
-               }
-       }
-       return res;
-}
-
-/*
-* Bump frequency up or down by a small amount 
-* Return 0 if the new frequnecy is valid, or -1 if invalid
-* Interval is in Hz, resolution is 10Hz 
-*/
-
-static int multimode_bump_freq_ic706(struct rpt *myrpt, int interval)
-{
-       int m,d;
-       char mhz[MAXREMSTR], decimals[MAXREMSTR];
-       unsigned char cmdstr[20];
-
-       if(debug)
-               printf("Before bump: %s\n", myrpt->freq);
-
-       if(split_freq(mhz, decimals, myrpt->freq))
-               return -1;
-       
-       m = atoi(mhz);
-       d = atoi(decimals);
-
-       d += (interval / 10); /* 10Hz resolution */
-       if(d < 0){
-               m--;
-               d += 100000;
-       }
-       else if(d >= 100000){
-               m++;
-               d -= 100000;
-       }
-
-       if(check_freq_ic706(m, d, NULL,myrpt->p.remote_mars)){
-               if(debug)
-                       printf("Bump freq invalid\n");
-               return -1;
-       }
-
-       snprintf(myrpt->freq, MAXREMSTR, "%d.%05d", m, d);
-
-       if(debug)
-               printf("After bump: %s\n", myrpt->freq);
-
-       /* The ic-706 likes packed BCD frequencies */
-
-       cmdstr[0] = cmdstr[1] = 0xfe;
-       cmdstr[2] = myrpt->p.civaddr;
-       cmdstr[3] = 0xe0;
-       cmdstr[4] = 0;
-       cmdstr[5] = ((d % 10) << 4);
-       cmdstr[6] = (((d % 1000)/ 100) << 4) + ((d % 100)/10);
-       cmdstr[7] = ((d / 10000) << 4) + ((d % 10000)/1000);
-       cmdstr[8] = (((m % 100)/10) << 4) + (m % 10);
-       cmdstr[9] = (m / 100);
-       cmdstr[10] = 0xfd;
-
-       return(serial_remote_io(myrpt,cmdstr,11,NULL,0,0));
-}
-
-
-
-/*
-* Dispatch to correct I/O handler 
-*/
-static int setrem(struct rpt *myrpt)
-{
-char   str[300];
-char   *offsets[] = {"SIMPLEX","MINUS","PLUS"};
-char   *powerlevels[] = {"LOW","MEDIUM","HIGH"};
-char   *modes[] = {"FM","USB","LSB","AM"};
-int    res = -1;
-
-#if    0
-printf("FREQ,%s,%s,%s,%s,%s,%s,%d,%d\n",myrpt->freq,
-       modes[(int)myrpt->remmode],
-       myrpt->txpl,myrpt->rxpl,offsets[(int)myrpt->offset],
-       powerlevels[(int)myrpt->powerlevel],myrpt->txplon,
-       myrpt->rxplon);
-#endif
-       if (myrpt->p.archivedir)
-       {
-               sprintf(str,"FREQ,%s,%s,%s,%s,%s,%s,%d,%d",myrpt->freq,
-                       modes[(int)myrpt->remmode],
-                       myrpt->txpl,myrpt->rxpl,offsets[(int)myrpt->offset],
-                       powerlevels[(int)myrpt->powerlevel],myrpt->txplon,
-                       myrpt->rxplon);
-               donodelog(myrpt,str);
-       }
-       if(!strcmp(myrpt->remoterig, remote_rig_ft897))
-       {
-               rpt_telemetry(myrpt,SETREMOTE,NULL);
-               res = 0;
-       }
-       if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-       {
-               rpt_telemetry(myrpt,SETREMOTE,NULL);
-               res = 0;
-       }
-       if(!strcmp(myrpt->remoterig, remote_rig_tm271))
-       {
-               rpt_telemetry(myrpt,SETREMOTE,NULL);
-               res = 0;
-       }
-       else if(!strcmp(myrpt->remoterig, remote_rig_rbi))
-       {
-               res = setrbi_check(myrpt);
-               if (!res)
-               {
-                       rpt_telemetry(myrpt,SETREMOTE,NULL);
-                       res = 0;
-               }
-       }
-       else if(ISRIG_RTX(myrpt->remoterig))
-       {
-               setrtx(myrpt);
-               res = 0;
-       }
-       else if(!strcmp(myrpt->remoterig, remote_rig_kenwood)) {
-               rpt_telemetry(myrpt,SETREMOTE,NULL);
-               res = 0;
-       }
-       else
-               res = 0;
-
-       if (res < 0) ast_log(LOG_ERROR,"Unable to send remote command on node %s\n",myrpt->name);
-
-       return res;
-}
-
-static int closerem(struct rpt *myrpt)
-{
-       if(!strcmp(myrpt->remoterig, remote_rig_ft897))
-               return closerem_ft897(myrpt);
-       else
-               return 0;
-}
-
-/*
-* Dispatch to correct RX frequency checker
-*/
-
-static int check_freq(struct rpt *myrpt, int m, int d, int *defmode)
-{
-       if(!strcmp(myrpt->remoterig, remote_rig_ft897))
-               return check_freq_ft897(m, d, defmode);
-       else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-               return check_freq_ic706(m, d, defmode,myrpt->p.remote_mars);
-       else if(!strcmp(myrpt->remoterig, remote_rig_rbi))
-               return check_freq_rbi(m, d, defmode);
-       else if(!strcmp(myrpt->remoterig, remote_rig_kenwood))
-               return check_freq_kenwood(m, d, defmode);
-       else if(!strcmp(myrpt->remoterig, remote_rig_tm271))
-               return check_freq_tm271(m, d, defmode);
-       else if(ISRIG_RTX(myrpt->remoterig))
-               return check_freq_rtx(m, d, defmode, myrpt);
-       else
-               return -1;
-}
-
-/*
- * Check TX frequency before transmitting
-   rv=1 if tx frequency in ok.
-*/
-
-static char check_tx_freq(struct rpt *myrpt)
-{
-       int i,rv=0;
-       int radio_mhz, radio_decimals, ulimit_mhz, ulimit_decimals, llimit_mhz, llimit_decimals;
-       char radio_mhz_char[MAXREMSTR];
-       char radio_decimals_char[MAXREMSTR];
-       char limit_mhz_char[MAXREMSTR];
-       char limit_decimals_char[MAXREMSTR];
-       char limits[256];
-       char *limit_ranges[40];
-       struct ast_variable *limitlist;
-       
-       if(debug > 3){
-               ast_log(LOG_NOTICE, "myrpt->freq = %s\n", myrpt->freq);
-       }
-
-       /* Must have user logged in and tx_limits defined */
-
-       if(!myrpt->p.txlimitsstanzaname || !myrpt->loginuser[0] || !myrpt->loginlevel[0]){
-               if(debug > 3){
-                       ast_log(LOG_NOTICE, "No tx band table defined, or no user logged in. rv=1\n");
-               }
-               rv=1;
-               return 1; /* Assume it's ok otherwise */
-       }
-
-       /* Retrieve the band table for the loginlevel */
-       limitlist = ast_variable_browse(myrpt->cfg, myrpt->p.txlimitsstanzaname);
-
-       if(!limitlist){
-               ast_log(LOG_WARNING, "No entries in %s band table stanza. rv=0\n", myrpt->p.txlimitsstanzaname);
-               rv=0;
-               return 0;
-       }
-
-       split_freq(radio_mhz_char, radio_decimals_char, myrpt->freq);
-       radio_mhz = atoi(radio_mhz_char);
-       radio_decimals = decimals2int(radio_decimals_char);
-
-       if(debug > 3){
-               ast_log(LOG_NOTICE, "Login User = %s, login level = %s\n", myrpt->loginuser, myrpt->loginlevel);
-       }
-
-       /* Find our entry */
-
-       for(;limitlist; limitlist=limitlist->next){
-               if(!strcmp(limitlist->name, myrpt->loginlevel))
-                       break;
-       }
-
-       if(!limitlist){
-               ast_log(LOG_WARNING, "Can't find %s entry in band table stanza %s. rv=0\n", myrpt->loginlevel, myrpt->p.txlimitsstanzaname);
-               rv=0;
-           return 0;
-       }
-       
-       if(debug > 3){
-               ast_log(LOG_NOTICE, "Auth: %s = %s\n", limitlist->name, limitlist->value);
-       }
-
-       /* Parse the limits */
-
-       strncpy(limits, limitlist->value, 256);
-       limits[255] = 0;
-       finddelim(limits, limit_ranges, 40);
-       for(i = 0; i < 40 && limit_ranges[i] ; i++){
-               char range[40];
-               char *r,*s;
-               strncpy(range, limit_ranges[i], 40);
-               range[39] = 0;
-        if(debug > 3) 
-               ast_log(LOG_NOTICE, "Check %s within %s\n", myrpt->freq, range);
-       
-               r = strchr(range, '-');
-               if(!r){
-                       ast_log(LOG_WARNING, "Malformed range in %s tx band table entry. rv=0\n", limitlist->name);
-                       rv=0;
-                       break;
-               }
-               *r++ = 0;
-               s = eatwhite(range);
-               r = eatwhite(r);
-               split_freq(limit_mhz_char, limit_decimals_char, s);
-               llimit_mhz = atoi(limit_mhz_char);
-               llimit_decimals = decimals2int(limit_decimals_char);
-               split_freq(limit_mhz_char, limit_decimals_char, r);
-               ulimit_mhz = atoi(limit_mhz_char);
-               ulimit_decimals = decimals2int(limit_decimals_char);
-                       
-               if((radio_mhz >= llimit_mhz) && (radio_mhz <= ulimit_mhz)){
-                       if(radio_mhz == llimit_mhz){ /* CASE 1: TX freq is in llimit mhz portion of band */
-                               if(radio_decimals >= llimit_decimals){ /* Cannot be below llimit decimals */
-                                       if(llimit_mhz == ulimit_mhz){ /* If bandwidth < 1Mhz, check ulimit decimals */
-                                               if(radio_decimals <= ulimit_decimals){
-                                                       rv=1;
-                                                       break;
-                                               }
-                                               else{
-                                                       if(debug > 3)
-                                                               ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 1\n");
-                                                       rv=0;
-                                                       break;
-                                               }
-                                       }
-                                       else{
-                                               rv=1;
-                                               break;
-                                       }
-                               }
-                               else{ /* Is below llimit decimals */
-                                       if(debug > 3)
-                                               ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 2\n");
-                                       rv=0;
-                                       break;
-                               }
-                       }
-                       else if(radio_mhz == ulimit_mhz){ /* CASE 2: TX freq not in llimit mhz portion of band */
-                               if(radio_decimals <= ulimit_decimals){
-                                       if(debug > 3)
-                                               ast_log(LOG_NOTICE, "radio_decimals <= ulimit_decimals\n");
-                                       rv=1;
-                                       break;
-                               }
-                               else{ /* Is above ulimit decimals */
-                                       if(debug > 3)
-                                               ast_log(LOG_NOTICE, "Invalid TX frequency, debug msg 3\n");
-                                       rv=0;
-                                       break;
-                               }
-                       }
-                       else /* CASE 3: TX freq within a multi-Mhz band and ok */
-                               if(debug > 3)
-                                               ast_log(LOG_NOTICE, "Valid TX freq within a multi-Mhz band and ok.\n");
-                               rv=1;
-                               break;
-               }
-       }
-       if(debug > 3)  
-               ast_log(LOG_NOTICE, "rv=%i\n",rv);
-
-       return rv;
-}
-
-
-/*
-* Dispatch to correct frequency bumping function
-*/
-
-static int multimode_bump_freq(struct rpt *myrpt, int interval)
-{
-       if(!strcmp(myrpt->remoterig, remote_rig_ft897))
-               return multimode_bump_freq_ft897(myrpt, interval);
-       else if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-               return multimode_bump_freq_ic706(myrpt, interval);
-       else
-               return -1;
-}
-
-
-/*
-* Queue announcment that scan has been stopped 
-*/
-
-static void stop_scan(struct rpt *myrpt)
-{
-       myrpt->hfscanstop = 1;
-       rpt_telemetry(myrpt,SCAN,0);
-}
-
-/*
-* This is called periodically when in scan mode
-*/
-
-
-static int service_scan(struct rpt *myrpt)
-{
-       int res, interval;
-       char mhz[MAXREMSTR], decimals[MAXREMSTR], k10=0i, k100=0;
-
-       switch(myrpt->hfscanmode){
-
-               case HF_SCAN_DOWN_SLOW:
-                       interval = -10; /* 100Hz /sec */
-                       break;
-
-               case HF_SCAN_DOWN_QUICK:
-                       interval = -50; /* 500Hz /sec */
-                       break;
-
-               case HF_SCAN_DOWN_FAST:
-                       interval = -200; /* 2KHz /sec */
-                       break;
-
-               case HF_SCAN_UP_SLOW:
-                       interval = 10; /* 100Hz /sec */
-                       break;
-
-               case HF_SCAN_UP_QUICK:
-                       interval = 50; /* 500 Hz/sec */
-                       break;
-
-               case HF_SCAN_UP_FAST:
-                       interval = 200; /* 2KHz /sec */
-                       break;
-
-               default:
-                       myrpt->hfscanmode = 0; /* Huh? */
-                       return -1;
-       }
-
-       res = split_freq(mhz, decimals, myrpt->freq);
-               
-       if(!res){
-               k100 =decimals[0];
-               k10 = decimals[1];
-               res = multimode_bump_freq(myrpt, interval);
-       }
-
-       if(!res)
-               res = split_freq(mhz, decimals, myrpt->freq);
-
-
-       if(res){
-               myrpt->hfscanmode = 0;
-               myrpt->hfscanstatus = -2;
-               return -1;
-       }
-
-       /* Announce 10KHz boundaries */
-       if(k10 != decimals[1]){
-               int myhund = (interval < 0) ? k100 : decimals[0];
-               int myten = (interval < 0) ? k10 : decimals[1];
-               myrpt->hfscanstatus = (myten == '0') ? (myhund - '0') * 100 : (myten - '0') * 10;
-       } else myrpt->hfscanstatus = 0;
-       return res;
-
-}
-/*
-       retrieve memory setting and set radio
-*/
-static int get_mem_set(struct rpt *myrpt, char *digitbuf)
-{
-       int res=0;
-       if(debug)ast_log(LOG_NOTICE," digitbuf=%s\n", digitbuf);
-       res = retreive_memory(myrpt, digitbuf);
-       if(!res)res=setrem(myrpt);      
-       if(debug)ast_log(LOG_NOTICE," freq=%s  res=%i\n", myrpt->freq, res);
-       return res;
-}
-/*
-       steer the radio selected channel to either one programmed into the radio
-       or if the radio is VFO agile, to an rpt.conf memory location.
-*/
-static int channel_steer(struct rpt *myrpt, char *data)
-{
-       int res=0;
-
-       if(debug)ast_log(LOG_NOTICE,"remoterig=%s, data=%s\n",myrpt->remoterig,data);
-       if (!myrpt->remoterig) return(0);
-       if(data<=0)
-       {
-               res=-1;
-       }
-       else
-       {
-               myrpt->nowchan=strtod(data,NULL);
-               if(!strcmp(myrpt->remoterig, remote_rig_ppp16))
-               {
-                       char string[16];
-                       sprintf(string,"SETCHAN %d ",myrpt->nowchan);
-                       send_usb_txt(myrpt,string);     
-               }
-               else
-               {
-                       if(get_mem_set(myrpt, data))res=-1;
-               }
-       }
-       if(debug)ast_log(LOG_NOTICE,"nowchan=%i  res=%i\n",myrpt->nowchan, res);
-       return res;
-}
-/*
-*/
-static int channel_revert(struct rpt *myrpt)
-{
-       int res=0;
-       if(debug)ast_log(LOG_NOTICE,"remoterig=%s, nowchan=%02d, waschan=%02d\n",myrpt->remoterig,myrpt->nowchan,myrpt->waschan);
-       if (!myrpt->remoterig) return(0);
-       if(myrpt->nowchan!=myrpt->waschan)
-       {
-               char data[8];
-        if(debug)ast_log(LOG_NOTICE,"reverting.\n");
-               sprintf(data,"%02d",myrpt->waschan);
-               myrpt->nowchan=myrpt->waschan;
-               channel_steer(myrpt,data);
-               res=1;
-       }
-       return(res);
-}
-/*
-* Remote base function
-*/
-
-static int function_remote(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink)
-{
-       char *s,*s1,*s2;
-       int i,j,r,ht,k,l,ls2,m,d,offset,offsave, modesave, defmode=0;
-       intptr_t p;
-       char multimode = 0;
-       char oc,*cp,*cp1,*cp2;
-       char tmp[20], freq[20] = "", savestr[20] = "";
-       char mhz[MAXREMSTR], decimals[MAXREMSTR];
-
-    if(debug > 6) {
-       ast_log(LOG_NOTICE,"%s param=%s digitbuf=%s source=%i\n",myrpt->name,param,digitbuf,command_source);
-       }
-
-       if((!param) || (command_source == SOURCE_RPT) || (command_source == SOURCE_LNK))
-               return DC_ERROR;
-               
-       p = myatoi(param);
-
-       if ((p != 99) && (p != 5) && (p != 140) && myrpt->p.authlevel && 
-               (!myrpt->loginlevel[0])) return DC_ERROR;
-       multimode = multimode_capable(myrpt);
-
-       switch(p){
-
-               case 1:  /* retrieve memory */
-                       if(strlen(digitbuf) < 2) /* needs 2 digits */
-                               break;
-                       
-                       for(i = 0 ; i < 2 ; i++){
-                               if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
-                                       return DC_ERROR;
-                       }
-               r=get_mem_set(myrpt, digitbuf);
-                       if (r < 0){
-                               rpt_telemetry(myrpt,MEMNOTFOUND,NULL);
-                               return DC_COMPLETE;
-                       }
-                       else if (r > 0){
-                               return DC_ERROR;
-                       }
-                       return DC_COMPLETE;     
-                       
-               case 2:  /* set freq and offset */
-          
-                       
-                       for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for M+*K+*O or M+*H+* depending on mode */
-                               if(digitbuf[i] == '*'){
-                                       j++;
-                                       continue;
-                               }
-                               if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
-                                       goto invalid_freq;
-                               else{
-                                       if(j == 0)
-                                               l++; /* # of digits before first * */
-                                       if(j == 1)
-                                               k++; /* # of digits after first * */
-                               }
-                       }
-               
-                       i = strlen(digitbuf) - 1;
-                       if(multimode){
-                               if((j > 2) || (l > 3) || (k > 6))
-                                       goto invalid_freq; /* &^@#! */
-                       }
-                       else{
-                               if((j > 2) || (l > 4) || (k > 3))
-                                       goto invalid_freq; /* &^@#! */
-                       }
-
-                       /* Wait for M+*K+* */
-
-                       if(j < 2)
-                               break; /* Not yet */
-
-                       /* We have a frequency */
-
-                       strncpy(tmp, digitbuf ,sizeof(tmp) - 1);
-                       
-                       s = tmp;
-                       s1 = strsep(&s, "*"); /* Pick off MHz */
-                       s2 = strsep(&s,"*"); /* Pick off KHz and Hz */
-                       ls2 = strlen(s2);       
-                       
-                       switch(ls2){ /* Allow partial entry of khz and hz digits for laziness support */
-                               case 1:
-                                       ht = 0;
-                                       k = 100 * atoi(s2);
-                                       break;
-                               
-                               case 2:
-                                       ht = 0;
-                                       k = 10 * atoi(s2);
-                                       break;
-                                       
-                               case 3:
-                                       if(!multimode){
-                                               if((s2[2] != '0')&&(s2[2] != '5'))
-                                                       goto invalid_freq;
-                                       }
-                                       ht = 0;
-                                       k = atoi(s2);
-                                               break;
-                               case 4:
-                                       k = atoi(s2)/10;
-                                       ht = 10 * (atoi(s2+(ls2-1)));
-                                       break;
-
-                               case 5:
-                                       k = atoi(s2)/100;
-                                       ht = (atoi(s2+(ls2-2)));
-                                       break;
-                                       
-                               default:
-                                       goto invalid_freq;
-                       }
-
-                       /* Check frequency for validity and establish a default mode */
-                       
-                       snprintf(freq, sizeof(freq), "%s.%03d%02d",s1, k, ht);
-
-                       if(debug)
-                               ast_log(LOG_NOTICE, "New frequency: %s\n", freq);
-       
-                       split_freq(mhz, decimals, freq);
-                       m = atoi(mhz);
-                       d = atoi(decimals);
-
-                       if(check_freq(myrpt, m, d, &defmode)) /* Check to see if frequency entered is legit */
-                               goto invalid_freq;
-
-
-                       if((defmode == REM_MODE_FM) && (digitbuf[i] == '*')) /* If FM, user must enter and additional offset digit */
-                               break; /* Not yet */
-
-
-                       offset = REM_SIMPLEX; /* Assume simplex */
-
-                       if(defmode == REM_MODE_FM){
-                               oc = *s; /* Pick off offset */
-                       
-                               if (oc){
-                                       switch(oc){
-                                               case '1':
-                                                       offset = REM_MINUS;
-                                                       break;
-                                               
-                                               case '2':
-                                                       offset = REM_SIMPLEX;
-                                               break;
-                                               
-                                               case '3':
-                                                       offset = REM_PLUS;
-                                                       break;
-                                               
-                                               default:
-                                                       goto invalid_freq;
-                                       } 
-                               } 
-                       }       
-                       offsave = myrpt->offset;
-                       modesave = myrpt->remmode;
-                       strncpy(savestr, myrpt->freq, sizeof(savestr) - 1);
-                       strncpy(myrpt->freq, freq, sizeof(myrpt->freq) - 1);
-                       myrpt->offset = offset;
-                       myrpt->remmode = defmode;
-
-                       if (setrem(myrpt) == -1){
-                               myrpt->offset = offsave;
-                               myrpt->remmode = modesave;
-                               strncpy(myrpt->freq, savestr, sizeof(myrpt->freq) - 1);
-                               goto invalid_freq;
-                       }
-
-                       return DC_COMPLETE;
-
-invalid_freq:
-                       rpt_telemetry(myrpt,INVFREQ,NULL);
-                       return DC_ERROR; 
-               
-               case 3: /* set rx PL tone */
-                       for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */
-                               if(digitbuf[i] == '*'){
-                                       j++;
-                                       continue;
-                               }
-                               if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
-                                       return DC_ERROR;
-                               else{
-                                       if(j)
-                                               l++;
-                                       else
-                                               k++;
-                               }
-                       }
-                       if((j > 1) || (k > 3) || (l > 1))
-                               return DC_ERROR; /* &$@^! */
-                       i = strlen(digitbuf) - 1;
-                       if((j != 1) || (k < 2)|| (l != 1))
-                               break; /* Not yet */
-                       if(debug)
-                               printf("PL digits entered %s\n", digitbuf);
-                       
-                       strncpy(tmp, digitbuf, sizeof(tmp) - 1);
-                       /* see if we have at least 1 */
-                       s = strchr(tmp,'*');
-                       if(s)
-                               *s = '.';
-                       strncpy(savestr, myrpt->rxpl, sizeof(savestr) - 1);
-                       strncpy(myrpt->rxpl, tmp, sizeof(myrpt->rxpl) - 1);
-                       if(!strcmp(myrpt->remoterig, remote_rig_rbi))
-                       {
-                               strncpy(myrpt->txpl, tmp, sizeof(myrpt->txpl) - 1);
-                       }
-                       if (setrem(myrpt) == -1){
-                               strncpy(myrpt->rxpl, savestr, sizeof(myrpt->rxpl) - 1);
-                               return DC_ERROR;
-                       }
-                       return DC_COMPLETE;
-               
-               case 4: /* set tx PL tone */
-                       /* cant set tx tone on RBI (rx tone does both) */
-                       if(!strcmp(myrpt->remoterig, remote_rig_rbi))
-                               return DC_ERROR;
-                       /*  eventually for the ic706 instead of just throwing the exception
-                               we can check if we are in encode only mode and allow the tx
-                               ctcss code to be changed. but at least the warning message is
-                               issued for now.
-                       */
-                       if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-                       {
-                               if(debug)
-                                       ast_log(LOG_WARNING,"Setting IC706 Tx CTCSS Code Not Supported. Set Rx Code for both.\n");
-                               return DC_ERROR;
-                       }
-               for(i = 0, j = 0, k = 0, l = 0 ; digitbuf[i] ; i++){ /* look for N+*N */
-                               if(digitbuf[i] == '*'){
-                                       j++;
-                                       continue;
-                               }
-                               if((digitbuf[i] < '0') || (digitbuf[i] > '9'))
-                                       return DC_ERROR;
-                               else{
-                                       if(j)
-                                               l++;
-                                       else
-                                               k++;
-                               }
-                       }
-                       if((j > 1) || (k > 3) || (l > 1))
-                               return DC_ERROR; /* &$@^! */
-                       i = strlen(digitbuf) - 1;
-                       if((j != 1) || (k < 2)|| (l != 1))
-                               break; /* Not yet */
-                       if(debug)
-                               printf("PL digits entered %s\n", digitbuf);
-                       
-                       strncpy(tmp, digitbuf, sizeof(tmp) - 1);
-                       /* see if we have at least 1 */
-                       s = strchr(tmp,'*');
-                       if(s)
-                               *s = '.';
-                       strncpy(savestr, myrpt->txpl, sizeof(savestr) - 1);
-                       strncpy(myrpt->txpl, tmp, sizeof(myrpt->txpl) - 1);
-                       
-                       if (setrem(myrpt) == -1){
-                               strncpy(myrpt->txpl, savestr, sizeof(myrpt->txpl) - 1);
-                               return DC_ERROR;
-                       }
-                       return DC_COMPLETE;
-               
-
-               case 6: /* MODE (FM,USB,LSB,AM) */
-                       if(strlen(digitbuf) < 1)
-                               break;
-
-                       if(!multimode)
-                               return DC_ERROR; /* Multimode radios only */
-
-                       switch(*digitbuf){
-                               case '1':
-                                       split_freq(mhz, decimals, myrpt->freq); 
-                                       m=atoi(mhz);
-                                       if(m < 29) /* No FM allowed below 29MHz! */
-                                               return DC_ERROR;
-                                       myrpt->remmode = REM_MODE_FM;
-                                       
-                                       rpt_telemetry(myrpt,REMMODE,NULL);
-                                       break;
-
-                               case '2':
-                                       myrpt->remmode = REM_MODE_USB;
-                                       rpt_telemetry(myrpt,REMMODE,NULL);
-                                       break;  
-
-                               case '3':
-                                       myrpt->remmode = REM_MODE_LSB;
-                                       rpt_telemetry(myrpt,REMMODE,NULL);
-                                       break;
-                               
-                               case '4':
-                                       myrpt->remmode = REM_MODE_AM;
-                                       rpt_telemetry(myrpt,REMMODE,NULL);
-                                       break;
-               
-                               default:
-                                       return DC_ERROR;
-                       }
-
-                       if(setrem(myrpt))
-                               return DC_ERROR;
-                       return DC_COMPLETEQUIET;
-               case 99:
-                       /* cant log in when logged in */
-                       if (myrpt->loginlevel[0]) 
-                               return DC_ERROR;
-                       *myrpt->loginuser = 0;
-                       myrpt->loginlevel[0] = 0;
-                       cp = ast_strdup(param);
-                       cp1 = strchr(cp,',');
-                       ast_mutex_lock(&myrpt->lock);
-                       if (cp1) 
-                       {
-                               *cp1 = 0;
-                               cp2 = strchr(cp1 + 1,',');
-                               if (cp2) 
-                               {
-                                       *cp2 = 0;
-                                       strncpy(myrpt->loginlevel,cp2 + 1,
-                                               sizeof(myrpt->loginlevel) - 1);
-                               }
-                               strncpy(myrpt->loginuser,cp1 + 1,sizeof(myrpt->loginuser));
-                               ast_mutex_unlock(&myrpt->lock);
-                               if (myrpt->p.archivedir)
-                               {
-                                       char str[100];
-
-                                       sprintf(str,"LOGIN,%s,%s",
-                                           myrpt->loginuser,myrpt->loginlevel);
-                                       donodelog(myrpt,str);
-                               }
-                               if (debug) 
-                                       printf("loginuser %s level %s\n",myrpt->loginuser,myrpt->loginlevel);
-                               rpt_telemetry(myrpt,REMLOGIN,NULL);
-                       }
-                       ast_free(cp);
-                       return DC_COMPLETEQUIET;
-               case 100: /* RX PL Off */
-                       myrpt->rxplon = 0;
-                       setrem(myrpt);
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 101: /* RX PL On */
-                       myrpt->rxplon = 1;
-                       setrem(myrpt);
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 102: /* TX PL Off */
-                       myrpt->txplon = 0;
-                       setrem(myrpt);
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 103: /* TX PL On */
-                       myrpt->txplon = 1;
-                       setrem(myrpt);
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 104: /* Low Power */
-                       if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-                               return DC_ERROR;
-                       myrpt->powerlevel = REM_LOWPWR;
-                       setrem(myrpt);
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 105: /* Medium Power */
-                       if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-                               return DC_ERROR;
-                       if (ISRIG_RTX(myrpt->remoterig)) return DC_ERROR;
-                       myrpt->powerlevel = REM_MEDPWR;
-                       setrem(myrpt);
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 106: /* Hi Power */
-                       if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-                               return DC_ERROR;
-                       myrpt->powerlevel = REM_HIPWR;
-                       setrem(myrpt);
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 107: /* Bump down 20Hz */
-                       multimode_bump_freq(myrpt, -20);
-                       return DC_COMPLETE;
-               case 108: /* Bump down 100Hz */
-                       multimode_bump_freq(myrpt, -100);
-                       return DC_COMPLETE;
-               case 109: /* Bump down 500Hz */
-                       multimode_bump_freq(myrpt, -500);
-                       return DC_COMPLETE;
-               case 110: /* Bump up 20Hz */
-                       multimode_bump_freq(myrpt, 20);
-                       return DC_COMPLETE;
-               case 111: /* Bump up 100Hz */
-                       multimode_bump_freq(myrpt, 100);
-                       return DC_COMPLETE;
-               case 112: /* Bump up 500Hz */
-                       multimode_bump_freq(myrpt, 500);
-                       return DC_COMPLETE;
-               case 113: /* Scan down slow */
-                       myrpt->scantimer = REM_SCANTIME;
-                       myrpt->hfscanmode = HF_SCAN_DOWN_SLOW;
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 114: /* Scan down quick */
-                       myrpt->scantimer = REM_SCANTIME;
-                       myrpt->hfscanmode = HF_SCAN_DOWN_QUICK;
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 115: /* Scan down fast */
-                       myrpt->scantimer = REM_SCANTIME;
-                       myrpt->hfscanmode = HF_SCAN_DOWN_FAST;
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 116: /* Scan up slow */
-                       myrpt->scantimer = REM_SCANTIME;
-                       myrpt->hfscanmode = HF_SCAN_UP_SLOW;
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 117: /* Scan up quick */
-                       myrpt->scantimer = REM_SCANTIME;
-                       myrpt->hfscanmode = HF_SCAN_UP_QUICK;
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 118: /* Scan up fast */
-                       myrpt->scantimer = REM_SCANTIME;
-                       myrpt->hfscanmode = HF_SCAN_UP_FAST;
-                       rpt_telemetry(myrpt,REMXXX,(void *)p);
-                       return DC_COMPLETEQUIET;
-               case 119: /* Tune Request */
-                       if(debug > 3)
-                               ast_log(LOG_NOTICE,"TUNE REQUEST\n");
-                       /* if not currently going, and valid to do */
-                       if((!myrpt->tunerequest) && 
-                           ((!strcmp(myrpt->remoterig, remote_rig_ft897) || 
-                               !strcmp(myrpt->remoterig, remote_rig_ic706)) )) { 
-                               myrpt->remotetx = 0;
-                               ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
-                               myrpt->tunerequest = 1;
-                               rpt_telemetry(myrpt,TUNE,NULL);
-                               return DC_COMPLETEQUIET;
-                       }
-                       return DC_ERROR;                        
-               case 5: /* Long Status */
-                       rpt_telemetry(myrpt,REMLONGSTATUS,NULL);
-                       return DC_COMPLETEQUIET;
-               case 140: /* Short Status */
-                       rpt_telemetry(myrpt,REMSHORTSTATUS,NULL);
-                       return DC_COMPLETEQUIET;
-               case 200:
-               case 201:
-               case 202:
-               case 203:
-               case 204:
-               case 205:
-               case 206:
-               case 207:
-               case 208:
-               case 209:
-               case 210:
-               case 211:
-               case 212:
-               case 213:
-               case 214:
-               case 215:
-                       do_dtmf_local(myrpt,remdtmfstr[p - 200]);
-                       return DC_COMPLETEQUIET;
-               default:
-                       break;
-       }
-       return DC_INDETERMINATE;
-}
-
-
-static int handle_remote_dtmf_digit(struct rpt *myrpt,char c, char *keyed, int phonemode)
-{
-time_t now;
-int    ret,res = 0,src;
-
-       if(debug > 6)
-               ast_log(LOG_NOTICE,"c=%c  phonemode=%i  dtmfidx=%i\n",c,phonemode,myrpt->dtmfidx);
-
-       time(&myrpt->last_activity_time);
-       /* Stop scan mode if in scan mode */
-       if(myrpt->hfscanmode){
-               stop_scan(myrpt);
-               return 0;
-       }
-
-       time(&now);
-       /* if timed-out */
-       if ((myrpt->dtmf_time_rem + DTMF_TIMEOUT) < now)
-       {
-               myrpt->dtmfidx = -1;
-               myrpt->dtmfbuf[0] = 0;
-               myrpt->dtmf_time_rem = 0;
-       }
-       /* if decode not active */
-       if (myrpt->dtmfidx == -1)
-       {
-               /* if not lead-in digit, don't worry */
-               if (c != myrpt->p.funcchar)
-               {
-                       if (!myrpt->p.propagate_dtmf)
-                       {
-                               rpt_mutex_lock(&myrpt->lock);
-                               do_dtmf_local(myrpt,c);
-                               rpt_mutex_unlock(&myrpt->lock);
-                       }
-                       return 0;
-               }
-               myrpt->dtmfidx = 0;
-               myrpt->dtmfbuf[0] = 0;
-               myrpt->dtmf_time_rem = now;
-               return 0;
-       }
-       /* if too many in buffer, start over */
-       if (myrpt->dtmfidx >= MAXDTMF)
-       {
-               myrpt->dtmfidx = 0;
-               myrpt->dtmfbuf[0] = 0;
-               myrpt->dtmf_time_rem = now;
-       }
-       if (c == myrpt->p.funcchar)
-       {
-               /* if star at beginning, or 2 together, erase buffer */
-               if ((myrpt->dtmfidx < 1) || 
-                       (myrpt->dtmfbuf[myrpt->dtmfidx - 1] == myrpt->p.funcchar))
-               {
-                       myrpt->dtmfidx = 0;
-                       myrpt->dtmfbuf[0] = 0;
-                       myrpt->dtmf_time_rem = now;
-                       return 0;
-               }
-       }
-       myrpt->dtmfbuf[myrpt->dtmfidx++] = c;
-       myrpt->dtmfbuf[myrpt->dtmfidx] = 0;
-       myrpt->dtmf_time_rem = now;
-       
-       
-       src = SOURCE_RMT;
-       if (phonemode == 2) src = SOURCE_DPHONE;
-       else if (phonemode) src = SOURCE_PHONE;
-       else if (phonemode == 4) src = SOURCE_ALT;
-       ret = collect_function_digits(myrpt, myrpt->dtmfbuf, src, NULL);
-       
-       switch(ret){
-       
-               case DC_INDETERMINATE:
-                       res = 0;
-                       break;
-                               
-               case DC_DOKEY:
-                       if (keyed) *keyed = 1;
-                       res = 0;
-                       break;
-                               
-               case DC_REQ_FLUSH:
-                       myrpt->dtmfidx = 0;
-                       myrpt->dtmfbuf[0] = 0;
-                       res = 0;
-                       break;
-                               
-                               
-               case DC_COMPLETE:
-                       res = 1;
-               case DC_COMPLETEQUIET:
-                       myrpt->totalexecdcommands++;
-                       myrpt->dailyexecdcommands++;
-                       strncpy(myrpt->lastdtmfcommand, myrpt->dtmfbuf, MAXDTMF-1);
-                       myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
-                       myrpt->dtmfbuf[0] = 0;
-                       myrpt->dtmfidx = -1;
-                       myrpt->dtmf_time_rem = 0;
-                       break;
-                               
-               case DC_ERROR:
-               default:
-                       myrpt->dtmfbuf[0] = 0;
-                       myrpt->dtmfidx = -1;
-                       myrpt->dtmf_time_rem = 0;
-                       res = 0;
-                       break;
-       }
-
-       return res;
-}
-
-static int handle_remote_data(struct rpt *myrpt, char *str)
-{
-/* XXX ATTENTION: if you change the size of these arrays you MUST
- * change the limits in corresponding sscanf() calls below. */
-char   tmp[300],cmd[300],dest[300],src[300],c;
-int    seq,res;
-
-       /* put string in our buffer */
-       strncpy(tmp,str,sizeof(tmp) - 1);
-       if (!strcmp(tmp,discstr)) return 0;
-        if (!strcmp(tmp,newkeystr))
-        {
-               myrpt->newkey = 1;
-                return 0;
-        }
-
-#ifndef        DO_NOT_NOTIFY_MDC1200_ON_REMOTE_BASES
-       if (tmp[0] == 'I')
-       {
-               /* XXX WARNING: be very careful with the limits on the folowing
-                * sscanf() call, make sure they match the values defined above */
-               if (sscanf(tmp,"%299s %299s %30x",cmd,src,&seq) != 3)
-               {
-                       ast_log(LOG_WARNING, "Unable to parse ident string %s\n",str);
-                       return 0;
-               }
-               mdc1200_notify(myrpt,src,seq);
-               return 0;
-       }
-#endif
-       /* XXX WARNING: be very careful with the limits on the folowing
-        * sscanf() call, make sure they match the values defined above */
-       if (sscanf(tmp,"%299s %299s %299s %30d %1c",cmd,dest,src,&seq,&c) != 5)
-       {
-               ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
-               return 0;
-       }
-       if (strcmp(cmd,"D"))
-       {
-               ast_log(LOG_WARNING, "Unable to parse link string %s\n",str);
-               return 0;
-       }
-       /* if not for me, ignore */
-       if (strcmp(dest,myrpt->name)) return 0;
-       if (myrpt->p.archivedir)
-       {
-               char dtmfstr[100];
-
-               sprintf(dtmfstr,"DTMF,%c",c);
-               donodelog(myrpt,dtmfstr);
-       }
-       c = func_xlat(myrpt,c,&myrpt->p.outxlat);
-       if (!c) return(0);
-       res = handle_remote_dtmf_digit(myrpt,c, NULL, 0);
-       if (res != 1)
-               return res;
-       rpt_telemetry(myrpt,COMPLETE,NULL);
-       return 0;
-}
-
-static int handle_remote_phone_dtmf(struct rpt *myrpt, char c, char *keyed, int phonemode)
-{
-int    res;
-
-
-       if(phonemode == 3) /* simplex phonemode, funcchar key/unkey toggle */
-       {
-               if (keyed && *keyed && ((c == myrpt->p.funcchar) || (c == myrpt->p.endchar)))
-               {
-                       *keyed = 0; /* UNKEY */
-                       return 0;
-               }
-               else if (keyed && !*keyed && (c = myrpt->p.funcchar))
-               {
-                       *keyed = 1; /* KEY */
-                       return 0;
-               }
-       }
-       else /* endchar unkey */
-       {
-
-               if (keyed && *keyed && (c == myrpt->p.endchar))
-               {
-                       *keyed = 0;
-                       return DC_INDETERMINATE;
-               }
-       }
-       if (myrpt->p.archivedir)
-       {
-               char str[100];
-
-               sprintf(str,"DTMF(P),%c",c);
-               donodelog(myrpt,str);
-       }
-       res = handle_remote_dtmf_digit(myrpt,c,keyed, phonemode);
-       if (res != 1)
-               return res;
-       rpt_telemetry(myrpt,COMPLETE,NULL);
-       return 0;
-}
-
-static int attempt_reconnect(struct rpt *myrpt, struct rpt_link *l)
-{
-       char *val, *s, *s1, *tele;
-       char tmp[300], deststr[300] = "";
-       char sx[320],*sy;
-       struct ast_format_cap *cap = NULL;
-
-
-       val = node_lookup(myrpt,l->name);
-       if (!val)
-       {
-               fprintf(stderr,"attempt_reconnect: cannot find node %s\n",l->name);
-               return -1;
-       }
-
-       rpt_mutex_lock(&myrpt->lock);
-       /* remove from queue */
-       remque((struct qelem *) l);
-       rpt_mutex_unlock(&myrpt->lock);
-       strncpy(tmp,val,sizeof(tmp) - 1);
-       s = tmp;
-       s1 = strsep(&s,",");
-       if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
-       {
-               sy = strchr(s1,'/');            
-               *sy = 0;
-               sprintf(sx,"%s:4569/%s",s1,sy + 1);
-               s1 = sx;
-       }
-       strsep(&s,",");
-       snprintf(deststr, sizeof(deststr), "IAX2/%s", s1);
-       tele = strchr(deststr, '/');
-       if (!tele) {
-               fprintf(stderr,"attempt_reconnect:Dial number (%s) must be in format tech/number\n",deststr);
-               return -1;
-       }
-       *tele++ = 0;
-       l->elaptime = 0;
-       l->connecttime = 0;
-       l->thisconnected = 0;
-       l->newkey = 0;
-       l->chan = ast_request(deststr, get_slin_cap(cap), NULL, tele, NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (l->chan){
-               ast_set_read_format_by_id(l->chan, AST_FORMAT_SLINEAR);
-               ast_set_write_format_by_id(l->chan, AST_FORMAT_SLINEAR);
-#ifndef        NEW_ASTERISK
-               l->chan->whentohangup = 0;
-#endif
-               l->chan->appl = "Apprpt";
-               l->chan->data = "(Remote Rx)";
-               if (option_verbose > 2)
-                       ast_verbose(VERBOSE_PREFIX_3 "rpt (attempt_reconnect) initiating call to %s/%s on %s\n",
-                               deststr, tele, l->chan->name);
-               l->chan->caller.id.number.valid = 1;
-               ast_free(l->chan->caller.id.number.str);
-               l->chan->caller.id.number.str = ast_strdup(myrpt->name);
-                ast_call(l->chan,tele,999); 
-
-       }
-       else 
-       {
-               if (option_verbose > 2)
-                       ast_verbose(VERBOSE_PREFIX_3 "Unable to place call to %s/%s on %s\n",
-                               deststr,tele,l->chan->name);
-               return -1;
-       }
-       rpt_mutex_lock(&myrpt->lock);
-       /* put back in queue */
-       insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
-       rpt_mutex_unlock(&myrpt->lock);
-       ast_log(LOG_WARNING,"Reconnect Attempt to %s in process\n",l->name);
-       if (!l->phonemode) send_newkey(l->chan);
-       return 0;
-}
-
-/* 0 return=continue, 1 return = break, -1 return = error */
-static void local_dtmf_helper(struct rpt *myrpt,char c_in)
-{
-int    res;
-pthread_attr_t attr;
-char   cmd[MAXDTMF+1] = "",c;
-
-
-       c = c_in & 0x7f;
-       if (myrpt->p.archivedir)
-       {
-               char str[100];
-
-               sprintf(str,"DTMF,MAIN,%c",c);
-               donodelog(myrpt,str);
-       }
-       if (c == myrpt->p.endchar)
-       {
-       /* if in simple mode, kill autopatch */
-               if (myrpt->p.simple && myrpt->callmode)
-               {   
-                       if(debug)
-                               ast_log(LOG_WARNING, "simple mode autopatch kill\n");
-                       rpt_mutex_lock(&myrpt->lock);
-                       myrpt->callmode = 0;
-                       myrpt->macropatch=0;
-                       channel_revert(myrpt);
-                       rpt_mutex_unlock(&myrpt->lock);
-                       rpt_telemetry(myrpt,TERM,NULL);
-                       return;
-               }
-               rpt_mutex_lock(&myrpt->lock);
-               myrpt->stopgen = 1;
-               if (myrpt->cmdnode[0])
-               {
-                       myrpt->cmdnode[0] = 0;
-                       myrpt->dtmfidx = -1;
-                       myrpt->dtmfbuf[0] = 0;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       rpt_telemetry(myrpt,COMPLETE,NULL);
-                       return;
-               } 
-               else if(!myrpt->inpadtest)
-                {
-                        rpt_mutex_unlock(&myrpt->lock);
-                        if (myrpt->p.propagate_phonedtmf)
-                               do_dtmf_phone(myrpt,NULL,c);
-                       return;
-                }
-               else
-                       rpt_mutex_unlock(&myrpt->lock);
-       }
-       rpt_mutex_lock(&myrpt->lock);
-       if (myrpt->cmdnode[0])
-       {
-               rpt_mutex_unlock(&myrpt->lock);
-               send_link_dtmf(myrpt,c);
-               return;
-       }
-       if (!myrpt->p.simple)
-       {
-               if ((!myrpt->inpadtest)&&(c == myrpt->p.funcchar))
-               {
-                       myrpt->dtmfidx = 0;
-                       myrpt->dtmfbuf[myrpt->dtmfidx] = 0;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       time(&myrpt->dtmf_time);
-                       return;
-               } 
-               else if (((myrpt->inpadtest)||(c != myrpt->p.endchar)) && (myrpt->dtmfidx >= 0))
-               {
-                       time(&myrpt->dtmf_time);
-                       
-                       if (myrpt->dtmfidx < MAXDTMF)
-                       {
-                               int src;
-
-                               myrpt->dtmfbuf[myrpt->dtmfidx++] = c;
-                               myrpt->dtmfbuf[myrpt->dtmfidx] = 0;
-                               
-                               strncpy(cmd, myrpt->dtmfbuf, sizeof(cmd) - 1);
-                               
-                               rpt_mutex_unlock(&myrpt->lock);
-                               src = SOURCE_RPT;
-                               if (c_in & 0x80) src = SOURCE_ALT;
-                               res = collect_function_digits(myrpt, cmd, src, NULL);
-                               rpt_mutex_lock(&myrpt->lock);
-                               switch(res){
-                                   case DC_INDETERMINATE:
-                                       break;
-                                   case DC_REQ_FLUSH:
-                                       myrpt->dtmfidx = 0;
-                                       myrpt->dtmfbuf[0] = 0;
-                                       break;
-                                   case DC_COMPLETE:
-                                   case DC_COMPLETEQUIET:
-                                       myrpt->totalexecdcommands++;
-                                       myrpt->dailyexecdcommands++;
-                                       strncpy(myrpt->lastdtmfcommand, cmd, MAXDTMF-1);
-                                       myrpt->lastdtmfcommand[MAXDTMF-1] = '\0';
-                                       myrpt->dtmfbuf[0] = 0;
-                                       myrpt->dtmfidx = -1;
-                                       myrpt->dtmf_time = 0;
-                                       break;
-
-                                   case DC_ERROR:
-                                   default:
-                                       myrpt->dtmfbuf[0] = 0;
-                                       myrpt->dtmfidx = -1;
-                                       myrpt->dtmf_time = 0;
-                                       break;
-                               }
-                               if(res != DC_INDETERMINATE) {
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       return;
-                               }
-                       } 
-               }
-       }
-       else /* if simple */
-       {
-               if ((!myrpt->callmode) && (c == myrpt->p.funcchar))
-               {
-                       myrpt->callmode = 1;
-                       myrpt->patchnoct = 0;
-                       myrpt->patchquiet = 0;
-                       myrpt->patchfarenddisconnect = 0;
-                       myrpt->patchdialtime = 0;
-                       strncpy(myrpt->patchcontext, myrpt->p.ourcontext, MAXPATCHCONTEXT);
-                       myrpt->cidx = 0;
-                       myrpt->exten[myrpt->cidx] = 0;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       pthread_attr_init(&attr);
-                       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-                       ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *)myrpt);
-                       return;
-               }
-       }
-       if (myrpt->callmode == 1)
-       {
-               myrpt->exten[myrpt->cidx++] = c;
-               myrpt->exten[myrpt->cidx] = 0;
-               /* if this exists */
-               if (ast_exists_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
-               {
-                       /* if this really it, end now */
-                       if (!ast_matchmore_extension(myrpt->pchannel,myrpt->patchcontext,
-                               myrpt->exten,1,NULL)) 
-                       {
-                               myrpt->callmode = 2;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               if(!myrpt->patchquiet)
-                                       rpt_telemetry(myrpt,PROC,NULL); 
-                               return;
-                       }
-                       else /* othewise, reset timer */
-                       {
-                               myrpt->calldigittimer = 1;
-                       }
-               }
-               /* if can continue, do so */
-               if (!ast_canmatch_extension(myrpt->pchannel,myrpt->patchcontext,myrpt->exten,1,NULL))
-               {
-                       /* call has failed, inform user */
-                       myrpt->callmode = 4;
-               }
-               rpt_mutex_unlock(&myrpt->lock);
-               return;
-       }
-       if ((myrpt->callmode == 2) || (myrpt->callmode == 3))
-       {
-               myrpt->mydtmf = c;
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-       if ((myrpt->dtmfidx < 0) && myrpt->p.propagate_phonedtmf)
-               do_dtmf_phone(myrpt,NULL,c);
-       return;
-}
-
-
-/* place an ID event in the telemetry queue */
-
-static void queue_id(struct rpt *myrpt)
-{
-       if(myrpt->p.idtime){ /* ID time must be non-zero */
-               myrpt->mustid = myrpt->tailid = 0;
-               myrpt->idtimer = myrpt->p.idtime; /* Reset our ID timer */
-               rpt_mutex_unlock(&myrpt->lock);
-               rpt_telemetry(myrpt,ID,NULL);
-               rpt_mutex_lock(&myrpt->lock);
-       }
-}
-
-/* Scheduler */
-/* must be called locked */
-
-static void do_scheduler(struct rpt *myrpt)
-{
-       int i,res;
-
-#ifdef NEW_ASTERISK
-       struct ast_tm tmnow;
-#else
-       struct tm tmnow;
-#endif
-       struct ast_variable *skedlist;
-       char *strs[5],*vp,*val,value[100];
-
-       memcpy(&myrpt->lasttv, &myrpt->curtv, sizeof(struct timeval));
-       
-       if( (res = gettimeofday(&myrpt->curtv, NULL)) < 0)
-               ast_log(LOG_NOTICE, "Scheduler gettime of day returned: %s\n", strerror(res));
-
-       /* Try to get close to a 1 second resolution */
-       
-       if(myrpt->lasttv.tv_sec == myrpt->curtv.tv_sec)
-               return;
-
-       rpt_localtime(&myrpt->curtv.tv_sec, &tmnow);
-
-       /* If midnight, then reset all daily statistics */
-       
-       if((tmnow.tm_hour == 0)&&(tmnow.tm_min == 0)&&(tmnow.tm_sec == 0)){
-               myrpt->dailykeyups = 0;
-               myrpt->dailytxtime = 0;
-               myrpt->dailykerchunks = 0;
-               myrpt->dailyexecdcommands = 0;
-       }
-
-       if(tmnow.tm_sec != 0)
-               return;
-
-       /* Code below only executes once per minute */
-
-
-       /* Don't schedule if remote */
-
-        if (myrpt->remote)
-                return;
-
-       /* Don't schedule if disabled */
-
-        if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable){
-               if(debug > 6)
-                       ast_log(LOG_NOTICE, "Scheduler disabled\n");
-               return;
-       }
-
-       if(!myrpt->p.skedstanzaname){ /* No stanza means we do nothing */
-               if(debug > 6)
-                       ast_log(LOG_NOTICE,"No stanza for scheduler in rpt.conf\n");
-               return;
-       }
-
-    /* get pointer to linked list of scheduler entries */
-    skedlist = ast_variable_browse(myrpt->cfg, myrpt->p.skedstanzaname);
-
-       if(debug > 6){
-               ast_log(LOG_NOTICE, "Time now: %02d:%02d %02d %02d %02d\n",
-                       tmnow.tm_hour,tmnow.tm_min,tmnow.tm_mday,tmnow.tm_mon + 1, tmnow.tm_wday); 
-       }
-       /* walk the list */
-       for(; skedlist; skedlist = skedlist->next){
-               if(debug > 6)
-                       ast_log(LOG_NOTICE, "Scheduler entry %s = %s being considered\n",skedlist->name, skedlist->value);
-               strncpy(value,skedlist->value,99);
-               value[99] = 0;
-               /* point to the substrings for minute, hour, dom, month, and dow */
-               for( i = 0, vp = value ; i < 5; i++){
-                       if(!*vp)
-                               break;
-                       while((*vp == ' ') || (*vp == 0x09)) /* get rid of any leading white space */
-                               vp++;
-                       strs[i] = vp; /* save pointer to beginning of substring */
-                       while((*vp != ' ') && (*vp != 0x09) && (*vp != 0)) /* skip over substring */
-                               vp++;
-                       if(*vp)
-                               *vp++ = 0; /* mark end of substring */
-               }
-               if(debug > 6)
-                       ast_log(LOG_NOTICE, "i = %d, min = %s, hour = %s, mday=%s, mon=%s, wday=%s\n",i,
-                               strs[0], strs[1], strs[2], strs[3], strs[4]); 
-               if(i == 5){
-                       if((*strs[0] != '*')&&(atoi(strs[0]) != tmnow.tm_min))
-                               continue;
-                       if((*strs[1] != '*')&&(atoi(strs[1]) != tmnow.tm_hour))
-                               continue;
-                       if((*strs[2] != '*')&&(atoi(strs[2]) != tmnow.tm_mday))
-                               continue;
-                       if((*strs[3] != '*')&&(atoi(strs[3]) != tmnow.tm_mon + 1))
-                               continue;
-                       if(atoi(strs[4]) == 7)
-                               strs[4] = "0";
-                       if((*strs[4] != '*')&&(atoi(strs[4]) != tmnow.tm_wday))
-                               continue;
-                       if(debug)
-                               ast_log(LOG_NOTICE, "Executing scheduler entry %s = %s\n", skedlist->name, skedlist->value);
-                       if(atoi(skedlist->name) == 0)
-                               return; /* Zero is reserved for the startup macro */
-                       val = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.macro, skedlist->name);
-                       if (!val){
-                               ast_log(LOG_WARNING,"Scheduler could not find macro %s\n",skedlist->name);
-                               return; /* Macro not found */
-                       }
-                       if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(val)){
-                               ast_log(LOG_WARNING, "Scheduler could not execute macro %s: Macro buffer full\n",
-                                       skedlist->name);
-                               return; /* Macro buffer full */
-                       }
-                       myrpt->macrotimer = MACROTIME;
-                       strncat(myrpt->macrobuf,val,MAXMACRO - 1);
-               }
-               else{
-                       ast_log(LOG_WARNING,"Malformed scheduler entry in rpt.conf: %s = %s\n",
-                               skedlist->name, skedlist->value);
-               }
-       }
-
-}
-
-/* single thread with one file (request) to dial */
-static void *rpt(void *this)
-{
-struct rpt *myrpt = (struct rpt *)this;
-char *tele,*idtalkover,c,myfirst,*p;
-int ms = MSWAIT,i,lasttx=0,val,remrx=0,identqueued,othertelemqueued;
-int tailmessagequeued,ctqueued,dtmfed,lastmyrx,localmsgqueued;
-struct ast_channel *who;
-struct dahdi_confinfo ci;  /* conference info */
-time_t t;
-struct rpt_link *l,*m;
-struct rpt_tele *telem;
-char tmpstr[300],lstr[MAXLINKLIST];
-struct ast_format_cap *cap = NULL;
-
-
-       if (myrpt->p.archivedir) mkdir(myrpt->p.archivedir,0600);
-       sprintf(tmpstr,"%s/%s",myrpt->p.archivedir,myrpt->name);
-       mkdir(tmpstr,0600);
-       rpt_mutex_lock(&myrpt->lock);
-
-       telem = myrpt->tele.next;
-       while(telem != &myrpt->tele)
-       {
-               ast_softhangup(telem->chan,AST_SOFTHANGUP_DEV);
-               telem = telem->next;
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-       /* find our index, and load the vars initially */
-       for(i = 0; i < nrpts; i++)
-       {
-               if (&rpt_vars[i] == myrpt)
-               {
-                       load_rpt_vars(i,0);
-                       break;
-               }
-       }
-
-       rpt_mutex_lock(&myrpt->lock);
-       while(myrpt->xlink)
-       {
-               myrpt->xlink = 3;
-               rpt_mutex_unlock(&myrpt->lock);
-               usleep(100000);
-               rpt_mutex_lock(&myrpt->lock);
-       }
-#ifdef HAVE_IOPERM
-       if ((!strcmp(myrpt->remoterig, remote_rig_rbi)) &&
-         (ioperm(myrpt->p.iobase,1,1) == -1))
-       {
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_log(LOG_WARNING, "Cant get io permission on IO port %x hex\n",myrpt->p.iobase);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-#endif
-       strncpy(tmpstr,myrpt->rxchanname,sizeof(tmpstr) - 1);
-       tele = strchr(tmpstr,'/');
-       if (!tele)
-       {
-               fprintf(stderr,"rpt:Rxchannel Dial number (%s) must be in format tech/number\n",myrpt->rxchanname);
-               rpt_mutex_unlock(&myrpt->lock);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       *tele++ = 0;
-       myrpt->rxchannel = ast_request(tmpstr, get_slin_cap(cap), NULL, tele, NULL);
-       cap = ast_format_cap_destroy(cap);
-       myrpt->dahdirxchannel = NULL;
-       if (!strcasecmp(tmpstr,"DAHDI"))
-               myrpt->dahdirxchannel = myrpt->rxchannel;
-       if (myrpt->rxchannel)
-       {
-               if (myrpt->rxchannel->_state == AST_STATE_BUSY)
-               {
-                       fprintf(stderr,"rpt:Sorry unable to obtain Rx channel\n");
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_hangup(myrpt->rxchannel);
-                       myrpt->rpt_thread = AST_PTHREADT_STOP;
-                       pthread_exit(NULL);
-               }
-               ast_set_read_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
-               ast_set_write_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-               if (myrpt->rxchannel->cdr)
-                       ast_set_flag(myrpt->rxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef        NEW_ASTERISK
-               myrpt->rxchannel->whentohangup = 0;
-#endif
-               myrpt->rxchannel->appl = "Apprpt";
-               myrpt->rxchannel->data = "(Repeater Rx)";
-               if (option_verbose > 2)
-                       ast_verbose(VERBOSE_PREFIX_3 "rpt (Rx) initiating call to %s/%s on %s\n",
-                               tmpstr,tele,myrpt->rxchannel->name);
-               ast_call(myrpt->rxchannel,tele,999);
-               if (myrpt->rxchannel->_state != AST_STATE_UP)
-               {
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_hangup(myrpt->rxchannel);
-                       myrpt->rpt_thread = AST_PTHREADT_STOP;
-                       pthread_exit(NULL);
-               }
-       }
-       else
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain Rx channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       myrpt->dahditxchannel = NULL;
-       if (myrpt->txchanname)
-       {
-               strncpy(tmpstr,myrpt->txchanname,sizeof(tmpstr) - 1);
-               tele = strchr(tmpstr,'/');
-               if (!tele)
-               {
-                       fprintf(stderr,"rpt:Txchannel Dial number (%s) must be in format tech/number\n",myrpt->txchanname);
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_hangup(myrpt->rxchannel);
-                       myrpt->rpt_thread = AST_PTHREADT_STOP;
-                       pthread_exit(NULL);
-               }
-               *tele++ = 0;
-               myrpt->txchannel = ast_request(tmpstr, get_slin_cap(cap), NULL, tele, NULL);
-               cap = ast_format_cap_destroy(cap);
-               if (!strcasecmp(tmpstr,"DAHDI"))
-                       myrpt->dahditxchannel = myrpt->txchannel;
-               if (myrpt->txchannel)
-               {
-                       if (myrpt->txchannel->_state == AST_STATE_BUSY)
-                       {
-                               fprintf(stderr,"rpt:Sorry unable to obtain Tx channel\n");
-                               rpt_mutex_unlock(&myrpt->lock);
-                               ast_hangup(myrpt->txchannel);
-                               ast_hangup(myrpt->rxchannel);
-                               myrpt->rpt_thread = AST_PTHREADT_STOP;
-                               pthread_exit(NULL);
-                       }                       
-                       ast_set_read_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
-                       ast_set_write_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-                       if (myrpt->txchannel->cdr)
-                               ast_set_flag(myrpt->txchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef        NEW_ASTERISK
-                       myrpt->txchannel->whentohangup = 0;
-#endif
-                       myrpt->txchannel->appl = "Apprpt";
-                       myrpt->txchannel->data = "(Repeater Tx)";
-                       if (option_verbose > 2)
-                               ast_verbose(VERBOSE_PREFIX_3 "rpt (Tx) initiating call to %s/%s on %s\n",
-                                       tmpstr,tele,myrpt->txchannel->name);
-                       ast_call(myrpt->txchannel,tele,999);
-                       if (myrpt->rxchannel->_state != AST_STATE_UP)
-                       {
-                               rpt_mutex_unlock(&myrpt->lock);
-                               ast_hangup(myrpt->rxchannel);
-                               ast_hangup(myrpt->txchannel);
-                               myrpt->rpt_thread = AST_PTHREADT_STOP;
-                               pthread_exit(NULL);
-                       }
-               }
-               else
-               {
-                       fprintf(stderr,"rpt:Sorry unable to obtain Tx channel\n");
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_hangup(myrpt->rxchannel);
-                       myrpt->rpt_thread = AST_PTHREADT_STOP;
-                       pthread_exit(NULL);
-               }
-       }
-       else
-       {
-               myrpt->txchannel = myrpt->rxchannel;
-               if (!strncasecmp(myrpt->rxchanname,"DAHDI",3))
-                       myrpt->dahditxchannel = myrpt->txchannel;
-       }
-       ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_KEY);
-       ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
-       /* allocate a pseudo-channel thru asterisk */
-       myrpt->pchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!myrpt->pchannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (myrpt->pchannel->cdr)
-               ast_set_flag(myrpt->pchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       if (!myrpt->dahdirxchannel) myrpt->dahdirxchannel = myrpt->pchannel;
-       if (!myrpt->dahditxchannel)
-       {
-               /* allocate a pseudo-channel thru asterisk */
-               myrpt->dahditxchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-               cap = ast_format_cap_destroy(cap);
-               if (!myrpt->dahditxchannel)
-               {
-                       fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-                       rpt_mutex_unlock(&myrpt->lock);
-                       if (myrpt->txchannel != myrpt->rxchannel) 
-                               ast_hangup(myrpt->txchannel);
-                       ast_hangup(myrpt->rxchannel);
-                       myrpt->rpt_thread = AST_PTHREADT_STOP;
-                       pthread_exit(NULL);
-               }
-               ast_set_read_format_by_id(myrpt->dahditxchannel,AST_FORMAT_SLINEAR);
-               ast_set_write_format_by_id(myrpt->dahditxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-               if (myrpt->dahditxchannel->cdr)
-                       ast_set_flag(myrpt->dahditxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       }
-       /* allocate a pseudo-channel thru asterisk */
-       myrpt->monchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!myrpt->monchannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       ast_set_read_format_by_id(myrpt->monchannel,AST_FORMAT_SLINEAR);
-       ast_set_write_format_by_id(myrpt->monchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (myrpt->monchannel->cdr)
-               ast_set_flag(myrpt->monchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       /* make a conference for the tx */
-       ci.chan = 0;
-       ci.confno = -1; /* make a new conf */
-       ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER;
-       /* first put the channel on the conference in proper mode */
-       if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->pchannel);
-               ast_hangup(myrpt->monchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       /* save tx conference number */
-       myrpt->txconf = ci.confno;
-       /* make a conference for the pseudo */
-       ci.chan = 0;
-       ci.confno = -1; /* make a new conf */
-       ci.confmode = ((myrpt->p.duplex == 2) || (myrpt->p.duplex == 4)) ? DAHDI_CONF_CONFANNMON :
-               (DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER);
-       /* first put the channel on the conference in announce mode */
-       if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->pchannel);
-               ast_hangup(myrpt->monchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       /* save pseudo channel conference number */
-       myrpt->conf = ci.confno;
-       /* make a conference for the pseudo */
-       ci.chan = 0;
-       if ((strstr(myrpt->txchannel->name,"pseudo") == NULL) &&
-               (myrpt->dahditxchannel == myrpt->txchannel))
-       {
-               /* get tx channel's port number */
-               if (ioctl(myrpt->txchannel->fds[0],DAHDI_CHANNO,&ci.confno) == -1)
-               {
-                       ast_log(LOG_WARNING, "Unable to set tx channel's chan number\n");
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_hangup(myrpt->pchannel);
-                       ast_hangup(myrpt->monchannel);
-                       if (myrpt->txchannel != myrpt->rxchannel) 
-                               ast_hangup(myrpt->txchannel);
-                       ast_hangup(myrpt->rxchannel);
-                       myrpt->rpt_thread = AST_PTHREADT_STOP;
-                       pthread_exit(NULL);
-               }
-               ci.confmode = DAHDI_CONF_MONITORTX;
-       }
-       else
-       {
-               ci.confno = myrpt->txconf;
-               ci.confmode = DAHDI_CONF_CONFANNMON;
-       }
-       /* first put the channel on the conference in announce mode */
-       if (ioctl(myrpt->monchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode for monitor\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->pchannel);
-               ast_hangup(myrpt->monchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       /* allocate a pseudo-channel thru asterisk */
-       myrpt->parrotchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!myrpt->parrotchannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       ast_set_read_format_by_id(myrpt->parrotchannel,AST_FORMAT_SLINEAR);
-       ast_set_write_format_by_id(myrpt->parrotchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (myrpt->parrotchannel->cdr)
-               ast_set_flag(myrpt->parrotchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       /* allocate a pseudo-channel thru asterisk */
-       myrpt->voxchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!myrpt->voxchannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       ast_set_read_format_by_id(myrpt->voxchannel,AST_FORMAT_SLINEAR);
-       ast_set_write_format_by_id(myrpt->voxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (myrpt->voxchannel->cdr)
-               ast_set_flag(myrpt->voxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       /* allocate a pseudo-channel thru asterisk */
-       myrpt->txpchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!myrpt->txpchannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->pchannel);
-               ast_hangup(myrpt->monchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (myrpt->txpchannel->cdr)
-               ast_set_flag(myrpt->txpchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       /* make a conference for the tx */
-       ci.chan = 0;
-       ci.confno = myrpt->txconf;
-       ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER ;
-       /* first put the channel on the conference in proper mode */
-       if (ioctl(myrpt->txpchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->txpchannel);
-               ast_hangup(myrpt->monchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               myrpt->rpt_thread = AST_PTHREADT_STOP;
-               pthread_exit(NULL);
-       }
-       /* if serial io port, open it */
-       myrpt->iofd = -1;
-       if (myrpt->p.ioport && ((myrpt->iofd = openserial(myrpt,myrpt->p.ioport)) == -1))
-       {
-               ast_log(LOG_ERROR, "Unable to open %s\n",myrpt->p.ioport);
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->pchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               pthread_exit(NULL);
-       }
-       /* Now, the idea here is to copy from the physical rx channel buffer
-          into the pseudo tx buffer, and from the pseudo rx buffer into the 
-          tx channel buffer */
-       myrpt->links.next = &myrpt->links;
-       myrpt->links.prev = &myrpt->links;
-       myrpt->tailtimer = 0;
-       myrpt->totimer = 0;
-       myrpt->tmsgtimer = myrpt->p.tailmessagetime;
-       myrpt->idtimer = myrpt->p.politeid;
-       myrpt->mustid = myrpt->tailid = 0;
-       myrpt->callmode = 0;
-       myrpt->tounkeyed = 0;
-       myrpt->tonotify = 0;
-       myrpt->retxtimer = 0;
-       myrpt->rerxtimer = 0;
-       myrpt->skedtimer = 0;
-       myrpt->tailevent = 0;
-       lasttx = 0;
-       myrpt->keyed = 0;
-       myrpt->txkeyed = 0;
-       time(&myrpt->lastkeyedtime);
-       myrpt->lastkeyedtime -= RPT_LOCKOUT_SECS;
-       time(&myrpt->lasttxkeyedtime);
-       myrpt->lasttxkeyedtime -= RPT_LOCKOUT_SECS;
-       idtalkover = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->name, "idtalkover");
-       myrpt->dtmfidx = -1;
-       myrpt->dtmfbuf[0] = 0;
-       myrpt->rem_dtmfidx = -1;
-       myrpt->rem_dtmfbuf[0] = 0;
-       myrpt->dtmf_time = 0;
-       myrpt->rem_dtmf_time = 0;
-       myrpt->inpadtest = 0;
-       myrpt->disgorgetime = 0;
-       myrpt->lastnodewhichkeyedusup[0] = '\0';
-       myrpt->dailytxtime = 0;
-       myrpt->totaltxtime = 0;
-       myrpt->dailykeyups = 0;
-       myrpt->totalkeyups = 0;
-       myrpt->dailykerchunks = 0;
-       myrpt->totalkerchunks = 0;
-       myrpt->dailyexecdcommands = 0;
-       myrpt->totalexecdcommands = 0;
-       myrpt->timeouts = 0;
-       myrpt->exten[0] = '\0';
-       myrpt->lastdtmfcommand[0] = '\0';
-       voxinit_rpt(myrpt,1);
-       myrpt->wasvox = 0;
-       if (myrpt->p.startupmacro)
-       {
-               snprintf(myrpt->macrobuf,MAXMACRO - 1,"PPPP%s",myrpt->p.startupmacro);
-       }
-       rpt_mutex_unlock(&myrpt->lock);
-       val = 1;
-       ast_channel_setoption(myrpt->rxchannel,AST_OPTION_RELAXDTMF,&val,sizeof(char),0);
-       val = 1;
-       ast_channel_setoption(myrpt->rxchannel,AST_OPTION_TONE_VERIFY,&val,sizeof(char),0);
-       if (myrpt->p.archivedir) donodelog(myrpt,"STARTUP");
-       dtmfed = 0;
-       if (myrpt->remoterig && !ISRIG_RTX(myrpt->remoterig)) setrem(myrpt);
-       lastmyrx = 0;
-       myfirst = 0;
-       while (ms >= 0)
-       {
-               struct ast_frame *f,*f1,*f2;
-               struct ast_channel *cs[300],*cs1[300];
-               int totx=0,elap=0,n,x,toexit=0;
-
-               /* DEBUG Dump */
-               if((myrpt->disgorgetime) && (time(NULL) >= myrpt->disgorgetime)){
-                       struct rpt_link *dl;
-                       struct rpt_tele *dt;
-
-                       myrpt->disgorgetime = 0;
-                       ast_log(LOG_NOTICE,"********** Variable Dump Start (app_rpt) **********\n");
-                       ast_log(LOG_NOTICE,"totx = %d\n",totx);
-                       ast_log(LOG_NOTICE,"remrx = %d\n",remrx);
-                       ast_log(LOG_NOTICE,"lasttx = %d\n",lasttx);
-                       ast_log(LOG_NOTICE,"elap = %d\n",elap);
-                       ast_log(LOG_NOTICE,"toexit = %d\n",toexit);
-
-                       ast_log(LOG_NOTICE,"myrpt->keyed = %d\n",myrpt->keyed);
-                       ast_log(LOG_NOTICE,"myrpt->localtx = %d\n",myrpt->localtx);
-                       ast_log(LOG_NOTICE,"myrpt->callmode = %d\n",myrpt->callmode);
-                       ast_log(LOG_NOTICE,"myrpt->mustid = %d\n",myrpt->mustid);
-                       ast_log(LOG_NOTICE,"myrpt->tounkeyed = %d\n",myrpt->tounkeyed);
-                       ast_log(LOG_NOTICE,"myrpt->tonotify = %d\n",myrpt->tonotify);
-                       ast_log(LOG_NOTICE,"myrpt->retxtimer = %ld\n",myrpt->retxtimer);
-                       ast_log(LOG_NOTICE,"myrpt->totimer = %d\n",myrpt->totimer);
-                       ast_log(LOG_NOTICE,"myrpt->tailtimer = %d\n",myrpt->tailtimer);
-                       ast_log(LOG_NOTICE,"myrpt->tailevent = %d\n",myrpt->tailevent);
-
-                       dl = myrpt->links.next;
-                       while(dl != &myrpt->links){
-                               ast_log(LOG_NOTICE,"*** Link Name: %s ***\n",dl->name);
-                               ast_log(LOG_NOTICE,"        link->lasttx %d\n",dl->lasttx);
-                               ast_log(LOG_NOTICE,"        link->lastrx %d\n",dl->lastrx);
-                               ast_log(LOG_NOTICE,"        link->connected %d\n",dl->connected);
-                               ast_log(LOG_NOTICE,"        link->hasconnected %d\n",dl->hasconnected);
-                               ast_log(LOG_NOTICE,"        link->outbound %d\n",dl->outbound);
-                               ast_log(LOG_NOTICE,"        link->disced %d\n",dl->disced);
-                               ast_log(LOG_NOTICE,"        link->killme %d\n",dl->killme);
-                               ast_log(LOG_NOTICE,"        link->disctime %ld\n",dl->disctime);
-                               ast_log(LOG_NOTICE,"        link->retrytimer %ld\n",dl->retrytimer);
-                               ast_log(LOG_NOTICE,"        link->retries = %d\n",dl->retries);
-                               ast_log(LOG_NOTICE,"        link->reconnects = %d\n",dl->reconnects);
-                               ast_log(LOG_NOTICE,"        link->newkey = %d\n",dl->newkey);
-                               dl = dl->next;
-                       }
-                                                                                                                               
-                       dt = myrpt->tele.next;
-                       if(dt != &myrpt->tele)
-                               ast_log(LOG_NOTICE,"*** Telemetry Queue ***\n");
-                       while(dt != &myrpt->tele){
-                               ast_log(LOG_NOTICE,"        Telemetry mode: %d\n",dt->mode);
-                               dt = dt->next;
-                       }
-                       ast_log(LOG_NOTICE,"******* Variable Dump End (app_rpt) *******\n");
-
-               }       
-
-
-               if (myrpt->reload)
-               {
-                       struct rpt_tele *inner_telem;
-
-                       rpt_mutex_lock(&myrpt->lock);
-                       inner_telem = myrpt->tele.next;
-                       while(inner_telem != &myrpt->tele)
-                       {
-                               ast_softhangup(inner_telem->chan,AST_SOFTHANGUP_DEV);
-                               inner_telem = inner_telem->next;
-                       }
-                       myrpt->reload = 0;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       usleep(10000);
-                       /* find our index, and load the vars */
-                       for(i = 0; i < nrpts; i++)
-                       {
-                               if (&rpt_vars[i] == myrpt)
-                               {
-                                       load_rpt_vars(i,0);
-                                       break;
-                               }
-                       }
-               }
-
-               rpt_mutex_lock(&myrpt->lock);
-               if (ast_check_hangup(myrpt->rxchannel)) break;
-               if (ast_check_hangup(myrpt->txchannel)) break;
-               if (ast_check_hangup(myrpt->pchannel)) break;
-               if (ast_check_hangup(myrpt->monchannel)) break;
-               if (myrpt->parrotchannel && 
-                       ast_check_hangup(myrpt->parrotchannel)) break;
-               if (myrpt->voxchannel && 
-                       ast_check_hangup(myrpt->voxchannel)) break;
-               if (ast_check_hangup(myrpt->txpchannel)) break;
-               if (myrpt->dahditxchannel && ast_check_hangup(myrpt->dahditxchannel)) break;
-
-               /* Set local tx with keyed */
-               myrpt->localtx = myrpt->keyed;
-               /* If someone's connected, and they're transmitting from their end to us, set remrx true */
-               l = myrpt->links.next;
-               remrx = 0;
-               while(l != &myrpt->links)
-               {
-                       if (l->lastrx){
-                               remrx = 1;
-                               if(l->name[0] != '0') /* Ignore '0' nodes */
-                                       strcpy(myrpt->lastnodewhichkeyedusup, l->name); /* Note the node which is doing the key up */
-                       }
-                       l = l->next;
-               }
-               /* Create a "must_id" flag for the cleanup ID */                
-               if(myrpt->p.idtime) /* ID time must be non-zero */
-                       myrpt->mustid |= (myrpt->idtimer) && (myrpt->keyed || remrx) ;
-               /* Build a fresh totx from myrpt->keyed and autopatch activated */
-               /* If full duplex, add local tx to totx */
-               if (myrpt->p.duplex > 1) 
-               {
-                       totx = myrpt->callmode;
-                       totx = totx || myrpt->localtx;
-               }
-               else
-               {
-                       int myrx = myrpt->localtx || remrx || (!myrpt->callmode);
-
-                       if (lastmyrx != myrx)
-                       {
-                               voxinit_rpt(myrpt,!myrx);
-                               lastmyrx = myrx;
-                       }
-                       totx = 0;
-                       if (myrpt->callmode && (myrpt->voxtotimer <= 0))
-                       {
-                               if (myrpt->voxtostate)
-                               {
-                                       myrpt->voxtotimer = myrpt->p.voxtimeout_ms;
-                                       myrpt->voxtostate = 0;
-                               }                               
-                               else
-                               {
-                                       myrpt->voxtotimer = myrpt->p.voxrecover_ms;
-                                       myrpt->voxtostate = 1;
-                               }
-                       }
-                       if (!myrpt->voxtostate)
-                               totx = myrpt->callmode && myrpt->wasvox;
-               }
-               /* Traverse the telemetry list to see what's queued */
-               identqueued = 0;
-               localmsgqueued = 0;
-               othertelemqueued = 0;
-               tailmessagequeued = 0;
-               ctqueued = 0;
-               telem = myrpt->tele.next;
-               while(telem != &myrpt->tele)
-               {
-                       if((telem->mode == ID) || (telem->mode == IDTALKOVER)){
-                               identqueued = 1; /* Identification telemetry */
-                       }
-                       else if(telem->mode == TAILMSG)
-                       {
-                               tailmessagequeued = 1; /* Tail message telemetry */
-                       }
-                       else if(telem->mode == STATS_TIME_LOCAL) 
-                       {
-                               localmsgqueued = 1; /* Local message */
-                       }
-                       else
-                       {
-                               if ((telem->mode != UNKEY) && (telem->mode != LINKUNKEY))
-                                       othertelemqueued = 1;  /* Other telemetry */
-                               else
-                                       ctqueued = 1; /* Courtesy tone telemetry */
-                       }
-                       telem = telem->next;
-               }
-       
-               /* Add in any "other" telemetry, unless specified otherwise */
-               if (!myrpt->p.notelemtx) totx = totx || othertelemqueued;
-               /* Update external (to links) transmitter PTT state with everything but */
-               /* ID, CT, local messages, and tailmessage telemetry */
-               myrpt->exttx = totx;
-               totx = totx || myrpt->dtmf_local_timer;
-               /* If half or 3/4 duplex, add localtx to external link tx */
-               if (myrpt->p.duplex < 2) myrpt->exttx = myrpt->exttx || myrpt->localtx;
-               /* Add in ID telemetry to local transmitter */
-               totx = totx || remrx;
-               /* If 3/4 or full duplex, add in ident, CT telemetry, and local messages */
-               if (myrpt->p.duplex > 0)
-                       totx = totx || identqueued || ctqueued || localmsgqueued;
-               /* If full duplex, add local dtmf stuff active */
-               if (myrpt->p.duplex > 1) 
-               {
-                       totx = totx || (myrpt->dtmfidx > -1) ||
-                               myrpt->cmdnode[0];
-               }
-               /* add in parrot stuff */
-               totx = totx || (myrpt->parrotstate > 1);
-               /* Reset time out timer variables if there is no activity */
-               if (!totx) 
-               {
-                       myrpt->totimer = myrpt->p.totime;
-                       myrpt->tounkeyed = 0;
-                       myrpt->tonotify = 0;
-               }
-               else{
-                       myrpt->tailtimer = myrpt->p.s[myrpt->p.sysstate_cur].alternatetail ?
-                               myrpt->p.althangtime : /* Initialize tail timer */
-                               myrpt->p.hangtime;
-               }
-               /* Disable the local transmitter if we are timed out */
-               totx = totx && myrpt->totimer;
-               /* if timed-out and not said already, say it */
-               if ((!myrpt->totimer) && (!myrpt->tonotify))
-               {
-                       myrpt->tonotify = 1;
-                       myrpt->timeouts++;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       rpt_telemetry(myrpt,TIMEOUT,NULL);
-                       rpt_mutex_lock(&myrpt->lock);
-               }
-
-               /* If unkey and re-key, reset time out timer */
-               if ((!totx) && (!myrpt->totimer) && (!myrpt->tounkeyed) && (!myrpt->keyed))
-               {
-                       myrpt->tounkeyed = 1;
-               }
-               if ((!totx) && (!myrpt->totimer) && myrpt->tounkeyed && myrpt->keyed)
-               {
-                       myrpt->totimer = myrpt->p.totime;
-                       myrpt->tounkeyed = 0;
-                       myrpt->tonotify = 0;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       continue;
-               }
-               /* if timed-out and in circuit busy after call */
-               if ((!totx) && (!myrpt->totimer) && (myrpt->callmode == 4))
-               {
-                   if(debug)
-                               ast_log(LOG_NOTICE, "timed-out and in circuit busy after call\n");
-                       myrpt->callmode = 0;
-                       myrpt->macropatch=0;
-                       channel_revert(myrpt);
-               }
-               /* get rid of tail if timed out */
-               if (!myrpt->totimer) myrpt->tailtimer = 0;
-               /* if not timed-out, add in tail */
-               if (myrpt->totimer) totx = totx || myrpt->tailtimer;
-               /* If user or links key up or are keyed up over standard ID, switch to talkover ID, if one is defined */
-               /* If tail message, kill the message if someone keys up over it */ 
-               if ((myrpt->keyed || remrx) && ((identqueued && idtalkover) || (tailmessagequeued))) {
-                       int hasid = 0,hastalkover = 0;
-
-                       telem = myrpt->tele.next;
-                       while(telem != &myrpt->tele){
-                               if(telem->mode == ID){
-                                       if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */
-                                       hasid = 1;
-                               }
-                               if(telem->mode == TAILMSG){
-                                        if (telem->chan) ast_softhangup(telem->chan, AST_SOFTHANGUP_DEV); /* Whoosh! */
-                                }
-                               if (telem->mode == IDTALKOVER) hastalkover = 1;
-                               telem = telem->next;
-                       }
-                       rpt_mutex_unlock(&myrpt->lock);
-                       if (hasid && (!hastalkover)) rpt_telemetry(myrpt, IDTALKOVER, NULL); /* Start Talkover ID */
-                       rpt_mutex_lock(&myrpt->lock);
-               }
-               /* Try to be polite */
-               /* If the repeater has been inactive for longer than the ID time, do an initial ID in the tail*/
-               /* If within 30 seconds of the time to ID, try do it in the tail */
-               /* else if at ID time limit, do it right over the top of them */
-               /* Lastly, if the repeater has been keyed, and the ID timer is expired, do a clean up ID */
-               if(myrpt->mustid && (!myrpt->idtimer))
-                       queue_id(myrpt);
-
-               if ((myrpt->p.idtime && totx && (!myrpt->exttx) &&
-                        (myrpt->idtimer <= myrpt->p.politeid) && myrpt->tailtimer)) /* ID time must be non-zero */ 
-                       {
-                               myrpt->tailid = 1;
-                       }
-
-               /* If tail timer expires, then check for tail messages */
-
-               if(myrpt->tailevent){
-                       myrpt->tailevent = 0;
-                       if(myrpt->tailid){
-                               totx = 1;
-                               queue_id(myrpt);
-                       }
-                       else if ((myrpt->p.tailmessages[0]) &&
-                               (myrpt->p.tailmessagetime) && (myrpt->tmsgtimer == 0)){
-                                       totx = 1;
-                                       myrpt->tmsgtimer = myrpt->p.tailmessagetime;    
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       rpt_telemetry(myrpt, TAILMSG, NULL);
-                                       rpt_mutex_lock(&myrpt->lock);
-                       }       
-               }
-
-               /* Main TX control */
-
-               /* let telemetry transmit anyway (regardless of timeout) */
-               if (myrpt->p.duplex > 0) totx = totx || (myrpt->tele.next != &myrpt->tele);
-               totx = totx && !myrpt->p.s[myrpt->p.sysstate_cur].txdisable;
-               myrpt->txrealkeyed = totx;
-               totx = totx || (!AST_LIST_EMPTY(&myrpt->txq));
-               if (totx && (!lasttx))
-               {
-                       char mydate[100],myfname[100];
-                       time_t myt;
-
-                       if (myrpt->monstream) ast_closestream(myrpt->monstream);
-                       if (myrpt->p.archivedir)
-                       {
-                               long blocksleft;
-
-                               time(&myt);
-                               strftime(mydate,sizeof(mydate) - 1,"%Y%m%d%H%M%S",
-                                       localtime(&myt));
-                               sprintf(myfname,"%s/%s/%s",myrpt->p.archivedir,
-                                       myrpt->name,mydate);
-                               myrpt->monstream = ast_writefile(myfname,"wav49",
-                                       "app_rpt Air Archive",O_CREAT | O_APPEND,0,0600);
-                               if (myrpt->p.monminblocks)
-                               {
-                                       blocksleft = diskavail(myrpt);
-                                       if (blocksleft >= myrpt->p.monminblocks)
-                                               donodelog(myrpt,"TXKEY,MAIN");
-                               } else donodelog(myrpt,"TXKEY,MAIN");
-                       }
-                       lasttx = 1;
-                       myrpt->txkeyed = 1;
-                       time(&myrpt->lasttxkeyedtime);
-                       myrpt->dailykeyups++;
-                       myrpt->totalkeyups++;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_KEY);
-                       rpt_mutex_lock(&myrpt->lock);
-               }
-               if ((!totx) && lasttx)
-               {
-                       if (myrpt->monstream) ast_closestream(myrpt->monstream);
-                       myrpt->monstream = NULL;
-
-                       lasttx = 0;
-                       myrpt->txkeyed = 0;
-                       time(&myrpt->lasttxkeyedtime);
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
-                       rpt_mutex_lock(&myrpt->lock);
-                       donodelog(myrpt,"TXUNKEY,MAIN");
-               }
-               time(&t);
-               /* if DTMF timeout */
-               if ((!myrpt->cmdnode[0]) && (myrpt->dtmfidx >= 0) && ((myrpt->dtmf_time + DTMF_TIMEOUT) < t))
-               {
-                       myrpt->inpadtest = 0;
-                       myrpt->dtmfidx = -1;
-                       myrpt->dtmfbuf[0] = 0;
-               }                       
-               /* if remote DTMF timeout */
-               if ((myrpt->rem_dtmfidx >= 0) && ((myrpt->rem_dtmf_time + DTMF_TIMEOUT) < t))
-               {
-                       myrpt->inpadtest = 0;
-                       myrpt->rem_dtmfidx = -1;
-                       myrpt->rem_dtmfbuf[0] = 0;
-               }       
-
-               if (myrpt->exttx && myrpt->parrotchannel && 
-                       myrpt->p.parrotmode && (!myrpt->parrotstate))
-               {
-                       char myfname[300];
-
-                       ci.confno = myrpt->conf;
-                       ci.confmode = DAHDI_CONF_CONFANNMON;
-                       ci.chan = 0;
-
-                       /* first put the channel on the conference in announce mode */
-                       if (ioctl(myrpt->parrotchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-                       {
-                               ast_log(LOG_WARNING, "Unable to set conference mode for parrot\n");
-                               break;
-                       }
-
-                       sprintf(myfname,PARROTFILE,myrpt->name,myrpt->parrotcnt);
-                       strcat(myfname,".wav");
-                       unlink(myfname);                        
-                       sprintf(myfname,PARROTFILE,myrpt->name,myrpt->parrotcnt);
-                       myrpt->parrotstate = 1;
-                       myrpt->parrottimer = myrpt->p.parrottime;
-                       if (myrpt->parrotstream) 
-                               ast_closestream(myrpt->parrotstream);
-                       myrpt->parrotstream = NULL;
-                       myrpt->parrotstream = ast_writefile(myfname,"wav",
-                               "app_rpt Parrot",O_CREAT | O_TRUNC,0,0600);
-               }
-
-               /* Reconnect */
-       
-               l = myrpt->links.next;
-               while(l != &myrpt->links)
-               {
-                       if (l->killme)
-                       {
-                               /* remove from queue */
-                               remque((struct qelem *) l);
-                               if (!strcmp(myrpt->cmdnode,l->name))
-                                       myrpt->cmdnode[0] = 0;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               /* hang-up on call to device */
-                               if (l->chan) ast_hangup(l->chan);
-                               ast_hangup(l->pchan);
-                               ast_free(l);
-                               rpt_mutex_lock(&myrpt->lock);
-                               /* re-start link traversal */
-                               l = myrpt->links.next;
-                               continue;
-                       }
-                       l = l->next;
-               }
-               n = 0;
-               cs[n++] = myrpt->rxchannel;
-               cs[n++] = myrpt->pchannel;
-               cs[n++] = myrpt->monchannel;
-               if (myrpt->parrotchannel) cs[n++] = myrpt->parrotchannel;
-               if (myrpt->voxchannel) cs[n++] = myrpt->voxchannel;
-               cs[n++] = myrpt->txpchannel;
-               if (myrpt->txchannel != myrpt->rxchannel) cs[n++] = myrpt->txchannel;
-               if (myrpt->dahditxchannel != myrpt->txchannel)
-                       cs[n++] = myrpt->dahditxchannel;
-               l = myrpt->links.next;
-               while(l != &myrpt->links)
-               {
-                       if ((!l->killme) && (!l->disctime) && l->chan)
-                       {
-                               cs[n++] = l->chan;
-                               cs[n++] = l->pchan;
-                       }
-                       l = l->next;
-               }
-               if ((myrpt->topkeystate == 1) && 
-                   ((t - myrpt->topkeytime) > TOPKEYWAIT))
-               {
-                       myrpt->topkeystate = 2;
-                       qsort(myrpt->topkey,TOPKEYN,sizeof(struct rpt_topkey),
-                               topcompar);
-               }
-               rpt_mutex_unlock(&myrpt->lock);
-
-               if (myrpt->topkeystate == 2)
-               {
-                       rpt_telemetry(myrpt,TOPKEY,NULL);
-                       myrpt->topkeystate = 3;
-               }
-               ms = MSWAIT;
-               for(x = 0; x < n; x++)
-               {
-                       int s = -(-x - myrpt->scram - 1) % n;
-                       cs1[x] = cs[s];
-               }
-               myrpt->scram++;
-               who = ast_waitfor_n(cs1,n,&ms);
-               if (who == NULL) ms = 0;
-               elap = MSWAIT - ms;
-               rpt_mutex_lock(&myrpt->lock);
-               l = myrpt->links.next;
-               while(l != &myrpt->links)
-               {
-                       int myrx;
-
-                       if (l->voxtotimer) l->voxtotimer -= elap;
-                       if (l->voxtotimer < 0) l->voxtotimer = 0;
-
-                       if (l->lasttx != l->lasttx1)
-                       {
-                               voxinit_link(l,!l->lasttx);
-                               l->lasttx1 = l->lasttx;
-                       }
-                       myrx = l->lastrealrx;
-                       if ((l->phonemode) && (l->phonevox))
-                       {
-                               myrx = myrx || (!AST_LIST_EMPTY(&l->rxq));
-                               if (l->voxtotimer <= 0)
-                               {
-                                       if (l->voxtostate)
-                                       {
-                                               l->voxtotimer = myrpt->p.voxtimeout_ms;
-                                               l->voxtostate = 0;
-                                       }                               
-                                       else
-                                       {
-                                               l->voxtotimer = myrpt->p.voxrecover_ms;
-                                               l->voxtostate = 1;
-                                       }
-                               }
-                               if (!l->voxtostate)
-                                       myrx = myrx || l->wasvox ;
-                       }
-                       l->lastrx = myrx;
-                       if (l->linklisttimer)
-                       {
-                               l->linklisttimer -= elap;
-                               if (l->linklisttimer < 0) l->linklisttimer = 0;
-                       }
-                       if ((!l->linklisttimer) && (l->name[0] != '0') && (!l->isremote))
-                       {
-                               struct  ast_frame lf;
-
-                               memset(&lf,0,sizeof(lf));
-                               lf.frametype = AST_FRAME_TEXT;
-                               lf.subclass.integer = 0;
-                               lf.offset = 0;
-                               lf.mallocd = 0;
-                               lf.samples = 0;
-                               l->linklisttimer = LINKLISTTIME;
-                               strcpy(lstr,"L ");
-                               __mklinklist(myrpt,l,lstr + 2);
-                               if (l->chan)
-                               {
-                                       lf.datalen = strlen(lstr) + 1;
-                                       lf.data.ptr = lstr;
-                                       ast_write(l->chan,&lf);
-                                       if (debug > 6) ast_log(LOG_NOTICE,
-                                               "@@@@ node %s sent node string %s to node %s\n",
-                                                       myrpt->name,lstr,l->name);
-                               }
-                       }
-                       if (l->newkey)
-                       {
-                               if ((l->retxtimer += elap) >= REDUNDANT_TX_TIME)
-                               {
-                                       l->retxtimer = 0;
-                                       if (l->chan && l->phonemode == 0) 
-                                       {
-                                               if (l->lasttx)
-                                                       ast_indicate(l->chan,AST_CONTROL_RADIO_KEY);
-                                               else
-                                                       ast_indicate(l->chan,AST_CONTROL_RADIO_UNKEY);
-                                       }
-                               }
-                               if ((l->rerxtimer += elap) >= (REDUNDANT_TX_TIME * 5))
-                               {
-                                       if (debug == 7) printf("@@@@ rx un-key\n");
-                                       l->lastrealrx = 0;
-                                       l->rerxtimer = 0;
-                                       if (l->lastrx1)
-                                       {
-                                               if (myrpt->p.archivedir)
-                                               {
-                                                       char str[100];
-       
-                                                       sprintf(str,"RXUNKEY(T),%s",l->name);
-                                                       donodelog(myrpt,str);
-                                               }
-                                               if(myrpt->p.duplex) 
-                                                       rpt_telemetry(myrpt,LINKUNKEY,l);
-                                               l->lastrx1 = 0;
-                                       }
-                               }
-                       }
-                       if (l->disctime) /* Disconnect timer active on a channel ? */
-                       {
-                               l->disctime -= elap;
-                               if (l->disctime <= 0) /* Disconnect timer expired on inbound channel ? */
-                                       l->disctime = 0; /* Yep */
-                       }
-
-                       if (l->retrytimer)
-                       {
-                               l->retrytimer -= elap;
-                               if (l->retrytimer < 0) l->retrytimer = 0;
-                       }
-
-                       /* Tally connect time */
-                       l->connecttime += elap;
-
-                       /* ignore non-timing channels */
-                       if (l->elaptime < 0)
-                       {
-                               l = l->next;
-                               continue;
-                       }
-                       l->elaptime += elap;
-                       /* if connection has taken too long */
-                       if ((l->elaptime > MAXCONNECTTIME) && 
-                          ((!l->chan) || (l->chan->_state != AST_STATE_UP)))
-                       {
-                               l->elaptime = 0;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               if (l->chan) ast_softhangup(l->chan,AST_SOFTHANGUP_DEV);
-                               rpt_mutex_lock(&myrpt->lock);
-                               break;
-                       }
-                       if ((!l->chan) && (!l->retrytimer) && l->outbound && 
-                               (l->retries++ < l->max_retries) && (l->hasconnected))
-                       {
-                               if (l->chan) ast_hangup(l->chan);
-                               l->chan = 0;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               if ((l->name[0] != '0') && (!l->isremote))
-                               {
-                                       if (attempt_reconnect(myrpt,l) == -1)
-                                       {
-                                               l->retrytimer = RETRY_TIMER_MS;
-                                       } 
-                               }
-                               else 
-                               {
-                                       l->retrytimer = l->max_retries + 1;
-                               }
-
-                               rpt_mutex_lock(&myrpt->lock);
-                               break;
-                       }
-                       if ((!l->chan) && (!l->retrytimer) && l->outbound &&
-                               (l->retries >= l->max_retries))
-                       {
-                               /* remove from queue */
-                               remque((struct qelem *) l);
-                               if (!strcmp(myrpt->cmdnode,l->name))
-                                       myrpt->cmdnode[0] = 0;
-                               rpt_mutex_unlock(&myrpt->lock);
-                               if (l->name[0] != '0')
-                               {
-                                       if (!l->hasconnected)
-                                               rpt_telemetry(myrpt,CONNFAIL,l);
-                                       else rpt_telemetry(myrpt,REMDISC,l);
-                               }
-                               if (myrpt->p.archivedir)
-                               {
-                                       char str[100];
-
-                                       if (!l->hasconnected)
-                                               sprintf(str,"LINKFAIL,%s",l->name);
-                                       else
-                                               sprintf(str,"LINKDISC,%s",l->name);
-                                       donodelog(myrpt,str);
-                               }
-                               /* hang-up on call to device */
-                               ast_hangup(l->pchan);
-                               ast_free(l);
-                                rpt_mutex_lock(&myrpt->lock);
-                               break;
-                       }
-            if ((!l->chan) && (!l->disctime) && (!l->outbound))
-            {
-                               if(debug)ast_log(LOG_NOTICE, "LINKDISC AA\n");
-                /* remove from queue */
-                remque((struct qelem *) l);
-                               if(myrpt->links.next==&myrpt->links)channel_revert(myrpt);
-                if (!strcmp(myrpt->cmdnode,l->name))myrpt->cmdnode[0] = 0;
-                rpt_mutex_unlock(&myrpt->lock);
-                               if (l->name[0] != '0') 
-                               {
-                       rpt_telemetry(myrpt,REMDISC,l);
-                               }
-                               if (myrpt->p.archivedir)
-                               {
-                                       char str[100];
-                                       sprintf(str,"LINKDISC,%s",l->name);
-                                       donodelog(myrpt,str);
-                               }
-                /* hang-up on call to device */
-                ast_hangup(l->pchan);
-                ast_free(l);
-                rpt_mutex_lock(&myrpt->lock);
-                break;
-            }
-                       l = l->next;
-               }
-               if (myrpt->linkposttimer)
-               {
-                       myrpt->linkposttimer -= elap;
-                       if (myrpt->linkposttimer < 0) myrpt->linkposttimer = 0;
-               }
-               if (myrpt->linkposttimer <= 0)
-               {
-                       int nstr;
-                       char lst,*str;
-                       time_t now;
-
-                       myrpt->linkposttimer = LINKPOSTTIME;
-                       nstr = 0;
-                       for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
-                       {
-                               /* if is not a real link, ignore it */
-                               if (l->name[0] == '0') continue;
-                               nstr += strlen(l->name) + 1;
-                       }
-                       str = ast_malloc(nstr + 256);
-                       if (!str)
-                       {
-                               ast_log(LOG_NOTICE,"Cannot ast_malloc()\n");
-                               break;
-                       }
-                       nstr = 0;
-                       strcpy(str,"nodes=");
-                       for(l = myrpt->links.next; l != &myrpt->links; l = l->next)
-                       {
-                               /* if is not a real link, ignore it */
-                               if (l->name[0] == '0') continue;
-                               lst = 'T';
-                               if (!l->mode) lst = 'R';
-                               if (!l->thisconnected) lst = 'C';
-                               if (nstr) strcat(str,",");
-                               sprintf(str + strlen(str),"%c%s",lst,l->name);
-                               nstr = 1;
-                       }
-                       p = strstr(tdesc, "version");
-                       if(p){
-                               int vmajor,vminor;
-                               if(sscanf(p, "version %30d.%30d", &vmajor, &vminor) == 2)
-                                       sprintf(str + strlen(str),"&apprptvers=%d.%d",vmajor,vminor);
-                       }
-                       time(&now);
-                       sprintf(str + strlen(str),"&apprptuptime=%d",(int)(now-starttime));
-                       sprintf(str + strlen(str),
-                       "&totalkerchunks=%d&totalkeyups=%d&totaltxtime=%d&timeouts=%d&totalexecdcommands=%d",
-                       myrpt->totalkerchunks,myrpt->totalkeyups,(int) myrpt->totaltxtime/1000,
-                       myrpt->timeouts,myrpt->totalexecdcommands);
-                       rpt_mutex_unlock(&myrpt->lock);
-                       statpost(myrpt,str);
-                       rpt_mutex_lock(&myrpt->lock);
-                       ast_free(str);
-               }
-               if (myrpt->keyposttimer)
-               {
-                       myrpt->keyposttimer -= elap;
-                       if (myrpt->keyposttimer < 0) myrpt->keyposttimer = 0;
-               }
-               if (myrpt->keyposttimer <= 0)
-               {
-                       char str[100];
-                       int diff = 0;
-                       time_t now;
-
-                       myrpt->keyposttimer = KEYPOSTTIME;
-                       time(&now);
-                       if (myrpt->lastkeyedtime)
-                       {
-                               diff = (int)(now - myrpt->lastkeyedtime);
-                       }
-                       sprintf(str,"keyed=%d&keytime=%d",myrpt->keyed,diff);
-                       rpt_mutex_unlock(&myrpt->lock);
-                       statpost(myrpt,str);
-                       rpt_mutex_lock(&myrpt->lock);
-               }
-               if(totx){
-                       myrpt->dailytxtime += elap;
-                       myrpt->totaltxtime += elap;
-               }
-               i = myrpt->tailtimer;
-               if (myrpt->tailtimer) myrpt->tailtimer -= elap;
-               if (myrpt->tailtimer < 0) myrpt->tailtimer = 0;
-               if((i) && (myrpt->tailtimer == 0))
-                       myrpt->tailevent = 1;
-               if ((!myrpt->p.s[myrpt->p.sysstate_cur].totdisable) && myrpt->totimer) myrpt->totimer -= elap;
-               if (myrpt->totimer < 0) myrpt->totimer = 0;
-               if (myrpt->idtimer) myrpt->idtimer -= elap;
-               if (myrpt->idtimer < 0) myrpt->idtimer = 0;
-               if (myrpt->tmsgtimer) myrpt->tmsgtimer -= elap;
-               if (myrpt->tmsgtimer < 0) myrpt->tmsgtimer = 0;
-               if (myrpt->voxtotimer) myrpt->voxtotimer -= elap;
-               if (myrpt->voxtotimer < 0) myrpt->voxtotimer = 0;
-               if (myrpt->exttx)
-               {
-                       myrpt->parrottimer = myrpt->p.parrottime;
-               }
-               else
-               {
-                       if (myrpt->parrottimer) myrpt->parrottimer -= elap;
-                       if (myrpt->parrottimer < 0) myrpt->parrottimer = 0;
-               }
-               /* do macro timers */
-               if (myrpt->macrotimer) myrpt->macrotimer -= elap;
-               if (myrpt->macrotimer < 0) myrpt->macrotimer = 0;
-               /* do local dtmf timer */
-               if (myrpt->dtmf_local_timer)
-               {
-                       if (myrpt->dtmf_local_timer > 1) myrpt->dtmf_local_timer -= elap;
-                       if (myrpt->dtmf_local_timer < 1) myrpt->dtmf_local_timer = 1;
-               }
-               do_dtmf_local(myrpt,0);
-               /* Execute scheduler appx. every 2 tenths of a second */
-               if (myrpt->skedtimer <= 0){
-                       myrpt->skedtimer = 200;
-                       do_scheduler(myrpt);
-               }
-               else
-                       myrpt->skedtimer -=elap;
-               if (!ms) 
-               {
-                       rpt_mutex_unlock(&myrpt->lock);
-                       continue;
-               }
-               if (myrpt->p.parrotmode && (myrpt->parrotstate == 1) &&
-                       (myrpt->parrottimer <= 0))
-               {
-
-                       ci.confno = 0;
-                       ci.confmode = 0;
-                       ci.chan = 0;
-
-                       /* first put the channel on the conference in announce mode */
-                       if (ioctl(myrpt->parrotchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-                       {
-                               ast_log(LOG_WARNING, "Unable to set conference mode for parrot\n");
-                               break;
-                       }
-                       if (myrpt->parrotstream) 
-                               ast_closestream(myrpt->parrotstream);
-                       myrpt->parrotstream = NULL;
-                       myrpt->parrotstate = 2;
-                       rpt_telemetry(myrpt,PARROT,(void *) ((intptr_t)myrpt->parrotcnt++)); 
-               }                       
-               if (myrpt->cmdAction.state == CMD_STATE_READY)
-               { /* there is a command waiting to be processed */
-                       myrpt->cmdAction.state = CMD_STATE_EXECUTING;
-                       // lose the lock
-                       rpt_mutex_unlock(&myrpt->lock);
-                       // do the function
-                       (*function_table[myrpt->cmdAction.functionNumber].function)(myrpt,myrpt->cmdAction.param, myrpt->cmdAction.digits, myrpt->cmdAction.command_source, NULL);
-                       // get the lock again
-                       rpt_mutex_lock(&myrpt->lock);
-                       myrpt->cmdAction.state = CMD_STATE_IDLE;
-               } /* if myrpt->cmdAction.state == CMD_STATE_READY */
-               
-               c = myrpt->macrobuf[0];
-               time(&t);
-               if (c && (!myrpt->macrotimer) && 
-                       starttime && (t > (starttime + START_DELAY)))
-               {
-                       char cin = c & 0x7f;
-                       myrpt->macrotimer = MACROTIME;
-                       memmove(myrpt->macrobuf,myrpt->macrobuf + 1,MAXMACRO - 1);
-                       if ((cin == 'p') || (cin == 'P'))
-                               myrpt->macrotimer = MACROPTIME;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       if (myrpt->p.archivedir)
-                       {
-                               char str[100];
-
-                               sprintf(str,"DTMF(M),MAIN,%c",cin);
-                               donodelog(myrpt,str);
-                       }
-                       local_dtmf_helper(myrpt,c);
-               } else rpt_mutex_unlock(&myrpt->lock);
-               if (who == myrpt->rxchannel) /* if it was a read from rx */
-               {
-                       int ismuted;
-
-                       f = ast_read(myrpt->rxchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-#ifdef _MDC_DECODE_H_
-                               unsigned char ubuf[2560];
-                               short *sp;
-                               int n;
-#endif
-
-                               if ((!myrpt->localtx) && (!myrpt->p.linktolink)) {
-                                       memset(f->data.ptr,0,f->datalen);
-                               }
-
-#ifdef _MDC_DECODE_H_
-                               sp = (short *) f->data;
-                               /* convert block to unsigned char */
-                               for(n = 0; n < f->datalen / 2; n++)
-                               {
-                                       ubuf[n] = (*sp++ >> 8) + 128;
-                               }
-                               n = mdc_decoder_process_samples(myrpt->mdc,ubuf,f->datalen / 2);
-                               if (n == 1)
-                               {
-                                               unsigned char op,arg;
-                                               unsigned short unitID;
-
-                                               mdc_decoder_get_packet(myrpt->mdc,&op,&arg,&unitID);
-                                               if (debug > 2)
-                                               {
-                                                       ast_log(LOG_NOTICE,"Got (single-length) packet:\n");
-                                                       ast_log(LOG_NOTICE,"op: %02x, arg: %02x, UnitID: %04x\n",
-                                                               op & 255,arg & 255,unitID);
-                                               }
-                                               if ((op == 1) && (arg == 0))
-                                               {
-                                                       myrpt->lastunit = unitID;
-                                                       mdc1200_notify(myrpt,NULL,myrpt->lastunit);
-                                                       mdc1200_send(myrpt,myrpt->lastunit);
-                                               }
-                               }
-                               if ((debug > 2) && (i == 2))
-                               {
-                                       unsigned char op,arg,ex1,ex2,ex3,ex4;
-                                       unsigned short unitID;
-
-                                       mdc_decoder_get_double_packet(myrpt->mdc,&op,&arg,&unitID,
-                                               &ex1,&ex2,&ex3,&ex4);
-                                       ast_log(LOG_NOTICE,"Got (double-length) packet:\n");
-                                       ast_log(LOG_NOTICE,"op: %02x, arg: %02x, UnitID: %04x\n",
-                                               op & 255,arg & 255,unitID);
-                                       ast_log(LOG_NOTICE,"ex1: %02x, ex2: %02x, ex3: %02x, ex4: %02x\n",
-                                               ex1 & 255, ex2 & 255, ex3 & 255, ex4 & 255);
-                               }
-#endif
-#ifdef __RPT_NOTCH
-                               /* apply inbound filters, if any */
-                               rpt_filter(myrpt,f->data,f->datalen / 2);
-#endif
-                               if (ioctl(myrpt->dahdirxchannel->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
-                               {
-                                       ismuted = 0;
-                               }
-                               if (dtmfed) ismuted = 1;
-                               dtmfed = 0;
-                               if (ismuted)
-                               {
-                                       memset(f->data.ptr,0,f->datalen);
-                                       if (myrpt->lastf1)
-                                               memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                                       if (myrpt->lastf2)
-                                               memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               } 
-                               if (f) f2 = ast_frdup(f);
-                               else f2 = NULL;
-                               f1 = myrpt->lastf2;
-                               myrpt->lastf2 = myrpt->lastf1;
-                               myrpt->lastf1 = f2;
-                               if (ismuted)
-                               {
-                                       if (myrpt->lastf1)
-                                               memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                                       if (myrpt->lastf2)
-                                               memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               }
-                               if (f1)
-                               {
-                                       ast_write(myrpt->pchannel,f1);
-                                       ast_frfree(f1);
-                               }
-                       }
-#ifndef        OLD_ASTERISK
-                       else if (f->frametype == AST_FRAME_DTMF_BEGIN)
-                       {
-                               if (myrpt->lastf1)
-                                       memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                               if (myrpt->lastf2)
-                                       memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               dtmfed = 1;
-                       }
-#endif
-                       else if (f->frametype == AST_FRAME_DTMF)
-                       {
-                               c = (char) f->subclass.integer; /* get DTMF char */
-                               ast_frfree(f);
-                               if (myrpt->lastf1)
-                                       memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                               if (myrpt->lastf2)
-                                       memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               dtmfed = 1;
-                               if (!myrpt->keyed) continue;
-                               c = func_xlat(myrpt,c,&myrpt->p.inxlat);
-                               if (c) local_dtmf_helper(myrpt,c);
-                               continue;
-                       }                                               
-                       else if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                               /* if RX key */
-                               if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
-                               {
-                                       if ((!lasttx) || (myrpt->p.duplex > 1) || (myrpt->p.linktolink)) 
-                                       {
-                                               if (debug == 7) printf("@@@@ rx key\n");
-                                               myrpt->keyed = 1;
-                                               time(&myrpt->lastkeyedtime);
-                                               myrpt->keyposttimer = KEYPOSTSHORTTIME;
-                                       }
-                                       if (myrpt->p.archivedir)
-                                       {
-                                               donodelog(myrpt,"RXKEY,MAIN");
-                                       }
-                                       if (f->datalen && f->data.ptr)
-                                       {
-                                               char busy = 0;
-
-                                               if (debug) ast_log(LOG_NOTICE,"Got PL %s on node %s\n",(char *)f->data.ptr,myrpt->name);
-                                               // ctcss code autopatch initiate
-                                               if (strstr((char *)f->data.ptr,"/M/")&& !myrpt->macropatch)
-                                               {
-                                                       char value[16] = "";
-                                                       strcat(value,"*6");
-                                                       myrpt->macropatch=1;
-                                                       rpt_mutex_lock(&myrpt->lock);
-                                                       if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(value)){
-                                                               rpt_mutex_unlock(&myrpt->lock);
-                                                               busy=1;
-                                                       }
-                                                       if(!busy){
-                                                               myrpt->macrotimer = MACROTIME;
-                                                               strncat(myrpt->macrobuf,value,MAXMACRO - 1);
-                                                               if (!busy) strcpy(myrpt->lasttone,(char*)f->data.ptr);
-                                                       }
-                                                       rpt_mutex_unlock(&myrpt->lock);
-                                               }
-                                               else if (strcmp((char *)f->data.ptr,myrpt->lasttone))
-                                               {
-                                                       char *value = (char *) ast_variable_retrieve(myrpt->cfg, myrpt->p.tonemacro, (char *)f->data.ptr);
-                                                       if (value)
-                                                       {
-                                                               if (debug) ast_log(LOG_NOTICE,"Tone %s doing %s on node %s\n",(char *) f->data.ptr,value,myrpt->name);
-                                                               rpt_mutex_lock(&myrpt->lock);
-                                                               if ((MAXMACRO - strlen(myrpt->macrobuf)) < strlen(value)){
-                                                                       rpt_mutex_unlock(&myrpt->lock);
-                                                                       busy=1;
-                                                               }
-                                                               if(!busy){
-                                                                       myrpt->macrotimer = MACROTIME;
-                                                                       strncat(myrpt->macrobuf,value,MAXMACRO - 1);
-                                                               }
-                                                               rpt_mutex_unlock(&myrpt->lock);
-                                                       }
-                                                       if (!busy) strcpy(myrpt->lasttone,(char*)f->data.ptr);
-                                               }
-                                       } else myrpt->lasttone[0] = 0;
-                               }
-                               /* if RX un-key */
-                               if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
-                               {
-                                       if ((!lasttx) || (myrpt->p.duplex > 1) || (myrpt->p.linktolink))
-                                       {
-                                               if (debug == 7) printf("@@@@ rx un-key\n");
-                                               if(myrpt->p.duplex && myrpt->keyed) {
-                                                       rpt_telemetry(myrpt,UNKEY,NULL);
-                                               }
-                                       }
-                                       myrpt->keyed = 0;
-                                       time(&myrpt->lastkeyedtime);
-                                       myrpt->keyposttimer = KEYPOSTSHORTTIME;
-                                       if (myrpt->p.archivedir)
-                                       {
-                                               donodelog(myrpt,"RXUNKEY,MAIN");
-                                       }
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (who == myrpt->pchannel) /* if it was a read from pseudo */
-               {
-                       f = ast_read(myrpt->pchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               ast_write(myrpt->txpchannel,f);
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (who == myrpt->txchannel) /* if it was a read from tx */
-               {
-                       f = ast_read(myrpt->txchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (who == myrpt->dahditxchannel) /* if it was a read from pseudo-tx */
-               {
-                       f = ast_read(myrpt->dahditxchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               struct ast_frame *vframe;
-
-                               if (myrpt->p.duplex < 2)
-                               {
-                                       if (myrpt->txrealkeyed) 
-                                       {
-                                               if ((!myfirst) && myrpt->callmode)
-                                               {
-                                                   x = 0;
-                                                   AST_LIST_TRAVERSE(&myrpt->txq, vframe,
-                                                       frame_list) x++;
-                                                   for(;x < myrpt->p.simplexpatchdelay; x++)
-                                                   {
-                                                               vframe = ast_frdup(f);
-                                                               memset(vframe->data.ptr,0,vframe->datalen);
-                                                               AST_LIST_INSERT_TAIL(&myrpt->txq,vframe,frame_list);
-                                                   }
-                                                   myfirst = 1;
-                                               }
-                                               vframe = ast_frdup(f);
-                                               AST_LIST_INSERT_TAIL(&myrpt->txq,
-                                                       vframe,frame_list);
-                                       } else myfirst = 0;
-                                       x = 0;
-                                       AST_LIST_TRAVERSE(&myrpt->txq, vframe,
-                                               frame_list) x++;
-                                       if (!x)
-                                       {
-                                               memset(f->data.ptr,0,f->datalen);
-                                       }
-                                       else
-                                       {
-                                               ast_frfree(f);
-                                               f = AST_LIST_REMOVE_HEAD(&myrpt->txq,
-                                                       frame_list);
-                                       }
-                               }
-                               else
-                               {
-                                       while((vframe = AST_LIST_REMOVE_HEAD(&myrpt->txq,
-                                               frame_list))) ast_frfree(vframe);
-                               }
-                               ast_write(myrpt->txchannel,f);
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               toexit = 0;
-               rpt_mutex_lock(&myrpt->lock);
-               l = myrpt->links.next;
-               while(l != &myrpt->links)
-               {
-                       int remnomute;
-                       struct timeval now;
-
-                       if (l->disctime)
-                       {
-                               l = l->next;
-                               continue;
-                       }
-
-                       remrx = 0;
-                       /* see if any other links are receiving */
-                       m = myrpt->links.next;
-                       while(m != &myrpt->links)
-                       {
-                               /* if not us, count it */
-                               if ((m != l) && (m->lastrx)) remrx = 1;
-                               m = m->next;
-                       }
-                       rpt_mutex_unlock(&myrpt->lock);
-                       now = ast_tvnow();
-                       if ((who == l->chan) || (!l->lastlinktv.tv_sec) ||
-                               (ast_tvdiff_ms(now,l->lastlinktv) >= 19))
-                       {
-                               l->lastlinktv = now;
-                               remnomute = myrpt->localtx && 
-                                   (!(myrpt->cmdnode[0] || 
-                                       (myrpt->dtmfidx > -1)));
-                               totx = (((l->isremote) ? (remnomute) : 
-                                       myrpt->exttx) || remrx) && l->mode;
-                               if (l->phonemode == 0 && l->chan && (l->lasttx != totx))
-                               {
-                                       if (totx)
-                                       {
-                                               ast_indicate(l->chan,AST_CONTROL_RADIO_KEY);
-                                       }
-                                       else
-                                       {
-                                               ast_indicate(l->chan,AST_CONTROL_RADIO_UNKEY);
-                                       }
-                                       if (myrpt->p.archivedir)
-                                       {
-                                               char str[100];
-
-                                               if (totx)
-                                                       sprintf(str,"TXKEY,%s",l->name);
-                                               else
-                                                       sprintf(str,"TXUNKEY,%s",l->name);
-                                               donodelog(myrpt,str);
-                                       }
-                               }
-                               l->lasttx = totx;
-                       }
-                       rpt_mutex_lock(&myrpt->lock);
-                       if (who == l->chan) /* if it was a read from rx */
-                       {
-                               rpt_mutex_unlock(&myrpt->lock);
-                               f = ast_read(l->chan);
-                               if (!f)
-                               {
-                                       rpt_mutex_lock(&myrpt->lock);
-                                       __kickshort(myrpt);
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       if ((!l->disced) && (!l->outbound))
-                                       {
-                                               if ((l->name[0] == '0') || l->isremote)
-                                                       l->disctime = 1;
-                                               else
-                                                       l->disctime = DISC_TIME;
-                                               rpt_mutex_lock(&myrpt->lock);
-                                               ast_hangup(l->chan);
-                                               l->chan = 0;
-                                               break;
-                                       }
-
-                                       if (l->retrytimer) 
-                                       {
-                                               ast_hangup(l->chan);
-                                               l->chan = 0;
-                                               rpt_mutex_lock(&myrpt->lock);
-                                               break; 
-                                       }
-                                       if (l->outbound && (l->retries++ < l->max_retries) && (l->hasconnected))
-                                       {
-                                               rpt_mutex_lock(&myrpt->lock);
-                                               if (l->chan) ast_hangup(l->chan);
-                                               l->chan = 0;
-                                               l->hasconnected = 1;
-                                               l->retrytimer = RETRY_TIMER_MS;
-                                               l->elaptime = 0;
-                                               l->connecttime = 0;
-                                               l->thisconnected = 0;
-                                               break;
-                                       }
-                                       rpt_mutex_lock(&myrpt->lock);
-                                       /* remove from queue */
-                                       remque((struct qelem *) l);
-                                       if (!strcmp(myrpt->cmdnode,l->name))
-                                               myrpt->cmdnode[0] = 0;
-                                       __kickshort(myrpt);
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       if (!l->hasconnected)
-                                               rpt_telemetry(myrpt,CONNFAIL,l);
-                                       else if (l->disced != 2) rpt_telemetry(myrpt,REMDISC,l);
-                                       if (myrpt->p.archivedir)
-                                       {
-                                               char str[100];
-
-                                               if (!l->hasconnected)
-                                                       sprintf(str,"LINKFAIL,%s",l->name);
-                                               else
-                                                       sprintf(str,"LINKDISC,%s",l->name);
-                                               donodelog(myrpt,str);
-                                       }
-                                       if (l->lastf1) ast_frfree(l->lastf1);
-                                       l->lastf1 = NULL;
-                                       if (l->lastf2) ast_frfree(l->lastf2);
-                                       l->lastf2 = NULL;
-                                       /* hang-up on call to device */
-                                       ast_hangup(l->chan);
-                                       ast_hangup(l->pchan);
-                                       ast_free(l);
-                                       rpt_mutex_lock(&myrpt->lock);
-                                       break;
-                               }
-                               if (f->frametype == AST_FRAME_VOICE)
-                               {
-                                       int ismuted,n1;
-
-                                       if ((l->phonemode) && (l->phonevox))
-                                       {
-                                               n1 = dovox(&l->vox,
-                                                       f->data.ptr,f->datalen / 2);
-                                               if (n1 != l->wasvox)
-                                               {
-                                                       ast_debug(1,"Link Node %s, vox %d\n",l->name,n1);
-                                                       l->wasvox = n1;
-                                                       l->voxtostate = 0;
-                                                       if (n1) l->voxtotimer = myrpt->p.voxtimeout_ms;
-                                                       else l->voxtotimer = 0;
-                                               }
-                                               if (l->lastrealrx || n1)
-                                               {
-                                                       if (!myfirst)
-                                                       {
-                                                           x = 0;
-                                                           AST_LIST_TRAVERSE(&l->rxq, f1,
-                                                               frame_list) x++;
-                                                           for(;x < myrpt->p.simplexphonedelay; x++)
-                                                               {
-                                                                       f1 = ast_frdup(f);
-                                                                       memset(f1->data.ptr,0,f1->datalen);
-                                                                       AST_LIST_INSERT_TAIL(&l->rxq,
-                                                                               f1,frame_list);
-                                                           }
-                                                           myfirst = 1;
-                                                       }
-                                                       f1 = ast_frdup(f);
-                                                       AST_LIST_INSERT_TAIL(&l->rxq,f1,frame_list);
-                                               } else myfirst = 0; 
-                                               x = 0;
-                                               AST_LIST_TRAVERSE(&l->rxq, f1,frame_list) x++;
-                                               if (!x)
-                                               {
-                                                       memset(f->data.ptr,0,f->datalen);
-                                               }
-                                               else
-                                               {
-                                                       ast_frfree(f);
-                                                       f = AST_LIST_REMOVE_HEAD(&l->rxq,frame_list);
-                                               }
-                                               if (ioctl(l->chan->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
-                                               {
-                                                       ismuted = 0;
-                                               }
-                                               /* if not receiving, zero-out audio */
-                                               ismuted |= (!l->lastrx);
-                                               if (l->dtmfed && l->phonemode) ismuted = 1;
-                                               l->dtmfed = 0;
-                                               if (ismuted)
-                                               {
-                                                       memset(f->data.ptr,0,f->datalen);
-                                                       if (l->lastf1)
-                                                               memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
-                                                       if (l->lastf2)
-                                                               memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
-                                               } 
-                                               if (f) f2 = ast_frdup(f);
-                                               else f2 = NULL;
-                                               f1 = l->lastf2;
-                                               l->lastf2 = l->lastf1;
-                                               l->lastf1 = f2;
-                                               if (ismuted)
-                                               {
-                                                       if (l->lastf1)
-                                                               memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
-                                                       if (l->lastf2)
-                                                               memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
-                                               }
-                                               if (f1)
-                                               {
-                                                       ast_write(l->pchan,f1);
-                                                       ast_frfree(f1);
-                                               }
-                                       }
-                                       else
-                                       {
-                                               if (!l->lastrx)
-                                                       memset(f->data.ptr,0,f->datalen);
-                                               ast_write(l->pchan,f);
-                                       }
-                               }
-#ifndef        OLD_ASTERISK
-                               else if (f->frametype == AST_FRAME_DTMF_BEGIN)
-                               {
-                                       if (l->lastf1)
-                                               memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
-                                       if (l->lastf2)
-                                               memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
-                                       l->dtmfed = 1;
-                               }
-#endif
-                               if (f->frametype == AST_FRAME_TEXT)
-                               {
-                                       handle_link_data(myrpt,l,f->data.ptr);
-                               }
-                               if (f->frametype == AST_FRAME_DTMF)
-                               {
-                                       if (l->lastf1)
-                                               memset(l->lastf1->data.ptr,0,l->lastf1->datalen);
-                                       if (l->lastf2)
-                                               memset(l->lastf2->data.ptr,0,l->lastf2->datalen);
-                                       l->dtmfed = 1;
-                                       handle_link_phone_dtmf(myrpt,l,f->subclass.integer);
-                               }
-                               if (f->frametype == AST_FRAME_CONTROL)
-                               {
-                                       if (f->subclass.integer == AST_CONTROL_ANSWER)
-                                       {
-                                               char lconnected = l->connected;
-
-                                               __kickshort(myrpt);
-                                               l->connected = 1;
-                                               l->hasconnected = 1;
-                                               l->thisconnected = 1;
-                                               l->elaptime = -1;
-                                               if (!l->phonemode) send_newkey(l->chan);
-                                               if (!l->isremote) l->retries = 0;
-                                               if (!lconnected) 
-                                               {
-                                                       rpt_telemetry(myrpt,CONNECTED,l);
-                                                       if (myrpt->p.archivedir)
-                                                       {
-                                                               char str[100];
-
-                                                               if (l->mode)
-                                                                       sprintf(str,"LINKTRX,%s",l->name);
-                                                               else
-                                                                       sprintf(str,"LINKMONITOR,%s",l->name);
-                                                               donodelog(myrpt,str);
-                                                       }
-                                               }               
-                                               else
-                                                       l->reconnects++;
-                                       }
-                                       /* if RX key */
-                                       if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
-                                       {
-                                               if (debug == 7 ) printf("@@@@ rx key\n");
-                                               l->lastrealrx = 1;
-                                               l->rerxtimer = 0;
-                                               if (!l->lastrx1)
-                                               {
-                                                       if (myrpt->p.archivedir)
-                                                       {
-                                                               char str[100];
-
-                                                               sprintf(str,"RXKEY,%s",l->name);
-                                                               donodelog(myrpt,str);
-                                                       }
-                                                       l->lastrx1 = 1;
-                                               }
-                                       }
-                                       /* if RX un-key */
-                                       if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
-                                       {
-                                               if (debug == 7) printf("@@@@ rx un-key\n");
-                                               l->lastrealrx = 0;
-                                               l->rerxtimer = 0;
-                                               if (l->lastrx1)
-                                               {
-                                                       if (myrpt->p.archivedir)
-                                                       {
-                                                               char str[100];
-
-                                                               sprintf(str,"RXUNKEY,%s",l->name);
-                                                               donodelog(myrpt,str);
-                                                       }
-                                                       l->lastrx1 = 0;
-                                                       if(myrpt->p.duplex) 
-                                                               rpt_telemetry(myrpt,LINKUNKEY,l);
-                                               }
-                                       }
-                                       if (f->subclass.integer == AST_CONTROL_HANGUP)
-                                       {
-                                               ast_frfree(f);
-                                               rpt_mutex_lock(&myrpt->lock);
-                                               __kickshort(myrpt);
-                                               rpt_mutex_unlock(&myrpt->lock);
-                                               if ((!l->outbound) && (!l->disced))
-                                               {
-                                                       if ((l->name[0] == '0') || l->isremote)
-                                                               l->disctime = 1;
-                                                       else
-                                                               l->disctime = DISC_TIME;
-                                                       rpt_mutex_lock(&myrpt->lock);
-                                                       ast_hangup(l->chan);
-                                                       l->chan = 0;
-                                                       break;
-                                               }
-                                               if (l->retrytimer) 
-                                               {
-                                                       if (l->chan) ast_hangup(l->chan);
-                                                       l->chan = 0;
-                                                       rpt_mutex_lock(&myrpt->lock);
-                                                       break;
-                                               }
-                                               if (l->outbound && (l->retries++ < l->max_retries) && (l->hasconnected))
-                                               {
-                                                       rpt_mutex_lock(&myrpt->lock);
-                                                       if (l->chan) ast_hangup(l->chan);
-                                                       l->chan = 0;
-                                                       l->hasconnected = 1;
-                                                       l->elaptime = 0;
-                                                       l->retrytimer = RETRY_TIMER_MS;
-                                                       l->connecttime = 0;
-                                                       l->thisconnected = 0;
-                                                       break;
-                                               }
-                                               rpt_mutex_lock(&myrpt->lock);
-                                               /* remove from queue */
-                                               remque((struct qelem *) l);
-                                               if (!strcmp(myrpt->cmdnode,l->name))
-                                                       myrpt->cmdnode[0] = 0;
-                                               __kickshort(myrpt);
-                                               rpt_mutex_unlock(&myrpt->lock);
-                                               if (!l->hasconnected)
-                                                       rpt_telemetry(myrpt,CONNFAIL,l);
-                                               else if (l->disced != 2) rpt_telemetry(myrpt,REMDISC,l);
-                                               if (myrpt->p.archivedir)
-                                               {
-                                                       char str[100];
-
-                                                       if (!l->hasconnected)
-                                                               sprintf(str,"LINKFAIL,%s",l->name);
-                                                       else
-                                                               sprintf(str,"LINKDISC,%s",l->name);
-                                                       donodelog(myrpt,str);
-                                               }
-                                               if (l->lastf1) ast_frfree(l->lastf1);
-                                               l->lastf1 = NULL;
-                                               if (l->lastf2) ast_frfree(l->lastf2);
-                                               l->lastf2 = NULL;
-                                               /* hang-up on call to device */
-                                               ast_hangup(l->chan);
-                                               ast_hangup(l->pchan);
-                                               ast_free(l);
-                                               rpt_mutex_lock(&myrpt->lock);
-                                               break;
-                                       }
-                               }
-                               ast_frfree(f);
-                               rpt_mutex_lock(&myrpt->lock);
-                               break;
-                       }
-                       if (who == l->pchan) 
-                       {
-                               rpt_mutex_unlock(&myrpt->lock);
-                               f = ast_read(l->pchan);
-                               if (!f)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       toexit = 1;
-                                       rpt_mutex_lock(&myrpt->lock);
-                                       break;
-                               }
-                               if (f->frametype == AST_FRAME_VOICE)
-                               {
-                                       if (l->chan) ast_write(l->chan,f);
-                               }
-                               if (f->frametype == AST_FRAME_CONTROL)
-                               {
-                                       if (f->subclass.integer == AST_CONTROL_HANGUP)
-                                       {
-                                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                                               ast_frfree(f);
-                                               toexit = 1;
-                                               rpt_mutex_lock(&myrpt->lock);
-                                               break;
-                                       }
-                               }
-                               ast_frfree(f);
-                               rpt_mutex_lock(&myrpt->lock);
-                               break;
-                       }
-                       l = l->next;
-               }
-               rpt_mutex_unlock(&myrpt->lock);
-               if (toexit) break;
-               if (who == myrpt->monchannel) 
-               {
-                       f = ast_read(myrpt->monchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               if (myrpt->monstream) 
-                                       ast_writestream(myrpt->monstream,f);
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (myrpt->parrotchannel && (who == myrpt->parrotchannel))
-               {
-                       f = ast_read(myrpt->parrotchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (!myrpt->p.parrotmode)
-                       {
-                               char myfname[300];
-
-                               if (myrpt->parrotstream)
-                               {
-                                       ast_closestream(myrpt->parrotstream);
-                                       myrpt->parrotstream = 0;
-                               }
-                               sprintf(myfname,PARROTFILE,myrpt->name,myrpt->parrotcnt);
-                               strcat(myfname,".wav");
-                               unlink(myfname);                        
-                       } else if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               if (myrpt->parrotstream) 
-                                       ast_writestream(myrpt->parrotstream,f);
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (myrpt->voxchannel && (who == myrpt->voxchannel))
-               {
-                       f = ast_read(myrpt->voxchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               n = dovox(&myrpt->vox,f->data.ptr,f->datalen / 2);
-                               if (n != myrpt->wasvox)
-                               {
-                                       ast_debug(1,"Node %s, vox %d\n",myrpt->name,n);
-                                       myrpt->wasvox = n;
-                                       myrpt->voxtostate = 0;
-                                       if (n) myrpt->voxtotimer = myrpt->p.voxtimeout_ms;
-                                       else myrpt->voxtotimer = 0;
-                               }
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (who == myrpt->txpchannel) /* if it was a read from remote tx */
-               {
-                       f = ast_read(myrpt->txpchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ rpt:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-       }
-       usleep(100000);
-       ast_hangup(myrpt->pchannel);
-       ast_hangup(myrpt->monchannel);
-       if (myrpt->parrotchannel) ast_hangup(myrpt->parrotchannel);
-       myrpt->parrotstate = 0;
-       if (myrpt->voxchannel) ast_hangup(myrpt->voxchannel);
-       ast_hangup(myrpt->txpchannel);
-       if (myrpt->txchannel != myrpt->rxchannel) ast_hangup(myrpt->txchannel);
-       if (myrpt->dahditxchannel != myrpt->txchannel) ast_hangup(myrpt->dahditxchannel);
-       if (myrpt->lastf1) ast_frfree(myrpt->lastf1);
-       myrpt->lastf1 = NULL;
-       if (myrpt->lastf2) ast_frfree(myrpt->lastf2);
-       myrpt->lastf2 = NULL;
-       ast_hangup(myrpt->rxchannel);
-       rpt_mutex_lock(&myrpt->lock);
-       l = myrpt->links.next;
-       while(l != &myrpt->links)
-       {
-               struct rpt_link *ll = l;
-               /* remove from queue */
-               remque((struct qelem *) l);
-               /* hang-up on call to device */
-               if (l->chan) ast_hangup(l->chan);
-               ast_hangup(l->pchan);
-               l = l->next;
-               ast_free(ll);
-       }
-       if (myrpt->xlink  == 1) myrpt->xlink = 2;
-       rpt_mutex_unlock(&myrpt->lock);
-       if (debug) printf("@@@@ rpt:Hung up channel\n");
-       myrpt->rpt_thread = AST_PTHREADT_STOP;
-       pthread_exit(NULL); 
-       return NULL;
-}
-
-       
-static void *rpt_master(void *ignore)
-{
-int    i,n;
-pthread_attr_t attr;
-struct ast_config *cfg;
-char *this,*val;
-
-       /* init nodelog queue */
-       nodelog.next = nodelog.prev = &nodelog;
-       /* go thru all the specified repeaters */
-       this = NULL;
-       n = 0;
-#ifndef OLD_ASTERISK
-       /* wait until asterisk starts */
-        while(!ast_test_flag(&ast_options,AST_OPT_FLAG_FULLY_BOOTED))
-                usleep(250000);
-#endif
-#ifdef NEW_ASTERISK
-       rpt_vars[n].cfg = ast_config_load("rpt.conf",config_flags);
-#else
-       rpt_vars[n].cfg = ast_config_load("rpt.conf");
-#endif
-       cfg = rpt_vars[n].cfg;
-       if (!cfg || cfg == CONFIG_STATUS_FILEINVALID) {
-               ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf.  Radio Repeater disabled.\n");
-               pthread_exit(NULL);
-       }
-       while((this = ast_category_browse(cfg,this)) != NULL)
-       {
-               for(i = 0 ; i < strlen(this) ; i++){
-                       if((this[i] < '0') || (this[i] > '9'))
-                               break;
-               }
-               if(i != strlen(this)) continue; /* Not a node defn */
-               memset(&rpt_vars[n],0,sizeof(rpt_vars[n]));
-               rpt_vars[n].name = ast_strdup(this);
-               val = (char *) ast_variable_retrieve(cfg,this,"rxchannel");
-               if (val) rpt_vars[n].rxchanname = ast_strdup(val);
-               val = (char *) ast_variable_retrieve(cfg,this,"txchannel");
-               if (val) rpt_vars[n].txchanname = ast_strdup(val);
-               rpt_vars[n].remote = 0;
-               rpt_vars[n].remoterig = "";
-               val = (char *) ast_variable_retrieve(cfg,this,"remote");
-               if (val) 
-               {
-                       rpt_vars[n].remoterig = ast_strdup(val);
-                       rpt_vars[n].remote = 1;
-               }
-               val = (char *) ast_variable_retrieve(cfg,this,"radiotype");
-               if (val) rpt_vars[n].remoterig = ast_strdup(val);
-               ast_mutex_init(&rpt_vars[n].lock);
-               ast_mutex_init(&rpt_vars[n].remlock);
-               ast_mutex_init(&rpt_vars[n].statpost_lock);
-               rpt_vars[n].tele.next = &rpt_vars[n].tele;
-               rpt_vars[n].tele.prev = &rpt_vars[n].tele;
-               rpt_vars[n].rpt_thread = AST_PTHREADT_NULL;
-               rpt_vars[n].tailmessagen = 0;
-#ifdef _MDC_DECODE_H_
-               rpt_vars[n].mdc = mdc_decoder_new(8000);
-#endif
-               n++;
-       }
-       nrpts = n;
-       ast_config_destroy(cfg);
-
-       /* start em all */
-       for(i = 0; i < n; i++)
-       {
-               load_rpt_vars(i,1);
-
-               /* if is a remote, don't start one for it */
-               if (rpt_vars[i].remote)
-               {
-                       if(retreive_memory(&rpt_vars[i],"init")){ /* Try to retreive initial memory channel */
-                               if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx450))
-                                       strncpy(rpt_vars[i].freq, "446.500", sizeof(rpt_vars[i].freq) - 1);
-                               else
-                                       strncpy(rpt_vars[i].freq, "146.580", sizeof(rpt_vars[i].freq) - 1);
-                               strncpy(rpt_vars[i].rxpl, "100.0", sizeof(rpt_vars[i].rxpl) - 1);
-
-                               strncpy(rpt_vars[i].txpl, "100.0", sizeof(rpt_vars[i].txpl) - 1);
-                               rpt_vars[i].remmode = REM_MODE_FM;
-                               rpt_vars[i].offset = REM_SIMPLEX;
-                               rpt_vars[i].powerlevel = REM_LOWPWR;
-                       }
-                       continue;
-               }
-               else /* is a normal repeater */
-               {
-                   rpt_vars[i].p.memory = rpt_vars[i].name;
-                       if(retreive_memory(&rpt_vars[i],"radiofreq")){ /* Try to retreive initial memory channel */
-                               if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx450))
-                                       strncpy(rpt_vars[i].freq, "446.500", sizeof(rpt_vars[i].freq) - 1);
-                               else if (!strcmp(rpt_vars[i].remoterig,remote_rig_rtx150))
-                                       strncpy(rpt_vars[i].freq, "146.580", sizeof(rpt_vars[i].freq) - 1);
-                               strncpy(rpt_vars[i].rxpl, "100.0", sizeof(rpt_vars[i].rxpl) - 1);
-
-                               strncpy(rpt_vars[i].txpl, "100.0", sizeof(rpt_vars[i].txpl) - 1);
-                               rpt_vars[i].remmode = REM_MODE_FM;
-                               rpt_vars[i].offset = REM_SIMPLEX;
-                               rpt_vars[i].powerlevel = REM_LOWPWR;
-                       }
-                       ast_log(LOG_NOTICE,"Normal Repeater Init  %s  %s  %s\n",rpt_vars[i].name, rpt_vars[i].remoterig, rpt_vars[i].freq);
-               }
-               if (!rpt_vars[i].p.ident)
-               {
-                       ast_log(LOG_WARNING,"Did not specify ident for node %s\n",rpt_vars[i].name);
-                       ast_config_destroy(cfg);
-                       pthread_exit(NULL);
-               }
-               pthread_attr_init(&attr);
-               pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-               ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
-       }
-       usleep(500000);
-       time(&starttime);
-       for(;;)
-       {
-               /* Now monitor each thread, and restart it if necessary */
-               for(i = 0; i < n; i++)
-               { 
-                       int rv;
-                       if (rpt_vars[i].remote) continue;
-                       if (rpt_vars[i].rpt_thread == AST_PTHREADT_STOP) 
-                               rv = -1;
-                       else
-                               rv = pthread_kill(rpt_vars[i].rpt_thread,0);
-                       if (rv)
-                       {
-                               if(time(NULL) - rpt_vars[i].lastthreadrestarttime <= 15)
-                               {
-                                       if(rpt_vars[i].threadrestarts >= 5)
-                                       {
-                                               ast_log(LOG_ERROR,"Continual RPT thread restarts, killing Asterisk\n");
-                                               exit(1); /* Stuck in a restart loop, kill Asterisk and start over */
-                                       }
-                                       else
-                                       {
-                                               ast_log(LOG_NOTICE,"RPT thread restarted on %s\n",rpt_vars[i].name);
-                                               rpt_vars[i].threadrestarts++;
-                                       }
-                               }
-                               else
-                                       rpt_vars[i].threadrestarts = 0;
-
-                               rpt_vars[i].lastthreadrestarttime = time(NULL);
-                               pthread_attr_init(&attr);
-                               pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-                               ast_pthread_create(&rpt_vars[i].rpt_thread,&attr,rpt,(void *) &rpt_vars[i]);
-                               /* if (!rpt_vars[i].xlink) */
-                                       ast_log(LOG_WARNING, "rpt_thread restarted on node %s\n", rpt_vars[i].name);
-                       }
-
-               }
-               for(;;)
-               {
-                       struct nodelog *nodep;
-                       char *space,datestr[100],fname[300];
-                       int fd;
-
-                       ast_mutex_lock(&nodeloglock);
-                       nodep = nodelog.next;
-                       if(nodep == &nodelog) /* if nothing in queue */
-                       {
-                               ast_mutex_unlock(&nodeloglock);
-                               break;
-                       }
-                       remque((struct qelem *)nodep);
-                       ast_mutex_unlock(&nodeloglock);
-                       space = strchr(nodep->str,' ');
-                       if (!space) 
-                       {
-                               ast_free(nodep);
-                               continue;
-                       }
-                       *space = 0;
-                       strftime(datestr,sizeof(datestr) - 1,"%Y%m%d",
-                               localtime(&nodep->timestamp));
-                       sprintf(fname,"%s/%s/%s.txt",nodep->archivedir,
-                               nodep->str,datestr);
-                       fd = open(fname,O_WRONLY | O_CREAT | O_APPEND,0600);
-                       if (fd == -1)
-                       {
-                               ast_log(LOG_ERROR,"Cannot open node log file %s for write",space + 1);
-                               ast_free(nodep);
-                               continue;
-                       }
-                       if (write(fd,space + 1,strlen(space + 1)) !=
-                               strlen(space + 1))
-                       {
-                               ast_log(LOG_ERROR,"Cannot write node log file %s for write",space + 1);
-                               ast_free(nodep);
-                               continue;
-                       }
-                       close(fd);
-                       ast_free(nodep);
-               }
-               sleep(2);
-       }
-       ast_config_destroy(cfg);
-       pthread_exit(NULL);
-}
-
-static int rpt_exec(struct ast_channel *chan, const char *data)
-{
-       int res=-1,i,rem_totx,rem_rx,remkeyed,n,phone_mode = 0;
-       int iskenwood_pci4,authtold,authreq,setting,notremming,reming;
-       int ismuted,dtmfed,phone_vox = 0;
-#ifdef OLD_ASTERISK
-       struct localuser *u;
-#endif
-       char tmp[256], keyed = 0,keyed1 = 0;
-       char *options,*stringp,*tele,c,*altp,*memp;
-       char sx[320],*sy;
-       struct  rpt *myrpt;
-       struct ast_frame *f,*f1,*f2;
-       struct ast_channel *who;
-       struct ast_channel *cs[20];
-       struct  rpt_link *l;
-       struct dahdi_confinfo ci;  /* conference info */
-       struct dahdi_params par;
-       int ms,elap,nullfd;
-       time_t t,last_timeout_warning;
-       struct  dahdi_radio_param z;
-       struct rpt_tele *telem;
-       int     numlinks;
-       struct ast_format_cap *cap = NULL;
-
-       nullfd = open("/dev/null",O_RDWR);
-       if (ast_strlen_zero(data)) {
-               ast_log(LOG_WARNING, "Rpt requires an argument (system node)\n");
-               return -1;
-       }
-
-       strncpy(tmp, (char *)data, sizeof(tmp)-1);
-       time(&t);
-       /* if time has externally shifted negative, screw it */
-       if (t < starttime) t = starttime + START_DELAY;
-       if ((!starttime) || (t < (starttime + START_DELAY)))
-       {
-               ast_log(LOG_NOTICE,"Node %s rejecting call: too soon!\n",tmp);
-               ast_safe_sleep(chan,3000);
-               return -1;
-       }
-
-       ast_log(LOG_NOTICE,"parsing argument=%s \n",tmp);
-
-       altp=strstr(tmp, "|*");
-       if(altp){
-               altp[0]=0;
-               altp++;
-    }
-
-       memp=strstr(tmp, "|M");
-       if(memp){
-               memp[0]=0;
-               memp+=2;
-    }
-
-       stringp=tmp;
-       strsep(&stringp, "|");
-       options = stringp;
-
-       ast_log(LOG_NOTICE,"options=%s \n",options);
-       if(memp>0)ast_log(LOG_NOTICE,"memp=%s \n",memp);
-       if(altp>0)ast_log(LOG_NOTICE,"altp=%s \n",altp);
-
-       myrpt = NULL;
-       /* see if we can find our specified one */
-       for(i = 0; i < nrpts; i++)
-       {
-               /* if name matches, assign it and exit loop */
-               if (!strcmp(tmp,rpt_vars[i].name))
-               {
-                       myrpt = &rpt_vars[i];
-                       break;
-               }
-       }
-
-       pbx_builtin_setvar_helper(chan, "RPT_STAT_ERR", "");
-
-       if (myrpt == NULL)
-       {
-               pbx_builtin_setvar_helper(chan, "RPT_STAT_ERR", "NODE_NOT_FOUND");
-               ast_log(LOG_WARNING, "Cannot find specified system node %s\n",tmp);
-               return (priority_jump(NULL,chan));
-       }
-
-       numlinks=linkcount(myrpt);
-
-       if(options && *options == 'q')
-       {
-               char buf2[128];
-
-               if(myrpt->keyed)
-                       pbx_builtin_setvar_helper(chan, "RPT_STAT_RXKEYED", "1");
-               else
-                       pbx_builtin_setvar_helper(chan, "RPT_STAT_RXKEYED", "0");       
-
-               if(myrpt->txkeyed)
-                       pbx_builtin_setvar_helper(chan, "RPT_STAT_TXKEYED", "1");
-               else
-                       pbx_builtin_setvar_helper(chan, "RPT_STAT_TXKEYED", "0");       
-
-               snprintf(buf2,sizeof(buf2),"%s=%i", "RPT_STAT_XLINK", myrpt->xlink);
-               pbx_builtin_setvar(chan, buf2);
-               snprintf(buf2,sizeof(buf2),"%s=%i", "RPT_STAT_LINKS", numlinks);
-               pbx_builtin_setvar(chan, buf2);
-               snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_WASCHAN", myrpt->waschan);
-               pbx_builtin_setvar(chan, buf2);
-               snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_NOWCHAN", myrpt->nowchan);
-               pbx_builtin_setvar(chan, buf2);
-               snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_DUPLEX", myrpt->p.duplex);
-               pbx_builtin_setvar(chan, buf2);
-               snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_PARROT", myrpt->p.parrotmode);
-               pbx_builtin_setvar(chan, buf2);
-               //snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_PHONEVOX", myrpt->phonevox);
-               //pbx_builtin_setvar(chan, buf2);
-               //snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_CONNECTED", myrpt->connected);
-               //pbx_builtin_setvar(chan, buf2);
-               snprintf(buf2,sizeof(buf2),"%s=%d", "RPT_STAT_CALLMODE", myrpt->callmode);
-               pbx_builtin_setvar(chan, buf2);
-               snprintf(buf2,sizeof(buf2),"%s=%s", "RPT_STAT_LASTTONE", myrpt->lasttone);
-               pbx_builtin_setvar(chan, buf2);
-
-               return priority_jump(myrpt,chan);
-       }
-
-       if(options && *options == 'o')
-       {
-               return(channel_revert(myrpt));
-       }
-
-       #if 0
-       if((altp)&&(*options == 'Z'))
-       {
-               rpt_push_alt_macro(myrpt,altp);
-               return 0;
-       }
-       #endif
-
-
-       /* if not phone access, must be an IAX connection */
-       if (options && ((*options == 'P') || (*options == 'D') || (*options == 'R') || (*options == 'S')))
-       {
-               int val;
-
-               pbx_builtin_setvar_helper(chan, "RPT_STAT_BUSY", "0");
-                
-               myrpt->bargechan=0;
-               if(options && strstr(options, "f")>0)
-               {
-                       myrpt->bargechan=1;             
-               }
-
-               if(memp>0)
-               {
-                       char radiochan;
-                       radiochan=strtod(data,NULL);
-                       // if(myrpt->nowchan!=0 && radiochan!=myrpt->nowchan && !myrpt->bargechan)
-
-                       if(numlinks>0 && radiochan!=myrpt->nowchan && !myrpt->bargechan)
-                       {
-                               pbx_builtin_setvar_helper(chan, "RPT_STAT_BUSY", "1");
-                               ast_log(LOG_NOTICE, "Radio Channel Busy.\n");
-                               return (priority_jump(myrpt,chan));
-                       }
-                       else if(radiochan!=myrpt->nowchan || myrpt->bargechan)
-                       {
-                               channel_steer(myrpt,memp);      
-                       }
-               }
-               if(altp)rpt_push_alt_macro(myrpt,altp);
-               phone_mode = 1;
-               if (*options == 'D') phone_mode = 2;
-               if (*options == 'S') phone_mode = 3;
-               ast_set_callerid(chan,"0","app_rpt user","0");
-               val = 1;
-               ast_channel_setoption(chan,AST_OPTION_TONE_VERIFY,&val,sizeof(char),0);
-               if ((*(options + 1) == 'V') || (*(options + 1) == 'v')) phone_vox = 1;
-       }
-       else
-       {
-#ifdef ALLOW_LOCAL_CHANNELS
-               /* Check to insure the connection is IAX2 or Local*/
-               if ( (strncmp(chan->name,"IAX2",4)) && (strncmp(chan->name,"Local",5)) ) {
-                   ast_log(LOG_WARNING, "We only accept links via IAX2 or Local!!\n");
-                   return -1;
-               }
-#else
-               if (strncmp(chan->name,"IAX2",4))
-               {
-                       ast_log(LOG_WARNING, "We only accept links via IAX2!!\n");
-                       return -1;
-               }
-#endif
-               if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable){ /* Do not allow incoming radio connections if disabled */
-                       ast_log(LOG_NOTICE, "Connect attempt to node %s  with tx disabled", myrpt->name);
-                       return -1;
-               }       
-       }
-       if (options && (*options == 'R'))
-       {
-               /* Parts of this section taken from app_parkandannounce */
-               char *return_context;
-               int length, m, lot, timeout = 0;
-               char buffer[256],*template;
-               char *working, *context, *exten, *priority;
-               char *s,*orig_s;
-
-               rpt_mutex_lock(&myrpt->lock);
-               m = myrpt->callmode;
-               rpt_mutex_unlock(&myrpt->lock);
-
-               if ((!myrpt->p.nobusyout) && m)
-               {
-                       if (chan->_state != AST_STATE_UP)
-                       {
-                               ast_indicate(chan,AST_CONTROL_BUSY);
-                       }
-                       while(ast_safe_sleep(chan,10000) != -1);
-                       return -1;
-               }
-
-               if (chan->_state != AST_STATE_UP)
-               {
-                       ast_answer(chan);
-                       if (!phone_mode) send_newkey(chan);
-               }
-
-               length=strlen(options)+2;
-               orig_s=ast_malloc(length);
-               if(!orig_s) {
-                       ast_log(LOG_WARNING, "Out of memory\n");
-                       return -1;
-               }
-               s=orig_s;
-               strncpy(s,options,length);
-
-               template=strsep(&s,"|");
-               if(!template) {
-                       ast_log(LOG_WARNING, "An announce template must be defined\n");
-                       ast_free(orig_s);
-                       return -1;
-               } 
-  
-               if(s) {
-                       timeout = atoi(strsep(&s, "|"));
-                       timeout *= 1000;
-               }
-       
-               return_context = s;
-  
-               if(return_context != NULL) {
-                       /* set the return context. Code borrowed from the Goto builtin */
-    
-                       working = return_context;
-                       context = strsep(&working, "|");
-                       exten = strsep(&working, "|");
-                       if(!exten) {
-                               /* Only a priority in this one */
-                               priority = context;
-                               exten = NULL;
-                               context = NULL;
-                       } else {
-                               priority = strsep(&working, "|");
-                               if(!priority) {
-                                       /* Only an extension and priority in this one */
-                                       priority = exten;
-                                       exten = context;
-                                       context = NULL;
-                       }
-               }
-               if(atoi(priority) < 0) {
-                       ast_log(LOG_WARNING, "Priority '%s' must be a number > 0\n", priority);
-                       ast_free(orig_s);
-                       return -1;
-               }
-               /* At this point we have a priority and maybe an extension and a context */
-               chan->priority = atoi(priority);
-#ifdef OLD_ASTERISK
-               if(exten && strcasecmp(exten, "BYEXTENSION"))
-#else
-               if(exten)
-#endif
-                       strncpy(chan->exten, exten, sizeof(chan->exten)-1);
-               if(context)
-                       strncpy(chan->context, context, sizeof(chan->context)-1);
-               } else {  /* increment the priority by default*/
-                       chan->priority++;
-               }
-
-               if(option_verbose > 2) {
-                       ast_verbose(VERBOSE_PREFIX_3 "Return Context: (%s,%s,%d) ID: %s\n",
-                               chan->context, chan->exten, chan->priority,
-                               S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, ""));
-                       if(!ast_exists_extension(chan, chan->context, chan->exten, chan->priority,
-                               S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL))) {
-                               ast_verbose( VERBOSE_PREFIX_3 "Warning: Return Context Invalid, call will return to default|s\n");
-                       }
-               }
-  
-               /* we are using masq_park here to protect * from touching the channel once we park it.  If the channel comes out of timeout
-               before we are done announcing and the channel is messed with, Kablooeee.  So we use Masq to prevent this.  */
-
-               ast_masq_park_call(chan, NULL, timeout, &lot);
-
-               if (option_verbose > 2) ast_verbose( VERBOSE_PREFIX_3 "Call Parking Called, lot: %d, timeout: %d, context: %s\n", lot, timeout, return_context);
-
-               snprintf(buffer, sizeof(buffer) - 1, "%d,%s", lot, template + 1);
-
-               rpt_telemetry(myrpt,REV_PATCH,buffer);
-
-               ast_free(orig_s);
-
-               return 0;
-
-       }
-
-       if (!options)
-       {
-        struct ast_hostent ahp;
-        struct hostent *hp;
-        struct in_addr ia;
-        char hisip[100],nodeip[100],*val, *s, *s1, *s2, *s3, *b,*b1;
-
-               /* look at callerid to see what node this comes from */
-               b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL);
-               if (!b) /* if doesn't have caller id */
-               {
-                       ast_log(LOG_WARNING, "Does not have callerid on %s\n",tmp);
-                       return -1;
-               }
-               /* get his IP from IAX2 module */
-               memset(hisip,0,sizeof(hisip));
-#ifdef ALLOW_LOCAL_CHANNELS
-        /* set IP address if this is a local connection*/
-        if (strncmp(chan->name,"Local",5)==0) {
-            strcpy(hisip,"127.0.0.1");
-        } else {
-                       pbx_substitute_variables_helper(chan,"${IAXPEER(CURRENTCHANNEL)}",hisip,sizeof(hisip) - 1);
-               }
-#else
-               pbx_substitute_variables_helper(chan,"${IAXPEER(CURRENTCHANNEL)}",hisip,sizeof(hisip) - 1);
-#endif
-
-               if (!hisip[0])
-               {
-                       ast_log(LOG_WARNING, "Link IP address cannot be determined!!\n");
-                       return -1;
-               }
-               
-               b1 = ast_strdupa(b);
-               ast_shrink_phone_number(b1);
-               if (!strcmp(myrpt->name,b1))
-               {
-                       ast_log(LOG_WARNING, "Trying to link to self!!\n");
-                       return -1;
-               }
-
-               if (*b1 < '1')
-               {
-                       ast_log(LOG_WARNING, "Node %s Invalid for connection here!!\n",b1);
-                       return -1;
-               }
-
-
-               /* look for his reported node string */
-               val = node_lookup(myrpt,b1);
-               if (!val)
-               {
-                       ast_log(LOG_WARNING, "Reported node %s cannot be found!!\n",b1);
-                       return -1;
-               }
-               strncpy(tmp,val,sizeof(tmp) - 1);
-               s = tmp;
-               s1 = strsep(&s,",");
-               if (!strchr(s1,':') && strchr(s1,'/') && strncasecmp(s1, "local/", 6))
-               {
-                       sy = strchr(s1,'/');            
-                       *sy = 0;
-                       sprintf(sx,"%s:4569/%s",s1,sy + 1);
-                       s1 = sx;
-               }
-               s2 = strsep(&s,",");
-               if (!s2)
-               {
-                       ast_log(LOG_WARNING, "Reported node %s not in correct format!!\n",b1);
-                       return -1;
-               }
-                if (strcmp(s2,"NONE")) {
-                       hp = ast_gethostbyname(s2, &ahp);
-                       if (!hp)
-                       {
-                               ast_log(LOG_WARNING, "Reported node %s, name %s cannot be found!!\n",b1,s2);
-                               return -1;
-                       }
-                       memcpy(&ia,hp->h_addr,sizeof(in_addr_t));
-#ifdef OLD_ASTERISK
-                       ast_inet_ntoa(nodeip,sizeof(nodeip) - 1,ia);
-#else
-                       strncpy(nodeip,ast_inet_ntoa(ia),sizeof(nodeip) - 1);
-#endif
-                       s3 = strchr(hisip,':');
-                       if (s3) *s3 = 0;
-                       if (strcmp(hisip,nodeip))
-                       {
-                               s3 = strchr(s1,'@');
-                               if (s3) s1 = s3 + 1;
-                               s3 = strchr(s1,'/');
-                               if (s3) *s3 = 0;
-                               s3 = strchr(s1,':');
-                               if (s3) *s3 = 0;
-                               hp = ast_gethostbyname(s1, &ahp);
-                               if (!hp)
-                               {
-                                       ast_log(LOG_WARNING, "Reported node %s, name %s cannot be found!!\n",b1,s1);
-                                       return -1;
-                               }
-                               memcpy(&ia,hp->h_addr,sizeof(in_addr_t));
-#ifdef OLD_ASTERISK
-                               ast_inet_ntoa(nodeip,sizeof(nodeip) - 1,ia);
-#else
-                               strncpy(nodeip,ast_inet_ntoa(ia),sizeof(nodeip) - 1);
-#endif
-                               if (strcmp(hisip,nodeip))
-                               {
-                                       ast_log(LOG_WARNING, "Node %s IP %s does not match link IP %s!!\n",b1,nodeip,hisip);
-                                       return -1;
-                               }
-                       }
-               }
-       }
-
-       /* if is not a remote */
-       if (!myrpt->remote)
-       {
-               char *b,*b1;
-               int reconnects = 0;
-
-               rpt_mutex_lock(&myrpt->lock);
-               i = myrpt->xlink;
-               rpt_mutex_unlock(&myrpt->lock);
-               if (i)
-               {
-                       ast_log(LOG_WARNING, "Cannot connect to node %s, system busy\n",myrpt->name);
-                       return -1;
-               }
-               /* look at callerid to see what node this comes from */
-               b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL);
-               if (!b) /* if doesn't have caller id */
-               {
-                       ast_log(LOG_WARNING, "Doesnt have callerid on %s\n",tmp);
-                       return -1;
-               }
-
-               b1 = ast_strdupa(b);
-               ast_shrink_phone_number(b1);
-               if (!strcmp(myrpt->name,b1))
-               {
-                       ast_log(LOG_WARNING, "Trying to link to self!!\n");
-                       return -1;
-               }
-               rpt_mutex_lock(&myrpt->lock);
-               l = myrpt->links.next;
-               /* try to find this one in queue */
-               while(l != &myrpt->links)
-               {
-                       if (l->name[0] == '0') 
-                       {
-                               l = l->next;
-                               continue;
-                       }
-                       /* if found matching string */
-                       if (!strcmp(l->name,b1)) break;
-                       l = l->next;
-               }
-               /* if found */
-               if (l != &myrpt->links) 
-               {
-                       l->killme = 1;
-                       l->retries = l->max_retries + 1;
-                       l->disced = 2;
-                       reconnects = l->reconnects;
-                       reconnects++;
-                        rpt_mutex_unlock(&myrpt->lock);
-                       usleep(500000); 
-               } else 
-                       rpt_mutex_unlock(&myrpt->lock);
-               /* establish call in tranceive mode */
-               l = ast_malloc(sizeof(struct rpt_link));
-               if (!l)
-               {
-                       ast_log(LOG_WARNING, "Unable to malloc\n");
-                       pthread_exit(NULL);
-               }
-               /* zero the silly thing */
-               memset((char *)l,0,sizeof(struct rpt_link));
-               l->mode = 1;
-               strncpy(l->name,b1,MAXNODESTR - 1);
-               l->isremote = 0;
-               l->chan = chan;
-               l->connected = 1;
-               l->thisconnected = 1;
-               l->hasconnected = 1;
-               l->reconnects = reconnects;
-               l->phonemode = phone_mode;
-               l->phonevox = phone_vox;
-               l->lastf1 = NULL;
-               l->lastf2 = NULL;
-               l->dtmfed = 0;
-               voxinit_link(l,1);
-               ast_set_read_format_by_id(l->chan,AST_FORMAT_SLINEAR);
-               ast_set_write_format_by_id(l->chan,AST_FORMAT_SLINEAR);
-               /* allocate a pseudo-channel thru asterisk */
-               l->pchan = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-               cap = ast_format_cap_destroy(cap);
-               if (!l->pchan)
-               {
-                       fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-                       pthread_exit(NULL);
-               }
-               ast_set_read_format_by_id(l->pchan,AST_FORMAT_SLINEAR);
-               ast_set_write_format_by_id(l->pchan,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-               if (l->pchan->cdr)
-                       ast_set_flag(l->pchan->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-               /* make a conference for the tx */
-               ci.chan = 0;
-               ci.confno = myrpt->conf;
-               ci.confmode = DAHDI_CONF_CONF | DAHDI_CONF_LISTENER | DAHDI_CONF_TALKER;
-               /* first put the channel on the conference in proper mode */
-               if (ioctl(l->pchan->fds[0],DAHDI_SETCONF,&ci) == -1)
-               {
-                       ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-                       pthread_exit(NULL);
-               }
-               rpt_mutex_lock(&myrpt->lock);
-               if ((phone_mode == 2) && (!phone_vox)) l->lastrealrx = 1;
-               l->max_retries = MAX_RETRIES;
-               /* insert at end of queue */
-               insque((struct qelem *)l,(struct qelem *)myrpt->links.next);
-               __kickshort(myrpt);
-               rpt_mutex_unlock(&myrpt->lock);
-               if (chan->_state != AST_STATE_UP) {
-                       ast_answer(chan);
-                       if (!phone_mode) send_newkey(chan);
-               }
-               if (myrpt->p.archivedir)
-               {
-                       char str[100];
-
-                       if (l->phonemode)
-                               sprintf(str,"LINK(P),%s",l->name);
-                       else
-                               sprintf(str,"LINK,%s",l->name);
-                       donodelog(myrpt,str);
-               }
-               if (!phone_mode) send_newkey(chan);
-               return 0;
-       }
-       /* well, then it is a remote */
-       rpt_mutex_lock(&myrpt->lock);
-       /* if remote, error if anyone else already linked */
-       if (myrpt->remoteon)
-       {
-               rpt_mutex_unlock(&myrpt->lock);
-               usleep(500000);
-               if (myrpt->remoteon)
-               {
-                       ast_log(LOG_WARNING, "Trying to use busy link on %s\n",tmp);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-                       if (chan->cdr)
-                               ast_set_flag(chan->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-                       return -1;
-               }               
-               rpt_mutex_lock(&myrpt->lock);
-       }
-       if (myrpt->p.rptnode)
-       {
-               char killedit = 0;
-               time_t now;
-
-               time(&now);
-               for(i = 0; i < nrpts; i++)
-               {
-                       if (!strcasecmp(rpt_vars[i].name,myrpt->p.rptnode))
-                       {
-                               if ((rpt_vars[i].links.next != &rpt_vars[i].links) ||
-                                  rpt_vars[i].keyed ||
-                                   ((rpt_vars[i].lastkeyedtime + RPT_LOCKOUT_SECS) > now) ||
-                                    rpt_vars[i].txkeyed ||
-                                     ((rpt_vars[i].lasttxkeyedtime + RPT_LOCKOUT_SECS) > now))
-                               {
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       ast_log(LOG_WARNING, "Trying to use busy link (repeater node %s) on %s\n",rpt_vars[i].name,tmp);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-                                       if (chan->cdr)
-                                               ast_set_flag(chan->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-                                       return -1;
-                               }
-                               while(rpt_vars[i].xlink != 3)
-                               {
-                                       if (!killedit)
-                                       {
-                                               ast_softhangup(rpt_vars[i].rxchannel,AST_SOFTHANGUP_DEV);
-                                               rpt_vars[i].xlink = 1;
-                                               killedit = 1;
-                                       }
-                                       rpt_mutex_unlock(&myrpt->lock);
-                                       if (ast_safe_sleep(chan,500) == -1)
-                                       {
-#ifdef AST_CDR_FLAG_POST_DISABLED
-                                               if (chan->cdr)
-                                                       ast_set_flag(chan->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-                                               return -1;
-                                       }
-                                       rpt_mutex_lock(&myrpt->lock);
-                               }
-                               break;
-                       }
-               }
-       }
-
-#ifdef HAVE_IOPERM
-       if ( (!strcmp(myrpt->remoterig, remote_rig_rbi)||!strcmp(myrpt->remoterig, remote_rig_ppp16)) &&
-         (ioperm(myrpt->p.iobase,1,1) == -1))
-       {
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_log(LOG_WARNING, "Can't get io permission on IO port %x hex\n",myrpt->p.iobase);
-               return -1;
-       }
-#endif
-       myrpt->remoteon = 1;
-#ifdef OLD_ASTERISK
-       LOCAL_USER_ADD(u);
-#endif
-       rpt_mutex_unlock(&myrpt->lock);
-       /* find our index, and load the vars initially */
-       for(i = 0; i < nrpts; i++)
-       {
-               if (&rpt_vars[i] == myrpt)
-               {
-                       load_rpt_vars(i,0);
-                       break;
-               }
-       }
-       rpt_mutex_lock(&myrpt->lock);
-       tele = strchr(myrpt->rxchanname,'/');
-       if (!tele)
-       {
-               fprintf(stderr,"rpt:Dial number must be in format tech/number\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               pthread_exit(NULL);
-       }
-       *tele++ = 0;
-       myrpt->rxchannel = ast_request(myrpt->rxchanname, get_slin_cap(cap), NULL, tele, NULL);
-       cap = ast_format_cap_destroy(cap);
-       myrpt->dahdirxchannel = NULL;
-       if (!strcasecmp(myrpt->rxchanname,"DAHDI"))
-               myrpt->dahdirxchannel = myrpt->rxchannel;
-       if (myrpt->rxchannel)
-       {
-               ast_set_read_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
-               ast_set_write_format_by_id(myrpt->rxchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-               if (myrpt->rxchannel->cdr)
-                       ast_set_flag(myrpt->rxchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef        NEW_ASTERISK
-               myrpt->rxchannel->whentohangup = 0;
-#endif
-               myrpt->rxchannel->appl = "Apprpt";
-               myrpt->rxchannel->data = "(Link Rx)";
-               if (option_verbose > 2)
-                       ast_verbose(VERBOSE_PREFIX_3 "rpt (Rx) initiating call to %s/%s on %s\n",
-                               myrpt->rxchanname,tele,myrpt->rxchannel->name);
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_call(myrpt->rxchannel,tele,999);
-               rpt_mutex_lock(&myrpt->lock);
-       }
-       else
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain Rx channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               pthread_exit(NULL);
-       }
-       *--tele = '/';
-       myrpt->dahditxchannel = NULL;
-       if (myrpt->txchanname)
-       {
-               tele = strchr(myrpt->txchanname,'/');
-               if (!tele)
-               {
-                       fprintf(stderr,"rpt:Dial number must be in format tech/number\n");
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_hangup(myrpt->rxchannel);
-                       pthread_exit(NULL);
-               }
-               *tele++ = 0;
-               myrpt->txchannel = ast_request(myrpt->txchanname, get_slin_cap(cap), NULL, tele, NULL);
-               cap = ast_format_cap_destroy(cap);
-               if (!strncasecmp(myrpt->txchanname,"DAHDI",3))
-                       myrpt->dahditxchannel = myrpt->txchannel;
-               if (myrpt->txchannel)
-               {
-                       ast_set_read_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
-                       ast_set_write_format_by_id(myrpt->txchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-                       if (myrpt->txchannel->cdr)
-                               ast_set_flag(myrpt->txchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-#ifndef        NEW_ASTERISK
-                       myrpt->txchannel->whentohangup = 0;
-#endif
-                       myrpt->txchannel->appl = "Apprpt";
-                       myrpt->txchannel->data = "(Link Tx)";
-                       if (option_verbose > 2)
-                               ast_verbose(VERBOSE_PREFIX_3 "rpt (Tx) initiating call to %s/%s on %s\n",
-                                       myrpt->txchanname,tele,myrpt->txchannel->name);
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_call(myrpt->txchannel,tele,999);
-                       rpt_mutex_lock(&myrpt->lock);
-               }
-               else
-               {
-                       fprintf(stderr,"rpt:Sorry unable to obtain Tx channel\n");
-                       rpt_mutex_unlock(&myrpt->lock);
-                       ast_hangup(myrpt->rxchannel);
-                       pthread_exit(NULL);
-               }
-               *--tele = '/';
-       }
-       else
-       {
-               myrpt->txchannel = myrpt->rxchannel;
-               if (!strncasecmp(myrpt->rxchanname,"DAHDI",3))
-                       myrpt->dahditxchannel = myrpt->rxchannel;
-       }
-       /* allocate a pseudo-channel thru asterisk */
-       myrpt->pchannel = ast_request("DAHDI", get_slin_cap(cap), NULL, "pseudo", NULL);
-       cap = ast_format_cap_destroy(cap);
-       if (!myrpt->pchannel)
-       {
-               fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               pthread_exit(NULL);
-       }
-       ast_set_read_format_by_id(myrpt->pchannel,AST_FORMAT_SLINEAR);
-       ast_set_write_format_by_id(myrpt->pchannel,AST_FORMAT_SLINEAR);
-#ifdef AST_CDR_FLAG_POST_DISABLED
-       if (myrpt->pchannel->cdr)
-               ast_set_flag(myrpt->pchannel->cdr,AST_CDR_FLAG_POST_DISABLED);
-#endif
-       if (!myrpt->dahdirxchannel) myrpt->dahdirxchannel = myrpt->pchannel;
-       if (!myrpt->dahditxchannel) myrpt->dahditxchannel = myrpt->pchannel;
-       /* make a conference for the pseudo */
-       ci.chan = 0;
-       ci.confno = -1; /* make a new conf */
-       ci.confmode = DAHDI_CONF_CONFANNMON ;
-       /* first put the channel on the conference in announce/monitor mode */
-       if (ioctl(myrpt->pchannel->fds[0],DAHDI_SETCONF,&ci) == -1)
-       {
-               ast_log(LOG_WARNING, "Unable to set conference mode to Announce\n");
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->pchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               pthread_exit(NULL);
-       }
-       /* save pseudo channel conference number */
-       myrpt->conf = myrpt->txconf = ci.confno;
-       /* if serial io port, open it */
-       myrpt->iofd = -1;
-       if (myrpt->p.ioport && ((myrpt->iofd = openserial(myrpt,myrpt->p.ioport)) == -1))
-       {
-               rpt_mutex_unlock(&myrpt->lock);
-               ast_hangup(myrpt->pchannel);
-               if (myrpt->txchannel != myrpt->rxchannel) 
-                       ast_hangup(myrpt->txchannel);
-               ast_hangup(myrpt->rxchannel);
-               pthread_exit(NULL);
-       }
-       iskenwood_pci4 = 0;
-       memset(&z,0,sizeof(z));
-       if ((myrpt->iofd < 1) && (myrpt->txchannel == myrpt->dahditxchannel))
-       {
-               z.radpar = DAHDI_RADPAR_REMMODE;
-               z.data = DAHDI_RADPAR_REM_NONE;
-               res = ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z);
-               /* if PCIRADIO and kenwood selected */
-               if ((!res) && (!strcmp(myrpt->remoterig,remote_rig_kenwood)))
-               {
-                       z.radpar = DAHDI_RADPAR_UIOMODE;
-                       z.data = 1;
-                       if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-                       {
-                               ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
-                               return -1;
-                       }
-                       z.radpar = DAHDI_RADPAR_UIODATA;
-                       z.data = 3;
-                       if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-                       {
-                               ast_log(LOG_ERROR,"Cannot set UIODATA\n");
-                               return -1;
-                       }
-                       i = DAHDI_OFFHOOK;
-                       if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i) == -1)
-                       {
-                               ast_log(LOG_ERROR,"Cannot set hook\n");
-                               return -1;
-                       }
-                       iskenwood_pci4 = 1;
-               }
-       }
-       if (myrpt->txchannel == myrpt->dahditxchannel)
-       {
-               i = DAHDI_ONHOOK;
-               ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i);
-               /* if PCIRADIO and Yaesu ft897/ICOM IC-706 selected */
-               if ((myrpt->iofd < 1) && (!res) &&
-                  ((!strcmp(myrpt->remoterig,remote_rig_ft897)) ||
-                     (!strcmp(myrpt->remoterig,remote_rig_ic706)) ||
-                        (!strcmp(myrpt->remoterig,remote_rig_tm271))))
-               {
-                       z.radpar = DAHDI_RADPAR_UIOMODE;
-                       z.data = 1;
-                       if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-                       {
-                               ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
-                               return -1;
-                       }
-                       z.radpar = DAHDI_RADPAR_UIODATA;
-                       z.data = 3;
-                       if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-                       {
-                               ast_log(LOG_ERROR,"Cannot set UIODATA\n");
-                               return -1;
-                       }
-               }
-       }
-       myrpt->remoterx = 0;
-       myrpt->remotetx = 0;
-       myrpt->retxtimer = 0;
-       myrpt->rerxtimer = 0;
-       myrpt->remoteon = 1;
-       myrpt->dtmfidx = -1;
-       myrpt->dtmfbuf[0] = 0;
-       myrpt->dtmf_time_rem = 0;
-       myrpt->hfscanmode = 0;
-       myrpt->hfscanstatus = 0;
-       if (myrpt->p.startupmacro)
-       {
-               snprintf(myrpt->macrobuf,MAXMACRO - 1,"PPPP%s",myrpt->p.startupmacro);
-       }
-       time(&myrpt->start_time);
-       myrpt->last_activity_time = myrpt->start_time;
-       last_timeout_warning = 0;
-       myrpt->reload = 0;
-       myrpt->tele.next = &myrpt->tele;
-       myrpt->tele.prev = &myrpt->tele;
-       myrpt->newkey = 0;
-       rpt_mutex_unlock(&myrpt->lock);
-       ast_set_write_format_by_id(chan, AST_FORMAT_SLINEAR);
-       ast_set_read_format_by_id(chan, AST_FORMAT_SLINEAR);
-       rem_rx = 0;
-       remkeyed = 0;
-       /* if we are on 2w loop and are a remote, turn EC on */
-       if (myrpt->remote && (myrpt->rxchannel == myrpt->txchannel))
-       {
-               i = 128;
-               ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_ECHOCANCEL,&i);
-       }
-       if (chan->_state != AST_STATE_UP) {
-               ast_answer(chan);
-               if (!phone_mode) send_newkey(chan);
-       }
-
-       if (myrpt->rxchannel == myrpt->dahdirxchannel)
-       {
-               if (ioctl(myrpt->dahdirxchannel->fds[0],DAHDI_GET_PARAMS,&par) != -1)
-               {
-                       if (par.rxisoffhook)
-                       {
-                               ast_indicate(chan,AST_CONTROL_RADIO_KEY);
-                               myrpt->remoterx = 1;
-                               remkeyed = 1;
-                       }
-               }
-       }
-       if (myrpt->p.archivedir)
-       {
-               char mycmd[100],mydate[100],*b,*b1;
-               time_t myt;
-               long blocksleft;
-
-
-               mkdir(myrpt->p.archivedir,0600);
-               sprintf(mycmd,"%s/%s",myrpt->p.archivedir,myrpt->name);
-               mkdir(mycmd,0600);
-               time(&myt);
-               strftime(mydate,sizeof(mydate) - 1,"%Y%m%d%H%M%S",
-                       localtime(&myt));
-               sprintf(mycmd,"mixmonitor start %s %s/%s/%s.wav49 a",chan->name,
-                       myrpt->p.archivedir,myrpt->name,mydate);
-               if (myrpt->p.monminblocks)
-               {
-                       blocksleft = diskavail(myrpt);
-                       if (myrpt->p.remotetimeout)
-                       {
-                               blocksleft -= (myrpt->p.remotetimeout *
-                                       MONITOR_DISK_BLOCKS_PER_MINUTE) / 60;
-                       }
-                       if (blocksleft >= myrpt->p.monminblocks)
-                               ast_cli_command(nullfd,mycmd);
-               } else ast_cli_command(nullfd,mycmd);
-               /* look at callerid to see what node this comes from */
-               b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL);
-               if (!b) /* if doesn't have caller id */
-               {
-                       b1 = "0";
-               } else {
-                       b1 = ast_strdupa(b);
-                       ast_shrink_phone_number(b1);
-               }
-               sprintf(mycmd,"CONNECT,%s",b1);
-               donodelog(myrpt,mycmd);
-       }
-       myrpt->loginuser[0] = 0;
-       myrpt->loginlevel[0] = 0;
-       myrpt->authtelltimer = 0;
-       myrpt->authtimer = 0;
-       authtold = 0;
-       authreq = 0;
-       if (myrpt->p.authlevel > 1) authreq = 1;
-       setrem(myrpt); 
-       n = 0;
-       dtmfed = 0;
-       cs[n++] = chan;
-       cs[n++] = myrpt->rxchannel;
-       cs[n++] = myrpt->pchannel;
-       if (myrpt->rxchannel != myrpt->txchannel)
-               cs[n++] = myrpt->txchannel;
-       if (!phone_mode) send_newkey(chan);
-       /* start un-locked */
-       for(;;) 
-       {
-               if (ast_check_hangup(chan)) break;
-               if (ast_check_hangup(myrpt->rxchannel)) break;
-               notremming = 0;
-               setting = 0;
-               reming = 0;
-               telem = myrpt->tele.next;
-               while(telem != &myrpt->tele)
-               {
-                       if (telem->mode == SETREMOTE) setting = 1;
-                       if ((telem->mode == SETREMOTE) ||
-                           (telem->mode == SCAN) ||
-                               (telem->mode == TUNE))  reming = 1;
-                       else notremming = 1;
-                       telem = telem->next;
-               }
-               if (myrpt->reload)
-               {
-                       myrpt->reload = 0;
-                       /* find our index, and load the vars */
-                       for(i = 0; i < nrpts; i++)
-                       {
-                               if (&rpt_vars[i] == myrpt)
-                               {
-                                       load_rpt_vars(i,0);
-                                       break;
-                               }
-                       }
-               }
-               time(&t);
-               if (myrpt->p.remotetimeout)
-               { 
-                       time_t r;
-
-                       r = (t - myrpt->start_time);
-                       if (r >= myrpt->p.remotetimeout)
-                       {
-                               saynode(myrpt,chan,myrpt->name);
-                               sayfile(chan,"rpt/timeout");
-                               ast_safe_sleep(chan,1000);
-                               break;
-                       }
-                       if ((myrpt->p.remotetimeoutwarning) && 
-                           (r >= (myrpt->p.remotetimeout -
-                               myrpt->p.remotetimeoutwarning)) &&
-                                   (r <= (myrpt->p.remotetimeout - 
-                                       myrpt->p.remotetimeoutwarningfreq)))
-                       {
-                               if (myrpt->p.remotetimeoutwarningfreq)
-                               {
-                                   if ((t - last_timeout_warning) >=
-                                       myrpt->p.remotetimeoutwarningfreq)
-                                   {
-                                       time(&last_timeout_warning);
-                                       rpt_telemetry(myrpt,TIMEOUT_WARNING,0);
-                                   }
-                               }
-                               else
-                               {
-                                   if (!last_timeout_warning)
-                                   {
-                                       time(&last_timeout_warning);
-                                       rpt_telemetry(myrpt,TIMEOUT_WARNING,0);
-                                   }
-                               }
-                       }
-               }
-               if (myrpt->p.remoteinacttimeout && myrpt->last_activity_time)
-               { 
-                       time_t r;
-
-                       r = (t - myrpt->last_activity_time);
-                       if (r >= myrpt->p.remoteinacttimeout)
-                       {
-                               saynode(myrpt,chan,myrpt->name);
-                               ast_safe_sleep(chan,1000);
-                               break;
-                       }
-                       if ((myrpt->p.remotetimeoutwarning) && 
-                           (r >= (myrpt->p.remoteinacttimeout -
-                               myrpt->p.remotetimeoutwarning)) &&
-                                   (r <= (myrpt->p.remoteinacttimeout - 
-                                       myrpt->p.remotetimeoutwarningfreq)))
-                       {
-                               if (myrpt->p.remotetimeoutwarningfreq)
-                               {
-                                   if ((t - last_timeout_warning) >=
-                                       myrpt->p.remotetimeoutwarningfreq)
-                                   {
-                                       time(&last_timeout_warning);
-                                       rpt_telemetry(myrpt,ACT_TIMEOUT_WARNING,0);
-                                   }
-                               }
-                               else
-                               {
-                                   if (!last_timeout_warning)
-                                   {
-                                       time(&last_timeout_warning);
-                                       rpt_telemetry(myrpt,ACT_TIMEOUT_WARNING,0);
-                                   }
-                               }
-                       }
-               }
-               ms = MSWAIT;
-               who = ast_waitfor_n(cs,n,&ms);
-               if (who == NULL) ms = 0;
-               elap = MSWAIT - ms;
-               if (myrpt->macrotimer) myrpt->macrotimer -= elap;
-               if (myrpt->macrotimer < 0) myrpt->macrotimer = 0;
-               if (!ms) continue;
-               /* do local dtmf timer */
-               if (myrpt->dtmf_local_timer)
-               {
-                       if (myrpt->dtmf_local_timer > 1) myrpt->dtmf_local_timer -= elap;
-                       if (myrpt->dtmf_local_timer < 1) myrpt->dtmf_local_timer = 1;
-               }
-               rpt_mutex_lock(&myrpt->lock);
-               do_dtmf_local(myrpt,0);
-               rpt_mutex_unlock(&myrpt->lock);
-               //
-               rem_totx =  myrpt->dtmf_local_timer && (!phone_mode);
-               rem_totx |= keyed && (!myrpt->tunerequest);
-               rem_rx = (remkeyed && (!setting)) || (myrpt->tele.next != &myrpt->tele);
-               if(!strcmp(myrpt->remoterig, remote_rig_ic706))
-                       rem_totx |= myrpt->tunerequest;
-               //
-           if((debug > 6) && rem_totx) {
-               ast_log(LOG_NOTICE,"Set rem_totx=%i.  dtmf_local_timer=%i phone_mode=%i keyed=%i tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,phone_mode,keyed,myrpt->tunerequest);
-               }
-               if (keyed && (!keyed1))
-               {
-                       keyed1 = 1;
-               }
-
-               if (!keyed && (keyed1))
-               {
-                       time_t myt;
-
-                       keyed1 = 0;
-                       time(&myt);
-                       /* if login necessary, and not too soon */
-                       if ((myrpt->p.authlevel) && 
-                           (!myrpt->loginlevel[0]) &&
-                               (myt > (t + 3)))
-                       {
-                               authreq = 1;
-                               authtold = 0;
-                               myrpt->authtelltimer = AUTHTELLTIME - AUTHTXTIME;
-                       }
-               }
-
-               if (rem_rx && (!myrpt->remoterx))
-               {
-                       myrpt->remoterx = 1;
-                       ast_indicate(chan,AST_CONTROL_RADIO_KEY);
-               }
-               if ((!rem_rx) && (myrpt->remoterx))
-               {
-                       myrpt->remoterx = 0;
-                       ast_indicate(chan,AST_CONTROL_RADIO_UNKEY);
-               }
-               /* if auth requested, and not authed yet */
-               if (authreq && (!myrpt->loginlevel[0]))
-               {
-                       if ((!authtold) && ((myrpt->authtelltimer += elap)
-                                >= AUTHTELLTIME))
-                       {
-                               authtold = 1;
-                               rpt_telemetry(myrpt,LOGINREQ,NULL);
-                       }
-                       if ((myrpt->authtimer += elap) >= AUTHLOGOUTTIME)
-                       {
-                               break; /* if not logged in, hang up after a time */
-                       }
-               }
-               if (myrpt->newkey)
-               {
-                       if ((myrpt->retxtimer += elap) >= REDUNDANT_TX_TIME)
-                       {
-                               myrpt->retxtimer = 0;
-                               if ((myrpt->remoterx) && (!myrpt->remotetx))
-                                       ast_indicate(chan,AST_CONTROL_RADIO_KEY);
-                               else
-                                       ast_indicate(chan,AST_CONTROL_RADIO_UNKEY);
-                       }
-
-                       if ((myrpt->rerxtimer += elap) >= (REDUNDANT_TX_TIME * 2))
-                       {
-                               keyed = 0;
-                               myrpt->rerxtimer = 0;
-                       }
-               }
-               if (rem_totx && (!myrpt->remotetx))
-               {
-                       /* if not authed, and needed, do not transmit */
-                       if ((!myrpt->p.authlevel) || myrpt->loginlevel[0])
-                       {
-                               if(debug > 6)
-                                       ast_log(LOG_NOTICE,"Handle rem_totx=%i.  dtmf_local_timer=%i  tunerequest=%i\n",rem_totx,myrpt->dtmf_local_timer,myrpt->tunerequest);
-
-                               myrpt->remotetx = 1;
-                               /* asdf maw ??? is this really what you want? Doesn't it always get executed? */
-                               if((myrpt->remtxfreqok = check_tx_freq(myrpt)))
-                               {
-                                       time(&myrpt->last_activity_time);
-                                       if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
-                                       {
-                                               z.radpar = DAHDI_RADPAR_UIODATA;
-                                               z.data = 1;
-                                               if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-                                               {
-                                                       ast_log(LOG_ERROR,"Cannot set UIODATA\n");
-                                                       return -1;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_KEY);
-                                       }
-                                       if (myrpt->p.archivedir) donodelog(myrpt,"TXKEY");
-                               }
-                       }
-               }
-               if ((!rem_totx) && myrpt->remotetx) /* Remote base radio TX unkey */
-               {
-                       myrpt->remotetx = 0;
-                       if(!myrpt->remtxfreqok){
-                               rpt_telemetry(myrpt,UNAUTHTX,NULL);
-                       }
-                       if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
-                       {
-                               z.radpar = DAHDI_RADPAR_UIODATA;
-                               z.data = 3;
-                               if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-                               {
-                                       ast_log(LOG_ERROR,"Cannot set UIODATA\n");
-                                       return -1;
-                               }
-                       }
-                       else
-                       {
-                               ast_indicate(myrpt->txchannel,AST_CONTROL_RADIO_UNKEY);
-                       }
-                       if (myrpt->p.archivedir) donodelog(myrpt,"TXUNKEY");
-               }
-               if (myrpt->hfscanmode){
-                       myrpt->scantimer -= elap;
-                       if(myrpt->scantimer <= 0){
-                               if (!reming)
-                               {
-                                       myrpt->scantimer = REM_SCANTIME;
-                                       rpt_telemetry(myrpt,SCAN,0);
-                               } else myrpt->scantimer = 1;
-                       }
-               }
-               rpt_mutex_lock(&myrpt->lock);
-               c = myrpt->macrobuf[0];
-               if (c && (!myrpt->macrotimer))
-               {
-                       myrpt->macrotimer = MACROTIME;
-                       memmove(myrpt->macrobuf,myrpt->macrobuf + 1,MAXMACRO - 1);
-                       if ((c == 'p') || (c == 'P'))
-                               myrpt->macrotimer = MACROPTIME;
-                       rpt_mutex_unlock(&myrpt->lock);
-                       if (myrpt->p.archivedir)
-                       {
-                               char str[100];
-                                       sprintf(str,"DTMF(M),%c",c);
-                               donodelog(myrpt,str);
-                       }
-                       if (handle_remote_dtmf_digit(myrpt,c,&keyed,0) == -1) break;
-                       continue;
-               } else rpt_mutex_unlock(&myrpt->lock);
-               if (who == chan) /* if it was a read from incoming */
-               {
-                       f = ast_read(chan);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ link:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               if (ioctl(chan->fds[0], DAHDI_GETCONFMUTE, &ismuted) == -1)
-                               {
-                                       ismuted = 0;
-                               }
-                               /* if not transmitting, zero-out audio */
-                               ismuted |= (!myrpt->remotetx);
-                               if (dtmfed && phone_mode) ismuted = 1;
-                               dtmfed = 0;
-                               if (ismuted)
-                               {
-                                       memset(f->data.ptr,0,f->datalen);
-                                       if (myrpt->lastf1)
-                                               memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                                       if (myrpt->lastf2)
-                                               memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               } 
-                               if (f) f2 = ast_frdup(f);
-                               else f2 = NULL;
-                               f1 = myrpt->lastf2;
-                               myrpt->lastf2 = myrpt->lastf1;
-                               myrpt->lastf1 = f2;
-                               if (ismuted)
-                               {
-                                       if (myrpt->lastf1)
-                                               memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                                       if (myrpt->lastf2)
-                                               memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               }
-                               if (f1)
-                               {
-                                       if (phone_mode)
-                                               ast_write(myrpt->txchannel,f1);
-                                       else
-                                               ast_write(myrpt->txchannel,f);
-                                       ast_frfree(f1);
-                               }
-                       }
-#ifndef        OLD_ASTERISK
-                       else if (f->frametype == AST_FRAME_DTMF_BEGIN)
-                       {
-                               if (myrpt->lastf1)
-                                       memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                               if (myrpt->lastf2)
-                                       memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               dtmfed = 1;
-                       }
-#endif
-                       if (f->frametype == AST_FRAME_DTMF)
-                       {
-                               if (myrpt->lastf1)
-                                       memset(myrpt->lastf1->data.ptr,0,myrpt->lastf1->datalen);
-                               if (myrpt->lastf2)
-                                       memset(myrpt->lastf2->data.ptr,0,myrpt->lastf2->datalen);
-                               dtmfed = 1;
-                               if (handle_remote_phone_dtmf(myrpt,f->subclass.integer,&keyed,phone_mode) == -1)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       if (f->frametype == AST_FRAME_TEXT)
-                       {
-                               if (handle_remote_data(myrpt,f->data.ptr) == -1)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                               /* if RX key */
-                               if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
-                               {
-                                       if (debug == 7) printf("@@@@ rx key\n");
-                                       keyed = 1;
-                                       myrpt->rerxtimer = 0;
-                               }
-                               /* if RX un-key */
-                               if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
-                               {
-                                       myrpt->rerxtimer = 0;
-                                       if (debug == 7) printf("@@@@ rx un-key\n");
-                                       keyed = 0;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (who == myrpt->rxchannel) /* if it was a read from radio */
-               {
-                       f = ast_read(myrpt->rxchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ link:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               int myreming = 0;
-
-                               if(!strcmp(myrpt->remoterig, remote_rig_kenwood))
-                                       myreming = reming;
-
-                               if (myreming || (!remkeyed) ||
-                               ((myrpt->remote) && (myrpt->remotetx)) ||
-                                 ((myrpt->remmode != REM_MODE_FM) &&
-                                   notremming))
-                                       memset(f->data.ptr,0,f->datalen); 
-                                ast_write(myrpt->pchannel,f);
-                       }
-                       else if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                               /* if RX key */
-                               if (f->subclass.integer == AST_CONTROL_RADIO_KEY)
-                               {
-                                       if (debug == 7) printf("@@@@ remote rx key\n");
-                                       if (!myrpt->remotetx)
-                                       {
-                                               remkeyed = 1;
-                                       }
-                               }
-                               /* if RX un-key */
-                               if (f->subclass.integer == AST_CONTROL_RADIO_UNKEY)
-                               {
-                                       if (debug == 7) printf("@@@@ remote rx un-key\n");
-                                       if (!myrpt->remotetx) 
-                                       {
-                                               remkeyed = 0;
-                                       }
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if (who == myrpt->pchannel) /* if is remote mix output */
-               {
-                       f = ast_read(myrpt->pchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ link:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_VOICE)
-                       {
-                               ast_write(chan,f);
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-               if ((myrpt->rxchannel != myrpt->txchannel) && 
-                       (who == myrpt->txchannel)) /* do this cuz you have to */
-               {
-                       f = ast_read(myrpt->txchannel);
-                       if (!f)
-                       {
-                               if (debug) printf("@@@@ link:Hung Up\n");
-                               break;
-                       }
-                       if (f->frametype == AST_FRAME_CONTROL)
-                       {
-                               if (f->subclass.integer == AST_CONTROL_HANGUP)
-                               {
-                                       if (debug) printf("@@@@ rpt:Hung Up\n");
-                                       ast_frfree(f);
-                                       break;
-                               }
-                       }
-                       ast_frfree(f);
-                       continue;
-               }
-       }
-       if (myrpt->p.archivedir)
-       {
-               char mycmd[100],*b,*b1;
-
-               /* look at callerid to see what node this comes from */
-               b = S_COR(chan->caller.id.number.valid, chan->caller.id.number.str, NULL);
-               if (!b) /* if doesn't have caller id */
-               {
-                       b1 = "0";
-               } else {
-                       b1 = ast_strdupa(b);
-                       ast_shrink_phone_number(b1);
-               }
-               sprintf(mycmd,"DISCONNECT,%s",b1);
-               donodelog(myrpt,mycmd);
-       }
-       /* wait for telem to be done */
-       while(myrpt->tele.next != &myrpt->tele) usleep(100000);
-       sprintf(tmp,"mixmonitor stop %s",chan->name);
-       ast_cli_command(nullfd,tmp);
-       close(nullfd);
-       rpt_mutex_lock(&myrpt->lock);
-       myrpt->hfscanmode = 0;
-       myrpt->hfscanstatus = 0;
-       myrpt->remoteon = 0;
-       rpt_mutex_unlock(&myrpt->lock);
-       if (myrpt->lastf1) ast_frfree(myrpt->lastf1);
-       myrpt->lastf1 = NULL;
-       if (myrpt->lastf2) ast_frfree(myrpt->lastf2);
-       myrpt->lastf2 = NULL;
-       if ((iskenwood_pci4) && (myrpt->txchannel == myrpt->dahditxchannel))
-       {
-               z.radpar = DAHDI_RADPAR_UIOMODE;
-               z.data = 3;
-               if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-               {
-                       ast_log(LOG_ERROR,"Cannot set UIOMODE\n");
-                       return -1;
-               }
-               z.radpar = DAHDI_RADPAR_UIODATA;
-               z.data = 3;
-               if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_RADIO_SETPARAM,&z) == -1)
-               {
-                       ast_log(LOG_ERROR,"Cannot set UIODATA\n");
-                       return -1;
-               }
-               i = DAHDI_OFFHOOK;
-               if (ioctl(myrpt->dahditxchannel->fds[0],DAHDI_HOOK,&i) == -1)
-               {
-                       ast_log(LOG_ERROR,"Cannot set hook\n");
-                       return -1;
-               }
-       }
-       if (myrpt->iofd) close(myrpt->iofd);
-       myrpt->iofd = -1;
-       ast_hangup(myrpt->pchannel);
-       if (myrpt->rxchannel != myrpt->txchannel) ast_hangup(myrpt->txchannel);
-       ast_hangup(myrpt->rxchannel);
-       closerem(myrpt);
-       if (myrpt->p.rptnode)
-       {
-               rpt_mutex_lock(&myrpt->lock);
-               for(i = 0; i < nrpts; i++)
-               {
-                       if (!strcasecmp(rpt_vars[i].name,myrpt->p.rptnode))
-                       {
-                               rpt_vars[i].xlink = 0;
-                               break;
-                       }
-               }
-               rpt_mutex_unlock(&myrpt->lock);
-       }
-#ifdef OLD_ASTERISK
-       LOCAL_USER_REMOVE(u);
-#endif
-       return res;
-}
-
-#ifndef OLD_ASTERISK
-/*!\brief callback to display list of locally configured nodes
-   \addtogroup Group_AMI
- */
-static int manager_rpt_local_nodes(struct mansession *s, const struct message *m)
-{
-    int i;
-    astman_append(s, "<?xml version=\"1.0\"?>\r\n");
-    astman_append(s, "<nodes>\r\n");
-    for (i=0; i< nrpts; i++)
-    {
-        astman_append(s, "  <node>%s</node>\r\n", rpt_vars[i].name);        
-    } /* for i */
-    astman_append(s, "</nodes>\r\n");
-    astman_append(s, "\r\n");  /* Properly terminate Manager output */
-    return RESULT_SUCCESS;
-} /* manager_rpt_local_nodes() */
-
-
-
-/*
- * Append Success and ActionID to manager response message
- */
-
-static void rpt_manager_success(struct mansession *s, const struct message *m)
-{
-       const char *id = astman_get_header(m, "ActionID");
-       if (!ast_strlen_zero(id))
-               astman_append(s, "ActionID: %s\r\n", id);
-       astman_append(s, "Response: Success\r\n");
-}
-
-/*
-* Dump statistics to manager session
-*/
-
-static int rpt_manager_do_stats(struct mansession *s, const struct message *m, char *str)
-{
-       int i,j,numoflinks;
-       int dailytxtime, dailykerchunks;
-       time_t now;
-       int totalkerchunks, dailykeyups, totalkeyups, timeouts;
-       int totalexecdcommands, dailyexecdcommands, hours, minutes, seconds;
-       long long totaltxtime;
-       struct  rpt_link *l;
-       char *listoflinks[MAX_STAT_LINKS];      
-       char *lastdtmfcommand,*parrot_ena;
-       char *tot_state, *ider_state, *patch_state;
-       char *reverse_patch_state, *sys_ena, *tot_ena, *link_ena, *patch_ena;
-       char *sch_ena, *input_signal, *called_number, *user_funs, *tail_type;
-       char *transmitterkeyed;
-       const char *node = astman_get_header(m, "Node");
-       struct rpt *myrpt;
-
-       static char *not_applicable = "N/A";
-
-       tot_state = ider_state = 
-       patch_state = reverse_patch_state = 
-       input_signal = not_applicable;
-       called_number = lastdtmfcommand = transmitterkeyed = NULL;
-
-       time(&now);
-       for(i = 0; i < nrpts; i++)
-       {
-               if ((node)&&(!strcmp(node,rpt_vars[i].name))){
-                       rpt_manager_success(s,m);
-
-                       myrpt = &rpt_vars[i];
-
-                       if(myrpt->remote){ /* Remote base ? */
-                               char *loginuser, *loginlevel, *freq, *rxpl, *txpl, *modestr;
-                               char offset = 0, powerlevel = 0, rxplon = 0, txplon = 0, remoteon, remmode = 0, reportfmstuff;
-                               char offsetc,powerlevelc;
-
-                               loginuser = loginlevel = freq = rxpl = txpl = NULL;
-                               /* Make a copy of all stat variables while locked */
-                               rpt_mutex_lock(&myrpt->lock); /* LOCK */
-                               if((remoteon = myrpt->remoteon)){
-                                       if(!ast_strlen_zero(myrpt->loginuser))
-                                               loginuser = ast_strdup(myrpt->loginuser);
-                                       if(!ast_strlen_zero(myrpt->loginlevel))
-                                               loginlevel = ast_strdup(myrpt->loginlevel);
-                                       if(!ast_strlen_zero(myrpt->freq))
-                                               freq = ast_strdup(myrpt->freq);
-                                       if(!ast_strlen_zero(myrpt->rxpl))
-                                               rxpl = ast_strdup(myrpt->rxpl);
-                                       if(!ast_strlen_zero(myrpt->txpl))
-                                               txpl = ast_strdup(myrpt->txpl);
-                                       remmode = myrpt->remmode;
-                                       offset = myrpt->offset;
-                                       powerlevel = myrpt->powerlevel;
-                                       rxplon = myrpt->rxplon;
-                                       txplon = myrpt->txplon;                 
-                               }
-                               rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-                               astman_append(s, "IsRemoteBase: YES\r\n");
-                               astman_append(s, "RemoteOn: %s\r\n",(remoteon) ? "YES": "NO");
-                               if(remoteon){
-                                       if(loginuser){
-                                               astman_append(s, "LogInUser: %s\r\n", loginuser);
-                                               ast_free(loginuser);
-                                       }
-                                       if(loginlevel){
-                                               astman_append(s, "LogInLevel: %s\r\n", loginlevel);
-                                               ast_free(loginlevel);
-                                       }
-                                       if(freq){
-                                               astman_append(s, "Freq: %s\r\n", freq);
-                                               ast_free(freq);
-                                       }
-                                       reportfmstuff = 0;
-                                       switch(remmode){
-                                               case REM_MODE_FM:
-                                                       modestr = "FM"; 
-                                                       reportfmstuff = 1;
-                                                       break;
-                                               case REM_MODE_AM:
-                                                       modestr = "AM";
-                                                       break;
-                                               case REM_MODE_USB:
-                                                       modestr = "USB";
-                                                       break;
-                                               default:
-                                                       modestr = "LSB";
-                                                       break;
-                                       }
-                                       astman_append(s, "RemMode: %s\r\n", modestr);
-                                       if(reportfmstuff){
-                                               switch(offset){
-                                                       case REM_SIMPLEX:
-                                                               offsetc = 'S';
-                                                               break;
-                                                       case REM_MINUS:
-                                                               offsetc = '-';
-                                                               break;
-                                                       default:
-                                                               offsetc = '+';
-                                                               break;
-                                               }
-                                               astman_append(s, "RemOffset: %c\r\n", offsetc);
-                                               if(rxplon && rxpl){
-                                                       astman_append(s, "RxPl: %s\r\n",rxpl);
-                                                       ast_free(rxpl);
-                                               }
-                                               if(txplon && txpl){
-                                                       astman_append(s, "TxPl: %s\r\n",txpl);
-                                                       ast_free(txpl);
-                                               }
-                                       }
-                                       switch(powerlevel){
-                                               case REM_LOWPWR:
-                                                       powerlevelc = 'L';
-                                                       break;
-                                               case REM_MEDPWR:
-                                                       powerlevelc = 'M';
-                                                       break;
-                                               default:
-                                                       powerlevelc = 'H';
-                                                       break;
-                                       }
-                                       astman_append(s,"PowerLevel: %c\r\n", powerlevelc);
-                               }
-                               astman_append(s, "\r\n");
-                               return 0; /* End of remote base status reporting */
-                       }       
-
-                       /* ELSE Process as a repeater node */
-                       /* Make a copy of all stat variables while locked */
-                       rpt_mutex_lock(&myrpt->lock); /* LOCK */
-                       dailytxtime = myrpt->dailytxtime;
-                       totaltxtime = myrpt->totaltxtime;
-                       dailykeyups = myrpt->dailykeyups;
-                       totalkeyups = myrpt->totalkeyups;
-                       dailykerchunks = myrpt->dailykerchunks;
-                       totalkerchunks = myrpt->totalkerchunks;
-                       dailyexecdcommands = myrpt->dailyexecdcommands;
-                       totalexecdcommands = myrpt->totalexecdcommands;
-                       timeouts = myrpt->timeouts;
-
-
-                       /* Traverse the list of connected nodes */
-                       reverse_patch_state = "DOWN";
-                       numoflinks = 0;
-                       l = myrpt->links.next;
-                       while(l && (l != &myrpt->links)){
-                               if(numoflinks >= MAX_STAT_LINKS){
-                                       ast_log(LOG_NOTICE,
-                                       "maximum number of links exceeds %d in rpt_do_stats()!",MAX_STAT_LINKS);
-                                       break;
-                               }
-                               if (l->name[0] == '0'){ /* Skip '0' nodes */
-                                       reverse_patch_state = "UP";
-                                       l = l->next;
-                                       continue;
-                               }
-                               listoflinks[numoflinks] = ast_strdup(l->name);
-                               if(listoflinks[numoflinks] == NULL){
-                                       break;
-                               }
-                               else{
-                                       numoflinks++;
-                               }
-                               l = l->next;
-                       }
-
-                       if(myrpt->keyed)
-                               input_signal = "YES";
-                       else
-                               input_signal = "NO";
-                       
-                       if(myrpt->txkeyed)
-                               transmitterkeyed = "YES";
-                       else
-                               transmitterkeyed = "NO";
-
-                       if(myrpt->p.parrotmode)
-                               parrot_ena = "ENABLED";
-                       else
-                               parrot_ena = "DISABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].txdisable)
-                               sys_ena = "DISABLED";
-                       else
-                               sys_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].totdisable)
-                               tot_ena = "DISABLED";
-                       else
-                               tot_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].linkfundisable)
-                               link_ena = "DISABLED";
-                       else
-                               link_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].autopatchdisable)
-                               patch_ena = "DISABLED";
-                       else
-                               patch_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].schedulerdisable)
-                               sch_ena = "DISABLED";
-                       else
-                               sch_ena = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].userfundisable)
-                               user_funs = "DISABLED";
-                       else
-                               user_funs = "ENABLED";
-
-                       if(myrpt->p.s[myrpt->p.sysstate_cur].alternatetail)
-                               tail_type = "ALTERNATE";
-                       else
-                               tail_type = "STANDARD";
-
-                       if(!myrpt->totimer)
-                               tot_state = "TIMED OUT!";
-                       else if(myrpt->totimer != myrpt->p.totime)
-                               tot_state = "ARMED";
-                       else
-                               tot_state = "RESET";
-
-                       if(myrpt->tailid)
-                               ider_state = "QUEUED IN TAIL";
-                       else if(myrpt->mustid)
-                               ider_state = "QUEUED FOR CLEANUP";
-                       else
-                               ider_state = "CLEAN";
-
-                       switch(myrpt->callmode){
-                               case 1:
-                                       patch_state = "DIALING";
-                                       break;
-                               case 2:
-                                       patch_state = "CONNECTING";
-                                       break;
-                               case 3:
-                                       patch_state = "UP";
-                                       break;
-
-                               case 4:
-                                       patch_state = "CALL FAILED";
-                                       break;
-
-                               default:
-                                       patch_state = "DOWN";
-                       }
-
-                       if(strlen(myrpt->exten)){
-                               called_number = ast_strdup(myrpt->exten);
-                       }
-
-                       if(strlen(myrpt->lastdtmfcommand)){
-                               lastdtmfcommand = ast_strdup(myrpt->lastdtmfcommand);
-                       }
-                       rpt_mutex_unlock(&myrpt->lock); /* UNLOCK */
-
-                       astman_append(s, "IsRemoteBase: NO\r\n");
-                       astman_append(s, "NodeState: %d\r\n", myrpt->p.sysstate_cur);
-                       astman_append(s, "SignalOnInput: %s\r\n", input_signal);
-                       astman_append(s, "TransmitterKeyed: %s\r\n", transmitterkeyed);
-                       astman_append(s, "Transmitter: %s\r\n", sys_ena);
-                       astman_append(s, "Parrot: %s\r\n", parrot_ena);
-                       astman_append(s, "Scheduler: %s\r\n", sch_ena);
-                       astman_append(s, "TailLength: %s\r\n", tail_type);
-                       astman_append(s, "TimeOutTimer: %s\r\n", tot_ena);
-                       astman_append(s, "TimeOutTimerState: %s\r\n", tot_state);
-                       astman_append(s, "TimeOutsSinceSystemInitialization: %d\r\n", timeouts);
-                       astman_append(s, "IdentifierState: %s\r\n", ider_state);
-                       astman_append(s, "KerchunksToday: %d\r\n", dailykerchunks);
-                       astman_append(s, "KerchunksSinceSystemInitialization: %d\r\n", totalkerchunks);
-                       astman_append(s, "KeyupsToday: %d\r\n", dailykeyups);
-                       astman_append(s, "KeyupsSinceSystemInitialization: %d\r\n", totalkeyups);
-                       astman_append(s, "DtmfCommandsToday: %d\r\n", dailyexecdcommands);
-                       astman_append(s, "DtmfCommandsSinceSystemInitialization: %d\r\n", totalexecdcommands);
-                       astman_append(s, "LastDtmfCommandExecuted: %s\r\n", 
-                       (lastdtmfcommand && strlen(lastdtmfcommand)) ? lastdtmfcommand : not_applicable);
-                       hours = dailytxtime/3600000;
-                       dailytxtime %= 3600000;
-                       minutes = dailytxtime/60000;
-                       dailytxtime %= 60000;
-                       seconds = dailytxtime/1000;
-                       dailytxtime %= 1000;
-
-                       astman_append(s, "TxTimeToday: %02d:%02d:%02d.%d\r\n",
-                               hours, minutes, seconds, dailytxtime);
-
-                       hours = (int) totaltxtime/3600000;
-                       totaltxtime %= 3600000;
-                       minutes = (int) totaltxtime/60000;
-                       totaltxtime %= 60000;
-                       seconds = (int)  totaltxtime/1000;
-                       totaltxtime %= 1000;
-
-                       astman_append(s, "TxTimeSinceSystemInitialization: %02d:%02d:%02d.%d\r\n",
-                                hours, minutes, seconds, (int) totaltxtime);
-
-                       sprintf(str, "NodesCurrentlyConnectedToUs: ");
-                        if(!numoflinks){
-                             strcat(str,"<NONE>");
-                        }
-                       else{
-                               for(j = 0 ;j < numoflinks; j++){
-                                       sprintf(str+strlen(str), "%s", listoflinks[j]);
-                                       if(j < numoflinks - 1)
-                                               strcat(str,",");
-                               }
-                       }
-                       astman_append(s,"%s\r\n", str);
-
-                       astman_append(s, "Autopatch: %s\r\n", patch_ena);
-                       astman_append(s, "AutopatchState: %s\r\n", patch_state);
-                       astman_append(s, "AutopatchCalledNumber: %s\r\n",
-                       (called_number && strlen(called_number)) ? called_number : not_applicable);
-                       astman_append(s, "ReversePatchIaxrptConnected: %s\r\n", reverse_patch_state);
-                       astman_append(s, "UserLinkingCommands: %s\r\n", link_ena);
-                       astman_append(s, "UserFunctions: %s\r\n", user_funs);
-
-                       for(j = 0; j < numoflinks; j++){ /* ast_free() all link names */
-                               ast_free(listoflinks[j]);
-                       }
-                       if(called_number){
-                               ast_free(called_number);
-                       }
-                       if(lastdtmfcommand){
-                               ast_free(lastdtmfcommand);
-                       }
-                       astman_append(s, "\r\n"); /* We're Done! */
-                       return 0;
-               }
-       }
-       astman_send_error(s, m, "RptStatus unknown or missing node");
-       return -1;
-}
-
-
-
-/*
- * Implement the RptStatus Manager Interface
- */
-
-static int manager_rpt_status(struct mansession *s, const struct message *m)
-{
-       int i,res,len,idx;
-       int uptime,hours,minutes;
-       time_t now;
-       const char *cmd = astman_get_header(m, "Command");
-       char *str;
-       enum {MGRCMD_RPTSTAT,MGRCMD_NODESTAT};
-       struct mgrcmdtbl{
-               const char *cmd;
-               int index;
-       };
-       static struct mgrcmdtbl mct[] = {
-               {"RptStat",MGRCMD_RPTSTAT},
-               {"NodeStat",MGRCMD_NODESTAT},
-               {NULL,0} /* NULL marks end of command table */
-       };
-
-       time(&now);
-
-       len = 1024; /* Allocate a working buffer */
-       if(!(str = ast_malloc(len)))
-               return -1;
-
-       /* Check for Command */
-       if(ast_strlen_zero(cmd)){
-               astman_send_error(s, m, "RptStatus missing command");
-               ast_free(str);
-               return 0;
-       }
-       /* Try to find the command in the table */
-       for(i = 0 ; mct[i].cmd ; i++){
-               if(!strcmp(mct[i].cmd, cmd))
-                       break;
-       }
-
-       if(!mct[i].cmd){ /* Found or not found ? */
-               astman_send_error(s, m, "RptStatus unknown command");
-               ast_free(str);
-               return 0;
-       }
-       else
-               idx = mct[i].index;
-
-       switch(idx){ /* Use the index to go to the correct command */
-
-               case MGRCMD_RPTSTAT:
-                       /* Return Nodes: and a comma separated list of nodes */
-                       if((res = snprintf(str, len, "Nodes: ")) > -1)
-                               len -= res;
-                       else{
-                               ast_free(str);
-                               return 0;
-                       }
-                       for(i = 0; i < nrpts; i++){
-                               if(i < nrpts - 1){
-                                       if((res = snprintf(str+strlen(str), len, "%s,",rpt_vars[i].name)) < 0){
-                                               ast_free(str);
-                                               return 0;
-                                       }
-                               }
-                               else{
-                                       if((res = snprintf(str+strlen(str), len, "%s",rpt_vars[i].name)) < 0){
-                                               ast_free(str);
-                                               return 0;
-                                       }
-                               }
-                               len -= res;
-                       }
-
-                       rpt_manager_success(s,m);
-                       
-                       if(!nrpts)
-                               astman_append(s, "<NONE>\r\n");
-                       else
-                               astman_append(s, "%s\r\n", str);
-
-                       uptime = (int)(now - starttime);
-                       hours = uptime/3600;
-                        uptime %= 3600;
-                        minutes = uptime/60;
-                        uptime %= 60;
-
-                        astman_append(s, "RptUptime: %02d:%02d:%02d\r\n",
-                                hours, minutes, uptime);
-
-                       astman_append(s, "\r\n");
-                       break;          
-
-               case    MGRCMD_NODESTAT:
-                       res = rpt_manager_do_stats(s,m,str);
-                       ast_free(str);
-                       return res;
-
-               default:
-                       astman_send_error(s, m, "RptStatus invalid command");
-                       break;
-       }
-       ast_free(str);
-       return 0;
-}
-
-#endif
-
-#ifdef OLD_ASTERISK
-int unload_module()
-#else
-static int unload_module(void)
-#endif
-{
-       int i, res;
-
-#ifdef OLD_ASTERISK
-       STANDARD_HANGUP_LOCALUSERS;
-#endif
-       for(i = 0; i < nrpts; i++) {
-               if (!strcmp(rpt_vars[i].name,rpt_vars[i].p.nodes)) continue;
-                ast_mutex_destroy(&rpt_vars[i].lock);
-                ast_mutex_destroy(&rpt_vars[i].remlock);
-       }
-       res = ast_unregister_application(app);
-
-#ifdef NEW_ASTERISK
-       ast_cli_unregister_multiple(rpt_cli, ARRAY_LEN(rpt_cli));
-#else
-       /* Unregister cli extensions */
-       ast_cli_unregister(&cli_debug);
-       ast_cli_unregister(&cli_dump);
-       ast_cli_unregister(&cli_stats);
-       ast_cli_unregister(&cli_lstats);
-       ast_cli_unregister(&cli_nodes);
-       ast_cli_unregister(&cli_local_nodes);
-       ast_cli_unregister(&cli_reload);
-       ast_cli_unregister(&cli_restart);
-       ast_cli_unregister(&cli_fun);
-       ast_cli_unregister(&cli_fun1);
-       res |= ast_cli_unregister(&cli_cmd);
-#endif
-#ifndef OLD_ASTERISK
-       res |= ast_manager_unregister("RptLocalNodes");
-       res |= ast_manager_unregister("RptStatus");
-#endif
-       return res;
-}
-
-#ifdef OLD_ASTERISK
-int load_module()
-#else
-static int load_module(void)
-#endif
-{
-       int res;
-       ast_pthread_create(&rpt_master_thread,NULL,rpt_master,NULL);
-
-#ifdef NEW_ASTERISK
-       ast_cli_register_multiple(rpt_cli, ARRAY_LEN(rpt_cli));
-       res = 0;
-#else
-       /* Register cli extensions */
-       ast_cli_register(&cli_debug);
-       ast_cli_register(&cli_dump);
-       ast_cli_register(&cli_stats);
-       ast_cli_register(&cli_lstats);
-       ast_cli_register(&cli_nodes);
-       ast_cli_register(&cli_local_nodes);
-       ast_cli_register(&cli_reload);
-       ast_cli_register(&cli_restart);
-       ast_cli_register(&cli_fun);
-       ast_cli_register(&cli_fun1);
-       res = ast_cli_register(&cli_cmd);
-#endif
-#ifndef OLD_ASTERISK
-       res |= ast_manager_register("RptLocalNodes", 0, manager_rpt_local_nodes, "List local node numbers");
-       res |= ast_manager_register("RptStatus", 0, manager_rpt_status, "Return Rpt Status for CGI");
-
-#endif
-       res |= ast_register_application(app, rpt_exec, synopsis, descrip);
-       return res;
-}
-
-#ifdef OLD_ASTERISK
-char *description()
-{
-       return tdesc;
-}
-int usecount(void)
-{
-       int res;
-       STANDARD_USECOUNT(res);
-       return res;
-}
-
-char *key()
-{
-       return ASTERISK_GPL_KEY;
-}
-#endif
-
-#ifdef OLD_ASTERISK
-int reload()
-#else
-static int reload(void)
-#endif
-{
-int    n;
-
-       for(n = 0; n < nrpts; n++) rpt_vars[n].reload = 1;
-       return(0);
-}
-
-
-#ifndef        OLD_ASTERISK
-/* STD_MOD(MOD_1, reload, NULL, NULL); */
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Radio Repeater/Remote Base Application",
-               .load = load_module,
-               .unload = unload_module,
-               .reload = reload,
-              );
-#endif
-
index 35573c3bf17b5af945f22814ab0034212c741bfc..d1f6afb7ed171de82201eb1462e1944c2d00a7a0 100644 (file)
@@ -61,7 +61,6 @@ SUPPSERV=@PBX_SUPPSERV@
 SYSLOG=@PBX_SYSLOG@
 TONEZONE=@PBX_TONEZONE@
 UNIXODBC=@PBX_UNIXODBC@
-USB=@PBX_USB@
 VORBIS=@PBX_VORBIS@
 VPB=@PBX_VPB@
 WINARCH=@PBX_WINARCH@
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c
deleted file mode 100644 (file)
index 792cb3b..0000000
+++ /dev/null
@@ -1,4036 +0,0 @@
-#define        NEW_ASTERISK
-/*
- * Asterisk -- An open source telephony toolkit.
- *
- * Copyright (C) 1999 - 2005, Digium, Inc.
- * Copyright (C) 2007 - 2008, Jim Dixon
- *
- * Jim Dixon, WB6NIL <jim@lambdatel.com>
- * Steve Henke, W9SH  <w9sh@arrl.net>
- * Based upon work by Mark Spencer <markster@digium.com> and Luigi Rizzo
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
-  * at the top of the source tree.
- */
-
-/*! \file
- *
- * \brief Channel driver for CM108 USB Cards with Radio Interface
- *
- * \author Jim Dixon  <jim@lambdatel.com>
- * \author Steve Henke  <w9sh@arrl.net>
- *
- * \par See also
- * \arg \ref Config_usbradio
- *
- * \ingroup channel_drivers
- */
-
-/*** MODULEINFO
-       <depend>oss</depend>
-       <depend>alsa</depend>
-       <depend>usb</depend>
-       <defaultenabled>no</defaultenabled>
-       <support_level>extended</support_level>
- ***/
-
-/*** MAKEOPTS
-<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags" positive_output="yes">
-       <member name="RADIO_RTX" displayname="Build RTX/DTX Radio Programming" touch_on_change="channels/chan_usbradio.c channels/xpmr/xpmr.h">
-               <defaultenabled>no</defaultenabled>
-               <depend>chan_usbradio</depend>
-               <support_level>extended</support_level>
-       </member>
-       <member name="RADIO_XPMRX" displayname="Build Experimental Radio Protocols" touch_on_change="channels/chan_usbradio.c">
-               <defaultenabled>no</defaultenabled>
-               <depend>chan_usbradio</depend>
-               <support_level>extended</support_level>
-       </member>
-</category>
- ***/
-
-// 20070918 1600 EDT sph@xelatec.com changing to rx driven streams
-
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef HAVE_SYS_IO_H
-#include <sys/io.h>
-#endif
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <usb.h>
-#include <alsa/asoundlib.h>
-
-//#define HAVE_XPMRX                           1
-#ifdef RADIO_XPMRX
-#define HAVE_XPMRX                             1
-#endif
-
-#define CHAN_USBRADIO           1
-#define DEBUG_USBRADIO          0      
-#define DEBUG_CAPTURES                 1
-#define DEBUG_CAP_RX_OUT               0               
-#define DEBUG_CAP_TX_OUT           0                   
-#define DEBUG_FILETEST                 0                        
-
-#define RX_CAP_RAW_FILE                        "/tmp/rx_cap_in.pcm"
-#define RX_CAP_TRACE_FILE              "/tmp/rx_trace.pcm"
-#define RX_CAP_OUT_FILE                        "/tmp/rx_cap_out.pcm"
-
-#define TX_CAP_RAW_FILE                        "/tmp/tx_cap_in.pcm"
-#define TX_CAP_TRACE_FILE              "/tmp/tx_trace.pcm"
-#define TX_CAP_OUT_FILE                        "/tmp/tx_cap_out.pcm"
-
-#define        MIXER_PARAM_MIC_PLAYBACK_SW "Mic Playback Switch"
-#define MIXER_PARAM_MIC_PLAYBACK_VOL "Mic Playback Volume"
-#define        MIXER_PARAM_MIC_CAPTURE_SW "Mic Capture Switch"
-#define        MIXER_PARAM_MIC_CAPTURE_VOL "Mic Capture Volume"
-#define        MIXER_PARAM_MIC_BOOST "Auto Gain Control"
-#define        MIXER_PARAM_SPKR_PLAYBACK_SW "Speaker Playback Switch"
-#define        MIXER_PARAM_SPKR_PLAYBACK_VOL "Speaker Playback Volume"
-
-#define        DELIMCHR ','
-#define        QUOTECHR 34
-
-#define        READERR_THRESHOLD 50
-
-#include "./xpmr/xpmr.h"
-#ifdef HAVE_XPMRX
-#include "./xpmrx/xpmrx.h"
-#include "./xpmrx/bitweight.h"
-#endif
-
-#if 0
-#define traceusb1(a) {printf a;}
-#else
-#define traceusb1(a)
-#endif
-
-#if 0
-#define traceusb2(a) {printf a;}
-#else
-#define traceusb2(a)
-#endif
-
-#ifdef __linux
-#include <linux/soundcard.h>
-#elif defined(__FreeBSD__)
-#include <sys/soundcard.h>
-#else
-#include <soundcard.h>
-#endif
-
-#include "asterisk/lock.h"
-#include "asterisk/frame.h"
-#include "asterisk/logger.h"
-#include "asterisk/callerid.h"
-#include "asterisk/channel.h"
-#include "asterisk/module.h"
-#include "asterisk/options.h"
-#include "asterisk/pbx.h"
-#include "asterisk/config.h"
-#include "asterisk/cli.h"
-#include "asterisk/utils.h"
-#include "asterisk/causes.h"
-#include "asterisk/endian.h"
-#include "asterisk/stringfields.h"
-#include "asterisk/abstract_jb.h"
-#include "asterisk/musiconhold.h"
-#include "asterisk/dsp.h"
-
-#ifndef        NEW_ASTERISK
-
-/* ringtones we use */
-#include "busy.h"
-#include "ringtone.h"
-#include "ring10.h"
-#include "answer.h"
-
-#endif
-
-#define C108_VENDOR_ID         0x0d8c
-#define C108_PRODUCT_ID        0x000c
-#define C108_HID_INTERFACE     3
-
-#define HID_REPORT_GET         0x01
-#define HID_REPORT_SET         0x09
-
-#define HID_RT_INPUT           0x01
-#define HID_RT_OUTPUT          0x02
-
-#define        EEPROM_START_ADDR       6
-#define        EEPROM_END_ADDR         63
-#define        EEPROM_PHYSICAL_LEN     64
-#define EEPROM_TEST_ADDR       EEPROM_END_ADDR
-#define        EEPROM_MAGIC_ADDR       6
-#define        EEPROM_MAGIC            34329
-#define        EEPROM_CS_ADDR          62
-#define        EEPROM_RXMIXERSET       8
-#define        EEPROM_TXMIXASET        9
-#define        EEPROM_TXMIXBSET        10
-#define        EEPROM_RXVOICEADJ       11
-#define        EEPROM_RXCTCSSADJ       13
-#define        EEPROM_TXCTCSSADJ       15
-#define        EEPROM_RXSQUELCHADJ     16
-
-/*! Global jitterbuffer configuration - by default, jb is disabled
- *  \note Values shown here match the defaults shown in usbradio.conf.sample */
-static struct ast_jb_conf default_jbconf =
-{
-       .flags = 0,
-       .max_size = 200,
-       .resync_threshold = 1000,
-       .impl = "fixed",
-       .target_extra = 40,
-};
-static struct ast_jb_conf global_jbconf;
-
-/*
- * usbradio.conf parameters are
-START_CONFIG
-
-[general]
-    ; General config options which propigate to all devices, with
-    ; default values shown. You may have as many devices as the
-    ; system will allow. You must use one section per device, with
-    ; [usb] generally (although its up to you) being the first device.
-    ;
-    ;
-    ; debug = 0x0              ; misc debug flags, default is 0
-
-       ; Set the device to use for I/O
-       ; devicenum = 0
-       ; Set hardware type here
-       ; hdwtype=0               ; 0=limey, 1=sph
-
-       ; rxboost=0          ; no rx gain boost
-       ; rxctcssrelax=1        ; reduce talkoff from radios w/o CTCSS Tx HPF
-       ; rxctcssfreqs=100.0,123.0      ; list of rx ctcss freq in floating point. must be in table
-       ; txctcssfreqs=100.0,123.0      ; list tx ctcss freq, any frequency permitted
-       ; txctcssdefault=100.0      ; default tx ctcss freq, any frequency permitted
-
-       ; carrierfrom=dsp     ;no,usb,usbinvert,dsp,vox
-       ; ctcssfrom=dsp       ;no,usb,dsp
-
-       ; rxdemod=flat            ; input type from radio: no,speaker,flat
-       ; txprelim=yes            ; output is pre-emphasised and limited
-       ; txtoctype=no            ; no,phase,notone
-
-       ; txmixa=composite        ;no,voice,tone,composite,auxvoice
-       ; txmixb=no               ;no,voice,tone,composite,auxvoice
-
-       ; invertptt=0
-
-    ;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
-    ; jbenable = yes              ; Enables the use of a jitterbuffer on the receiving side of an
-                                  ; USBRADIO channel. Defaults to "no". An enabled jitterbuffer will
-                                  ; be used only if the sending side can create and the receiving
-                                  ; side can not accept jitter. The USBRADIO channel can't accept jitter,
-                                  ; thus an enabled jitterbuffer on the receive USBRADIO side will always
-                                  ; be used if the sending side can create jitter.
-
-    ; jbmaxsize = 200             ; Max length of the jitterbuffer in milliseconds.
-
-    ; jbresyncthreshold = 1000    ; Jump in the frame timestamps over which the jitterbuffer is
-                                  ; resynchronized. Useful to improve the quality of the voice, with
-                                  ; big jumps in/broken timestamps, usualy sent from exotic devices
-                                  ; and programs. Defaults to 1000.
-
-    ; jbimpl = fixed              ; Jitterbuffer implementation, used on the receiving side of an USBRADIO
-                                  ; channel. Two implementations are currenlty available - "fixed"
-                                  ; (with size always equals to jbmax-size) and "adaptive" (with
-                                  ; variable size, actually the new jb of IAX2). Defaults to fixed.
-
-    ; jblog = no                  ; Enables jitterbuffer frame logging. Defaults to "no".
-    ;-----------------------------------------------------------------------------------
-
-[usb]
-
-; First channel unique config
-
-[usb1]
-
-; Second channel config
-
-END_CONFIG
-
- */
-
-/*
- * Helper macros to parse config arguments. They will go in a common
- * header file if their usage is globally accepted. In the meantime,
- * we define them here. Typical usage is as below.
- * Remember to open a block right before M_START (as it declares
- * some variables) and use the M_* macros WITHOUT A SEMICOLON:
- *
- *     {
- *             M_START(v->name, v->value) 
- *
- *             M_BOOL("dothis", x->flag1)
- *             M_STR("name", x->somestring)
- *             M_F("bar", some_c_code)
- *             M_END(some_final_statement)
- *             ... other code in the block
- *     }
- *
- * XXX NOTE these macros should NOT be replicated in other parts of asterisk. 
- * Likely we will come up with a better way of doing config file parsing.
- */
-#define M_START(var, val) \
-        char *__s = var; char *__val = val;
-#define M_END(x)   x;
-#define M_F(tag, f)                    if (!strcasecmp((__s), tag)) { f; } else
-#define M_BOOL(tag, dst)       M_F(tag, (dst) = ast_true(__val) )
-#define M_UINT(tag, dst)       M_F(tag, (dst) = strtoul(__val, NULL, 0) )
-#define M_STR(tag, dst)                M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
-
-/*
- * The following parameters are used in the driver:
- *
- *  FRAME_SIZE the size of an audio frame, in samples.
- *             160 is used almost universally, so you should not change it.
- *
- *  FRAGS      the argument for the SETFRAGMENT ioctl.
- *             Overridden by the 'frags' parameter in usbradio.conf
- *
- *             Bits 0-7 are the base-2 log of the device's block size,
- *             bits 16-31 are the number of blocks in the driver's queue.
- *             There are a lot of differences in the way this parameter
- *             is supported by different drivers, so you may need to
- *             experiment a bit with the value.
- *             A good default for linux is 30 blocks of 64 bytes, which
- *             results in 6 frames of 320 bytes (160 samples).
- *             FreeBSD works decently with blocks of 256 or 512 bytes,
- *             leaving the number unspecified.
- *             Note that this only refers to the device buffer size,
- *             this module will then try to keep the lenght of audio
- *             buffered within small constraints.
- *
- *  QUEUE_SIZE The max number of blocks actually allowed in the device
- *             driver's buffer, irrespective of the available number.
- *             Overridden by the 'queuesize' parameter in usbradio.conf
- *
- *             Should be >=2, and at most as large as the hw queue above
- *             (otherwise it will never be full).
- */
-
-#define FRAME_SIZE     160
-#define        QUEUE_SIZE      2                               
-
-#if defined(__FreeBSD__)
-#define        FRAGS   0x8
-#else
-#define        FRAGS   ( ( (6 * 5) << 16 ) | 0xc )
-#endif
-
-/*
- * XXX text message sizes are probably 256 chars, but i am
- * not sure if there is a suitable definition anywhere.
- */
-#define TEXT_SIZE      256
-
-#if 0
-#define        TRYOPEN 1                               /* try to open on startup */
-#endif
-#define        O_CLOSE 0x444                   /* special 'close' mode for device */
-/* Which device to use */
-#if defined( __OpenBSD__ ) || defined( __NetBSD__ )
-#define DEV_DSP "/dev/audio"
-#else
-#define DEV_DSP "/dev/dsp"
-#endif
-
-static const char *config = "usbradio.conf";   /* default config file */
-#define config1 "usbradio_tune_%s.conf"    /* tune config file */
-
-static FILE *frxcapraw = NULL, *frxcaptrace = NULL, *frxoutraw = NULL;
-static FILE *ftxcapraw = NULL, *ftxcaptrace = NULL, *ftxoutraw = NULL;
-
-static char *usb_device_list = NULL;
-static int usb_device_list_size = 0;
-
-static int usbradio_debug;
-#if 0 //maw asdf sph
-static int usbradio_debug_level = 0;
-#endif
-
-enum {RX_AUDIO_NONE,RX_AUDIO_SPEAKER,RX_AUDIO_FLAT};
-enum {CD_IGNORE,CD_XPMR_NOISE,CD_XPMR_VOX,CD_HID,CD_HID_INVERT};
-enum {SD_IGNORE,SD_HID,SD_HID_INVERT,SD_XPMR};                                  // no,external,externalinvert,software
-enum {RX_KEY_CARRIER,RX_KEY_CARRIER_CODE};
-enum {TX_OUT_OFF,TX_OUT_VOICE,TX_OUT_LSD,TX_OUT_COMPOSITE,TX_OUT_AUX};
-enum {TOC_NONE,TOC_PHASE,TOC_NOTONE};
-
-/*     DECLARE STRUCTURES */
-
-/*
- * Each sound is made of 'datalen' samples of sound, repeated as needed to
- * generate 'samplen' samples of data, then followed by 'silencelen' samples
- * of silence. The loop is repeated if 'repeat' is set.
- */
-struct sound {
-       int ind;
-       char *desc;
-       short *data;
-       int datalen;
-       int samplen;
-       int silencelen;
-       int repeat;
-};
-
-#ifndef        NEW_ASTERISK
-
-static struct sound sounds[] = {
-       { AST_CONTROL_RINGING, "RINGING", ringtone, sizeof(ringtone)/2, 16000, 32000, 1 },
-       { AST_CONTROL_BUSY, "BUSY", busy, sizeof(busy)/2, 4000, 4000, 1 },
-       { AST_CONTROL_CONGESTION, "CONGESTION", busy, sizeof(busy)/2, 2000, 2000, 1 },
-       { AST_CONTROL_RING, "RING10", ring10, sizeof(ring10)/2, 16000, 32000, 1 },
-       { AST_CONTROL_ANSWER, "ANSWER", answer, sizeof(answer)/2, 2200, 0, 0 },
-       { -1, NULL, 0, 0, 0, 0 },       /* end marker */
-};
-
-#endif
-
-/*
- * descriptor for one of our channels.
- * There is one used for 'default' values (from the [general] entry in
- * the configuration file), and then one instance for each device
- * (the default is cloned from [general], others are only created
- * if the relevant section exists).
- */
-struct chan_usbradio_pvt {
-       struct chan_usbradio_pvt *next;
-
-       char *name;
-#ifndef        NEW_ASTERISK
-       /*
-        * cursound indicates which in struct sound we play. -1 means nothing,
-        * any other value is a valid sound, in which case sampsent indicates
-        * the next sample to send in [0..samplen + silencelen]
-        * nosound is set to disable the audio data from the channel
-        * (so we can play the tones etc.).
-        */
-       int sndcmd[2];                          /* Sound command pipe */
-       int cursound;                           /* index of sound to send */
-       int sampsent;                           /* # of sound samples sent  */
-       int nosound;                            /* set to block audio from the PBX */
-#endif
-
-       int pttkick[2];
-       int total_blocks;                       /* total blocks in the output device */
-       int sounddev;
-       enum { M_UNSET, M_FULL, M_READ, M_WRITE } duplex;
-       i16 cdMethod;
-       int autoanswer;
-       int autohangup;
-       int hookstate;
-       unsigned int queuesize;         /* max fragments in queue */
-       unsigned int frags;                     /* parameter for SETFRAGMENT */
-
-       int warned;                                     /* various flags used for warnings */
-#define WARN_used_blocks       1
-#define WARN_speed             2
-#define WARN_frag              4
-       int w_errors;                           /* overfull in the write path */
-       struct timeval lastopen;
-
-       int overridecontext;
-       int mute;
-
-       /* boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must
-        * be representable in 16 bits to avoid overflows.
-        */
-#define        BOOST_SCALE     (1<<9)
-#define        BOOST_MAX       40                      /* slightly less than 7 bits */
-       int boost;                                      /* input boost, scaled by BOOST_SCALE */
-       char devicenum;
-       char devstr[128];
-       int spkrmax;
-       int micmax;
-
-#ifndef        NEW_ASTERISK
-       pthread_t sthread;
-#endif
-       pthread_t hidthread;
-
-       int stophid;
-       FILE *hkickhid;
-
-       struct ast_channel *owner;
-       char ext[AST_MAX_EXTENSION];
-       char ctx[AST_MAX_CONTEXT];
-       char language[MAX_LANGUAGE];
-       char cid_name[256];                     /*XXX */
-       char cid_num[256];                      /*XXX */
-       char mohinterpret[MAX_MUSICCLASS];
-
-       /* buffers used in usbradio_write, 2 per int by 2 channels by 6 times oversampling (48KS/s) */
-       char usbradio_write_buf[FRAME_SIZE * 2 * 2 * 6];    
-       char usbradio_write_buf_1[FRAME_SIZE * 2 * 2* 6];
-
-       int usbradio_write_dst;
-       /* buffers used in usbradio_read - AST_FRIENDLY_OFFSET space for headers
-        * plus enough room for a full frame
-        */
-       char usbradio_read_buf[FRAME_SIZE * (2 * 12) + AST_FRIENDLY_OFFSET];
-       char usbradio_read_buf_8k[FRAME_SIZE * 2 + AST_FRIENDLY_OFFSET];
-       int readpos;                            /* read position above */
-       struct ast_frame read_f;        /* returned by usbradio_read */
-
-       char    debuglevel;
-       char    radioduplex;                    // 
-       char    wanteeprom;
-
-       int     tracetype;
-       int     tracelevel;
-       char    area;
-       char    rptnum;
-       int     idleinterval;
-       int             turnoffs;
-       int     txsettletime;
-       char    ukey[48];
-
-       char lastrx;
-       char rxhidsq;
-       char rxcarrierdetect;           // status from pmr channel
-       char rxctcssdecode;                     // status from pmr channel
-
-       int  rxdcsdecode;
-       int  rxlsddecode;
-
-       char rxkeytype;
-       char rxkeyed;                           // indicates rx signal present
-
-       char lasttx;
-       char txkeyed;                           // tx key request from upper layers 
-       char txchankey;
-       char txtestkey;
-
-       time_t lasthidtime;
-    struct ast_dsp *dsp;
-
-       t_pmr_chan      *pmrChan;
-
-       char    rxcpusaver;
-       char    txcpusaver;
-
-       char    rxdemod;
-       float   rxgain;
-       char    rxcdtype;
-       char    rxsdtype;
-       int             rxsquelchadj;   /* this copy needs to be here for initialization */
-       int     rxsqvoxadj;
-       char    txtoctype;
-
-       char    txprelim;
-       float   txctcssgain;
-       char    txmixa;
-       char    txmixb;
-
-       char    invertptt;
-
-       char    rxctcssrelax;
-       float   rxctcssgain;
-
-       char    txctcssdefault[16];                             // for repeater operation
-       char    rxctcssfreqs[512];                              // a string
-       char    txctcssfreqs[512];
-
-       char    txctcssfreq[32];                                // encode now
-       char    rxctcssfreq[32];                                // decode now
-
-       char    numrxctcssfreqs;                                // how many
-       char    numtxctcssfreqs;
-
-       char    *rxctcss[CTCSS_NUM_CODES];              // pointers to strings
-       char    *txctcss[CTCSS_NUM_CODES];
-
-       int     txfreq;                                                 // in Hz
-       int     rxfreq;
-
-       //              start remote operation info
-       char    set_txctcssdefault[16];                         // for remote operation
-       char    set_txctcssfreq[16];                            // encode now
-       char    set_rxctcssfreq[16];                            // decode now
-
-       char    set_numrxctcssfreqs;                            // how many
-       char    set_numtxctcssfreqs;
-
-       char    set_rxctcssfreqs[16];                           // a string
-       char    set_txctcssfreqs[16];
-
-       char    *set_rxctcss;                                       // pointers to strings
-       char    *set_txctcss;
-
-       int     set_txfreq;                                                     // in Hz
-       int     set_rxfreq;
-       //              end remote operation info
-
-       int             rxmixerset;             
-       int     rxboostset;
-       float   rxvoiceadj;
-       float   rxctcssadj;
-       int     txmixaset;
-       int     txmixbset;
-       int     txctcssadj;
-
-       int     hdwtype;
-       int             hid_gpio_ctl;           
-       int             hid_gpio_ctl_loc;       
-       int             hid_io_cor;             
-       int             hid_io_cor_loc;         
-       int             hid_io_ctcss;           
-       int             hid_io_ctcss_loc;       
-       int             hid_io_ptt;             
-       int             hid_gpio_loc;           
-
-       struct {
-           unsigned rxcapraw:1;
-               unsigned txcapraw:1;
-               unsigned txcap2:1;
-               unsigned rxcap2:1;
-               unsigned rxplmon:1;
-               unsigned remoted:1;
-               unsigned txpolarity:1;
-               unsigned rxpolarity:1;
-               unsigned dcstxpolarity:1;
-               unsigned dcsrxpolarity:1;
-               unsigned lsdtxpolarity:1;
-               unsigned lsdrxpolarity:1;
-               unsigned loopback:1;
-               unsigned radioactive:1;
-       }b;
-       unsigned short eeprom[EEPROM_PHYSICAL_LEN];
-       char eepromctl;
-       ast_mutex_t eepromlock;
-
-       struct usb_dev_handle *usb_handle;
-       int readerrs;
-};
-
-// maw add additional defaults !!!
-static struct chan_usbradio_pvt usbradio_default = {
-#ifndef        NEW_ASTERISK
-       .cursound = -1,
-#endif
-       .sounddev = -1,
-       .duplex = M_UNSET,                      /* XXX check this */
-       .autoanswer = 1,
-       .autohangup = 1,
-       .queuesize = QUEUE_SIZE,
-       .frags = FRAGS,
-       .ext = "s",
-       .ctx = "default",
-       .readpos = AST_FRIENDLY_OFFSET, /* start here on reads */
-       .lastopen = { 0, 0 },
-       .boost = BOOST_SCALE,
-       .wanteeprom = 1,
-       .area = 0,
-       .rptnum = 0,
-};
-
-/*     DECLARE FUNCTION PROTOTYPES     */
-
-static void store_txtoctype(struct chan_usbradio_pvt *o, const char *s);
-static int     hidhdwconfig(struct chan_usbradio_pvt *o);
-static int set_txctcss_level(struct chan_usbradio_pvt *o);
-static void pmrdump(struct chan_usbradio_pvt *o);
-static void mult_set(struct chan_usbradio_pvt *o);
-static int  mult_calc(int value);
-static void mixer_write(struct chan_usbradio_pvt *o);
-static void tune_rxinput(int fd, struct chan_usbradio_pvt *o);
-static void tune_rxvoice(int fd, struct chan_usbradio_pvt *o);
-static void tune_rxctcss(int fd, struct chan_usbradio_pvt *o);
-static void tune_txoutput(struct chan_usbradio_pvt *o, int value, int fd);
-static void tune_write(struct chan_usbradio_pvt *o);
-
-static char *usbradio_active;   /* the active device */
-
-static int setformat(struct chan_usbradio_pvt *o, int mode);
-
-static struct ast_channel *usbradio_request(const char *type, struct ast_format_cap *cap,
-               const struct ast_channel *requestor,
-               void *data, int *cause);
-static int usbradio_digit_begin(struct ast_channel *c, char digit);
-static int usbradio_digit_end(struct ast_channel *c, char digit, unsigned int duration);
-static int usbradio_text(struct ast_channel *c, const char *text);
-static int usbradio_hangup(struct ast_channel *c);
-static int usbradio_answer(struct ast_channel *c);
-static struct ast_frame *usbradio_read(struct ast_channel *chan);
-static int usbradio_call(struct ast_channel *c, char *dest, int timeout);
-static int usbradio_write(struct ast_channel *chan, struct ast_frame *f);
-static int usbradio_indicate(struct ast_channel *chan, int cond, const void *data, size_t datalen);
-static int usbradio_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
-static int xpmr_config(struct chan_usbradio_pvt *o);
-
-#if    DEBUG_FILETEST == 1
-static int RxTestIt(struct chan_usbradio_pvt *o);
-#endif
-
-static char tdesc[] = "USB (CM108) Radio Channel Driver";
-
-static struct ast_format slin;
-
-static struct ast_channel_tech usbradio_tech = {
-       .type = "Radio",
-       .description = tdesc,
-       .requester = usbradio_request,
-       .send_digit_begin = usbradio_digit_begin,
-       .send_digit_end = usbradio_digit_end,
-       .send_text = usbradio_text,
-       .hangup = usbradio_hangup,
-       .answer = usbradio_answer,
-       .read = usbradio_read,
-       .call = usbradio_call,
-       .write = usbradio_write,
-       .indicate = usbradio_indicate,
-       .fixup = usbradio_fixup,
-};
-
-/* Call with:  devnum: alsa major device number, param: ascii Formal
-Parameter Name, val1, first or only value, val2 second value, or 0 
-if only 1 value. Values: 0-99 (percent) or 0-1 for baboon.
-
-Note: must add -lasound to end of linkage */
-
-static int amixer_max(int devnum,char *param)
-{
-int    rv,type;
-char   str[100];
-snd_hctl_t *hctl;
-snd_ctl_elem_id_t *id;
-snd_hctl_elem_t *elem;
-snd_ctl_elem_info_t *info;
-
-       sprintf(str,"hw:%d",devnum);
-       if (snd_hctl_open(&hctl, str, 0)) return(-1);
-       snd_hctl_load(hctl);
-       snd_ctl_elem_id_alloca(&id);
-       snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
-       snd_ctl_elem_id_set_name(id, param);  
-       elem = snd_hctl_find_elem(hctl, id);
-       if (!elem)
-       {
-               snd_hctl_close(hctl);
-               return(-1);
-       }
-       snd_ctl_elem_info_alloca(&info);
-       snd_hctl_elem_info(elem,info);
-       type = snd_ctl_elem_info_get_type(info);
-       rv = 0;
-       switch(type)
-       {
-           case SND_CTL_ELEM_TYPE_INTEGER:
-               rv = snd_ctl_elem_info_get_max(info);
-               break;
-           case SND_CTL_ELEM_TYPE_BOOLEAN:
-               rv = 1;
-               break;
-       }
-       snd_hctl_close(hctl);
-       return(rv);
-}
-
-/* Call with:  devnum: alsa major device number, param: ascii Formal
-Parameter Name, val1, first or only value, val2 second value, or 0 
-if only 1 value. Values: 0-99 (percent) or 0-1 for baboon.
-
-Note: must add -lasound to end of linkage */
-
-static int setamixer(int devnum,char *param, int v1, int v2)
-{
-int    type;
-char   str[100];
-snd_hctl_t *hctl;
-snd_ctl_elem_id_t *id;
-snd_ctl_elem_value_t *control;
-snd_hctl_elem_t *elem;
-snd_ctl_elem_info_t *info;
-
-       sprintf(str,"hw:%d",devnum);
-       if (snd_hctl_open(&hctl, str, 0)) return(-1);
-       snd_hctl_load(hctl);
-       snd_ctl_elem_id_alloca(&id);
-       snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_MIXER);
-       snd_ctl_elem_id_set_name(id, param);  
-       elem = snd_hctl_find_elem(hctl, id);
-       if (!elem)
-       {
-               snd_hctl_close(hctl);
-               return(-1);
-       }
-       snd_ctl_elem_info_alloca(&info);
-       snd_hctl_elem_info(elem,info);
-       type = snd_ctl_elem_info_get_type(info);
-       snd_ctl_elem_value_alloca(&control);
-       snd_ctl_elem_value_set_id(control, id);    
-       switch(type)
-       {
-           case SND_CTL_ELEM_TYPE_INTEGER:
-               snd_ctl_elem_value_set_integer(control, 0, v1);
-               if (v2 > 0) snd_ctl_elem_value_set_integer(control, 1, v2);
-               break;
-           case SND_CTL_ELEM_TYPE_BOOLEAN:
-               snd_ctl_elem_value_set_integer(control, 0, (v1 != 0));
-               break;
-       }
-       if (snd_hctl_elem_write(elem, control))
-       {
-               snd_hctl_close(hctl);
-               return(-1);
-       }
-       snd_hctl_close(hctl);
-       return(0);
-}
-
-static void hid_set_outputs(struct usb_dev_handle *handle,
-         unsigned char *outputs)
-{
-       usleep(1500);
-       usb_control_msg(handle,
-             USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE,
-             HID_REPORT_SET,
-             0 + (HID_RT_OUTPUT << 8),
-             C108_HID_INTERFACE,
-             (char*)outputs, 4, 5000);
-}
-
-static void hid_get_inputs(struct usb_dev_handle *handle,
-         unsigned char *inputs)
-{
-       usleep(1500);
-       usb_control_msg(handle,
-             USB_ENDPOINT_IN + USB_TYPE_CLASS + USB_RECIP_INTERFACE,
-             HID_REPORT_GET,
-             0 + (HID_RT_INPUT << 8),
-             C108_HID_INTERFACE,
-             (char*)inputs, 4, 5000);
-}
-
-static unsigned short read_eeprom(struct usb_dev_handle *handle, int addr)
-{
-       unsigned char buf[4];
-
-       buf[0] = 0x80;
-       buf[1] = 0;
-       buf[2] = 0;
-       buf[3] = 0x80 | (addr & 0x3f);
-       hid_set_outputs(handle,buf);
-       memset(buf,0,sizeof(buf));
-       hid_get_inputs(handle,buf);
-       return(buf[1] + (buf[2] << 8));
-}
-
-static void write_eeprom(struct usb_dev_handle *handle, int addr, 
-   unsigned short data)
-{
-
-       unsigned char buf[4];
-
-       buf[0] = 0x80;
-       buf[1] = data & 0xff;
-       buf[2] = data >> 8;
-       buf[3] = 0xc0 | (addr & 0x3f);
-       hid_set_outputs(handle,buf);
-}
-
-static unsigned short get_eeprom(struct usb_dev_handle *handle,
-       unsigned short *buf)
-{
-int    i;
-unsigned short cs;
-
-       cs = 0xffff;
-       for(i = EEPROM_START_ADDR; i < EEPROM_END_ADDR; i++)
-       {
-               cs += buf[i] = read_eeprom(handle,i);
-       }
-       return(cs);
-}
-
-static void put_eeprom(struct usb_dev_handle *handle,unsigned short *buf)
-{
-int    i;
-unsigned short cs;
-
-       cs = 0xffff;
-       buf[EEPROM_MAGIC_ADDR] = EEPROM_MAGIC;
-       for(i = EEPROM_START_ADDR; i < EEPROM_CS_ADDR; i++)
-       {
-               write_eeprom(handle,i,buf[i]);
-               cs += buf[i];
-       }
-       buf[EEPROM_CS_ADDR] = (65535 - cs) + 1;
-       write_eeprom(handle,i,buf[EEPROM_CS_ADDR]);
-}
-
-static struct usb_device *hid_device_init(char *desired_device)
-{
-    struct usb_bus *usb_bus;
-    struct usb_device *dev;
-    char devstr[200],str[200],desdev[200],*cp;
-    int i;
-    FILE *fp;
-
-    usb_init();
-    usb_find_busses();
-    usb_find_devices();
-    for (usb_bus = usb_busses;
-         usb_bus;
-         usb_bus = usb_bus->next) {
-        for (dev = usb_bus->devices;
-             dev;
-             dev = dev->next) {
-            if ((dev->descriptor.idVendor
-                  == C108_VENDOR_ID) &&
-                (dev->descriptor.idProduct
-                  == C108_PRODUCT_ID))
-               {
-                        sprintf(devstr,"%s/%s", usb_bus->dirname,dev->filename);
-                       for(i = 0; i < 32; i++)
-                       {
-                               sprintf(str,"/proc/asound/card%d/usbbus",i);
-                               fp = fopen(str,"r");
-                               if (!fp) continue;
-                               if ((!fgets(desdev,sizeof(desdev) - 1,fp)) || (!desdev[0]))
-                               {
-                                       fclose(fp);
-                                       continue;
-                               }
-                               fclose(fp);
-                               if (desdev[strlen(desdev) - 1] == '\n')
-                                       desdev[strlen(desdev) -1 ] = 0;
-                               if (strcasecmp(desdev,devstr)) continue;
-                               if (i) sprintf(str,"/sys/class/sound/dsp%d/device",i);
-                               else strcpy(str,"/sys/class/sound/dsp/device");
-                               memset(desdev,0,sizeof(desdev));
-                               if (readlink(str,desdev,sizeof(desdev) - 1) == -1)
-                               {
-                                       sprintf(str,"/sys/class/sound/controlC%d/device",i);
-                                       memset(desdev,0,sizeof(desdev));
-                                       if (readlink(str,desdev,sizeof(desdev) - 1) == -1) continue;
-                               }
-                               cp = strrchr(desdev,'/');
-                               if (cp) *cp = 0; else continue;
-                               cp = strrchr(desdev,'/');
-                               if (!cp) continue;
-                               cp++;
-                               break;
-                       }
-                       if (i >= 32) continue;
-                        if (!strcmp(cp,desired_device)) return dev;
-               }
-
-        }
-    }
-    return NULL;
-}
-
-static int hid_device_mklist(void)
-{
-    struct usb_bus *usb_bus;
-    struct usb_device *dev;
-    char devstr[200],str[200],desdev[200],*cp;
-    int i;
-    FILE *fp;
-
-    usb_device_list = ast_malloc(2);
-    if (!usb_device_list) return -1;
-    memset(usb_device_list,0,2);
-
-    usb_init();
-    usb_find_busses();
-    usb_find_devices();
-    for (usb_bus = usb_busses;
-         usb_bus;
-         usb_bus = usb_bus->next) {
-        for (dev = usb_bus->devices;
-             dev;
-             dev = dev->next) {
-            if ((dev->descriptor.idVendor
-                  == C108_VENDOR_ID) &&
-                (dev->descriptor.idProduct
-                  == C108_PRODUCT_ID))
-               {
-                        sprintf(devstr,"%s/%s", usb_bus->dirname,dev->filename);
-                       for(i = 0;i < 32; i++)
-                       {
-                               sprintf(str,"/proc/asound/card%d/usbbus",i);
-                               fp = fopen(str,"r");
-                               if (!fp) continue;
-                               if ((!fgets(desdev,sizeof(desdev) - 1,fp)) || (!desdev[0]))
-                               {
-                                       fclose(fp);
-                                       continue;
-                               }
-                               fclose(fp);
-                               if (desdev[strlen(desdev) - 1] == '\n')
-                                       desdev[strlen(desdev) -1 ] = 0;
-                               if (strcasecmp(desdev,devstr)) continue;
-                               if (i) sprintf(str,"/sys/class/sound/dsp%d/device",i);
-                               else strcpy(str,"/sys/class/sound/dsp/device");
-                               memset(desdev,0,sizeof(desdev));
-                               if (readlink(str,desdev,sizeof(desdev) - 1) == -1)
-                               {
-                                       sprintf(str,"/sys/class/sound/controlC%d/device",i);
-                                       memset(desdev,0,sizeof(desdev));
-                                       if (readlink(str,desdev,sizeof(desdev) - 1) == -1) continue;
-                               }
-                               cp = strrchr(desdev,'/');
-                               if (cp) *cp = 0; else continue;
-                               cp = strrchr(desdev,'/');
-                               if (!cp) continue;
-                               cp++;
-                               break;
-                       }
-                       if (i >= 32) return -1;
-                       usb_device_list = ast_realloc(usb_device_list,
-                               usb_device_list_size + 2 +
-                                       strlen(cp));
-                       if (!usb_device_list) return -1;
-                       usb_device_list_size += strlen(cp) + 2;
-                       i = 0;
-                       while(usb_device_list[i])
-                       {
-                               i += strlen(usb_device_list + i) + 1;
-                       }
-                       strcat(usb_device_list + i,cp);
-                       usb_device_list[strlen(cp) + i + 1] = 0;
-               }
-
-        }
-    }
-    return 0;
-}
-
-/* returns internal formatted string from external one */
-static int usb_get_usbdev(char *devstr)
-{
-int    i;
-char   str[200],desdev[200],*cp;
-
-       for(i = 0;i < 32; i++)
-       {
-               if (i) sprintf(str,"/sys/class/sound/dsp%d/device",i);
-               else strcpy(str,"/sys/class/sound/dsp/device");
-               memset(desdev,0,sizeof(desdev));
-               if (readlink(str,desdev,sizeof(desdev) - 1) == -1)
-               {
-                       sprintf(str,"/sys/class/sound/controlC%d/device",i);
-                       memset(desdev,0,sizeof(desdev));
-                       if (readlink(str,desdev,sizeof(desdev) - 1) == -1) continue;
-               }
-               cp = strrchr(desdev,'/');
-               if (cp) *cp = 0; else continue;
-               cp = strrchr(desdev,'/');
-               if (!cp) continue;
-               cp++;
-               if (!strcasecmp(cp,devstr)) break;
-       }
-       if (i >= 32) return -1;
-       return i;
-
-}
-
-static int usb_list_check(char *devstr)
-{
-
-char *s = usb_device_list;
-
-       if (!s) return(0);
-       while(*s)
-       {
-               if (!strcasecmp(s,devstr)) return(1);
-               s += strlen(s) + 1;
-       }
-       return(0);
-}
-
-
-static int     hidhdwconfig(struct chan_usbradio_pvt *o)
-{
-       if(o->hdwtype==1)         //sphusb
-       {
-               o->hid_gpio_ctl         =  0x08;        /* set GPIO4 to output mode */
-               o->hid_gpio_ctl_loc     =  2;   /* For CTL of GPIO */
-               o->hid_io_cor           =  4;   /* GPIO3 is COR */
-               o->hid_io_cor_loc       =  1;   /* GPIO3 is COR */
-               o->hid_io_ctcss         =  2;   /* GPIO 2 is External CTCSS */
-               o->hid_io_ctcss_loc =  1;       /* is GPIO 2 */
-               o->hid_io_ptt           =  8;   /* GPIO 4 is PTT */
-               o->hid_gpio_loc         =  1;   /* For ALL GPIO */
-       }
-       else if(o->hdwtype==0)  //dudeusb
-       {
-               o->hid_gpio_ctl         =  0x0c;        /* set GPIO 3 & 4 to output mode */
-               o->hid_gpio_ctl_loc     =  2;   /* For CTL of GPIO */
-               o->hid_io_cor           =  2;   /* VOLD DN is COR */
-               o->hid_io_cor_loc       =  0;   /* VOL DN COR */
-               o->hid_io_ctcss         =  2;   /* GPIO 2 is External CTCSS */
-               o->hid_io_ctcss_loc =  1;       /* is GPIO 2 */
-               o->hid_io_ptt           =  4;   /* GPIO 3 is PTT */
-               o->hid_gpio_loc         =  1;   /* For ALL GPIO */
-       }
-       else if(o->hdwtype==3)  // custom version
-       {
-               o->hid_gpio_ctl         =  0x0c;        /* set GPIO 3 & 4 to output mode */
-               o->hid_gpio_ctl_loc     =  2;   /* For CTL of GPIO */
-               o->hid_io_cor           =  2;   /* VOLD DN is COR */
-               o->hid_io_cor_loc       =  0;   /* VOL DN COR */
-               o->hid_io_ctcss         =  2;   /* GPIO 2 is External CTCSS */
-               o->hid_io_ctcss_loc =  1;       /* is GPIO 2 */
-               o->hid_io_ptt           =  4;   /* GPIO 3 is PTT */
-               o->hid_gpio_loc         =  1;   /* For ALL GPIO */
-       }
-
-       return 0;
-}
-/*
-*/
-static void kickptt(struct chan_usbradio_pvt *o)
-{
-       char c = 0;
-       //printf("kickptt  %i  %i  %i\n",o->txkeyed,o->txchankey,o->txtestkey);
-       if (!o) return;
-       if (!o->pttkick) return;
-       if (write(o->pttkick[1],&c,1) < 0) {
-               ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno));
-       }
-}
-/*
-*/
-static void *hidthread(void *arg)
-{
-       unsigned char buf[4],bufsave[4],keyed;
-       char txtmp;
-       int res;
-       struct usb_device *usb_dev;
-       struct usb_dev_handle *usb_handle;
-       struct chan_usbradio_pvt *o = (struct chan_usbradio_pvt *) arg;
-       struct pollfd pfd = { .events = POLLIN };
-
-       usb_dev = hid_device_init(o->devstr);
-       if (usb_dev == NULL) {
-               ast_log(LOG_ERROR,"USB HID device not found\n");
-               pthread_exit(NULL);
-       }
-       usb_handle = usb_open(usb_dev);
-       if (usb_handle == NULL) {
-               ast_log(LOG_ERROR,"Not able to open USB device\n");
-               pthread_exit(NULL);
-       }
-       if (usb_claim_interface(usb_handle,C108_HID_INTERFACE) < 0)
-       {
-           if (usb_detach_kernel_driver_np(usb_handle,C108_HID_INTERFACE) < 0) {
-                       ast_log(LOG_ERROR,"Not able to detach the USB device\n");
-                       pthread_exit(NULL);
-               }
-               if (usb_claim_interface(usb_handle,C108_HID_INTERFACE) < 0) {
-                       ast_log(LOG_ERROR,"Not able to claim the USB device\n");
-                       pthread_exit(NULL);
-               }
-       }
-       memset(buf,0,sizeof(buf));
-       buf[2] = o->hid_gpio_ctl;
-       buf[1] = 0;
-       hid_set_outputs(usb_handle,buf);
-       memcpy(bufsave,buf,sizeof(buf));
-       if (pipe(o->pttkick) == -1)
-       {
-           ast_log(LOG_ERROR,"Not able to create pipe\n");
-               pthread_exit(NULL);
-       }
-       traceusb1(("hidthread: Starting normally on %s!!\n",o->name));
-       // popen 
-       while (!o->stophid) {
-               pfd.fd = o->pttkick[0];
-               pfd.revents = 0;
-
-               res = ast_poll(&pfd, 1, 50);
-               if (res < 0) {
-                       ast_log(LOG_WARNING, "poll() failed: %s\n", strerror(errno));
-                       usleep(10000);
-                       continue;
-               }
-               if (pfd.revents & POLLIN) {
-                       char c;
-
-                       if (read(o->pttkick[0], &c, 1) < 0) {
-                               ast_log(LOG_ERROR, "read() failed: %s\n", strerror(errno));
-                       }
-               }
-               if (o->wanteeprom) {
-                       ast_mutex_lock(&o->eepromlock);
-                       if (o->eepromctl == 1) { /* to read */
-                               /* if CS okay */
-                               if (!get_eeprom(usb_handle, o->eeprom)) {
-                                       if (o->eeprom[EEPROM_MAGIC_ADDR] != EEPROM_MAGIC) {
-                                               ast_log(LOG_NOTICE, "UNSUCCESSFUL: EEPROM MAGIC NUMBER BAD on channel %s\n", o->name);
-                                       } else {
-                                               o->rxmixerset = o->eeprom[EEPROM_RXMIXERSET];
-                                               o->txmixaset = o->eeprom[EEPROM_TXMIXASET];
-                                               o->txmixbset = o->eeprom[EEPROM_TXMIXBSET];
-                                               memcpy(&o->rxvoiceadj, &o->eeprom[EEPROM_RXVOICEADJ], sizeof(float));
-                                               memcpy(&o->rxctcssadj, &o->eeprom[EEPROM_RXCTCSSADJ], sizeof(float));
-                                               o->txctcssadj = o->eeprom[EEPROM_TXCTCSSADJ];
-                                               o->rxsquelchadj = o->eeprom[EEPROM_RXSQUELCHADJ];
-                                               ast_log(LOG_NOTICE,"EEPROM Loaded on channel %s\n",o->name);
-                                       }
-                               } else {
-                                       ast_log(LOG_NOTICE, "USB Adapter has no EEPROM installed or Checksum BAD on channel %s\n", o->name);
-                               }
-                               hid_set_outputs(usb_handle,bufsave);
-                       }
-                       if (o->eepromctl == 2) { /* to write */
-                               put_eeprom(usb_handle,o->eeprom);
-                               hid_set_outputs(usb_handle,bufsave);
-                               ast_log(LOG_NOTICE, "USB Parameters written to EEPROM on %s\n", o->name);
-                       }
-                       o->eepromctl = 0;
-                       ast_mutex_unlock(&o->eepromlock);
-               }
-               buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
-               hid_get_inputs(usb_handle,buf);
-               keyed = !(buf[o->hid_io_cor_loc] & o->hid_io_cor);
-               if (keyed != o->rxhidsq) {
-                       if (o->debuglevel) {
-                               printf("chan_usbradio() hidthread: update rxhidsq = %d\n", keyed);
-                       }
-                       o->rxhidsq=keyed;
-               }
-
-               /* if change in tx state as controlled by xpmr */
-               txtmp = o->pmrChan->txPttOut;
-
-               if (o->lasttx != txtmp) {
-                       o->pmrChan->txPttHid = o->lasttx = txtmp;
-                       if (o->debuglevel) {
-                               ast_debug(0, "hidthread: tx set to %d\n", txtmp);
-                       }
-                       buf[o->hid_gpio_loc] = 0;
-                       if (!o->invertptt) {
-                               if (txtmp) {
-                                       buf[o->hid_gpio_loc] = o->hid_io_ptt;
-                               }
-                       } else {
-                               if (!txtmp) {
-                                       buf[o->hid_gpio_loc] = o->hid_io_ptt;
-                               }
-                       }
-                       buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
-                       memcpy(bufsave, buf, sizeof(buf));
-                       hid_set_outputs(usb_handle, buf);
-               }
-               time(&o->lasthidtime);
-       }
-       buf[o->hid_gpio_loc] = 0;
-       if (o->invertptt) {
-               buf[o->hid_gpio_loc] = o->hid_io_ptt;
-       }
-       buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
-       hid_set_outputs(usb_handle, buf);
-       pthread_exit(0);
-}
-
-/*
- * returns a pointer to the descriptor with the given name
- */
-static struct chan_usbradio_pvt *find_desc(char *dev)
-{
-       struct chan_usbradio_pvt *o = NULL;
-
-       if (!dev)
-               ast_log(LOG_WARNING, "null dev\n");
-
-       for (o = usbradio_default.next; o && o->name && dev && strcmp(o->name, dev) != 0; o = o->next);
-       if (!o)
-       {
-               ast_log(LOG_WARNING, "could not find <%s>\n", dev ? dev : "--no-device--");
-       }
-
-       return o;
-}
-
-static struct chan_usbradio_pvt *find_desc_usb(char *devstr)
-{
-       struct chan_usbradio_pvt *o = NULL;
-
-       if (!devstr)
-               ast_log(LOG_WARNING, "null dev\n");
-
-       for (o = usbradio_default.next; o && devstr && strcmp(o->devstr, devstr) != 0; o = o->next);
-
-       return o;
-}
-
-/*
- * split a string in extension-context, returns pointers to malloc'ed
- * strings.
- * If we do not have 'overridecontext' then the last @ is considered as
- * a context separator, and the context is overridden.
- * This is usually not very necessary as you can play with the dialplan,
- * and it is nice not to need it because you have '@' in SIP addresses.
- * Return value is the buffer address.
- */
-#if    0
-static char *ast_ext_ctx(const char *src, char **ext, char **ctx)
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
-       if (ext == NULL || ctx == NULL)
-               return NULL;                    /* error */
-
-       *ext = *ctx = NULL;
-
-       if (src && *src != '\0')
-               *ext = ast_strdup(src);
-
-       if (*ext == NULL)
-               return NULL;
-
-       if (!o->overridecontext) {
-               /* parse from the right */
-               *ctx = strrchr(*ext, '@');
-               if (*ctx)
-                       *(*ctx)++ = '\0';
-       }
-
-       return *ext;
-}
-#endif
-
-/*
- * Returns the number of blocks used in the audio output channel
- */
-static int used_blocks(struct chan_usbradio_pvt *o)
-{
-       struct audio_buf_info info;
-
-       if (ioctl(o->sounddev, SNDCTL_DSP_GETOSPACE, &info)) {
-               if (!(o->warned & WARN_used_blocks)) {
-                       ast_log(LOG_WARNING, "Error reading output space\n");
-                       o->warned |= WARN_used_blocks;
-               }
-               return 1;
-       }
-
-       if (o->total_blocks == 0) {
-               if (0)                                  /* debugging */
-                       ast_log(LOG_WARNING, "fragtotal %d size %d avail %d\n", info.fragstotal, info.fragsize, info.fragments);
-               o->total_blocks = info.fragments;
-       }
-
-       return o->total_blocks - info.fragments;
-}
-
-/* Write an exactly FRAME_SIZE sized frame */
-static int soundcard_writeframe(struct chan_usbradio_pvt *o, short *data)
-{
-       int res;
-
-       if (o->sounddev < 0)
-               setformat(o, O_RDWR);
-       if (o->sounddev < 0)
-               return 0;                               /* not fatal */
-       //  maw maw sph !!! may or may not be a good thing
-       //  drop the frame if not transmitting, this keeps from gradually
-       //  filling the buffer when asterisk clock > usb sound clock
-       if(!o->pmrChan->txPttIn && !o->pmrChan->txPttOut)
-       {
-               //return 0;
-       }
-       /*
-        * Nothing complex to manage the audio device queue.
-        * If the buffer is full just drop the extra, otherwise write.
-        * XXX in some cases it might be useful to write anyways after
-        * a number of failures, to restart the output chain.
-        */
-       res = used_blocks(o);
-       if (res > o->queuesize) {       /* no room to write a block */
-           // ast_log(LOG_WARNING, "sound device write buffer overflow\n");
-               if (o->w_errors++ == 0 && (usbradio_debug & 0x4))
-                       ast_log(LOG_WARNING, "write: used %d blocks (%d)\n", res, o->w_errors);
-               return 0;
-       }
-       o->w_errors = 0;
-
-       return write(o->sounddev, ((void *) data), FRAME_SIZE * 2 * 12);
-}
-
-#ifndef        NEW_ASTERISK
-
-/*
- * Handler for 'sound writable' events from the sound thread.
- * Builds a frame from the high level description of the sounds,
- * and passes it to the audio device.
- * The actual sound is made of 1 or more sequences of sound samples
- * (s->datalen, repeated to make s->samplen samples) followed by
- * s->silencelen samples of silence. The position in the sequence is stored
- * in o->sampsent, which goes between 0 .. s->samplen+s->silencelen.
- * In case we fail to write a frame, don't update o->sampsent.
- */
-static void send_sound(struct chan_usbradio_pvt *o)
-{
-       short myframe[FRAME_SIZE];
-       int ofs, l, start;
-       int l_sampsent = o->sampsent;
-       struct sound *s;
-
-       if (o->cursound < 0)            /* no sound to send */
-               return;
-
-       s = &sounds[o->cursound];
-
-       for (ofs = 0; ofs < FRAME_SIZE; ofs += l) {
-               l = s->samplen - l_sampsent;    /* # of available samples */
-               if (l > 0) {
-                       start = l_sampsent % s->datalen;        /* source offset */
-                       if (l > FRAME_SIZE - ofs)       /* don't overflow the frame */
-                               l = FRAME_SIZE - ofs;
-                       if (l > s->datalen - start)     /* don't overflow the source */
-                               l = s->datalen - start;
-                       memmove(myframe + ofs, s->data + start, l * 2);
-                       if (0)
-                               ast_log(LOG_WARNING, "send_sound sound %d/%d of %d into %d\n", l_sampsent, l, s->samplen, ofs);
-                       l_sampsent += l;
-               } else {                                /* end of samples, maybe some silence */
-                       static const short silence[FRAME_SIZE] = { 0, };
-
-                       l += s->silencelen;
-                       if (l > 0) {
-                               if (l > FRAME_SIZE - ofs)
-                                       l = FRAME_SIZE - ofs;
-                               memmove(myframe + ofs, silence, l * 2);
-                               l_sampsent += l;
-                       } else {                        /* silence is over, restart sound if loop */
-                               if (s->repeat == 0) {   /* last block */
-                                       o->cursound = -1;
-                                       o->nosound = 0; /* allow audio data */
-                                       if (ofs < FRAME_SIZE)   /* pad with silence */
-                                               memmove(myframe + ofs, silence, (FRAME_SIZE - ofs) * 2);
-                               }
-                               l_sampsent = 0;
-                       }
-               }
-       }
-       l = soundcard_writeframe(o, myframe);
-       if (l > 0)
-               o->sampsent = l_sampsent;       /* update status */
-}
-
-static void *sound_thread(void *arg)
-{
-       char ign[4096];
-       struct chan_usbradio_pvt *o = (struct chan_usbradio_pvt *) arg;
-
-       /*
-        * Just in case, kick the driver by trying to read from it.
-        * Ignore errors - this read is almost guaranteed to fail.
-        */
-       read(o->sounddev, ign, sizeof(ign));
-       for (;;) {
-               struct pollfd pfd[2] = { { .fd = o->sndcmd[0], .events = POLLIN }, { .fd = o->sounddev } };
-               int res;
-
-               if (o->cursound > -1 && o->sounddev < 0) {
-                       setformat(o, O_RDWR);   /* need the channel, try to reopen */
-               } else if (o->cursound == -1 && o->owner == NULL) {
-                       setformat(o, O_CLOSE);  /* can close */
-               }
-               if (o->sounddev > -1) {
-                       if (!o->owner) {        /* no one owns the audio, so we must drain it */
-                               pfd[1].events = POLLIN;
-                       }
-                       if (o->cursound > -1) {
-                               pfd[1].events |= POLLOUT;
-                       }
-               }
-               res = ast_poll(pfd, o->sounddev > -1 ? 2 : 1, -1);
-               if (res < 1) {
-                       ast_log(LOG_WARNING, "poll failed: %s\n", strerror(errno));
-                       sleep(1);
-                       continue;
-               }
-               if (pfd[0].revents & POLLIN) {
-                       /* read which sound to play from the pipe */
-                       int i, what = -1;
-
-                       read(o->sndcmd[0], &what, sizeof(what));
-                       for (i = 0; sounds[i].ind != -1; i++) {
-                               if (sounds[i].ind == what) {
-                                       o->cursound = i;
-                                       o->sampsent = 0;
-                                       o->nosound = 1; /* block audio from pbx */
-                                       break;
-                               }
-                       }
-                       if (sounds[i].ind == -1) {
-                               ast_log(LOG_WARNING, "invalid sound index: %d\n", what);
-                       }
-               }
-               if (o->sounddev > -1) {
-                       if (pfd[1].revents & POLLIN) { /* read and ignore errors */
-                               read(o->sounddev, ign, sizeof(ign)); 
-                       }
-                       if (pfd[1].revents & POLLOUT) {
-                               send_sound(o);
-                       }
-               }
-       }
-       return NULL;                            /* Never reached */
-}
-
-#endif
-
-/*
- * reset and close the device if opened,
- * then open and initialize it in the desired mode,
- * trigger reads and writes so we can start using it.
- */
-static int setformat(struct chan_usbradio_pvt *o, int mode)
-{
-       int fmt, desired, res, fd;
-       char device[100];
-
-       if (o->sounddev >= 0) {
-               ioctl(o->sounddev, SNDCTL_DSP_RESET, 0);
-               close(o->sounddev);
-               o->duplex = M_UNSET;
-               o->sounddev = -1;
-       }
-       if (mode == O_CLOSE)            /* we are done */
-               return 0;
-       o->lastopen = ast_tvnow();
-       strcpy(device,"/dev/dsp");
-       if (o->devicenum)
-               sprintf(device,"/dev/dsp%d",o->devicenum);
-       fd = o->sounddev = open(device, mode | O_NONBLOCK);
-       if (fd < 0) {
-               ast_log(LOG_WARNING, "Unable to re-open DSP device %d: %s\n", o->devicenum, strerror(errno));
-               return -1;
-       }
-       if (o->owner)
-               o->owner->fds[0] = fd;
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-       fmt = AFMT_S16_LE;
-#else
-       fmt = AFMT_S16_BE;
-#endif
-       res = ioctl(fd, SNDCTL_DSP_SETFMT, &fmt);
-       if (res < 0) {
-               ast_log(LOG_WARNING, "Unable to set format to 16-bit signed\n");
-               return -1;
-       }
-       switch (mode) {
-               case O_RDWR:
-                       res = ioctl(fd, SNDCTL_DSP_SETDUPLEX, 0);
-                       /* Check to see if duplex set (FreeBSD Bug) */
-                       res = ioctl(fd, SNDCTL_DSP_GETCAPS, &fmt);
-                       if (res == 0 && (fmt & DSP_CAP_DUPLEX)) {
-                               if (option_verbose > 1)
-                                       ast_verbose(VERBOSE_PREFIX_2 "Console is full duplex\n");
-                               o->duplex = M_FULL;
-                       };
-                       break;
-               case O_WRONLY:
-                       o->duplex = M_WRITE;
-                       break;
-               case O_RDONLY:
-                       o->duplex = M_READ;
-                       break;
-       }
-
-       fmt = 1;
-       res = ioctl(fd, SNDCTL_DSP_STEREO, &fmt);
-       if (res < 0) {
-               ast_log(LOG_WARNING, "Failed to set audio device to mono\n");
-               return -1;
-       }
-       fmt = desired = 48000;                                                  /* 8000 Hz desired */
-       res = ioctl(fd, SNDCTL_DSP_SPEED, &fmt);
-
-       if (res < 0) {
-               ast_log(LOG_WARNING, "Failed to set audio device to mono\n");
-               return -1;
-       }
-       if (fmt != desired) {
-               if (!(o->warned & WARN_speed)) {
-                       ast_log(LOG_WARNING,
-                           "Requested %d Hz, got %d Hz -- sound may be choppy\n",
-                           desired, fmt);
-                       o->warned |= WARN_speed;
-               }
-       }
-       /*
-        * on Freebsd, SETFRAGMENT does not work very well on some cards.
-        * Default to use 256 bytes, let the user override
-        */
-       if (o->frags) {
-               fmt = o->frags;
-               res = ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fmt);
-               if (res < 0) {
-                       if (!(o->warned & WARN_frag)) {
-                               ast_log(LOG_WARNING,
-                                       "Unable to set fragment size -- sound may be choppy\n");
-                               o->warned |= WARN_frag;
-                       }
-               }
-       }
-       /* on some cards, we need SNDCTL_DSP_SETTRIGGER to start outputting */
-       res = PCM_ENABLE_INPUT | PCM_ENABLE_OUTPUT;
-       res = ioctl(fd, SNDCTL_DSP_SETTRIGGER, &res);
-       /* it may fail if we are in half duplex, never mind */
-       return 0;
-}
-
-/*
- * some of the standard methods supported by channels.
- */
-static int usbradio_digit_begin(struct ast_channel *c, char digit)
-{
-       return 0;
-}
-
-static int usbradio_digit_end(struct ast_channel *c, char digit, unsigned int duration)
-{
-       /* no better use for received digits than print them */
-       ast_verbose(" << Console Received digit %c of duration %u ms >> \n", 
-               digit, duration);
-       return 0;
-}
-/*
-       SETFREQ - sets spi programmable xcvr
-       SETCHAN - sets binary parallel xcvr
-*/
-static int usbradio_text(struct ast_channel *c, const char *text)
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-       double tx,rx;
-       char cnt,rxs[16],txs[16],txpl[16],rxpl[16];
-       char pwr,*cmd;
-
-       cmd = alloca(strlen(text) + 10);
-
-       /* print received messages */
-       if(o->debuglevel)ast_verbose(" << Console Received usbradio text %s >> \n", text);
-
-       cnt = sscanf(text, "%300s %15s %15s %15s %15s %1c", cmd, rxs, txs, rxpl, txpl, &pwr);
-
-       if (strcmp(cmd,"SETCHAN")==0)
-    { 
-               u8 chan;
-               chan=strtod(rxs,NULL);
-               ppbinout(chan);
-        if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETCHAN cmd: %s chan: %i\n",text,chan);
-        return 0;
-    }
-       
-    if (cnt < 6)
-    {
-           ast_log(LOG_ERROR,"Cannot parse usbradio text: %s\n",text);
-           return 0;
-    }
-       else
-       {
-               if(o->debuglevel)ast_verbose(" << %s %s %s %s %s %c >> \n", cmd,rxs,txs,rxpl,txpl,pwr); 
-       }
-    
-    if (strcmp(cmd,"SETFREQ")==0)
-    {
-        if(o->debuglevel)ast_log(LOG_NOTICE,"parse usbradio SETFREQ cmd: %s\n",text);
-               tx=strtod(txs,NULL);
-               rx=strtod(rxs,NULL);
-               o->set_txfreq = round(tx * (double)1000000);
-               o->set_rxfreq = round(rx * (double)1000000);
-               o->pmrChan->txpower = (pwr == 'H');
-               strcpy(o->set_rxctcssfreqs,rxpl);
-               strcpy(o->set_txctcssfreqs,txpl);
-       
-               o->b.remoted=1;
-               xpmr_config(o);
-        return 0;
-    }
-       ast_log(LOG_ERROR,"Cannot parse usbradio cmd: %s\n",text);
-       return 0;
-}
-
-/* Play ringtone 'x' on device 'o' */
-static void ring(struct chan_usbradio_pvt *o, int x)
-{
-#ifndef        NEW_ASTERISK
-       write(o->sndcmd[1], &x, sizeof(x));
-#endif
-}
-
-/*
- * handler for incoming calls. Either autoanswer, or start ringing
- */
-static int usbradio_call(struct ast_channel *c, char *dest, int timeout)
-{
-       struct chan_usbradio_pvt *o = c->tech_pvt;
-
-       o->stophid = 0;
-       time(&o->lasthidtime);
-       ast_pthread_create_background(&o->hidthread, NULL, hidthread, o);
-       ast_setstate(c, AST_STATE_UP);
-       return 0;
-}
-
-/*
- * remote side answered the phone
- */
-static int usbradio_answer(struct ast_channel *c)
-{
-#ifndef        NEW_ASTERISK
-       struct chan_usbradio_pvt *o = c->tech_pvt;
-#endif
-
-       ast_setstate(c, AST_STATE_UP);
-#ifndef        NEW_ASTERISK
-       o->cursound = -1;
-       o->nosound = 0;
-#endif
-       return 0;
-}
-
-static int usbradio_hangup(struct ast_channel *c)
-{
-       struct chan_usbradio_pvt *o = c->tech_pvt;
-
-       //ast_log(LOG_NOTICE, "usbradio_hangup()\n");
-#ifndef        NEW_ASTERISK
-       o->cursound = -1;
-       o->nosound = 0;
-#endif
-       c->tech_pvt = NULL;
-       o->owner = NULL;
-       ast_module_unref(ast_module_info->self);
-       if (o->hookstate) {
-               if (o->autoanswer || o->autohangup) {
-                       /* Assume auto-hangup too */
-                       o->hookstate = 0;
-                       setformat(o, O_CLOSE);
-               } else {
-                       /* Make congestion noise */
-                       ring(o, AST_CONTROL_CONGESTION);
-               }
-       }
-       o->stophid = 1;
-       pthread_join(o->hidthread,NULL);
-       return 0;
-}
-
-
-/* used for data coming from the network */
-static int usbradio_write(struct ast_channel *c, struct ast_frame *f)
-{
-       struct chan_usbradio_pvt *o = c->tech_pvt;
-
-       traceusb2(("usbradio_write() o->nosound= %i\n",o->nosound));
-
-#ifndef        NEW_ASTERISK
-       /* Immediately return if no sound is enabled */
-       if (o->nosound)
-               return 0;
-       /* Stop any currently playing sound */
-       o->cursound = -1;
-#endif
-       /*
-        * we could receive a block which is not a multiple of our
-        * FRAME_SIZE, so buffer it locally and write to the device
-        * in FRAME_SIZE chunks.
-        * Keep the residue stored for future use.
-        */
-
-       #if DEBUG_CAPTURES == 1 // to write input data to a file   datalen=320
-       if (ftxcapraw && o->b.txcapraw)
-       {
-               i16 i, tbuff[f->datalen];
-               for(i=0;i<f->datalen;i+=2)
-               {
-                       tbuff[i]= ((i16*)(f->data.ptr))[i/2];
-                       tbuff[i+1]= o->txkeyed*M_Q13;
-               }
-               if (fwrite(tbuff,2,f->datalen,ftxcapraw) != f->datalen) {
-                       ast_log(LOG_ERROR, "write() failed: %s\n", strerror(errno));
-               }
-               //fwrite(f->data,1,f->datalen,ftxcapraw);
-       }
-       #endif
-
-       // maw just take the data from the network and save it for PmrRx processing
-
-       PmrTx(o->pmrChan,(i16*)f->data.ptr);
-       
-       return 0;
-}
-
-static struct ast_frame *usbradio_read(struct ast_channel *c)
-{
-       int res, src, datalen, oldpttout;
-       int cd,sd;
-       struct chan_usbradio_pvt *o = c->tech_pvt;
-       struct ast_frame *f = &o->read_f,*f1;
-       struct ast_frame wf = { AST_FRAME_CONTROL };
-       time_t now;
-
-       traceusb2(("usbradio_read()\n"));
-
-       if (o->lasthidtime)
-       {
-               time(&now);
-               if ((now - o->lasthidtime) > 3)
-               {
-                       ast_log(LOG_ERROR,"HID process has died or something!!\n");
-                       return NULL;
-               }
-       }
-       /* XXX can be simplified returning &ast_null_frame */
-       /* prepare a NULL frame in case we don't have enough data to return */
-       memset(f, '\0', sizeof(struct ast_frame));
-       f->frametype = AST_FRAME_NULL;
-       f->src = usbradio_tech.type;
-
-       res = read(o->sounddev, o->usbradio_read_buf + o->readpos, 
-               sizeof(o->usbradio_read_buf) - o->readpos);
-       if (res < 0)                            /* audio data not ready, return a NULL frame */
-       {
-               if (errno != EAGAIN) return NULL;
-               if (o->readerrs++ > READERR_THRESHOLD)
-               {
-                       ast_log(LOG_ERROR,"Stuck USB read channel [%s], un-sticking it!\n",o->name);
-                       o->readerrs = 0;
-                       return NULL;
-               }
-               if (o->readerrs == 1) 
-                       ast_log(LOG_WARNING,"Possibly stuck USB read channel. [%s]\n",o->name);
-               return f;
-       }
-       if (o->readerrs) ast_log(LOG_WARNING,"Nope, USB read channel [%s] wasn't stuck after all.\n",o->name);
-       o->readerrs = 0;
-       o->readpos += res;
-       if (o->readpos < sizeof(o->usbradio_read_buf))  /* not enough samples */
-               return f;
-
-       if (o->mute)
-               return f;
-
-       #if DEBUG_CAPTURES == 1
-       if ((o->b.rxcapraw && frxcapraw) && (fwrite((o->usbradio_read_buf + AST_FRIENDLY_OFFSET),1,FRAME_SIZE * 2 * 2 * 6,frxcapraw) != FRAME_SIZE * 2 * 2 * 6)) {
-               ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
-       }
-       #endif
-
-       #if 1
-       if(o->txkeyed||o->txtestkey)
-       {
-               if(!o->pmrChan->txPttIn)
-               {
-                       o->pmrChan->txPttIn=1;
-                       if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name);
-               }
-       }
-       else if(o->pmrChan->txPttIn)
-       {
-               o->pmrChan->txPttIn=0;
-               if(o->debuglevel) ast_log(LOG_NOTICE,"txPttIn = %i, chan %s\n",o->pmrChan->txPttIn,o->owner->name);
-       }
-       oldpttout = o->pmrChan->txPttOut;
-
-       PmrRx(         o->pmrChan, 
-                  (i16 *)(o->usbradio_read_buf + AST_FRIENDLY_OFFSET),
-                  (i16 *)(o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET),
-                  (i16 *)(o->usbradio_write_buf_1));
-
-       if (oldpttout != o->pmrChan->txPttOut)
-       {
-               if(o->debuglevel) ast_log(LOG_NOTICE,"txPttOut = %i, chan %s\n",o->pmrChan->txPttOut,o->owner->name);
-               kickptt(o);
-       }
-
-       #if 0   // to write 48KS/s stereo tx data to a file
-       if (!ftxoutraw) ftxoutraw = fopen(TX_CAP_OUT_FILE,"w");
-       if (ftxoutraw) fwrite(o->usbradio_write_buf_1,1,FRAME_SIZE * 2 * 6,ftxoutraw);
-       #endif
-
-       #if DEBUG_CAPTURES == 1 && XPMR_DEBUG0 == 1
-    if ((o->b.txcap2 && ftxcaptrace) && (fwrite((o->pmrChan->ptxDebug),1,FRAME_SIZE * 2 * 16,ftxcaptrace) != FRAME_SIZE * 2 * 16)) {
-          ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
-       }
-       #endif
-       
-       // 160 samples * 2 bytes/sample * 2 chan * 6x oversampling to 48KS/s
-       datalen = FRAME_SIZE * 24;  
-       src = 0;                                        /* read position into f->data */
-       while (src < datalen) 
-       {
-               /* Compute spare room in the buffer */
-               int l = sizeof(o->usbradio_write_buf) - o->usbradio_write_dst;
-
-               if (datalen - src >= l) 
-               {       
-                       /* enough to fill a frame */
-                       memcpy(o->usbradio_write_buf + o->usbradio_write_dst, o->usbradio_write_buf_1 + src, l);
-                       soundcard_writeframe(o, (short *) o->usbradio_write_buf);
-                       src += l;
-                       o->usbradio_write_dst = 0;
-               } 
-               else 
-               {                               
-                       /* copy residue */
-                       l = datalen - src;
-                       memcpy(o->usbradio_write_buf + o->usbradio_write_dst, o->usbradio_write_buf_1 + src, l);
-                       src += l;                       /* but really, we are done */
-                       o->usbradio_write_dst += l;
-               }
-       }
-       #else
-       static FILE *hInput;
-       i16 iBuff[FRAME_SIZE*2*6];
-
-       o->pmrChan->b.rxCapture=1;
-
-       if(!hInput)
-       {
-               hInput  = fopen("/usr/src/xpmr/testdata/rx_in.pcm","r");
-               if(!hInput)
-               {
-                       printf(" Input Data File Not Found.\n");
-                       return 0;
-               }
-       }
-
-       if(0==fread((void *)iBuff,2,FRAME_SIZE*2*6,hInput))exit;
-
-       PmrRx(  o->pmrChan, 
-                  (i16 *)iBuff,
-                  (i16 *)(o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET));
-
-       #endif
-
-       #if 0
-       if (!frxoutraw) frxoutraw = fopen(RX_CAP_OUT_FILE,"w");
-    if (frxoutraw) fwrite((o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET),1,FRAME_SIZE * 2,frxoutraw);
-       #endif
-
-       #if DEBUG_CAPTURES == 1 && XPMR_DEBUG0 == 1
-    if ((frxcaptrace && o->b.rxcap2 && o->pmrChan->b.radioactive) && (fwrite((o->pmrChan->prxDebug),1,FRAME_SIZE * 2 * 16,frxcaptrace) != FRAME_SIZE * 2 * 16 )) {
-               ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
-       }
-       #endif
-
-       cd = 0;
-       if(o->rxcdtype==CD_HID && (o->pmrChan->rxExtCarrierDetect!=o->rxhidsq))
-               o->pmrChan->rxExtCarrierDetect=o->rxhidsq;
-       
-       if(o->rxcdtype==CD_HID_INVERT && (o->pmrChan->rxExtCarrierDetect==o->rxhidsq))
-               o->pmrChan->rxExtCarrierDetect=!o->rxhidsq;
-               
-       if( (o->rxcdtype==CD_HID        && o->rxhidsq)                  ||
-               (o->rxcdtype==CD_HID_INVERT && !o->rxhidsq)                 ||
-               (o->rxcdtype==CD_XPMR_NOISE && o->pmrChan->rxCarrierDetect) ||
-               (o->rxcdtype==CD_XPMR_VOX   && o->pmrChan->rxCarrierDetect)
-         )
-       {
-               if (!o->pmrChan->txPttOut || o->radioduplex)cd=1;       
-       }
-       else
-       {
-               cd=0;
-       }
-
-       if(cd!=o->rxcarrierdetect)
-       {
-               o->rxcarrierdetect=cd;
-               if(o->debuglevel) ast_log(LOG_NOTICE,"rxcarrierdetect = %i, chan %s\n",cd,o->owner->name);
-               // printf("rxcarrierdetect = %i, chan %s\n",res,o->owner->name);
-       }
-
-       if(o->pmrChan->b.ctcssRxEnable && o->pmrChan->rxCtcss->decode!=o->rxctcssdecode)
-       {
-               if(o->debuglevel)ast_log(LOG_NOTICE,"rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name);
-               // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name);
-               o->rxctcssdecode=o->pmrChan->rxCtcss->decode;
-               strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq);
-       }
-
-       #ifndef HAVE_XPMRX
-       if(  !o->pmrChan->b.ctcssRxEnable ||
-               ( o->pmrChan->b.ctcssRxEnable && 
-             o->pmrChan->rxCtcss->decode>CTCSS_NULL && 
-             o->pmrChan->smode==SMODE_CTCSS )  
-       )
-       {
-               sd=1;   
-       }
-       else
-       {
-               sd=0;
-       }
-       #else
-       if( (!o->pmrChan->b.ctcssRxEnable && !o->pmrChan->b.dcsRxEnable && !o->pmrChan->b.lmrRxEnable) ||
-               ( o->pmrChan->b.ctcssRxEnable && 
-             o->pmrChan->rxCtcss->decode>CTCSS_NULL && 
-             o->pmrChan->smode==SMODE_CTCSS ) ||
-               ( o->pmrChan->b.dcsRxEnable && 
-             o->pmrChan->decDcs->decode > 0 &&
-             o->pmrChan->smode==SMODE_DCS )
-       )
-       {
-               sd=1;   
-       }
-       else
-       {
-               sd=0;
-       }
-
-       if(o->pmrChan->decDcs->decode!=o->rxdcsdecode)
-       {                                                                                                       
-               if(o->debuglevel)ast_log(LOG_NOTICE,"rxdcsdecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name);
-               // printf("rxctcssdecode = %i, chan %s\n",o->pmrChan->rxCtcss->decode,o->owner->name);
-               o->rxdcsdecode=o->pmrChan->decDcs->decode;
-               strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq);
-       }                                                                                                                                                                                         
-
-       if(o->pmrChan->rptnum && (o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed != o->rxlsddecode))
-       {                                                               
-               if(o->debuglevel)ast_log(LOG_NOTICE,"rxLSDecode = %s, chan %s\n",o->pmrChan->rxctcssfreq,o->owner->name);
-               o->rxlsddecode=o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed;
-               strcpy(o->rxctcssfreq, o->pmrChan->rxctcssfreq);
-       }
-
-       if( (o->pmrChan->rptnum>0 && o->pmrChan->smode==SMODE_LSD && o->pmrChan->pLsdCtl->cs[o->pmrChan->rptnum].b.rxkeyed)||
-           (o->pmrChan->smode==SMODE_DCS && o->pmrChan->decDcs->decode>0) )
-       {
-               sd=1;
-       }
-       #endif
-
-       if ( cd && sd )
-       {
-               //if(!o->rxkeyed)o->pmrChan->dd.b.doitnow=1;
-               if(!o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 1, chan %s\n", o->owner->name);
-               o->rxkeyed = 1;
-       }
-       else 
-       {
-               //if(o->rxkeyed)o->pmrChan->dd.b.doitnow=1;
-               if(o->rxkeyed && o->debuglevel)ast_log(LOG_NOTICE,"o->rxkeyed = 0, chan %s\n",o->owner->name);
-               o->rxkeyed = 0;
-       }
-
-       // provide rx signal detect conditions
-       if (o->lastrx && (!o->rxkeyed))
-       {
-               o->lastrx = 0;
-               //printf("AST_CONTROL_RADIO_UNKEY\n");
-               wf.subclass.integer = AST_CONTROL_RADIO_UNKEY;
-               ast_queue_frame(o->owner, &wf);
-       }
-       else if ((!o->lastrx) && (o->rxkeyed))
-       {
-               o->lastrx = 1;
-               //printf("AST_CONTROL_RADIO_KEY\n");
-               wf.subclass.integer = AST_CONTROL_RADIO_KEY;
-               if(o->rxctcssdecode)    
-        {
-               wf.data.ptr = o->rxctcssfreq;
-               wf.datalen = strlen(o->rxctcssfreq) + 1;
-                       TRACEO(1,("AST_CONTROL_RADIO_KEY text=%s\n",o->rxctcssfreq));
-        }
-               ast_queue_frame(o->owner, &wf);
-       }
-
-       o->readpos = AST_FRIENDLY_OFFSET;       /* reset read pointer for next frame */
-       if (c->_state != AST_STATE_UP)  /* drop data if frame is not up */
-               return f;
-       /* ok we can build and deliver the frame to the caller */
-       f->frametype = AST_FRAME_VOICE;
-       ast_format_set(&f->subclass.format, AST_FORMAT_SLINEAR, 0);
-       f->samples = FRAME_SIZE;
-       f->datalen = FRAME_SIZE * 2;
-       f->data.ptr = o->usbradio_read_buf_8k + AST_FRIENDLY_OFFSET;
-       if (o->boost != BOOST_SCALE) {  /* scale and clip values */
-               int i, x;
-               int16_t *p = (int16_t *) f->data.ptr;
-               for (i = 0; i < f->samples; i++) {
-                       x = (p[i] * o->boost) / BOOST_SCALE;
-                       if (x > 32767)
-                               x = 32767;
-                       else if (x < -32768)
-                               x = -32768;
-                       p[i] = x;
-               }
-       }
-
-       f->offset = AST_FRIENDLY_OFFSET;
-       if (o->dsp)
-       {
-           f1 = ast_dsp_process(c,o->dsp,f);
-           if ((f1->frametype == AST_FRAME_DTMF_END) ||
-             (f1->frametype == AST_FRAME_DTMF_BEGIN))
-           {
-               if ((f1->subclass.integer == 'm') || (f1->subclass.integer == 'u'))
-               {
-                       f1->frametype = AST_FRAME_NULL;
-                       f1->subclass.integer = 0;
-                       return(f1);
-               }
-               if (f1->frametype == AST_FRAME_DTMF_END)
-                       ast_log(LOG_NOTICE, "Got DTMF char %c\n", f1->subclass.integer);
-               return(f1);
-           }
-       }
-       return f;
-}
-
-static int usbradio_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
-{
-       struct chan_usbradio_pvt *o = newchan->tech_pvt;
-       ast_log(LOG_WARNING,"usbradio_fixup()\n");
-       o->owner = newchan;
-       return 0;
-}
-
-static int usbradio_indicate(struct ast_channel *c, int cond, const void *data, size_t datalen)
-{
-       struct chan_usbradio_pvt *o = c->tech_pvt;
-       int res = -1;
-
-       switch (cond) {
-               case AST_CONTROL_BUSY:
-               case AST_CONTROL_CONGESTION:
-               case AST_CONTROL_RINGING:
-                       res = cond;
-                       break;
-               case AST_CONTROL_INCOMPLETE:
-                       res = AST_CONTROL_CONGESTION;
-                       break;
-               case -1:
-#ifndef        NEW_ASTERISK
-                       o->cursound = -1;
-                       o->nosound = 0;         /* when cursound is -1 nosound must be 0 */
-#endif
-                       return 0;
-
-               case AST_CONTROL_VIDUPDATE:
-                       res = -1;
-                       break;
-               case AST_CONTROL_HOLD:
-                       ast_verbose(" << Console Has Been Placed on Hold >> \n");
-                       ast_moh_start(c, data, o->mohinterpret);
-                       break;
-               case AST_CONTROL_UNHOLD:
-                       ast_verbose(" << Console Has Been Retrieved from Hold >> \n");
-                       ast_moh_stop(c);
-                       break;
-               case AST_CONTROL_PROCEEDING:
-                       ast_verbose(" << Call Proceeding... >> \n");
-                       ast_moh_stop(c);
-                       break;
-               case AST_CONTROL_PROGRESS:
-                       ast_verbose(" << Call Progress... >> \n");
-                       ast_moh_stop(c);
-                       break;
-               case AST_CONTROL_RADIO_KEY:
-                       o->txkeyed = 1;
-                       if(o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_KEY Radio Transmit On. >> \n");
-                       break;
-               case AST_CONTROL_RADIO_UNKEY:
-                       o->txkeyed = 0;
-                       if(o->debuglevel)ast_verbose(" << AST_CONTROL_RADIO_UNKEY Radio Transmit Off. >> \n");
-                       break;
-               default:
-                       ast_log(LOG_WARNING, "Don't know how to display condition %d on %s\n", cond, c->name);
-                       return -1;
-       }
-
-       if (res > -1)
-               ring(o, res);
-
-       return 0;
-}
-
-/*
- * allocate a new channel.
- */
-static struct ast_channel *usbradio_new(struct chan_usbradio_pvt *o, char *ext, char *ctx, int state, const char *linkedid)
-{
-       struct ast_channel *c;
-
-       c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", ext, ctx, linkedid, 0, "Radio/%s", o->name);
-       if (c == NULL)
-               return NULL;
-       c->tech = &usbradio_tech;
-       if (o->sounddev < 0)
-               setformat(o, O_RDWR);
-       c->fds[0] = o->sounddev;        /* -1 if device closed, override later */
-       ast_format_cap_add(c->nativeformats, &slin);
-       ast_format_set(&c->readformat, AST_FORMAT_SLINEAR, 0);
-       ast_format_set(&c->writeformat, AST_FORMAT_SLINEAR, 0);
-       c->tech_pvt = o;
-
-       if (!ast_strlen_zero(o->language))
-               ast_string_field_set(c, language, o->language);
-       /* Don't use ast_set_callerid() here because it will
-        * generate a needless NewCallerID event */
-       if (!ast_strlen_zero(o->cid_num)) {
-               c->caller.ani.number.valid = 1;
-               c->caller.ani.number.str = ast_strdup(o->cid_num);
-       }
-       if (!ast_strlen_zero(ext)) {
-               c->dialed.number.str = ast_strdup(ext);
-       }
-
-       o->owner = c;
-       ast_module_ref(ast_module_info->self);
-       ast_jb_configure(c, &global_jbconf);
-       if (state != AST_STATE_DOWN) {
-               if (ast_pbx_start(c)) {
-                       ast_log(LOG_WARNING, "Unable to start PBX on %s\n", c->name);
-                       ast_hangup(c);
-                       o->owner = c = NULL;
-                       /* XXX what about the channel itself ? */
-                       /* XXX what about usecnt ? */
-               }
-       }
-
-       return c;
-}
-/*
-*/
-static struct ast_channel *usbradio_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, void *data, int *cause)
-{
-       struct ast_channel *c;
-       struct chan_usbradio_pvt *o = find_desc(data);
-
-       TRACEO(1,("usbradio_request()\n"));
-
-       if (0)
-       {
-               ast_log(LOG_WARNING, "usbradio_request type <%s> data 0x%p <%s>\n", type, data, (char *) data);
-       }
-       if (o == NULL) {
-               ast_log(LOG_NOTICE, "Device %s not found\n", (char *) data);
-               /* XXX we could default to 'dsp' perhaps ? */
-               return NULL;
-       }
-       if (!(ast_format_cap_iscompatible(cap, &slin))) {
-               return NULL;
-       }
-       if (o->owner) {
-               ast_log(LOG_NOTICE, "Already have a call (chan %p) on the usb channel\n", o->owner);
-               *cause = AST_CAUSE_BUSY;
-               return NULL;
-       }
-       c = usbradio_new(o, NULL, NULL, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
-       if (c == NULL) {
-               ast_log(LOG_WARNING, "Unable to create new usb channel\n");
-               return NULL;
-       }
-               
-       o->b.remoted=0;
-       xpmr_config(o);
-
-       return c;
-}
-/*
-*/
-static int console_key(int fd, int argc, char *argv[])
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
-       if (argc != 2)
-               return RESULT_SHOWUSAGE; 
-       o->txtestkey = 1;
-       return RESULT_SUCCESS;
-}
-/*
-*/
-static int console_unkey(int fd, int argc, char *argv[])
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
-       if (argc != 2)
-               return RESULT_SHOWUSAGE;
-       o->txtestkey = 0;
-       return RESULT_SUCCESS;
-}
-
-static int radio_tune(int fd, int argc, char *argv[])
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-       int i=0;
-
-       if ((argc < 2) || (argc > 4))
-               return RESULT_SHOWUSAGE; 
-
-       if (argc == 2) /* just show stuff */
-       {
-               ast_cli(fd,"Active radio interface is [%s]\n",usbradio_active);
-               ast_cli(fd,"Output A is currently set to ");
-               if(o->txmixa==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n");
-               else if (o->txmixa==TX_OUT_VOICE)ast_cli(fd,"voice.\n");
-               else if (o->txmixa==TX_OUT_LSD)ast_cli(fd,"tone.\n");
-               else if (o->txmixa==TX_OUT_AUX)ast_cli(fd,"auxvoice.\n");
-               else ast_cli(fd,"off.\n");
-
-               ast_cli(fd,"Output B is currently set to ");
-               if(o->txmixb==TX_OUT_COMPOSITE)ast_cli(fd,"composite.\n");
-               else if (o->txmixb==TX_OUT_VOICE)ast_cli(fd,"voice.\n");
-               else if (o->txmixb==TX_OUT_LSD)ast_cli(fd,"tone.\n");
-               else if (o->txmixb==TX_OUT_AUX)ast_cli(fd,"auxvoice.\n");
-               else ast_cli(fd,"off.\n");
-
-               ast_cli(fd,"Tx Voice Level currently set to %d\n",o->txmixaset);
-               ast_cli(fd,"Tx Tone Level currently set to %d\n",o->txctcssadj);
-               ast_cli(fd,"Rx Squelch currently set to %d\n",o->rxsquelchadj);
-               ast_cli(fd,"Device String is %s\n",o->devstr);
-               return RESULT_SHOWUSAGE;
-       }
-
-       o->pmrChan->b.tuning=1;
-
-       if (!strcasecmp(argv[2],"rxnoise")) tune_rxinput(fd,o);
-       else if (!strcasecmp(argv[2],"rxvoice")) tune_rxvoice(fd,o);
-       else if (!strcasecmp(argv[2],"rxtone")) tune_rxctcss(fd,o);
-       else if (!strcasecmp(argv[2],"rxsquelch"))
-       {
-               if (argc == 3)
-               {
-                   ast_cli(fd,"Current Signal Strength is %d\n",((32767-o->pmrChan->rxRssi)*1000/32767));
-                   ast_cli(fd,"Current Squelch setting is %d\n",o->rxsquelchadj);
-                       //ast_cli(fd,"Current Raw RSSI        is %d\n",o->pmrChan->rxRssi);
-                   //ast_cli(fd,"Current (real) Squelch setting is %d\n",*(o->pmrChan->prxSquelchAdjust));
-               } else {
-                       i = atoi(argv[3]);
-                       if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
-                       ast_cli(fd,"Changed Squelch setting to %d\n",i);
-                       o->rxsquelchadj = i;
-                       *(o->pmrChan->prxSquelchAdjust)= ((999 - i) * 32767) / 1000;
-               }
-       }
-       else if (!strcasecmp(argv[2],"txvoice")) {
-               i = 0;
-
-               if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) &&
-                       (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE)
-                 )
-               {
-                       ast_log(LOG_ERROR,"No txvoice output configured.\n");
-               }
-               else if (argc == 3)
-               {
-                       if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
-                               ast_cli(fd,"Current txvoice setting on Channel A is %d\n",o->txmixaset);
-                       else
-                               ast_cli(fd,"Current txvoice setting on Channel B is %d\n",o->txmixbset);
-               }
-               else
-               {
-                       i = atoi(argv[3]);
-                       if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
-
-                       if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
-                       {
-                               o->txmixaset=i;
-                               ast_cli(fd,"Changed txvoice setting on Channel A to %d\n",o->txmixaset);
-                       }
-                       else
-                       {
-                               o->txmixbset=i;   
-                               ast_cli(fd,"Changed txvoice setting on Channel B to %d\n",o->txmixbset);
-                       }
-                       mixer_write(o);
-                       mult_set(o);
-                       ast_cli(fd,"Changed Tx Voice Output setting to %d\n",i);
-               }
-               o->pmrChan->b.txCtcssInhibit=1;
-               tune_txoutput(o,i,fd);
-               o->pmrChan->b.txCtcssInhibit=0;
-       }
-       else if (!strcasecmp(argv[2],"txall")) {
-               i = 0;
-
-               if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) &&
-                       (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE)
-                 )
-               {
-                       ast_log(LOG_ERROR,"No txvoice output configured.\n");
-               }
-               else if (argc == 3)
-               {
-                       if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
-                               ast_cli(fd,"Current txvoice setting on Channel A is %d\n",o->txmixaset);
-                       else
-                               ast_cli(fd,"Current txvoice setting on Channel B is %d\n",o->txmixbset);
-               }
-               else
-               {
-                       i = atoi(argv[3]);
-                       if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
-
-                       if((o->txmixa==TX_OUT_VOICE)||(o->txmixa==TX_OUT_COMPOSITE))
-                       {
-                               o->txmixaset=i;
-                               ast_cli(fd,"Changed txvoice setting on Channel A to %d\n",o->txmixaset);
-                       }
-                       else
-                       {
-                               o->txmixbset=i;   
-                               ast_cli(fd,"Changed txvoice setting on Channel B to %d\n",o->txmixbset);
-                       }
-                       mixer_write(o);
-                       mult_set(o);
-                       ast_cli(fd,"Changed Tx Voice Output setting to %d\n",i);
-               }
-               tune_txoutput(o,i,fd);
-       }
-       else if (!strcasecmp(argv[2],"auxvoice")) {
-               i = 0;
-               if( (o->txmixa!=TX_OUT_AUX) && (o->txmixb!=TX_OUT_AUX))
-               {
-                       ast_log(LOG_WARNING,"No auxvoice output configured.\n");
-               }
-               else if (argc == 3)
-               {
-                       if(o->txmixa==TX_OUT_AUX)
-                               ast_cli(fd,"Current auxvoice setting on Channel A is %d\n",o->txmixaset);
-                       else
-                               ast_cli(fd,"Current auxvoice setting on Channel B is %d\n",o->txmixbset);
-               }
-               else
-               {
-                       i = atoi(argv[3]);
-                       if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
-                       if(o->txmixa==TX_OUT_AUX)
-                       {
-                               o->txmixbset=i;
-                               ast_cli(fd,"Changed auxvoice setting on Channel A to %d\n",o->txmixaset);
-                       }
-                       else
-                       {
-                               o->txmixbset=i;
-                               ast_cli(fd,"Changed auxvoice setting on Channel B to %d\n",o->txmixbset);
-                       }
-                       mixer_write(o);
-                       mult_set(o);
-               }
-               //tune_auxoutput(o,i);
-       }
-       else if (!strcasecmp(argv[2],"txtone"))
-       {
-               if (argc == 3)
-                       ast_cli(fd,"Current Tx CTCSS modulation setting = %d\n",o->txctcssadj);
-               else
-               {
-                       i = atoi(argv[3]);
-                       if ((i < 0) || (i > 999)) return RESULT_SHOWUSAGE;
-                       o->txctcssadj = i;
-                       set_txctcss_level(o);
-                       ast_cli(fd,"Changed Tx CTCSS modulation setting to %i\n",i);
-               }
-               o->txtestkey=1;
-               usleep(5000000);
-               o->txtestkey=0;
-       }
-       else if (!strcasecmp(argv[2],"dump")) pmrdump(o);
-       else if (!strcasecmp(argv[2],"nocap"))  
-       {
-               ast_cli(fd,"File capture (trace) was rx=%d tx=%d and now off.\n",o->b.rxcap2,o->b.txcap2);
-               ast_cli(fd,"File capture (raw)   was rx=%d tx=%d and now off.\n",o->b.rxcapraw,o->b.txcapraw);
-               o->b.rxcapraw=o->b.txcapraw=o->b.rxcap2=o->b.txcap2=o->pmrChan->b.rxCapture=o->pmrChan->b.txCapture=0;
-               if (frxcapraw) { fclose(frxcapraw); frxcapraw = NULL; }
-               if (frxcaptrace) { fclose(frxcaptrace); frxcaptrace = NULL; }
-               if (frxoutraw) { fclose(frxoutraw); frxoutraw = NULL; }
-               if (ftxcapraw) { fclose(ftxcapraw); ftxcapraw = NULL; }
-               if (ftxcaptrace) { fclose(ftxcaptrace); ftxcaptrace = NULL; }
-               if (ftxoutraw) { fclose(ftxoutraw); ftxoutraw = NULL; }
-       }
-       else if (!strcasecmp(argv[2],"rxtracecap")) 
-       {
-               if (!frxcaptrace) frxcaptrace= fopen(RX_CAP_TRACE_FILE,"w");
-               ast_cli(fd,"Trace rx on.\n");
-               o->b.rxcap2=o->pmrChan->b.rxCapture=1;
-       }
-       else if (!strcasecmp(argv[2],"txtracecap")) 
-       {
-               if (!ftxcaptrace) ftxcaptrace= fopen(TX_CAP_TRACE_FILE,"w");
-               ast_cli(fd,"Trace tx on.\n");
-               o->b.txcap2=o->pmrChan->b.txCapture=1;
-       }
-       else if (!strcasecmp(argv[2],"rxcap")) 
-       {
-               if (!frxcapraw) frxcapraw = fopen(RX_CAP_RAW_FILE,"w");
-               ast_cli(fd,"cap rx raw on.\n");
-               o->b.rxcapraw=1;
-       }
-       else if (!strcasecmp(argv[2],"txcap")) 
-       {
-               if (!ftxcapraw) ftxcapraw = fopen(TX_CAP_RAW_FILE,"w");
-               ast_cli(fd,"cap tx raw on.\n");
-               o->b.txcapraw=1;
-       }
-       else if (!strcasecmp(argv[2],"save"))
-       {
-               tune_write(o);
-               ast_cli(fd,"Saved radio tuning settings to usbradio_tune_%s.conf\n",o->name);
-       }
-       else if (!strcasecmp(argv[2],"load"))
-       {
-               ast_mutex_lock(&o->eepromlock);
-               while(o->eepromctl)
-               {
-                       ast_mutex_unlock(&o->eepromlock);
-                       usleep(10000);
-                       ast_mutex_lock(&o->eepromlock);
-               }
-               o->eepromctl = 1;  /* request a load */
-               ast_mutex_unlock(&o->eepromlock);
-
-               ast_cli(fd,"Requesting loading of tuning settings from EEPROM for channel %s\n",o->name);
-       }
-       else
-       {
-               o->pmrChan->b.tuning=0;
-               return RESULT_SHOWUSAGE;
-       }
-       o->pmrChan->b.tuning=0;
-       return RESULT_SUCCESS;
-}
-
-/*
-       set transmit ctcss modulation level
-       adjust mixer output or internal gain depending on output type
-       setting range is 0.0 to 0.9
-*/
-static int set_txctcss_level(struct chan_usbradio_pvt *o)
-{                                                        
-       if (o->txmixa == TX_OUT_LSD)
-       {
-//             o->txmixaset=(151*o->txctcssadj) / 1000;
-               o->txmixaset=o->txctcssadj;
-               mixer_write(o);
-               mult_set(o);
-       }
-       else if (o->txmixb == TX_OUT_LSD)
-       {
-//             o->txmixbset=(151*o->txctcssadj) / 1000;
-               o->txmixbset=o->txctcssadj;
-               mixer_write(o);
-               mult_set(o);
-       }
-       else
-       {
-               *o->pmrChan->ptxCtcssAdjust=(o->txctcssadj * M_Q8) / 1000;
-       }
-       return 0;
-}
-/*
-       CLI debugging on and off
-*/
-static int radio_set_debug(int fd, int argc, char *argv[])
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
-       o->debuglevel=1;
-       ast_cli(fd,"usbradio debug on.\n");
-       return RESULT_SUCCESS;
-}
-
-static int radio_set_debug_off(int fd, int argc, char *argv[])
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
-       o->debuglevel=0;
-       ast_cli(fd,"usbradio debug off.\n");
-       return RESULT_SUCCESS;
-}
-
-static int radio_active(int fd, int argc, char *argv[])
-{
-        if (argc == 2)
-                ast_cli(fd, "active (command) USB Radio device is [%s]\n", usbradio_active);
-        else if (argc != 3)
-                return RESULT_SHOWUSAGE;
-        else {
-                struct chan_usbradio_pvt *o;
-                if (strcmp(argv[2], "show") == 0) {
-                        for (o = usbradio_default.next; o; o = o->next)
-                                ast_cli(fd, "device [%s] exists\n", o->name);
-                        return RESULT_SUCCESS;
-                }
-                o = find_desc(argv[2]);
-                if (o == NULL)
-                        ast_cli(fd, "No device [%s] exists\n", argv[2]);
-                else
-                               {
-                                       struct chan_usbradio_pvt *ao;
-                                       for (ao = usbradio_default.next; ao && ao->name ; ao = ao->next)ao->pmrChan->b.radioactive=0;
-                    usbradio_active = o->name;
-                                   o->pmrChan->b.radioactive=1;
-                               }
-        }
-        return RESULT_SUCCESS;
-}
-/*
-       CLI debugging on and off
-*/
-static int radio_set_xpmr_debug(int fd, int argc, char *argv[])
-{
-       struct chan_usbradio_pvt *o = find_desc(usbradio_active);
-
-       if (argc == 4)
-       {
-               int i;
-               i = atoi(argv[3]);
-               if ((i >= 0) && (i <= 100))
-               { 
-                       o->pmrChan->tracelevel=i;
-               }
-    }
-       // add ability to set it for a number of frames after which it reverts
-       ast_cli(fd,"usbradio xdebug on tracelevel %i\n",o->pmrChan->tracelevel);
-
-       return RESULT_SUCCESS;
-}
-
-
-static char key_usage[] =
-       "Usage: radio key\n"
-       "       Simulates COR active.\n";
-
-static char unkey_usage[] =
-       "Usage: radio unkey\n"
-       "       Simulates COR un-active.\n";
-
-static char active_usage[] =
-        "Usage: radio active [device-name]\n"
-        "       If used without a parameter, displays which device is the current\n"
-        "one being commanded.  If a device is specified, the commanded radio device is changed\n"
-        "to the device specified.\n";
-/*
-radio tune 6 3000              measured tx value
-*/
-static char radio_tune_usage[] =
-       "Usage: radio tune <function>\n"
-       "       rxnoise\n"
-       "       rxvoice\n"
-       "       rxtone\n"
-       "       rxsquelch [newsetting]\n"
-       "       txvoice [newsetting]\n"
-       "       txtone [newsetting]\n"
-       "       auxvoice [newsetting]\n"
-       "       save (settings to tuning file)\n"
-       "       load (tuning settings from EEPROM)\n"
-       "\n       All [newsetting]'s are values 0-999\n\n";
-                                         
-#ifndef        NEW_ASTERISK
-
-static struct ast_cli_entry cli_usbradio[] = {
-       { { "radio", "key", NULL },
-       console_key, "Simulate Rx Signal Present",
-       key_usage, NULL, NULL},
-
-       { { "radio", "unkey", NULL },
-       console_unkey, "Simulate Rx Signal Lusb",
-       unkey_usage, NULL, NULL },
-
-       { { "radio", "tune", NULL },
-       radio_tune, "Radio Tune",
-       radio_tune_usage, NULL, NULL },
-
-       { { "radio", "set", "debug", NULL },
-       radio_set_debug, "Radio Debug",
-       radio_tune_usage, NULL, NULL },
-
-       { { "radio", "set", "debug", "off", NULL },
-       radio_set_debug_off, "Radio Debug",
-       radio_tune_usage, NULL, NULL },
-
-       { { "radio", "active", NULL },
-       radio_active, "Change commanded device",
-       active_usage, NULL, NULL },
-
-    { { "radio", "set", "xdebug", NULL },
-       radio_set_xpmr_debug, "Radio set xpmr debug level",
-       active_usage, NULL, NULL },
-
-};
-#endif
-
-/*
- * store the callerid components
- */
-#if 0
-static void store_callerid(struct chan_usbradio_pvt *o, char *s)
-{
-       ast_callerid_split(s, o->cid_name, sizeof(o->cid_name), o->cid_num, sizeof(o->cid_num));
-}
-#endif
-
-static void store_rxdemod(struct chan_usbradio_pvt *o, const char *s)
-{
-       if (!strcasecmp(s,"no")){
-               o->rxdemod = RX_AUDIO_NONE;
-       }
-       else if (!strcasecmp(s,"speaker")){
-               o->rxdemod = RX_AUDIO_SPEAKER;
-       }
-       else if (!strcasecmp(s,"flat")){
-                       o->rxdemod = RX_AUDIO_FLAT;
-       }       
-       else {
-               ast_log(LOG_WARNING,"Unrecognized rxdemod parameter: %s\n",s);
-       }
-
-       //ast_log(LOG_WARNING, "set rxdemod = %s\n", s);
-}
-
-                                          
-static void store_txmixa(struct chan_usbradio_pvt *o, const char *s)
-{
-       if (!strcasecmp(s,"no")){
-               o->txmixa = TX_OUT_OFF;
-       }
-       else if (!strcasecmp(s,"voice")){
-               o->txmixa = TX_OUT_VOICE;
-       }
-       else if (!strcasecmp(s,"tone")){
-                       o->txmixa = TX_OUT_LSD;
-       }       
-       else if (!strcasecmp(s,"composite")){
-               o->txmixa = TX_OUT_COMPOSITE;
-       }       
-       else if (!strcasecmp(s,"auxvoice")){
-               o->txmixa = TX_OUT_AUX;
-       }       
-       else {
-               ast_log(LOG_WARNING,"Unrecognized txmixa parameter: %s\n",s);
-       }
-
-       //ast_log(LOG_WARNING, "set txmixa = %s\n", s);
-}
-
-static void store_txmixb(struct chan_usbradio_pvt *o, const char *s)
-{
-       if (!strcasecmp(s,"no")){
-               o->txmixb = TX_OUT_OFF;
-       }
-       else if (!strcasecmp(s,"voice")){
-               o->txmixb = TX_OUT_VOICE;
-       }
-       else if (!strcasecmp(s,"tone")){
-                       o->txmixb = TX_OUT_LSD;
-       }       
-       else if (!strcasecmp(s,"composite")){
-               o->txmixb = TX_OUT_COMPOSITE;
-       }       
-       else if (!strcasecmp(s,"auxvoice")){
-               o->txmixb = TX_OUT_AUX;
-       }       
-       else {
-               ast_log(LOG_WARNING,"Unrecognized txmixb parameter: %s\n",s);
-       }
-
-       //ast_log(LOG_WARNING, "set txmixb = %s\n", s);
-}
-/*
-*/
-static void store_rxcdtype(struct chan_usbradio_pvt *o, const char *s)
-{
-       if (!strcasecmp(s,"no")){
-               o->rxcdtype = CD_IGNORE;
-       }
-       else if (!strcasecmp(s,"usb")){
-               o->rxcdtype = CD_HID;
-       }
-       else if (!strcasecmp(s,"dsp")){
-               o->rxcdtype = CD_XPMR_NOISE;
-       }       
-       else if (!strcasecmp(s,"vox")){
-               o->rxcdtype = CD_XPMR_VOX;
-       }       
-       else if (!strcasecmp(s,"usbinvert")){
-               o->rxcdtype = CD_HID_INVERT;
-       }       
-       else {
-               ast_log(LOG_WARNING,"Unrecognized rxcdtype parameter: %s\n",s);
-       }
-
-       //ast_log(LOG_WARNING, "set rxcdtype = %s\n", s);
-}
-/*
-*/
-static void store_rxsdtype(struct chan_usbradio_pvt *o, const char *s)
-{
-       if (!strcasecmp(s,"no") || !strcasecmp(s,"SD_IGNORE")){
-               o->rxsdtype = SD_IGNORE;
-       }
-       else if (!strcasecmp(s,"usb") || !strcasecmp(s,"SD_HID")){
-               o->rxsdtype = SD_HID;
-       }
-       else if (!strcasecmp(s,"usbinvert") || !strcasecmp(s,"SD_HID_INVERT")){
-               o->rxsdtype = SD_HID_INVERT;
-       }       
-       else if (!strcasecmp(s,"software") || !strcasecmp(s,"SD_XPMR")){
-               o->rxsdtype = SD_XPMR;
-       }       
-       else {
-               ast_log(LOG_WARNING,"Unrecognized rxsdtype parameter: %s\n",s);
-       }
-
-       //ast_log(LOG_WARNING, "set rxsdtype = %s\n", s);
-}
-/*
-*/
-static void store_rxgain(struct chan_usbradio_pvt *o, const char *s)
-{
-       float f;
-       sscanf(s, "%30f", &f); 
-       o->rxgain = f;
-       //ast_log(LOG_WARNING, "set rxgain = %f\n", f);
-}
-/*
-*/
-static void store_rxvoiceadj(struct chan_usbradio_pvt *o, const char *s)
-{
-       float f;
-       sscanf(s, "%30f", &f);
-       o->rxvoiceadj = f;
-       //ast_log(LOG_WARNING, "set rxvoiceadj = %f\n", f);
-}
-/*
-*/
-static void store_rxctcssadj(struct chan_usbradio_pvt *o, const char *s)
-{
-       float f;
-       sscanf(s, "%30f", &f);
-       o->rxctcssadj = f;
-       //ast_log(LOG_WARNING, "set rxctcssadj = %f\n", f);
-}
-/*
-*/
-static void store_txtoctype(struct chan_usbradio_pvt *o, const char *s)
-{
-       if (!strcasecmp(s,"no") || !strcasecmp(s,"TOC_NONE")){
-               o->txtoctype = TOC_NONE;
-       }
-       else if (!strcasecmp(s,"phase") || !strcasecmp(s,"TOC_PHASE")){
-               o->txtoctype = TOC_PHASE;
-       }
-       else if (!strcasecmp(s,"notone") || !strcasecmp(s,"TOC_NOTONE")){
-               o->txtoctype = TOC_NOTONE;
-       }       
-       else {
-               ast_log(LOG_WARNING,"Unrecognized txtoctype parameter: %s\n",s);
-       }
-}
-/*
-*/
-static void tune_txoutput(struct chan_usbradio_pvt *o, int value, int fd)
-{
-       o->txtestkey=1;
-       o->pmrChan->txPttIn=1;
-       TxTestTone(o->pmrChan, 1);        // generate 1KHz tone at 7200 peak
-       if (fd > 0) ast_cli(fd,"Tone output starting on channel %s...\n",o->name);
-       usleep(5000000);
-       TxTestTone(o->pmrChan, 0);
-       if (fd > 0) ast_cli(fd,"Tone output ending on channel %s...\n",o->name);
-       o->pmrChan->txPttIn=0;
-       o->txtestkey=0;
-}
-/*
-*/
-static void tune_rxinput(int fd, struct chan_usbradio_pvt *o)
-{
-       const int target=23000;
-       const int tolerance=2000;
-       const int settingmin=1;
-       const int settingstart=2;
-       const int maxtries=12;
-
-       float settingmax;
-       
-       int setting=0, tries=0, tmpdiscfactor, meas;
-
-       settingmax = o->micmax;
-
-       o->pmrChan->b.tuning=1;
-
-       setting = settingstart;
-
-    ast_cli(fd,"tune rxnoise maxtries=%i, target=%i, tolerance=%i\n",maxtries,target,tolerance);
-
-       while(tries<maxtries)
-       {
-               setamixer(o->devicenum,MIXER_PARAM_MIC_CAPTURE_VOL,setting,0);
-               setamixer(o->devicenum,MIXER_PARAM_MIC_BOOST,o->rxboostset,0);
-       
-               usleep(100000);
-               if(o->rxcdtype!=CD_XPMR_NOISE || o->rxdemod==RX_AUDIO_SPEAKER) 
-               {
-                       // printf("Measure Direct Input\n");
-                       o->pmrChan->spsMeasure->source = o->pmrChan->spsRx->source;
-                       o->pmrChan->spsMeasure->discfactor=2000;
-                       o->pmrChan->spsMeasure->enabled=1;
-                       o->pmrChan->spsMeasure->amax = o->pmrChan->spsMeasure->amin = 0;
-                       usleep(400000); 
-                       meas=o->pmrChan->spsMeasure->apeak;
-                       o->pmrChan->spsMeasure->enabled=0;      
-               }
-               else
-               {
-                       // printf("Measure HF Noise\n");
-                       tmpdiscfactor=o->pmrChan->spsRx->discfactor;
-                       o->pmrChan->spsRx->discfactor=(i16)2000;
-                       o->pmrChan->spsRx->discounteru=o->pmrChan->spsRx->discounterl=0;
-                       o->pmrChan->spsRx->amax=o->pmrChan->spsRx->amin=0;
-                       usleep(200000);
-                       meas=o->pmrChan->rxRssi;
-                       o->pmrChan->spsRx->discfactor=tmpdiscfactor;
-                       o->pmrChan->spsRx->discounteru=o->pmrChan->spsRx->discounterl=0;
-                       o->pmrChan->spsRx->amax=o->pmrChan->spsRx->amin=0;
-               }
-        if(!meas)meas++;
-               ast_cli(fd,"tries=%i, setting=%i, meas=%i\n",tries,setting,meas);
-
-               if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){
-                       setting=setting*target/meas;
-               }
-               else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) )
-               {
-                       break;
-               }
-
-               if(setting<settingmin)setting=settingmin;
-               else if(setting>settingmax)setting=settingmax;
-
-               tries++;
-       }
-       ast_cli(fd,"DONE tries=%i, setting=%i, meas=%i\n",tries,
-               (setting * 1000) / o->micmax,meas);
-       if( meas<(target-tolerance) || meas>(target+tolerance) ){
-               ast_cli(fd,"ERROR: RX INPUT ADJUST FAILED.\n");
-       }else{
-               ast_cli(fd,"INFO: RX INPUT ADJUST SUCCESS.\n"); 
-               o->rxmixerset=(setting * 1000) / o->micmax;
-       }
-       o->pmrChan->b.tuning=0;
-}
-/*
-*/
-static void tune_rxvoice(int fd, struct chan_usbradio_pvt *o)
-{
-       const int target=7200;                          // peak
-       const int tolerance=360;                        // peak to peak
-       const float settingmin=0.1;
-       const float settingmax=4;
-       const float settingstart=1;
-       const int maxtries=12;
-
-       float setting;
-
-       int tries=0, meas;
-
-       ast_cli(fd,"INFO: RX VOICE ADJUST START.\n");   
-       ast_cli(fd,"target=%i tolerance=%i \n",target,tolerance);
-
-       o->pmrChan->b.tuning=1;
-       if(!o->pmrChan->spsMeasure)
-               ast_cli(fd,"ERROR: NO MEASURE BLOCK.\n");
-
-       if(!o->pmrChan->spsMeasure->source || !o->pmrChan->prxVoiceAdjust )
-               ast_cli(fd,"ERROR: NO SOURCE OR MEASURE SETTING.\n");
-
-       o->pmrChan->spsMeasure->source=o->pmrChan->spsRxOut->sink;
-       o->pmrChan->spsMeasure->enabled=1;
-       o->pmrChan->spsMeasure->discfactor=1000;
-       
-       setting=settingstart;
-
-       // ast_cli(fd,"ERROR: NO MEASURE BLOCK.\n");
-
-       while(tries<maxtries)
-       {
-               *(o->pmrChan->prxVoiceAdjust)=setting*M_Q8;
-               usleep(10000);
-       o->pmrChan->spsMeasure->amax = o->pmrChan->spsMeasure->amin = 0;
-               usleep(1000000);
-               meas = o->pmrChan->spsMeasure->apeak;
-               ast_cli(fd,"tries=%i, setting=%f, meas=%i\n",tries,setting,meas);
-
-               if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){
-                       setting=setting*target/meas;
-               }
-               else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) )
-               {
-                       break;
-               }
-               if(setting<settingmin)setting=settingmin;
-               else if(setting>settingmax)setting=settingmax;
-
-               tries++;
-       }
-
-       o->pmrChan->spsMeasure->enabled=0;
-
-       ast_cli(fd,"DONE tries=%i, setting=%f, meas=%f\n",tries,setting,(float)meas);
-       if( meas<(target-tolerance) || meas>(target+tolerance) ){
-               ast_cli(fd,"ERROR: RX VOICE GAIN ADJUST FAILED.\n");
-       }else{
-               ast_cli(fd,"INFO: RX VOICE GAIN ADJUST SUCCESS.\n");
-               o->rxvoiceadj=setting;
-       }
-       o->pmrChan->b.tuning=0;
-}
-/*
-*/
-static void tune_rxctcss(int fd, struct chan_usbradio_pvt *o)
-{
-       const int target=2400;           // was 4096 pre 20080205
-       const int tolerance=100;
-       const float settingmin=0.1;
-       const float settingmax=8;
-       const float settingstart=1;
-       const int maxtries=12;
-
-       float setting;
-       int tries=0, meas;
-
-       ast_cli(fd,"INFO: RX CTCSS ADJUST START.\n");   
-       ast_cli(fd,"target=%i tolerance=%i \n",target,tolerance);
-
-       o->pmrChan->b.tuning=1;
-       o->pmrChan->spsMeasure->source=o->pmrChan->prxCtcssMeasure;
-       o->pmrChan->spsMeasure->discfactor=400;
-       o->pmrChan->spsMeasure->enabled=1;
-
-       setting=settingstart;
-
-       while(tries<maxtries)
-       {
-               *(o->pmrChan->prxCtcssAdjust)=setting*M_Q8;
-               usleep(10000);
-       o->pmrChan->spsMeasure->amax = o->pmrChan->spsMeasure->amin = 0;
-               usleep(500000);
-               meas = o->pmrChan->spsMeasure->apeak;
-               ast_cli(fd,"tries=%i, setting=%f, meas=%i\n",tries,setting,meas);
-
-               if( meas<(target-tolerance) || meas>(target+tolerance) || tries<3){
-                       setting=setting*target/meas;
-               }
-               else if(tries>4 && meas>(target-tolerance) && meas<(target+tolerance) )
-               {
-                       break;
-               }
-               if(setting<settingmin)setting=settingmin;
-               else if(setting>settingmax)setting=settingmax;
-
-               tries++;
-       }
-       o->pmrChan->spsMeasure->enabled=0;
-       ast_cli(fd,"DONE tries=%i, setting=%f, meas=%f\n",tries,setting,(float)meas);
-       if( meas<(target-tolerance) || meas>(target+tolerance) ){
-               ast_cli(fd,"ERROR: RX CTCSS GAIN ADJUST FAILED.\n");
-       }else{
-               ast_cli(fd,"INFO: RX CTCSS GAIN ADJUST SUCCESS.\n");
-               o->rxctcssadj=setting;
-       }
-       o->pmrChan->b.tuning=0;
-}
-/*
-       after radio tune is performed data is serialized here 
-*/
-static void tune_write(struct chan_usbradio_pvt *o)
-{
-       FILE *fp;
-       char fname[200];
-
-       snprintf(fname,sizeof(fname) - 1,"/etc/asterisk/usbradio_tune_%s.conf",o->name);
-       fp = fopen(fname,"w");
-
-       fprintf(fp,"[%s]\n",o->name);
-
-       fprintf(fp,"; name=%s\n",o->name);
-       fprintf(fp,"; devicenum=%i\n",o->devicenum);
-       fprintf(fp,"devstr=%s\n",o->devstr);
-       fprintf(fp,"rxmixerset=%i\n",o->rxmixerset);
-       fprintf(fp,"txmixaset=%i\n",o->txmixaset);
-       fprintf(fp,"txmixbset=%i\n",o->txmixbset);
-       fprintf(fp,"rxvoiceadj=%f\n",o->rxvoiceadj);
-       fprintf(fp,"rxctcssadj=%f\n",o->rxctcssadj);
-       fprintf(fp,"txctcssadj=%i\n",o->txctcssadj);
-       fprintf(fp,"rxsquelchadj=%i\n",o->rxsquelchadj);
-       fclose(fp);
-
-       if(o->wanteeprom)
-       {
-               ast_mutex_lock(&o->eepromlock);
-               while(o->eepromctl)
-               {
-                       ast_mutex_unlock(&o->eepromlock);
-                       usleep(10000);
-                       ast_mutex_lock(&o->eepromlock);
-               }
-               o->eeprom[EEPROM_RXMIXERSET] = o->rxmixerset;
-               o->eeprom[EEPROM_TXMIXASET] = o->txmixaset;
-               o->eeprom[EEPROM_TXMIXBSET] = o->txmixbset;
-               memcpy(&o->eeprom[EEPROM_RXVOICEADJ],&o->rxvoiceadj,sizeof(float));
-               memcpy(&o->eeprom[EEPROM_RXCTCSSADJ],&o->rxctcssadj,sizeof(float));
-               o->eeprom[EEPROM_TXCTCSSADJ] = o->txctcssadj;
-               o->eeprom[EEPROM_RXSQUELCHADJ] = o->rxsquelchadj;
-               o->eepromctl = 2;  /* request a write */
-               ast_mutex_unlock(&o->eepromlock);
-       }
-}
-//
-static void mixer_write(struct chan_usbradio_pvt *o)
-{
-       setamixer(o->devicenum,MIXER_PARAM_MIC_PLAYBACK_SW,0,0);
-       setamixer(o->devicenum,MIXER_PARAM_MIC_PLAYBACK_VOL,0,0);
-       setamixer(o->devicenum,MIXER_PARAM_SPKR_PLAYBACK_SW,1,0);
-       setamixer(o->devicenum,MIXER_PARAM_SPKR_PLAYBACK_VOL,
-               o->txmixaset * o->spkrmax / 1000,
-               o->txmixbset * o->spkrmax / 1000);
-       setamixer(o->devicenum,MIXER_PARAM_MIC_CAPTURE_VOL,
-               o->rxmixerset * o->micmax / 1000,0);
-       setamixer(o->devicenum,MIXER_PARAM_MIC_BOOST,o->rxboostset,0);
-       setamixer(o->devicenum,MIXER_PARAM_MIC_CAPTURE_SW,1,0);
-}
-/*
-       adjust dsp multiplier to add resolution to tx level adjustment
-*/
-static void mult_set(struct chan_usbradio_pvt *o)
-{
-
-       if(o->pmrChan->spsTxOutA) {
-               o->pmrChan->spsTxOutA->outputGain = 
-                       mult_calc((o->txmixaset * 152) / 1000);
-       }
-       if(o->pmrChan->spsTxOutB){
-               o->pmrChan->spsTxOutB->outputGain = 
-                       mult_calc((o->txmixbset * 152) / 1000);
-       }
-}
-//
-// input 0 - 151 outputs are pot and multiplier
-//
-static int mult_calc(int value)
-{
-       const int multx=M_Q8;
-       int pot,mult;
-
-       pot=((int)(value/4)*4)+2;
-       mult = multx-( ( multx * (3-(value%4)) ) / (pot+2) );
-       return(mult);
-}
-
-#define pd(x) {printf(#x" = %d\n",x);}
-#define pp(x) {printf(#x" = %p\n",x);}
-#define ps(x) {printf(#x" = %s\n",x);}
-#define pf(x) {printf(#x" = %f\n",x);}
-
-
-#if 0
-/*
-       do hid output if only requirement is ptt out
-       this give fastest performance with least overhead
-       where gpio inputs are not required.
-*/
-
-static int usbhider(struct chan_usbradio_pvt *o, int opt)
-{
-       unsigned char buf[4];
-       char lastrx, txtmp;
-
-       if(opt)
-       {
-               struct usb_device *usb_dev;
-
-               usb_dev = hid_device_init(o->devstr);
-               if (usb_dev == NULL) {
-                       ast_log(LOG_ERROR,"USB HID device not found\n");
-                       return -1;
-               }
-               o->usb_handle = usb_open(usb_dev);
-               if (o->usb_handle == NULL) {
-                   ast_log(LOG_ERROR,"Not able to open USB device\n");
-                       return -1;
-               }
-               if (usb_claim_interface(o->usb_handle,C108_HID_INTERFACE) < 0)
-               {
-                   if (usb_detach_kernel_driver_np(o->usb_handle,C108_HID_INTERFACE) < 0) {
-                           ast_log(LOG_ERROR,"Not able to detach the USB device\n");
-                               return -1;
-                       }
-                       if (usb_claim_interface(o->usb_handle,C108_HID_INTERFACE) < 0) {
-                               ast_log(LOG_ERROR,"Not able to claim the USB device\n");
-                               return -1;
-                       }
-               }
-       
-               memset(buf,0,sizeof(buf));
-               buf[2] = o->hid_gpio_ctl;
-               buf[1] = 0;
-               hid_set_outputs(o->usb_handle,buf);
-               memcpy(bufsave,buf,sizeof(buf));
-        
-               buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
-               o->lasttx=0;
-       }
-
-       /* if change in tx state as controlled by xpmr */
-       txtmp=o->pmrChan->txPttOut;
-                       
-       if (o->lasttx != txtmp)
-       {
-               o->pmrChan->txPttHid=o->lasttx = txtmp;
-               if(o->debuglevel)printf("usbhid: tx set to %d\n",txtmp);
-               buf[o->hid_gpio_loc] = 0;
-               if (!o->invertptt)
-               {
-                       if (txtmp) buf[o->hid_gpio_loc] = o->hid_io_ptt;
-               }
-               else
-               {
-                       if (!txtmp) buf[o->hid_gpio_loc] = o->hid_io_ptt;
-               }
-               buf[o->hid_gpio_ctl_loc] = o->hid_gpio_ctl;
-               hid_set_outputs(o->usb_handle,buf);
-       }
-
-       return(0);
-}
-#endif
-/*
-*/
-static void pmrdump(struct chan_usbradio_pvt *o)
-{
-       t_pmr_chan *p;
-       int i;
-
-       p=o->pmrChan;
-
-       printf("\nodump()\n");
-
-       pd(o->devicenum);
-       ps(o->devstr);
-
-       pd(o->micmax);
-       pd(o->spkrmax);
-
-       pd(o->rxdemod);
-       pd(o->rxcdtype);
-       pd(o->rxsdtype);
-       pd(o->txtoctype);
-
-       pd(o->rxmixerset);
-       pd(o->rxboostset);
-
-       pf(o->rxvoiceadj);
-       pf(o->rxctcssadj);
-       pd(o->rxsquelchadj);
-
-       ps(o->txctcssdefault);
-       ps(o->txctcssfreq);
-
-       pd(o->numrxctcssfreqs);
-       if(o->numrxctcssfreqs>0)
-       {
-               for(i=0;i<o->numrxctcssfreqs;i++)
-               {
-                       printf(" %i =  %s  %s\n",i,o->rxctcss[i],o->txctcss[i]); 
-               }
-       }
-
-       pd(o->b.rxpolarity);
-       pd(o->b.txpolarity);
-
-       pd(o->txprelim);
-       pd(o->txmixa);
-       pd(o->txmixb);
-       
-       pd(o->txmixaset);
-       pd(o->txmixbset);
-       
-       printf("\npmrdump()\n");
-       pd(p->devicenum);
-
-       printf("prxSquelchAdjust=%i\n",*(o->pmrChan->prxSquelchAdjust));
-
-       pd(p->rxCarrierPoint);
-       pd(p->rxCarrierHyst);
-
-       pd(*p->prxVoiceAdjust);
-       pd(*p->prxCtcssAdjust);
-
-       pd(p->rxfreq);
-       pd(p->txfreq);
-
-       pd(p->rxCtcss->relax);
-       //pf(p->rxCtcssFreq);   
-       pd(p->numrxcodes);
-       if(o->pmrChan->numrxcodes>0)
-       {
-               for(i=0;i<o->pmrChan->numrxcodes;i++)
-               {
-                       printf(" %i = %s\n",i,o->pmrChan->pRxCode[i]); 
-               }
-       }
-
-       pd(p->txTocType);
-       ps(p->pTxCodeDefault);
-       pd(p->txcodedefaultsmode);
-       pd(p->numtxcodes);
-       if(o->pmrChan->numtxcodes>0)
-       {
-               for(i=0;i<o->pmrChan->numtxcodes;i++)
-               {                                                                                                        
-                       printf(" %i = %s\n",i,o->pmrChan->pTxCode[i]); 
-               }
-       }
-
-       pd(p->b.rxpolarity);
-       pd(p->b.txpolarity);
-       pd(p->b.dcsrxpolarity);
-       pd(p->b.dcstxpolarity);
-       pd(p->b.lsdrxpolarity);
-       pd(p->b.lsdtxpolarity);
-
-       pd(p->txMixA);
-       pd(p->txMixB);
-    
-       pd(p->rxDeEmpEnable);
-       pd(p->rxCenterSlicerEnable);
-       pd(p->rxCtcssDecodeEnable);
-       pd(p->rxDcsDecodeEnable);
-       pd(p->b.ctcssRxEnable);
-       pd(p->b.dcsRxEnable);
-       pd(p->b.lmrRxEnable);
-       pd(p->b.dstRxEnable);
-       pd(p->smode);
-
-       pd(p->txHpfEnable);
-       pd(p->txLimiterEnable);
-       pd(p->txPreEmpEnable);
-       pd(p->txLpfEnable);
-
-       if(p->spsTxOutA)pd(p->spsTxOutA->outputGain);
-       if(p->spsTxOutB)pd(p->spsTxOutB->outputGain);
-       pd(p->txPttIn);
-       pd(p->txPttOut);
-
-       pd(p->tracetype);
-
-       return;
-}
-/*
-       takes data from a chan_usbradio_pvt struct (e.g. o->)
-       and configures the xpmr radio layer
-*/
-static int xpmr_config(struct chan_usbradio_pvt *o)
-{
-       //ast_log(LOG_NOTICE,"xpmr_config()\n");
-
-       TRACEO(1,("xpmr_config()\n"));
-
-       if(o->pmrChan==NULL)
-       {
-               ast_log(LOG_ERROR,"pmr channel structure NULL\n");
-               return 1;
-       }
-
-       o->pmrChan->rxCtcss->relax = o->rxctcssrelax;
-       o->pmrChan->txpower=0;
-
-       if(o->b.remoted)
-       {
-               o->pmrChan->pTxCodeDefault = o->set_txctcssdefault;
-               o->pmrChan->pRxCodeSrc=o->set_rxctcssfreqs;
-               o->pmrChan->pTxCodeSrc=o->set_txctcssfreqs;
-
-               o->pmrChan->rxfreq=o->set_rxfreq;
-               o->pmrChan->txfreq=o->set_txfreq;
-               /* printf(" remoted %s %s --> %s \n",o->pmrChan->txctcssdefault,
-                       o->pmrChan->txctcssfreq,o->pmrChan->rxctcssfreq); */
-       }
-       else
-       {
-               // set xpmr pointers to source strings
-
-               o->pmrChan->pTxCodeDefault = o->txctcssdefault;
-               o->pmrChan->pRxCodeSrc     = o->rxctcssfreqs;
-               o->pmrChan->pTxCodeSrc     = o->txctcssfreqs;
-       
-               o->pmrChan->rxfreq = o->rxfreq;
-               o->pmrChan->txfreq = o->txfreq;
-       }
-       
-       code_string_parse(o->pmrChan);
-       if(o->pmrChan->rxfreq) o->pmrChan->b.reprog=1;
-
-       return 0;
-}
-/*
- * grab fields from the config file, init the descriptor and open the device.
- */
-static struct chan_usbradio_pvt *store_config(struct ast_config *cfg, char *ctg)
-{
-       struct ast_variable *v;
-       struct chan_usbradio_pvt *o;
-       struct ast_config *cfg1;
-       int i;
-       char fname[200];
-#ifdef NEW_ASTERISK
-       struct ast_flags zeroflag = {0};
-#endif
-       if (ctg == NULL) {
-               traceusb1((" store_config() ctg == NULL\n"));
-               o = &usbradio_default;
-               ctg = "general";
-       } else {
-               /* "general" is also the default thing */
-               if (strcmp(ctg, "general") == 0) {
-                       o = &usbradio_default;
-               } else {
-                   // ast_log(LOG_NOTICE,"ast_calloc for chan_usbradio_pvt of %s\n",ctg);
-                       if (!(o = ast_calloc(1, sizeof(*o))))
-                               return NULL;
-                       *o = usbradio_default;
-                       o->name = ast_strdup(ctg);
-                       if (!usbradio_active) 
-                               usbradio_active = o->name;
-               }
-       }
-       ast_mutex_init(&o->eepromlock);
-       strcpy(o->mohinterpret, "default");
-       /* fill other fields from configuration */
-       for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
-               M_START((char *)v->name, (char *)v->value);
-
-               /* handle jb conf */
-               if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
-                       continue;
-
-#if    0
-                       M_BOOL("autoanswer", o->autoanswer)
-                       M_BOOL("autohangup", o->autohangup)
-                       M_BOOL("overridecontext", o->overridecontext)
-                       M_STR("context", o->ctx)
-                       M_STR("language", o->language)
-                       M_STR("mohinterpret", o->mohinterpret)
-                       M_STR("extension", o->ext)
-                       M_F("callerid", store_callerid(o, v->value))
-#endif
-                       M_UINT("frags", o->frags)
-                       M_UINT("queuesize",o->queuesize)
-#if 0
-                       M_UINT("devicenum",o->devicenum)
-#endif
-                       M_UINT("debug", usbradio_debug)
-                       M_BOOL("rxcpusaver",o->rxcpusaver)
-                       M_BOOL("txcpusaver",o->txcpusaver)
-                       M_BOOL("invertptt",o->invertptt)
-                       M_F("rxdemod",store_rxdemod(o,(char *)v->value))
-                       M_BOOL("txprelim",o->txprelim);
-                       M_F("txmixa",store_txmixa(o,(char *)v->value))
-                       M_F("txmixb",store_txmixb(o,(char *)v->value))
-                       M_F("carrierfrom",store_rxcdtype(o,(char *)v->value))
-                       M_F("rxsdtype",store_rxsdtype(o,(char *)v->value))
-                   M_UINT("rxsqvox",o->rxsqvoxadj)
-                       M_STR("txctcssdefault",o->txctcssdefault)
-                       M_STR("rxctcssfreqs",o->rxctcssfreqs)
-                       M_STR("txctcssfreqs",o->txctcssfreqs)
-                       M_UINT("rxfreq",o->rxfreq)
-                       M_UINT("txfreq",o->txfreq)
-                       M_F("rxgain",store_rxgain(o,(char *)v->value))
-                       M_BOOL("rxboost",o->rxboostset)
-                       M_UINT("rxctcssrelax",o->rxctcssrelax)
-                       M_F("txtoctype",store_txtoctype(o,(char *)v->value))
-                       M_UINT("hdwtype",o->hdwtype)
-                       M_UINT("eeprom",o->wanteeprom)
-                       M_UINT("duplex",o->radioduplex)
-                       M_UINT("txsettletime",o->txsettletime)
-                       M_BOOL("rxpolarity",o->b.rxpolarity)
-                       M_BOOL("txpolarity",o->b.txpolarity)
-                       M_BOOL("dcsrxpolarity",o->b.dcsrxpolarity)
-                       M_BOOL("dcstxpolarity",o->b.dcstxpolarity)
-                       M_BOOL("lsdrxpolarity",o->b.lsdrxpolarity)
-                       M_BOOL("lsdtxpolarity",o->b.lsdtxpolarity)
-                       M_BOOL("loopback",o->b.loopback)
-                       M_BOOL("radioactive",o->b.radioactive)
-                       M_UINT("rptnum",o->rptnum)
-                       M_UINT("idleinterval",o->idleinterval)
-                       M_UINT("turnoffs",o->turnoffs)
-                       M_UINT("tracetype",o->tracetype)
-                       M_UINT("tracelevel",o->tracelevel)
-                       M_UINT("area",o->area)
-                       M_STR("ukey",o->ukey)
-                       M_END(;
-                       );
-       }
-
-       o->debuglevel=0;
-
-       if (o == &usbradio_default)             /* we are done with the default */
-               return NULL;
-
-       snprintf(fname,sizeof(fname) - 1,config1,o->name);
-#ifdef NEW_ASTERISK
-       cfg1 = ast_config_load(fname,zeroflag);
-#else
-       cfg1 = ast_config_load(fname);
-#endif
-       o->rxmixerset = 500;
-       o->txmixaset = 500;
-       o->txmixbset = 500;
-       o->rxvoiceadj = 0.5;
-       o->rxctcssadj = 0.5;
-       o->txctcssadj = 200;
-       o->rxsquelchadj = 500;
-       o->devstr[0] = 0;
-       if (cfg1 && cfg1 != CONFIG_STATUS_FILEINVALID) {
-               for (v = ast_variable_browse(cfg1, o->name); v; v = v->next) {
-       
-                       M_START((char *)v->name, (char *)v->value);
-                       M_UINT("rxmixerset", o->rxmixerset)
-                       M_UINT("txmixaset", o->txmixaset)
-                       M_UINT("txmixbset", o->txmixbset)
-                       M_F("rxvoiceadj",store_rxvoiceadj(o,(char *)v->value))
-                       M_F("rxctcssadj",store_rxctcssadj(o,(char *)v->value))
-                       M_UINT("txctcssadj",o->txctcssadj);
-                       M_UINT("rxsquelchadj", o->rxsquelchadj)
-                       M_STR("devstr", o->devstr)
-                       M_END(;
-                       );
-               }
-               ast_config_destroy(cfg1);
-       } else ast_log(LOG_WARNING,"File %s not found, using default parameters.\n",fname);
-
-       if(o->wanteeprom)
-       {
-               ast_mutex_lock(&o->eepromlock);
-               while(o->eepromctl)
-               {
-                       ast_mutex_unlock(&o->eepromlock);
-                       usleep(10000);
-                       ast_mutex_lock(&o->eepromlock);
-               }
-               o->eepromctl = 1;  /* request a load */
-               ast_mutex_unlock(&o->eepromlock);
-       }
-       /* if our specified one exists in the list */
-       if ((!usb_list_check(o->devstr)) || find_desc_usb(o->devstr))
-       {
-               char *s;
-
-               for(s = usb_device_list; *s; s += strlen(s) + 1)
-               {
-                       if (!find_desc_usb(s)) break;
-               }
-               if (!*s)
-               {
-                       ast_log(LOG_WARNING,"Unable to assign USB device for channel %s\n",o->name);
-                       goto error;
-               }
-               ast_log(LOG_NOTICE,"Assigned USB device %s to usbradio channel %s\n",s,o->name);
-               strcpy(o->devstr,s);
-       }
-
-       i = usb_get_usbdev(o->devstr);
-       if (i < 0)
-       {
-               ast_log(LOG_ERROR,"Not able to find alsa USB device\n");
-               goto error;
-       }
-       o->devicenum = i;
-
-       o->micmax = amixer_max(o->devicenum,MIXER_PARAM_MIC_CAPTURE_VOL);
-       o->spkrmax = amixer_max(o->devicenum,MIXER_PARAM_SPKR_PLAYBACK_VOL);
-       o->lastopen = ast_tvnow();      /* don't leave it 0 or tvdiff may wrap */
-       o->dsp = ast_dsp_new();
-       if (o->dsp)
-       {
-#ifdef NEW_ASTERISK
-         ast_dsp_set_features(o->dsp,DSP_FEATURE_DIGIT_DETECT);
-         ast_dsp_set_digitmode(o->dsp,DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
-#else
-         ast_dsp_set_features(o->dsp,DSP_FEATURE_DTMF_DETECT);
-         ast_dsp_digitmode(o->dsp,DSP_DIGITMODE_DTMF | DSP_DIGITMODE_MUTECONF | DSP_DIGITMODE_RELAXDTMF);
-#endif
-       }
-
-       if(o->pmrChan==NULL)
-       {
-               t_pmr_chan tChan;
-
-               // ast_log(LOG_NOTICE,"createPmrChannel() %s\n",o->name);
-               memset(&tChan,0,sizeof(t_pmr_chan));
-
-               tChan.pTxCodeDefault = o->txctcssdefault;
-               tChan.pRxCodeSrc     = o->rxctcssfreqs;
-               tChan.pTxCodeSrc     = o->txctcssfreqs;
-
-               tChan.rxDemod=o->rxdemod;
-               tChan.rxCdType=o->rxcdtype;
-               tChan.rxSqVoxAdj=o->rxsqvoxadj;
-
-               if (o->txprelim) 
-                       tChan.txMod = 2;
-
-               tChan.txMixA = o->txmixa;
-               tChan.txMixB = o->txmixb;
-
-               tChan.rxCpuSaver=o->rxcpusaver;
-               tChan.txCpuSaver=o->txcpusaver;
-
-               tChan.b.rxpolarity=o->b.rxpolarity;
-               tChan.b.txpolarity=o->b.txpolarity;
-
-               tChan.b.dcsrxpolarity=o->b.dcsrxpolarity;
-               tChan.b.dcstxpolarity=o->b.dcstxpolarity;
-
-               tChan.b.lsdrxpolarity=o->b.lsdrxpolarity;
-               tChan.b.lsdtxpolarity=o->b.lsdtxpolarity;
-
-               tChan.tracetype=o->tracetype;
-               tChan.tracelevel=o->tracelevel;
-               tChan.rptnum=o->rptnum;
-               tChan.idleinterval=o->idleinterval;
-               tChan.turnoffs=o->turnoffs;
-               tChan.area=o->area;
-               tChan.ukey=o->ukey;
-               tChan.name=o->name;
-
-               o->pmrChan=createPmrChannel(&tChan,FRAME_SIZE);
-                                                                        
-               o->pmrChan->radioDuplex=o->radioduplex;
-               o->pmrChan->b.loopback=0; 
-               o->pmrChan->txsettletime=o->txsettletime;
-               o->pmrChan->rxCpuSaver=o->rxcpusaver;
-               o->pmrChan->txCpuSaver=o->txcpusaver;
-
-               *(o->pmrChan->prxSquelchAdjust) = 
-                       ((999 - o->rxsquelchadj) * 32767) / 1000;
-
-               *(o->pmrChan->prxVoiceAdjust)=o->rxvoiceadj*M_Q8;
-               *(o->pmrChan->prxCtcssAdjust)=o->rxctcssadj*M_Q8;
-               o->pmrChan->rxCtcss->relax=o->rxctcssrelax;
-               o->pmrChan->txTocType = o->txtoctype;
-
-        if (    (o->txmixa == TX_OUT_LSD) ||
-                (o->txmixa == TX_OUT_COMPOSITE) ||
-                (o->txmixb == TX_OUT_LSD) ||
-                (o->txmixb == TX_OUT_COMPOSITE))
-        {
-                set_txctcss_level(o);
-        }
-
-               if( (o->txmixa!=TX_OUT_VOICE) && (o->txmixb!=TX_OUT_VOICE) &&
-                       (o->txmixa!=TX_OUT_COMPOSITE) && (o->txmixb!=TX_OUT_COMPOSITE)
-                 )
-               {
-                       ast_log(LOG_ERROR,"No txvoice output configured.\n");
-               }
-       
-               if( o->txctcssfreq[0] && 
-                   o->txmixa!=TX_OUT_LSD && o->txmixa!=TX_OUT_COMPOSITE  &&
-                       o->txmixb!=TX_OUT_LSD && o->txmixb!=TX_OUT_COMPOSITE
-                 )
-               {
-                       ast_log(LOG_ERROR,"No txtone output configured.\n");
-               }
-               
-               if(o->b.radioactive)
-               {
-                   // 20080328 sphenke asdf maw !!!
-                   // this diagnostic option was working but now appears broken
-                       // it's not required for operation so I'll fix it later.
-                       //struct chan_usbradio_pvt *ao;
-                       //for (ao = usbradio_default.next; ao && ao->name ; ao = ao->next)ao->pmrChan->b.radioactive=0;
-                       usbradio_active = o->name;
-                       // o->pmrChan->b.radioactive=1;
-                       //o->b.radioactive=0;
-                       //o->pmrChan->b.radioactive=0;
-                       ast_log(LOG_NOTICE,"radio active set to [%s]\n",o->name);
-               }
-       }
-
-       xpmr_config(o);
-
-       TRACEO(1,("store_config() 120\n"));
-       mixer_write(o);
-       TRACEO(1,("store_config() 130\n"));
-       mult_set(o);    
-       TRACEO(1,("store_config() 140\n"));
-       hidhdwconfig(o);
-
-       TRACEO(1,("store_config() 200\n"));
-
-#ifndef        NEW_ASTERISK
-       if (pipe(o->sndcmd) != 0) {
-               ast_log(LOG_ERROR, "Unable to create pipe\n");
-               goto error;
-       }
-
-       ast_pthread_create_background(&o->sthread, NULL, sound_thread, o);
-#endif
-
-       /* link into list of devices */
-       if (o != &usbradio_default) {
-               o->next = usbradio_default.next;
-               usbradio_default.next = o;
-       }
-       TRACEO(1,("store_config() complete\n"));
-       return o;
-  
-  error:
-       if (o != &usbradio_default)
-               free(o);
-       return NULL;
-}
-
-
-#if    DEBUG_FILETEST == 1
-/*
-       Test It on a File
-*/
-int RxTestIt(struct chan_usbradio_pvt *o)
-{
-       const int numSamples = SAMPLES_PER_BLOCK;
-       const int numChannels = 16;
-
-       i16 sample,i,ii;
-       
-       i32 txHangTime;
-
-       i16 txEnable;
-
-       t_pmr_chan      tChan;
-       t_pmr_chan *pChan;
-
-       FILE *hInput=NULL, *hOutput=NULL, *hOutputTx=NULL;
-       i16 iBuff[numSamples*2*6], oBuff[numSamples];
-                                 
-       printf("RxTestIt()\n");
-
-       pChan=o->pmrChan;
-       pChan->b.txCapture=1;
-       pChan->b.rxCapture=1;
-
-       txEnable = 0;
-
-       hInput  = fopen("/usr/src/xpmr/testdata/rx_in.pcm","r");
-       if(!hInput){
-               printf(" RxTestIt() File Not Found.\n");
-               return 0;
-       }
-       hOutput = fopen("/usr/src/xpmr/testdata/rx_debug.pcm","w");
-
-       printf(" RxTestIt() Working...\n");
-                               
-       while(!feof(hInput))
-       {
-               fread((void *)iBuff,2,numSamples*2*6,hInput);
-                
-               if(txHangTime)txHangTime-=numSamples;
-               if(txHangTime<0)txHangTime=0;
-               
-               if(pChan->rxCtcss->decode)txHangTime=(8000/1000*2000);
-
-               if(pChan->rxCtcss->decode && !txEnable)
-               {
-                       txEnable=1;
-                       //pChan->inputBlanking=(8000/1000*200);
-               }
-               else if(!pChan->rxCtcss->decode && txEnable)
-               {
-                       txEnable=0;     
-               }
-
-               PmrRx(pChan,iBuff,oBuff);
-
-               if (fwrite((void *)pChan->prxDebug,2,numSamples*numChannels,hOutput) != numSamples * numChannels) {
-                       ast_log(LOG_ERROR, "fwrite() failed: %s\n", strerror(errno));
-               }
-       }
-       pChan->b.txCapture=0;
-       pChan->b.rxCapture=0;
-
-       if(hInput)fclose(hInput);
-       if(hOutput)fclose(hOutput);
-
-       printf(" RxTestIt() Complete.\n");
-
-       return 0;
-}
-#endif
-
-#ifdef NEW_ASTERISK
-
-static char *res2cli(int r)
-
-{
-       switch (r)
-       {
-           case RESULT_SUCCESS:
-               return(CLI_SUCCESS);
-           case RESULT_SHOWUSAGE:
-               return(CLI_SHOWUSAGE);
-           default:
-               return(CLI_FAILURE);
-       }
-}
-
-static char *handle_console_key(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-       char *argv[] = { "radio", "key", NULL };
-
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "radio key";
-                e->usage = key_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(console_key(a->fd, 2, argv));
-}
-
-static char *handle_console_unkey(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-       char *argv[] = { "radio", "unkey", NULL };
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "radio unkey";
-                e->usage = unkey_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(console_unkey(a->fd, 2, argv));
-}
-
-static char *handle_radio_tune(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-       char *argv[5] = { "radio", "tune", a->argc > 2 ? (char *) a->argv[2] : NULL, a->argc > 3 ? (char *) a->argv[3] : NULL };
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "radio tune";
-                e->usage = radio_tune_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(radio_tune(a->fd, a->argc, argv));
-}
-
-static char *handle_radio_debug(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "radio debug";
-                e->usage = radio_tune_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(radio_set_debug(a->fd, a->argc, NULL /* ignored */));
-}
-
-static char *handle_radio_debug_off(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "radio debug off";
-                e->usage = radio_tune_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(radio_set_debug_off(a->fd, a->argc, NULL /* ignored */));
-}
-
-static char *handle_radio_active(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-       char *argv[4] = { "radio", "active", a->argc > 2 ? (char *) a->argv[2] : NULL, };
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "radio active";
-                e->usage = active_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(radio_active(a->fd, a->argc, argv));
-}
-
-static char *handle_set_xdebug(struct ast_cli_entry *e,
-       int cmd, struct ast_cli_args *a)
-{
-       char *argv[5] = { "radio", "set", "xdebug", a->argc == 4 ? (char *) a->argv[3] : NULL, };
-        switch (cmd) {
-        case CLI_INIT:
-                e->command = "radio set xdebug";
-                e->usage = active_usage;
-                return NULL;
-        case CLI_GENERATE:
-                return NULL;
-       }
-       return res2cli(radio_set_xpmr_debug(a->fd, a->argc, argv));
-}
-
-
-static struct ast_cli_entry cli_usbradio[] = {
-       AST_CLI_DEFINE(handle_console_key,"Simulate Rx Signal Present"),
-       AST_CLI_DEFINE(handle_console_unkey,"Simulate Rx Signal Loss"),
-       AST_CLI_DEFINE(handle_radio_tune,"Radio Tune"),
-       AST_CLI_DEFINE(handle_radio_debug,"Radio Debug On"),
-       AST_CLI_DEFINE(handle_radio_debug_off,"Radio Debug Off"),
-       AST_CLI_DEFINE(handle_radio_active,"Change commanded device"),
-       AST_CLI_DEFINE(handle_set_xdebug,"Radio set xpmr debug level")
-};
-
-#endif
-
-#include "./xpmr/xpmr.c"
-#ifdef HAVE_XPMRX
-#include "./xpmrx/xpmrx.c"
-#endif
-
-/*
-*/
-static int load_module(void)
-{
-       struct ast_config *cfg = NULL;
-       char *ctg = NULL;
-#ifdef NEW_ASTERISK
-       struct ast_flags zeroflag = {0};
-#endif
-
-       if (!(usbradio_tech.capabilities = ast_format_cap_alloc())) {
-               return AST_MODULE_LOAD_DECLINE;
-       }
-       ast_format_cap_add(usbradio_tech.capabilities, ast_format_set(&slin, AST_FORMAT_SLINEAR, 0));
-
-       if (hid_device_mklist()) {
-               ast_log(LOG_NOTICE, "Unable to make hid list\n");
-               return AST_MODULE_LOAD_DECLINE;
-       }
-
-       usb_list_check("");
-
-       usbradio_active = NULL;
-
-       /* Copy the default jb config over global_jbconf */
-       memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
-
-       /* load config file */
-#ifdef NEW_ASTERISK
-       if (!(cfg = ast_config_load(config,zeroflag)) || cfg == CONFIG_STATUS_FILEINVALID) {
-#else
-       if (!(cfg = ast_config_load(config))) || cfg == CONFIG_STATUS_FILEINVALID {
-#endif
-               ast_log(LOG_NOTICE, "Unable to load config %s\n", config);
-               return AST_MODULE_LOAD_DECLINE;
-       }
-
-       do {
-               store_config(cfg, ctg);
-       } while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
-
-       ast_config_destroy(cfg);
-
-       if (find_desc(usbradio_active) == NULL) {
-               ast_log(LOG_NOTICE, "radio active device %s not found\n", usbradio_active);
-               /* XXX we could default to 'dsp' perhaps ? */
-               /* XXX should cleanup allocated memory etc. */
-               return AST_MODULE_LOAD_DECLINE;
-       }
-
-       if (ast_channel_register(&usbradio_tech)) {
-               ast_log(LOG_ERROR, "Unable to register channel type 'usb'\n");
-               return AST_MODULE_LOAD_DECLINE;
-       }
-
-       ast_cli_register_multiple(cli_usbradio, ARRAY_LEN(cli_usbradio));
-
-       return AST_MODULE_LOAD_SUCCESS;
-}
-/*
-*/
-static int unload_module(void)
-{
-       struct chan_usbradio_pvt *o;
-
-       ast_log(LOG_WARNING, "unload_module() called\n");
-
-       ast_channel_unregister(&usbradio_tech);
-       ast_cli_unregister_multiple(cli_usbradio, ARRAY_LEN(cli_usbradio));
-
-       for (o = usbradio_default.next; o; o = o->next) {
-
-               ast_log(LOG_WARNING, "destroyPmrChannel() called\n");
-               if(o->pmrChan)destroyPmrChannel(o->pmrChan);
-               
-               #if DEBUG_CAPTURES == 1
-               if (frxcapraw) { fclose(frxcapraw); frxcapraw = NULL; }
-               if (frxcaptrace) { fclose(frxcaptrace); frxcaptrace = NULL; }
-               if (frxoutraw) { fclose(frxoutraw); frxoutraw = NULL; }
-               if (ftxcapraw) { fclose(ftxcapraw); ftxcapraw = NULL; }
-               if (ftxcaptrace) { fclose(ftxcaptrace); ftxcaptrace = NULL; }
-               if (ftxoutraw) { fclose(ftxoutraw); ftxoutraw = NULL; }
-               #endif
-
-               close(o->sounddev);
-#ifndef        NEW_ASTERISK
-               if (o->sndcmd[0] > 0) {
-                       close(o->sndcmd[0]);
-                       close(o->sndcmd[1]);
-               }
-#endif
-               if (o->dsp) ast_dsp_free(o->dsp);
-               if (o->owner)
-                       ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
-               if (o->owner)                   /* XXX how ??? */
-                       return -1;
-               /* XXX what about the thread ? */
-               /* XXX what about the memory allocated ? */
-       }
-
-       usbradio_tech.capabilities = ast_format_cap_destroy(usbradio_tech.capabilities);
-       return 0;
-}
-
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "usb Console Channel Driver");
-
-/*     end of file */
-
-
diff --git a/channels/xpmr/sinetabx.h b/channels/xpmr/sinetabx.h
deleted file mode 100755 (executable)
index 14d8f9f..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * sinetabx.h - for Xelatec Private Mobile Radio Processes
- * 
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- * 
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *              
- * This version may be optionally licenced under the GNU LGPL licence.
- *
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-
-#ifndef XPMR_SINETABX_H
-#define XPMR_SINETABX_H        1
-               
-#define SAMPLES_PER_SINE 256           
-               
-static const i16 sinetablex[]={                
-0,                     // 0
-804,           // 1
-1608,          // 2
-2410,          // 3
-3212,          // 4
-4011,          // 5
-4808,          // 6
-5602,          // 7
-6393,          // 8
-7179,          // 9
-7962,          // 10
-8739,          // 11
-9512,          // 12
-10278,         // 13
-11039,         // 14
-11793,         // 15
-12539,         // 16
-13279,         // 17
-14010,         // 18
-14732,         // 19
-15446,         // 20
-16151,         // 21
-16846,         // 22
-17530,         // 23
-18204,         // 24
-18868,         // 25
-19519,         // 26
-20159,         // 27
-20787,         // 28
-21403,         // 29
-22005,         // 30
-22594,         // 31
-23170,         // 32
-23731,         // 33
-24279,         // 34
-24811,         // 35
-25329,         // 36
-25832,         // 37
-26319,         // 38
-26790,         // 39
-27245,         // 40
-27683,         // 41
-28105,         // 42
-28510,         // 43
-28898,         // 44
-29268,         // 45
-29621,         // 46
-29956,         // 47
-30273,         // 48
-30571,         // 49
-30852,         // 50
-31113,         // 51
-31356,         // 52
-31580,         // 53
-31785,         // 54
-31971,         // 55
-32137,         // 56
-32285,         // 57
-32412,         // 58
-32521,         // 59
-32609,         // 60
-32678,         // 61
-32728,         // 62
-32757,         // 63
-32767,         // 64
-32757,         // 65
-32728,         // 66
-32678,         // 67
-32609,         // 68
-32521,         // 69
-32412,         // 70
-32285,         // 71
-32137,         // 72
-31971,         // 73
-31785,         // 74
-31580,         // 75
-31356,         // 76
-31113,         // 77
-30852,         // 78
-30571,         // 79
-30273,         // 80
-29956,         // 81
-29621,         // 82
-29268,         // 83
-28898,         // 84
-28510,         // 85
-28105,         // 86
-27683,         // 87
-27245,         // 88
-26790,         // 89
-26319,         // 90
-25832,         // 91
-25329,         // 92
-24811,         // 93
-24279,         // 94
-23731,         // 95
-23170,         // 96
-22594,         // 97
-22005,         // 98
-21403,         // 99
-20787,         // 100
-20159,         // 101
-19519,         // 102
-18868,         // 103
-18204,         // 104
-17530,         // 105
-16846,         // 106
-16151,         // 107
-15446,         // 108
-14732,         // 109
-14010,         // 110
-13279,         // 111
-12539,         // 112
-11793,         // 113
-11039,         // 114
-10278,         // 115
-9512,          // 116
-8739,          // 117
-7962,          // 118
-7179,          // 119
-6393,          // 120
-5602,          // 121
-4808,          // 122
-4011,          // 123
-3212,          // 124
-2410,          // 125
-1608,          // 126
-804,           // 127
-0,                     // 128
--804,          // 129
--1608,         // 130
--2410,         // 131
--3212,         // 132
--4011,         // 133
--4808,         // 134
--5602,         // 135
--6393,         // 136
--7179,         // 137
--7962,         // 138
--8739,         // 139
--9512,         // 140
--10278,                // 141
--11039,                // 142
--11793,                // 143
--12539,                // 144
--13279,                // 145
--14010,                // 146
--14732,                // 147
--15446,                // 148
--16151,                // 149
--16846,                // 150
--17530,                // 151
--18204,                // 152
--18868,                // 153
--19519,                // 154
--20159,                // 155
--20787,                // 156
--21403,                // 157
--22005,                // 158
--22594,                // 159
--23170,                // 160
--23731,                // 161
--24279,                // 162
--24811,                // 163
--25329,                // 164
--25832,                // 165
--26319,                // 166
--26790,                // 167
--27245,                // 168
--27683,                // 169
--28105,                // 170
--28510,                // 171
--28898,                // 172
--29268,                // 173
--29621,                // 174
--29956,                // 175
--30273,                // 176
--30571,                // 177
--30852,                // 178
--31113,                // 179
--31356,                // 180
--31580,                // 181
--31785,                // 182
--31971,                // 183
--32137,                // 184
--32285,                // 185
--32412,                // 186
--32521,                // 187
--32609,                // 188
--32678,                // 189
--32728,                // 190
--32757,                // 191
--32767,                // 192
--32757,                // 193
--32728,                // 194
--32678,                // 195
--32609,                // 196
--32521,                // 197
--32412,                // 198
--32285,                // 199
--32137,                // 200
--31971,                // 201
--31785,                // 202
--31580,                // 203
--31356,                // 204
--31113,                // 205
--30852,                // 206
--30571,                // 207
--30273,                // 208
--29956,                // 209
--29621,                // 210
--29268,                // 211
--28898,                // 212
--28510,                // 213
--28105,                // 214
--27683,                // 215
--27245,                // 216
--26790,                // 217
--26319,                // 218
--25832,                // 219
--25329,                // 220
--24811,                // 221
--24279,                // 222
--23731,                // 223
--23170,                // 224
--22594,                // 225
--22005,                // 226
--21403,                // 227
--20787,                // 228
--20159,                // 229
--19519,                // 230
--18868,                // 231
--18204,                // 232
--17530,                // 233
--16846,                // 234
--16151,                // 235
--15446,                // 236
--14732,                // 237
--14010,                // 238
--13279,                // 239
--12539,                // 240
--11793,                // 241
--11039,                // 242
--10278,                // 243
--9512,         // 244
--8739,         // 245
--7962,         // 246
--7179,         // 247
--6393,         // 248
--5602,         // 249
--4808,         // 250
--4011,         // 251
--3212,         // 252
--2410,         // 253
--1608,         // 254
--804,          // 255
-};
-
-#endif /* !XPMR_SINETABX_H */
diff --git a/channels/xpmr/xpmr.c b/channels/xpmr/xpmr.c
deleted file mode 100755 (executable)
index 4bfc2c5..0000000
+++ /dev/null
@@ -1,3325 +0,0 @@
-/*
- * xpmr.c - Xelatec Private Mobile Radio Processes
- *
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- *
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *
- * This version may be optionally licenced under the GNU LGPL licence.
- *
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- * 20080118 0800 sph@xelatec.com major fixes and features
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-/*
-       FYI     = For Your Information
-       PMR     = Private Mobile Radio
-       RX      = Receive
-       TX      = Transmit
-       CTCSS   = Continuous Tone Coded Squelch System
-       TONE    = Same as above.
-       LSD     = Low Speed Data, subaudible signaling. May be tones or codes.
-       VOX     = Voice Operated Transmit
-       DSP     = Digital Signal Processing
-       LPF     = Low Pass Filter
-       FIR     = Finite Impulse Response (Filter)
-       IIR     = Infinite Impulse Response (Filter)
-*/
-
-// XPMR_FILE_VERSION(__FILE__, "$Revision$")
-
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#ifdef HAVE_SYS_IO_H
-#include <sys/io.h>
-#endif
-#include <fcntl.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <errno.h>
-          
-#include "xpmr.h"
-#include "xpmr_coef.h"
-#include "sinetabx.h"
-
-static i16 pmrChanIndex=0;                             // count of created pmr instances
-//static i16 pmrSpsIndex=0;
-
-#if (DTX_PROG == 1) ||         XPMR_PPTP == 1
-static int ppdrvdev=0;
-#endif
-
-/*
-       Trace Routines
-*/
-void strace(i16 point, t_sdbg *sdbg, i16 idx, i16 value)
-{
-       // make dbg_trace buffer in structure
-       if(!sdbg->mode || sdbg->point[point]<0){
-               return;
-    } else {
-               sdbg->buffer[(idx*XPMR_DEBUG_CHANS) + sdbg->point[point]] = value;
-       }
-}
-/*
-
-*/
-void strace2(t_sdbg *sdbg)
-{
-       int i;
-       for(i=0;i<XPMR_DEBUG_CHANS;i++)
-       {
-               if(sdbg->source[i])
-               {
-                       int ii;
-                       for(ii=0;ii<SAMPLES_PER_BLOCK;ii++)
-                       {
-                               sdbg->buffer[ii*XPMR_DEBUG_CHANS + i] = sdbg->source[i][ii];
-                   }
-               }
-       }
-}
-#if XPMR_PPTP == 1
-/*
-       Hardware Trace Signals via the PC Parallel Port
-*/
-void   pptp_init (void)
-{
-       if (ppdrvdev == 0)
-       ppdrvdev = open("/dev/ppdrv_device", 0);
-
-    if (ppdrvdev < 0)
-    {
-        ast_log(LOG_ERROR, "open /dev/ppdrv_ppdrvdev returned %i\n",ppdrvdev);
-               exit(0);
-       }
-       ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX | DTX_TP1 | DTX_TP2);
-       ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR,    DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX | DTX_TP1 | DTX_TP2);
-}
-/*
-*/
-void   pptp_write(i16 bit, i16 state)
-{
-       if(bit==0)
-       {
-               if(state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP1);
-               else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,DTX_TP1);
-       }
-       else
-       {
-               if(state)ioctl(ppdrvdev,PPDRV_IOC_PINSET,DTX_TP2);
-               else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,DTX_TP2);
-       }
-}
-#endif
-/*
-       take source string allocate and copy
-       copy is modified, delimiters are replaced with zeros to mark
-       end of string
-       count set pointers
-       string_parse( char *src, char *dest, char **sub)
-*/
-i16 string_parse(char *src, char **dest, char ***ptrs)
-{
-       char *p,*pd;
-       char *ptstr[1000];
-       i16 i, slen, numsub;
-
-       TRACEJ(2,("string_parse(%s)\n",src));
-
-       slen=strlen(src);
-       TRACEJ(2,(" source len = %i\n",slen));
-
-       pd=*dest;
-       free(pd);
-    pd=calloc(slen+1,1);
-       memcpy(pd,src,slen);
-       *dest=pd;
-
-       p=0;
-       numsub=0;
-       for(i=0;i<slen+1;i++)
-       {
-               TRACEJ(5,(" pd[%i] = %c\n",i,pd[i]));
-
-               if( p==0 && pd[i]!=',' && pd[i]!=' ' )
-               {
-                       p=&(pd[i]);     
-               }
-               else if(pd[i]==',' || pd[i]==0 )
-               {
-                       ptstr[numsub]=p;
-                       pd[i]=0;
-                       p=0;
-                       numsub++;
-               }
-       }
-
-       for(i=0;i<numsub;i++)
-       {
-               TRACEJ(5,(" ptstr[%i] = %p %s\n",i,ptstr[i],ptstr[i]));
-       }
-
-       if(*ptrs)free(*ptrs);
-       *ptrs=calloc(numsub,4);
-       for(i=0;i<numsub;i++)
-       {
-               (*ptrs)[i]=ptstr[i];    
-               TRACEJ(5,(" %i = %s\n",i,(*ptrs)[i]));
-       }
-       TRACEJ(5,("string_parse()=%i\n\n",numsub));
-
-       return numsub;
-}
-/*
-       the parent program defines
-       pRxCodeSrc and pTxCodeSrc string pointers to the list of codes
-       pTxCodeDefault the default Tx Code.
-
-*/
-i16 code_string_parse(t_pmr_chan *pChan)
-{
-       i16 i, ii, hit, ti;
-       char *p;
-       float f, maxctcsstxfreq;
-
-       t_pmr_sps       *pSps;
-       i16     maxctcssindex;
-
-       TRACEF(1,("code_string_parse(%i)\n",0)); 
-       TRACEF(1,("pChan->pRxCodeSrc %s \n",pChan->pRxCodeSrc));
-       TRACEF(1,("pChan->pTxCodeSrc %s \n",pChan->pTxCodeSrc));
-       TRACEF(1,("pChan->pTxCodeDefault %s \n",pChan->pTxCodeDefault));
-
-       //printf("code_string_parse() %s / %s / %s / %s \n",pChan->name, pChan->pTxCodeDefault,pChan->pTxCodeSrc,pChan->pRxCodeSrc);
-
-       maxctcssindex=CTCSS_NULL;
-       maxctcsstxfreq=CTCSS_NULL;
-       pChan->txctcssdefault_index=CTCSS_NULL;
-       pChan->txctcssdefault_value=CTCSS_NULL;
-
-       pChan->b.ctcssRxEnable=pChan->b.ctcssTxEnable=0;
-       pChan->b.dcsRxEnable=pChan->b.dcsTxEnable=0;
-       pChan->b.lmrRxEnable=pChan->b.lmrTxEnable=0;
-       pChan->b.mdcRxEnable=pChan->b.mdcTxEnable=0;
-       pChan->b.dstRxEnable=pChan->b.dstTxEnable=0;
-       pChan->b.p25RxEnable=pChan->b.p25TxEnable=0;
-
-       if(pChan->spsLsdGen){
-               pChan->spsLsdGen->enabled=0;
-               pChan->spsLsdGen->state=0;
-       }
-
-       TRACEF(1,("code_string_parse(%i) 05\n",0));
-
-       pChan->numrxcodes = string_parse( pChan->pRxCodeSrc, &(pChan->pRxCodeStr), &(pChan->pRxCode));
-       pChan->numtxcodes = string_parse( pChan->pTxCodeSrc, &(pChan->pTxCodeStr), &(pChan->pTxCode));
-
-       if(pChan->numrxcodes!=pChan->numtxcodes)printf("ERROR: numrxcodes != numtxcodes \n");
-       
-       pChan->rxCtcss->enabled=0;
-       pChan->rxCtcss->gain=1*M_Q8;
-       pChan->rxCtcss->limit=8192;
-       pChan->rxCtcss->input=pChan->pRxLsdLimit;
-       pChan->rxCtcss->decode=CTCSS_NULL;
-
-       pChan->rxCtcss->testIndex=0;
-       if(!pChan->rxCtcss->testIndex)pChan->rxCtcss->testIndex=3;
-
-       pChan->rxctcssfreq[0]=0;        // decode now   CTCSS_RXONLY
-
-       for(i=0;i<CTCSS_NUM_CODES;i++)
-       {
-               pChan->rxctcss[i]=0;
-               pChan->txctcss[i]=0;
-               pChan->rxCtcssMap[i]=CTCSS_NULL;
-       }
-
-       TRACEF(1,("code_string_parse(%i) 10\n",0));
-       
-       #ifdef XPMRX_H
-       xpmrx(pChan,XXO_LSDCODEPARSE);
-       #endif
-
-       // Do Receive Codes String
-       for(i=0;i<pChan->numrxcodes;i++)
-       {
-               i16 ri,_ti;
-               float _f;
-
-               p=pChan->pStr=pChan->pRxCode[i];
-
-               #ifdef HAVE_XPMRX
-               if(!xpmrx(pChan,XXO_LSDCODEPARSE_1))
-               #endif
-               {
-                       sscanf(p, "%30f", &_f);
-                       ri=CtcssFreqIndex(_f);
-                       if(ri>maxctcssindex)maxctcssindex=ri;
-
-                       sscanf(pChan->pTxCode[i], "%30f", &_f);
-                   _ti=CtcssFreqIndex(_f);
-                       if(_f>maxctcsstxfreq)maxctcsstxfreq=_f;
-
-                       if(ri>CTCSS_NULL && _ti>CTCSS_NULL)
-                       {
-                               pChan->b.ctcssRxEnable=pChan->b.ctcssTxEnable=1;
-                               pChan->rxCtcssMap[ri]=_ti;
-                               pChan->numrxctcssfreqs++;
-                               TRACEF(1,("pChan->rxctcss[%i]=%s  pChan->rxCtcssMap[%i]=%i\n",i,pChan->rxctcss[i],ri,_ti));
-                       }
-                       else if(ri>CTCSS_NULL && _f==0)
-                       {
-                               pChan->b.ctcssRxEnable=1;
-                               pChan->rxCtcssMap[ri]=CTCSS_RXONLY;
-                               pChan->numrxctcssfreqs++;
-                               TRACEF(1,("pChan->rxctcss[%i]=%s  pChan->rxCtcssMap[%i]=%i RXONLY\n",i,pChan->rxctcss[i],ri,_ti));
-                       }
-                       else
-                       {
-                               i16 _ii;
-                               pChan->numrxctcssfreqs=0;
-                               for(_ii=0;_ii<CTCSS_NUM_CODES;_ii++) pChan->rxCtcssMap[_ii]=CTCSS_NULL;
-                               TRACEF(1,("WARNING: Invalid Channel code detected and ignored. %i %s %s \n",i,pChan->pRxCode[i],pChan->pTxCode[i]));
-                       }
-               }
-       }
-
-       TRACEF(1,("code_string_parse() CTCSS Init Struct  %i  %i\n",pChan->b.ctcssRxEnable,pChan->b.ctcssTxEnable));
-       if(pChan->b.ctcssRxEnable)
-       {
-               pChan->rxHpfEnable=1;
-               pChan->spsRxLsdNrz->enabled=pChan->rxCenterSlicerEnable=1;
-               pChan->rxCtcssDecodeEnable=1;
-               pChan->rxCtcss->enabled=1;
-       }
-       else
-       {
-               pChan->rxHpfEnable=1;
-               pChan->spsRxLsdNrz->enabled=pChan->rxCenterSlicerEnable=0;
-               pChan->rxCtcssDecodeEnable=0;
-               pChan->rxCtcss->enabled=0;
-       }
-
-       TRACEF(1,("code_string_parse() CTCSS Init Decoders \n"));
-       for(i=0;i<CTCSS_NUM_CODES;i++)
-       {
-               t_tdet *ptdet;
-               ptdet=&(pChan->rxCtcss->tdet[i]);
-               ptdet->counterFactor=coef_ctcss_div[i];
-               ptdet->state=1;
-               ptdet->setpt=(M_Q15*0.041);                                     // 0.069
-               ptdet->hyst =(M_Q15*0.0130);
-               ptdet->binFactor=(M_Q15*0.135);                         // was 0.140
-               ptdet->fudgeFactor=8;
-       }
-
-
-       // DEFAULT TX CODE
-       TRACEF(1,("code_string_parse() Default Tx Code %s \n",pChan->pTxCodeDefault));
-       pChan->txcodedefaultsmode=SMODE_NULL;
-       p=pChan->pStr=pChan->pTxCodeDefault;
-
-       #ifdef HAVE_XPMRX
-       if(!lsd_code_parse(pChan,3))
-       #endif
-       {
-               sscanf(p, "%30f", &f);
-           ti=CtcssFreqIndex(f);
-               if(f>maxctcsstxfreq)maxctcsstxfreq=f;
-
-               if(ti>CTCSS_NULL)
-               {
-                       pChan->b.ctcssTxEnable=1;
-                       pChan->txctcssdefault_index=ti;
-                       pChan->txctcssdefault_value=f;
-                       pChan->spsSigGen0->freq=f*10;
-                       pChan->txcodedefaultsmode=SMODE_CTCSS;
-                       TRACEF(1,("code_string_parse() Tx Default CTCSS = %s %i %f\n",p,ti,f));
-               }
-       }
-
-
-       // set x for maximum length and just change pointers
-       TRACEF(1,("code_string_parse() Filter Config \n"));
-       pSps=pChan->spsTxLsdLpf;
-       if(pSps->x)free(pSps->x);
-       if(maxctcsstxfreq>203.5)
-       {
-               pSps->ncoef=taps_fir_lpf_250_9_66;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_fir_lpf_250_9_66;
-               pSps->nx=taps_fir_lpf_250_9_66;
-               pSps->size_x=2;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               pSps->calcAdjust=gain_fir_lpf_250_9_66;
-               TRACEF(1,("code_string_parse() Tx Filter Freq High\n"));
-       }
-       else
-       {
-               pSps->ncoef=taps_fir_lpf_215_9_88;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_fir_lpf_215_9_88;
-               pSps->nx=taps_fir_lpf_215_9_88;
-               pSps->size_x=2;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               pSps->calcAdjust=gain_fir_lpf_215_9_88;
-               TRACEF(1,("code_string_parse() Tx Filter Freq Low\n"));
-       }
-
-       // CTCSS Rx Decoder Low Pass Filter
-       hit=0;
-       ii=     CtcssFreqIndex(203.5);
-       for(i=ii;i<CTCSS_NUM_CODES;i++)
-       {
-               if(pChan->rxCtcssMap[i]>CTCSS_NULL)hit=1;
-       }
-
-       pSps=pChan->spsRxLsd;
-       if(pSps->x)free(pSps->x);
-       if(hit)
-       {
-               pSps->ncoef=taps_fir_lpf_250_9_66;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_fir_lpf_250_9_66;
-               pSps->nx=taps_fir_lpf_250_9_66;
-               pSps->size_x=2;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               pSps->calcAdjust=gain_fir_lpf_250_9_66;
-               TRACEF(1,("code_string_parse() Rx Filter Freq High\n"));
-       }
-       else
-       {
-               pSps->ncoef=taps_fir_lpf_215_9_88;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_fir_lpf_215_9_88;
-               pSps->nx=taps_fir_lpf_215_9_88;
-               pSps->size_x=2;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               pSps->calcAdjust=gain_fir_lpf_215_9_88;
-               TRACEF(1,("code_string_parse() Rx Filter Freq Low\n"));
-       }
-
-       if(pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable)
-       {
-               pChan->rxCenterSlicerEnable=1;
-               pSps->enabled=1;
-       }
-       else
-       {
-               pChan->rxCenterSlicerEnable=0;
-               pSps->enabled=0;
-       }
-
-       #if XPMR_DEBUG0 == 1
-       TRACEF(2,("code_string_parse() ctcssRxEnable = %i \n",pChan->b.ctcssRxEnable));
-       TRACEF(2,("                    ctcssTxEnable = %i \n",pChan->b.ctcssTxEnable));
-       TRACEF(2,("                      dcsRxEnable = %i \n",pChan->b.dcsRxEnable));
-       TRACEF(2,("                      lmrRxEnable = %i \n",pChan->b.lmrRxEnable));
-       TRACEF(2,("               txcodedefaultsmode = %i \n",pChan->txcodedefaultsmode));
-       for(i=0;i<CTCSS_NUM_CODES;i++)
-       {
-               TRACEF(2,("rxCtcssMap[%i] = %i \n",i,pChan->rxCtcssMap[i]));
-       }
-    #endif
-
-       #ifdef HAVE_XPMRX
-       lsd_code_parse(pChan,5);
-       #endif
-
-       TRACEF(1,("code_string_parse(%i) end\n",0));
-
-       return 0;
-}
-/*
-       Convert a Frequency in Hz to a zero based CTCSS Table index
-*/
-i16 CtcssFreqIndex(float freq)
-{
-       i16 i,hit=CTCSS_NULL;
-
-       for(i=0;i<CTCSS_NUM_CODES;i++){
-               if(freq==freq_ctcss[i])hit=i;
-       }
-       return hit;
-}
-/*
-       pmr_rx_frontend
-       Takes a block of data and low pass filters it.
-       Determines the amplitude of high frequency noise for carrier detect.
-       Decimates input data to change the rate.
-*/
-i16 pmr_rx_frontend(t_pmr_sps *mySps)
-{
-       #define DCgainBpfNoise  65536
-
-       i16 samples,iOutput, *input, *output, *noutput;
-       i16 *x, *coef;
-    i32 i, naccum, outputGain, calcAdjust;
-       i64 y;
-       i16 nx, hyst, setpt, compOut;
-       i16 amax, amin, apeak, discounteru, discounterl, discfactor;
-       i16 decimator, decimate, doNoise;
-
-       TRACEJ(5,("pmr_rx_frontend()\n"));
-
-       if(!mySps->enabled)return(1);
-
-       decimator = mySps->decimator;
-       decimate = mySps->decimate;
-
-       input     = mySps->source;
-       output    = mySps->sink;
-       noutput   = mySps->parentChan->pRxNoise;
-
-       nx        = mySps->nx;
-       coef      = mySps->coef;
-
-       calcAdjust = mySps->calcAdjust;
-       outputGain = mySps->outputGain;
-
-       amax=mySps->amax;
-       amin=mySps->amin;
-       apeak=mySps->apeak;
-       discounteru=mySps->discounteru;
-       discounterl=mySps->discounterl;
-       discfactor=mySps->discfactor;
-       setpt=mySps->setpt;
-       hyst=mySps->hyst;
-       compOut=mySps->compOut;
-
-       samples=mySps->nSamples*decimate;
-       x=mySps->x;
-       iOutput=0;
-
-       if(mySps->parentChan->rxCdType!=CD_XPMR_VOX)doNoise=1;
-       else doNoise=0;
-
-       for(i=0;i<samples;i++)
-       {
-               i16 n;
-
-               //shift the old samples
-           for(n=nx-1; n>0; n--)
-              x[n] = x[n-1];
-
-           x[0] = input[i*2];
-
-               --decimator;
-
-               if(decimator<=0)
-               {
-                       decimator=decimate;
-
-                   y=0;
-                   for(n=0; n<nx; n++)
-                       y += coef[n] * x[n];
-
-                   y=((y/calcAdjust)*outputGain)/M_Q8;
-
-                       if(y>32767)y=32767;
-                       else if(y<-32767)y=-32767;
-
-                   output[iOutput]=y;                                  // Rx Baseband decimated
-                       noutput[iOutput++] = apeak;                     // Rx Noise
-               }
-
-               if(doNoise)
-               {
-                       // calculate noise output
-                       naccum=0;
-                   for(n=0; n<nx; n++)
-                       naccum += coef_fir_bpf_noise_1[n] * x[n];
-
-                   naccum /= DCgainBpfNoise;
-
-                       if(naccum>amax)
-                       {
-                               amax=naccum;
-                               discounteru=discfactor;
-                       }
-                       else if(--discounteru<=0)
-                       {
-                               discounteru=discfactor;
-                               amax=(i32)((amax*32700)/32768);
-                       }
-
-                       if(naccum<amin)
-                       {
-                               amin=naccum;
-                               discounterl=discfactor;
-                       }
-                       else if(--discounterl<=0)
-                       {
-                               discounterl=discfactor;
-                               amin=(i32)((amin*32700)/32768);
-                       }
-
-                       apeak=(amax-amin)/2;
-
-               }  // if doNoise
-       }
-
-       if(doNoise)
-       {
-               ((t_pmr_chan *)(mySps->parentChan))->rxRssi=apeak;
-
-               if(apeak>setpt || (compOut&&(apeak>(setpt-hyst)))) compOut=1;
-               else compOut=0;
-               mySps->compOut=compOut;
-               mySps->amax=amax;
-               mySps->amin=amin;
-               mySps->apeak=apeak;
-               mySps->discounteru=discounteru;
-               mySps->discounterl=discounterl;
-       }
-
-       return 0;
-}
-/*
-       pmr general purpose fir
-       works on a block of samples
-*/
-i16 pmr_gp_fir(t_pmr_sps *mySps)
-{
-       i32 nsamples,inputGain,outputGain,calcAdjust;
-       i16 *input, *output;
-       i16 *x, *coef;
-    i32 i, ii;
-       i16 nx, hyst, setpt, compOut;
-       i16 amax, amin, apeak=0, discounteru=0, discounterl=0, discfactor;
-       i16 decimator, decimate, interpolate;
-       i16 numChanOut, selChanOut, mixOut, monoOut;
-
-       TRACEJ(5,("pmr_gp_fir() %i %i\n",mySps->index, mySps->enabled));
-
-       if(!mySps->enabled)return(1);
-
-       inputGain  = mySps->inputGain;
-       calcAdjust = mySps->calcAdjust;
-       outputGain = mySps->outputGain;
-
-       input      = mySps->source;
-       output     = mySps->sink;
-       x          = mySps->x;
-       nx         = mySps->nx;
-       coef       = mySps->coef;
-
-       decimator   = mySps->decimator;
-       decimate        = mySps->decimate;
-       interpolate = mySps->interpolate;
-
-       setpt      = mySps->setpt;
-       compOut    = mySps->compOut;
-
-       inputGain  = mySps->inputGain;
-       outputGain = mySps->outputGain;
-       numChanOut = mySps->numChanOut;
-       selChanOut = mySps->selChanOut;
-       mixOut     = mySps->mixOut;
-       monoOut    = mySps->monoOut;
-
-       amax=mySps->amax;
-       amin=mySps->amin;
-
-       discfactor=mySps->discfactor;
-       hyst=mySps->hyst;
-       setpt=mySps->setpt;
-       nsamples=mySps->nSamples;
-
-       if(mySps->option==3)
-       {
-               mySps->option=0;
-               mySps->enabled=0;
-               for(i=0;i<nsamples;i++)
-               {
-                       if(monoOut)
-                               output[(i*2)]=output[(i*2)+1]=0;
-                       else
-                               output[(i*numChanOut)+selChanOut]=0;
-               }
-               return 0;
-       }
-
-       ii=0;
-       for(i=0;i<nsamples;i++)
-       {
-               int ix;
-
-               int64_t y=0;
-
-               if(decimate<0)
-               {
-                       decimator=decimate;
-               }
-
-               for(ix=0;ix<interpolate;ix++)
-               {
-                       i16 n;
-                       y=0;
-
-                   for(n=nx-1; n>0; n--)
-                      x[n] = x[n-1];
-                   x[0] = (input[i]*inputGain)/M_Q8;
-
-                       #if 0
-                       --decimator;
-                       if(decimator<=0)
-                       {
-                               decimator=decimate;
-                           for(n=0; n<nx; n++)
-                               y += coef[n] * x[n];
-                               y /= (outputGain*3);
-                               output[ii++]=y;
-                       }
-                       #else
-                   for(n=0; n<nx; n++)
-                       y += coef[n] * x[n];
-
-                       y=((y/calcAdjust)*outputGain)/M_Q8;
-
-                       if(mixOut){
-                               if(monoOut){
-                                       output[(ii*2)]=output[(ii*2)+1]+=y;
-                               }
-                               else{
-                                       output[(ii*numChanOut)+selChanOut]+=y;
-                               }
-                       }
-                       else{
-                               if(monoOut){
-                                       output[(ii*2)]=output[(ii*2)+1]=y;
-                               }
-                               else{
-                                       output[(ii*numChanOut)+selChanOut]=y;
-                               }
-                       }
-                       ii++;
-                   #endif
-               }
-
-               // amplitude detector
-               if(setpt)
-               {
-                       i16 accum=y;
-
-                       if(accum>amax)
-                       {
-                               amax=accum;
-                               discounteru=discfactor;
-                       }
-                       else if(--discounteru<=0)
-                       {
-                               discounteru=discfactor;
-                               amax=(i32)((amax*32700)/32768);
-                       }
-
-                       if(accum<amin)
-                       {
-                               amin=accum;
-                               discounterl=discfactor;
-                       }
-                       else if(--discounterl<=0)
-                       {
-                               discounterl=discfactor;
-                               amin=(i32)((amin*32700)/32768);
-                       }
-
-                       apeak = (i32)(amax-amin)/2;
-
-                       if(apeak>setpt)compOut=1;
-                       else if(compOut&&(apeak<(setpt-hyst)))compOut=0;
-               }
-       }
-
-       mySps->decimator = decimator;
-
-       mySps->amax=amax;
-       mySps->amin=amin;
-       mySps->apeak=apeak;
-       mySps->discounteru=discounteru;
-       mySps->discounterl=discounterl;
-
-       mySps->compOut=compOut;
-
-       return 0;
-}
-/*
-       general purpose integrator lpf
-*/
-i16 gp_inte_00(t_pmr_sps *mySps)
-{
-       i16 npoints;
-       i16 *input, *output;
-
-       i32 outputGain;
-       i32     i;
-       i32 accum;
-
-       i32 state00;
-       i16 coeff00, coeff01;
-
-       TRACEJ(5,("gp_inte_00() %i\n",mySps->enabled));
-       if(!mySps->enabled)return(1);
-
-       input   = mySps->source;
-       output  = mySps->sink;
-
-       npoints=mySps->nSamples;
-
-       outputGain=mySps->outputGain;
-
-       coeff00=((i16*)mySps->coef)[0];
-       coeff01=((i16*)mySps->coef)[1];
-       state00=((i32*)mySps->x)[0];
-
-       // note fixed gain of 2 to compensate for attenuation
-       // in passband
-
-       for(i=0;i<npoints;i++)
-       {
-               accum=input[i];
-               state00 = accum + (state00*coeff01)/M_Q15;
-               accum = (state00*coeff00)/(M_Q15/4);
-               output[i]=(accum*outputGain)/M_Q8;
-       }
-
-       ((i32*)(mySps->x))[0]=state00;
-
-       return 0;
-}
-/*
-       general purpose differentiator hpf
-*/
-i16 gp_diff(t_pmr_sps *mySps)
-{
-       i16 *input, *output;
-       i16 npoints;
-       i32 outputGain, calcAdjust;
-       i32     i;
-       i32 temp0,temp1;
-       i16 x0;
-       i32 _y0;
-       i16 a0,a1;
-       i16 *coef;
-       i16 *x;
-
-       input   = mySps->source;
-       output  = mySps->sink;
-
-       npoints=mySps->nSamples;
-
-       outputGain=mySps->outputGain;
-       calcAdjust=mySps->calcAdjust;
-
-       coef=(i16*)(mySps->coef);
-       x=(i16*)(mySps->x);
-       a0=coef[0];
-       a1=coef[1];
-
-       x0=x[0];
-
-       TRACEJ(5,("gp_diff()\n"));
-
-       for (i=0;i<npoints;i++)
-    {
-               temp0 = x0 * a1;
-                  x0 = input[i];
-               temp1 = input[i] * a0;
-                 _y0 = (temp0 + temp1)/calcAdjust;
-                 _y0 = (_y0*outputGain)/M_Q8;
-               
-               if(_y0>32766)_y0=32766;
-               else if(_y0<-32766)_y0=-32766;
-        output[i]=_y0;
-    }
-
-       x[0]=x0;
-
-       return 0;
-}
-/*     ----------------------------------------------------------------------
-       CenterSlicer
-*/
-i16 CenterSlicer(t_pmr_sps *mySps)
-{
-       i16 npoints/*, lhit, uhit*/;
-       i16 *input, *output, *buff;
-
-       i32 inputGainB;
-       i32     i;
-       i32 accum;
-
-       i32  amax;                      // buffer amplitude maximum
-       i32  amin;                      // buffer amplitude minimum
-       i32  apeak;                     // buffer amplitude peak
-       i32  center;
-       i32  setpt;                     // amplitude set point for peak tracking
-
-       i32  discounteru;       // amplitude detector integrator discharge counter upper
-       i32  discounterl;       // amplitude detector integrator discharge counter lower
-       i32  discfactor;        // amplitude detector integrator discharge factor
-
-       TRACEJ(5,("CenterSlicer() %i\n",mySps->enabled));
-       if(!mySps->enabled)return(1);
-
-       input   = mySps->source;
-       output  = mySps->sink;                          // limited output
-       buff    = mySps->buff;
-
-       npoints=mySps->nSamples;
-
-       inputGainB=mySps->inputGainB;
-
-       amax=mySps->amax;
-       amin=mySps->amin;
-       setpt=mySps->setpt;
-       apeak=mySps->apeak;
-       discounteru=mySps->discounteru;
-       discounterl=mySps->discounterl;
-
-       discfactor=mySps->discfactor;
-       npoints=mySps->nSamples;
-
-       for(i=0;i<npoints;i++)
-       {
-               #if XPMR_DEBUG0 == 1
-               static i32 tfx=0;
-               #endif
-               accum=input[i];
-
-               /* lhit=uhit=0; */
-
-               if(accum>amax)
-               {
-                       amax=accum;
-                       /* uhit=1; */
-                       if(amin<(amax-setpt))
-                       {
-                               amin=(amax-setpt);
-                               /* lhit=1; */
-                       }
-               }
-               else if(accum<amin)
-               {
-                       amin=accum;
-                       /* lhit=1; */
-                       if(amax>(amin+setpt))
-                       {
-                               amax=(amin+setpt);
-                               /* uhit=1; */
-                       }
-               }
-               #if 0
-               if((discounteru-=1)<=0 && amax>amin)
-               {
-                       if((amax-=10)<amin)amax=amin;
-                       uhit=1;
-               }
-
-               if((discounterl-=1)<=0 && amin<amax)
-               {
-                       if((amin+=10)>amax)amin=amax;
-                       lhit=1;
-               }
-               if(uhit)discounteru=discfactor;
-               if(lhit)discounterl=discfactor;
-
-               #else
-                
-               if((amax-=discfactor)<amin)amax=amin;
-               if((amin+=discfactor)>amax)amin=amax;
-
-               #endif
-
-               apeak = (amax-amin)/2;
-               center = (amax+amin)/2;
-               accum = accum - center;
-
-               output[i]=accum;                        // sink output unlimited/centered.
-
-               // do limiter function
-               if(accum>inputGainB)accum=inputGainB;
-               else if(accum<-inputGainB)accum=-inputGainB;
-               buff[i]=accum;
-
-               #if XPMR_DEBUG0 == 1
-               #if 0
-               mySps->parentChan->pRxLsdCen[i]=center;         // trace center ref
-               #else
-               if((tfx++/8)&1)                                                         // trace min/max levels
-                       mySps->parentChan->pRxLsdCen[i]=amax;
-               else
-                       mySps->parentChan->pRxLsdCen[i]=amin;
-               #endif
-           #if 0
-               if(mySps->parentChan->frameCountRx&0x01) mySps->parentChan->prxDebug1[i]=amax;
-               else mySps->parentChan->prxDebug1[i]=amin;
-               #endif
-               #endif
-       }
-
-       mySps->amax=amax;
-       mySps->amin=amin;
-       mySps->apeak=apeak;
-       mySps->discounteru=discounteru;
-       mySps->discounterl=discounterl;
-
-       return 0;
-}
-/*     ----------------------------------------------------------------------
-       MeasureBlock
-       determine peak amplitude
-*/
-i16 MeasureBlock(t_pmr_sps *mySps)
-{
-       i16 npoints;
-       i16 *input, *output;
-
-       i32     i;
-       i32 accum;
-
-       i16  amax;                      // buffer amplitude maximum
-       i16  amin;                      // buffer amplitude minimum
-       i16  apeak=0;                   // buffer amplitude peak (peak to peak)/2
-       i16  setpt;                     // amplitude set point for amplitude comparator
-
-       i32  discounteru;       // amplitude detector integrator discharge counter upper
-       i32  discounterl;       // amplitude detector integrator discharge counter lower
-       i32  discfactor;        // amplitude detector integrator discharge factor
-
-       TRACEJ(5,("MeasureBlock() %i\n",mySps->enabled));
-
-       if(!mySps->enabled)return 1;
-
-       if(mySps->option==3)
-       {
-               mySps->amax = mySps->amin = mySps->apeak = \
-               mySps->discounteru = mySps->discounterl = \
-               mySps->enabled = 0;
-               return 1;
-       }
-
-       input   = mySps->source;
-       output  = mySps->sink;
-
-       npoints=mySps->nSamples;
-
-       amax=mySps->amax;
-       amin=mySps->amin;
-       setpt=mySps->setpt;
-       discounteru=mySps->discounteru;
-       discounterl=mySps->discounterl;
-
-       discfactor=mySps->discfactor;
-       npoints=mySps->nSamples;
-
-       for(i=0;i<npoints;i++)
-       {
-               accum=input[i];
-
-               if(accum>amax)
-               {
-                       amax=accum;
-                       discounteru=discfactor;
-               }
-               else if(--discounteru<=0)
-               {
-                       discounteru=discfactor;
-                       amax=(i32)((amax*32700)/32768);
-               }
-
-               if(accum<amin)
-               {
-                       amin=accum;
-                       discounterl=discfactor;
-               }
-               else if(--discounterl<=0)
-               {
-                       discounterl=discfactor;
-                       amin=(i32)((amin*32700)/32768);
-               }
-
-               apeak = (i32)(amax-amin)/2;
-               if(output)output[i]=apeak;
-       }
-
-       mySps->amax=amax;
-       mySps->amin=amin;
-       mySps->apeak=apeak;
-       mySps->discounteru=discounteru;
-       mySps->discounterl=discounterl;
-       if(apeak>=setpt) mySps->compOut=1;
-       else mySps->compOut=0;
-
-       //TRACEX((" -MeasureBlock()=%i\n",mySps->apeak));
-       return 0;
-}
-/*
-       SoftLimiter
-*/
-i16 SoftLimiter(t_pmr_sps *mySps)
-{
-       i16 npoints;
-       //i16 samples, lhit,uhit;
-       i16 *input, *output;
-
-       i32 /*inputGain, */outputGain;
-       i32     i;
-       i32 accum;
-       i32  tmp;
-
-       i32  amax;                      // buffer amplitude maximum
-       i32  amin;                      // buffer amplitude minimum
-       //i32  apeak;           // buffer amplitude peak
-       i32  setpt;                     // amplitude set point for amplitude comparator
-
-       input   = mySps->source;
-       output  = mySps->sink;
-
-       /* inputGain=mySps->inputGain; */
-       outputGain=mySps->outputGain;
-
-       npoints=mySps->nSamples;
-
-       setpt=mySps->setpt;
-       amax=(setpt*124)/128;
-       amin=-amax;
-
-       TRACEJ(5,("SoftLimiter() %i %i %i) \n",amin, amax,setpt));
-
-       for(i=0;i<npoints;i++)
-       {
-               accum=input[i];
-               //accum=input[i]*mySps->inputGain/256;
-
-               if(accum>setpt)
-               {
-                   tmp=((accum-setpt)*4)/128;
-                   accum=setpt+tmp;
-                       if(accum>amax)accum=amax;
-                       accum=setpt;
-               }
-               else if(accum<-setpt)
-               {
-                   tmp=((accum+setpt)*4)/128;
-                   accum=(-setpt)-tmp;
-                       if(accum<amin)accum=amin;
-                       accum=-setpt;
-               }
-
-               output[i]=(accum*outputGain)/M_Q8;
-       }
-
-       return 0;
-}
-/*
-       SigGen() - sine, square function generator
-       sps overloaded values
-       discfactor  = phase factor
-       discfactoru = phase index
-       if source is not NULL then mix it in!
-
-       sign table and output gain are in Q15 format (32767=.999)
-*/
-i16    SigGen(t_pmr_sps *mySps)
-{
-       #define PH_FRACT_FACT   128
-
-       i32 ph;
-       i16 i,outputgain,waveform,numChanOut,selChanOut;
-       i32 accum;
-       
-       t_pmr_chan *pChan;
-       pChan=mySps->parentChan;
-       TRACEC(5,("SigGen(%i %i %i)\n",mySps->option,mySps->enabled,mySps->state));
-
-       if(!mySps->freq ||!mySps->enabled)return 0;
-
-       outputgain=mySps->outputGain;
-       waveform=0;
-       numChanOut=mySps->numChanOut;
-       selChanOut=mySps->selChanOut;
-
-    if(mySps->option==1)
-       {
-               mySps->option=0;
-               mySps->state=1;
-               mySps->discfactor=
-                       (SAMPLES_PER_SINE*mySps->freq*PH_FRACT_FACT)/mySps->sampleRate/10;
-
-               TRACEF(5,(" SigGen() discfactor = %i\n",mySps->discfactor));
-               if(mySps->discounterl)mySps->state=2;
-       }
-       else if(mySps->option==2)
-       {
-               i16 shiftfactor=CTCSS_TURN_OFF_SHIFT;
-               // phase shift request
-               mySps->option=0;
-               mySps->state=2;
-               mySps->discounterl=CTCSS_TURN_OFF_TIME-(2*MS_PER_FRAME);                //
-
-               mySps->discounteru = \
-                       (mySps->discounteru + (((SAMPLES_PER_SINE*shiftfactor)/360)*PH_FRACT_FACT)) % (SAMPLES_PER_SINE*PH_FRACT_FACT);
-               //printf("shiftfactor = %i\n",shiftfactor);
-               //shiftfactor+=10;
-       }
-       else if(mySps->option==3)
-       {
-               // stop it and clear the output buffer
-               mySps->option=0;
-               mySps->state=0;
-               mySps->enabled=0;
-               for(i=0;i<mySps->nSamples;i++)
-                       mySps->sink[(i*numChanOut)+selChanOut]=0;
-               return(0);
-       }
-       else if(mySps->state==2)
-       {
-               // doing turn off
-               mySps->discounterl-=MS_PER_FRAME;
-               if(mySps->discounterl<=0)
-               {
-                       mySps->option=3;
-                       mySps->state=2;
-               }
-       }
-       else if(mySps->state==0)
-       {
-               return(0);
-       }
-
-       ph=mySps->discounteru;
-
-       for(i=0;i<mySps->nSamples;i++)
-       {
-               if(!waveform)
-               {
-                       // sine
-                       //tmp=(sinetablex[ph/PH_FRACT_FACT]*amplitude)/M_Q16;
-                       accum=sinetablex[ph/PH_FRACT_FACT];
-                       accum=(accum*outputgain)/M_Q8;
-           }
-               else
-               {
-                       // square
-                       if(ph>SAMPLES_PER_SINE/2)
-                               accum=outputgain/M_Q8;
-                       else
-                               accum=-outputgain/M_Q8;
-               }
-
-               if(mySps->source)accum+=mySps->source[i];
-
-               mySps->sink[(i*numChanOut)+selChanOut]=accum;
-
-               ph=(ph+mySps->discfactor)%(SAMPLES_PER_SINE*PH_FRACT_FACT);
-       }
-
-       mySps->discounteru=ph;
-
-       return 0;
-}
-/*
-       adder/mixer
-       takes existing buffer and adds source buffer to destination buffer
-       sink buffer = (sink buffer * gain) + source buffer
-*/
-i16 pmrMixer(t_pmr_sps *mySps)
-{
-       i32 accum;
-       i16 i, *input, *inputB, *output;
-       i16  inputGain, inputGainB;             // apply to input data   in Q7.8 format
-       i16  outputGain;        // apply to output data  in Q7.8 format
-       i16      discounteru,discounterl,amax,amin,setpt,discfactor;
-       i16      npoints,uhit,lhit,apeak,measPeak;
-
-       t_pmr_chan *pChan;
-       pChan=mySps->parentChan;
-       TRACEF(5,("pmrMixer()\n"));
-
-       input     = mySps->source;
-       inputB    = mySps->sourceB;
-       output    = mySps->sink;
-
-       inputGain=mySps->inputGain;
-       inputGainB=mySps->inputGainB;
-       outputGain=mySps->outputGain;
-
-       amax=mySps->amax;
-       amin=mySps->amin;
-       setpt=mySps->setpt;
-       discounteru=mySps->discounteru;
-       discounterl=mySps->discounteru;
-
-       discfactor=mySps->discfactor;
-       npoints=mySps->nSamples;
-       measPeak=mySps->measPeak;
-
-       for(i=0;i<npoints;i++)
-       {
-               accum = ((input[i]*inputGain)/M_Q8) +
-                               ((inputB[i]*inputGainB)/M_Q8);
-
-               accum=(accum*outputGain)/M_Q8;
-               output[i]=accum;
-
-               if(measPeak){
-                       lhit=uhit=0;
-
-                       if(accum>amax){
-                               amax=accum;
-                               uhit=1;
-                               if(amin<(amax-setpt)){
-                                       amin=(amax-setpt);
-                                       lhit=1;
-                               }
-                       }
-                       else if(accum<amin){
-                               amin=accum;
-                               lhit=1;
-                               if(amax>(amin+setpt)){
-                                       amax=(amin+setpt);
-                                       uhit=1;
-                               }
-                       }
-
-                       if(--discounteru<=0 && amax>0){
-                               amax--;
-                               uhit=1;
-                       }
-
-                       if(--discounterl<=0 && amin<0){
-                               amin++;
-                               lhit=1;
-                       }
-
-                       if(uhit)discounteru=discfactor;
-                       if(lhit)discounterl=discfactor;
-               }
-       }
-
-       if(measPeak){
-               apeak = (amax-amin)/2;
-               mySps->apeak=apeak;
-               mySps->amax=amax;
-               mySps->amin=amin;
-               mySps->discounteru=discounteru;
-               mySps->discounterl=discounterl;
-       }
-
-       return 0;
-}
-/*
-       DelayLine
-*/
-i16 DelayLine(t_pmr_sps *mySps)
-{
-       i16 *input, *output, *buff;
-       i16      i, npoints,buffsize,inindex,outindex;
-
-       t_pmr_chan *pChan;
-       pChan=mySps->parentChan;
-       TRACEF(5,(" DelayLine() %i\n",mySps->enabled));
-
-       input           = mySps->source;
-       output          = mySps->sink;
-       buff            = (i16*)(mySps->buff);
-       buffsize        = mySps->buffSize;
-       npoints         = mySps->nSamples;
-
-       outindex        = mySps->buffOutIndex;
-       inindex         = outindex + mySps->buffLead;
-
-       for(i=0;i<npoints;i++)
-       {
-               inindex %= buffsize;
-               outindex %= buffsize;
-
-               buff[inindex]=input[i];
-               output[i]=buff[outindex];
-               inindex++;
-               outindex++;
-       }
-       mySps->buffOutIndex=outindex;
-
-       return 0;
-}
-/*
-       Continuous Tone Coded Squelch (CTCSS) Detector
-*/
-i16 ctcss_detect(t_pmr_chan *pChan)
-{
-       i16 i,points2do,*pInput,hit,thit,relax;
-       i16 tnum, tmp,indexNow,diffpeak;
-       /* i16 difftrig; */
-       i16 tv0,tv1,tv2,tv3,indexDebug;
-       i16 points=0;
-       i16 indexWas=0;
-
-       TRACEF(5,("ctcss_detect(%p) %i %i %i %i\n",pChan,
-               pChan->rxCtcss->enabled,
-               0,
-               pChan->rxCtcss->testIndex,
-               pChan->rxCtcss->decode));
-
-       if(!pChan->rxCtcss->enabled)return(1);
-
-       relax  = pChan->rxCtcss->relax;
-       pInput = pChan->rxCtcss->input;
-
-       /*
-       if(relax) difftrig=(-0.1*M_Q15);
-       else difftrig=(-0.05*M_Q15);
-       */
-
-       thit=hit=-1;
-
-       //TRACEX((" ctcss_detect() %i  %i  %i  %i\n", CTCSS_NUM_CODES,0,0,0));
-
-       for(tnum=0;tnum<CTCSS_NUM_CODES;tnum++)
-       {
-               i32 accum, peak;
-               t_tdet  *ptdet;
-               i16 fudgeFactor;
-               i16 binFactor;
-
-               TRACEF(6,(" ctcss_detect() tnum=%i %i\n",tnum,pChan->rxCtcssMap[tnum]));
-               //if(tnum==14)printf("ctcss_detect() %i %i %i\n",tnum,pChan->rxCtcssMap[tnum], pChan->rxCtcss->decode );
-
-               if( (pChan->rxCtcssMap[tnum]==CTCSS_NULL) ||
-                   (pChan->rxCtcss->decode>CTCSS_NULL && (tnum!= pChan->rxCtcss->decode))
-                 )
-                       continue;
-
-               TRACEF(6,(" ctcss_detect() tnum=%i\n",tnum));
-
-               ptdet=&(pChan->rxCtcss->tdet[tnum]);
-               indexDebug=0;
-               points=points2do=pChan->nSamplesRx;
-               fudgeFactor=ptdet->fudgeFactor;
-               binFactor=ptdet->binFactor;
-
-               while(ptdet->counter < (points2do*CTCSS_SCOUNT_MUL))
-               {
-                       tmp=(ptdet->counter/CTCSS_SCOUNT_MUL)+1;
-                   ptdet->counter-=(tmp*CTCSS_SCOUNT_MUL);
-                       points2do-=tmp;
-                       indexNow=points-points2do;
-
-                       ptdet->counter += ptdet->counterFactor;
-
-                       accum = pInput[indexNow-1];             // duuuude's major bug fix!
-
-                       ptdet->z[ptdet->zIndex]+=
-                               (((accum - ptdet->z[ptdet->zIndex])*binFactor)/M_Q15);
-
-                       peak = abs(ptdet->z[0]-ptdet->z[2]) + abs(ptdet->z[1]-ptdet->z[3]);
-
-                       if (ptdet->peak < peak)
-                               ptdet->peak += ( ((peak-ptdet->peak)*binFactor)/M_Q15);
-                       else
-                               ptdet->peak=peak;
-
-                       {
-                               static const i16 a0=13723;
-                               static const i16 a1=-13723;
-                               i32 temp0,temp1;
-                               i16 x0;
-
-                               //differentiate
-                               x0=ptdet->zd;
-                               temp0 = x0 * a1;
-                               ptdet->zd = ptdet->peak;
-                               temp1 = ptdet->peak * a0;
-                           diffpeak = (temp0 + temp1)/1024;
-                       }
-
-                       if(diffpeak<(-0.03*M_Q15))ptdet->dvd-=4;
-                       else if(ptdet->dvd<0)ptdet->dvd++;
-
-                       if((ptdet->dvd < -12) && diffpeak > (-0.02*M_Q15))ptdet->dvu+=2;
-                       else if(ptdet->dvu)ptdet->dvu--;
-
-                       tmp=ptdet->setpt;
-                       if(pChan->rxCtcss->decode==tnum)
-                       {
-                               if(relax)tmp=(tmp*55)/100;
-                               else tmp=(tmp*80)/100;
-                       }
-
-                       if(ptdet->peak > tmp)
-                       {
-                           if(ptdet->decode<(fudgeFactor*32))ptdet->decode++;
-                       }
-                       else if(pChan->rxCtcss->decode==tnum)
-                       {
-                               if(ptdet->peak > ptdet->hyst)ptdet->decode--;
-                               else if(relax) ptdet->decode--;
-                               else ptdet->decode-=4;
-                       }
-                       else
-                       {
-                               ptdet->decode=0;
-                       }
-
-                       if((pChan->rxCtcss->decode==tnum) && !relax && (ptdet->dvu > (0.00075*M_Q15)))
-                       {
-                               ptdet->decode=0;
-                               ptdet->z[0]=ptdet->z[1]=ptdet->z[2]=ptdet->z[3]=ptdet->dvu=0;
-                               TRACEF(4,("ctcss_detect() turnoff detected by dvdt for tnum = %i.\n",tnum));
-                       }
-
-                       if(ptdet->decode<0 || !pChan->rxCarrierDetect)ptdet->decode=0;
-
-                       if(ptdet->decode>=fudgeFactor)
-                       {
-                               thit=tnum;
-                               if(pChan->rxCtcss->decode!=tnum)
-                               {
-                                       ptdet->zd=ptdet->dvu=ptdet->dvd=0;      
-                               }
-                       }
-
-                       #if XPMR_DEBUG0 == 1
-                       if(thit>=0 && thit==tnum)
-                               TRACEF(6,(" ctcss_detect() %i %i %i %i \n",tnum,ptdet->peak,ptdet->setpt,ptdet->hyst));
-
-                       if(ptdet->pDebug0)
-                       {
-                               tv0=ptdet->peak;
-                               tv1=ptdet->decode;
-                               tv2=tmp;
-                               tv3=ptdet->dvu*32;
-
-                               if(indexDebug==0)
-                               {
-                                       ptdet->lasttv0=ptdet->pDebug0[points-1];
-                                       ptdet->lasttv1=ptdet->pDebug1[points-1];
-                                       ptdet->lasttv2=ptdet->pDebug2[points-1];
-                                       ptdet->lasttv3=ptdet->pDebug3[points-1];
-                               }
-
-                               while(indexDebug<indexNow)
-                               {
-                                       ptdet->pDebug0[indexDebug]=ptdet->lasttv0;
-                                       ptdet->pDebug1[indexDebug]=ptdet->lasttv1;
-                                       ptdet->pDebug2[indexDebug]=ptdet->lasttv2;
-                                       ptdet->pDebug3[indexDebug]=ptdet->lasttv3;
-                                       indexDebug++;
-                               }
-                               ptdet->lasttv0=tv0;
-                               ptdet->lasttv1=tv1;
-                               ptdet->lasttv2=tv2;
-                               ptdet->lasttv3=tv3;
-                       }
-                       #endif
-                       indexWas=indexNow;
-                       ptdet->zIndex=(ptdet->zIndex + 1) % 4;
-               }
-               ptdet->counter-=(points2do*CTCSS_SCOUNT_MUL);
-
-               #if XPMR_DEBUG0 == 1
-               for(i=indexWas;i<points;i++)
-               {
-                       ptdet->pDebug0[i]=ptdet->lasttv0;
-                       ptdet->pDebug1[i]=ptdet->lasttv1;
-                       ptdet->pDebug2[i]=ptdet->lasttv2;
-                       ptdet->pDebug3[i]=ptdet->lasttv3;
-               }
-               #endif
-       }
-
-       //TRACEX((" ctcss_detect() thit %i\n",thit));
-
-       if(pChan->rxCtcss->BlankingTimer>0)pChan->rxCtcss->BlankingTimer-=points;
-       if(pChan->rxCtcss->BlankingTimer<0)pChan->rxCtcss->BlankingTimer=0;
-
-    if(thit>CTCSS_NULL && pChan->rxCtcss->decode<=CTCSS_NULL && !pChan->rxCtcss->BlankingTimer)
-    {
-               pChan->rxCtcss->decode=thit;
-               sprintf(pChan->rxctcssfreq,"%.1f",freq_ctcss[thit]);
-               TRACEC(1,("ctcss decode  %i  %.1f\n",thit,freq_ctcss[thit]));
-       }
-       else if(thit<=CTCSS_NULL && pChan->rxCtcss->decode>CTCSS_NULL)
-       {
-               pChan->rxCtcss->BlankingTimer=SAMPLE_RATE_NETWORK/5;
-               pChan->rxCtcss->decode=CTCSS_NULL;
-               strcpy(pChan->rxctcssfreq,"0");
-               TRACEC(1,("ctcss decode  NULL\n"));
-               for(tnum=0;tnum<CTCSS_NUM_CODES;tnum++)
-               {
-                   t_tdet      *ptdet=NULL;
-                       ptdet=&(pChan->rxCtcss->tdet[tnum]);
-                   ptdet->decode=0;
-                       ptdet->z[0]=ptdet->z[1]=ptdet->z[2]=ptdet->z[3]=0;
-               }
-       }
-       //TRACEX((" ctcss_detect() thit %i %i\n",thit,pChan->rxCtcss->decode));
-       return(0);
-}
-/*
-       TxTestTone
-*/
-static i16     TxTestTone(t_pmr_chan *pChan, i16 function)
-{
-       if(function==1)
-       {
-               pChan->spsSigGen1->enabled=1;
-               pChan->spsSigGen1->option=1;
-               pChan->spsSigGen1->outputGain=(.23125*M_Q8);   // to match *99 level
-               pChan->spsTx->source=pChan->spsSigGen1->sink;
-       }
-       else
-       {
-               pChan->spsSigGen1->option=3;
-       }
-       return 0;
-}
-/*
-       assumes:
-       sampling rate is 48KS/s
-       samples are all 16 bits
-    samples are filtered and decimated by 1/6th
-*/
-t_pmr_chan     *createPmrChannel(t_pmr_chan *tChan, i16 numSamples)
-{
-       i16 i, *inputTmp;
-       t_pmr_chan      *pChan;
-       t_pmr_sps       *pSps;
-       t_dec_ctcss     *pDecCtcss;
-
-       TRACEJ(1,("createPmrChannel(%p,%i)\n",tChan,numSamples));
-
-       pChan = (t_pmr_chan *)calloc(sizeof(t_pmr_chan),1);
-       if(pChan==NULL)
-       {
-               printf("createPmrChannel() failed\n");
-               return(NULL);
-       }
-
-       #if XPMR_PPTP == 1
-       pptp_init();
-       #endif
-
-       pChan->index=pmrChanIndex++;
-       pChan->nSamplesTx=pChan->nSamplesRx=numSamples;
-
-       pDecCtcss = (t_dec_ctcss *)calloc(sizeof(t_dec_ctcss),1);
-       pChan->rxCtcss=pDecCtcss;
-       pChan->rxctcssfreq[0]=0;
-
-       #ifdef HAVE_XPMRX
-       if(tChan->rptnum>=LSD_CHAN_MAX)tChan->rptnum=0;
-       #endif
-
-       if(tChan==NULL)
-       {
-               printf("createPmrChannel() WARNING: NULL tChan!\n");
-               pChan->rxNoiseSquelchEnable=0;
-               pChan->rxHpfEnable=0;
-               pChan->rxDeEmpEnable=0;
-               pChan->rxCenterSlicerEnable=0;
-               pChan->rxCtcssDecodeEnable=0;
-               pChan->rxDcsDecodeEnable=0;
-
-               pChan->rxCarrierPoint = 17000;
-               pChan->rxCarrierHyst = 2500;
-
-               pChan->txHpfEnable=0;
-               pChan->txLimiterEnable=0;
-               pChan->txPreEmpEnable=0;
-               pChan->txLpfEnable=1;
-               pChan->txMixA=TX_OUT_VOICE;
-               pChan->txMixB=TX_OUT_LSD;
-       }
-       else
-       {
-               pChan->rxDemod=tChan->rxDemod;
-               pChan->rxCdType=tChan->rxCdType;
-               pChan->rxSquelchPoint = tChan->rxSquelchPoint;
-               pChan->rxCarrierHyst = 3000;
-               pChan->rxSqVoxAdj=tChan->rxSqVoxAdj;
-
-               pChan->txMod=tChan->txMod;
-               pChan->txHpfEnable=1;
-               pChan->txLpfEnable=1;
-
-               pChan->pTxCodeDefault=tChan->pTxCodeDefault;
-               pChan->pRxCodeSrc=tChan->pRxCodeSrc;
-               pChan->pTxCodeSrc=tChan->pTxCodeSrc;
-
-               pChan->txMixA=tChan->txMixA;
-               pChan->txMixB=tChan->txMixB;
-               pChan->radioDuplex=tChan->radioDuplex;
-               pChan->area=tChan->area;
-               pChan->rptnum=tChan->rptnum;
-               pChan->idleinterval=tChan->idleinterval;
-               pChan->turnoffs=tChan->turnoffs;
-               pChan->b.rxpolarity=tChan->b.rxpolarity;
-               pChan->b.txpolarity=tChan->b.txpolarity;
-               pChan->b.dcsrxpolarity=tChan->b.dcsrxpolarity;
-               pChan->b.dcstxpolarity=tChan->b.dcstxpolarity;
-               pChan->b.lsdrxpolarity=tChan->b.lsdrxpolarity;
-               pChan->b.lsdtxpolarity=tChan->b.lsdtxpolarity;
-
-               pChan->txsettletime=tChan->txsettletime;
-               pChan->tracelevel=tChan->tracelevel;
-               pChan->tracetype=tChan->tracetype;
-               pChan->ukey=tChan->ukey;
-               pChan->name=tChan->name;
-       }
-
-
-       pChan->txHpfEnable=1;
-       pChan->txLpfEnable=1;
-
-       if(pChan->rxCdType==CD_XPMR_NOISE) pChan->rxNoiseSquelchEnable=1;
-
-       if(pChan->rxDemod==RX_AUDIO_FLAT) pChan->rxDeEmpEnable=1;
-
-       pChan->rxCarrierPoint=(pChan->rxSquelchPoint*32767)/100;
-       pChan->rxCarrierHyst = 3000; //pChan->rxCarrierPoint/15;
-
-       pChan->rxDcsDecodeEnable=0;
-
-       if(pChan->b.ctcssRxEnable || pChan->b.dcsRxEnable || pChan->b.lmrRxEnable)
-       {
-               pChan->rxHpfEnable=1;
-               pChan->rxCenterSlicerEnable=1;
-               pChan->rxCtcssDecodeEnable=1;
-       }
-
-       if(pChan->txMod){
-               pChan->txPreEmpEnable=1;
-               pChan->txLimiterEnable=1;
-       }
-
-       pChan->dd.option=9;
-       dedrift(pChan);
-
-       TRACEF(1,("calloc buffers \n"));
-
-       pChan->pRxDemod         = calloc(numSamples,2);
-       pChan->pRxNoise         = calloc(numSamples,2);
-       pChan->pRxBase          = calloc(numSamples,2);
-       pChan->pRxHpf           = calloc(numSamples,2);
-       pChan->pRxLsd           = calloc(numSamples,2);
-       pChan->pRxSpeaker       = calloc(numSamples,2);
-       pChan->pRxCtcss         = calloc(numSamples,2);
-       pChan->pRxDcTrack       = calloc(numSamples,2);
-       pChan->pRxLsdLimit      = calloc(numSamples,2);
-
-       pChan->pTxInput         = calloc(numSamples,2);
-       pChan->pTxBase          = calloc(numSamples,2);
-       pChan->pTxHpf           = calloc(numSamples,2);
-       pChan->pTxPreEmp        = calloc(numSamples,2);
-       pChan->pTxLimiter       = calloc(numSamples,2);
-       pChan->pTxLsd           = calloc(numSamples,2);
-       pChan->pTxLsdLpf    = calloc(numSamples,2);
-       pChan->pTxComposite     = calloc(numSamples,2);
-       pChan->pSigGen0         = calloc(numSamples,2);
-    pChan->pSigGen1            = calloc(numSamples,2);
-               
-       pChan->prxMeasure       = calloc(numSamples,2);
-
-       pChan->pTxOut           = calloc(numSamples,2*2*6);             // output buffer
-    
-#ifdef HAVE_XPMRX
-       pChan->pLsdEnc          = calloc(sizeof(t_encLsd),1);
-#endif
-
-       #if XPMR_DEBUG0 == 1
-       TRACEF(1,("configure tracing\n"));
-
-       pChan->pTstTxOut        = calloc(numSamples,2);
-       pChan->pRxLsdCen    = calloc(numSamples,2);
-       pChan->prxDebug0        = calloc(numSamples,2);
-       pChan->prxDebug1        = calloc(numSamples,2);
-       pChan->prxDebug2        = calloc(numSamples,2);
-       pChan->prxDebug3        = calloc(numSamples,2);
-       pChan->ptxDebug0        = calloc(numSamples,2);
-       pChan->ptxDebug1        = calloc(numSamples,2);
-       pChan->ptxDebug2        = calloc(numSamples,2);
-       pChan->ptxDebug3        = calloc(numSamples,2);
-       pChan->pNull            = calloc(numSamples,2);
-
-       for(i=0;i<numSamples;i++)pChan->pNull[i]=((i%(numSamples/2))*8000)-4000;
-
-       pChan->rxCtcss->pDebug0=calloc(numSamples,2);
-       pChan->rxCtcss->pDebug1=calloc(numSamples,2);
-       pChan->rxCtcss->pDebug2=calloc(numSamples,2);
-       pChan->rxCtcss->pDebug3=calloc(numSamples,2);
-
-       for(i=0;i<CTCSS_NUM_CODES;i++)
-       {
-               pChan->rxCtcss->tdet[i].pDebug0=calloc(numSamples,2);
-               pChan->rxCtcss->tdet[i].pDebug1=calloc(numSamples,2);
-               pChan->rxCtcss->tdet[i].pDebug2=calloc(numSamples,2);
-               pChan->rxCtcss->tdet[i].pDebug3=calloc(numSamples,2);
-       }
-
-       // buffer, 2 bytes per sample, and 16 channels
-       pChan->prxDebug=calloc(numSamples*16,2);
-       pChan->ptxDebug=calloc(numSamples*16,2);
-
-       // TSCOPE CONFIGURATION SETSCOPE configure debug traces and sources for each channel of the output
-       pChan->sdbg                     = (t_sdbg *)calloc(sizeof(t_sdbg),1);
-
-       for(i=0;i<XPMR_DEBUG_CHANS;i++)pChan->sdbg->trace[i]=-1;        
-
-       TRACEF(1,("pChan->tracetype = %i\n",pChan->tracetype));
-
-       if(pChan->tracetype==1)                                                 // CTCSS DECODE
-       {
-               pChan->sdbg->source [0]=pChan->pRxDemod;
-               pChan->sdbg->source [1]=pChan->pRxBase;
-               pChan->sdbg->source [2]=pChan->pRxNoise;
-               pChan->sdbg->trace  [3]=RX_NOISE_TRIG;
-               pChan->sdbg->source [4]=pChan->pRxLsd;
-               pChan->sdbg->source [5]=pChan->pRxLsdCen;
-               pChan->sdbg->source [6]=pChan->pRxLsdLimit;
-               pChan->sdbg->source [7]=pChan->rxCtcss->tdet[3].pDebug0;
-               pChan->sdbg->trace  [8]=RX_CTCSS_DECODE;
-               pChan->sdbg->trace  [9]=RX_SMODE;
-       }
-       if(pChan->tracetype==2)                                                 // CTCSS DECODE
-       {
-               pChan->sdbg->source [0]=pChan->pRxDemod;
-               pChan->sdbg->source [1]=pChan->pRxBase;
-               pChan->sdbg->trace  [2]=RX_NOISE_TRIG;
-               pChan->sdbg->source [3]=pChan->pRxLsd;
-               pChan->sdbg->source [4]=pChan->pRxLsdCen;
-               pChan->sdbg->source [5]=pChan->pRxDcTrack;
-               pChan->sdbg->source [6]=pChan->pRxLsdLimit;
-               pChan->sdbg->source [7]=pChan->rxCtcss->tdet[3].pDebug0;
-               pChan->sdbg->source [8]=pChan->rxCtcss->tdet[3].pDebug1;
-               pChan->sdbg->source [9]=pChan->rxCtcss->tdet[3].pDebug2;
-               pChan->sdbg->source [10]=pChan->rxCtcss->tdet[3].pDebug3;
-               pChan->sdbg->trace  [11]=RX_CTCSS_DECODE;
-               pChan->sdbg->trace  [12]=RX_SMODE;
-               pChan->sdbg->trace  [13]=TX_PTT_IN;
-               pChan->sdbg->trace  [14]=TX_PTT_OUT;
-               pChan->sdbg->source [15]=pChan->pTxLsdLpf;
-       }
-       else if(pChan->tracetype==3)                                    // DCS DECODE
-       {
-               pChan->sdbg->source [0]=pChan->pRxDemod;
-               pChan->sdbg->source [1]=pChan->pRxBase;
-               pChan->sdbg->trace  [2]=RX_NOISE_TRIG;
-               pChan->sdbg->source [3]=pChan->pRxLsd;
-               pChan->sdbg->source [4]=pChan->pRxLsdCen;
-               pChan->sdbg->source [5]=pChan->pRxDcTrack;
-               pChan->sdbg->trace  [6]=RX_DCS_CLK;
-               pChan->sdbg->trace  [7]=RX_DCS_DIN;
-               pChan->sdbg->trace  [8]=RX_DCS_DEC;
-               pChan->sdbg->trace  [9]=RX_SMODE;
-               pChan->sdbg->trace  [10]=TX_PTT_IN;
-               pChan->sdbg->trace  [11]=TX_PTT_OUT;
-               pChan->sdbg->trace  [12]=TX_LSD_CLK;
-               pChan->sdbg->trace  [13]=TX_LSD_DAT;
-               pChan->sdbg->trace  [14]=TX_LSD_GEN;
-               pChan->sdbg->source [14]=pChan->pTxLsd;
-               pChan->sdbg->source [15]=pChan->pTxLsdLpf;
-       }
-       else if(pChan->tracetype==4)                                    // LSD DECODE
-       {
-               pChan->sdbg->source [0]=pChan->pRxDemod;
-               pChan->sdbg->source [1]=pChan->pRxBase;
-               pChan->sdbg->trace  [2]=RX_NOISE_TRIG;
-               pChan->sdbg->source [3]=pChan->pRxLsd;
-               pChan->sdbg->source [4]=pChan->pRxLsdCen;
-               pChan->sdbg->source [5]=pChan->pRxDcTrack;
-               pChan->sdbg->trace  [6]=RX_LSD_CLK;
-               pChan->sdbg->trace  [7]=RX_LSD_DAT;
-               pChan->sdbg->trace  [8]=RX_LSD_ERR;
-               pChan->sdbg->trace  [9]=RX_LSD_SYNC;
-               pChan->sdbg->trace  [10]=RX_SMODE;
-               pChan->sdbg->trace  [11]=TX_PTT_IN;
-               pChan->sdbg->trace  [12]=TX_PTT_OUT;
-               pChan->sdbg->trace  [13]=TX_LSD_CLK;
-               pChan->sdbg->trace  [14]=TX_LSD_DAT;
-               //pChan->sdbg->trace  [14]=TX_LSD_GEN;
-               //pChan->sdbg->source [14]=pChan->pTxLsd;
-               pChan->sdbg->source [15]=pChan->pTxLsdLpf;
-       }
-       else if(pChan->tracetype==5)                                            // LSD LOGIC
-       {
-               pChan->sdbg->source [0]=pChan->pRxBase;
-               pChan->sdbg->trace  [1]=RX_NOISE_TRIG;
-               pChan->sdbg->source [2]=pChan->pRxDcTrack;
-               pChan->sdbg->trace  [3]=RX_LSD_SYNC;
-               pChan->sdbg->trace  [4]=RX_SMODE;
-               pChan->sdbg->trace  [5]=TX_PTT_IN;
-               pChan->sdbg->trace  [6]=TX_PTT_OUT;
-               pChan->sdbg->source [7]=pChan->pTxLsdLpf;
-       }
-       else if(pChan->tracetype==6)
-       {
-               // tx clock skew and jitter buffer
-               pChan->sdbg->source [0]=pChan->pRxDemod;
-               pChan->sdbg->source  [5]=pChan->pTxBase;
-               pChan->sdbg->trace   [6]=TX_DEDRIFT_LEAD;
-               pChan->sdbg->trace   [7]=TX_DEDRIFT_ERR;
-               pChan->sdbg->trace   [8]=TX_DEDRIFT_FACTOR;
-               pChan->sdbg->trace   [9]=TX_DEDRIFT_DRIFT;
-       }
-       else if(pChan->tracetype==7)
-       {
-               // tx path
-               pChan->sdbg->source [0]=pChan->pRxBase;
-               pChan->sdbg->trace  [1]=RX_NOISE_TRIG;
-               pChan->sdbg->source [2]=pChan->pRxLsd;
-               pChan->sdbg->trace  [3]=RX_CTCSS_DECODE;
-               pChan->sdbg->source [4]=pChan->pRxHpf;
-
-               pChan->sdbg->trace  [5]=TX_PTT_IN;
-               pChan->sdbg->trace  [6]=TX_PTT_OUT;
-
-               pChan->sdbg->source [7]=pChan->pTxBase;
-               pChan->sdbg->source [8]=pChan->pTxHpf;
-               pChan->sdbg->source [9]=pChan->pTxPreEmp;
-               pChan->sdbg->source [10]=pChan->pTxLimiter;
-               pChan->sdbg->source [11]=pChan->pTxComposite;
-               pChan->sdbg->source [12]=pChan->pTxLsdLpf;
-       }
-
-       for(i=0;i<XPMR_DEBUG_CHANS;i++){
-               if(pChan->sdbg->trace[i]>=0)pChan->sdbg->point[pChan->sdbg->trace[i]]=i;        
-       }
-       pChan->sdbg->mode=1;
-       #endif
-
-       #ifdef XPMRX_H
-       // LSD GENERATOR
-       pSps=pChan->spsLsdGen=createPmrSps(pChan);
-       pSps->source=NULL;
-       pSps->sink=pChan->pTxLsd;
-       pSps->numChanOut=1;
-       pSps->selChanOut=0;
-       pSps->sigProc=LsdGen;
-       pSps->nSamples=pChan->nSamplesTx;
-       pSps->outputGain=(.25*M_Q8);
-       pSps->option=0;
-       pSps->interpolate=1;
-       pSps->decimate=1;
-       pSps->enabled=0;
-       #endif
-
-       // General Purpose Function Generator
-       pSps=pChan->spsSigGen1=createPmrSps(pChan);
-       pSps->sink=pChan->pSigGen1;
-       pSps->numChanOut=1;
-       pSps->selChanOut=0;
-       pSps->sigProc=SigGen;
-       pSps->nSamples=pChan->nSamplesTx;
-       pSps->sampleRate=SAMPLE_RATE_NETWORK;
-       pSps->freq=10000;                                               // in increments of 0.1 Hz
-       pSps->outputGain=(.25*M_Q8);
-       pSps->option=0;
-       pSps->interpolate=1;
-       pSps->decimate=1;
-       pSps->enabled=0;
-
-
-       // CTCSS ENCODER
-       pSps = pChan->spsSigGen0 = createPmrSps(pChan);
-       pSps->sink=pChan->pTxLsd;
-       pSps->sigProc=SigGen;
-       pSps->numChanOut=1;
-       pSps->selChanOut=0;
-       pSps->nSamples=pChan->nSamplesTx;
-       pSps->sampleRate=SAMPLE_RATE_NETWORK;
-       pSps->freq=1000;                                                // in 0.1 Hz steps
-       pSps->outputGain=(0.5*M_Q8);
-       pSps->option=0;
-       pSps->interpolate=1;
-       pSps->decimate=1;
-       pSps->enabled=0;
-
-       // Tx LSD Low Pass Filter
-       pSps=pChan->spsTxLsdLpf=createPmrSps(pChan);
-       pSps->source=pChan->pTxLsd;
-       pSps->sink=pChan->pTxLsdLpf;
-       pSps->sigProc=pmr_gp_fir;
-       pSps->enabled=0;
-       pSps->numChanOut=1;
-       pSps->selChanOut=0;
-       pSps->nSamples=pChan->nSamplesTx;
-       pSps->decimator=pSps->decimate=1;
-       pSps->interpolate=1;
-       pSps->inputGain=(1*M_Q8);
-       pSps->outputGain=(1*M_Q8);
-        
-       // configure the longer, lower cutoff filter by default
-       pSps->ncoef=taps_fir_lpf_215_9_88;
-       pSps->size_coef=2;
-       pSps->coef=(void*)coef_fir_lpf_215_9_88;
-       pSps->nx=taps_fir_lpf_215_9_88;
-       pSps->size_x=2;
-       pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-       pSps->calcAdjust=gain_fir_lpf_215_9_88;
-
-       pSps->inputGain=(1*M_Q8);
-       pSps->outputGain=(1*M_Q8);
-
-       TRACEF(1,("spsTxLsdLpf = sps \n"));
-
-       if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-
-
-       // RX Process
-       TRACEF(1,("create rx\n"));
-       pSps = NULL;
-
-       // allocate space for first sps and set pointers
-       pSps=pChan->spsRx=createPmrSps(pChan);
-       pSps->source=NULL;                                      //set when called
-       pSps->sink=pChan->pRxBase;
-       pSps->sigProc=pmr_rx_frontend;
-       pSps->enabled=1;
-       pSps->decimator=pSps->decimate=6;
-       pSps->interpolate=1;
-       pSps->nSamples=pChan->nSamplesRx;
-       pSps->ncoef=taps_fir_bpf_noise_1;
-       pSps->size_coef=2;
-       pSps->coef=(void*)coef_fir_lpf_3K_1;
-       pSps->coef2=(void*)coef_fir_bpf_noise_1;
-       pSps->nx=taps_fir_bpf_noise_1;
-       pSps->size_x=2;
-       pSps->x=(void*)(calloc(pSps->nx,pSps->size_coef));
-       pSps->calcAdjust=(gain_fir_lpf_3K_1*256)/0x0100;
-       pSps->outputGain=(1.0*M_Q8);
-       pSps->discfactor=2;
-       pSps->hyst=pChan->rxCarrierHyst;
-       pSps->setpt=pChan->rxCarrierPoint;
-       pChan->prxSquelchAdjust=&pSps->setpt;
-       #if XPMR_DEBUG0 == 1
-       pSps->debugBuff0=pChan->pRxDemod;
-       pSps->debugBuff1=pChan->pRxNoise;
-       pSps->debugBuff2=pChan->prxDebug0;
-       #endif
-
-
-       // allocate space for next sps and set pointers
-       // Rx SubAudible Decoder Low Pass Filter
-       pSps=pChan->spsRxLsd=pSps->nextSps=createPmrSps(pChan);
-       pSps->source=pChan->pRxBase;
-       pSps->sink=pChan->pRxLsd;
-       pSps->sigProc=pmr_gp_fir;
-       pSps->enabled=1;
-       pSps->numChanOut=1;
-       pSps->selChanOut=0;
-       pSps->nSamples=pChan->nSamplesRx;
-       pSps->decimator=pSps->decimate=1;
-       pSps->interpolate=1;
-
-       // configure the the larger, lower cutoff filter by default
-       pSps->ncoef=taps_fir_lpf_215_9_88;
-       pSps->size_coef=2;
-       pSps->coef=(void*)coef_fir_lpf_215_9_88;
-       pSps->nx=taps_fir_lpf_215_9_88;
-       pSps->size_x=2;
-       pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-       pSps->calcAdjust=gain_fir_lpf_215_9_88;
-
-       pSps->inputGain=(1*M_Q8);
-       pSps->outputGain=(1*M_Q8);
-       pChan->prxCtcssMeasure=pSps->sink;
-       pChan->prxCtcssAdjust=&(pSps->outputGain);
-
-       // CTCSS CenterSlicer
-       pSps=pChan->spsRxLsdNrz=pSps->nextSps=createPmrSps(pChan);
-       pSps->source=pChan->pRxLsd;
-       pSps->sink=pChan->pRxDcTrack;
-       pSps->buff=pChan->pRxLsdLimit;
-       pSps->sigProc=CenterSlicer;
-       pSps->nSamples=pChan->nSamplesRx;
-       pSps->discfactor=LSD_DFS;                               // centering time constant
-       pSps->inputGain=(1*M_Q8);
-       pSps->outputGain=(1*M_Q8);
-       pSps->setpt=4900;                               // ptp clamp for DC centering
-       pSps->inputGainB=625;                   // peak output limiter clip point
-       pSps->enabled=0;
-
-
-       // Rx HPF
-       pSps=pSps->nextSps=createPmrSps(pChan);
-       pChan->spsRxHpf=pSps;
-       pSps->source=pChan->pRxBase;
-       pSps->sink=pChan->pRxHpf;
-       pSps->sigProc=pmr_gp_fir;
-       pSps->enabled=1;
-       pSps->numChanOut=1;
-       pSps->selChanOut=0;
-       pSps->nSamples=pChan->nSamplesRx;
-       pSps->decimator=pSps->decimate=1;
-       pSps->interpolate=1;
-       pSps->ncoef=taps_fir_hpf_300_9_66;
-       pSps->size_coef=2;
-       pSps->coef=(void*)coef_fir_hpf_300_9_66;
-       pSps->nx=taps_fir_hpf_300_9_66;
-       pSps->size_x=2;
-       pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-       if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-       pSps->calcAdjust=gain_fir_hpf_300_9_66;
-       pSps->inputGain=(1*M_Q8);
-       pSps->outputGain=(1*M_Q8);
-       pChan->prxVoiceAdjust=&(pSps->outputGain);
-       pChan->spsRxOut=pSps;
-
-       // allocate space for next sps and set pointers
-       // Rx DeEmp
-       if(pChan->rxDeEmpEnable){
-               pSps=pSps->nextSps=createPmrSps(pChan);
-               pChan->spsRxDeEmp=pSps;
-               pSps->source=pChan->pRxHpf;
-               pSps->sink=pChan->pRxSpeaker;
-               pChan->spsRxOut=pSps;                                    // OUTPUT STRUCTURE!
-               pSps->sigProc=gp_inte_00;
-               pSps->enabled=1;
-               pSps->nSamples=pChan->nSamplesRx;
-
-               pSps->ncoef=taps_int_lpf_300_1_2;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_int_lpf_300_1_2;
-
-               pSps->nx=taps_int_lpf_300_1_2;
-               pSps->size_x=4;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-               pSps->calcAdjust=gain_int_lpf_300_1_2/2;
-               pSps->inputGain=(1.0*M_Q8);
-               pSps->outputGain=(1.0*M_Q8);
-               pChan->prxVoiceMeasure=pSps->sink;
-               pChan->prxVoiceAdjust=&(pSps->outputGain);
-       }
-
-       if(pChan->rxDelayLineEnable)
-       {
-               TRACEF(1,("create delayline\n"));
-               pSps=pChan->spsDelayLine=pSps->nextSps=createPmrSps(pChan);
-               pSps->sigProc=DelayLine;
-               pSps->source=pChan->pRxSpeaker;
-               pSps->sink=pChan->pRxSpeaker;
-               pSps->enabled=0;
-               pSps->inputGain=1*M_Q8;
-               pSps->outputGain=1*M_Q8;
-               pSps->nSamples=pChan->nSamplesRx;
-               pSps->buffSize=4096;
-               pSps->buff=calloc(4096,2);                      // one second maximum
-               pSps->buffLead = (SAMPLE_RATE_NETWORK*0.100);
-               pSps->buffOutIndex=0;
-       }
-
-       if(pChan->rxCdType==CD_XPMR_VOX)
-       {
-               TRACEF(1,("create vox measureblock\n"));
-               pChan->prxVoxMeas=calloc(pChan->nSamplesRx,2);
-
-               pSps=pChan->spsRxVox=pSps->nextSps=createPmrSps(pChan);
-               pSps->sigProc=MeasureBlock;
-               pSps->parentChan=pChan;
-               pSps->source=pChan->pRxBase;
-               pSps->sink=pChan->prxVoxMeas;
-               pSps->inputGain=1*M_Q8;
-               pSps->outputGain=1*M_Q8;
-               pSps->nSamples=pChan->nSamplesRx;
-               pSps->discfactor=3;
-               if(pChan->rxSqVoxAdj==0)
-                       pSps->setpt=(0.011*M_Q15);
-               else
-                       pSps->setpt=(pChan->rxSqVoxAdj);
-               pSps->hyst=(pSps->setpt/10);
-               pSps->enabled=1;
-       }
-
-       // tuning measure block
-       pSps=pChan->spsMeasure=pSps->nextSps=createPmrSps(pChan);
-       pSps->source=pChan->spsRx->sink;
-       pSps->sink=pChan->prxMeasure;
-       pSps->sigProc=MeasureBlock;
-       pSps->enabled=0;
-       pSps->nSamples=pChan->nSamplesRx;
-       pSps->discfactor=10;
-
-       pSps->nextSps=NULL;             // last sps in chain RX
-
-
-       // CREATE TRANSMIT CHAIN
-       TRACEF(1,("create tx\n"));
-       inputTmp=NULL;
-       pSps = NULL;
-
-       // allocate space for first sps and set pointers
-
-       // Tx HPF SubAudible
-       if(pChan->txHpfEnable)
-       {
-               pSps=createPmrSps(pChan);
-               pChan->spsTx=pSps;
-               pSps->source=pChan->pTxBase;
-               pSps->sink=pChan->pTxHpf;
-               pSps->sigProc=pmr_gp_fir;
-               pSps->enabled=1;
-               pSps->numChanOut=1;
-               pSps->selChanOut=0;
-               pSps->nSamples=pChan->nSamplesTx;
-               pSps->decimator=pSps->decimate=1;
-               pSps->interpolate=1;
-               pSps->ncoef=taps_fir_hpf_300_9_66;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_fir_hpf_300_9_66;
-               pSps->nx=taps_fir_hpf_300_9_66;
-               pSps->size_x=2;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-               pSps->calcAdjust=gain_fir_hpf_300_9_66;
-               pSps->inputGain=(1*M_Q8);
-               pSps->outputGain=(1*M_Q8);
-               inputTmp=pChan->pTxHpf;
-       }
-
-       // Tx PreEmphasis
-       if(pChan->txPreEmpEnable)
-       {
-               if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
-               else pSps=pSps->nextSps=createPmrSps(pChan);
-
-               pSps->source=inputTmp;
-               pSps->sink=pChan->pTxPreEmp;
-
-               pSps->sigProc=gp_diff;
-               pSps->enabled=1;
-               pSps->nSamples=pChan->nSamplesTx;
-
-               pSps->ncoef=taps_int_hpf_4000_1_2;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_int_hpf_4000_1_2;
-
-               pSps->nx=taps_int_hpf_4000_1_2;
-               pSps->size_x=2;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-                
-               pSps->calcAdjust=gain_int_hpf_4000_1_2;
-               pSps->inputGain=(1*M_Q8);
-               pSps->outputGain=(1*M_Q8);       // to match flat at 1KHz
-               inputTmp=pSps->sink;
-       }
-
-       // Tx Limiter
-       if(pChan->txLimiterEnable)
-       {
-               if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
-               else pSps=pSps->nextSps=createPmrSps(pChan);
-               pSps->source=inputTmp;
-               pSps->sink=pChan->pTxLimiter;
-               pSps->sigProc=SoftLimiter;
-               pSps->enabled=1;
-               pSps->nSamples=pChan->nSamplesTx;
-               pSps->inputGain=(1*M_Q8);
-               pSps->outputGain=(1*M_Q8);
-               pSps->setpt=12000;
-               inputTmp=pSps->sink;
-       }
-
-       // Composite Mix of Voice and LSD
-       if((pChan->txMixA==TX_OUT_COMPOSITE)||(pChan->txMixB==TX_OUT_COMPOSITE))
-       {
-               if(pSps==NULL)
-                       pSps=pChan->spsTx=createPmrSps(pChan);
-               else
-                       pSps=pSps->nextSps=createPmrSps(pChan);
-               pSps->source=inputTmp;
-               pSps->sourceB=pChan->pTxLsdLpf;          //asdf ??? !!! maw pTxLsdLpf
-               pSps->sink=pChan->pTxComposite;
-               pSps->sigProc=pmrMixer;
-               pSps->enabled=1;
-               pSps->nSamples=pChan->nSamplesTx;
-               pSps->inputGain=2*M_Q8;
-               pSps->inputGainB=1*M_Q8/8;
-               pSps->outputGain=1*M_Q8;
-               pSps->setpt=0;
-               inputTmp=pSps->sink;
-               pChan->ptxCtcssAdjust=&pSps->inputGainB;
-       }
-
-       // Chan A Upsampler and Filter
-       if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
-       else pSps=pSps->nextSps=createPmrSps(pChan);
-
-       pChan->spsTxOutA=pSps;
-       if(!pChan->spsTx)pChan->spsTx=pSps;
-
-       if(pChan->txMixA==TX_OUT_COMPOSITE)
-       {
-               pSps->source=pChan->pTxComposite;
-       }
-       else if(pChan->txMixA==TX_OUT_LSD)
-       {
-               pSps->source=pChan->pTxLsdLpf;
-       }
-       else if(pChan->txMixA==TX_OUT_VOICE)
-       {
-               pSps->source=pChan->pTxHpf;
-       }
-       else if (pChan->txMixA==TX_OUT_AUX)
-       {
-               pSps->source=inputTmp;
-       }
-       else
-       {
-               pSps->source=NULL;              // maw sph asdf !!!     no blow up
-               pSps->source=inputTmp;
-       }
-
-       pSps->sink=pChan->pTxOut;
-       pSps->sigProc=pmr_gp_fir;
-       pSps->enabled=1;
-       pSps->numChanOut=2;
-       pSps->selChanOut=0;
-       pSps->nSamples=pChan->nSamplesTx;
-       pSps->interpolate=6;
-       pSps->ncoef=taps_fir_lpf_3K_1;
-       pSps->size_coef=2;
-       pSps->coef=(void*)coef_fir_lpf_3K_1;
-       pSps->nx=taps_fir_lpf_3K_1;
-       pSps->size_x=2;
-       pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-       if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-       pSps->calcAdjust=gain_fir_lpf_3K_1;
-       pSps->inputGain=(1*M_Q8);
-       pSps->outputGain=(1*M_Q8);
-       if(pChan->txMixA==pChan->txMixB)pSps->monoOut=1;
-       else pSps->monoOut=0;
-
-
-       // Chan B Upsampler and Filter
-       if((pChan->txMixA!=pChan->txMixB)&&(pChan->txMixB!=TX_OUT_OFF))
-       {
-               if(pSps==NULL) pSps=pChan->spsTx=createPmrSps(pChan);
-               else pSps=pSps->nextSps=createPmrSps(pChan);
-
-               pChan->spsTxOutB=pSps;
-               if(pChan->txMixB==TX_OUT_COMPOSITE)
-               {
-                       pSps->source=pChan->pTxComposite;
-               }
-               else if(pChan->txMixB==TX_OUT_LSD)
-               {
-                       pSps->source=pChan->pTxLsdLpf;
-                       // pChan->ptxCtcssAdjust=&pSps->inputGain;
-               }
-               else if(pChan->txMixB==TX_OUT_VOICE)
-               {
-                       pSps->source=inputTmp;
-               }
-               else if(pChan->txMixB==TX_OUT_AUX)
-               {
-                       pSps->source=pChan->pTxHpf;
-               }
-               else
-               {
-                       pSps->source=NULL;
-               }
-
-               pSps->sink=pChan->pTxOut;
-               pSps->sigProc=pmr_gp_fir;
-               pSps->enabled=1;
-               pSps->numChanOut=2;
-               pSps->selChanOut=1;
-               pSps->mixOut=0;
-               pSps->nSamples=pChan->nSamplesTx;
-               pSps->interpolate=6;
-               pSps->ncoef=taps_fir_lpf_3K_1;
-               pSps->size_coef=2;
-               pSps->coef=(void*)coef_fir_lpf_3K_1;
-               pSps->nx=taps_fir_lpf_3K_1;
-               pSps->size_x=2;
-               pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-               if(pSps==NULL)printf("Error: calloc(), createPmrChannel()\n");
-               pSps->calcAdjust=(gain_fir_lpf_3K_1);
-               pSps->inputGain=(1*M_Q8);
-               pSps->outputGain=(1*M_Q8);
-       }
-
-       pSps->nextSps=NULL;
-
-       // Configure Coded Signaling
-       code_string_parse(pChan);
-
-       pChan->smode=SMODE_NULL;
-       pChan->smodewas=SMODE_NULL;
-       pChan->smodetime=2500;
-       pChan->smodetimer=0;
-       pChan->b.smodeturnoff=0;
-
-       pChan->txsettletimer=0;
-
-       TRACEF(1,("createPmrChannel() end\n"));
-
-       return pChan;
-}
-/*
-*/
-i16 destroyPmrChannel(t_pmr_chan *pChan)
-{
-       #if XPMR_DEBUG0 == 1
-       i16 i;
-       #endif
-       t_pmr_sps       *pmr_sps, *tmp_sps;
-
-       TRACEF(1,("destroyPmrChannel()\n"));
-       
-       free(pChan->pRxDemod);
-       free(pChan->pRxNoise);
-       free(pChan->pRxBase);
-       free(pChan->pRxHpf);
-       free(pChan->pRxLsd);
-       free(pChan->pRxSpeaker);
-       free(pChan->pRxDcTrack);
-       if(pChan->pRxLsdLimit)free(pChan->pRxLsdLimit);
-       free(pChan->pTxBase);
-       free(pChan->pTxHpf);
-       free(pChan->pTxPreEmp);
-       free(pChan->pTxLimiter);
-       free(pChan->pTxLsd);
-       free(pChan->pTxLsdLpf);
-       if(pChan->pTxComposite)free(pChan->pTxComposite);
-       free(pChan->pTxOut);
-
-       if(pChan->prxMeasure)free(pChan->prxMeasure);
-       if(pChan->pSigGen0)free(pChan->pSigGen0);
-       if(pChan->pSigGen1)free(pChan->pSigGen1);
-        
-
-       #if XPMR_DEBUG0 == 1
-       //if(pChan->prxDebug)free(pChan->prxDebug);
-       if(pChan->ptxDebug)free(pChan->ptxDebug);
-       free(pChan->prxDebug0);
-       free(pChan->prxDebug1);
-       free(pChan->prxDebug2);
-       free(pChan->prxDebug3);
-
-       free(pChan->ptxDebug0);
-       free(pChan->ptxDebug1);
-       free(pChan->ptxDebug2);
-       free(pChan->ptxDebug3);
-
-       free(pChan->rxCtcss->pDebug0);
-       free(pChan->rxCtcss->pDebug1);
-
-       for(i=0;i<CTCSS_NUM_CODES;i++)
-       {
-               free(pChan->rxCtcss->tdet[i].pDebug0);
-               free(pChan->rxCtcss->tdet[i].pDebug1);
-               free(pChan->rxCtcss->tdet[i].pDebug2);
-               free(pChan->rxCtcss->tdet[i].pDebug3);
-       }
-       #endif
-
-       pChan->dd.option=8;
-       dedrift(pChan);
-
-       free(pChan->pRxCtcss);
-
-       pmr_sps=pChan->spsRx;
-
-       if(pChan->sdbg)free(pChan->sdbg);
-
-       while(pmr_sps)
-       {
-               tmp_sps = pmr_sps;
-               pmr_sps = tmp_sps->nextSps;
-               destroyPmrSps(tmp_sps);
-       }
-
-       free(pChan);
-
-       return 0;
-}
-/*
-*/
-t_pmr_sps *createPmrSps(t_pmr_chan *pChan)
-{
-       t_pmr_sps  *pSps;
-
-       TRACEF(1,("createPmrSps()\n"));
-
-       pSps = (t_pmr_sps *)calloc(sizeof(t_pmr_sps),1);
-
-       if(!pSps)printf("Error: createPmrSps()\n");
-
-       pSps->parentChan=pChan;
-       pSps->index=pChan->spsIndex++;
-
-       // pSps->x=calloc(pSps->nx,pSps->size_x);
-
-       return pSps;
-}
-/*
-*/
-i16 destroyPmrSps(t_pmr_sps  *pSps)
-{
-       TRACEJ(1,("destroyPmrSps(%i)\n",pSps->index));
-
-       if(pSps->x!=NULL)free(pSps->x);
-       free(pSps);
-       return 0;
-}
-/*
-       PmrTx - takes data from network and holds it for PmrRx
-*/
-i16 PmrTx(t_pmr_chan *pChan, i16 *input)
-{
-       pChan->frameCountTx++;
-
-       TRACEF(5,("PmrTx() start %i\n",pChan->frameCountTx));
-
-       #if XPMR_PPTP == 99
-       pptp_p2^=1;
-       if(pptp_p2)ioctl(ppdrvdev,PPDRV_IOC_PINSET,LP_PIN02);
-       else ioctl(ppdrvdev,PPDRV_IOC_PINCLEAR,LP_PIN02);
-       #endif
-
-       if(pChan==NULL){
-               printf("PmrTx() pChan == NULL\n");
-               return 1;
-       }
-
-       #if XPMR_DEBUG0 == 1
-       if(pChan->b.rxCapture && pChan->tracetype==5)
-       {
-               memcpy(pChan->pTxInput,input,pChan->nSamplesRx*2);
-       }
-       #endif
-
-       //if(pChan->b.radioactive)pChan->dd.debug=1;
-       //else pChan->dd.debug=0;
-
-       dedrift_write(pChan,input);
-
-       return 0;
-}
-/*
-       PmrRx handles a block of data from the usb audio device
-*/
-i16 PmrRx(t_pmr_chan *pChan, i16 *input, i16 *outputrx, i16 *outputtx)
-{
-       int i,hit;
-       float f=0;
-       t_pmr_sps *pmr_sps;
-
-       TRACEC(5,("PmrRx(%p %p %p %p)\n",pChan, input, outputrx, outputtx));
-
-    #if XPMR_PPTP == 1
-       if(pChan->b.radioactive)
-       {
-               pptp_write(1,pChan->frameCountRx&0x00000001);
-       }
-       #endif
-
-       if(pChan==NULL){
-               printf("PmrRx() pChan == NULL\n");
-               return 1;
-       }
-
-       pChan->frameCountRx++;
-
-       #if XPMR_DEBUG0 == 1
-       if(pChan->b.rxCapture)
-       {
-               //if(pChan->prxDebug)memset((void *)pChan->prxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2);
-               if(pChan->ptxDebug)memset((void *)pChan->ptxDebug,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2);
-               if(pChan->sdbg->buffer)
-               {
-                       memset((void *)pChan->sdbg->buffer,0,pChan->nSamplesRx*XPMR_DEBUG_CHANS*2);
-                       pChan->prxDebug=pChan->sdbg->buffer;
-               }
-       }
-       #endif
-
-       pmr_sps=pChan->spsRx;           // first sps
-       pmr_sps->source=input;
-
-       if(outputrx!=NULL)pChan->spsRxOut->sink=outputrx;        //last sps
-
-       #if 0
-       if(pChan->inputBlanking>0)
-       {
-               pChan->inputBlanking-=pChan->nSamplesRx;
-               if(pChan->inputBlanking<0)pChan->inputBlanking=0;
-               for(i=0;i<pChan->nSamplesRx*6;i++)
-                       input[i]=0;
-       }
-       #endif
-
-       if( pChan->rxCpuSaver && !pChan->rxCarrierDetect && 
-           pChan->smode==SMODE_NULL &&
-          !pChan->txPttIn && !pChan->txPttOut)
-       {
-               if(!pChan->b.rxhalted)
-               {
-                       if(pChan->spsRxHpf)pChan->spsRxHpf->enabled=0;
-                       if(pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=0;
-                       pChan->b.rxhalted=1;
-                       TRACEC(1,("PmrRx() rx sps halted\n"));
-               }
-       }
-       else if(pChan->b.rxhalted)
-       {
-               if(pChan->spsRxHpf)pChan->spsRxHpf->enabled=1;
-               if(pChan->spsRxDeEmp)pChan->spsRxDeEmp->enabled=1;
-               pChan->b.rxhalted=0;
-               TRACEC(1,("PmrRx() rx sps un-halted\n"));
-       }
-
-       i=0;
-       while(pmr_sps!=NULL && pmr_sps!=0)
-       {
-               TRACEC(5,("PmrRx() sps %i\n",i++));
-               pmr_sps->sigProc(pmr_sps);
-               pmr_sps = (t_pmr_sps *)(pmr_sps->nextSps);
-               //pmr_sps=NULL; // sph maw
-       }
-
-       #define XPMR_VOX_HANGTIME       2000
-
-       if(pChan->rxCdType==CD_XPMR_VOX)
-       {
-               if(pChan->spsRxVox->compOut)
-               {
-                       pChan->rxVoxTimer=XPMR_VOX_HANGTIME;    //VOX HangTime in ms
-               }
-               if(pChan->rxVoxTimer>0)
-               {
-                       pChan->rxVoxTimer-=MS_PER_FRAME;
-                       pChan->rxCarrierDetect=1;
-               }
-               else
-               {
-                       pChan->rxVoxTimer=0;
-                       pChan->rxCarrierDetect=0;
-               }
-       }
-       else
-       {
-               pChan->rxCarrierDetect=!pChan->spsRx->compOut;
-       }
-
-       // stop and start these engines instead to eliminate falsing
-       if( pChan->b.ctcssRxEnable && 
-           ( (!pChan->b.rxhalted || 
-                  pChan->rxCtcss->decode!=CTCSS_NULL || pChan->smode==SMODE_CTCSS) &&
-               (pChan->smode!=SMODE_DCS&&pChan->smode!=SMODE_LSD) ) 
-         )
-       {
-               ctcss_detect(pChan);
-       }
-
-       #if 1
-       if(pChan->txPttIn!=pChan->b.pttwas)
-       {
-               pChan->b.pttwas=pChan->txPttIn;
-               TRACEC(1,("PmrRx() txPttIn=%i\n",pChan->b.pttwas));
-       }
-       #endif
-
-       #ifdef XPMRX_H
-       xpmrx(pChan,XXO_RXDECODE);
-       #endif
-
-       if(pChan->smodetimer>0 && !pChan->txPttIn)
-       {
-               pChan->smodetimer-=MS_PER_FRAME;
-               
-               if(pChan->smodetimer<=0)
-               {
-                       pChan->smodetimer=0;
-                       pChan->smodewas=pChan->smode;
-                       pChan->smode=SMODE_NULL;
-                       pChan->b.smodeturnoff=1;
-                       TRACEC(1,("smode timeout. smode was=%i\n",pChan->smodewas));
-               }
-       }
-
-       if(pChan->rxCtcss->decode > CTCSS_NULL && 
-          (pChan->smode==SMODE_NULL||pChan->smode==SMODE_CTCSS) )
-       {
-               if(pChan->smode!=SMODE_CTCSS)
-               {
-                       TRACEC(1,("smode set=%i  code=%i\n",pChan->smode,pChan->rxCtcss->decode));
-                       pChan->smode=pChan->smodewas=SMODE_CTCSS;
-               }
-               pChan->smodetimer=pChan->smodetime;
-       }
-
-       #ifdef HAVE_XPMRX
-       xpmrx(pChan,XXO_LSDCTL);
-       #endif
-
-       //TRACEX(("PmrRx() tx portion.\n"));
-
-       // handle radio transmitter ptt input
-       hit=0;
-       if( !(pChan->smode==SMODE_DCS||pChan->smode==SMODE_LSD) )
-       {
-        
-       if( pChan->txPttIn && pChan->txState==CHAN_TXSTATE_IDLE )
-       {
-               TRACEC(1,("txPttIn==1 from CHAN_TXSTATE_IDLE && !SMODE_LSD. codeindex=%i  %i \n",pChan->rxCtcss->decode, pChan->rxCtcssMap[pChan->rxCtcss->decode] ));
-               pChan->dd.b.doitnow=1;
-
-           if(pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit)
-               {
-                       if(pChan->rxCtcss->decode>CTCSS_NULL)
-                       {
-                               if(pChan->rxCtcssMap[pChan->rxCtcss->decode]!=CTCSS_RXONLY)
-                               {
-                                       f=freq_ctcss[pChan->rxCtcssMap[pChan->rxCtcss->decode]];
-                               }
-                       }
-                       else
-                       {
-                               f=pChan->txctcssdefault_value;  
-                       }
-                       TRACEC(1,("txPttIn - Start CTCSSGen  %f \n",f));
-                       if(f)
-                       {
-                               t_pmr_sps *pSps;
-       
-                               pChan->spsSigGen0->freq=f*10;
-                               pSps=pChan->spsTxLsdLpf;
-                               pSps->enabled=1;
-
-                               #if 0
-                               if(f>203.0)
-                               {
-                                       pSps->ncoef=taps_fir_lpf_250_9_66;
-                                       pSps->size_coef=2;
-                                       pSps->coef=(void*)coef_fir_lpf_250_9_66;
-                                       pSps->nx=taps_fir_lpf_250_9_66;
-                                       pSps->size_x=2;
-                                       pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-                                       pSps->calcAdjust=gain_fir_lpf_250_9_66;
-                               }
-                               else
-                               {
-                                       pSps->ncoef=taps_fir_lpf_215_9_88;
-                                       pSps->size_coef=2;
-                                       pSps->coef=(void*)coef_fir_lpf_215_9_88;
-                                       pSps->nx=taps_fir_lpf_215_9_88;
-                                       pSps->size_x=2;
-                                       pSps->x=(void*)(calloc(pSps->nx,pSps->size_x));
-                                       pSps->calcAdjust=gain_fir_lpf_215_9_88;
-                               }
-                               #endif
-
-                               pChan->spsSigGen0->option=1;
-                               pChan->spsSigGen0->enabled=1;
-                           pChan->spsSigGen0->discounterl=0;
-                   }
-               }
-               else if(pChan->smode==SMODE_NULL && pChan->txcodedefaultsmode==SMODE_CTCSS && !pChan->b.txCtcssInhibit)
-               {
-                   TRACEC(1,("txPtt Encode txcodedefaultsmode==SMODE_CTCSS %f\n",pChan->txctcssdefault_value));
-                       pChan->spsSigGen0->freq=pChan->txctcssdefault_value*10;
-                       pChan->spsSigGen0->option=1;
-                   pChan->spsSigGen0->enabled=1;
-                       pChan->spsSigGen0->discounterl=0;
-                       pChan->smode=SMODE_CTCSS;
-                       pChan->smodetimer=pChan->smodetime;
-               }
-               else if(pChan->txcodedefaultsmode==SMODE_NULL||pChan->b.txCtcssInhibit)
-               {
-                       TRACEC(1,("txPtt Encode txcodedefaultsmode==SMODE_NULL\n"));
-               }
-               else
-               {
-                       printf   ("ERROR: txPttIn=%i NOT HANDLED PROPERLY.\n",pChan->txPttIn);
-                       TRACEC(1,("ERROR: txPttIn=%i NOT HANDLED PROPERLY.\n",pChan->txPttIn));
-               }
-
-               pChan->txState = CHAN_TXSTATE_ACTIVE;
-               pChan->txPttOut=1;
-
-               pChan->txsettletimer=pChan->txsettletime;
-
-               if(pChan->spsTxOutA)pChan->spsTxOutA->enabled=1;
-               if(pChan->spsTxOutB)pChan->spsTxOutB->enabled=1;
-               if(pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->enabled=1;
-               if(pChan->txfreq)pChan->b.reprog=1;
-               TRACEC(1,("PmrRx() TxOn\n"));
-       }
-       else if(pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE)
-       {
-               // pChan->smode=SMODE_CTCSS;
-               pChan->smodetimer=pChan->smodetime;
-       }
-       else if(!pChan->txPttIn && pChan->txState==CHAN_TXSTATE_ACTIVE)
-       {
-               TRACEC(1,("txPttIn==0 from CHAN_TXSTATE_ACTIVE\n"));
-               if(pChan->smode==SMODE_CTCSS && !pChan->b.txCtcssInhibit)
-               {
-                       if( pChan->txTocType==TOC_NONE || !pChan->b.ctcssTxEnable )
-                       {
-                               TRACEC(1,("Tx Off Immediate.\n"));
-                               pChan->spsSigGen0->option=3;
-                               pChan->txBufferClear=3;
-                               pChan->txState=CHAN_TXSTATE_FINISHING;
-               }
-                       else if(pChan->txTocType==TOC_NOTONE)
-                       {
-                               pChan->txState=CHAN_TXSTATE_TOC;
-                               pChan->txHangTime=TOC_NOTONE_TIME/MS_PER_FRAME;
-                               pChan->spsSigGen0->option=3;
-                               TRACEC(1,("Tx Turn Off No Tone Start.\n"));
-                       }
-                       else
-                       {
-                               pChan->txState=CHAN_TXSTATE_TOC;
-                               pChan->txHangTime=0;
-                               pChan->spsSigGen0->option=2;
-                               TRACEC(1,("Tx Turn Off Phase Shift Start.\n"));
-                       }
-           }
-               else
-               {
-                   pChan->txBufferClear=3;
-                       pChan->txState=CHAN_TXSTATE_FINISHING;
-                       TRACEC(1,("Tx Off No SMODE to Finish.\n"));
-               }
-       }
-       else if(pChan->txState==CHAN_TXSTATE_TOC)
-       {
-               if( pChan->txPttIn && pChan->smode==SMODE_CTCSS )
-               {
-                       TRACEC(1,("Tx Key During HangTime\n"));
-                       pChan->txState = CHAN_TXSTATE_ACTIVE;
-                       pChan->spsSigGen0->option=1;
-                       pChan->spsSigGen0->enabled=1;
-                       pChan->spsSigGen0->discounterl=0;
-                       hit=0;
-               }
-               else if(pChan->txHangTime)
-               {
-                       if(--pChan->txHangTime==0)pChan->txState=CHAN_TXSTATE_FINISHING;
-               }
-               else if(pChan->txHangTime<=0 && pChan->spsSigGen0->state==0)
-               {
-                       pChan->txBufferClear=3;
-                       pChan->txState=CHAN_TXSTATE_FINISHING;
-                       TRACEC(1,("Tx Off TOC.\n"));
-               }
-       }
-       else if(pChan->txState==CHAN_TXSTATE_FINISHING)
-       {
-               if(--pChan->txBufferClear<=0)
-                       pChan->txState=CHAN_TXSTATE_COMPLETE;
-       }
-       else if(pChan->txState==CHAN_TXSTATE_COMPLETE)
-       {
-               hit=1;  
-       }
-       }       // end of if SMODE==LSD
-
-       if(hit)
-       {
-               pChan->txPttOut=0;
-               pChan->spsSigGen0->option=3;
-               pChan->txState=CHAN_TXSTATE_IDLE;
-               if(pChan->spsTxLsdLpf)pChan->spsTxLsdLpf->option=3;
-               if(pChan->spsTxOutA)pChan->spsTxOutA->option=3;
-               if(pChan->spsTxOutB)pChan->spsTxOutB->option=3;
-               if(pChan->rxfreq||pChan->txfreq)pChan->b.reprog=1;
-               TRACEC(1,("Tx Off hit.\n"));
-       }
-                         
-       if(pChan->b.reprog)
-       {
-               pChan->b.reprog=0;      
-               progdtx(pChan);
-       }
-
-       if(pChan->txsettletimer && pChan->txPttHid )
-       {
-               pChan->txsettletimer-=MS_PER_FRAME;
-               if(pChan->txsettletimer<0)pChan->txsettletimer=0;
-       }
-
-       // enable this after we know everything else is working
-       if( pChan->txCpuSaver && 
-           !pChan->txPttIn && !pChan->txPttOut && 
-           pChan->txState==CHAN_TXSTATE_IDLE &&
-           !pChan->dd.b.doitnow 
-           ) 
-       {
-               if(!pChan->b.txhalted)
-               {
-                       pChan->b.txhalted=1;
-                       TRACEC(1,("PmrRx() tx sps halted\n"));
-               }
-       }
-       else if(pChan->b.txhalted)
-       {
-               pChan->dd.b.doitnow=1;
-               pChan->b.txhalted=0;
-               TRACEC(1,("PmrRx() tx sps un-halted\n"));
-       }
-
-       if(pChan->b.txhalted)return(1);
-
-       if(pChan->b.startSpecialTone)
-       {
-               pChan->b.startSpecialTone=0;
-               pChan->spsSigGen1->option=1;
-               pChan->spsSigGen1->enabled=1;
-               pChan->b.doingSpecialTone=1;
-       } 
-       else if(pChan->b.stopSpecialTone)
-       {
-               pChan->b.stopSpecialTone=0;
-               pChan->spsSigGen1->option=0;
-               pChan->b.doingSpecialTone=0;
-               pChan->spsSigGen1->enabled=0;
-       } 
-       else if(pChan->b.doingSpecialTone)
-       {
-               pChan->spsSigGen1->sink=outputtx;
-               pChan->spsSigGen1->sigProc(pChan->spsSigGen1);
-               for(i=0;i<(pChan->nSamplesTx*2*6);i+=2)outputtx[i+1]=outputtx[i];
-               return 0;
-       }
-
-       if(pChan->spsSigGen0 && pChan->spsSigGen0->enabled )
-       {
-               pChan->spsSigGen0->sigProc(pChan->spsSigGen0);
-       }
-
-       if(pChan->spsSigGen1 && pChan->spsSigGen1->enabled)
-       {
-               pChan->spsSigGen1->sigProc(pChan->spsSigGen1);
-       }
-
-       #ifdef XPMRX_H
-       pChan->spsLsdGen->sigProc(pChan->spsLsdGen);    // maw sph ???
-       #endif
-
-       // Do Low Speed Data Low Pass Filter
-       pChan->spsTxLsdLpf->sigProc(pChan->spsTxLsdLpf);
-
-       // Do Voice
-       pmr_sps=pChan->spsTx;
-
-       // get tx data from de-drift process
-       pChan->dd.option=0;
-       pChan->dd.ptr=pChan->pTxBase;
-       dedrift(pChan);
-
-       // tx process
-       if(!pChan->spsSigGen1->enabled)
-       {
-               pmr_sps->source=pChan->pTxBase;
-       }
-       else input=pmr_sps->source;
-
-       if(outputtx!=NULL)
-       {
-               if(pChan->spsTxOutA)pChan->spsTxOutA->sink=outputtx;
-               if(pChan->spsTxOutB)pChan->spsTxOutB->sink=outputtx;
-       }
-
-       i=0;
-       while(pmr_sps!=NULL && pmr_sps!=0)
-       {
-               //TRACEF(1,("PmrTx() sps %i\n",i++));
-               pmr_sps->sigProc(pmr_sps);
-               pmr_sps = (t_pmr_sps *)(pmr_sps->nextSps);
-       }
-
-       //TRACEF(1,("PmrTx() - outputs \n"));
-       if(pChan->txMixA==TX_OUT_OFF || !pChan->txPttOut){
-               for(i=0;i<pChan->nSamplesTx*2*6;i+=2)outputtx[i]=0;
-       }
-
-       if(pChan->txMixB==TX_OUT_OFF || !pChan->txPttOut ){
-               for(i=0;i<pChan->nSamplesTx*2*6;i+=2)outputtx[i+1]=0;
-       }
-
-       #if XPMR_PPTP == 1
-       if(     pChan->b.radioactive && pChan->b.pptp_p1!=pChan->txPttOut)
-       {
-               pChan->b.pptp_p1=pChan->txPttOut;
-               pptp_write(0,pChan->b.pptp_p1);
-       }
-       #endif
-
-       #if XPMR_DEBUG0 == 1
-       // TRACEF(1,("PmrRx() - debug outputs \n"));
-       if(pChan->b.rxCapture){
-               for(i=0;i<pChan->nSamplesRx;i++)
-               {
-                       pChan->pRxDemod[i]=input[i*2*6];
-                       pChan->pTstTxOut[i]=outputtx[i*2*6+0]; // txa
-                       //pChan->pTstTxOut[i]=outputtx[i*2*6+1]; // txb
-                       TSCOPE((RX_NOISE_TRIG, pChan->sdbg, i, (pChan->rxCarrierDetect*XPMR_TRACE_AMP)-XPMR_TRACE_AMP/2));
-                       TSCOPE((RX_CTCSS_DECODE, pChan->sdbg, i, pChan->rxCtcss->decode*(M_Q14/CTCSS_NUM_CODES)));
-                       TSCOPE((RX_SMODE, pChan->sdbg, i, pChan->smode*(XPMR_TRACE_AMP/4)));
-                       TSCOPE((TX_PTT_IN, pChan->sdbg, i, (pChan->txPttIn*XPMR_TRACE_AMP)-XPMR_TRACE_AMP/2));
-                       TSCOPE((TX_PTT_OUT, pChan->sdbg, i, (pChan->txPttOut*XPMR_TRACE_AMP)-XPMR_TRACE_AMP/2));
-                       TSCOPE((TX_DEDRIFT_LEAD, pChan->sdbg, i, pChan->dd.lead*8));
-                       TSCOPE((TX_DEDRIFT_ERR, pChan->sdbg, i, pChan->dd.err*16));
-                       TSCOPE((TX_DEDRIFT_FACTOR, pChan->sdbg, i, pChan->dd.factor*16));
-                       TSCOPE((TX_DEDRIFT_DRIFT, pChan->sdbg, i, pChan->dd.drift*16));
-               }
-    }
-       #endif
-
-       strace2(pChan->sdbg);
-       TRACEC(5,("PmrRx() return  cd=%i smode=%i  txPttIn=%i  txPttOut=%i \n",pChan->rxCarrierDetect,pChan->smode,pChan->txPttIn,pChan->txPttOut));
-       return 0;
-}
-/*
-       parallel binary programming of an RF Transceiver*/
-
-void   ppbinout        (u8 chan)
-{
-#if(DTX_PROG == 1)
-       i32     i;
-
-       if (ppdrvdev == 0)
-       ppdrvdev = open("/dev/ppdrv_device", 0);
-
-    if (ppdrvdev < 0)
-    {
-        ast_log(LOG_ERROR, "open /dev/ppdrv_ppdrvdev returned %i\n",ppdrvdev);
-               return;
-       }
-
-       i=0;
-       if(chan&0x01)i|=BIN_PROG_0;
-       if(chan&0x02)i|=BIN_PROG_1;
-       if(chan&0x04)i|=BIN_PROG_2;
-       if(chan&0x08)i|=BIN_PROG_3;
-
-       ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0);
-       //ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR,    BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0);
-       //ioctl(ppdrvdev, PPDRV_IOC_PINSET, i );
-       ioctl(ppdrvdev, PPDRV_IOC_PINSET,    BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0);
-       ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, i );
-
-    // ioctl(ppdrvdev, PPDRV_IOC_PINSET, BIN_PROG_3|BIN_PROG_2|BIN_PROG_1|BIN_PROG_0 ); 
-    ast_log(LOG_NOTICE, "mask=%i 0x%x\n",i,i); 
-#endif
-}
-/*
-       SPI Programming of an RF Transceiver
-       need to add permissions check and mutex
-*/
-/*
-       need to add permissions check and mutex
-*/
-void   ppspiout        (u32 spidata)
-{
-#if(DTX_PROG == 1)
-       static char firstrun=0;
-       i32     i,ii;
-       u32     bitselect;
-
-    if (ppdrvdev < 0)
-    {
-        ast_log(LOG_ERROR, "no parallel port permission ppdrvdev %i\n",ppdrvdev);
-               exit(0);
-       }
-
-       ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX );
-       ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX );
-
-       if(firstrun==0)
-       {
-               firstrun=1;
-               for(ii=0;ii<PP_BIT_TIME*200;ii++);      
-       }
-       else
-       {
-               for(ii=0;ii<PP_BIT_TIME*4;ii++);
-       }
-
-       bitselect=0x00080000;
-
-       for(i=0;i<(PP_REG_LEN-12);i++)
-       {
-               if((bitselect&spidata))
-                       ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_DATA );
-               else
-                       ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_DATA );
-
-               for(ii=0;ii<PP_BIT_TIME;ii++);
-
-               ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_CLK );
-               for(ii=0;ii<PP_BIT_TIME;ii++);
-               ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK );
-               for(ii=0;ii<PP_BIT_TIME;ii++);
-
-               bitselect=(bitselect>>1);
-       }
-       ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA );
-       ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_ENABLE );
-       for(ii=0;ii<PP_BIT_TIME;ii++);
-       ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_ENABLE );
-#endif
-}
-/*
-       mutex needed
-       now assumes calling thread secures permissions
-       could set up a separate thread to program the radio? yuck!
-
-*/
-void   progdtx(t_pmr_chan *pChan)
-{
-#if(DTX_PROG == 1)     
-       //static u32    progcount=0;
-
-       u32 reffreq;
-       u32 stepfreq;
-       u32 rxiffreq;
-       u32 synthfreq;
-       u32 shiftreg;
-       u32 tmp;
-
-       TRACEC(1,("\nprogdtx() %i %i %i\n",pChan->rxfreq,pChan->txfreq,0));
-
-       if (ppdrvdev == 0)
-       ppdrvdev = open("/dev/ppdrv_device", 0);
-
-    if (ppdrvdev < 0)
-    {
-        ast_log(LOG_ERROR, "open /dev/ppdrv_ppdrvdev returned %i\n",ppdrvdev);
-               exit(0);
-       }
-
-       if(pChan->rxfreq>200000000)
-       {
-               reffreq=16012500;
-               stepfreq=12500;
-               rxiffreq=21400000;
-       }
-       else
-       {
-               reffreq=16000000;
-               stepfreq=5000;
-               rxiffreq=10700000;
-       }
-
-       shiftreg=(reffreq/stepfreq)<<1;
-       shiftreg=shiftreg|0x00000001;
-
-       ppspiout(shiftreg);
-
-       if(pChan->txPttOut)
-               synthfreq=pChan->txfreq;
-       else
-               synthfreq=pChan->rxfreq-rxiffreq;
-
-       shiftreg=(synthfreq/stepfreq)<<1;
-       tmp=(shiftreg&0xFFFFFF80)<<1;
-       shiftreg=tmp+(shiftreg&0x0000007F);
-
-       ppspiout(shiftreg);
-
-       ioctl(ppdrvdev, PPDRV_IOC_PINMODE_OUT, DTX_CLK | DTX_DATA | DTX_ENABLE | DTX_TXPWR | DTX_TX );
-       ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_CLK | DTX_DATA | DTX_ENABLE );
-
-       if(pChan->txPttOut)
-       {
-               ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_TXPWR );
-               ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_TX );
-               if(pChan->txpower && 0) ioctl(ppdrvdev, PPDRV_IOC_PINSET, DTX_TXPWR );
-       }
-       else
-       {
-               ioctl(ppdrvdev, PPDRV_IOC_PINCLEAR, DTX_TX | DTX_TXPWR );
-       }
-#endif
-}
-
-/*     dedrift
-       reconciles clock differences between the usb adapter and 
-       asterisk's frame rate clock     
-       take out all accumulated drift error on these events:
-       before transmitter on
-       when ptt release from mobile units detected
-*/
-void dedrift(t_pmr_chan *pChan)
-{
-       TRACEC(5,("dedrift()\n"));
-
-       if(pChan->dd.option==9)
-       {
-               TRACEF(1,("dedrift(9)\n"));
-               pChan->dd.framesize=DDB_FRAME_SIZE;
-               pChan->dd.frames=DDB_FRAMES_IN_BUFF;
-               pChan->dd.buffersize = pChan->dd.frames * pChan->dd.framesize;
-               pChan->dd.buff=calloc(DDB_FRAME_SIZE*DDB_FRAMES_IN_BUFF,2);
-               pChan->dd.modulus=DDB_ERR_MODULUS;
-               pChan->dd.inputindex=0;
-               pChan->dd.outputindex=0;
-               pChan->dd.skew = pChan->dd.lead=0;
-               pChan->dd.z1=0;
-               pChan->dd.debug=0;
-               pChan->dd.debugcnt=0;
-               pChan->dd.lock=pChan->dd.b.txlock=pChan->dd.b.rxlock=0;
-               pChan->dd.initcnt=2;
-               pChan->dd.timer=10000/20;
-               pChan->dd.drift=0;
-               pChan->dd.factor=pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
-               pChan->dd.txframecnt=pChan->dd.rxframecnt=0;
-               // clear the buffer too!
-               return;
-       }
-       else if(pChan->dd.option==8)
-       {
-               free(pChan->dd.buff);
-               pChan->dd.lock=0;
-               pChan->dd.b.txlock=pChan->dd.b.rxlock=0;
-               return;
-       }
-       else if(pChan->dd.initcnt==0)
-       {
-               const i32 a0 =  26231;
-               const i32 a1 =  26231;
-               const i32 b0 =  32768;
-               const i32 b1 = -32358;
-               const i32 dg =  128;
-               void *vptr;
-               i16 inputindex;
-               i16 indextweak;
-           i32 accum;
-
-               inputindex = pChan->dd.inputindex;
-               pChan->dd.skew = pChan->dd.txframecnt-pChan->dd.rxframecnt;
-               pChan->dd.rxframecnt++;
-
-               // pull data from buffer
-               if( (pChan->dd.outputindex + pChan->dd.framesize) > pChan->dd.buffersize )
-               {
-                       i16 dofirst,donext;
-
-                       dofirst = pChan->dd.buffersize - pChan->dd.outputindex;
-                   donext = pChan->dd.framesize - dofirst;
-                       vptr = (void*)(pChan->dd.ptr);
-                       memcpy(vptr,(void*)(pChan->dd.buff + pChan->dd.outputindex),dofirst*2);
-                       vptr=(void*)(pChan->dd.ptr + dofirst);
-                       memcpy(vptr,(void*)(pChan->dd.buff),donext*2);
-               }
-               else
-               {
-                       memcpy(pChan->dd.ptr,(void*)(pChan->dd.buff + pChan->dd.outputindex),pChan->dd.framesize*2);
-               }
-               
-               // compute clock error and correction factor
-               if(pChan->dd.outputindex > inputindex)
-               {
-                       pChan->dd.lead = (inputindex + pChan->dd.buffersize) - pChan->dd.outputindex;
-               }
-           else
-               {
-                       pChan->dd.lead = inputindex - pChan->dd.outputindex;
-               }
-               pChan->dd.err = pChan->dd.lead - (pChan->dd.buffersize/2);
-
-               // WinFilter, IIR Fs=50, Fc=0.1
-               pChan->dd.x1 = pChan->dd.x0;
-           pChan->dd.y1 = pChan->dd.y0;
-               pChan->dd.x0 = pChan->dd.err;
-           pChan->dd.y0 = a0 * pChan->dd.x0;
-           pChan->dd.y0 += (a1 * pChan->dd.x1 - (b1 * pChan->dd.y1));
-           pChan->dd.y0 /= b0;
-               accum = pChan->dd.y0/dg;
-
-               pChan->dd.factor=accum;
-               indextweak=0;
-
-               #if 1
-               // event sync'd correction
-               if(pChan->dd.b.doitnow)
-               {
-                   pChan->dd.b.doitnow=0;      
-                       indextweak=pChan->dd.factor;
-                       pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
-                       pChan->dd.timer=20000/MS_PER_FRAME;
-               }
-               // coarse lead adjustment if really far out of range
-               else if( pChan->dd.lead >= pChan->dd.framesize*(DDB_FRAMES_IN_BUFF-2) )
-               {
-                       pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
-                       indextweak += (pChan->dd.framesize*5/4);
-               }
-               else if(pChan->dd.lead <= pChan->dd.framesize*2 )
-               {
-                       pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
-                       indextweak -= (pChan->dd.framesize*5/4);
-               }
-           #endif
-
-               #if 1
-               if(pChan->dd.timer>0)pChan->dd.timer--;
-               if(pChan->dd.timer==0 && abs(pChan->dd.factor)>=16)
-               {
-                       indextweak=pChan->dd.factor;
-                       pChan->dd.factor = pChan->dd.x1 = pChan->dd.x0 = pChan->dd.y1 = pChan->dd.y0 = 0;
-                       pChan->dd.timer=20000/MS_PER_FRAME;
-               }
-               #endif
-
-               #if XPMR_DEBUG0 == 1
-               if(indextweak!=0)TRACEF(4,("%08i indextweak  %+4i  %+4i  %+5i  %5i  %5i  %5i  %+4i\n",pChan->dd.rxframecnt, indextweak, pChan->dd.err, accum, inputindex, pChan->dd.outputindex, pChan->dd.lead, pChan->dd.skew));
-               #endif
-
-               // set the output index based on lead and clock offset
-               pChan->dd.outputindex = (pChan->dd.outputindex + pChan->dd.framesize + indextweak)%pChan->dd.buffersize;
-       }
-}
-/*
-*/
-void dedrift_write(t_pmr_chan *pChan, i16 *src )
-{
-       void *vptr;
-
-       TRACEF(5,("dedrift_write()\n"));
-       vptr = pChan->dd.buff + pChan->dd.inputindex;
-       memcpy(vptr, src, pChan->dd.framesize*2);
-       pChan->dd.inputindex = (pChan->dd.inputindex + pChan->dd.framesize) % pChan->dd.buffersize;
-       pChan->dd.txframecnt++;
-       if(pChan->dd.initcnt!=0)pChan->dd.initcnt--;
-       pChan->dd.accum+=pChan->dd.framesize;
-}
-
-/* end of file */
diff --git a/channels/xpmr/xpmr.h b/channels/xpmr/xpmr.h
deleted file mode 100755 (executable)
index 49f5148..0000000
+++ /dev/null
@@ -1,951 +0,0 @@
-/*
- * xpmr.h - for Xelatec Private Mobile Radio Processes
- * 
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- * 
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *              
- * This version may be optionally licenced under the GNU LGPL licence.
- *                                                                                                     
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-
-#ifndef  XPMR_H
-#define  XPMR_H                                1
-
-#define  XPMR_DEV              0                       // when running in test mode
-
-#define  XPMR_TRACE_LEVEL      0
-
-#ifdef  RADIO_RTX
-#define         DTX_PROG                       1                       // rf transceiver module
-#define  XPMR_PPTP                     0                       // parallel port test probe
-#else
-#define         DTX_PROG                       0
-#define  XPMR_PPTP                     0                       
-#endif
-
-#if (DTX_PROG == 1) ||         XPMR_PPTP == 1
-#include <parapindriver.h>
-#endif
-
-#ifdef CHAN_USBRADIO
-#define XPMR_DEBUG0            1
-#define XPMR_TRACE             1
-#define TRACEO(level,a) { if ( o->tracelevel >= level ) {printf a;} }
-#else
-#define XPMR_DEBUG0            1
-#define XPMR_TRACE             1
-#define TRACEO(level,a)
-#endif
-
-
-#define LSD_DFS                        5
-#define LSD_DFD                        1
-
-#if(XPMR_DEBUG0 == 1)
-#define XPMR_DEBUG_CHANS       16
-#define TSCOPE(a) {strace a;}
-#else
-#define XPMR_DEBUG_CHANS       0
-#define TSCOPE(a)
-#endif  
-
-#define        XPMR_TRACE_AMP          8192
-
-// TRACEM(3,TSYS_LSD,("pmr_lsdctl_exec() RX FRAME UNPROCESSED.\n"));
-#if(XPMR_TRACE == 1)
-#define TRACEX(a) {printf a;}
-#define TRACEXL(a) {printf("%s @ %u : ",__FILE__ ,__LINE__); printf a; }
-#define TRACEXT(a) {struct timeval hack; gettimeofday(&hack,NULL); printf("%ld.",hack.tv_sec%100000); printf("%i : ",(int)hack.tv_usec); printf a; }
-#define TRACEXR(a) {printf a;}
-#define TRACEC(level,a) {if(pChan->tracelevel>=level){printf("%08i ",pChan->frameCountRx);printf a;} }
-#define TRACEF(level,a) {if(pChan->tracelevel>=level){printf a;} }
-#define TRACEJ(level,a) {if(XPMR_TRACE_LEVEL>=level){printf a;} }
-#define TRACES(level,a) {if(mySps->parentChan->tracelevel >= level){printf a;} }
-#define TRACET(level,a) {if(pChan->tracelevel>=level){printf("%08i %02i",pChan->frameCountRx,pChan->rptnum);printf a;} }
-#define TRACEXR(a) {printf a;}
-#define TRACEM(level,sys,a) {if(pChan->tracelevel>=level || (pChan->tracesys[sys])){printf a;} }
-#else                                            
-#define TRACEX(a)
-#define TRACEXL(a)
-#define TRACEXT(a)
-#define TRACEC(level,a)
-#define TRACEF(level,a)
-#define TRACEJ(level,a)
-#define TRACES(level,a)
-#define TRACET(level,a)
-#define TRACEXR(a)
-#define TRACEM(level,sys,a)
-#endif
-
-#define i8     int8_t
-#define u8     u_int8_t
-#define i16            int16_t
-#define u16    u_int16_t
-#define i32            int32_t
-#define u32    u_int32_t
-#define i64    int64_t
-#define u64    u_int64_t
-
-#define M_Q31                  0x80000000              //
-#define M_Q30                  0x40000000              //
-#define M_Q29                  0x20000000              //
-#define M_Q28                  0x10000000              //
-#define M_Q27                  0x08000000              //
-#define M_Q26                  0x04000000              //
-#define M_Q25                  0x02000000              //                      
-#define M_Q24                  0x01000000              //
-#define M_Q23                  0x00800000              //
-#define M_Q22                  0x00400000              //                                      
-#define M_Q21                  0x00200000              // undsoweiter                  
-#define M_Q20                  0x00100000              // 1048576
-#define M_Q19                  0x00080000              // 524288                  
-#define M_Q18                  0x00040000              // 262144
-#define M_Q17           0x00020000             // 131072
-#define M_Q16           0x00010000             // 65536
-#define M_Q15           0x00008000             // 32768
-#define M_Q14           0x00004000             // 16384
-#define M_Q13           0x00002000             // 8182
-#define M_Q12           0x00001000             // 4096
-#define M_Q11           0x00000800             // 2048
-#define M_Q10           0x00000400             // 1024
-#define M_Q9            0x00000200             // 512
-#define M_Q8            0x00000100             // 256
-#define M_Q7            0x00000080             // 128
-#define M_Q6            0x00000040             // 64
-#define M_Q5            0x00000020             // 32
-#define M_Q4            0x00000010             // 16
-#define M_Q3            0x00000008             // 16
-#define M_Q2            0x00000004             // 16
-#define M_Q1            0x00000002             // 16
-#define M_Q0            0x00000001             // 16
-
-#define RADIANS_PER_CYCLE              (2*M_PI)
-
-#define SAMPLE_RATE_INPUT       48000
-#define SAMPLE_RATE_NETWORK     8000
-
-#define SAMPLES_PER_BLOCK       160
-#define MS_PER_FRAME            20
-#define SAMPLES_PER_MS          8
-
-#define CTCSS_NULL              -1
-#define CTCSS_RXONLY            -2
-#define CTCSS_NUM_CODES                        38                      // 0 - 37
-#define CTCSS_SCOUNT_MUL               100
-#define CTCSS_INTEGRATE                        3932       // 32767*.120 // 120/1000  // 0.120
-#define CTCSS_INPUT_LIMIT              1000
-#define CTCSS_DETECT_POINT             1989
-#define CTCSS_HYSTERSIS                    200
-
-#define CTCSS_TURN_OFF_TIME            160                     // ms
-#define CTCSS_TURN_OFF_SHIFT    240                    // degrees
-#define TOC_NOTONE_TIME                        600                     // ms
-
-#define        DDB_FRAME_SIZE                  160                     // clock de-drift defaults
-#define DDB_FRAMES_IN_BUFF             8
-#define DDB_ERR_MODULUS                10000
-
-#define DCS_TURN_OFF_TIME       180
-
-#define        NUM_TXLSD_FRAMEBUFFERS  4
-
-#define CHAN_TXSTATE_IDLE              0
-#define CHAN_TXSTATE_ACTIVE            1
-#define CHAN_TXSTATE_TOC               2
-#define CHAN_TXSTATE_HANGING    3
-#define CHAN_TXSTATE_FINISHING  4
-#define CHAN_TXSTATE_COMPLETE  5
-#define CHAN_TXSTATE_USURPED   9
-
-#define SMODE_NULL                             0
-#define SMODE_CARRIER                  1
-#define SMODE_CTCSS                            2
-#define SMODE_DCS                      3
-#define SMODE_LSD                              4
-#define SMODE_MPT                              5
-#define SMODE_DST                              6
-#define SMODE_P25                              7
-#define SMODE_MDC                              8
-
-
-#define SPS_OPT_START                  1
-#define SPS_OPT_STOP                   2
-#define SPS_OPT_TURNOFF         3
-#define SPS_OPT_STOPNOW                        4
-
-#define SPS_STAT_STOPPED               0
-#define SPS_STAT_STARTING              1
-#define SPS_STAT_RUNNING               2
-#define SPS_STAT_HALTING               3
-
-#define PP_BIT_TEST            6
-#define PP_REG_LEN             32
-#define PP_BIT_TIME            100000
-                                               
-#define DTX_CLK        LP_PIN02
-#define DTX_DATA       LP_PIN03
-#define DTX_ENABLE     LP_PIN04
-#define DTX_TX             LP_PIN05            // only used on older mods
-#define DTX_TXPWR      LP_PIN06                // not used
-#define DTX_TP1        LP_PIN07                // not used
-#define DTX_TP2        LP_PIN08                // not used
-
-#define BIN_PROG_0     LP_PIN06
-#define BIN_PROG_1     LP_PIN07
-#define BIN_PROG_2     LP_PIN08
-#define BIN_PROG_3     LP_PIN09 
-                
-#ifndef CHAN_USBRADIO  
-enum {RX_AUDIO_NONE,RX_AUDIO_SPEAKER,RX_AUDIO_FLAT};
-enum {TX_AUDIO_NONE,TX_AUDIO_FLAT,TX_AUDIO_FILTERED,TX_AUDIO_PROC};
-enum {CD_IGNORE,CD_XPMR_NOISE,CD_XPMR_VOX,CD_HID,CD_HID_INVERT};
-enum {SD_IGNORE,SD_HID,SD_HID_INVERT,SD_XPMR};                                  // no,external,externalinvert,software
-enum {RX_KEY_CARRIER,RX_KEY_CARRIER_CODE};
-enum {TX_OUT_OFF,TX_OUT_VOICE,TX_OUT_LSD,TX_OUT_COMPOSITE,TX_OUT_AUX};
-enum {TOC_NONE,TOC_PHASE,TOC_NOTONE};
-#endif
-
-enum dbg_pts {
-RX_INPUT,      
-RX_NOISE_AMP, 
-RX_NOISE_TRIG,
-
-RX_CTCSS_LPF,
-RX_CTCSS_CENTER,
-RX_CTCSS_NRZ,
-RX_CTCSS_CLK,
-RX_CTCSS_P0,  
-RX_CTCSS_P1,
-RX_CTCSS_ACCUM,
-RX_CTCSS_DVDT,
-RX_CTCSS_DECODE,
-
-RX_DCS_CENTER,
-RX_DCS_DEC,
-RX_DCS_DIN,
-RX_DCS_CLK,
-RX_DCS_DAT,
-
-RX_LSD_LPF,
-RX_LSD_CLK,
-RX_LSD_DAT,
-RX_LSD_DEC,
-
-RX_LSD_CENTER,
-RX_LSD_SYNC,  
-RX_LSD_STATE,
-RX_LSD_ERR,
-RX_LSD_INTE,
-
-RX_SMODE,
-
-TX_PTT_IN,
-TX_PTT_OUT,
-
-TX_DEDRIFT_LEAD,
-TX_DEDRIFT_ERR,
-TX_DEDRIFT_FACTOR,
-TX_DEDRIFT_DRIFT,
-TX_DEDRIFT_TWIDDLE,
-
-TX_CTCSS_GEN,
-
-TX_SIGGEN_0,
-
-TX_DCS_CLK,
-TX_DCS_DAT,
-TX_DCS_LPF,
-
-TX_LSD_CLK,
-TX_LSD_DAT,
-TX_LSD_GEN,    
-TX_LSD_LPF,
-
-TX_NET_INT,
-TX_VOX_HPF,
-TX_VOX_LIM,
-
-TX_VOX_LPF,
-
-TX_OUT_A,
-TX_OUT_B,
-
-NUM_DEBUG_PTS  
-};
-
-typedef struct
-{
-       i16 mode;
-       i16     point[NUM_DEBUG_PTS];
-       i16 trace[16];
-       i16 scale[16];
-       i16 offset[16];
-       i16 buffer[16 * SAMPLES_PER_BLOCK];  // allocate for rx and tx
-       i16 *source[16];
-} t_sdbg;
-
-typedef struct
-{
-       i16 lock;
-       i16 option;                                     // 1 = data in, 0 = data out
-       i16 debug;
-       i16 debugcnt;
-       i32 rxframecnt;
-       i32 txframecnt;
-
-       i32 skew;
-
-       i16 frames;
-       i16 framesize;
-       i16 buffersize;
-
-       i32 timer;
-       
-       i32 x0,x1,y0,y1;
-
-       i16 inputindex;
-       i16 outputindex;
-       i16 lead;
-       i16 err;
-       i16 accum;
-
-       i16 *ptr;                                       // source or destination
-       i16     *buff;
-       
-       i16 inputcnt;
-       i16 initcnt;
-
-       i32 factor;
-       i32 drift;
-       i32 modulus;
-       i32     z1;
-       struct {
-               unsigned rxlock:1;
-               unsigned txlock:1;
-               unsigned twiddle:1;
-               unsigned doitnow:1;
-       }b;
-}
-t_dedrift;
-
-/*
-       one structure for each ctcss tone to decode 
-*/
-typedef struct
-{
-       i16 counter;                    // counter to next sample
-       i16 counterFactor;              // full divisor used to increment counter
-       i16 binFactor;
-       i16 fudgeFactor;
-       i16 peak;                               // peak amplitude now   maw sph now
-       i16 enabled;
-       i16 state;                              // dead, running, error                          
-       i16 zIndex;                             // z bucket index
-       i16 z[4];                                
-       i16 zi;
-       i16 dvu;
-       i16 dvd;
-       i16 zd;
-       i16 setpt;
-       i16 hyst;
-       i16 decode;
-       i16 diffpeak;
-       i16 debug;                               
-
-       #if XPMR_DEBUG0 == 1
-       i16 lasttv0;
-       i16 lasttv1;
-       i16 lasttv2;
-       i16 lasttv3;
-
-       i16 *pDebug0;                   // pointer to debug output
-       i16 *pDebug1;                   // pointer to debug output
-       i16 *pDebug2;                   // pointer to debug output
-       i16 *pDebug3;                   // pointer to debug output
-       #endif
-
-} t_tdet;
-
-typedef struct
-{
-       i16 enabled;                                            // if 0 none, 0xFFFF all tones, or single tone
-       i16 *input;                                                     // source data
-       i16 clamplitude;
-       i16 center;
-       i16 decode;                                                     // current ctcss decode index
-       i32 BlankingTimer;
-       u32 TurnOffTimer;
-       i16 gain;
-       i16 limit;
-       i16 debugIndex;
-       i16 *pDebug0;
-       i16 *pDebug1;
-       i16 *pDebug2;
-       i16 *pDebug3;
-       i16 testIndex;
-       i16 multiFreq;
-       i8 relax;
-       t_tdet tdet[CTCSS_NUM_CODES];
-
-       i8              numrxcodes;
-       i16     rxCtcssMap[CTCSS_NUM_CODES];
-       char    *rxctcss[CTCSS_NUM_CODES];              // pointers to each tone in string above
-       char    *txctcss[CTCSS_NUM_CODES];
-
-       i32             txctcssdefault_index;
-       float   txctcssdefault_value;
-
-       struct{
-               unsigned valid:1;
-       }b;
-} t_dec_ctcss;
-
-/*
-       Low Speed Data
-*/
-/* 
-       general purpose pmr signal processing element 
-*/
-
-struct t_pmr_chan;
-
-typedef struct t_pmr_sps
-{
-       i16  index;                     // unique to each instance
-
-       i16  enabled;           // enabled/disabled
-
-
-       struct t_pmr_chan *parentChan;
-       
-       i16  *source;           // source buffer
-       i16  *sourceB;          // source buffer B
-       i16  *sink;                     // sink buffer
-
-       i16  numChanOut;        // allows output direct to interleaved buffer
-       i16  selChanOut;
-
-       i32  ticks;                     
-       i32  timer;
-       i32  count;
-
-       void *buff;                     // this structure's internal buffer
-
-       i16  *debugBuff0;       // debug buffer
-       i16  *debugBuff1;       // debug buffer
-       i16  *debugBuff2;       // debug buffer
-       i16  *debugBuff3;       // debug buffer
-
-       i16  nSamples;          // number of samples in the buffer
-
-       u32      buffSize;              // buffer maximum index
-       u32  buffInIndex;       // index to current input point
-       u32  buffOutIndex;      // index to current output point
-       u32  buffLead;          // lead of input over output through cb
-
-       i16  decimate;          // decimation or interpolation factor (could be put in coef's)
-       i16  interpolate;
-       i16      decimator;             // like the state this must be saved between calls (could be put in x's)
-
-       u32  sampleRate;    // in Hz for elements in this structure
-       u32  freq;                      // in 0.1 Hz
-
-       i16  measPeak;          // do measure Peak
-       i16  amax;                      // buffer amplitude maximum
-       i16  amin;                      // buffer amplitude minimum
-       i16  apeak;                     // buffer amplitude peak value (peak to peak)/2
-       i16  setpt;                     // amplitude set point for amplitude comparator
-       i16  hyst;                      // hysterysis for amplitude comparator
-       i16  compOut;           // amplitude comparator output
-
-       i32  discounteru;       // amplitude detector integrator discharge counter upper
-       i32  discounterl;       // amplitude detector integrator discharge counter lower
-       i32  discfactor;        // amplitude detector integrator discharge factor
-
-       i16  err;                       // error condition
-       i16  option;            // option / request zero
-       i16  state;         // stopped, start, stopped assumes zero'd
-       
-       i16  pending;
-
-       struct {
-               unsigned hit:1;
-               unsigned hitlast:1;
-               unsigned hita:1;
-               unsigned hitb:1;
-               unsigned bithit:1;
-               unsigned now:1;
-               unsigned next:1;
-               unsigned prev:1;
-               unsigned clock:1;
-               unsigned hold:1;
-               unsigned opt1:1;
-               unsigned opt2:1;
-               unsigned polarity:1;
-               unsigned dotting:1;
-               unsigned lastbitpending:1;
-               unsigned outzero:1;
-               unsigned settling:1;
-               unsigned syncing:1;
-       }b;
-
-       i16  cleared;           // output buffer cleared
-
-       i16  delay;
-       i16  decode;
-
-       i32  inputGain;         // apply to input data   ? in Q7.8 format
-       i32  inputGainB;        // apply to input data   ? in Q7.8 format
-       i32  outputGain;        // apply to output data  ? in Q7.8 format
-       i16  mixOut;
-       i16  monoOut;
-
-       i16  filterType;        // iir, fir, 1, 2, 3, 4 ...
-
-       i16 (*sigProc)(struct t_pmr_sps *sps);  // function to call
-
-       i32      calcAdjust;    // final adjustment
-       i16      nx;                    // number of x history elements
-       i16  ncoef;                     // number of coefficients
-       i16  size_x;            // size of each x history element
-       i16  size_coef;         // size of each coefficient
-       void  *x;                       // history registers
-       void  *x2;                      // history registers, 2nd bank 
-       void  *coef;            // coefficients
-       void  *coef2;           // coefficients 2
-
-       void  *nextSps;         // next Sps function
-
-} t_pmr_sps;
-
-
-struct t_dec_dcs;
-struct t_lsd_control;
-struct t_decLsd;;      
-struct t_encLsd;
-
-/*
-       pmr channel
-*/
-typedef struct t_pmr_chan
-{
-       i16 index;                              // which one
-       i16 devicenum;                  // belongs to
-
-       char *name;
-
-       i16 enabled;                    // enabled/disabled
-       i16 status;                             // ok, error, busy, idle, initializing
-       
-       i16  tracelevel;
-       i16  tracetype;
-       u32  tracemask;
-
-       i16 nSamplesRx;                 // max frame size
-       i16 nSamplesTx;
-
-       i32 inputSampleRate;    // in S/s  48000
-       i32 baseSampleRate;             // in S/s   8000 
-
-       i16 inputGain;
-       i16 inputOffset;
-
-       i32  ticks;                             // time ticks
-       u32  frameCountRx;              // number processed
-       u32  frameCountTx;
-
-       i8   txframelock;
-
-       i32  txHangTime;
-       i32  txHangTimer;
-       i32  txTurnOff;
-       i16  txBufferClear;
-
-       u32 txfreq;
-       u32 rxfreq;
-       i8  txpower;
-
-       i32 txsettletime;               // in samples
-       i32 txsettletimer;
-
-       i16 rxDC;                           // average DC value of input
-       i16 rxSqSet;                    // carrier squelch threshold
-       i16 rxSqHyst;                   // carrier squelch hysterysis
-       i16 rxRssi;                             // current Rssi level
-       i16 rxQuality;                  // signal quality metric
-       i16 rxCarrierDetect;    // carrier detect
-       i16 rxCdType;
-       i16 rxSqVoxAdj;
-       i16 rxExtCarrierDetect; 
-       i32 inputBlanking;      // Tx pulse eliminator
-
-       i16 rxDemod;            // see enum
-       i16 txMod;                      //
-
-       i16 rxNoiseSquelchEnable;
-       i16 rxHpfEnable;
-       i16 rxDeEmpEnable;
-       i16 rxCenterSlicerEnable;
-       i16 rxCtcssDecodeEnable;
-       i16 rxDcsDecodeEnable;
-       i16 rxDelayLineEnable;
-
-       i16 txHpfEnable;
-       i16 txLimiterEnable;
-       i16 txPreEmpEnable;
-       i16 txLpfEnable;
-
-       char radioDuplex;
-
-       char    *pStr;
-
-       //              start channel signaling codes source
-       char    *pRxCodeSrc;                                    // source
-       char    *pTxCodeSrc;                                    // source
-       char    *pTxCodeDefault;                                // source
-       //              end channel signaling codes source
-
-       //              start signaling code info derived from source
-       i16     numrxcodes;
-       i16     numtxcodes;
-       char    *pRxCodeStr;                                    // copied and cut up
-       char    **pRxCode;                                              // pointers to subs
-       char    *pTxCodeStr;                                     
-       char    **pTxCode;
-
-       char    txctcssdefault[16];                             // codes from higher level
-
-       char    *rxctcssfreqs;                                  // rest are derived from this 
-       char    *txctcssfreqs;
-       
-       char    numrxctcssfreqs;
-       char    numtxctcssfreqs;
-
-       char    *rxctcss[CTCSS_NUM_CODES];              // pointers to each tone in string above
-       char    *txctcss[CTCSS_NUM_CODES];
-
-       i16     rxCtcssMap[CTCSS_NUM_CODES];
-
-       i8              txcodedefaultsmode;
-       i16             txctcssdefault_index;
-       float   txctcssdefault_value;
-
-       char    txctcssfreq[32];                                // encode now
-       char    rxctcssfreq[32];                                // decode now
-       //              end most of signaling code info derived from source
-
-       struct t_lsd_control    *pLsdCtl;
-
-       i16  rptnum;
-       i16  area;
-       char *ukey;
-       u32  idleinterval;
-       char turnoffs;
-
-       char pplock;
-
-       t_dedrift       dd;
-
-       i16 dummy;
-
-       i32 txScramFreq;
-       i32 rxScramFreq;
-
-       i16 gainVoice;
-       i16 gainSubAudible;
-
-       i16 txMixA;                             // Off, Ctcss, Voice, Composite
-       i16 txMixB;                             // Off, Ctcss, Voice, Composite
-       
-       i16 rxMuting;
-
-       i16 rxCpuSaver;
-       i16 txCpuSaver;
-
-       i8      rxSqMode;                       // 0 open, 1 carrier, 2 coded
-
-       i8      cdMethod;
-
-       i16     rxSquelchPoint;
-
-       i16 rxCarrierPoint;
-       i16 rxCarrierHyst;
-       
-       i16 txCtcssTocShift;
-       i16 txCtcssTocTime;
-       i8      txTocType;
-
-       i16 smode;                                                              // ctcss, dcs, lsd
-       i16 smodecode;
-       i16 smodewas;                                                   // ctcss, dcs, lsd
-       i32 smodetimer;                                                 // in ms
-       i32 smodetime;                                                  // to set in ms
-
-       t_dec_ctcss                     *rxCtcss;
-       struct t_dec_dcs        *decDcs;
-       struct t_decLsd         *decLsd;                                                
-       struct t_encLsd         *pLsdEnc;
-
-       i16 clamplitudeDcs;
-       i16 centerDcs;
-       u32 dcsBlankingTimer;
-       i16 dcsDecode;                                                  // current dcs decode value
-
-       i16 clamplitudeLsd;
-       i16 centerLsd;
-
-
-       i16 txPttIn;                    // from external request
-       i16 txPttOut;                   // to radio hardware
-       i16 txPttHid;
-
-       i16 bandwidth;                  // wide/narrow
-       i16 txCompand;                  // type
-       i16 rxCompand;                  // 
-       
-       i16 txEqRight;                  // muted, flat, pre-emp limited filtered
-       i16 txEqLeft;
-
-       i16 txPotRight;                 // 
-       i16 txPotLeft;                  //
-
-       i16 rxPotRight;                 // 
-       i16 rxPotLeft;                  //
-
-       i16 function;
-
-       i16 txState;                            // off,settling,on,hangtime,turnoff
-
-       i16 spsIndex;
-
-       t_pmr_sps *spsMeasure;          // measurement block
-
-       t_pmr_sps *spsRx;                       // 1st signal processing struct
-       t_pmr_sps *spsRxLsd;
-       t_pmr_sps *spsRxLsdNrz;
-       t_pmr_sps *spsRxDeEmp;
-       t_pmr_sps *spsRxHpf;
-       t_pmr_sps *spsRxVox;
-       t_pmr_sps *spsDelayLine;        // Last signal processing struct
-       t_pmr_sps *spsRxOut;            // Last signal processing struct
-
-       t_pmr_sps *spsTx;                       // 1st  signal processing struct
-       
-       t_pmr_sps *spsTxOutA;           // Last signal processing struct
-       t_pmr_sps *spsTxOutB;           // Last signal processing struct
-
-       t_pmr_sps *spsSigGen0;          // ctcss
-       t_pmr_sps *spsSigGen1;          // test and other tones
-       t_pmr_sps *spsLsdGen;
-       t_pmr_sps *spsTxLsdLpf;
-
-       // tune tweaks
-
-       i32 rxVoxTimer;                         // Vox Hang Timer
-
-       i16     *prxSquelchAdjust;
-
-       // i16  *prxNoiseMeasure;       // for autotune
-       // i32  *prxNoiseAdjust;
-
-       i16     *prxVoiceMeasure;
-       i32     *prxVoiceAdjust;        
-       
-       i16     *prxCtcssMeasure;
-       i32     *prxCtcssAdjust;                 
-       
-       i16     *ptxVoiceAdjust;                // from calling application
-       i32     *ptxCtcssAdjust;                // from calling application
-
-       i32     *ptxLimiterAdjust;              // from calling application
-
-       struct {
-               unsigned pmrNoiseSquelch:1;
-               unsigned rxHpf:1;
-               unsigned txHpf:1;
-               unsigned txLpf:1;
-               unsigned rxDeEmphasis:1;
-               unsigned txPreEmphasis:1;
-               unsigned startSpecialTone:1;
-               unsigned stopSpecialTone:1;
-               unsigned doingSpecialTone:1;
-               unsigned extCarrierDetect:1;
-               unsigned txCapture:1;
-               unsigned rxCapture:1;
-               unsigned reprog:1;
-               unsigned radioactive:1;
-               unsigned rxplmon:1;
-               unsigned remoted:1;
-               unsigned loopback:1;
-               unsigned rxpolarity:1;
-               unsigned txpolarity:1;
-               unsigned dcsrxpolarity:1;
-               unsigned dcstxpolarity:1;
-               unsigned lsdrxpolarity:1;
-               unsigned lsdtxpolarity:1;
-               unsigned txsettling:1;
-               unsigned smodeturnoff:1;
-
-               unsigned ctcssRxEnable:1;
-               unsigned ctcssTxEnable:1;
-               unsigned dcsRxEnable:1;
-               unsigned dcsTxEnable:1;
-               unsigned lmrRxEnable:1;
-               unsigned lmrTxEnable:1;
-               unsigned mdcRxEnable:1;
-               unsigned mdcTxEnable:1;
-               unsigned dstRxEnable:1;
-               unsigned dstTxEnable:1;
-               unsigned p25RxEnable:1;
-               unsigned p25TxEnable:1;
-               unsigned ax25Enable:1;
-
-               unsigned txCtcssInhibit:1;
-
-               unsigned rxkeyed:1;
-               unsigned rxhalted:1;
-               unsigned txhalted:1;
-               unsigned pptp_p1:1;
-               unsigned pptp_p2:1;
-               unsigned tuning:1;
-               unsigned pttwas:1;
-       }b;
-
-       i16 *pRxDemod;                          // buffers
-       i16 *pRxBase;                           // decimated lpf input
-       i16 *pRxNoise;   
-       i16 *pRxLsd;                            // subaudible only 
-       i16 *pRxHpf;                            // subaudible removed
-       i16 *pRxDeEmp;                  // EIA Audio
-       i16 *pRxSpeaker;                // EIA Audio
-       i16 *pRxDcTrack;                        // DC Restored LSD
-       i16 *pRxLsdLimit;               // LSD Limited
-       i16 *pRxCtcss;                          //
-       i16 *pRxSquelch;
-       i16 *prxVoxMeas;                                
-       i16 *prxMeasure;
-
-       i16 *pTxInput;                          // input data
-       i16 *pTxBase;                           // input data
-       i16 *pTxHpf;
-       i16 *pTxPreEmp;
-       i16 *pTxLimiter;
-       i16 *pTxLsd;
-       i16 *pTxLsdLpf;
-       i16 *pTxComposite;
-       i16 *pTxMod;                    // upsampled, low pass filtered
-       
-       i16 *pTxOut;                    // 
-
-       i16     *pSigGen0;
-       i16     *pSigGen1;
-
-       i16 *pAlt0;
-       i16 *pAlt1;
-
-       i16 *pNull;
-
-       #if XPMR_DEBUG0 == 1
-
-       i16 *pRxLsdCen;
-
-       i16 *pTstTxOut;
-
-       i16 *prxDebug;                  // consolidated debug buffer
-       i16 *ptxDebug;                  // consolidated debug buffer
-
-       i16 *prxDebug0;
-       i16 *prxDebug1;
-       i16 *prxDebug2;
-       i16 *prxDebug3;
-
-       i16 *ptxDebug0;
-       i16 *ptxDebug1;
-       i16 *ptxDebug2;
-       i16 *ptxDebug3;
-
-       #endif
-
-       i16 numDebugChannels;
-
-       t_sdbg  *sdbg;
-
-} t_pmr_chan;
-
-/*
-       function prototype declarations
-*/
-void           strace(i16 point, t_sdbg *sdbg, i16 index, i16 value);
-void           strace2(t_sdbg *sdbg);
-
-static i16     TxTestTone(t_pmr_chan *pChan, i16 function);
-t_pmr_chan     *createPmrChannel(t_pmr_chan *tChan, i16 numSamples);
-t_pmr_sps      *createPmrSps(t_pmr_chan *pChan);
-i16                    destroyPmrChannel(t_pmr_chan *pChan);
-i16                    destroyPmrSps(t_pmr_sps  *pSps);
-i16            pmr_rx_frontend(t_pmr_sps *mySps);
-i16            pmr_gp_fir(t_pmr_sps *mySps);
-i16            pmr_gp_iir(t_pmr_sps *mySps);
-i16            gp_inte_00(t_pmr_sps *mySps);
-i16            gp_diff(t_pmr_sps *mySps);
-i16            CenterSlicer(t_pmr_sps *mySps);
-i16            ctcss_detect(t_pmr_chan *pmrChan);
-i16            SoftLimiter(t_pmr_sps *mySps);
-i16                    SigGen(t_pmr_sps *mySps);
-i16            pmrMixer(t_pmr_sps *mySps);
-i16            DelayLine(t_pmr_sps *mySps);
-
-i16                    PmrRx(t_pmr_chan *PmrChan, i16 *input, i16 *outputrx, i16 *outputtx );
-i16                    PmrTx(t_pmr_chan *PmrChan, i16 *input);
-
-i16            string_parse(char *src, char **dest, char ***ptrs);
-i16            code_string_parse(t_pmr_chan *pChan);
-
-i16            CtcssFreqIndex(float freq);
-i16            MeasureBlock(t_pmr_sps *mySps);
-
-void           dedrift                 (t_pmr_chan *pChan);
-void           dedrift_write   (t_pmr_chan *pChan, i16 *src);
-
-void           ppspiout        (u32 spidata);
-void           progdtx         (t_pmr_chan *pChan);
-void           ppbinout        (u8 chan);
-
-#if XPMR_PPTP == 1
-void           pptp_init               (void);
-void           pptp_write              (i16 bit, i16 state);
-#endif
-
-#endif /* ! XPMR_H */
-
-/* end of file */
-
-
-
diff --git a/channels/xpmr/xpmr_coef.h b/channels/xpmr/xpmr_coef.h
deleted file mode 100755 (executable)
index 84254e8..0000000
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- * xpmr_coef.h - for Xelatec Private Mobile Radio Processes
- * 
- * All Rights Reserved. Copyright (C)2007, Xelatec, LLC
- * 
- * 20070808 1235 Steven Henke, W9SH, sph@xelatec.com
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
- *              
- * This version may be optionally licenced under the GNU LGPL licence.
- *
- * A license has been granted to Digium (via disclaimer) for the use of
- * this code.
- *
- * Some filter coeficients via 'WinFilter' http://www.winfilter.20m.com.
- *
- */
-
-/*! \file
- *
- * \brief Private Land Mobile Radio Channel Voice and Signaling Processor
- *
- * \author Steven Henke, W9SH <sph@xelatec.com> Xelatec, LLC
- */
-
-#ifndef XPMR_COEF_H
-#define XMPR_COEF_H    1
-
-// frequencies in 0.1 Hz
-static const u32 dtmf_row[] =
-{
-       6970,  7700,  8520,  9410
-};
-static const u32 dtmf_col[] =
-{
-       12090, 13360, 14770, 16330
-};
-
-
-#define CTCSS_COEF_INT         120
-#define CTCSS_SAMPLE_RATE   8000
-#define TDIV(x) ((CTCSS_SAMPLE_RATE*1000/x)+5)/10
-
-#if 0
-static i32 coef_ctcss[4][5]=
-{
-       // freq, divisor, integrator, filter
-       {770,TDIV(770),CTCSS_COEF_INT,0,0},
-       {1000,TDIV(1000),CTCSS_COEF_INT,0,0},
-       {1035,TDIV(1035),CTCSS_COEF_INT,0,0},
-       {0,0,0,0}
-};
-#endif
-
-static i16 coef_ctcss_div[]=
-{
-2985,    // 00   067.0
-2782,    // 01   071.9
-2688,    // 02   074.4
-2597,    // 03   077.0
-2509,    // 04   079.7
-2424,    // 05   082.5
-2342,    // 06   085.4
-2260,    // 07   088.5
-2186,    // 08   091.5
-2110,    // 09   094.8
-2053,    // 10   097.4
-2000,    // 11   100.0
-1932,    // 12   103.5
-1866,    // 13   107.2
-1803,    // 14   110.9
-1742,    // 15   114.8
-1684,    // 16   118.8
-1626,    // 17   123.0
-1571,    // 18   127.3
-1517,    // 19   131.8
-1465,    // 20   136.5
-1415,    // 21   141.3
-1368,    // 22   146.2
-1321,    // 23   151.4
-1276,    // 24   156.7
-1233,    // 25   162.2
-1191,    // 26   167.9
-1151,    // 27   173.8
-1112,    // 28   179.9
-1074,    // 29   186.2
-1037,    // 30   192.8
-983,    // 31   203.5
-949,    // 32   210.7
-917,    // 33   218.1
-886,    // 34   225.7
-856,    // 35   233.6
-827,    // 36   241.8
-799     // 37   250.3
-};
-
-static float freq_ctcss[]=
-{
-067.0,    // 00   
-071.9,    // 01   
-074.4,    // 02   
-077.0,    // 03   
-079.7,    // 04   
-082.5,    // 05   
-085.4,    // 06   
-088.5,    // 07   
-091.5,    // 08   
-094.8,    // 09   
-097.4,    // 10   
-100.0,    // 11   
-103.5,    // 12   
-107.2,    // 13   
-110.9,    // 14   
-114.8,    // 15   
-118.8,    // 16   
-123.0,    // 17   
-127.3,    // 18   
-131.8,    // 19   
-136.5,    // 20   
-141.3,    // 21   
-146.2,    // 22   
-151.4,    // 23   
-156.7,    // 24   
-162.2,    // 25   
-167.9,    // 26   
-173.8,    // 27   
-179.9,    // 28   
-186.2,    // 29   
-192.8,    // 30   
-203.5,    // 31  
-210.7 ,    // 32  
-218.1 ,    // 33  
-225.7 ,    // 34  
-233.6 ,    // 35  
-241.8 ,    // 36  
-250.3      // 37  
-};
-
-/*
-       noise squelch carrier detect filter
-*/
-static const int16_t taps_fir_bpf_noise_1 = 66;
-static const int32_t gain_fir_bpf_noise_1 = 65536;
-static const int16_t coef_fir_bpf_noise_1[] = { 
-      139,
-     -182,
-     -269,
-      -66,
-       56,
-       59,
-      250,
-      395,
-      -80,
-     -775,
-     -557,
-      437,
-      779,
-      210,
-      -17,
-      123,
-     -692,
-    -1664,
-     -256,
-     2495,
-     2237,
-    -1018,
-    -2133,
-     -478,
-    -1134,
-    -2711,
-     2642,
-    10453,
-     4010,
-    -14385,
-    -16488,
-     6954,
-    23030,
-     6954,
-    -16488,
-    -14385,
-     4010,
-    10453,
-     2642,
-    -2711,
-    -1134,
-     -478,
-    -2133,
-    -1018,
-     2237,
-     2495,
-     -256,
-    -1664,
-     -692,
-      123,
-      -17,
-      210,
-      779,
-      437,
-     -557,
-     -775,
-      -80,
-      395,
-      250,
-       59,
-       56,
-      -66,
-     -269,
-     -182,
-      139,
-      257
-};
-/*
-       tbd
-*/
-static const int16_t taps_fir_lpf_3K_1 = 66;
-static const int32_t gain_fir_lpf_3K_1 = 131072;
-static const int16_t coef_fir_lpf_3K_1[] = { 
-      259,
-       58,
-     -185,
-     -437,
-     -654,
-     -793,
-     -815,
-     -696,
-     -434,
-      -48,
-      414,
-      886,
-     1284,
-     1523,
-     1529,
-     1254,
-      691,
-     -117,
-    -1078,
-    -2049,
-    -2854,
-    -3303,
-    -3220,
-    -2472,
-     -995,
-     1187,
-     3952,
-     7086,
-    10300,
-    13270,
-    15672,
-    17236,
-    17778,
-    17236,
-    15672,
-    13270,
-    10300,
-     7086,
-     3952,
-     1187,
-     -995,
-    -2472,
-    -3220,
-    -3303,
-    -2854,
-    -2049,
-    -1078,
-     -117,
-      691,
-     1254,
-     1529,
-     1523,
-     1284,
-      886,
-      414,
-      -48,
-     -434,
-     -696,
-     -815,
-     -793,
-     -654,
-     -437,
-     -185,
-       58,
-      259,
-      393
-};
-
-/**************************************************************
-Filter type: Low Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.250000 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_lpf_250_11_64 = 64;
-static const int32_t gain_fir_lpf_250_11_64 = 262144;
-static const int16_t coef_fir_lpf_250_11_64[] = 
-{
-      366,
-       -3,
-     -418,
-     -865,
-    -1328,
-    -1788,
-    -2223,
-    -2609,
-    -2922,
-    -3138,
-    -3232,
-    -3181,
-    -2967,
-    -2573,
-    -1988,
-    -1206,
-     -228,
-      937,
-     2277,
-     3767,
-     5379,
-     7077,
-     8821,
-    10564,
-    12259,
-    13855,
-    15305,
-    16563,
-    17588,
-    18346,
-    18812,
-    18968,
-    18812,
-    18346,
-    17588,
-    16563,
-    15305,
-    13855,
-    12259,
-    10564,
-     8821,
-     7077,
-     5379,
-     3767,
-     2277,
-      937,
-     -228,
-    -1206,
-    -1988,
-    -2573,
-    -2967,
-    -3181,
-    -3232,
-    -3138,
-    -2922,
-    -2609,
-    -2223,
-    -1788,
-    -1328,
-     -865,
-     -418,
-       -3,
-      366,
-      680
-};
-
-// de-emphasis integrator 300 Hz with 8KS/s
-// a0, b1
-static const int16_t taps_int_lpf_300_1_2 = 2;
-static const int32_t gain_int_lpf_300_1_2 = 8182;
-static const int16_t coef_int_lpf_300_1_2[]={
-6878,
-25889
-};
-
-// pre-emphasis differentiator 4000 Hz with 8KS/s
-// a0,a1,b0,
-static const int16_t taps_int_hpf_4000_1_2 = 2;
-//static const int32_t gain_int_hpf_4000_1_2 = 16384;  // per calculations
-static const int32_t gain_int_hpf_4000_1_2 = 13404; // hand tweaked for unity gain at 1KHz
-static const int16_t coef_int_hpf_4000_1_2[]={
-17610,
--17610,
-2454
-};
-
-
-
-
-/*
-       ctcss decode filter
-*/
-/**************************************************************
-Filter type: Low Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.250000 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_lpf_250_9_66 = 66;
-static const int32_t gain_fir_lpf_250_9_66 = 262144;
-static const int16_t coef_fir_lpf_250_9_66[] = 
-{ 
-  676,
-  364,
-   -3,
- -415,
- -860,
--1320,
--1777,
--2209,
--2593,
--2904,
--3119,
--3212,
--3162,
--2949,
--2557,
--1975,
--1198,
- -226,
-  932,
- 2263,
- 3744,
- 5346,
- 7034,
- 8767,
-10499,
-12184,
-13770,
-15211,
-16462,
-17480,
-18234,
-18696,
-18852,
-18696,
-18234,
-17480,
-16462,
-15211,
-13770,
-12184,
-10499,
- 8767,
- 7034,
- 5346,
- 3744,
- 2263,
-  932,
- -226,
--1198,
--1975,
--2557,
--2949,
--3162,
--3212,
--3119,
--2904,
--2593,
--2209,
--1777,
--1320,
- -860,
- -415,
-   -3,
-  364,
-  676,
-  927
-};
-/* *************************************************************
-Filter type: Low Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.215 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_lpf_215_9_88 = 88;
-static const int32_t gain_fir_lpf_215_9_88 = 524288;
-static const int16_t coef_fir_lpf_215_9_88[] = {
- 2038,
- 2049,
- 1991,
- 1859,
- 1650,
- 1363,
-  999,
-  562,
-   58,
- -502,
--1106,
--1739,
--2382,
--3014,
--3612,
--4153,
--4610,
--4959,
--5172,
--5226,
--5098,
--4769,
--4222,
--3444,
--2430,
--1176,
-  310,
- 2021,
- 3937,
- 6035,
- 8284,
-10648,
-13086,
-15550,
-17993,
-20363,
-22608,
-24677,
-26522,
-28099,
-29369,
-30299,
-30867,
-31058,
-30867,
-30299,
-29369,
-28099,
-26522,
-24677,
-22608,
-20363,
-17993,
-15550,
-13086,
-10648,
- 8284,
- 6035,
- 3937,
- 2021,
-  310,
--1176,
--2430,
--3444,
--4222,
--4769,
--5098,
--5226,
--5172,
--4959,
--4610,
--4153,
--3612,
--3014,
--2382,
--1739,
--1106,
- -502,
-   58,
-  562,
-  999,
- 1363,
- 1650,
- 1859,
- 1991,
- 2049,
- 2038,
- 1966
-};
-// end coef fir_lpf_215_9_88
-//
-/**************************************************************
-Filter type: High Pass
-Filter model: Butterworth
-Filter order: 9
-Sampling Frequency: 8 KHz
-Cut Frequency: 0.300000 KHz
-Coefficents Quantization: 16-bit
-***************************************************************/
-static const int16_t taps_fir_hpf_300_9_66 = 66;
-static const int32_t gain_fir_hpf_300_9_66 = 32768;
-static const int16_t coef_fir_hpf_300_9_66[] = 
-{ 
- -141,
- -114,
-  -77,
-  -30,
-   23,
-   83,
-  147,
-  210,
-  271,
-  324,
-  367,
-  396,
-  407,
-  396,
-  362,
-  302,
-  216,
-  102,
-  -36,
- -199,
- -383,
- -585,
- -798,
--1017,
--1237,
--1452,
--1653,
--1836,
--1995,
--2124,
--2219,
--2278,
-30463,
--2278,
--2219,
--2124,
--1995,
--1836,
--1653,
--1452,
--1237,
--1017,
- -798,
- -585,
- -383,
- -199,
-  -36,
-  102,
-  216,
-  302,
-  362,
-  396,
-  407,
-  396,
-  367,
-  324,
-  271,
-  210,
-  147,
-   83,
-   23,
-  -30,
-  -77,
- -114,
- -141,
- -158
-    };
-#endif /* !XPMR_COEF_H */
-/* end of file */
-
-
-
-
index 62884ab1f30faf410f5e0e358438ad246946e5ba..96c3e3fa57aa7ea573306893f56c90b379007136 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,23 +1,27 @@
 #! /bin/sh
-# From configure.ac Revision: 355375 .
+# From configure.ac Revision: 355620 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for asterisk trunk.
+# Generated by GNU Autoconf 2.68 for asterisk trunk.
 #
 # Report bugs to <https://issues.asterisk.org>.
 #
+#
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 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.
 #
 # "Asterisk"
-## --------------------- ##
-## 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=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -25,23 +29,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   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
-
 as_nl='
 '
 export as_nl
@@ -49,7 +45,13 @@ export as_nl
 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
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# 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
@@ -60,7 +62,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
        expr "X$arg" : "X\\(.*\\)$as_nl";
        arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -83,13 +85,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -99,15 +94,16 @@ fi
 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
 
      ;;
@@ -119,12 +115,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  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='> '
@@ -136,330 +136,307 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# 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 ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-
 # 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
-
-if as_func_ret_success; then
-  :
+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 :
+
+else
+  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 as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+  as_have_required=no
 fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
 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; }
-") 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=:
-  # 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 ;;
-esac
-
-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=:
-  # 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 ;;
-esac
-
-fi
-
-
-:
-(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
-}
-
-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
-
-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
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
+      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
 
-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
+    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: https://issues.asterisk.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
 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
+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
 
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
 
-    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
-
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
 
-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
 
-fi
+# 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
+# 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
 
 
-(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 bug-autoconf@gnu.org about your system,
-  echo including any error possibly output before this message.
-  echo This can help us improve future autoconf versions.
-  echo Configuration will now proceed without shell functions.
-}
-
+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/=
@@ -476,8 +453,7 @@ test \$exitcode = 0") || {
       s/-\n.*//
     ' >$as_me.lineno &&
   chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (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
@@ -487,29 +463,18 @@ 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
@@ -539,7 +504,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
@@ -558,10 +523,10 @@ else
       if test -d "$1"; then
        test -d "$1/.";
       else
-       case $1 in
+       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
   '
@@ -575,11 +540,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 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&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`
 
@@ -594,7 +559,6 @@ cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
 PACKAGE_NAME='asterisk'
@@ -602,6 +566,7 @@ PACKAGE_TARNAME='asterisk'
 PACKAGE_VERSION='trunk'
 PACKAGE_STRING='asterisk trunk'
 PACKAGE_BUGREPORT='https://issues.asterisk.org'
+PACKAGE_URL=''
 
 ac_unique_file="main/asterisk.c"
 # Factoring default headers for most tests.
@@ -725,10 +690,6 @@ PBX_VORBIS
 VORBIS_DIR
 VORBIS_INCLUDE
 VORBIS_LIB
-PBX_USB
-USB_DIR
-USB_INCLUDE
-USB_LIB
 PBX_UNIXODBC
 UNIXODBC_DIR
 UNIXODBC_INCLUDE
@@ -1195,6 +1156,7 @@ bindir
 program_transform_name
 prefix
 exec_prefix
+PACKAGE_URL
 PACKAGE_BUGREPORT
 PACKAGE_STRING
 PACKAGE_VERSION
@@ -1274,7 +1236,6 @@ with_timerfd
 with_tinfo
 with_tonezone
 with_unixodbc
-with_usb
 with_vorbis
 with_vpb
 with_x11
@@ -1358,8 +1319,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.
@@ -1404,8 +1366,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      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
@@ -1431,8 +1392,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      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
@@ -1636,8 +1596,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      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
@@ -1653,8 +1612,7 @@ do
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      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
@@ -1684,17 +1642,17 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { $as_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 &&
-      { $as_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 ;;
 
@@ -1703,7 +1661,7 @@ Try \`$0 --help' for more information." >&2
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1711,15 +1669,13 @@ done
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
-   { (exit 1); exit 1; }; } ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
@@ -1742,8 +1698,7 @@ do
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  { $as_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'
@@ -1757,8 +1712,8 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $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
+    $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
@@ -1773,11 +1728,9 @@ 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 .` ||
-  { $as_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" ||
-  { $as_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.
@@ -1816,13 +1769,11 @@ else
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { $as_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" || { $as_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
@@ -1862,7 +1813,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
@@ -2000,7 +1951,6 @@ Optional Packages:
   --with-tinfo=PATH       use Term Info files in PATH
   --with-tonezone=PATH    use tonezone files in PATH
   --with-unixodbc=PATH    use unixODBC files in PATH
-  --with-usb=PATH         use usb files in PATH
   --with-vorbis=PATH      use Vorbis files in PATH
   --with-vpb=PATH         use Voicetronix API files in PATH
   --with-x11=PATH         use X11 files in PATH
@@ -2012,7 +1962,7 @@ Some influential environment variables:
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
   CXX         C++ compiler command
@@ -2086,10 +2036,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 asterisk configure trunk
-generated by GNU Autoconf 2.63
+generated by GNU Autoconf 2.68
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+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.
 
@@ -2097,12 +2046,900 @@ 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_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------------ ##
+## Report this to https://issues.asterisk.org ##
+## ------------------------------------------ ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_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_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_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_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_cxx_try_compile
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_preproc_warn_flag$ac_cxx_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_cxx_try_cpp
+
+# 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
+
+} # ac_fn_c_try_link
+
+# 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 <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* 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
+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
+
+# 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_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval \${$4+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+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=\$$4
+              { $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_member
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+                       if test $ac_lo -le $ac_mid; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+                       if test $ac_mid -le $ac_hi; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+       return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+       return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+
+# ac_fn_cxx_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_cxx_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_cxx_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_cxx_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_cxx_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------------ ##
+## Report this to https://issues.asterisk.org ##
+## ------------------------------------------ ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_cxx_check_header_mongrel
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_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_cxx_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
+
+} # ac_fn_cxx_try_link
+
+# ac_fn_cxx_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_cxx_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_cxx_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_cxx_check_header_compile
 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 asterisk $as_me trunk, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -2138,8 +2975,8 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  $as_echo "PATH: $as_dir"
-done
+    $as_echo "PATH: $as_dir"
+  done
 IFS=$as_save_IFS
 
 } >&5
@@ -2176,9 +3013,9 @@ do
       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
@@ -2194,13 +3031,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
@@ -2212,11 +3049,9 @@ trap 'exit_status=$?
   {
     echo
 
-    cat <<\_ASBOX
-## ---------------- ##
+    $as_echo "## ---------------- ##
 ## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
     echo
     # The following way of writing the cache mishandles newlines in values,
 (
@@ -2225,13 +3060,13 @@ _ASBOX
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_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) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -2250,11 +3085,9 @@ $as_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
@@ -2267,11 +3100,9 @@ _ASBOX
     echo
 
     if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
+      $as_echo "## ------------------- ##
 ## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
       echo
       for ac_var in $ac_subst_files
       do
@@ -2285,11 +3116,9 @@ _ASBOX
     fi
 
     if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
+      $as_echo "## ----------- ##
 ## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
       echo
       cat confdefs.h
       echo
@@ -2303,46 +3132,53 @@ _ASBOX
     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 an explicitly selected file to automatically selected ones.
 ac_site_file1=NONE
 ac_site_file2=NONE
 if test -n "$CONFIG_SITE"; then
-  ac_site_file1=$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
   ac_site_file1=$prefix/share/config.site
   ac_site_file2=$prefix/etc/config.site
@@ -2353,19 +3189,23 @@ fi
 for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
   test "x$ac_site_file" = xNONE && continue
-  if test -r "$ac_site_file"; then
-    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+  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
-    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+  # 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";;
@@ -2373,12 +3213,15 @@ $as_echo "$as_me: loading cache $cache_file" >&6;}
     esac
   fi
 else
-  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
 $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
-ac_header_list="$ac_header_list utime.h"
+as_fn_append ac_header_list " stdlib.h"
+as_fn_append ac_header_list " unistd.h"
+as_fn_append ac_header_list " sys/param.h"
+as_fn_append ac_header_list " utime.h"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -2389,11 +3232,11 @@ 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,)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+      { $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=: ;;
     ,);;
@@ -2403,17 +3246,17 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
        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:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+         { $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:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+         { $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:$LINENO:   former value:  \`$ac_old_val'" >&5
+       { $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:$LINENO:   current value: \`$ac_new_val'" >&5
+       { $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
@@ -2425,43 +3268,20 @@ $as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
     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
-  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { $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:$LINENO: error: changes in the environment can compromise the build" >&5
+  { $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_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+  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'
@@ -2489,9 +3309,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2505,35 +3323,27 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
+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 &&
-  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_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` ||
-  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_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='-'
@@ -2549,28 +3359,24 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
+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` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_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='-'
@@ -2607,9 +3413,7 @@ for ac_dir in `pwd` "$srcdir"/`pwd`; do
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \`pwd\` \"$srcdir\"/\`pwd\`" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in \`pwd\` \"$srcdir\"/\`pwd\`" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \`pwd\` \"$srcdir\"/\`pwd\`" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2653,9 +3457,9 @@ if test -n "$ac_tool_prefix"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2666,24 +3470,24 @@ 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"
-    $as_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
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2697,9 +3501,9 @@ 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -2710,24 +3514,24 @@ 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"
-    $as_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
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2740,7 +3544,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -2749,57 +3553,37 @@ esac
 fi
 
 
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+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_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&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=$?
-  $as_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
@@ -2815,8 +3599,8 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:$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}: 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:
@@ -2832,17 +3616,17 @@ do
 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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=$?
-  $as_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,
@@ -2859,7 +3643,7 @@ do
        # 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
@@ -2878,84 +3662,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
 else
   ac_file=''
 fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
-  $as_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
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $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:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+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.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_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
-       { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_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
-$as_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
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
 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.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+{ $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"
+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:$LINENO: $ac_try_echo\""
-$as_echo "$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=$?
-  $as_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
@@ -2970,32 +3711,83 @@ for ac_file in conftest.exe conftest conftest.*; do
   esac
 done
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $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:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_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_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+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
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
+if ${ac_cv_objext+:} 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
@@ -3007,17 +3799,17 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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=$?
-  $as_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
@@ -3030,31 +3822,23 @@ else
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $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:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
 fi
-
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
 $as_echo "$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+{ $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 test "${ac_cv_c_compiler_gnu+set}" = set; then
+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
@@ -3068,37 +3852,16 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+{ $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
@@ -3107,20 +3870,16 @@ else
 fi
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
+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
@@ -3131,35 +3890,11 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3170,36 +3905,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
@@ -3210,42 +3921,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+{ $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
@@ -3262,18 +3948,14 @@ else
     CFLAGS=
   fi
 fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+{ $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 test "${ac_cv_prog_cc_c89+set}" = set; then
+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 <stdarg.h>
 #include <stdio.h>
@@ -3330,32 +4012,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
@@ -3366,17 +4025,19 @@ fi
 # AC_CACHE_VAL
 case "x$ac_cv_prog_cc_c89" in
   x)
-    { $as_echo "$as_me:$LINENO: result: none needed" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
 $as_echo "none needed" >&6; } ;;
   xno)
-    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
 $as_echo "unsupported" >&6; } ;;
   *)
     CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+    { $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'
@@ -3391,14 +4052,14 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+{ $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
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -3413,11 +4074,7 @@ do
   # <limits.h> 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 <limits.h>
@@ -3426,78 +4083,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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 <ac_nonexistent.h>
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
 
@@ -3509,7 +4122,7 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+{ $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
@@ -3520,11 +4133,7 @@ do
   # <limits.h> 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 <limits.h>
@@ -3533,87 +4142,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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 <ac_nonexistent.h>
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $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:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -3623,9 +4185,9 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+{ $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 test "${ac_cv_path_GREP+set}" = set; then
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -3636,7 +4198,7 @@ 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_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
@@ -3656,7 +4218,7 @@ case `"$ac_path_GREP" --version 2>&1` in
     $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"
@@ -3671,26 +4233,24 @@ esac
       $ac_path_GREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
 $as_echo "$ac_cv_path_GREP" >&6; }
  GREP="$ac_cv_path_GREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -3704,7 +4264,7 @@ 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_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
@@ -3724,7 +4284,7 @@ case `"$ac_path_EGREP" --version 2>&1` in
     $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"
@@ -3739,12 +4299,10 @@ esac
       $ac_path_EGREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    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
@@ -3752,21 +4310,17 @@ fi
 
    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
 $as_echo "$ac_cv_path_EGREP" >&6; }
  EGREP="$ac_cv_path_EGREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+{ $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 test "${ac_cv_header_stdc+set}" = set; then
+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 <stdlib.h>
 #include <stdarg.h>
@@ -3781,48 +4335,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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 <string.h>
 
 _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
@@ -3832,18 +4361,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 <stdlib.h>
 
 _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
@@ -3853,14 +4378,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 <ctype.h>
 #include <stdlib.h>
@@ -3887,118 +4408,33 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-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
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+{ $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
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
                  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; 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
-/* 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+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
@@ -4009,139 +4445,8 @@ done
 
 
 
-  if test "${ac_cv_header_minix_config_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
-$as_echo_n "checking minix/config.h usability... " >&6; }
-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 <minix/config.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
-$as_echo_n "checking minix/config.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <minix/config.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: minix/config.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
-$as_echo_n "checking for minix/config.h... " >&6; }
-if test "${ac_cv_header_minix_config_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_minix_config_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
-$as_echo "$ac_cv_header_minix_config_h" >&6; }
-
-fi
-if test "x$ac_cv_header_minix_config_h" = x""yes; then
+  ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = xyes; then :
   MINIX=yes
 else
   MINIX=
@@ -4150,34 +4455,23 @@ fi
 
   if test "$MINIX" = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_SOURCE 1
-_ACEOF
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define _POSIX_1_SOURCE 2
-_ACEOF
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define _MINIX 1
-_ACEOF
+$as_echo "#define _MINIX 1" >>confdefs.h
 
   fi
 
 
-
-  { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
-if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
+if ${ac_cv_safe_to_define___extensions__+:} 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.  */
 
 #        define __EXTENSIONS__ 1
@@ -4190,56 +4484,25 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_safe_to_define___extensions__=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_safe_to_define___extensions__=no
+  ac_cv_safe_to_define___extensions__=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
   test $ac_cv_safe_to_define___extensions__ = yes &&
-    cat >>confdefs.h <<\_ACEOF
-#define __EXTENSIONS__ 1
-_ACEOF
+    $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _ALL_SOURCE 1
-_ACEOF
+  $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _GNU_SOURCE 1
-_ACEOF
+  $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _POSIX_PTHREAD_SEMANTICS 1
-_ACEOF
+  $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
 
-  cat >>confdefs.h <<\_ACEOF
-#define _TANDEM_SOURCE 1
-_ACEOF
+  $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
 
 
 # System default paths
@@ -4298,14 +4561,10 @@ case "${host_os}" in
         astvarrundir='/Library/Application Support/Asterisk/Run'
      fi
 
-cat >>confdefs.h <<\_ACEOF
-#define AST_POLL_COMPAT 1
-_ACEOF
+$as_echo "#define AST_POLL_COMPAT 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define _DARWIN_UNLIMITED_SELECT 1
-_ACEOF
+$as_echo "#define _DARWIN_UNLIMITED_SELECT 1" >>confdefs.h
 
      ;;
      solaris*)
@@ -4401,9 +4660,9 @@ esac
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}uname", so it can be a program name with args.
 set dummy ${ac_tool_prefix}uname; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNAME+set}" = set; then
+if ${ac_cv_path_UNAME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNAME in
@@ -4416,14 +4675,14 @@ 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_path_UNAME="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -4431,10 +4690,10 @@ esac
 fi
 UNAME=$ac_cv_path_UNAME
 if test -n "$UNAME"; then
-  { $as_echo "$as_me:$LINENO: result: $UNAME" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNAME" >&5
 $as_echo "$UNAME" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4444,9 +4703,9 @@ if test -z "$ac_cv_path_UNAME"; then
   ac_pt_UNAME=$UNAME
   # Extract the first word of "uname", so it can be a program name with args.
 set dummy uname; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_UNAME+set}" = set; then
+if ${ac_cv_path_ac_pt_UNAME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_UNAME in
@@ -4459,14 +4718,14 @@ 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_path_ac_pt_UNAME="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -4474,10 +4733,10 @@ esac
 fi
 ac_pt_UNAME=$ac_cv_path_ac_pt_UNAME
 if test -n "$ac_pt_UNAME"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_UNAME" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_UNAME" >&5
 $as_echo "$ac_pt_UNAME" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4486,7 +4745,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -4505,17 +4764,15 @@ fi
 
 
 
-
-
 # cross-compile checks
 if test "${cross_compiling}" = "yes";
 then
    if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -4526,24 +4783,24 @@ 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"
-    $as_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
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4553,9 +4810,9 @@ if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -4566,24 +4823,24 @@ 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"
-    $as_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
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4592,7 +4849,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -4605,9 +4862,9 @@ fi
    if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
 set dummy ${ac_tool_prefix}g++; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then
+if ${ac_cv_prog_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CXX"; then
@@ -4618,24 +4875,24 @@ 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_CXX="${ac_tool_prefix}g++"
-    $as_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
 CXX=$ac_cv_prog_CXX
 if test -n "$CXX"; then
-  { $as_echo "$as_me:$LINENO: result: $CXX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
 $as_echo "$CXX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4645,9 +4902,9 @@ if test -z "$ac_cv_prog_CXX"; then
   ac_ct_CXX=$CXX
   # Extract the first word of "g++", so it can be a program name with args.
 set dummy g++; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CXX"; then
@@ -4658,24 +4915,24 @@ 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_CXX="g++"
-    $as_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_CXX=$ac_cv_prog_ac_ct_CXX
 if test -n "$ac_ct_CXX"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
 $as_echo "$ac_ct_CXX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4684,7 +4941,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -4697,9 +4954,9 @@ fi
    if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ld; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_LD+set}" = set; then
+if ${ac_cv_prog_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$LD"; then
@@ -4710,24 +4967,24 @@ 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_LD="${ac_tool_prefix}ld"
-    $as_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
 LD=$ac_cv_prog_LD
 if test -n "$LD"; then
-  { $as_echo "$as_me:$LINENO: result: $LD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
 $as_echo "$LD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4737,9 +4994,9 @@ if test -z "$ac_cv_prog_LD"; then
   ac_ct_LD=$LD
   # Extract the first word of "ld", so it can be a program name with args.
 set dummy ld; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_LD+set}" = set; then
+if ${ac_cv_prog_ac_ct_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_LD"; then
@@ -4750,24 +5007,24 @@ 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_LD="ld"
-    $as_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_LD=$ac_cv_prog_ac_ct_LD
 if test -n "$ac_ct_LD"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_LD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LD" >&5
 $as_echo "$ac_ct_LD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4776,7 +5033,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -4789,9 +5046,9 @@ fi
    if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -4802,24 +5059,24 @@ 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_RANLIB="${ac_tool_prefix}ranlib"
-    $as_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
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
 $as_echo "$RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4829,9 +5086,9 @@ if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -4842,24 +5099,24 @@ 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_RANLIB="ranlib"
-    $as_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_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
 $as_echo "$ac_ct_RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4868,7 +5125,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -4895,9 +5152,9 @@ if test -z "$CXX"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then
+if ${ac_cv_prog_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CXX"; then
@@ -4908,24 +5165,24 @@ 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_CXX="$ac_tool_prefix$ac_prog"
-    $as_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
 CXX=$ac_cv_prog_CXX
 if test -n "$CXX"; then
-  { $as_echo "$as_me:$LINENO: result: $CXX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
 $as_echo "$CXX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4939,9 +5196,9 @@ if test -z "$CXX"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CXX"; then
@@ -4952,24 +5209,24 @@ 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_CXX="$ac_prog"
-    $as_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_CXX=$ac_cv_prog_ac_ct_CXX
 if test -n "$ac_ct_CXX"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
 $as_echo "$ac_ct_CXX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4982,7 +5239,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -4993,53 +5250,36 @@ fi
   fi
 fi
 # Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&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=$?
-  $as_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
 
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+{ $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 test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+if ${ac_cv_cxx_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
@@ -5053,37 +5293,16 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_cxx_try_compile "$LINENO"; then :
   ac_compiler_gnu=yes
 else
-  $as_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_cxx_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
 $as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
 if test $ac_compiler_gnu = yes; then
   GXX=yes
@@ -5092,20 +5311,16 @@ else
 fi
 ac_test_CXXFLAGS=${CXXFLAGS+set}
 ac_save_CXXFLAGS=$CXXFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
 $as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then
+if ${ac_cv_prog_cxx_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_cxx_werror_flag=$ac_cxx_werror_flag
    ac_cxx_werror_flag=yes
    ac_cv_prog_cxx_g=no
    CXXFLAGS="-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
@@ -5116,35 +5331,11 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_cxx_try_compile "$LINENO"; then :
   ac_cv_prog_cxx_g=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       CXXFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -5155,36 +5346,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_cxx_try_compile "$LINENO"; then :
 
-       ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
         CXXFLAGS="-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
@@ -5195,42 +5362,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_cxx_try_compile "$LINENO"; then :
   ac_cv_prog_cxx_g=yes
-else
-  $as_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_cxx_werror_flag=$ac_save_cxx_werror_flag
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
 $as_echo "$ac_cv_prog_cxx_g" >&6; }
 if test "$ac_test_CXXFLAGS" = set; then
   CXXFLAGS=$ac_save_CXXFLAGS
@@ -5258,14 +5400,14 @@ ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+{ $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
+  if ${ac_cv_prog_CPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -5280,11 +5422,7 @@ do
   # <limits.h> 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 <limits.h>
@@ -5293,78 +5431,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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 <ac_nonexistent.h>
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
 
@@ -5376,7 +5470,7 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+{ $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
@@ -5387,11 +5481,7 @@ do
   # <limits.h> 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 <limits.h>
@@ -5400,87 +5490,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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 <ac_nonexistent.h>
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $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:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -5494,10 +5537,10 @@ ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+{ $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; }
 if test -z "$CXXCPP"; then
-  if test "${ac_cv_prog_CXXCPP+set}" = set; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CXXCPP needs to be expanded
@@ -5512,11 +5555,7 @@ do
   # <limits.h> 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 <limits.h>
@@ -5525,78 +5564,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_cxx_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 <ac_nonexistent.h>
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
+if ac_fn_cxx_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_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
 
@@ -5608,7 +5603,7 @@ fi
 else
   ac_cv_prog_CXXCPP=$CXXCPP
 fi
-{ $as_echo "$as_me:$LINENO: result: $CXXCPP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
 $as_echo "$CXXCPP" >&6; }
 ac_preproc_ok=false
 for ac_cxx_preproc_warn_flag in '' yes
@@ -5619,11 +5614,7 @@ do
   # <limits.h> 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 <limits.h>
@@ -5632,87 +5623,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_cxx_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 <ac_nonexistent.h>
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
+if ac_fn_cxx_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_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
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $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:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -5723,9 +5667,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 # This macro is just copied into our local acinclude.m4 from libtool.m4 so that
 # the developers regenerating the configure script don't have to install libtool.
-{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
 $as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
+if ${ac_cv_path_SED+:} false; then :
   $as_echo_n "(cached) " >&6
 else
             ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
@@ -5742,7 +5686,7 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in sed gsed; do
+    for ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
@@ -5762,7 +5706,7 @@ case `"$ac_path_SED" --version 2>&1` in
     $as_echo '' >> "conftest.nl"
     "$ac_path_SED" -f conftest.sed < "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_SED_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_SED="$ac_path_SED"
@@ -5777,26 +5721,24 @@ esac
       $ac_path_SED_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_SED"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
 else
   ac_cv_path_SED=$SED
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
 $as_echo "$ac_cv_path_SED" >&6; }
  SED="$ac_cv_path_SED"
   rm -f conftest.sed
 
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_prog_egrep+set}" = set; then
+if ${ac_cv_prog_egrep+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | (grep -E '(a|b)') >/dev/null 2>&1
@@ -5804,14 +5746,14 @@ else
     else ac_cv_prog_egrep='egrep'
     fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_egrep" >&5
 $as_echo "$ac_cv_prog_egrep" >&6; }
  EGREP=$ac_cv_prog_egrep
 
 
 
 # Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
+if test "${with_gnu_ld+set}" = set; then :
   withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
 else
   with_gnu_ld=no
@@ -5820,7 +5762,7 @@ fi
 ac_prog=ld
 if test "$GCC" = yes; then
   # Check if gcc -print-prog-name=ld gives a path.
-  { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
 $as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
@@ -5850,13 +5792,13 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
     ;;
   esac
 elif test "$with_gnu_ld" = yes; then
-  { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
 $as_echo_n "checking for GNU ld... " >&6; }
 else
-  { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
 $as_echo_n "checking for non-GNU ld... " >&6; }
 fi
-if test "${lt_cv_path_LD+set}" = set; then
+if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
@@ -5887,18 +5829,16 @@ fi
 
 LD="$lt_cv_path_LD"
 if test -n "$LD"; then
-  { $as_echo "$as_me:$LINENO: result: $LD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
 $as_echo "$LD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
+if ${lt_cv_prog_gnu_ld+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   # I'd rather use --version here, but apparently some GNU lds only accept -v.
@@ -5911,7 +5851,7 @@ case `$LD -v 2>&1 </dev/null` in
   ;;
 esac
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
 $as_echo "$lt_cv_prog_gnu_ld" >&6; }
 with_gnu_ld=$lt_cv_prog_gnu_ld
 
@@ -5920,9 +5860,9 @@ for ac_prog in gawk mawk nawk awk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -5933,24 +5873,24 @@ 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_AWK="$ac_prog"
-    $as_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
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
 $as_echo "$AWK" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5972,10 +5912,10 @@ done
 # OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
 # Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+{ $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
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -5983,11 +5923,11 @@ 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.
@@ -6024,7 +5964,7 @@ case $as_dir/ in
     ;;
 esac
 
-done
+  done
 IFS=$as_save_IFS
 
 rm -rf conftest.one conftest.two conftest.dir
@@ -6040,7 +5980,7 @@ fi
     INSTALL=$ac_install_sh
   fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+{ $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}.
@@ -6051,23 +5991,23 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
 $as_echo_n "checking whether ln -s works... " >&6; }
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
 $as_echo "no, using $LN_S" >&6; }
 fi
 
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then
+if ${ac_cv_prog_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$RANLIB"; then
@@ -6078,24 +6018,24 @@ 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_RANLIB="${ac_tool_prefix}ranlib"
-    $as_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
 RANLIB=$ac_cv_prog_RANLIB
 if test -n "$RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
 $as_echo "$RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6105,9 +6045,9 @@ if test -z "$ac_cv_prog_RANLIB"; then
   ac_ct_RANLIB=$RANLIB
   # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_RANLIB"; then
@@ -6118,24 +6058,24 @@ 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_RANLIB="ranlib"
-    $as_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_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
 $as_echo "$ac_ct_RANLIB" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6144,7 +6084,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -6154,9 +6094,9 @@ else
   RANLIB="$ac_cv_prog_RANLIB"
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for GNU make" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU make" >&5
 $as_echo_n "checking for GNU make... " >&6; }
-if test "${ac_cv_GNU_MAKE+set}" = set; then
+if ${ac_cv_GNU_MAKE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_GNU_MAKE='Not Found' ;
@@ -6173,20 +6113,18 @@ else
    done ;
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_GNU_MAKE" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_GNU_MAKE" >&5
 $as_echo "$ac_cv_GNU_MAKE" >&6; } ;
 if test  "x$ac_cv_GNU_MAKE" = "xNot Found"  ; then
-   { { $as_echo "$as_me:$LINENO: error: *** Please install GNU make.  It is required to build Asterisk!" >&5
-$as_echo "$as_me: error: *** Please install GNU make.  It is required to build Asterisk!" >&2;}
-   { (exit 1); exit 1; }; }
+   as_fn_error $? "*** Please install GNU make.  It is required to build Asterisk!" "$LINENO" 5
    exit 1
 fi
 GNU_MAKE=$ac_cv_GNU_MAKE
 
 
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
+if ${ac_cv_path_EGREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -6200,7 +6138,7 @@ 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_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
@@ -6220,7 +6158,7 @@ case `"$ac_path_EGREP" --version 2>&1` in
     $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"
@@ -6235,12 +6173,10 @@ esac
       $ac_path_EGREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    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
@@ -6248,7 +6184,7 @@ fi
 
    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+{ $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"
 
@@ -6259,9 +6195,9 @@ if test -n "$ac_tool_prefix"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -6272,24 +6208,24 @@ 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_STRIP="$ac_tool_prefix$ac_prog"
-    $as_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
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
 $as_echo "$STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6303,9 +6239,9 @@ if test -z "$STRIP"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -6316,24 +6252,24 @@ 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_STRIP="$ac_prog"
-    $as_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_STRIP=$ac_cv_prog_ac_ct_STRIP
 if test -n "$ac_ct_STRIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
 $as_echo "$ac_ct_STRIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6346,7 +6282,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -6359,9 +6295,9 @@ if test -n "$ac_tool_prefix"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then
+if ${ac_cv_prog_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AR"; then
@@ -6372,24 +6308,24 @@ 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_AR="$ac_tool_prefix$ac_prog"
-    $as_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
 AR=$ac_cv_prog_AR
 if test -n "$AR"; then
-  { $as_echo "$as_me:$LINENO: result: $AR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
 $as_echo "$AR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6403,9 +6339,9 @@ if test -z "$AR"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_AR"; then
@@ -6416,24 +6352,24 @@ 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_AR="$ac_prog"
-    $as_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_AR=$ac_cv_prog_ac_ct_AR
 if test -n "$ac_ct_AR"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
 $as_echo "$ac_ct_AR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6446,7 +6382,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -6459,9 +6395,9 @@ if test -n "$ac_tool_prefix"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_SHA1SUM+set}" = set; then
+if ${ac_cv_prog_SHA1SUM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$SHA1SUM"; then
@@ -6472,24 +6408,24 @@ 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_SHA1SUM="$ac_tool_prefix$ac_prog"
-    $as_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
 SHA1SUM=$ac_cv_prog_SHA1SUM
 if test -n "$SHA1SUM"; then
-  { $as_echo "$as_me:$LINENO: result: $SHA1SUM" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHA1SUM" >&5
 $as_echo "$SHA1SUM" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6503,9 +6439,9 @@ if test -z "$SHA1SUM"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_SHA1SUM+set}" = set; then
+if ${ac_cv_prog_ac_ct_SHA1SUM+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_SHA1SUM"; then
@@ -6516,24 +6452,24 @@ 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_SHA1SUM="$ac_prog"
-    $as_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_SHA1SUM=$ac_cv_prog_ac_ct_SHA1SUM
 if test -n "$ac_ct_SHA1SUM"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_SHA1SUM" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_SHA1SUM" >&5
 $as_echo "$ac_ct_SHA1SUM" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6546,7 +6482,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -6559,9 +6495,9 @@ if test -n "$ac_tool_prefix"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OPENSSL+set}" = set; then
+if ${ac_cv_prog_OPENSSL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OPENSSL"; then
@@ -6572,24 +6508,24 @@ 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_OPENSSL="$ac_tool_prefix$ac_prog"
-    $as_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
 OPENSSL=$ac_cv_prog_OPENSSL
 if test -n "$OPENSSL"; then
-  { $as_echo "$as_me:$LINENO: result: $OPENSSL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPENSSL" >&5
 $as_echo "$OPENSSL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6603,9 +6539,9 @@ if test -z "$OPENSSL"; 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
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OPENSSL+set}" = set; then
+if ${ac_cv_prog_ac_ct_OPENSSL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OPENSSL"; then
@@ -6616,24 +6552,24 @@ 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_OPENSSL="$ac_prog"
-    $as_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_OPENSSL=$ac_cv_prog_ac_ct_OPENSSL
 if test -n "$ac_ct_OPENSSL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OPENSSL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OPENSSL" >&5
 $as_echo "$ac_ct_OPENSSL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -6646,7 +6582,7 @@ done
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -6663,9 +6599,9 @@ fi
 
 # Extract the first word of "bison", so it can be a program name with args.
 set dummy bison; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BISON+set}" = set; then
+if ${ac_cv_path_BISON+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $BISON in
@@ -6678,14 +6614,14 @@ 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_path_BISON="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_BISON" && ac_cv_path_BISON=":"
@@ -6694,19 +6630,19 @@ esac
 fi
 BISON=$ac_cv_path_BISON
 if test -n "$BISON"; then
-  { $as_echo "$as_me:$LINENO: result: $BISON" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BISON" >&5
 $as_echo "$BISON" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "cmp", so it can be a program name with args.
 set dummy cmp; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CMP+set}" = set; then
+if ${ac_cv_path_CMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CMP in
@@ -6719,14 +6655,14 @@ 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_path_CMP="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_CMP" && ac_cv_path_CMP=":"
@@ -6735,19 +6671,19 @@ esac
 fi
 CMP=$ac_cv_path_CMP
 if test -n "$CMP"; then
-  { $as_echo "$as_me:$LINENO: result: $CMP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CMP" >&5
 $as_echo "$CMP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FLEX+set}" = set; then
+if ${ac_cv_path_FLEX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $FLEX in
@@ -6760,14 +6696,14 @@ 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_path_FLEX="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_FLEX" && ac_cv_path_FLEX=":"
@@ -6776,19 +6712,19 @@ esac
 fi
 FLEX=$ac_cv_path_FLEX
 if test -n "$FLEX"; then
-  { $as_echo "$as_me:$LINENO: result: $FLEX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FLEX" >&5
 $as_echo "$FLEX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "grep", so it can be a program name with args.
 set dummy grep; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
+if ${ac_cv_path_GREP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $GREP in
@@ -6801,14 +6737,14 @@ 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_path_GREP="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_GREP" && ac_cv_path_GREP=":"
@@ -6817,19 +6753,19 @@ esac
 fi
 GREP=$ac_cv_path_GREP
 if test -n "$GREP"; then
-  { $as_echo "$as_me:$LINENO: result: $GREP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GREP" >&5
 $as_echo "$GREP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "find", so it can be a program name with args.
 set dummy find; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FIND+set}" = set; then
+if ${ac_cv_path_FIND+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $FIND in
@@ -6842,14 +6778,14 @@ 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_path_FIND="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_FIND" && ac_cv_path_FIND=":"
@@ -6858,19 +6794,19 @@ esac
 fi
 FIND=$ac_cv_path_FIND
 if test -n "$FIND"; then
-  { $as_echo "$as_me:$LINENO: result: $FIND" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FIND" >&5
 $as_echo "$FIND" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "compress", so it can be a program name with args.
 set dummy compress; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_COMPRESS+set}" = set; then
+if ${ac_cv_path_COMPRESS+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $COMPRESS in
@@ -6883,14 +6819,14 @@ 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_path_COMPRESS="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_COMPRESS" && ac_cv_path_COMPRESS=":"
@@ -6899,19 +6835,19 @@ esac
 fi
 COMPRESS=$ac_cv_path_COMPRESS
 if test -n "$COMPRESS"; then
-  { $as_echo "$as_me:$LINENO: result: $COMPRESS" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COMPRESS" >&5
 $as_echo "$COMPRESS" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "basename", so it can be a program name with args.
 set dummy basename; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BASENAME+set}" = set; then
+if ${ac_cv_path_BASENAME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $BASENAME in
@@ -6924,14 +6860,14 @@ 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_path_BASENAME="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_BASENAME" && ac_cv_path_BASENAME=":"
@@ -6940,19 +6876,19 @@ esac
 fi
 BASENAME=$ac_cv_path_BASENAME
 if test -n "$BASENAME"; then
-  { $as_echo "$as_me:$LINENO: result: $BASENAME" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASENAME" >&5
 $as_echo "$BASENAME" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "dirname", so it can be a program name with args.
 set dummy dirname; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DIRNAME+set}" = set; then
+if ${ac_cv_path_DIRNAME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $DIRNAME in
@@ -6965,14 +6901,14 @@ 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_path_DIRNAME="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_DIRNAME" && ac_cv_path_DIRNAME=":"
@@ -6981,19 +6917,19 @@ esac
 fi
 DIRNAME=$ac_cv_path_DIRNAME
 if test -n "$DIRNAME"; then
-  { $as_echo "$as_me:$LINENO: result: $DIRNAME" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DIRNAME" >&5
 $as_echo "$DIRNAME" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "sh", so it can be a program name with args.
 set dummy sh; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SHELL+set}" = set; then
+if ${ac_cv_path_SHELL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $SHELL in
@@ -7006,14 +6942,14 @@ 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_path_SHELL="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_SHELL" && ac_cv_path_SHELL=":"
@@ -7022,19 +6958,19 @@ esac
 fi
 SHELL=$ac_cv_path_SHELL
 if test -n "$SHELL"; then
-  { $as_echo "$as_me:$LINENO: result: $SHELL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHELL" >&5
 $as_echo "$SHELL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "ln", so it can be a program name with args.
 set dummy ln; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LN+set}" = set; then
+if ${ac_cv_path_LN+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $LN in
@@ -7047,14 +6983,14 @@ 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_path_LN="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_LN" && ac_cv_path_LN=":"
@@ -7063,19 +6999,19 @@ esac
 fi
 LN=$ac_cv_path_LN
 if test -n "$LN"; then
-  { $as_echo "$as_me:$LINENO: result: $LN" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LN" >&5
 $as_echo "$LN" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "dot", so it can be a program name with args.
 set dummy dot; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DOT+set}" = set; then
+if ${ac_cv_path_DOT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $DOT in
@@ -7088,14 +7024,14 @@ 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_path_DOT="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_DOT" && ac_cv_path_DOT=":"
@@ -7104,19 +7040,19 @@ esac
 fi
 DOT=$ac_cv_path_DOT
 if test -n "$DOT"; then
-  { $as_echo "$as_me:$LINENO: result: $DOT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DOT" >&5
 $as_echo "$DOT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "wget", so it can be a program name with args.
 set dummy wget; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_WGET+set}" = set; then
+if ${ac_cv_path_WGET+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $WGET in
@@ -7129,14 +7065,14 @@ 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_path_WGET="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_WGET" && ac_cv_path_WGET=":"
@@ -7145,19 +7081,19 @@ esac
 fi
 WGET=$ac_cv_path_WGET
 if test -n "$WGET"; then
-  { $as_echo "$as_me:$LINENO: result: $WGET" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WGET" >&5
 $as_echo "$WGET" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "curl", so it can be a program name with args.
 set dummy curl; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CURL+set}" = set; then
+if ${ac_cv_path_CURL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CURL in
@@ -7170,14 +7106,14 @@ 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_path_CURL="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_CURL" && ac_cv_path_CURL=":"
@@ -7186,19 +7122,19 @@ esac
 fi
 CURL=$ac_cv_path_CURL
 if test -n "$CURL"; then
-  { $as_echo "$as_me:$LINENO: result: $CURL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL" >&5
 $as_echo "$CURL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "rubber", so it can be a program name with args.
 set dummy rubber; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_RUBBER+set}" = set; then
+if ${ac_cv_path_RUBBER+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $RUBBER in
@@ -7211,14 +7147,14 @@ 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_path_RUBBER="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_RUBBER" && ac_cv_path_RUBBER=":"
@@ -7227,19 +7163,19 @@ esac
 fi
 RUBBER=$ac_cv_path_RUBBER
 if test -n "$RUBBER"; then
-  { $as_echo "$as_me:$LINENO: result: $RUBBER" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBBER" >&5
 $as_echo "$RUBBER" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "catdvi", so it can be a program name with args.
 set dummy catdvi; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CATDVI+set}" = set; then
+if ${ac_cv_path_CATDVI+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CATDVI in
@@ -7252,14 +7188,14 @@ 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_path_CATDVI="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_CATDVI" && ac_cv_path_CATDVI=":"
@@ -7268,19 +7204,19 @@ esac
 fi
 CATDVI=$ac_cv_path_CATDVI
 if test -n "$CATDVI"; then
-  { $as_echo "$as_me:$LINENO: result: $CATDVI" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CATDVI" >&5
 $as_echo "$CATDVI" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "kpsewhich", so it can be a program name with args.
 set dummy kpsewhich; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_KPATHSEA+set}" = set; then
+if ${ac_cv_path_KPATHSEA+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $KPATHSEA in
@@ -7293,14 +7229,14 @@ 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_path_KPATHSEA="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_KPATHSEA" && ac_cv_path_KPATHSEA=":"
@@ -7309,19 +7245,19 @@ esac
 fi
 KPATHSEA=$ac_cv_path_KPATHSEA
 if test -n "$KPATHSEA"; then
-  { $as_echo "$as_me:$LINENO: result: $KPATHSEA" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $KPATHSEA" >&5
 $as_echo "$KPATHSEA" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "xmllint", so it can be a program name with args.
 set dummy xmllint; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XMLLINT+set}" = set; then
+if ${ac_cv_path_XMLLINT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $XMLLINT in
@@ -7334,14 +7270,14 @@ 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_path_XMLLINT="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_XMLLINT" && ac_cv_path_XMLLINT=":"
@@ -7350,19 +7286,19 @@ esac
 fi
 XMLLINT=$ac_cv_path_XMLLINT
 if test -n "$XMLLINT"; then
-  { $as_echo "$as_me:$LINENO: result: $XMLLINT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5
 $as_echo "$XMLLINT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "xmlstarlet", so it can be a program name with args.
 set dummy xmlstarlet; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XMLSTARLET+set}" = set; then
+if ${ac_cv_path_XMLSTARLET+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $XMLSTARLET in
@@ -7375,14 +7311,14 @@ 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_path_XMLSTARLET="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_XMLSTARLET" && ac_cv_path_XMLSTARLET=":"
@@ -7391,10 +7327,10 @@ esac
 fi
 XMLSTARLET=$ac_cv_path_XMLSTARLET
 if test -n "$XMLSTARLET"; then
-  { $as_echo "$as_me:$LINENO: result: $XMLSTARLET" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLSTARLET" >&5
 $as_echo "$XMLSTARLET" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7406,9 +7342,9 @@ else if test "${CURL}" != ":" ; then
 else
   # Extract the first word of "fetch", so it can be a program name with args.
 set dummy fetch; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FETCH+set}" = set; then
+if ${ac_cv_path_FETCH+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $FETCH in
@@ -7421,14 +7357,14 @@ 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_path_FETCH="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path_FETCH" && ac_cv_path_FETCH=":"
@@ -7437,10 +7373,10 @@ esac
 fi
 FETCH=$ac_cv_path_FETCH
 if test -n "$FETCH"; then
-  { $as_echo "$as_me:$LINENO: result: $FETCH" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FETCH" >&5
 $as_echo "$FETCH" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7450,9 +7386,9 @@ fi
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking for bison that supports parse-param" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bison that supports parse-param" >&5
 $as_echo_n "checking for bison that supports parse-param... " >&6; }
-if test "${ac_cv_path_BISON2+set}" = set; then
+if ${ac_cv_path_BISON2+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -7485,7 +7421,7 @@ __EOL__
        fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_BISON2" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_BISON2" >&5
 $as_echo "$ac_cv_path_BISON2" >&6; }
 if test "x${ac_cv_path_BISON2}" = "x" ; then
        BISON=:
@@ -7504,9 +7440,9 @@ fi
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}soxmix", so it can be a program name with args.
 set dummy ${ac_tool_prefix}soxmix; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_SOXMIX+set}" = set; then
+if ${ac_cv_prog_SOXMIX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$SOXMIX"; then
@@ -7517,24 +7453,24 @@ 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_SOXMIX="${ac_tool_prefix}soxmix"
-    $as_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
 SOXMIX=$ac_cv_prog_SOXMIX
 if test -n "$SOXMIX"; then
-  { $as_echo "$as_me:$LINENO: result: $SOXMIX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOXMIX" >&5
 $as_echo "$SOXMIX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7544,9 +7480,9 @@ if test -z "$ac_cv_prog_SOXMIX"; then
   ac_ct_SOXMIX=$SOXMIX
   # Extract the first word of "soxmix", so it can be a program name with args.
 set dummy soxmix; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_SOXMIX+set}" = set; then
+if ${ac_cv_prog_ac_ct_SOXMIX+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_SOXMIX"; then
@@ -7557,24 +7493,24 @@ 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_SOXMIX="soxmix"
-    $as_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_SOXMIX=$ac_cv_prog_ac_ct_SOXMIX
 if test -n "$ac_ct_SOXMIX"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_SOXMIX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_SOXMIX" >&5
 $as_echo "$ac_ct_SOXMIX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7583,7 +7519,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -7595,9 +7531,7 @@ fi
 
 if test "${SOXMIX}" != ":" ; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SOXMIX 1
-_ACEOF
+$as_echo "#define HAVE_SOXMIX 1" >>confdefs.h
 
 fi
 
@@ -7605,9 +7539,9 @@ for ac_prog in md5 md5sum gmd5sum digest
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_MD5+set}" = set; then
+if ${ac_cv_prog_MD5+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$MD5"; then
@@ -7618,24 +7552,24 @@ 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_MD5="$ac_prog"
-    $as_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
 MD5=$ac_cv_prog_MD5
 if test -n "$MD5"; then
-  { $as_echo "$as_me:$LINENO: result: $MD5" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MD5" >&5
 $as_echo "$MD5" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7671,13 +7605,9 @@ if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
         save_LIBS="$LIBS"
         LIBS="$PTHREAD_LIBS $LIBS"
-        { $as_echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; }
-        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.
@@ -7695,39 +7625,12 @@ return pthread_join ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   acx_pthread_ok=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-        { $as_echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
 $as_echo "$acx_pthread_ok" >&6; }
         if test x"$acx_pthread_ok" = xno; then
                 PTHREAD_LIBS=""
@@ -7789,12 +7692,12 @@ for flag in $acx_pthread_flags; do
 
         case $flag in
                 none)
-                { $as_echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
 $as_echo_n "checking whether pthreads work without any flags... " >&6; }
                 ;;
 
                 -*)
-                { $as_echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5
 $as_echo_n "checking whether pthreads work with $flag... " >&6; }
                 PTHREAD_CFLAGS="$flag"
                 ;;
@@ -7802,9 +7705,9 @@ $as_echo_n "checking whether pthreads work with $flag... " >&6; }
                pthread-config)
                # Extract the first word of "pthread-config", so it can be a program name with args.
 set dummy pthread-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_acx_pthread_config+set}" = set; then
+if ${ac_cv_prog_acx_pthread_config+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$acx_pthread_config"; then
@@ -7815,14 +7718,14 @@ 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_acx_pthread_config="yes"
-    $as_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
 
   test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
@@ -7830,10 +7733,10 @@ fi
 fi
 acx_pthread_config=$ac_cv_prog_acx_pthread_config
 if test -n "$acx_pthread_config"; then
-  { $as_echo "$as_me:$LINENO: result: $acx_pthread_config" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5
 $as_echo "$acx_pthread_config" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -7844,7 +7747,7 @@ fi
                ;;
 
                 *)
-                { $as_echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5
 $as_echo_n "checking for the pthreads library -l$flag... " >&6; }
                 PTHREAD_LIBS="-l$flag"
                 ;;
@@ -7864,11 +7767,7 @@ $as_echo_n "checking for the pthreads library -l$flag... " >&6; }
         # pthread_cleanup_push because it is one of the few pthread
         # functions on Solaris that doesn't have a non-functional libc stub.
         # We try pthread_create on general principles.
-        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 <pthread.h>
 int
@@ -7881,43 +7780,16 @@ pthread_t th; pthread_join(th, 0);
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   acx_pthread_ok=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-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="$save_LIBS"
         CFLAGS="$save_CFLAGS"
 
-        { $as_echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
 $as_echo "$acx_pthread_ok" >&6; }
         if test "x$acx_pthread_ok" = xyes; then
                 break;
@@ -7936,15 +7808,11 @@ if test "x$acx_pthread_ok" = xyes; then
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 
         # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
-       { $as_echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
 $as_echo_n "checking for joinable pthread attribute... " >&6; }
        attr_name=unknown
        for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; 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.  */
 #include <pthread.h>
 int
@@ -7955,40 +7823,13 @@ int attr=$attr; return attr;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   attr_name=$attr; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-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
        done
-        { $as_echo "$as_me:$LINENO: result: $attr_name" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5
 $as_echo "$attr_name" >&6; }
         if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
 
@@ -7998,14 +7839,14 @@ _ACEOF
 
         fi
 
-        { $as_echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
 $as_echo_n "checking if more special flags are required for pthreads... " >&6; }
         flag=no
         case "${host_cpu}-${host_os}" in
             *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
             *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
         esac
-        { $as_echo "$as_me:$LINENO: result: ${flag}" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5
 $as_echo "${flag}" >&6; }
         if test "x$flag" != xno; then
             PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
@@ -8020,9 +7861,9 @@ $as_echo "${flag}" >&6; }
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then
+if ${ac_cv_prog_PTHREAD_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PTHREAD_CC"; then
@@ -8033,24 +7874,24 @@ 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_PTHREAD_CC="$ac_prog"
-    $as_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
 PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
 if test -n "$PTHREAD_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTHREAD_CC" >&5
 $as_echo "$PTHREAD_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -8073,9 +7914,7 @@ fi
 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 if test x"$acx_pthread_ok" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD 1
-_ACEOF
+$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
 
         :
 else
@@ -8098,7 +7937,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 # Check whether --enable-dev-mode was given.
-if test "${enable_dev_mode+set}" = set; then
+if test "${enable_dev_mode+set}" = set; then :
   enableval=$enable_dev_mode; case "${enableval}" in
              y|ye|yes) AST_DEVMODE=yes ;;
              n|no)  AST_DEVMODE=no ;;
@@ -8106,9 +7945,7 @@ if test "${enable_dev_mode+set}" = set; then
              AST_DEVMODE=yes
              NOISY_BUILD=yes
              ;;
-             *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-dev-mode" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-dev-mode" >&2;}
-   { (exit 1); exit 1; }; }  ;;
+             *) as_fn_error $? "bad value ${enableval} for --enable-dev-mode" "$LINENO" 5  ;;
        esac
 fi
 
@@ -8117,13 +7954,11 @@ fi
 
 AST_CODE_COVERAGE=no
 # Check whether --enable-coverage was given.
-if test "${enable_coverage+set}" = set; then
+if test "${enable_coverage+set}" = set; then :
   enableval=$enable_coverage; case "${enableval}" in
              y|ye|yes) AST_CODE_COVERAGE=yes ;;
              n|no) AST_CODE_COVERAGE=no ;;
-             *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-coverage" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-coverage" >&2;}
-   { (exit 1); exit 1; }; }  ;;
+             *) as_fn_error $? "bad value ${enableval} for --enable-coverage" "$LINENO" 5  ;;
        esac
 fi
 
@@ -8145,7 +7980,7 @@ fi
     PBX_ALSA=0
 
 # Check whether --with-asound was given.
-if test "${with_asound+set}" = set; then
+if test "${with_asound+set}" = set; then :
   withval=$with_asound;
        case ${withval} in
        n|no)
@@ -8172,13 +8007,12 @@ fi
 
 
 
-
     BFD_DESCRIP="Debug symbol decoding"
     BFD_OPTION="bfd"
     PBX_BFD=0
 
 # Check whether --with-bfd was given.
-if test "${with_bfd+set}" = set; then
+if test "${with_bfd+set}" = set; then :
   withval=$with_bfd;
        case ${withval} in
        n|no)
@@ -8205,7 +8039,6 @@ fi
 
 
 
-
 # BKTR is used for backtrace support on platforms that do not
 # have it natively.
 
@@ -8214,7 +8047,7 @@ fi
     PBX_BKTR=0
 
 # Check whether --with-execinfo was given.
-if test "${with_execinfo+set}" = set; then
+if test "${with_execinfo+set}" = set; then :
   withval=$with_execinfo;
        case ${withval} in
        n|no)
@@ -8241,13 +8074,12 @@ fi
 
 
 
-
     BLUETOOTH_DESCRIP="Bluetooth"
     BLUETOOTH_OPTION="bluetooth"
     PBX_BLUETOOTH=0
 
 # Check whether --with-bluetooth was given.
-if test "${with_bluetooth+set}" = set; then
+if test "${with_bluetooth+set}" = set; then :
   withval=$with_bluetooth;
        case ${withval} in
        n|no)
@@ -8274,13 +8106,12 @@ fi
 
 
 
-
     CAP_DESCRIP="POSIX 1.e capabilities"
     CAP_OPTION="cap"
     PBX_CAP=0
 
 # Check whether --with-cap was given.
-if test "${with_cap+set}" = set; then
+if test "${with_cap+set}" = set; then :
   withval=$with_cap;
        case ${withval} in
        n|no)
@@ -8307,13 +8138,12 @@ fi
 
 
 
-
     CURSES_DESCRIP="curses"
     CURSES_OPTION="curses"
     PBX_CURSES=0
 
 # Check whether --with-curses was given.
-if test "${with_curses+set}" = set; then
+if test "${with_curses+set}" = set; then :
   withval=$with_curses;
        case ${withval} in
        n|no)
@@ -8340,13 +8170,12 @@ fi
 
 
 
-
     CRYPTO_DESCRIP="OpenSSL Cryptography"
     CRYPTO_OPTION="crypto"
     PBX_CRYPTO=0
 
 # Check whether --with-crypto was given.
-if test "${with_crypto+set}" = set; then
+if test "${with_crypto+set}" = set; then :
   withval=$with_crypto;
        case ${withval} in
        n|no)
@@ -8373,13 +8202,12 @@ fi
 
 
 
-
     DAHDI_DESCRIP="DAHDI"
     DAHDI_OPTION="dahdi"
     PBX_DAHDI=0
 
 # Check whether --with-dahdi was given.
-if test "${with_dahdi+set}" = set; then
+if test "${with_dahdi+set}" = set; then :
   withval=$with_dahdi;
        case ${withval} in
        n|no)
@@ -8406,13 +8234,12 @@ fi
 
 
 
-
     FFMPEG_DESCRIP="Ffmpeg and avcodec"
     FFMPEG_OPTION="avcodec"
     PBX_FFMPEG=0
 
 # Check whether --with-avcodec was given.
-if test "${with_avcodec+set}" = set; then
+if test "${with_avcodec+set}" = set; then :
   withval=$with_avcodec;
        case ${withval} in
        n|no)
@@ -8439,13 +8266,12 @@ fi
 
 
 
-
     GSM_DESCRIP="External GSM"
     GSM_OPTION="gsm"
     PBX_GSM=0
 
 # Check whether --with-gsm was given.
-if test "${with_gsm+set}" = set; then
+if test "${with_gsm+set}" = set; then :
   withval=$with_gsm;
        case ${withval} in
        n|no)
@@ -8472,13 +8298,12 @@ fi
 
 
 
-
     GTK2_DESCRIP="gtk2"
     GTK2_OPTION="gtk2"
     PBX_GTK2=0
 
 # Check whether --with-gtk2 was given.
-if test "${with_gtk2+set}" = set; then
+if test "${with_gtk2+set}" = set; then :
   withval=$with_gtk2;
        case ${withval} in
        n|no)
@@ -8505,13 +8330,12 @@ fi
 
 
 
-
     GMIME_DESCRIP="GMime"
     GMIME_OPTION="gmime"
     PBX_GMIME=0
 
 # Check whether --with-gmime was given.
-if test "${with_gmime+set}" = set; then
+if test "${with_gmime+set}" = set; then :
   withval=$with_gmime;
        case ${withval} in
        n|no)
@@ -8538,13 +8362,12 @@ fi
 
 
 
-
     OPENH323_DESCRIP="OpenH323"
     OPENH323_OPTION="h323"
     PBX_OPENH323=0
 
 # Check whether --with-h323 was given.
-if test "${with_h323+set}" = set; then
+if test "${with_h323+set}" = set; then :
   withval=$with_h323;
        case ${withval} in
        n|no)
@@ -8571,13 +8394,12 @@ fi
 
 
 
-
     HOARD_DESCRIP="Hoard Memory Allocator"
     HOARD_OPTION="hoard"
     PBX_HOARD=0
 
 # Check whether --with-hoard was given.
-if test "${with_hoard+set}" = set; then
+if test "${with_hoard+set}" = set; then :
   withval=$with_hoard;
        case ${withval} in
        n|no)
@@ -8604,13 +8426,12 @@ fi
 
 
 
-
     ICAL_DESCRIP="iCal"
     ICAL_OPTION="ical"
     PBX_ICAL=0
 
 # Check whether --with-ical was given.
-if test "${with_ical+set}" = set; then
+if test "${with_ical+set}" = set; then :
   withval=$with_ical;
        case ${withval} in
        n|no)
@@ -8637,13 +8458,12 @@ fi
 
 
 
-
     ICONV_DESCRIP="Iconv"
     ICONV_OPTION="iconv"
     PBX_ICONV=0
 
 # Check whether --with-iconv was given.
-if test "${with_iconv+set}" = set; then
+if test "${with_iconv+set}" = set; then :
   withval=$with_iconv;
        case ${withval} in
        n|no)
@@ -8670,13 +8490,12 @@ fi
 
 
 
-
     IKSEMEL_DESCRIP="Iksemel Jabber"
     IKSEMEL_OPTION="iksemel"
     PBX_IKSEMEL=0
 
 # Check whether --with-iksemel was given.
-if test "${with_iksemel+set}" = set; then
+if test "${with_iksemel+set}" = set; then :
   withval=$with_iksemel;
        case ${withval} in
        n|no)
@@ -8703,13 +8522,12 @@ fi
 
 
 
-
     IMAP_TK_DESCRIP="UW IMAP Toolkit"
     IMAP_TK_OPTION="imap"
     PBX_IMAP_TK=0
 
 # Check whether --with-imap was given.
-if test "${with_imap+set}" = set; then
+if test "${with_imap+set}" = set; then :
   withval=$with_imap;
        case ${withval} in
        n|no)
@@ -8736,13 +8554,12 @@ fi
 
 
 
-
     INOTIFY_DESCRIP="inotify support"
     INOTIFY_OPTION="inotify"
     PBX_INOTIFY=0
 
 # Check whether --with-inotify was given.
-if test "${with_inotify+set}" = set; then
+if test "${with_inotify+set}" = set; then :
   withval=$with_inotify;
        case ${withval} in
        n|no)
@@ -8769,13 +8586,12 @@ fi
 
 
 
-
     IODBC_DESCRIP="iODBC"
     IODBC_OPTION="iodbc"
     PBX_IODBC=0
 
 # Check whether --with-iodbc was given.
-if test "${with_iodbc+set}" = set; then
+if test "${with_iodbc+set}" = set; then :
   withval=$with_iodbc;
        case ${withval} in
        n|no)
@@ -8802,13 +8618,12 @@ fi
 
 
 
-
     ISDNNET_DESCRIP="ISDN4Linux"
     ISDNNET_OPTION="isdnnet"
     PBX_ISDNNET=0
 
 # Check whether --with-isdnnet was given.
-if test "${with_isdnnet+set}" = set; then
+if test "${with_isdnnet+set}" = set; then :
   withval=$with_isdnnet;
        case ${withval} in
        n|no)
@@ -8835,13 +8650,12 @@ fi
 
 
 
-
     JACK_DESCRIP="Jack Audio Connection Kit"
     JACK_OPTION="jack"
     PBX_JACK=0
 
 # Check whether --with-jack was given.
-if test "${with_jack+set}" = set; then
+if test "${with_jack+set}" = set; then :
   withval=$with_jack;
        case ${withval} in
        n|no)
@@ -8868,13 +8682,12 @@ fi
 
 
 
-
     KQUEUE_DESCRIP="kqueue support"
     KQUEUE_OPTION="kqueue"
     PBX_KQUEUE=0
 
 # Check whether --with-kqueue was given.
-if test "${with_kqueue+set}" = set; then
+if test "${with_kqueue+set}" = set; then :
   withval=$with_kqueue;
        case ${withval} in
        n|no)
@@ -8901,13 +8714,12 @@ fi
 
 
 
-
     LDAP_DESCRIP="OpenLDAP"
     LDAP_OPTION="ldap"
     PBX_LDAP=0
 
 # Check whether --with-ldap was given.
-if test "${with_ldap+set}" = set; then
+if test "${with_ldap+set}" = set; then :
   withval=$with_ldap;
        case ${withval} in
        n|no)
@@ -8946,24 +8758,6 @@ fi
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 
 
 
@@ -8974,7 +8768,7 @@ fi
 
 
 # Check whether --with-libcurl was given.
-if test "${with_libcurl+set}" = set; then
+if test "${with_libcurl+set}" = set; then :
   withval=$with_libcurl; _libcurl_with=$withval
 else
   _libcurl_with=yes
@@ -8987,9 +8781,9 @@ fi
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -9000,24 +8794,24 @@ 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_AWK="$ac_prog"
-    $as_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
 AWK=$ac_cv_prog_AWK
 if test -n "$AWK"; then
-  { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
 $as_echo "$AWK" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -9035,9 +8829,9 @@ done
         _libcurl_ldflags="-L$withval/lib"
         # Extract the first word of "curl-config", so it can be a program name with args.
 set dummy curl-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path__libcurl_config+set}" = set; then
+if ${ac_cv_path__libcurl_config+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $_libcurl_config in
@@ -9050,14 +8844,14 @@ for as_dir in "$withval/bin"
 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_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   test -z "$ac_cv_path__libcurl_config" && ac_cv_path__libcurl_config=""$withval/bin""
@@ -9066,10 +8860,10 @@ esac
 fi
 _libcurl_config=$ac_cv_path__libcurl_config
 if test -n "$_libcurl_config"; then
-  { $as_echo "$as_me:$LINENO: result: $_libcurl_config" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5
 $as_echo "$_libcurl_config" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -9077,9 +8871,9 @@ fi
      else
         # Extract the first word of "curl-config", so it can be a program name with args.
 set dummy curl-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path__libcurl_config+set}" = set; then
+if ${ac_cv_path__libcurl_config+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $_libcurl_config in
@@ -9092,14 +8886,14 @@ 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_path__libcurl_config="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -9107,10 +8901,10 @@ esac
 fi
 _libcurl_config=$ac_cv_path__libcurl_config
 if test -n "$_libcurl_config"; then
-  { $as_echo "$as_me:$LINENO: result: $_libcurl_config" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_libcurl_config" >&5
 $as_echo "$_libcurl_config" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -9118,23 +8912,23 @@ fi
      fi
 
      if test x$_libcurl_config != "x" ; then
-        { $as_echo "$as_me:$LINENO: checking for the version of libcurl" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the version of libcurl" >&5
 $as_echo_n "checking for the version of libcurl... " >&6; }
-if test "${libcurl_cv_lib_curl_version+set}" = set; then
+if ${libcurl_cv_lib_curl_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $2}'`
 fi
-{ $as_echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_version" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_version" >&5
 $as_echo "$libcurl_cv_lib_curl_version" >&6; }
 
         _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse`
         _libcurl_wanted=`echo 7.10.1 | $_libcurl_version_parse`
 
         if test $_libcurl_wanted -gt 0 ; then
-           { $as_echo "$as_me:$LINENO: checking for libcurl >= version 7.10.1" >&5
+           { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libcurl >= version 7.10.1" >&5
 $as_echo_n "checking for libcurl >= version 7.10.1... " >&6; }
-if test "${libcurl_cv_lib_version_ok+set}" = set; then
+if ${libcurl_cv_lib_version_ok+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -9145,7 +8939,7 @@ else
               fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $libcurl_cv_lib_version_ok" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_version_ok" >&5
 $as_echo "$libcurl_cv_lib_version_ok" >&6; }
         fi
 
@@ -9186,9 +8980,9 @@ $as_echo "$libcurl_cv_lib_version_ok" >&6; }
         # link line (or failing that, "-lcurl") is enough.
         CURL_LIB=${CURL_LIB-"$_libcurl_ldflags -lcurl"}
 
-        { $as_echo "$as_me:$LINENO: checking whether libcurl is usable" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether libcurl is usable" >&5
 $as_echo_n "checking whether libcurl is usable... " >&6; }
-if test "${libcurl_cv_lib_curl_usable+set}" = set; then
+if ${libcurl_cv_lib_curl_usable+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -9197,11 +8991,7 @@ else
            _libcurl_save_libs=$LIBS
            LIBS="$CURL_LIB $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.  */
 #include <curl/curl.h>
 int
@@ -9223,38 +9013,13 @@ x=CURLOPT_VERBOSE;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   libcurl_cv_lib_curl_usable=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       libcurl_cv_lib_curl_usable=no
+  libcurl_cv_lib_curl_usable=no
 fi
-
-rm -rf conftest.dSYM
-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
 
            CPPFLAGS=$_libcurl_save_cppflags
            LIBS=$_libcurl_save_libs
@@ -9262,7 +9027,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
            unset _libcurl_save_libs
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $libcurl_cv_lib_curl_usable" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libcurl_cv_lib_curl_usable" >&5
 $as_echo "$libcurl_cv_lib_curl_usable" >&6; }
 
         if test $libcurl_cv_lib_curl_usable = yes ; then
@@ -9275,98 +9040,12 @@ $as_echo "$libcurl_cv_lib_curl_usable" >&6; }
            _libcurl_save_libs=$LIBS
            LIBS="$LIBS $CURL_LIB"
 
-           { $as_echo "$as_me:$LINENO: checking for curl_free" >&5
-$as_echo_n "checking for curl_free... " >&6; }
-if test "${ac_cv_func_curl_free+set}" = set; 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
-/* end confdefs.h.  */
-/* Define curl_free to an innocuous variant, in case <limits.h> declares curl_free.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define curl_free innocuous_curl_free
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char curl_free (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef curl_free
-
-/* 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 curl_free ();
-/* 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_curl_free || defined __stub___curl_free
-choke me
-#endif
-
-int
-main ()
-{
-return curl_free ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_curl_free=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_curl_free=no
-fi
+           ac_fn_c_check_func "$LINENO" "curl_free" "ac_cv_func_curl_free"
+if test "x$ac_cv_func_curl_free" = xyes; then :
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_curl_free" >&5
-$as_echo "$ac_cv_func_curl_free" >&6; }
-if test "x$ac_cv_func_curl_free" = x""yes; then
-  :
 else
 
-cat >>confdefs.h <<\_ACEOF
-#define curl_free free
-_ACEOF
+$as_echo "#define curl_free free" >>confdefs.h
 
 fi
 
@@ -9377,9 +9056,7 @@ fi
            unset _libcurl_save_libs
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CURL 1
-_ACEOF
+$as_echo "#define HAVE_CURL 1" >>confdefs.h
 
 
 
@@ -9451,7 +9128,7 @@ _ACEOF
     PBX_LIBXML2=0
 
 # Check whether --with-libxml2 was given.
-if test "${with_libxml2+set}" = set; then
+if test "${with_libxml2+set}" = set; then :
   withval=$with_libxml2;
        case ${withval} in
        n|no)
@@ -9478,13 +9155,12 @@ fi
 
 
 
-
     LTDL_DESCRIP="libtool"
     LTDL_OPTION="ltdl"
     PBX_LTDL=0
 
 # Check whether --with-ltdl was given.
-if test "${with_ltdl+set}" = set; then
+if test "${with_ltdl+set}" = set; then :
   withval=$with_ltdl;
        case ${withval} in
        n|no)
@@ -9511,13 +9187,12 @@ fi
 
 
 
-
     LUA_DESCRIP="Lua"
     LUA_OPTION="lua"
     PBX_LUA=0
 
 # Check whether --with-lua was given.
-if test "${with_lua+set}" = set; then
+if test "${with_lua+set}" = set; then :
   withval=$with_lua;
        case ${withval} in
        n|no)
@@ -9544,13 +9219,12 @@ fi
 
 
 
-
     MISDN_DESCRIP="mISDN user"
     MISDN_OPTION="misdn"
     PBX_MISDN=0
 
 # Check whether --with-misdn was given.
-if test "${with_misdn+set}" = set; then
+if test "${with_misdn+set}" = set; then :
   withval=$with_misdn;
        case ${withval} in
        n|no)
@@ -9577,13 +9251,12 @@ fi
 
 
 
-
     MYSQLCLIENT_DESCRIP="MySQL client"
     MYSQLCLIENT_OPTION="mysqlclient"
     PBX_MYSQLCLIENT=0
 
 # Check whether --with-mysqlclient was given.
-if test "${with_mysqlclient+set}" = set; then
+if test "${with_mysqlclient+set}" = set; then :
   withval=$with_mysqlclient;
        case ${withval} in
        n|no)
@@ -9610,13 +9283,12 @@ fi
 
 
 
-
     NBS_DESCRIP="Network Broadcast Sound"
     NBS_OPTION="nbs"
     PBX_NBS=0
 
 # Check whether --with-nbs was given.
-if test "${with_nbs+set}" = set; then
+if test "${with_nbs+set}" = set; then :
   withval=$with_nbs;
        case ${withval} in
        n|no)
@@ -9643,13 +9315,12 @@ fi
 
 
 
-
     NCURSES_DESCRIP="ncurses"
     NCURSES_OPTION="ncurses"
     PBX_NCURSES=0
 
 # Check whether --with-ncurses was given.
-if test "${with_ncurses+set}" = set; then
+if test "${with_ncurses+set}" = set; then :
   withval=$with_ncurses;
        case ${withval} in
        n|no)
@@ -9676,13 +9347,12 @@ fi
 
 
 
-
     NEON_DESCRIP="neon"
     NEON_OPTION="neon"
     PBX_NEON=0
 
 # Check whether --with-neon was given.
-if test "${with_neon+set}" = set; then
+if test "${with_neon+set}" = set; then :
   withval=$with_neon;
        case ${withval} in
        n|no)
@@ -9709,13 +9379,12 @@ fi
 
 
 
-
     NEON29_DESCRIP="neon29"
     NEON29_OPTION="neon29"
     PBX_NEON29=0
 
 # Check whether --with-neon29 was given.
-if test "${with_neon29+set}" = set; then
+if test "${with_neon29+set}" = set; then :
   withval=$with_neon29;
        case ${withval} in
        n|no)
@@ -9742,13 +9411,12 @@ fi
 
 
 
-
     NETSNMP_DESCRIP="Net-SNMP"
     NETSNMP_OPTION="netsnmp"
     PBX_NETSNMP=0
 
 # Check whether --with-netsnmp was given.
-if test "${with_netsnmp+set}" = set; then
+if test "${with_netsnmp+set}" = set; then :
   withval=$with_netsnmp;
        case ${withval} in
        n|no)
@@ -9775,13 +9443,12 @@ fi
 
 
 
-
     NEWT_DESCRIP="newt"
     NEWT_OPTION="newt"
     PBX_NEWT=0
 
 # Check whether --with-newt was given.
-if test "${with_newt+set}" = set; then
+if test "${with_newt+set}" = set; then :
   withval=$with_newt;
        case ${withval} in
        n|no)
@@ -9808,13 +9475,12 @@ fi
 
 
 
-
     OGG_DESCRIP="OGG"
     OGG_OPTION="ogg"
     PBX_OGG=0
 
 # Check whether --with-ogg was given.
-if test "${with_ogg+set}" = set; then
+if test "${with_ogg+set}" = set; then :
   withval=$with_ogg;
        case ${withval} in
        n|no)
@@ -9841,13 +9507,12 @@ fi
 
 
 
-
     OPENAIS_DESCRIP="OpenAIS"
     OPENAIS_OPTION="openais"
     PBX_OPENAIS=0
 
 # Check whether --with-openais was given.
-if test "${with_openais+set}" = set; then
+if test "${with_openais+set}" = set; then :
   withval=$with_openais;
        case ${withval} in
        n|no)
@@ -9874,13 +9539,12 @@ fi
 
 
 
-
     OPENR2_DESCRIP="MFR2"
     OPENR2_OPTION="openr2"
     PBX_OPENR2=0
 
 # Check whether --with-openr2 was given.
-if test "${with_openr2+set}" = set; then
+if test "${with_openr2+set}" = set; then :
   withval=$with_openr2;
        case ${withval} in
        n|no)
@@ -9907,13 +9571,12 @@ fi
 
 
 
-
     OSPTK_DESCRIP="OSP Toolkit"
     OSPTK_OPTION="osptk"
     PBX_OSPTK=0
 
 # Check whether --with-osptk was given.
-if test "${with_osptk+set}" = set; then
+if test "${with_osptk+set}" = set; then :
   withval=$with_osptk;
        case ${withval} in
        n|no)
@@ -9940,13 +9603,12 @@ fi
 
 
 
-
     OSS_DESCRIP="Open Sound System"
     OSS_OPTION="oss"
     PBX_OSS=0
 
 # Check whether --with-oss was given.
-if test "${with_oss+set}" = set; then
+if test "${with_oss+set}" = set; then :
   withval=$with_oss;
        case ${withval} in
        n|no)
@@ -9973,13 +9635,12 @@ fi
 
 
 
-
     PGSQL_DESCRIP="PostgreSQL"
     PGSQL_OPTION="postgres"
     PBX_PGSQL=0
 
 # Check whether --with-postgres was given.
-if test "${with_postgres+set}" = set; then
+if test "${with_postgres+set}" = set; then :
   withval=$with_postgres;
        case ${withval} in
        n|no)
 
 
 
-
     POPT_DESCRIP="popt"
     POPT_OPTION="popt"
     PBX_POPT=0
 
 # Check whether --with-popt was given.
-if test "${with_popt+set}" = set; then
+if test "${with_popt+set}" = set; then :
   withval=$with_popt;
        case ${withval} in
        n|no)
 
 
 
-
     PORTAUDIO_DESCRIP="PortAudio"
     PORTAUDIO_OPTION="portaudio"
     PBX_PORTAUDIO=0
 
 # Check whether --with-portaudio was given.
-if test "${with_portaudio+set}" = set; then
+if test "${with_portaudio+set}" = set; then :
   withval=$with_portaudio;
        case ${withval} in
        n|no)
 
 
 
-
     PRI_DESCRIP="ISDN PRI"
     PRI_OPTION="pri"
     PBX_PRI=0
 
 # Check whether --with-pri was given.
-if test "${with_pri+set}" = set; then
+if test "${with_pri+set}" = set; then :
   withval=$with_pri;
        case ${withval} in
        n|no)
@@ -10105,7 +9763,6 @@ fi
 
 
 
-
 PRI_L2_PERSISTENCE_DESCRIP="ISDN Layer 2 persistence option"
 PRI_L2_PERSISTENCE_OPTION=pri
 PRI_L2_PERSISTENCE_DIR=${PRI_DIR}
@@ -10118,7 +9775,6 @@ PBX_PRI_L2_PERSISTENCE=0
 
 
 
-
 PRI_DATETIME_SEND_DESCRIP="ISDN PRI Date/time ie send policy"
 PRI_DATETIME_SEND_OPTION=pri
 PRI_DATETIME_SEND_DIR=${PRI_DIR}
@@ -10131,7 +9787,6 @@ PBX_PRI_DATETIME_SEND=0
 
 
 
-
 PRI_MWI_V2_DESCRIP="ISDN PRI Message Waiting Indication (Fixed)"
 PRI_MWI_V2_OPTION=pri
 PRI_MWI_V2_DIR=${PRI_DIR}
@@ -10144,7 +9799,6 @@ PBX_PRI_MWI_V2=0
 
 
 
-
 PRI_DISPLAY_TEXT_DESCRIP="ISDN PRI user display text IE contents during call"
 PRI_DISPLAY_TEXT_OPTION=pri
 PRI_DISPLAY_TEXT_DIR=${PRI_DIR}
@@ -10157,7 +9811,6 @@ PBX_PRI_DISPLAY_TEXT=0
 
 
 
-
 PRI_MWI_DESCRIP="ISDN PRI Message Waiting Indication"
 PRI_MWI_OPTION=pri
 PRI_MWI_DIR=${PRI_DIR}
@@ -10170,7 +9823,6 @@ PBX_PRI_MWI=0
 
 
 
-
 PRI_MCID_DESCRIP="ISDN PRI Malicious Call ID"
 PRI_MCID_OPTION=pri
 PRI_MCID_DIR=${PRI_DIR}
@@ -10183,7 +9835,6 @@ PBX_PRI_MCID=0
 
 
 
-
 PRI_CALL_WAITING_DESCRIP="ISDN PRI call waiting supplementary service"
 PRI_CALL_WAITING_OPTION=pri
 PRI_CALL_WAITING_DIR=${PRI_DIR}
@@ -10196,7 +9847,6 @@ PBX_PRI_CALL_WAITING=0
 
 
 
-
 PRI_AOC_EVENTS_DESCRIP="ISDN PRI advice of charge supplementary service events"
 PRI_AOC_EVENTS_OPTION=pri
 PRI_AOC_EVENTS_DIR=${PRI_DIR}
@@ -10209,7 +9859,6 @@ PBX_PRI_AOC_EVENTS=0
 
 
 
-
 PRI_TRANSFER_DESCRIP="ISDN PRI call transfer supplementary service"
 PRI_TRANSFER_OPTION=pri
 PRI_TRANSFER_DIR=${PRI_DIR}
@@ -10222,7 +9871,6 @@ PBX_PRI_TRANSFER=0
 
 
 
-
 PRI_CCSS_DESCRIP="ISDN PRI call completion supplementary service"
 PRI_CCSS_OPTION=pri
 PRI_CCSS_DIR=${PRI_DIR}
@@ -10235,7 +9883,6 @@ PBX_PRI_CCSS=0
 
 
 
-
 PRI_HANGUP_FIX_DESCRIP="ISDN PRI hangup fix"
 PRI_HANGUP_FIX_OPTION=pri
 PRI_HANGUP_FIX_DIR=${PRI_DIR}
@@ -10248,7 +9895,6 @@ PBX_PRI_HANGUP_FIX=0
 
 
 
-
 PRI_SUBADDR_DESCRIP="ISDN PRI subaddressing"
 PRI_SUBADDR_OPTION=pri
 PRI_SUBADDR_DIR=${PRI_DIR}
@@ -10261,7 +9907,6 @@ PBX_PRI_SUBADDR=0
 
 
 
-
 PRI_CALL_HOLD_DESCRIP="ISDN PRI call hold"
 PRI_CALL_HOLD_OPTION=pri
 PRI_CALL_HOLD_DIR=${PRI_DIR}
@@ -10274,7 +9919,6 @@ PBX_PRI_CALL_HOLD=0
 
 
 
-
 PRI_CALL_REROUTING_DESCRIP="ISDN PRI call rerouting and call deflection"
 PRI_CALL_REROUTING_OPTION=pri
 PRI_CALL_REROUTING_DIR=${PRI_DIR}
@@ -10287,7 +9931,6 @@ PBX_PRI_CALL_REROUTING=0
 
 
 
-
 PRI_SETUP_KEYPAD_DESCRIP="ISDN PRI keypad facility in SETUP"
 PRI_SETUP_KEYPAD_OPTION=pri
 PRI_SETUP_KEYPAD_DIR=${PRI_DIR}
@@ -10299,7 +9942,6 @@ PBX_PRI_SETUP_KEYPAD=0
 
 
 
-
 # ------------------------------------v
 # TODO: The code can be changed to always include these features now.
 # These features will always be present if pri_connected_line_update is available.
@@ -10316,7 +9958,6 @@ PBX_PRI_INBANDDISCONNECT=0
 
 
 
-
 PRI_PROG_W_CAUSE_DESCRIP="ISDN progress with cause"
 PRI_PROG_W_CAUSE_OPTION=pri
 PRI_PROG_W_CAUSE_DIR=${PRI_DIR}
@@ -10329,7 +9970,6 @@ PBX_PRI_PROG_W_CAUSE=0
 
 
 
-
 PRI_SERVICE_MESSAGES_DESCRIP="ISDN service messages"
 PRI_SERVICE_MESSAGES_OPTION=pri
 PRI_SERVICE_MESSAGES_DIR=${PRI_DIR}
@@ -10342,7 +9982,6 @@ PBX_PRI_SERVICE_MESSAGES=0
 
 
 
-
 PRI_REVERSE_CHARGE_DESCRIP="ISDN reverse charge"
 PRI_REVERSE_CHARGE_OPTION=pri
 PRI_REVERSE_CHARGE_DIR=${PRI_DIR}
@@ -10354,7 +9993,6 @@ PBX_PRI_REVERSE_CHARGE=0
 
 
 
-
 # ------------------------------------^
 
     PWLIB_DESCRIP="PWlib"
@@ -10362,7 +10000,7 @@ PBX_PRI_REVERSE_CHARGE=0
     PBX_PWLIB=0
 
 # Check whether --with-pwlib was given.
-if test "${with_pwlib+set}" = set; then
+if test "${with_pwlib+set}" = set; then :
   withval=$with_pwlib;
        case ${withval} in
        n|no)
 
 
 
-
     RADIUS_DESCRIP="Radius Client"
     RADIUS_OPTION="radius"
     PBX_RADIUS=0
 
 # Check whether --with-radius was given.
-if test "${with_radius+set}" = set; then
+if test "${with_radius+set}" = set; then :
   withval=$with_radius;
        case ${withval} in
        n|no)
 
 
 
-
     RESAMPLE_DESCRIP="LIBRESAMPLE"
     RESAMPLE_OPTION="resample"
     PBX_RESAMPLE=0
 
 # Check whether --with-resample was given.
-if test "${with_resample+set}" = set; then
+if test "${with_resample+set}" = set; then :
   withval=$with_resample;
        case ${withval} in
        n|no)
 
 
 
-
     SDL_DESCRIP="Sdl"
     SDL_OPTION="sdl"
     PBX_SDL=0
 
 # Check whether --with-sdl was given.
-if test "${with_sdl+set}" = set; then
+if test "${with_sdl+set}" = set; then :
   withval=$with_sdl;
        case ${withval} in
        n|no)
 
 
 
-
     SDL_IMAGE_DESCRIP="Sdl Image"
     SDL_IMAGE_OPTION="SDL_image"
     PBX_SDL_IMAGE=0
 
 # Check whether --with-SDL_image was given.
-if test "${with_SDL_image+set}" = set; then
+if test "${with_SDL_image+set}" = set; then :
   withval=$with_SDL_image;
        case ${withval} in
        n|no)
@@ -10522,9 +10156,8 @@ fi
 
 
 
-
 # Check whether --with-sounds-cache was given.
-if test "${with_sounds_cache+set}" = set; then
+if test "${with_sounds_cache+set}" = set; then :
   withval=$with_sounds_cache;
        case ${withval} in
        n|no)
@@ -10551,7 +10184,7 @@ fi
     PBX_SPANDSP=0
 
 # Check whether --with-spandsp was given.
-if test "${with_spandsp+set}" = set; then
+if test "${with_spandsp+set}" = set; then :
   withval=$with_spandsp;
        case ${withval} in
        n|no)
 
 
 
-
     SS7_DESCRIP="ISDN SS7"
     SS7_OPTION="ss7"
     PBX_SS7=0
 
 # Check whether --with-ss7 was given.
-if test "${with_ss7+set}" = set; then
+if test "${with_ss7+set}" = set; then :
   withval=$with_ss7;
        case ${withval} in
        n|no)
 
 
 
-
     SPEEX_DESCRIP="Speex"
     SPEEX_OPTION="speex"
     PBX_SPEEX=0
 
 # Check whether --with-speex was given.
-if test "${with_speex+set}" = set; then
+if test "${with_speex+set}" = set; then :
   withval=$with_speex;
        case ${withval} in
        n|no)
 
 
 
-
     SPEEX_PREPROCESS_DESCRIP="Speex preprocess routines"
     SPEEX_PREPROCESS_OPTION="speex"
     PBX_SPEEX_PREPROCESS=0
 
 # Check whether --with-speex was given.
-if test "${with_speex+set}" = set; then
+if test "${with_speex+set}" = set; then :
   withval=$with_speex;
        case ${withval} in
        n|no)
 
 
 
-
     SPEEXDSP_DESCRIP="SpeexDSP"
     SPEEXDSP_OPTION="speexdsp"
     PBX_SPEEXDSP=0
 
 # Check whether --with-speexdsp was given.
-if test "${with_speexdsp+set}" = set; then
+if test "${with_speexdsp+set}" = set; then :
   withval=$with_speexdsp;
        case ${withval} in
        n|no)
@@ -10710,7 +10339,6 @@ fi
 
 
 
-
 SPEEX_PREPROCESS_DESCRIP="speex_preprocess_ctl"
 SPEEX_PREPROCESS_OPTION=speex
 
@@ -10722,13 +10350,12 @@ PBX_SPEEX_PREPROCESS=0
 
 
 
-
     SQLITE_DESCRIP="SQLite"
     SQLITE_OPTION="sqlite"
     PBX_SQLITE=0
 
 # Check whether --with-sqlite was given.
-if test "${with_sqlite+set}" = set; then
+if test "${with_sqlite+set}" = set; then :
   withval=$with_sqlite;
        case ${withval} in
        n|no)
 
 
 
-
     SQLITE3_DESCRIP="SQLite"
     SQLITE3_OPTION="sqlite3"
     PBX_SQLITE3=0
 
 # Check whether --with-sqlite3 was given.
-if test "${with_sqlite3+set}" = set; then
+if test "${with_sqlite3+set}" = set; then :
   withval=$with_sqlite3;
        case ${withval} in
        n|no)
 
 
 
-
     SRTP_DESCRIP="Secure RTP"
     SRTP_OPTION="srtp"
     PBX_SRTP=0
 
 # Check whether --with-srtp was given.
-if test "${with_srtp+set}" = set; then
+if test "${with_srtp+set}" = set; then :
   withval=$with_srtp;
        case ${withval} in
        n|no)
 
 
 
-
     OPENSSL_DESCRIP="OpenSSL Secure Sockets Layer"
     OPENSSL_OPTION="ssl"
     PBX_OPENSSL=0
 
 # Check whether --with-ssl was given.
-if test "${with_ssl+set}" = set; then
+if test "${with_ssl+set}" = set; then :
   withval=$with_ssl;
        case ${withval} in
        n|no)
 
 
 
-
     SUPPSERV_DESCRIP="mISDN Supplemental Services"
     SUPPSERV_OPTION="suppserv"
     PBX_SUPPSERV=0
 
 # Check whether --with-suppserv was given.
-if test "${with_suppserv+set}" = set; then
+if test "${with_suppserv+set}" = set; then :
   withval=$with_suppserv;
        case ${withval} in
        n|no)
 
 
 
-
     FREETDS_DESCRIP="FreeTDS"
     FREETDS_OPTION="tds"
     PBX_FREETDS=0
 
 # Check whether --with-tds was given.
-if test "${with_tds+set}" = set; then
+if test "${with_tds+set}" = set; then :
   withval=$with_tds;
        case ${withval} in
        n|no)
 
 
 
-
     TERMCAP_DESCRIP="Termcap"
     TERMCAP_OPTION="termcap"
     PBX_TERMCAP=0
 
 # Check whether --with-termcap was given.
-if test "${with_termcap+set}" = set; then
+if test "${with_termcap+set}" = set; then :
   withval=$with_termcap;
        case ${withval} in
        n|no)
 
 
 
-
     TIMERFD_DESCRIP="timerfd"
     TIMERFD_OPTION="timerfd"
     PBX_TIMERFD=0
 
 # Check whether --with-timerfd was given.
-if test "${with_timerfd+set}" = set; then
+if test "${with_timerfd+set}" = set; then :
   withval=$with_timerfd;
        case ${withval} in
        n|no)
 
 
 
-
     TINFO_DESCRIP="Term Info"
     TINFO_OPTION="tinfo"
     PBX_TINFO=0
 
 # Check whether --with-tinfo was given.
-if test "${with_tinfo+set}" = set; then
+if test "${with_tinfo+set}" = set; then :
   withval=$with_tinfo;
        case ${withval} in
        n|no)
 
 
 
-
     TONEZONE_DESCRIP="tonezone"
     TONEZONE_OPTION="tonezone"
     PBX_TONEZONE=0
 
 # Check whether --with-tonezone was given.
-if test "${with_tonezone+set}" = set; then
+if test "${with_tonezone+set}" = set; then :
   withval=$with_tonezone;
        case ${withval} in
        n|no)
 
 
 
-
     UNIXODBC_DESCRIP="unixODBC"
     UNIXODBC_OPTION="unixodbc"
     PBX_UNIXODBC=0
 
 # Check whether --with-unixodbc was given.
-if test "${with_unixodbc+set}" = set; then
+if test "${with_unixodbc+set}" = set; then :
   withval=$with_unixodbc;
        case ${withval} in
        n|no)
 
 
 
-
-    USB_DESCRIP="usb"
-    USB_OPTION="usb"
-    PBX_USB=0
-
-# Check whether --with-usb was given.
-if test "${with_usb+set}" = set; then
-  withval=$with_usb;
-       case ${withval} in
-       n|no)
-       USE_USB=no
-       # -1 is a magic value used by menuselect to know that the package
-       # was disabled, other than 'not found'
-       PBX_USB=-1
-       ;;
-       y|ye|yes)
-       ac_mandatory_list="${ac_mandatory_list} USB"
-       ;;
-       *)
-       USB_DIR="${withval}"
-       ac_mandatory_list="${ac_mandatory_list} USB"
-       ;;
-       esac
-
-fi
-
-
-
-
-
-
-
-
-
     VORBIS_DESCRIP="Vorbis"
     VORBIS_OPTION="vorbis"
     PBX_VORBIS=0
 
 # Check whether --with-vorbis was given.
-if test "${with_vorbis+set}" = set; then
+if test "${with_vorbis+set}" = set; then :
   withval=$with_vorbis;
        case ${withval} in
        n|no)
 
 
 
-
     VPB_DESCRIP="Voicetronix API"
     VPB_OPTION="vpb"
     PBX_VPB=0
 
 # Check whether --with-vpb was given.
-if test "${with_vpb+set}" = set; then
+if test "${with_vpb+set}" = set; then :
   withval=$with_vpb;
        case ${withval} in
        n|no)
 
 
 
-
     X11_DESCRIP="X11"
     X11_OPTION="x11"
     PBX_X11=0
 
 # Check whether --with-x11 was given.
-if test "${with_x11+set}" = set; then
+if test "${with_x11+set}" = set; then :
   withval=$with_x11;
        case ${withval} in
        n|no)
 
 
 
-
     ZLIB_DESCRIP="zlib compression"
     ZLIB_OPTION="z"
     PBX_ZLIB=0
 
 # Check whether --with-z was given.
-if test "${with_z+set}" = set; then
+if test "${with_z+set}" = set; then :
   withval=$with_z;
        case ${withval} in
        n|no)
 
 
 
-
 # check for basic system features and functionality before
 # checking for package libraries
 
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
-{ $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
 $as_echo_n "checking for working alloca.h... " >&6; }
-if test "${ac_cv_working_alloca_h+set}" = set; then
+if ${ac_cv_working_alloca_h+:} 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 <alloca.h>
 int
@@ -11277,59 +10863,28 @@ char *p = (char *) alloca (2 * sizeof (int));
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_working_alloca_h=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_working_alloca_h=no
+  ac_cv_working_alloca_h=no
 fi
-
-rm -rf conftest.dSYM
-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
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
 $as_echo "$ac_cv_working_alloca_h" >&6; }
 if test $ac_cv_working_alloca_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA_H 1
-_ACEOF
+$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for alloca" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
 $as_echo_n "checking for alloca... " >&6; }
-if test "${ac_cv_func_alloca_works+set}" = set; then
+if ${ac_cv_func_alloca_works+:} 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.  */
 #ifdef __GNUC__
 # define alloca __builtin_alloca
@@ -11345,7 +10900,7 @@ cat >>conftest.$ac_ext <<_ACEOF
  #pragma alloca
 #   else
 #    ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
+void *alloca (size_t);
 #    endif
 #   endif
 #  endif
@@ -11361,47 +10916,20 @@ char *p = (char *) alloca (1);
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_func_alloca_works=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func_alloca_works=no
+  ac_cv_func_alloca_works=no
 fi
-
-rm -rf conftest.dSYM
-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
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
 $as_echo "$ac_cv_func_alloca_works" >&6; }
 
 if test $ac_cv_func_alloca_works = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ALLOCA 1
-_ACEOF
+$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
 
 else
   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
@@ -11411,21 +10939,15 @@ else
 
 ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
 
-cat >>confdefs.h <<\_ACEOF
-#define C_ALLOCA 1
-_ACEOF
+$as_echo "#define C_ALLOCA 1" >>confdefs.h
 
 
-{ $as_echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if test "${ac_cv_os_cray+set}" = set; then
+if ${ac_cv_os_cray+:} 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.  */
 #if defined CRAY && ! defined CRAY2
 webecray
@@ -11435,7 +10957,7 @@ wenotbecray
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then
+  $EGREP "webecray" >/dev/null 2>&1; then :
   ac_cv_os_cray=yes
 else
   ac_cv_os_cray=no
 rm -f conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
 $as_echo "$ac_cv_os_cray" >&6; }
 if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; do
     as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
-   builtin and then its argument prototype would still apply.  */
-#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
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+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 CRAY_STACKSEG_END $ac_func
   done
 fi
 
-{ $as_echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
 $as_echo_n "checking stack direction for C alloca... " >&6; }
-if test "${ac_cv_c_stack_direction+set}" = set; then
+if ${ac_cv_c_stack_direction+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   ac_cv_c_stack_direction=0
 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.  */
 $ac_includes_default
 int
@@ -11584,46 +11014,18 @@ main ()
   return find_stack_direction () < 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   ac_cv_c_stack_direction=1
 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
-
-( exit $ac_status )
-ac_cv_c_stack_direction=-1
+  ac_cv_c_stack_direction=-1
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
 $as_echo "$ac_cv_c_stack_direction" >&6; }
-
 cat >>confdefs.h <<_ACEOF
 #define STACK_DIRECTION $ac_cv_c_stack_direction
 _ACEOF
@@ -11631,24 +11033,15 @@ _ACEOF
 
 fi
 
-
-
-
-
-
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Header+:} 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 <sys/types.h>
 #include <$ac_hdr>
@@ -11662,41 +11055,17 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 :
   eval "$as_ac_Header=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Header=no"
+  eval "$as_ac_Header=no"
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Header
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
-  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
 $as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
+if ${ac_cv_search_opendir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$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.
@@ -11742,70 +11107,39 @@ for ac_lib in '' dir; do
     ac_res=-l$ac_lib
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
-  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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+  if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_search_opendir=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_opendir+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_opendir+:} false; then :
   break
 fi
 done
-if test "${ac_cv_search_opendir+set}" = set; then
-  :
+if ${ac_cv_search_opendir+:} false; then :
+
 else
   ac_cv_search_opendir=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
 $as_echo "$ac_cv_search_opendir" >&6; }
 ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
+if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 else
-  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
 $as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
+if ${ac_cv_search_opendir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$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.
@@ -11830,70 +11164,39 @@ for ac_lib in '' x; do
     ac_res=-l$ac_lib
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
-  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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+  if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_search_opendir=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_opendir+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_opendir+:} false; then :
   break
 fi
 done
-if test "${ac_cv_search_opendir+set}" = set; then
-  :
+if ${ac_cv_search_opendir+:} false; then :
+
 else
   ac_cv_search_opendir=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
 $as_echo "$ac_cv_search_opendir" >&6; }
 ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
+if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+{ $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 test "${ac_cv_header_stdc+set}" = set; then
+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 <stdlib.h>
 #include <stdarg.h>
@@ -11908,48 +11211,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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 <string.h>
 
 _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
 
 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 <stdlib.h>
 
 _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
 
 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 <ctype.h>
 #include <stdlib.h>
@@ -12014,64 +11284,31 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-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
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+{ $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
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
-if test "${ac_cv_header_sys_wait_h+set}" = set; then
+if ${ac_cv_header_sys_wait_h+:} 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 <sys/types.h>
 #include <sys/wait.h>
@@ -12092,212 +11329,26 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_sys_wait_h=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_sys_wait_h=no
+  ac_cv_header_sys_wait_h=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
 $as_echo "$ac_cv_header_sys_wait_h" >&6; }
 if test $ac_cv_header_sys_wait_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_WAIT_H 1
-_ACEOF
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
 fi
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 for ac_header in arpa/inet.h fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/event.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h arpa/nameser.h sys/io.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -12326,18 +11377,14 @@ if test "x${PBX_TERMCAP}" != "x1" -a "${USE_TERMCAP}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_termcap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -ltermcap" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltermcap" >&5
 $as_echo_n "checking for ${pbxfuncname} in -ltermcap... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermcap ${pbxlibdir}  $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.
@@ -12355,47 +11402,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_TERMCAP_FOUND=yes
 else
   AST_TERMCAP_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${TERMCAP_INCLUDE}"
-         if test "${ac_cv_header_+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking  usability" >&5
-$as_echo_n "checking  usability... " >&6; }
-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 <>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking  presence" >&5
-$as_echo_n "checking  presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-
-fi
-if test "x$ac_cv_header_" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = xyes; then :
   TERMCAP_HEADER_FOUND=1
 else
   TERMCAP_HEADER_FOUND=0
@@ -12593,18 +11481,14 @@ if test "x${PBX_TINFO}" != "x1" -a "${USE_TINFO}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_tinfo_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -ltinfo" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltinfo" >&5
 $as_echo_n "checking for ${pbxfuncname} in -ltinfo... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltinfo ${pbxlibdir}  $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.
@@ -12622,47 +11506,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_TINFO_FOUND=yes
 else
   AST_TINFO_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${TINFO_INCLUDE}"
-         if test "${ac_cv_header_+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking  usability" >&5
-$as_echo_n "checking  usability... " >&6; }
-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 <>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking  presence" >&5
-$as_echo_n "checking  presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-
-fi
-if test "x$ac_cv_header_" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = xyes; then :
   TINFO_HEADER_FOUND=1
 else
   TINFO_HEADER_FOUND=0
@@ -12860,18 +11585,14 @@ if test "x${PBX_CURSES}" != "x1" -a "${USE_CURSES}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_curses_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lcurses" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcurses" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lcurses... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcurses ${pbxlibdir}  $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.
@@ -12889,47 +11610,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_CURSES_FOUND=yes
 else
   AST_CURSES_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${CURSES_INCLUDE}"
-         if test "${ac_cv_header_curses_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for curses.h" >&5
-$as_echo_n "checking for curses.h... " >&6; }
-if test "${ac_cv_header_curses_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
-$as_echo "$ac_cv_header_curses_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking curses.h usability" >&5
-$as_echo_n "checking curses.h usability... " >&6; }
-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 <curses.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking curses.h presence" >&5
-$as_echo_n "checking curses.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <curses.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: curses.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for curses.h" >&5
-$as_echo_n "checking for curses.h... " >&6; }
-if test "${ac_cv_header_curses_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_curses_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
-$as_echo "$ac_cv_header_curses_h" >&6; }
-
-fi
-if test "x$ac_cv_header_curses_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
+if test "x$ac_cv_header_curses_h" = xyes; then :
   CURSES_HEADER_FOUND=1
 else
   CURSES_HEADER_FOUND=0
@@ -13127,18 +11689,14 @@ if test "x${PBX_NCURSES}" != "x1" -a "${USE_NCURSES}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ncurses_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lncurses" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lncurses" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lncurses... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lncurses ${pbxlibdir}  $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.
@@ -13156,47 +11714,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_NCURSES_FOUND=yes
 else
   AST_NCURSES_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${NCURSES_INCLUDE}"
-         if test "${ac_cv_header_curses_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for curses.h" >&5
-$as_echo_n "checking for curses.h... " >&6; }
-if test "${ac_cv_header_curses_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
-$as_echo "$ac_cv_header_curses_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking curses.h usability" >&5
-$as_echo_n "checking curses.h usability... " >&6; }
-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 <curses.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking curses.h presence" >&5
-$as_echo_n "checking curses.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <curses.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: curses.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: curses.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for curses.h" >&5
-$as_echo_n "checking for curses.h... " >&6; }
-if test "${ac_cv_header_curses_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_curses_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5
-$as_echo "$ac_cv_header_curses_h" >&6; }
-
-fi
-if test "x$ac_cv_header_curses_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "curses.h" "ac_cv_header_curses_h" "$ac_includes_default"
+if test "x$ac_cv_header_curses_h" = xyes; then :
   NCURSES_HEADER_FOUND=1
 else
   NCURSES_HEADER_FOUND=0
@@ -13387,21 +11786,17 @@ elif test "x$CURSES_LIB" != "x" ; then
 elif test "x$NCURSES_LIB" != "x" ; then
   EDITLINE_LIB="$NCURSES_LIB"
 else
-  { { $as_echo "$as_me:$LINENO: error: *** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" >&5
-$as_echo "$as_me: error: *** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "*** termcap support not found (on modern systems, this typically means the ncurses development package is missing)" "$LINENO" 5
 fi
 
 
 # Another mandatory item (unless it's explicitly disabled)
 # Check whether --enable-xmldoc was given.
-if test "${enable_xmldoc+set}" = set; then
+if test "${enable_xmldoc+set}" = set; then :
   enableval=$enable_xmldoc; case "${enableval}" in
                y|ye|yes) disable_xmldoc=no ;;
                n|no)  disable_xmldoc=yes ;;
-               *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --disable-xmldoc" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --disable-xmldoc" >&2;}
-   { (exit 1); exit 1; }; }  ;;
+               *) as_fn_error $? "bad value ${enableval} for --disable-xmldoc" "$LINENO" 5  ;;
        esac
 else
   disable_xmldoc=no
@@ -13415,9 +11810,9 @@ if test "${disable_xmldoc}" != "yes"; then
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}xml2-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}xml2-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_LIBXML2+set}" = set; then
+if ${ac_cv_path_CONFIG_LIBXML2+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CONFIG_LIBXML2 in
@@ -13431,14 +11826,14 @@ for as_dir in $as_dummy
 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_path_CONFIG_LIBXML2="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -13446,10 +11841,10 @@ esac
 fi
 CONFIG_LIBXML2=$ac_cv_path_CONFIG_LIBXML2
 if test -n "$CONFIG_LIBXML2"; then
-  { $as_echo "$as_me:$LINENO: result: $CONFIG_LIBXML2" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_LIBXML2" >&5
 $as_echo "$CONFIG_LIBXML2" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -13459,9 +11854,9 @@ if test -z "$ac_cv_path_CONFIG_LIBXML2"; then
   ac_pt_CONFIG_LIBXML2=$CONFIG_LIBXML2
   # Extract the first word of "xml2-config", so it can be a program name with args.
 set dummy xml2-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_LIBXML2+set}" = set; then
+if ${ac_cv_path_ac_pt_CONFIG_LIBXML2+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_CONFIG_LIBXML2 in
@@ -13475,14 +11870,14 @@ for as_dir in $as_dummy
 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_path_ac_pt_CONFIG_LIBXML2="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -13490,10 +11885,10 @@ esac
 fi
 ac_pt_CONFIG_LIBXML2=$ac_cv_path_ac_pt_CONFIG_LIBXML2
 if test -n "$ac_pt_CONFIG_LIBXML2"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_CONFIG_LIBXML2" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_LIBXML2" >&5
 $as_echo "$ac_pt_CONFIG_LIBXML2" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -13502,7 +11897,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
                saved_libs="${LIBS}"
                LIBS="${LIBXML2_LIB}"
 
-               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 <libxml/tree.h>
 #include <libxml/tree.h>
        #include <libxml/parser.h>
 int
 main ()
@@ -13545,529 +11936,86 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
      PBX_LIBXML2=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBXML2 1
-_ACEOF
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
 
 
 fi
-
-rm -rf conftest.dSYM
-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
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
            else
                PBX_LIBXML2=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBXML2 1
-_ACEOF
+$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
 
            fi
        fi
     fi
 
        if test "${PBX_LIBXML2}" != 1; then
-               { $as_echo "$as_me:$LINENO: *** XML documentation will not be available because the 'libxml2' development package is missing." >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: *** XML documentation will not be available because the 'libxml2' development package is missing." >&5
 $as_echo "$as_me: *** XML documentation will not be available because the 'libxml2' development package is missing." >&6;}
-               { $as_echo "$as_me:$LINENO: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&5
 $as_echo "$as_me: *** Please run the 'configure' script with the '--disable-xmldoc' parameter option" >&6;}
-               { $as_echo "$as_me:$LINENO: *** or install the 'libxml2' development package." >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: *** or install the 'libxml2' development package." >&5
 $as_echo "$as_me: *** or install the 'libxml2' development package." >&6;}
                exit 1
        fi
 fi
 
 # some embedded systems omit internationalization (locale) support
-
 for ac_header in xlocale.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-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>
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "xlocale.h" "ac_cv_header_xlocale_h" "$ac_includes_default"
+if test "x$ac_cv_header_xlocale_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_XLOCALE_H 1
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_header_compiler=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+done
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&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>
+
+for ac_header in winsock.h winsock2.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
-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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+done
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_poll_h" = xyes; then :
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-for ac_header in winsock.h winsock2.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-if test "${ac_cv_header_sys_poll_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/poll.h" >&5
-$as_echo_n "checking for sys/poll.h... " >&6; }
-if test "${ac_cv_header_sys_poll_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_poll_h" >&5
-$as_echo "$ac_cv_header_sys_poll_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/poll.h usability" >&5
-$as_echo_n "checking sys/poll.h usability... " >&6; }
-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 <sys/poll.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/poll.h presence" >&5
-$as_echo_n "checking sys/poll.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/poll.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sys/poll.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/poll.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/poll.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/poll.h" >&5
-$as_echo_n "checking for sys/poll.h... " >&6; }
-if test "${ac_cv_header_sys_poll_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_poll_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_poll_h" >&5
-$as_echo "$ac_cv_header_sys_poll_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sys_poll_h" = x""yes; then
-  :
-else
-
-cat >>confdefs.h <<\_ACEOF
-#define AST_POLL_COMPAT 1
-_ACEOF
+$as_echo "#define AST_POLL_COMPAT 1" >>confdefs.h
 
 fi
 
 
 
 # Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then
+if test "${enable_largefile+set}" = set; then :
   enableval=$enable_largefile;
 fi
 
 if test "$enable_largefile" != no; then
 
-  { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
 $as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then
+if ${ac_cv_sys_largefile_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_sys_largefile_CC=no
@@ -14076,11 +12024,7 @@ else
        while :; do
         # IRIX 6.2 and later do not support large files by default,
         # so use the C compiler's -n32 option if that helps.
-        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 <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -14099,60 +12043,14 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 :
   break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext
         CC="$CC -n32"
-        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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_sys_largefile_CC=' -n32'; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext
         break
        done
@@ -14160,23 +12058,19 @@ rm -f core conftest.err conftest.$ac_objext
        rm -f conftest.$ac_ext
     fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
 $as_echo "$ac_cv_sys_largefile_CC" >&6; }
   if test "$ac_cv_sys_largefile_CC" != no; then
     CC=$CC$ac_cv_sys_largefile_CC
   fi
 
-  { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+if ${ac_cv_sys_file_offset_bits+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   while :; 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.  */
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -14195,38 +12089,11 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_sys_file_offset_bits=no; break
-else
-  $as_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
-  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.  */
 #define _FILE_OFFSET_BITS 64
 #include <sys/types.h>
@@ -14246,38 +12113,15 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_sys_file_offset_bits=64; break
-else
-  $as_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
   ac_cv_sys_file_offset_bits=unknown
   break
 done
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
 $as_echo "$ac_cv_sys_file_offset_bits" >&6; }
 case $ac_cv_sys_file_offset_bits in #(
   no | unknown) ;;
@@ -14289,17 +12133,13 @@ _ACEOF
 esac
 rm -rf conftest*
   if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if test "${ac_cv_sys_large_files+set}" = set; then
+if ${ac_cv_sys_large_files+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   while :; 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.  */
 #include <sys/types.h>
  /* Check that off_t can represent 2**63 - 1 correctly.
@@ -14318,38 +12158,11 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_sys_large_files=no; break
-else
-  $as_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
-  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.  */
 #define _LARGE_FILES 1
 #include <sys/types.h>
@@ -14369,38 +12182,15 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_sys_large_files=1; break
-else
-  $as_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
   ac_cv_sys_large_files=unknown
   break
 done
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
 $as_echo "$ac_cv_sys_large_files" >&6; }
 case $ac_cv_sys_large_files in #(
   no | unknown) ;;
 
 
 # Checks for typedefs, structures, and compiler characteristics.
-{ $as_echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
+{ $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 test "${ac_cv_header_stdbool_h+set}" = set; then
+if ${ac_cv_header_stdbool_h+:} 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 <stdbool.h>
@@ -14454,7 +12240,7 @@ 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)];
@@ -14465,25 +12251,6 @@ cat >>conftest.$ac_ext <<_ACEOF
        _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
@@ -14495,6 +12262,7 @@ int
 main ()
 {
 
+       bool e = &s;
        *pq |= q;
        *pq |= ! q;
        /* Refer to every declared value, to avoid compiler optimizations.  */
@@ -14505,131 +12273,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdbool_h=no
+  ac_cv_header_stdbool_h=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
 $as_echo "$ac_cv_header_stdbool_h" >&6; }
-{ $as_echo "$as_me:$LINENO: checking for _Bool" >&5
-$as_echo_n "checking for _Bool... " >&6; }
-if test "${ac_cv_type__Bool+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type__Bool=no
-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
-int
-main ()
-{
-if (sizeof (_Bool))
-       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  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
-int
-main ()
-{
-if (sizeof ((_Bool)))
-         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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type__Bool=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
-$as_echo "$ac_cv_type__Bool" >&6; }
-if test "x$ac_cv_type__Bool" = x""yes; then
+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
 
 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
 
-{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+{ $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 test "${ac_cv_c_const+set}" = set; then
+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
@@ -14715,60 +12363,33 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+{ $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
 
-{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
 $as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if test "${ac_cv_type_uid_t+set}" = set; then
+if ${ac_cv_type_uid_t+:} 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 <sys/types.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "uid_t" >/dev/null 2>&1; then
+  $EGREP "uid_t" >/dev/null 2>&1; then :
   ac_cv_type_uid_t=yes
 else
   ac_cv_type_uid_t=no
 rm -f conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
 $as_echo "$ac_cv_type_uid_t" >&6; }
 if test $ac_cv_type_uid_t = no; then
 
-cat >>confdefs.h <<\_ACEOF
-#define uid_t int
-_ACEOF
+$as_echo "#define uid_t int" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define gid_t int
-_ACEOF
+$as_echo "#define gid_t int" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for inline" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
 $as_echo_n "checking for inline... " >&6; }
-if test "${ac_cv_c_inline+set}" = set; then
+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;
@@ -14811,41 +12424,17 @@ $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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+{ $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) ;;
   *)
@@ -14862,16 +12451,12 @@ _ACEOF
 esac
 
 
-  { $as_echo "$as_me:$LINENO: checking for long double with more range or precision than double" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long double with more range or precision than double" >&5
 $as_echo_n "checking for long double with more range or precision than double... " >&6; }
-if test "${ac_cv_type_long_double_wider+set}" = set; then
+if ${ac_cv_type_long_double_wider+:} 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 <float.h>
            long double const a[] =
@@ -14901,1841 +12486,1419 @@ test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_type_long_double_wider=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_long_double_wider=no
+  ac_cv_type_long_double_wider=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_double_wider" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_double_wider" >&5
 $as_echo "$ac_cv_type_long_double_wider" >&6; }
   if test $ac_cv_type_long_double_wider = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LONG_DOUBLE_WIDER 1
-_ACEOF
+$as_echo "#define HAVE_LONG_DOUBLE_WIDER 1" >>confdefs.h
 
   fi
 
-{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5
-$as_echo_n "checking for mode_t... " >&6; }
-if test "${ac_cv_type_mode_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = xyes; then :
+
 else
-  ac_cv_type_mode_t=no
-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
-int
-main ()
-{
-if (sizeof (mode_t))
-       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof ((mode_t)))
-         return 0;
-  ;
-  return 0;
-}
+
+fi
+
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  :
+
+fi
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       ac_cv_type_mode_t=yes
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+_ACEOF
+
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
-$as_echo "$ac_cv_type_mode_t" >&6; }
-if test "x$ac_cv_type_mode_t" = x""yes; then
-  :
-else
+
+ac_fn_c_check_member "$LINENO" "struct ucred" "uid" "ac_cv_member_struct_ucred_uid" "#include <sys/types.h>
+#include <sys/socket.h>
+"
+if test "x$ac_cv_member_struct_ucred_uid" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
-#define mode_t int
+#define HAVE_STRUCT_UCRED_UID 1
 _ACEOF
 
+
 fi
+ac_fn_c_check_member "$LINENO" "struct ucred" "cr_uid" "ac_cv_member_struct_ucred_cr_uid" "#include <sys/types.h>
+#include <sys/socket.h>
+"
+if test "x$ac_cv_member_struct_ucred_cr_uid" = xyes; then :
 
-{ $as_echo "$as_me:$LINENO: checking for off_t" >&5
-$as_echo_n "checking for off_t... " >&6; }
-if test "${ac_cv_type_off_t+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_type_off_t=no
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_UCRED_CR_UID 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-if (sizeof (off_t))
-       return 0;
-  ;
-  return 0;
-}
+
+
+fi
+ac_fn_c_check_member "$LINENO" "struct sockpeercred" "uid" "ac_cv_member_struct_sockpeercred_uid" "#include <sys/types.h>
+#include <sys/socket.h>
+"
+if test "x$ac_cv_member_struct_sockpeercred_uid" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_SOCKPEERCRED_UID 1
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+
+fi
+
+ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_ifru.ifru_hwaddr" "ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" "#include <net/if.h>
+"
+if test "x$ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+
+fi
+
+{ $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
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
 int
 main ()
 {
-if (sizeof ((off_t)))
-         return 0;
+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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_off_t=yes
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_time=yes
 else
-  $as_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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-$as_echo "$ac_cv_type_off_t" >&6; }
-if test "x$ac_cv_type_off_t" = x""yes; then
-  :
-else
+{ $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
 
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5
-$as_echo_n "checking for pid_t... " >&6; }
-if test "${ac_cv_type_pid_t+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
+$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
+if ${ac_cv_struct_tm+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_type_pid_t=no
-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 <sys/types.h>
+#include <time.h>
+
 int
 main ()
 {
-if (sizeof (pid_t))
-       return 0;
+struct tm tm;
+                                    int *p = &tm.tm_sec;
+                                    return !p;
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_struct_tm=time.h
+else
+  ac_cv_struct_tm=sys/time.h
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
+
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
+$as_echo_n "checking for working volatile... " >&6; }
+if ${ac_cv_c_volatile+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
 int
 main ()
 {
-if (sizeof ((pid_t)))
-         return 0;
+
+volatile int x;
+int * volatile y = (int *) 0;
+return !x && !y;
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_volatile=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_pid_t=yes
+  ac_cv_c_volatile=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
+$as_echo "$ac_cv_c_volatile" >&6; }
+if test $ac_cv_c_volatile = no; then
 
+$as_echo "#define volatile /**/" >>confdefs.h
 
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-$as_echo "$ac_cv_type_pid_t" >&6; }
-if test "x$ac_cv_type_pid_t" = x""yes; then
-  :
-else
+ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
+if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
-#define pid_t int
+#define HAVE_PTRDIFF_T 1
+_ACEOF
+
+
+fi
+
+
+# Checks for library functions.
+for ac_header in unistd.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
+if test "x$ac_cv_header_unistd_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_UNISTD_H 1
 _ACEOF
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
-$as_echo_n "checking for size_t... " >&6; }
-if test "${ac_cv_type_size_t+set}" = set; then
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5
+$as_echo_n "checking for working chown... " >&6; }
+if ${ac_cv_func_chown_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_type_size_t=no
-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
-int
-main ()
-{
-if (sizeof (size_t))
-       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_chown_works=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
+#include <fcntl.h>
+
 int
 main ()
 {
-if (sizeof ((size_t)))
-         return 0;
+  char *f = "conftest.chown";
+  struct stat before, after;
+
+  if (creat (f, 0600) < 0)
+    return 1;
+  if (stat (f, &before) < 0)
+    return 1;
+  if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
+    return 1;
+  if (stat (f, &after) < 0)
+    return 1;
+  return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_run "$LINENO"; then :
+  ac_cv_func_chown_works=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_size_t=yes
+  ac_cv_func_chown_works=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.chown
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-$as_echo "$ac_cv_type_size_t" >&6; }
-if test "x$ac_cv_type_size_t" = x""yes; then
-  :
-else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5
+$as_echo "$ac_cv_func_chown_works" >&6; }
+if test $ac_cv_func_chown_works = yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
+$as_echo "#define HAVE_CHOWN 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
-$as_echo_n "checking for struct stat.st_blksize... " >&6; }
-if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether closedir returns void" >&5
+$as_echo_n "checking whether closedir returns void... " >&6; }
+if ${ac_cv_func_closedir_void+:} 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
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_closedir_void=yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
+#include <$ac_header_dirent>
+#ifndef __cplusplus
+int closedir ();
+#endif
+
 int
 main ()
 {
-static struct stat ac_aggr;
-if (ac_aggr.st_blksize)
-return 0;
+return closedir (opendir (".")) != 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_stat_st_blksize=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_closedir_void=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_func_closedir_void=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_closedir_void" >&5
+$as_echo "$ac_cv_func_closedir_void" >&6; }
+if test $ac_cv_func_closedir_void = yes; then
+
+$as_echo "#define CLOSEDIR_VOID 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5
+$as_echo_n "checking for error_at_line... " >&6; }
+if ${ac_cv_lib_error_at_line+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <error.h>
 int
 main ()
 {
-static struct stat ac_aggr;
-if (sizeof ac_aggr.st_blksize)
-return 0;
+error_at_line (0, 0, "", 0, "an error occurred");
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_stat_st_blksize=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_error_at_line=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_stat_st_blksize=no
+  ac_cv_lib_error_at_line=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5
+$as_echo "$ac_cv_lib_error_at_line" >&6; }
+if test $ac_cv_lib_error_at_line = no; then
+  case " $LIBOBJS " in
+  *" error.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS error.$ac_objext"
+ ;;
+esac
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5
-$as_echo "$ac_cv_member_struct_stat_st_blksize" >&6; }
-if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+for ac_header in vfork.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
 _ACEOF
 
+fi
+
+done
+
+for ac_func in fork vfork
+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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
 fi
+done
 
-{ $as_echo "$as_me:$LINENO: checking for struct ucred.uid" >&5
-$as_echo_n "checking for struct ucred.uid... " >&6; }
-if test "${ac_cv_member_struct_ucred_uid+set}" = set; then
+if test "x$ac_cv_func_fork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} 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
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_fork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
-
+$ac_includes_default
 int
 main ()
 {
-static struct ucred ac_aggr;
-if (ac_aggr.uid)
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_ucred_uid=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
+         /* By Ruediger Kuhlmann. */
+         return fork () < 0;
 
-int
-main ()
-{
-static struct ucred ac_aggr;
-if (sizeof ac_aggr.uid)
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_ucred_uid=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_fork_works=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_ucred_uid=no
+  ac_cv_func_fork_works=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ucred_uid" >&5
-$as_echo "$ac_cv_member_struct_ucred_uid" >&6; }
-if test "x$ac_cv_member_struct_ucred_uid" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_UCRED_UID 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
 
+else
+  ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+  case $host in
+    *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
+      # Override, as these systems have only a dummy fork() stub
+      ac_cv_func_fork_works=no
+      ;;
+    *)
+      ac_cv_func_fork_works=yes
+      ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
 fi
-{ $as_echo "$as_me:$LINENO: checking for struct ucred.cr_uid" >&5
-$as_echo_n "checking for struct ucred.cr_uid... " >&6; }
-if test "${ac_cv_member_struct_ucred_cr_uid+set}" = set; then
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} 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
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_vfork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
-
-int
-main ()
+/* Thanks to Paul Eggert for this test.  */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.  The compiler
+   is told about this with #include <vfork.h>, but some compilers
+   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
+   static variable whose address is put into a register that is
+   clobbered by the vfork.  */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
 {
-static struct ucred ac_aggr;
-if (ac_aggr.cr_uid)
-return 0;
-  ;
-  return 0;
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0) {
+      perror ("vfork");
+      _exit(2);
+    }
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
 }
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_ucred_cr_uid=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
 
 int
 main ()
 {
-static struct ucred ac_aggr;
-if (sizeof ac_aggr.cr_uid)
-return 0;
-  ;
-  return 0;
+  pid_t parent = getpid ();
+  pid_t child;
+
+  sparc_address_test (0);
+
+  child = vfork ();
+
+  if (child == 0) {
+    /* Here is another test for sparc vfork register problems.  This
+       test uses lots of local variables, at least as many local
+       variables as main has allocated so far including compiler
+       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
+       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
+       reuse the register of parent for one of the local variables,
+       since it will think that parent can't possibly be used any more
+       in this routine.  Assigning to the local variable will thus
+       munge parent in the parent process.  */
+    pid_t
+      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+    /* Convince the compiler that p..p7 are live; otherwise, it might
+       use the same hardware register for all 8 local variables.  */
+    if (p != p1 || p != p2 || p != p3 || p != p4
+       || p != p5 || p != p6 || p != p7)
+      _exit(1);
+
+    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+       from child file descriptors.  If the child closes a descriptor
+       before it execs or exits, this munges the parent's descriptor
+       as well.  Test for this by closing stdout in the child.  */
+    _exit(close(fileno(stdout)) != 0);
+  } else {
+    int status;
+    struct stat st;
+
+    while (wait(&status) != child)
+      ;
+    return (
+        /* Was there some problem with vforking?  */
+        child < 0
+
+        /* Did the child fail?  (This shouldn't happen.)  */
+        || status
+
+        /* Did the vfork/compiler bug occur?  */
+        || parent != getpid()
+
+        /* Did the file descriptor bug occur?  */
+        || fstat(fileno(stdout), &st) != 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_ucred_cr_uid=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_vfork_works=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-       ac_cv_member_struct_ucred_cr_uid=no
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+  ac_cv_func_vfork_works=$ac_cv_func_vfork
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ucred_cr_uid" >&5
-$as_echo "$ac_cv_member_struct_ucred_cr_uid" >&6; }
-if test "x$ac_cv_member_struct_ucred_cr_uid" = x""yes; then
+if test "x$ac_cv_func_fork_works" = xyes; then
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_UCRED_CR_UID 1
-_ACEOF
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
 
+  PBX_WORKING_FORK=1
 
 fi
-{ $as_echo "$as_me:$LINENO: checking for struct sockpeercred.uid" >&5
-$as_echo_n "checking for struct sockpeercred.uid... " >&6; }
-if test "${ac_cv_member_struct_sockpeercred_uid+set}" = set; then
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
+if ${ac_cv_sys_largefile_source+:} 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
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
-
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-static struct sockpeercred ac_aggr;
-if (ac_aggr.uid)
-return 0;
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_sockpeercred_uid=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/socket.h>
-
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-static struct sockpeercred ac_aggr;
-if (sizeof ac_aggr.uid)
-return 0;
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_sockpeercred_uid=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_sockpeercred_uid=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=1; break
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  ac_cv_sys_largefile_source=unknown
+  break
+done
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_sockpeercred_uid" >&5
-$as_echo "$ac_cv_member_struct_sockpeercred_uid" >&6; }
-if test "x$ac_cv_member_struct_sockpeercred_uid" = x""yes; then
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
+$as_echo "$ac_cv_sys_largefile_source" >&6; }
+case $ac_cv_sys_largefile_source in #(
+  no | unknown) ;;
+  *)
 cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_SOCKPEERCRED_UID 1
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
 _ACEOF
+;;
+esac
+rm -rf conftest*
+
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
 
+$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for struct ifreq.ifr_ifru.ifru_hwaddr" >&5
-$as_echo_n "checking for struct ifreq.ifr_ifru.ifru_hwaddr... " >&6; }
-if test "${ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr+set}" = set; then
+if test $ac_cv_c_compiler_gnu = yes; then
+    { $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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+    ac_pattern="Autoconf.*'x'"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <net/if.h>
-
-int
-main ()
-{
-static struct ifreq ac_aggr;
-if (ac_aggr.ifr_ifru.ifru_hwaddr)
-return 0;
-  ;
-  return 0;
-}
+#include <sgtty.h>
+Autoconf TIOCGETP
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_ifreq_ifr_ifru_ifru_hwaddr=yes
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
+  ac_cv_prog_gcc_traditional=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
 
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+  if test $ac_cv_prog_gcc_traditional = no; then
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <net/if.h>
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then :
+  ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+  fi
+fi
+{ $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
 
+# XXX: these are commented out until we determine whether it matters if our malloc()
+# acts exactly like glibc's or not
+# AC_FUNC_MALLOC
+# AC_FUNC_REALLOC
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
+$as_echo_n "checking for working memcmp... " >&6; }
+if ${ac_cv_func_memcmp_working+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_memcmp_working=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
 int
 main ()
 {
-static struct ifreq ac_aggr;
-if (sizeof ac_aggr.ifr_ifru.ifru_hwaddr)
-return 0;
+
+  /* Some versions of memcmp are not 8-bit clean.  */
+  char c0 = '\100', c1 = '\200', c2 = '\201';
+  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+    return 1;
+
+  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+     or more and with at least one buffer not starting on a 4-byte boundary.
+     William Lewis provided this test program.   */
+  {
+    char foo[21];
+    char bar[21];
+    int i;
+    for (i = 0; i < 4; i++)
+      {
+       char *a = foo + i;
+       char *b = bar + i;
+       strcpy (a, "--------01111111");
+       strcpy (b, "--------10000000");
+       if (memcmp (a, b, 16) >= 0)
+         return 1;
+      }
+    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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_struct_ifreq_ifr_ifru_ifru_hwaddr=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_memcmp_working=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr=no
+  ac_cv_func_memcmp_working=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" >&5
-$as_echo "$ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" >&6; }
-if test "x$ac_cv_member_struct_ifreq_ifr_ifru_ifru_hwaddr" = x""yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
+$as_echo "$ac_cv_func_memcmp_working" >&6; }
+test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
+  *" memcmp.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+ ;;
+esac
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR 1
+
+
+
+
+  for ac_header in $ac_header_list
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
+fi
+
+done
+
+
+
+
+
+
+
+
+for ac_func in getpagesize
+do :
+  ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
+if test "x$ac_cv_func_getpagesize" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETPAGESIZE 1
+_ACEOF
 
 fi
+done
 
-{ $as_echo "$as_me:$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 test "${ac_cv_header_time+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
+$as_echo_n "checking for working mmap... " >&6; }
+if ${ac_cv_func_mmap_fixed_mapped+:} 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
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_mmap_fixed_mapped=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
+$ac_includes_default
+/* malloc might have been renamed as rpl_malloc. */
+#undef malloc
+
+/* Thanks to Mike Haertel and Jim Avera for this test.
+   Here is a matrix of mmap possibilities:
+       mmap private not fixed
+       mmap private fixed at somewhere currently unmapped
+       mmap private fixed at somewhere already mapped
+       mmap shared not fixed
+       mmap shared fixed at somewhere currently unmapped
+       mmap shared fixed at somewhere already mapped
+   For private mappings, we should verify that changes cannot be read()
+   back from the file, nor mmap's back from the file at a different
+   address.  (There have been systems where private was not correctly
+   implemented like the infamous i386 svr4.0, and systems where the
+   VM page cache was not coherent with the file system buffer cache
+   like early versions of FreeBSD and possibly contemporary NetBSD.)
+   For shared mappings, we should conversely verify that changes get
+   propagated back to all the places they're supposed to be.
+
+   Grep wants private fixed already mapped.
+   The main things grep needs to know about mmap are:
+   * does it exist and is it safe to write into the mmap'd area
+   * how to use it (BSD variants)  */
+
+#include <fcntl.h>
+#include <sys/mman.h>
+
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
+char *malloc ();
+#endif
+
+/* This mess was copied from the GNU getpagesize.h.  */
+#ifndef HAVE_GETPAGESIZE
+# ifdef _SC_PAGESIZE
+#  define getpagesize() sysconf(_SC_PAGESIZE)
+# else /* no _SC_PAGESIZE */
+#  ifdef HAVE_SYS_PARAM_H
+#   include <sys/param.h>
+#   ifdef EXEC_PAGESIZE
+#    define getpagesize() EXEC_PAGESIZE
+#   else /* no EXEC_PAGESIZE */
+#    ifdef NBPG
+#     define getpagesize() NBPG * CLSIZE
+#     ifndef CLSIZE
+#      define CLSIZE 1
+#     endif /* no CLSIZE */
+#    else /* no NBPG */
+#     ifdef NBPC
+#      define getpagesize() NBPC
+#     else /* no NBPC */
+#      ifdef PAGESIZE
+#       define getpagesize() PAGESIZE
+#      endif /* PAGESIZE */
+#     endif /* no NBPC */
+#    endif /* no NBPG */
+#   endif /* no EXEC_PAGESIZE */
+#  else /* no HAVE_SYS_PARAM_H */
+#   define getpagesize() 8192  /* punt totally */
+#  endif /* no HAVE_SYS_PARAM_H */
+# endif /* no _SC_PAGESIZE */
+
+#endif /* no HAVE_GETPAGESIZE */
 
 int
 main ()
 {
-if ((struct tm *) 0)
-return 0;
-  ;
+  char *data, *data2, *data3;
+  const char *cdata2;
+  int i, pagesize;
+  int fd, fd2;
+
+  pagesize = getpagesize ();
+
+  /* First, make a file with some known garbage in it. */
+  data = (char *) malloc (pagesize);
+  if (!data)
+    return 1;
+  for (i = 0; i < pagesize; ++i)
+    *(data + i) = rand ();
+  umask (0);
+  fd = creat ("conftest.mmap", 0600);
+  if (fd < 0)
+    return 2;
+  if (write (fd, data, pagesize) != pagesize)
+    return 3;
+  close (fd);
+
+  /* Next, check that the tail of a page is zero-filled.  File must have
+     non-zero length, otherwise we risk SIGBUS for entire page.  */
+  fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
+  if (fd2 < 0)
+    return 4;
+  cdata2 = "";
+  if (write (fd2, cdata2, 1) != 1)
+    return 5;
+  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
+  if (data2 == MAP_FAILED)
+    return 6;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data2 + i))
+      return 7;
+  close (fd2);
+  if (munmap (data2, pagesize))
+    return 8;
+
+  /* Next, try to mmap the file at a fixed address which already has
+     something else allocated at it.  If we can, also make sure that
+     we see the same garbage.  */
+  fd = open ("conftest.mmap", O_RDWR);
+  if (fd < 0)
+    return 9;
+  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
+                    MAP_PRIVATE | MAP_FIXED, fd, 0L))
+    return 10;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data2 + i))
+      return 11;
+
+  /* Finally, make sure that changes to the mapped area do not
+     percolate back to the file as seen by read().  (This is a bug on
+     some variants of i386 svr4.0.)  */
+  for (i = 0; i < pagesize; ++i)
+    *(data2 + i) = *(data2 + i) + 1;
+  data3 = (char *) malloc (pagesize);
+  if (!data3)
+    return 12;
+  if (read (fd, data3, pagesize) != pagesize)
+    return 13;
+  for (i = 0; i < pagesize; ++i)
+    if (*(data + i) != *(data3 + i))
+      return 14;
+  close (fd);
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_mmap_fixed_mapped=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_func_mmap_fixed_mapped=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-       ac_cv_header_time=no
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
+$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
+if test $ac_cv_func_mmap_fixed_mapped = yes; then
+
+$as_echo "#define HAVE_MMAP 1" >>confdefs.h
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
-if test $ac_cv_header_time = yes; then
+rm -f conftest.mmap conftest.txt
 
-cat >>confdefs.h <<\_ACEOF
-#define TIME_WITH_SYS_TIME 1
+for ac_header in sys/select.h sys/socket.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
-$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if test "${ac_cv_struct_tm+set}" = set; then
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5
+$as_echo_n "checking types of arguments for select... " >&6; }
+if ${ac_cv_func_select_args+:} 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
+  for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
+ for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
+  for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
-#include <time.h>
+$ac_includes_default
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
 
 int
 main ()
 {
-struct tm tm;
-                                    int *p = &tm.tm_sec;
-                                    return !p;
+extern int select ($ac_arg1,
+                                           $ac_arg234, $ac_arg234, $ac_arg234,
+                                           $ac_arg5);
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_struct_tm=time.h
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_struct_tm=sys/time.h
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+ done
+done
+# Provide a safe default value.
+: "${ac_cv_func_select_args=int,int *,struct timeval *}"
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
-$as_echo "$ac_cv_struct_tm" >&6; }
-if test $ac_cv_struct_tm = sys/time.h; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5
+$as_echo "$ac_cv_func_select_args" >&6; }
+ac_save_IFS=$IFS; IFS=','
+set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
+IFS=$ac_save_IFS
+shift
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG1 $1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG234 ($2)
+_ACEOF
 
-cat >>confdefs.h <<\_ACEOF
-#define TM_IN_SYS_TIME 1
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG5 ($3)
 _ACEOF
 
+rm -f conftest*
+
+if ${ac_cv_func_setvbuf_reversed+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_func_setvbuf_reversed=no
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5
-$as_echo_n "checking for working volatile... " >&6; }
-if test "${ac_cv_c_volatile+set}" = set; then
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
+if ${ac_cv_type_signal+:} 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 <sys/types.h>
+#include <signal.h>
 
 int
 main ()
 {
-
-volatile int x;
-int * volatile y = (int *) 0;
-return !x && !y;
+return *(signal (0, 0)) (0) == 1;
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_c_volatile=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_type_signal=int
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_c_volatile=no
+  ac_cv_type_signal=void
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
-$as_echo "$ac_cv_c_volatile" >&6; }
-if test $ac_cv_c_volatile = no; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define volatile /**/
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
 _ACEOF
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
-$as_echo_n "checking for ptrdiff_t... " >&6; }
-if test "${ac_cv_type_ptrdiff_t+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_type_ptrdiff_t=no
-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
-int
-main ()
-{
-if (sizeof (ptrdiff_t))
-       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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
 int
 main ()
 {
-if (sizeof ((ptrdiff_t)))
-         return 0;
+struct stat sbuf;
+     /* Linux will dereference the symlink and fail, as required by POSIX.
+       That is better in the sense that it means we will not
+       have to compile and use the lstat wrapper.  */
+     return lstat ("conftest.sym/", &sbuf) == 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_run "$LINENO"; then :
+  ac_cv_func_lstat_dereferences_slashed_symlink=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_ptrdiff_t=yes
+  ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+  # If the `ln -s' command failed, then we probably don't even
+  # have an lstat function.
+  ac_cv_func_lstat_dereferences_slashed_symlink=no
 fi
+rm -f conftest.sym conftest.file
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
-$as_echo "$ac_cv_type_ptrdiff_t" >&6; }
-if test "x$ac_cv_type_ptrdiff_t" = x""yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+
+test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
 
 cat >>confdefs.h <<_ACEOF
-#define HAVE_PTRDIFF_T 1
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
 _ACEOF
 
 
-fi
-
+if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
+  case " $LIBOBJS " in
+  *" lstat.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
+ ;;
+esac
 
-# Checks for library functions.
+fi
 
-for ac_header in unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
+$as_echo_n "checking whether stat accepts an empty string... " >&6; }
+if ${ac_cv_func_stat_empty_string_bug+:} false; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_stat_empty_string_bug=yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 $ac_includes_default
-#include <$ac_header>
+int
+main ()
+{
+struct stat sbuf;
+  return stat ("", &sbuf) == 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_run "$LINENO"; then :
+  ac_cv_func_stat_empty_string_bug=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+  ac_cv_func_stat_empty_string_bug=yes
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5
+$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
+if test $ac_cv_func_stat_empty_string_bug = yes; then
+  case " $LIBOBJS " in
+  *" stat.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS stat.$ac_objext"
+ ;;
+esac
 
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
 _ACEOF
 
 fi
 
-done
-
-{ $as_echo "$as_me:$LINENO: checking for working chown" >&5
-$as_echo_n "checking for working chown... " >&6; }
-if test "${ac_cv_func_chown_works+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strcoll" >&5
+$as_echo_n "checking for working strcoll... " >&6; }
+if ${ac_cv_func_strcoll_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_chown_works=no
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_strcoll_works=no
 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.  */
 $ac_includes_default
-#include <fcntl.h>
-
 int
 main ()
 {
-  char *f = "conftest.chown";
-  struct stat before, after;
-
-  if (creat (f, 0600) < 0)
-    return 1;
-  if (stat (f, &before) < 0)
-    return 1;
-  if (chown (f, (uid_t) -1, (gid_t) -1) == -1)
-    return 1;
-  if (stat (f, &after) < 0)
-    return 1;
-  return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid);
-
+return (strcoll ("abc", "def") >= 0 ||
+        strcoll ("ABC", "DEF") >= 0 ||
+        strcoll ("123", "456") >= 0)
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_chown_works=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_strcoll_works=yes
 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
-
-( exit $ac_status )
-ac_cv_func_chown_works=no
+  ac_cv_func_strcoll_works=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcoll_works" >&5
+$as_echo "$ac_cv_func_strcoll_works" >&6; }
+if test $ac_cv_func_strcoll_works = yes; then
 
-rm -f conftest.chown
+$as_echo "#define HAVE_STRCOLL 1" >>confdefs.h
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_chown_works" >&5
-$as_echo "$ac_cv_func_chown_works" >&6; }
-if test $ac_cv_func_chown_works = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_CHOWN 1
+for ac_func in strftime
+do :
+  ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
+if test "x$ac_cv_func_strftime" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_STRFTIME 1
 _ACEOF
 
-fi
-
-{ $as_echo "$as_me:$LINENO: checking whether closedir returns void" >&5
-$as_echo_n "checking whether closedir returns void... " >&6; }
-if test "${ac_cv_func_closedir_void+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_closedir_void=yes
+  # strftime is in -lintl on SCO UNIX.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
+$as_echo_n "checking for strftime in -lintl... " >&6; }
+if ${ac_cv_lib_intl_strftime+:} 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="-lintl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header_dirent>
-#ifndef __cplusplus
-int closedir ();
-#endif
 
+/* 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 strftime ();
 int
 main ()
 {
-return closedir (opendir (".")) != 0;
+return strftime ();
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_closedir_void=no
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_intl_strftime=yes
 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
-
-( exit $ac_status )
-ac_cv_func_closedir_void=yes
+  ac_cv_lib_intl_strftime=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+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_intl_strftime" >&5
+$as_echo "$ac_cv_lib_intl_strftime" >&6; }
+if test "x$ac_cv_lib_intl_strftime" = xyes; then :
+  $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
 
-
+LIBS="-lintl $LIBS"
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_closedir_void" >&5
-$as_echo "$ac_cv_func_closedir_void" >&6; }
-if test $ac_cv_func_closedir_void = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define CLOSEDIR_VOID 1
-_ACEOF
 
 fi
+done
 
-{ $as_echo "$as_me:$LINENO: checking for error_at_line" >&5
-$as_echo_n "checking for error_at_line... " >&6; }
-if test "${ac_cv_lib_error_at_line+set}" = set; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strnlen" >&5
+$as_echo_n "checking for working strnlen... " >&6; }
+if ${ac_cv_func_strnlen_working+:} 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
+  if test "$cross_compiling" = yes; then :
+  # Guess no on AIX systems, yes otherwise.
+               case "$host_os" in
+                 aix*) ac_cv_func_strnlen_working=no;;
+                 *)    ac_cv_func_strnlen_working=yes;;
+               esac
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <error.h>
+$ac_includes_default
 int
 main ()
 {
-error_at_line (0, 0, "", 0, "an error occurred");
+
+#define S "foobar"
+#define S_LEN (sizeof S - 1)
+
+  /* At least one implementation is buggy: that of AIX 4.3 would
+     give strnlen (S, 1) == 3.  */
+
+  int i;
+  for (i = 0; i < S_LEN + 1; ++i)
+    {
+      int expected = i <= S_LEN ? i : S_LEN;
+      if (strnlen (S, i) != expected)
+       return 1;
+    }
+  return 0;
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_error_at_line=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_strnlen_working=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_error_at_line=no
+  ac_cv_func_strnlen_working=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_error_at_line" >&5
-$as_echo "$ac_cv_lib_error_at_line" >&6; }
-if test $ac_cv_lib_error_at_line = no; then
-  case " $LIBOBJS " in
-  *" error.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS error.$ac_objext"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strnlen_working" >&5
+$as_echo "$ac_cv_func_strnlen_working" >&6; }
+test $ac_cv_func_strnlen_working = no && case " $LIBOBJS " in
+  *" strnlen.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS strnlen.$ac_objext"
  ;;
 esac
 
-fi
-
 
-for ac_header in vfork.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working strtod" >&5
+$as_echo_n "checking for working strtod... " >&6; }
+if ${ac_cv_func_strtod+:} false; then :
   $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
 else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 test "$cross_compiling" = yes; then :
+  ac_cv_func_strtod=no
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&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.  */
-#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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
+$ac_includes_default
+#ifndef strtod
+double strtod ();
+#endif
+int
+main()
+{
+  {
+    /* Some versions of Linux strtod mis-parse strings with leading '+'.  */
+    char *string = " +69";
+    char *term;
+    double value;
+    value = strtod (string, &term);
+    if (value != 69 || term != (string + 4))
+      return 1;
+  }
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+  {
+    /* Under Solaris 2.4, strtod returns the wrong value for the
+       terminating character under some conditions.  */
+    char *string = "NaN";
+    char *term;
+    strtod (string, &term);
+    if (term != string && *(term - 1) == 0)
+      return 1;
+  }
+  return 0;
+}
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_strtod=yes
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  ac_cv_func_strtod=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strtod" >&5
+$as_echo "$ac_cv_func_strtod" >&6; }
+if test $ac_cv_func_strtod = no; then
+  case " $LIBOBJS " in
+  *" strtod.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS strtod.$ac_objext"
+ ;;
+esac
 
-done
-
+ac_fn_c_check_func "$LINENO" "pow" "ac_cv_func_pow"
+if test "x$ac_cv_func_pow" = xyes; then :
 
+fi
 
-for ac_func in fork vfork
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+if test $ac_cv_func_pow = no; then
+  { $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
-  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="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
@@ -16743,3511 +13906,2121 @@ 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 pow ();
 int
 main ()
 {
-return $ac_func ();
+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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_pow=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+  ac_cv_lib_m_pow=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_m_pow" >&5
+$as_echo "$ac_cv_lib_m_pow" >&6; }
+if test "x$ac_cv_lib_m_pow" = xyes; then :
+  POW_LIB=-lm
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find library containing definition of pow" >&5
+$as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;}
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
 fi
-done
 
-if test "x$ac_cv_func_fork" = xyes; then
-  { $as_echo "$as_me:$LINENO: checking for working fork" >&5
-$as_echo_n "checking for working fork... " >&6; }
-if test "${ac_cv_func_fork_works+set}" = set; then
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5
+$as_echo_n "checking whether utime accepts a null argument... " >&6; }
+if ${ac_cv_func_utime_null+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_fork_works=cross
+  rm -f conftest.data; >conftest.data
+# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
+if test "$cross_compiling" = yes; then :
+  ac_cv_func_utime_null='guessing yes'
 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.  */
 $ac_includes_default
+              #ifdef HAVE_UTIME_H
+              # include <utime.h>
+              #endif
 int
 main ()
 {
-
-         /* By Ruediger Kuhlmann. */
-         return fork () < 0;
-
+struct stat s, t;
+  return ! (stat ("conftest.data", &s) == 0
+           && utime ("conftest.data", 0) == 0
+           && stat ("conftest.data", &t) == 0
+           && t.st_mtime >= s.st_mtime
+           && t.st_mtime - s.st_mtime < 120);
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_fork_works=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_utime_null=yes
 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_cv_func_utime_null=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-( exit $ac_status )
-ac_cv_func_fork_works=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_utime_null" >&5
+$as_echo "$ac_cv_func_utime_null" >&6; }
+if test "x$ac_cv_func_utime_null" != xno; then
+  ac_cv_func_utime_null=yes
+
+$as_echo "#define HAVE_UTIME_NULL 1" >>confdefs.h
+
 fi
+rm -f conftest.data
+
+for ac_func in vprintf
+do :
+  ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
+if test "x$ac_cv_func_vprintf" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_VPRINTF 1
+_ACEOF
 
+ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
+if test "x$ac_cv_func__doprnt" = xyes; then :
+
+$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
-$as_echo "$ac_cv_func_fork_works" >&6; }
 
-else
-  ac_cv_func_fork_works=$ac_cv_func_fork
 fi
-if test "x$ac_cv_func_fork_works" = xcross; then
-  case $host in
-    *-*-amigaos* | *-*-msdosdjgpp* | *-*-uclinux* )
-      # Override, as these systems have only a dummy fork() stub
-      ac_cv_func_fork_works=no
-      ;;
-    *)
-      ac_cv_func_fork_works=yes
-      ;;
-  esac
-  { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
-$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+done
+
+
+for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
+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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
 fi
-ac_cv_func_vfork_works=$ac_cv_func_vfork
-if test "x$ac_cv_func_vfork" = xyes; then
-  { $as_echo "$as_me:$LINENO: checking for working vfork" >&5
-$as_echo_n "checking for working vfork... " >&6; }
-if test "${ac_cv_func_vfork_works+set}" = set; then
+done
+
+
+# NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
+# so that AC_CHECK_FUNCS can detect functions in that library.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
+$as_echo_n "checking for sqrt in -lm... " >&6; }
+if ${ac_cv_lib_m_sqrt+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_vfork_works=cross
-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="-lm  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Thanks to Paul Eggert for this test.  */
-$ac_includes_default
-#include <sys/wait.h>
-#ifdef HAVE_VFORK_H
-# include <vfork.h>
-#endif
-/* On some sparc systems, changes by the child to local and incoming
-   argument registers are propagated back to the parent.  The compiler
-   is told about this with #include <vfork.h>, but some compilers
-   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
-   static variable whose address is put into a register that is
-   clobbered by the vfork.  */
-static void
+
+/* 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
-sparc_address_test (int arg)
-# else
-sparc_address_test (arg) int arg;
+extern "C"
 #endif
-{
-  static pid_t child;
-  if (!child) {
-    child = vfork ();
-    if (child < 0) {
-      perror ("vfork");
-      _exit(2);
-    }
-    if (!child) {
-      arg = getpid();
-      write(-1, "", 0);
-      _exit (arg);
-    }
-  }
-}
-
+char sqrt ();
 int
 main ()
 {
-  pid_t parent = getpid ();
-  pid_t child;
-
-  sparc_address_test (0);
-
-  child = vfork ();
-
-  if (child == 0) {
-    /* Here is another test for sparc vfork register problems.  This
-       test uses lots of local variables, at least as many local
-       variables as main has allocated so far including compiler
-       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
-       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
-       reuse the register of parent for one of the local variables,
-       since it will think that parent can't possibly be used any more
-       in this routine.  Assigning to the local variable will thus
-       munge parent in the parent process.  */
-    pid_t
-      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
-      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
-    /* Convince the compiler that p..p7 are live; otherwise, it might
-       use the same hardware register for all 8 local variables.  */
-    if (p != p1 || p != p2 || p != p3 || p != p4
-       || p != p5 || p != p6 || p != p7)
-      _exit(1);
-
-    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
-       from child file descriptors.  If the child closes a descriptor
-       before it execs or exits, this munges the parent's descriptor
-       as well.  Test for this by closing stdout in the child.  */
-    _exit(close(fileno(stdout)) != 0);
-  } else {
-    int status;
-    struct stat st;
-
-    while (wait(&status) != child)
-      ;
-    return (
-        /* Was there some problem with vforking?  */
-        child < 0
-
-        /* Did the child fail?  (This shouldn't happen.)  */
-        || status
-
-        /* Did the vfork/compiler bug occur?  */
-        || parent != getpid()
-
-        /* Did the file descriptor bug occur?  */
-        || fstat(fileno(stdout), &st) != 0
-        );
-  }
+return sqrt ();
+  ;
+  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_vfork_works=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_m_sqrt=yes
 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
-
-( exit $ac_status )
-ac_cv_func_vfork_works=no
+  ac_cv_lib_m_sqrt=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+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_m_sqrt" >&5
+$as_echo "$ac_cv_lib_m_sqrt" >&6; }
+if test "x$ac_cv_lib_m_sqrt" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
 
+  LIBS="-lm $LIBS"
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
-$as_echo "$ac_cv_func_vfork_works" >&6; }
-
-fi;
-if test "x$ac_cv_func_fork_works" = xcross; then
-  ac_cv_func_vfork_works=$ac_cv_func_vfork
-  { $as_echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
-$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
-fi
-
-if test "x$ac_cv_func_vfork_works" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WORKING_VFORK 1
-_ACEOF
-
-else
-
-cat >>confdefs.h <<\_ACEOF
-#define vfork fork
+# BSD might not have exp2, and/or log2
+for ac_func in exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil
+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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
-if test "x$ac_cv_func_fork_works" = xyes; then
+done
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_WORKING_FORK 1
+
+# Certain architectures don't really have long double, even though
+# AC_CHECK_FUNCS would otherwise find the following functions.
+if test "x${ac_cv_type_long_double_wider}" = "xyes" ; then
+       for ac_func in exp2l log2l exp10l log10l sinl cosl tanl asinl acosl atanl atan2l powl sqrtl rintl expl logl remainderl fmodl roundl truncl floorl ceill
+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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
-  PBX_WORKING_FORK=1
+fi
+done
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5
-$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_source+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LLONG_MAX in limits.h" >&5
+$as_echo_n "checking for LLONG_MAX in limits.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
+#include <limits.h>
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+long long foo = LLONG_MAX
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_sys_largefile_source=no; break
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_LLONG_MAX 1" >>confdefs.h
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for timersub in time.h" >&5
+$as_echo_n "checking for timersub in time.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/time.h>
+int
+main ()
+{
+struct timeval *a; timersub(a, a, a);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_TIMERSUB 1" >>confdefs.h
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of GNU ld that supports the --dynamic-list flag" >&5
+$as_echo_n "checking for a version of GNU ld that supports the --dynamic-list flag... " >&6; }
+old_LDFLAGS=${LDFLAGS}
+cat >conftest.dynamics <<_ACEOF
+{
+       *ast_*;
+};
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LDFLAGS="${LDFLAGS} -Wl,--dynamic-list,conftest.dynamics"
+PBX_DYNAMIC_LIST=0
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#define _LARGEFILE_SOURCE 1
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
+
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_sys_largefile_source=1; break
+if ac_fn_c_try_link "$LINENO"; then :
+  PBX_DYNAMIC_LIST=1
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+LDFLAGS=${old_LDFLAGS}
+rm -f conftest.dynamics
+
+ac_fn_c_check_header_mongrel "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_poll_h" = xyes; then :
+  HAS_POLL=1
 
+$as_echo "#define HAVE_SYS_POLL_H 1" >>confdefs.h
 
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-  ac_cv_sys_largefile_source=unknown
-  break
-done
+
+
+# Check whether --enable-internal-poll was given.
+if test "${enable_internal_poll+set}" = set; then :
+  enableval=$enable_internal_poll; case "${enableval}" in
+               y|ye|yes) HAS_POLL="";;
+               n|no) HAS_POLL="${HAS_POLL}" ;;
+               *) as_fn_error $? "bad value ${enableval} for --enable-internal-poll" "$LINENO" 5 ;;
+       esac
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5
-$as_echo "$ac_cv_sys_largefile_source" >&6; }
-case $ac_cv_sys_largefile_source in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
-_ACEOF
-;;
-esac
-rm -rf conftest*
 
-# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
-# in glibc 2.1.3, but that breaks too many other things.
-# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-if test $ac_cv_sys_largefile_source != unknown; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FSEEKO 1
+
+
+
+# https support (in main/http.c) uses funopen on BSD systems,
+# fopencookie on linux
+for ac_func in funopen fopencookie
+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 `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
+done
 
-if test $ac_cv_c_compiler_gnu = yes; then
-    { $as_echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
-$as_echo_n "checking whether $CC needs -traditional... " >&6; }
-if test "${ac_cv_prog_gcc_traditional+set}" = set; 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
-/* end confdefs.h.  */
-#include <sgtty.h>
-Autoconf TIOCGETP
+
+for ac_func in inet_aton
+do :
+  ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton"
+if test "x$ac_cv_func_inet_aton" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_INET_ATON 1
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then
-  ac_cv_prog_gcc_traditional=yes
-else
-  ac_cv_prog_gcc_traditional=no
+
 fi
-rm -f conftest*
+done
 
 
-  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
+# check if we have IP_PKTINFO constant defined
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IP_PKTINFO" >&5
+$as_echo_n "checking for IP_PKTINFO... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <termio.h>
-Autoconf TCGETA
+#include <netinet/in.h>
+int
+main ()
+{
+int pi = IP_PKTINFO;
+  ;
+  return 0;
+}
 _ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "$ac_pattern" >/dev/null 2>&1; then
-  ac_cv_prog_gcc_traditional=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PKTINFO 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
 fi
-rm -f conftest*
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+# some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname_r" >&5
+$as_echo_n "checking for library containing gethostbyname_r... " >&6; }
+if ${ac_cv_search_gethostbyname_r+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char gethostbyname_r ();
+int
+main ()
+{
+return gethostbyname_r ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' socket nsl; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_gethostbyname_r=$ac_res
 fi
-{ $as_echo "$as_me:$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
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_gethostbyname_r+:} false; then :
+  break
 fi
+done
+if ${ac_cv_search_gethostbyname_r+:} false; then :
 
-# XXX: these are commented out until we determine whether it matters if our malloc()
-# acts exactly like glibc's or not
-# AC_FUNC_MALLOC
-# AC_FUNC_REALLOC
-{ $as_echo "$as_me:$LINENO: checking for working memcmp" >&5
-$as_echo_n "checking for working memcmp... " >&6; }
-if test "${ac_cv_func_memcmp_working+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_memcmp_working=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_cv_search_gethostbyname_r=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname_r" >&5
+$as_echo "$ac_cv_search_gethostbyname_r" >&6; }
+ac_res=$ac_cv_search_gethostbyname_r
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 6 arguments" >&5
+$as_echo_n "checking for gethostbyname_r with 6 arguments... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <stdlib.h>
+                         #include <netdb.h>
 int
 main ()
 {
+struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-  /* Some versions of memcmp are not 8-bit clean.  */
-  char c0 = '\100', c1 = '\200', c2 = '\201';
-  if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
-    return 1;
+$as_echo "#define HAVE_GETHOSTBYNAME_R_6 1" >>confdefs.h
 
-  /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
-     or more and with at least one buffer not starting on a 4-byte boundary.
-     William Lewis provided this test program.   */
-  {
-    char foo[21];
-    char bar[21];
-    int i;
-    for (i = 0; i < 4; i++)
-      {
-       char *a = foo + i;
-       char *b = bar + i;
-       strcpy (a, "--------01111111");
-       strcpy (b, "--------10000000");
-       if (memcmp (a, b, 16) >= 0)
-         return 1;
-      }
-    return 0;
-  }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname_r with 5 arguments" >&5
+$as_echo_n "checking for gethostbyname_r with 5 arguments... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+                        #include <netdb.h>
+int
+main ()
+{
+struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_memcmp_working=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_GETHOSTBYNAME_R_5 1" >>confdefs.h
+
 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
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-( exit $ac_status )
-ac_cv_func_memcmp_working=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
+ac_fn_c_check_header_mongrel "$LINENO" "byteswap.h" "ac_cv_header_byteswap_h" "$ac_includes_default"
+if test "x$ac_cv_header_byteswap_h" = xyes; then :
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
-$as_echo "$ac_cv_func_memcmp_working" >&6; }
-test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
-  *" memcmp.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
- ;;
-esac
+cat >>confdefs.h <<_ACEOF
+#define HAVE_BYTESWAP_H 1
+_ACEOF
 
+fi
 
 
 
-for ac_header in stdlib.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __swap16 variant of <sys/endian.h> byteswapping macros" >&5
+$as_echo_n "checking for __swap16 variant of <sys/endian.h> byteswapping macros... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+#include <sys/endian.h>
+int
+main ()
+{
+int a = 1; int b = __swap16(a);
+  ;
+  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_SYS_ENDIAN_SWAP16 1" >>confdefs.h
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-       ac_header_compiler=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for bswap16 variant of <sys/endian.h> byteswapping macros" >&5
+$as_echo_n "checking for bswap16 variant of <sys/endian.h> byteswapping macros... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <$ac_header>
+#include <sys/endian.h>
+int
+main ()
+{
+int a = 1; int b = bswap16(a);
+  ;
+  return 0;
+}
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_SYS_ENDIAN_BSWAP16 1" >>confdefs.h
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-  ac_header_preproc=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+if test "${cross_compiling}" = "no";
+then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/urandom" >&5
+$as_echo_n "checking for /dev/urandom... " >&6; }
+if ${ac_cv_file__dev_urandom+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
+  test "$cross_compiling" = yes &&
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
+if test -r "/dev/urandom"; then
+  ac_cv_file__dev_urandom=yes
+else
+  ac_cv_file__dev_urandom=no
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_urandom" >&5
+$as_echo "$ac_cv_file__dev_urandom" >&6; }
+if test "x$ac_cv_file__dev_urandom" = xyes; then :
+
+$as_echo "#define HAVE_DEV_URANDOM 1" >>confdefs.h
 
 fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
 fi
 
-done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t in locale.h" >&5
+$as_echo_n "checking for locale_t in locale.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <locale.h>
+int
+main ()
+{
+locale_t lt = NULL
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
+$as_echo "#define HAVE_LOCALE_T_IN_LOCALE_H 1" >>confdefs.h
 
-for ac_func in getpagesize
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t in xlocale.h" >&5
+$as_echo_n "checking for locale_t in xlocale.h... " >&6; }
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+#include <xlocale.h>
+int
+main ()
+{
+locale_t lt = NULL
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+$as_echo "#define HAVE_LOCALE_T_IN_XLOCALE_H 1" >>confdefs.h
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-#undef $ac_func
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $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
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_EVTONLY in fcntl.h" >&5
+$as_echo_n "checking for O_EVTONLY in fcntl.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <fcntl.h>
 int
 main ()
 {
-return $ac_func ();
+int a = O_EVTONLY;
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-       eval "$as_ac_var=no"
-fi
+$as_echo "#define HAVE_O_EVTONLY 1" >>confdefs.h
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-done
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-{ $as_echo "$as_me:$LINENO: checking for working mmap" >&5
-$as_echo_n "checking for working mmap... " >&6; }
-if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_mmap_fixed_mapped=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for O_SYMLINK in fcntl.h" >&5
+$as_echo_n "checking for O_SYMLINK in fcntl.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
+#include <fcntl.h>
+int
+main ()
+{
+int a = O_SYMLINK;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-/* Thanks to Mike Haertel and Jim Avera for this test.
-   Here is a matrix of mmap possibilities:
-       mmap private not fixed
-       mmap private fixed at somewhere currently unmapped
-       mmap private fixed at somewhere already mapped
-       mmap shared not fixed
-       mmap shared fixed at somewhere currently unmapped
-       mmap shared fixed at somewhere already mapped
-   For private mappings, we should verify that changes cannot be read()
-   back from the file, nor mmap's back from the file at a different
-   address.  (There have been systems where private was not correctly
-   implemented like the infamous i386 svr4.0, and systems where the
-   VM page cache was not coherent with the file system buffer cache
-   like early versions of FreeBSD and possibly contemporary NetBSD.)
-   For shared mappings, we should conversely verify that changes get
-   propagated back to all the places they're supposed to be.
+$as_echo "#define HAVE_O_SYMLINK 1" >>confdefs.h
 
-   Grep wants private fixed already mapped.
-   The main things grep needs to know about mmap are:
-   * does it exist and is it safe to write into the mmap'd area
-   * how to use it (BSD variants)  */
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-#include <fcntl.h>
-#include <sys/mman.h>
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
-char *malloc ();
-#endif
 
-/* This mess was copied from the GNU getpagesize.h.  */
-#ifndef HAVE_GETPAGESIZE
-/* Assume that all systems that can run configure have sys/param.h.  */
-# ifndef HAVE_SYS_PARAM_H
-#  define HAVE_SYS_PARAM_H 1
-# endif
-
-# ifdef _SC_PAGESIZE
-#  define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-#  ifdef HAVE_SYS_PARAM_H
-#   include <sys/param.h>
-#   ifdef EXEC_PAGESIZE
-#    define getpagesize() EXEC_PAGESIZE
-#   else /* no EXEC_PAGESIZE */
-#    ifdef NBPG
-#     define getpagesize() NBPG * CLSIZE
-#     ifndef CLSIZE
-#      define CLSIZE 1
-#     endif /* no CLSIZE */
-#    else /* no NBPG */
-#     ifdef NBPC
-#      define getpagesize() NBPC
-#     else /* no NBPC */
-#      ifdef PAGESIZE
-#       define getpagesize() PAGESIZE
-#      endif /* PAGESIZE */
-#     endif /* no NBPC */
-#    endif /* no NBPG */
-#   endif /* no EXEC_PAGESIZE */
-#  else /* no HAVE_SYS_PARAM_H */
-#   define getpagesize() 8192  /* punt totally */
-#  endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
+    if test "x${PBX_PTHREAD_RWLOCK_INITIALIZER}" != "x1"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_RWLOCK_INITIALIZER in pthread.h" >&5
+$as_echo_n "checking for PTHREAD_RWLOCK_INITIALIZER in pthread.h... " >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${PTHREAD_RWLOCK_INITIALIZER_DIR}" != "x"; then
+           PTHREAD_RWLOCK_INITIALIZER_INCLUDE="-I${PTHREAD_RWLOCK_INITIALIZER_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${PTHREAD_RWLOCK_INITIALIZER_INCLUDE}"
 
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <pthread.h>
 int
 main ()
 {
-  char *data, *data2, *data3;
-  int i, pagesize;
-  int fd;
-
-  pagesize = getpagesize ();
-
-  /* First, make a file with some known garbage in it. */
-  data = (char *) malloc (pagesize);
-  if (!data)
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    *(data + i) = rand ();
-  umask (0);
-  fd = creat ("conftest.mmap", 0600);
-  if (fd < 0)
-    return 1;
-  if (write (fd, data, pagesize) != pagesize)
-    return 1;
-  close (fd);
-
-  /* Next, try to mmap the file at a fixed address which already has
-     something else allocated at it.  If we can, also make sure that
-     we see the same garbage.  */
-  fd = open ("conftest.mmap", O_RDWR);
-  if (fd < 0)
-    return 1;
-  data2 = (char *) malloc (2 * pagesize);
-  if (!data2)
-    return 1;
-  data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-                    MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data2 + i))
-      return 1;
+#if defined(PTHREAD_RWLOCK_INITIALIZER)
+                               int foo = 0;
+                               #else
+                               int foo = bar;
+                               #endif
+                               0
 
-  /* Finally, make sure that changes to the mapped area do not
-     percolate back to the file as seen by read().  (This is a bug on
-     some variants of i386 svr4.0.)  */
-  for (i = 0; i < pagesize; ++i)
-    *(data2 + i) = *(data2 + i) + 1;
-  data3 = (char *) malloc (pagesize);
-  if (!data3)
-    return 1;
-  if (read (fd, data3, pagesize) != pagesize)
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data3 + i))
-      return 1;
-  close (fd);
+  ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_mmap_fixed_mapped=yes
-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
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+               PBX_PTHREAD_RWLOCK_INITIALIZER=1
 
-( exit $ac_status )
-ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+$as_echo "#define HAVE_PTHREAD_RWLOCK_INITIALIZER 1" >>confdefs.h
 
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MMAP 1
-_ACEOF
+else
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-rm -f conftest.mmap
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    fi
 
 
 
-for ac_header in sys/select.h sys/socket.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h" >&5
+$as_echo_n "checking for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+#include <pthread.h>
+int
+main ()
+{
+int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;
+  ;
+  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP 1" >>confdefs.h
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-       ac_header_compiler=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h" >&5
+$as_echo_n "checking for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <$ac_header>
+#include <pthread.h>
+int
+main ()
+{
+int a = PTHREAD_MUTEX_RECURSIVE_NP;
+  ;
+  return 0;
+}
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+$as_echo "#define HAVE_PTHREAD_MUTEX_RECURSIVE_NP 1" >>confdefs.h
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-done
-
-{ $as_echo "$as_me:$LINENO: checking types of arguments for select" >&5
-$as_echo_n "checking types of arguments for select... " >&6; }
-if test "${ac_cv_func_select_args+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
- for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
-  for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_rwlock_timedwrlock() in pthread.h" >&5
+$as_echo_n "checking for pthread_rwlock_timedwrlock() in pthread.h... " >&6; }
+save_LIBS="$LIBS"
+save_CFLAGS="$CFLAGS"
+LIBS="$PTHREAD_LIBS $LIBS"
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#ifdef HAVE_SYS_SELECT_H
-# include <sys/select.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-# include <sys/socket.h>
-#endif
-
+#include <pthread.h>
+     #include <time.h>
 int
 main ()
 {
-extern int select ($ac_arg1,
-                                           $ac_arg234, $ac_arg234, $ac_arg234,
-                                           $ac_arg5);
+pthread_rwlock_t foo; struct timespec bar; pthread_rwlock_timedwrlock(&foo, &bar)
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
+if ac_fn_c_try_link "$LINENO"; then :
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    ac_cv_pthread_rwlock_timedwrlock="yes"
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ac_cv_pthread_rwlock_timedwrlock="no"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS="$save_LIBS"
+CFLAGS="$save_CFLAGS"
+if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
- done
-done
-# Provide a safe default value.
-: ${ac_cv_func_select_args='int,int *,struct timeval *'}
+$as_echo "#define HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK 1" >>confdefs.h
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5
-$as_echo "$ac_cv_func_select_args" >&6; }
-ac_save_IFS=$IFS; IFS=','
-set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
-IFS=$ac_save_IFS
-shift
 
-cat >>confdefs.h <<_ACEOF
-#define SELECT_TYPE_ARG1 $1
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if PTHREAD_ONCE_INIT needs braces" >&5
+$as_echo_n "checking if PTHREAD_ONCE_INIT needs braces... " >&6; }
+saved_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -Werror -Wmissing-braces"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <pthread.h>
+     void empty(){}
+int
+main ()
+{
+pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, empty);
+  ;
+  return 0;
+}
+
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ac_cv_pthread_once_needsbraces="no"
 
-cat >>confdefs.h <<_ACEOF
-#define SELECT_TYPE_ARG234 ($2)
-_ACEOF
+else
 
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    ac_cv_pthread_once_needsbraces="yes"
 
-cat >>confdefs.h <<_ACEOF
-#define SELECT_TYPE_ARG5 ($3)
-_ACEOF
 
-rm -f conftest*
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="${saved_CFLAGS}"
+if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
+
+$as_echo "#define PTHREAD_ONCE_INIT_NEEDS_BRACES 1" >>confdefs.h
 
-if test "${ac_cv_func_setvbuf_reversed+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_func_setvbuf_reversed=no
 fi
 
 
-{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; 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
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <signal.h>
+    if test "x${PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}" != "x1"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in pthread.h" >&5
+$as_echo_n "checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in pthread.h... " >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_DIR}" != "x"; then
+           PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_INCLUDE="-I${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_INCLUDE}"
 
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <pthread.h>
 int
 main ()
 {
-return *(signal (0, 0)) (0) == 1;
+#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
+                               int foo = 0;
+                               #else
+                               int foo = bar;
+                               #endif
+                               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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_signal=int
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+               PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP=1
+
+$as_echo "#define HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 1" >>confdefs.h
+
+
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-       ac_cv_type_signal=void
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
+       CPPFLAGS="${saved_cppflags}"
+    fi
 
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
 
 
-{ $as_echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
-$as_echo_n "checking whether lstat dereferences a symlink specified with a trailing slash... " >&6; }
-if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  rm -f conftest.sym conftest.file
-echo >conftest.file
-if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+# Can we compare a mutex to its initial value?
+# Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can compare a mutex to its initial value" >&5
+$as_echo_n "checking whether we can compare a mutex to its initial value... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+#include <pthread.h>
 int
 main ()
 {
-struct stat sbuf;
-     /* Linux will dereference the symlink and fail.
-       That is better in the sense that it means we will not
-       have to compile and use the lstat wrapper.  */
-     return lstat ("conftest.sym/", &sbuf) == 0;
+pthread_mutex_t lock;
+       if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
+               return 0;
+       }
+       return 0
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_lstat_dereferences_slashed_symlink=yes
-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
-
-( exit $ac_status )
-ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
+$as_echo "#define CAN_COMPARE_MUTEX_TO_INIT_VALUE 1" >>confdefs.h
 
 else
-  # If the `ln -s' command failed, then we probably don't even
-  # have an lstat function.
-  ac_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f conftest.sym conftest.file
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+#if test "${cross_compiling}" = "no";
+#then
+#AC_MSG_CHECKING(for working epoll support)
+#AC_LINK_IFELSE(
+#AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
+#                                        if (res < 0)
+#                                           return 1;
+#                                        close (res);
+#                                        return 0;]),
+#AC_MSG_RESULT(yes)
+#AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
+#AC_MSG_RESULT(no)
+#)
+#fi
 
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+# for FreeBSD thr_self
+for ac_header in sys/thr.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/thr.h" "ac_cv_header_sys_thr_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_thr_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_THR_H 1
 _ACEOF
 
+fi
 
-if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
-  case " $LIBOBJS " in
-  *" lstat.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
- ;;
-esac
+done
 
-fi
 
-{ $as_echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
-$as_echo_n "checking whether stat accepts an empty string... " >&6; }
-if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_stat_empty_string_bug=yes
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler atomic operations" >&5
+$as_echo_n "checking for compiler atomic operations... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
 int
 main ()
 {
-struct stat sbuf;
-  return stat ("", &sbuf) == 0;
+int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_stat_empty_string_bug=no
-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
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-( exit $ac_status )
-ac_cv_func_stat_empty_string_bug=yes
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+$as_echo "#define HAVE_GCC_ATOMICS 1" >>confdefs.h
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
-$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
-if test $ac_cv_func_stat_empty_string_bug = yes; then
-  case " $LIBOBJS " in
-  *" stat.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS stat.$ac_objext"
- ;;
-esac
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STAT_EMPTY_STRING_BUG 1
-_ACEOF
-
-fi
+# glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if your system printf is NULL-safe." >&5
+$as_echo_n "checking if your system printf is NULL-safe.... " >&6; }
+if test "$cross_compiling" = yes; then :
+  # It's unlikely an embedded system will have this.
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
 
-{ $as_echo "$as_me:$LINENO: checking for working strcoll" >&5
-$as_echo_n "checking for working strcoll... " >&6; }
-if test "${ac_cv_func_strcoll_works+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_strcoll_works=no
 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.  */
-$ac_includes_default
+#include <stdio.h>
 int
 main ()
 {
-return (strcoll ("abc", "def") >= 0 ||
-        strcoll ("ABC", "DEF") >= 0 ||
-        strcoll ("123", "456") >= 0)
+printf("%s", NULL)
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_strcoll_works=yes
-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
-
-( exit $ac_status )
-ac_cv_func_strcoll_works=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+if ac_fn_c_try_run "$LINENO"; then :
 
+$as_echo "#define HAVE_NULLSAFE_PRINTF 1" >>confdefs.h
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strcoll_works" >&5
-$as_echo "$ac_cv_func_strcoll_works" >&6; }
-if test $ac_cv_func_strcoll_works = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRCOLL 1
-_ACEOF
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
-for ac_func in strftime
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can increase the maximum select-able file descriptor" >&5
+$as_echo_n "checking if we can increase the maximum select-able file descriptor... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: cross-compile" >&5
+$as_echo "cross-compile" >&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.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
-   builtin and then its argument prototype would still apply.  */
-#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
+#include <stdio.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <string.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 int
 main ()
 {
-return $ac_func ();
+
+       struct rlimit rlim = { FD_SETSIZE * 2, FD_SETSIZE * 2 };
+       int fd0, fd1;
+       struct timeval tv = { 0, };
+       struct ast_fdset { long fds_bits[[1024]]; } fds = { { 0, } };
+       if (setrlimit(RLIMIT_NOFILE, &rlim)) { exit(1); }
+       if ((fd0 = open("/dev/null", O_RDONLY)) < 0) { exit(1); }
+       if (dup2(fd0, (fd1 = FD_SETSIZE + 1)) < 0) { exit(1); }
+       FD_SET(fd0, (fd_set *) &fds);
+       FD_SET(fd1, (fd_set *) &fds);
+       if (select(FD_SETSIZE + 2, (fd_set *) &fds, NULL, NULL, &tv) < 0) { exit(1); }
+       exit(0)
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-       eval "$as_ac_var=no"
-fi
+$as_echo "#define HAVE_VARIABLE_FDSET 1" >>confdefs.h
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
+
+if test "${ac_cv_have_variable_fdset}x" = "0x"; then
+       if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
 else
-  # strftime is in -lintl on SCO UNIX.
-{ $as_echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
-$as_echo_n "checking for strftime in -lintl... " >&6; }
-if test "${ac_cv_lib_intl_strftime+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lintl  $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.
-   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 strftime ();
+#include <unistd.h>
+#include <sys/types.h>
+#include <stdlib.h>
+
 int
 main ()
 {
-return strftime ();
+if (getuid() != 0) { exit(1); }
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_intl_strftime=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-       ac_cv_lib_intl_strftime=no
-fi
+$as_echo "#define CONFIGURE_RAN_AS_ROOT 1" >>confdefs.h
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
-$as_echo "$ac_cv_lib_intl_strftime" >&6; }
-if test "x$ac_cv_lib_intl_strftime" = x""yes; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_STRFTIME 1
-_ACEOF
-
-LIBS="-lintl $LIBS"
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 fi
-done
 
-{ $as_echo "$as_me:$LINENO: checking for working strnlen" >&5
-$as_echo_n "checking for working strnlen... " >&6; }
-if test "${ac_cv_func_strnlen_working+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_strnlen_working=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute pure' support" >&5
+$as_echo_n "checking for compiler 'attribute pure' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+ void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
 
-#define S "foobar"
-#define S_LEN (sizeof S - 1)
-
-  /* At least one implementation is buggy: that of AIX 4.3 would
-     give strnlen (S, 1) == 3.  */
-
-  int i;
-  for (i = 0; i < S_LEN + 1; ++i)
-    {
-      int expected = i <= S_LEN ? i : S_LEN;
-      if (strnlen (S, i) != expected)
-       return 1;
-    }
-  return 0;
-
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_strnlen_working=yes
-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
-
-( exit $ac_status )
-ac_cv_func_strnlen_working=no
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strnlen_working" >&5
-$as_echo "$ac_cv_func_strnlen_working" >&6; }
-test $ac_cv_func_strnlen_working = no && case " $LIBOBJS " in
-  *" strnlen.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS strnlen.$ac_objext"
- ;;
-esac
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_pure 1
+_ACEOF
 
-{ $as_echo "$as_me:$LINENO: checking for working strtod" >&5
-$as_echo_n "checking for working strtod... " >&6; }
-if test "${ac_cv_func_strtod+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  ac_cv_func_strtod=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 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.  */
-
-$ac_includes_default
-#ifndef strtod
-double strtod ();
-#endif
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
 int
-main()
+main ()
 {
-  {
-    /* Some versions of Linux strtod mis-parse strings with leading '+'.  */
-    char *string = " +69";
-    char *term;
-    double value;
-    value = strtod (string, &term);
-    if (value != 69 || term != (string + 4))
-      return 1;
-  }
 
-  {
-    /* Under Solaris 2.4, strtod returns the wrong value for the
-       terminating character under some conditions.  */
-    char *string = "NaN";
-    char *term;
-    strtod (string, &term);
-    if (term != string && *(term - 1) == 0)
-      return 1;
-  }
+  ;
   return 0;
 }
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_pure 1
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_strtod=yes
+
 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
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-( exit $ac_status )
-ac_cv_func_strtod=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strtod" >&5
-$as_echo "$ac_cv_func_strtod" >&6; }
-if test $ac_cv_func_strtod = no; then
-  case " $LIBOBJS " in
-  *" strtod.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS strtod.$ac_objext"
- ;;
-esac
-
-{ $as_echo "$as_me:$LINENO: checking for pow" >&5
-$as_echo_n "checking for pow... " >&6; }
-if test "${ac_cv_func_pow+set}" = set; 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
-/* end confdefs.h.  */
-/* Define pow to an innocuous variant, in case <limits.h> declares pow.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define pow innocuous_pow
+CFLAGS="$saved_CFLAGS"
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char pow (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef pow
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute malloc' support" >&5
+$as_echo_n "checking for compiler 'attribute malloc' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
-/* 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 pow ();
-/* 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_pow || defined __stub___pow
-choke me
-#endif
 
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func_pow=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-       ac_cv_func_pow=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_pow" >&5
-$as_echo "$ac_cv_func_pow" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_malloc 1
+_ACEOF
 
-if test $ac_cv_func_pow = no; then
-  { $as_echo "$as_me:$LINENO: checking for pow in -lm" >&5
-$as_echo_n "checking for pow in -lm... " >&6; }
-if test "${ac_cv_lib_m_pow+set}" = set; 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
-/* end confdefs.h.  */
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-/* 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 pow ();
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_m_pow=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-       ac_cv_lib_m_pow=no
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_pow" >&5
-$as_echo "$ac_cv_lib_m_pow" >&6; }
-if test "x$ac_cv_lib_m_pow" = x""yes; then
-  POW_LIB=-lm
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_malloc 1
+_ACEOF
+
 else
-  { $as_echo "$as_me:$LINENO: WARNING: cannot find library containing definition of pow" >&5
-$as_echo "$as_me: WARNING: cannot find library containing definition of pow" >&2;}
-fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
 
+CFLAGS="$saved_CFLAGS"
 
 
 
-for ac_header in $ac_header_list
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute const' support" >&5
+$as_echo_n "checking for compiler 'attribute const' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+ void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;}
+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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_const 1
+_ACEOF
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-       ac_header_compiler=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <$ac_header>
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-  ac_header_preproc=no
-fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_const 1
+_ACEOF
 
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
 else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
-done
+
+CFLAGS="$saved_CFLAGS"
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute unused' support" >&5
+$as_echo_n "checking for compiler 'attribute unused' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
 
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_unused 1
+_ACEOF
 
-{ $as_echo "$as_me:$LINENO: checking whether utime accepts a null argument" >&5
-$as_echo_n "checking whether utime accepts a null argument... " >&6; }
-if test "${ac_cv_func_utime_null+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  rm -f conftest.data; >conftest.data
-# Sequent interprets utime(file, 0) to mean use start of epoch.  Wrong.
-if test "$cross_compiling" = yes; then
-  ac_cv_func_utime_null=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 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.  */
-$ac_includes_default
-              #ifdef HAVE_UTIME_H
-              # include <utime.h>
-              #endif
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-struct stat s, t;
-  return ! (stat ("conftest.data", &s) == 0
-           && utime ("conftest.data", 0) == 0
-           && stat ("conftest.data", &t) == 0
-           && t.st_mtime >= s.st_mtime
-           && t.st_mtime - s.st_mtime < 120);
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_func_utime_null=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_unused 1
+_ACEOF
+
 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
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-( exit $ac_status )
-ac_cv_func_utime_null=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
 
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_utime_null" >&5
-$as_echo "$ac_cv_func_utime_null" >&6; }
-if test $ac_cv_func_utime_null = yes; then
+CFLAGS="$saved_CFLAGS"
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_UTIME_NULL 1
-_ACEOF
 
-fi
-rm -f conftest.data
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute always_inline' support" >&5
+$as_echo_n "checking for compiler 'attribute always_inline' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
-for ac_func in vprintf
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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
+
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
+ void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef $ac_func
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_always_inline 1
+_ACEOF
 
-/* 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 $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
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-return $ac_func ();
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-       eval "$as_ac_var=no"
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_always_inline 1
 _ACEOF
 
-{ $as_echo "$as_me:$LINENO: checking for _doprnt" >&5
-$as_echo_n "checking for _doprnt... " >&6; }
-if test "${ac_cv_func__doprnt+set}" = set; 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
-/* end confdefs.h.  */
-/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define _doprnt innocuous__doprnt
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char _doprnt (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef _doprnt
+CFLAGS="$saved_CFLAGS"
 
-/* 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 _doprnt ();
-/* 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__doprnt || defined __stub____doprnt
-choke me
-#endif
 
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute deprecated' support" >&5
+$as_echo_n "checking for compiler 'attribute deprecated' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+
+
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-return _doprnt ();
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_func__doprnt=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_func__doprnt=no
-fi
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
-$as_echo "$ac_cv_func__doprnt" >&6; }
-if test "x$ac_cv_func__doprnt" = x""yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DOPRNT 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_deprecated 1
 _ACEOF
 
-fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-done
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_deprecated 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
 
+CFLAGS="$saved_CFLAGS"
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute sentinel' support" >&5
+$as_echo_n "checking for compiler 'attribute sentinel' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
 
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_sentinel 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_sentinel 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
 
+CFLAGS="$saved_CFLAGS"
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute warn_unused_result' support" >&5
+$as_echo_n "checking for compiler 'attribute warn_unused_result' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
 
 
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_warn_unused_result 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_warn_unused_result 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
 
+CFLAGS="$saved_CFLAGS"
 
 
 
+# Support weak symbols on a platform specific basis.  The Mac OS X
+# (Darwin) support must be isolated from the other platforms because
+# it has caused other platforms to fail.
+#
+case "${OSARCH}" in
+       darwin*)
+       # Allow weak symbol support on Darwin platforms only because there
+       # is active community support for it.
+       # However, Darwin seems to break weak symbols for each new version.
+       #
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weak_import' support" >&5
+$as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+PBX_WEAKREF=0
 
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weak_import 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weak_import 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
 
+CFLAGS="$saved_CFLAGS"
 
 
 
+       # Several other platforms including Linux have GCC versions that
+       # define the weak attribute.  However, this attribute is only
+       # setup for use in the code by Darwin.
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weak' support" >&5
+$as_echo_n "checking for compiler 'attribute weak' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+PBX_WEAKREF=0
 
-for ac_func in asprintf atexit closefrom dup2 eaccess endpwent euidaccess ffsll ftruncate getcwd gethostbyname gethostname getloadavg gettimeofday glob htonll ioperm inet_ntoa isascii memchr memmove memset mkdir mkdtemp munmap ntohll newlocale ppoll putenv re_comp regcomp select setenv socket strcasecmp strcasestr strchr strcspn strdup strerror strlcat strlcpy strncasecmp strndup strnlen strrchr strsep strspn strstr strtod strtol strtold strtoq unsetenv utime vasprintf getpeereid sysctl swapctl
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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
+if test "x" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
-   builtin and then its argument prototype would still apply.  */
-#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
-
+ void __attribute__((weak)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-return $ac_func ();
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weak 1
 _ACEOF
 
-fi
-done
-
-
-# NOTE: we use AC_CHECK_LIB to get -lm into the arguments for later checks,
-# so that AC_CHECK_FUNCS can detect functions in that library.
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-{ $as_echo "$as_me:$LINENO: checking for sqrt in -lm" >&5
-$as_echo_n "checking for sqrt in -lm... " >&6; }
-if test "${ac_cv_lib_m_sqrt+set}" = set; then
-  $as_echo_n "(cached) " >&6
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 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.
-   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 sqrt ();
+ void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-return sqrt ();
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_m_sqrt=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_m_sqrt=no
-fi
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5
-$as_echo "$ac_cv_lib_m_sqrt" >&6; }
-if test "x$ac_cv_lib_m_sqrt" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weak 1
 _ACEOF
 
-  LIBS="-lm $LIBS"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-
-# BSD might not have exp2, and/or log2
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
 
+CFLAGS="$saved_CFLAGS"
 
 
+       ;;
+       linux-gnu)
+       # Primarily support weak symbols on Linux platforms.
+       #
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weakref' support" >&5
+$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+PBX_WEAKREF=0
 
+if test "xweakref("foo")" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weakref 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weakref 1
+_ACEOF
 
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
 
+CFLAGS="$saved_CFLAGS"
 
 
+       ;;
+       *)
+       # Allow weak symbols on other platforms.  However, any problems
+       # with this feature on other platforms must be fixed by the
+       # community.
+       #
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler 'attribute weakref' support" >&5
+$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
+PBX_WEAKREF=0
 
-for ac_func in exp2 log2 exp10 log10 sin cos tan asin acos atan atan2 pow rint exp log remainder fmod round trunc floor ceil
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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
+if test "xweakref("foo")" = "x"
+then
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
-   builtin and then its argument prototype would still apply.  */
-#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
-
+static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-return $ac_func ();
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-# Certain architectures don't really have long double, even though
-# AC_CHECK_FUNCS would otherwise find the following functions.
-if test "x${ac_cv_type_long_double_wider}" = "xyes" ; then
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
-for ac_func in exp2l log2l exp10l log10l sinl cosl tanl asinl acosl atanl atan2l powl sqrtl rintl expl logl remainderl fmodl roundl truncl floorl ceill
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weakref 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
-   builtin and then its argument prototype would still apply.  */
-#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
 
-int
-main ()
-{
-return $ac_func ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-
-{ $as_echo "$as_me:$LINENO: checking for LLONG_MAX in limits.h" >&5
-$as_echo_n "checking for LLONG_MAX in limits.h... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <limits.h>
+static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
 int
 main ()
 {
-long long foo = LLONG_MAX
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+       PBX_WEAKREF=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LLONG_MAX 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ATTRIBUTE_weakref 1
 _ACEOF
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 
-{ $as_echo "$as_me:$LINENO: checking for timersub in time.h" >&5
-$as_echo_n "checking for timersub in time.h... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+CFLAGS="$saved_CFLAGS"
+
+
+       ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ffunction-sections support" >&5
+$as_echo_n "checking for -ffunction-sections support... " >&6; }
+saved_CFLAGS="${CFLAGS}"
+CFLAGS="${CFLAGS} -ffunction-sections"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/time.h>
+
 int
 main ()
 {
-struct timeval *a; timersub(a, a, a);
+int x = 1;
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TIMERSUB 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-{ $as_echo "$as_me:$LINENO: checking for a version of GNU ld that supports the --dynamic-list flag" >&5
-$as_echo_n "checking for a version of GNU ld that supports the --dynamic-list flag... " >&6; }
-old_LDFLAGS=${LDFLAGS}
-cat >conftest.dynamics <<_ACEOF
-{
-       *ast_*;
-};
-_ACEOF
-LDFLAGS="${LDFLAGS} -Wl,--dynamic-list,conftest.dynamics"
-PBX_DYNAMIC_LIST=0
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+       saved_LDFLAGS="${LDFLAGS}"
+       LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --gc-sections support" >&5
+$as_echo_n "checking for --gc-sections support... " >&6; }
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
-
+int x = 1;
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  PBX_DYNAMIC_LIST=1
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+               GC_CFLAGS="-ffunction-sections"
+               GC_LDFLAGS="-Wl,--gc-sections"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+       LDFLAGS="${saved_LDFLAGS}"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="${saved_CFLAGS}"
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 
-LDFLAGS=${old_LDFLAGS}
-rm -f conftest.dynamics
 
-if test "${ac_cv_header_sys_poll_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/poll.h" >&5
-$as_echo_n "checking for sys/poll.h... " >&6; }
-if test "${ac_cv_header_sys_poll_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_poll_h" >&5
-$as_echo "$ac_cv_header_sys_poll_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/poll.h usability" >&5
-$as_echo_n "checking sys/poll.h usability... " >&6; }
-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 <sys/poll.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wdeclaration-after-statement support" >&5
+$as_echo_n "checking for -Wdeclaration-after-statement support... " >&6; }
+if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       AST_DECLARATION_AFTER_STATEMENT=
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/poll.h presence" >&5
-$as_echo_n "checking sys/poll.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/poll.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FORTIFY_SOURCE support" >&5
+$as_echo_n "checking for _FORTIFY_SOURCE support... " >&6; }
+if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       AST_FORTIFY_SOURCE=
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sys/poll.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/poll.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/poll.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/poll.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/poll.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/poll.h" >&5
-$as_echo_n "checking for sys/poll.h... " >&6; }
-if test "${ac_cv_header_sys_poll_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-strict-overflow" >&5
+$as_echo_n "checking for -fno-strict-overflow... " >&6; }
+if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
 else
-  ac_cv_header_sys_poll_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_poll_h" >&5
-$as_echo "$ac_cv_header_sys_poll_h" >&6; }
-
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       AST_NO_STRICT_OVERFLOW=
 fi
-if test "x$ac_cv_header_sys_poll_h" = x""yes; then
-  HAS_POLL=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_POLL_H 1
-_ACEOF
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wshadow" >&5
+$as_echo_n "checking for -Wshadow... " >&6; }
+if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       AST_SHADOW_WARNINGS=-Wshadow
+else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       AST_SHADOW_WARNINGS=
 fi
 
 
-
-# Check whether --enable-internal-poll was given.
-if test "${enable_internal_poll+set}" = set; then
-  enableval=$enable_internal_poll; case "${enableval}" in
-               y|ye|yes) HAS_POLL="";;
-               n|no) HAS_POLL="${HAS_POLL}" ;;
-               *) { { $as_echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-internal-poll" >&5
-$as_echo "$as_me: error: bad value ${enableval} for --enable-internal-poll" >&2;}
-   { (exit 1); exit 1; }; } ;;
-       esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -march=native" >&5
+$as_echo_n "checking for -march=native... " >&6; }
+if $(${CC} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+       AST_MARCH_NATIVE="-march=native"
+else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+       AST_MARCH_NATIVE=
 fi
 
 
-
-
-
-# https support (in main/http.c) uses funopen on BSD systems,
-# fopencookie on linux
-
-
-for ac_func in funopen fopencookie
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysinfo" >&5
+$as_echo_n "checking for sysinfo... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
-   builtin and then its argument prototype would still apply.  */
-#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
-
+#include <sys/sysinfo.h>
 int
 main ()
 {
-return $ac_func ();
+struct sysinfo sys_info; int uptime = sys_info.uptime
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-       eval "$as_ac_var=no"
-fi
+$as_echo "#define HAVE_SYSINFO 1" >>confdefs.h
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
 fi
-done
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-
-
-for ac_func in inet_aton
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_9_ninit" >&5
+$as_echo_n "checking for library containing res_9_ninit... " >&6; }
+if ${ac_cv_search_res_9_ninit+:} 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_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
@@ -20255,141 +16028,83 @@ 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 res_9_ninit ();
 int
 main ()
 {
-return $ac_func ();
+return res_9_ninit ();
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
+for ac_lib in '' resolv; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_res_9_ninit=$ac_res
 fi
-
-rm -rf conftest.dSYM
-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
+  if ${ac_cv_search_res_9_ninit+:} false; then :
+  break
 fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+done
+if ${ac_cv_search_res_9_ninit+:} false; then :
 
+else
+  ac_cv_search_res_9_ninit=no
 fi
-done
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_9_ninit" >&5
+$as_echo "$ac_cv_search_res_9_ninit" >&6; }
+ac_res=$ac_cv_search_res_9_ninit
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
+fi
 
-# check if we have IP_PKTINFO constant defined
-{ $as_echo "$as_me:$LINENO: checking for IP_PKTINFO" >&5
-$as_echo_n "checking for IP_PKTINFO... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_ninit" >&5
+$as_echo_n "checking for res_ninit... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <netinet/in.h>
+
+                       #ifdef HAVE_SYS_SOCKET_H
+                       #include <sys/socket.h>
+                       #endif
+                       #ifdef HAVE_NETINET_IN_H
+                       #include <netinet/in.h>
+                       #endif
+                       #ifdef HAVE_ARPA_NAMESER_H
+                       #include <arpa/nameser.h>
+                       #endif
+                       #include <resolv.h>
 int
 main ()
 {
-int pi = IP_PKTINFO;
+int foo = res_ninit(NULL);
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PKTINFO 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+$as_echo "#define HAVE_RES_NINIT 1" >>confdefs.h
 
-# some systems already have gethostbyname_r so we don't need to build ours in main/utils.c
-{ $as_echo "$as_me:$LINENO: checking for library containing gethostbyname_r" >&5
-$as_echo_n "checking for library containing gethostbyname_r... " >&6; }
-if test "${ac_cv_search_gethostbyname_r+set}" = set; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_9_ndestroy" >&5
+$as_echo_n "checking for library containing res_9_ndestroy... " >&6; }
+if ${ac_cv_search_res_9_ndestroy+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$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.
@@ -20398,732 +16113,294 @@ cat >>conftest.$ac_ext <<_ACEOF
 #ifdef __cplusplus
 extern "C"
 #endif
-char gethostbyname_r ();
+char res_9_ndestroy ();
 int
 main ()
 {
-return gethostbyname_r ();
+return res_9_ndestroy ();
   ;
   return 0;
 }
 _ACEOF
-for ac_lib in '' socket nsl; do
+for ac_lib in '' resolv; do
   if test -z "$ac_lib"; then
     ac_res="none required"
   else
     ac_res=-l$ac_lib
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
-  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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_search_gethostbyname_r=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_res_9_ndestroy=$ac_res
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_gethostbyname_r+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_res_9_ndestroy+:} false; then :
   break
 fi
 done
-if test "${ac_cv_search_gethostbyname_r+set}" = set; then
-  :
+if ${ac_cv_search_res_9_ndestroy+:} false; then :
+
 else
-  ac_cv_search_gethostbyname_r=no
+  ac_cv_search_res_9_ndestroy=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname_r" >&5
-$as_echo "$ac_cv_search_gethostbyname_r" >&6; }
-ac_res=$ac_cv_search_gethostbyname_r
-if test "$ac_res" != no; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_9_ndestroy" >&5
+$as_echo "$ac_cv_search_res_9_ndestroy" >&6; }
+ac_res=$ac_cv_search_res_9_ndestroy
+if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_ndestroy" >&5
+$as_echo_n "checking for res_ndestroy... " >&6; }
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-{ $as_echo "$as_me:$LINENO: checking for gethostbyname_r with 6 arguments" >&5
-$as_echo_n "checking for gethostbyname_r with 6 arguments... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-                         #include <netdb.h>
+                               #ifdef HAVE_SYS_SOCKET_H
+                               #include <sys/socket.h>
+                               #endif
+                               #ifdef HAVE_NETINET_IN_H
+                               #include <netinet/in.h>
+                               #endif
+                               #ifdef HAVE_ARPA_NAMESER_H
+                               #include <arpa/nameser.h>
+                               #endif
+                               #include <resolv.h>
 int
 main ()
 {
-struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);
+res_ndestroy(NULL);
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETHOSTBYNAME_R_6 1
-_ACEOF
+$as_echo "#define HAVE_RES_NDESTROY 1" >>confdefs.h
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-{ $as_echo "$as_me:$LINENO: checking for gethostbyname_r with 5 arguments" >&5
-$as_echo_n "checking for gethostbyname_r with 5 arguments... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing res_9_close" >&5
+$as_echo_n "checking for library containing res_9_close... " >&6; }
+if ${ac_cv_search_res_9_close+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
-                        #include <netdb.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char res_9_close ();
 int
 main ()
 {
-struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);
+return res_9_close ();
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETHOSTBYNAME_R_5 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-if test "${ac_cv_header_byteswap_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for byteswap.h" >&5
-$as_echo_n "checking for byteswap.h... " >&6; }
-if test "${ac_cv_header_byteswap_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_byteswap_h" >&5
-$as_echo "$ac_cv_header_byteswap_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking byteswap.h usability" >&5
-$as_echo_n "checking byteswap.h usability... " >&6; }
-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 <byteswap.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
+for ac_lib in '' resolv; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_res_9_close=$ac_res
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking byteswap.h presence" >&5
-$as_echo_n "checking byteswap.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <byteswap.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_res_9_close+:} false; then :
+  break
 fi
+done
+if ${ac_cv_search_res_9_close+:} false; then :
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: byteswap.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: byteswap.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: byteswap.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: byteswap.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: byteswap.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: byteswap.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: byteswap.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: byteswap.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: byteswap.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: byteswap.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: byteswap.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: byteswap.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: byteswap.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: byteswap.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: byteswap.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: byteswap.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for byteswap.h" >&5
-$as_echo_n "checking for byteswap.h... " >&6; }
-if test "${ac_cv_header_byteswap_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
 else
-  ac_cv_header_byteswap_h=$ac_header_preproc
+  ac_cv_search_res_9_close=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_byteswap_h" >&5
-$as_echo "$ac_cv_header_byteswap_h" >&6; }
-
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
 fi
-if test "x$ac_cv_header_byteswap_h" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_BYTESWAP_H 1
-_ACEOF
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_res_9_close" >&5
+$as_echo "$ac_cv_search_res_9_close" >&6; }
+ac_res=$ac_cv_search_res_9_close
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
-
-
-{ $as_echo "$as_me:$LINENO: checking for __swap16 variant of <sys/endian.h> byteswapping macros" >&5
-$as_echo_n "checking for __swap16 variant of <sys/endian.h> byteswapping macros... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_close" >&5
+$as_echo_n "checking for res_close... " >&6; }
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/endian.h>
+
+                               #ifdef HAVE_SYS_SOCKET_H
+                               #include <sys/socket.h>
+                               #endif
+                               #ifdef HAVE_NETINET_IN_H
+                               #include <netinet/in.h>
+                               #endif
+                               #ifdef HAVE_ARPA_NAMESER_H
+                               #include <arpa/nameser.h>
+                               #endif
+                               #include <resolv.h>
 int
 main ()
 {
-int a = 1; int b = __swap16(a);
+res_close();
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_ENDIAN_SWAP16 1
-_ACEOF
+$as_echo "#define HAVE_RES_CLOSE 1" >>confdefs.h
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-{ $as_echo "$as_me:$LINENO: checking for bswap16 variant of <sys/endian.h> byteswapping macros" >&5
-$as_echo_n "checking for bswap16 variant of <sys/endian.h> byteswapping macros... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/endian.h>
-int
-main ()
-{
-int a = 1; int b = bswap16(a);
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_ENDIAN_BSWAP16 1
-_ACEOF
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-if test "${cross_compiling}" = "no";
-then
-  { $as_echo "$as_me:$LINENO: checking for /dev/urandom" >&5
-$as_echo_n "checking for /dev/urandom... " >&6; }
-if test "${ac_cv_file__dev_urandom+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  test "$cross_compiling" = yes &&
-  { { $as_echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-$as_echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
-if test -r "/dev/urandom"; then
-  ac_cv_file__dev_urandom=yes
-else
-  ac_cv_file__dev_urandom=no
-fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_file__dev_urandom" >&5
-$as_echo "$ac_cv_file__dev_urandom" >&6; }
-if test "x$ac_cv_file__dev_urandom" = x""yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DEV_URANDOM 1
-_ACEOF
-
-fi
 
-fi
+    if test "x${PBX_GLOB_NOMAGIC}" != "x1"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_NOMAGIC in glob.h" >&5
+$as_echo_n "checking for GLOB_NOMAGIC in glob.h... " >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${GLOB_NOMAGIC_DIR}" != "x"; then
+           GLOB_NOMAGIC_INCLUDE="-I${GLOB_NOMAGIC_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${GLOB_NOMAGIC_INCLUDE}"
 
-{ $as_echo "$as_me:$LINENO: checking for locale_t in locale.h" >&5
-$as_echo_n "checking for locale_t in locale.h... " >&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.  */
-#include <locale.h>
+ #include <glob.h>
 int
 main ()
 {
-locale_t lt = NULL
+#if defined(GLOB_NOMAGIC)
+                               int foo = 0;
+                               #else
+                               int foo = bar;
+                               #endif
+                               0
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+               PBX_GLOB_NOMAGIC=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LOCALE_T_IN_LOCALE_H 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+$as_echo "#define HAVE_GLOB_NOMAGIC 1" >>confdefs.h
 
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-  { $as_echo "$as_me:$LINENO: checking for locale_t in xlocale.h" >&5
-$as_echo_n "checking for locale_t in xlocale.h... " >&6; }
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <xlocale.h>
-int
-main ()
-{
-locale_t lt = NULL
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LOCALE_T_IN_XLOCALE_H 1
-_ACEOF
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 
-fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 
-{ $as_echo "$as_me:$LINENO: checking for O_EVTONLY in fcntl.h" >&5
-$as_echo_n "checking for O_EVTONLY in fcntl.h... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+    if test "x${PBX_GLOB_BRACE}" != "x1"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLOB_BRACE in glob.h" >&5
+$as_echo_n "checking for GLOB_BRACE in glob.h... " >&6; }
+       saved_cppflags="${CPPFLAGS}"
+       if test "x${GLOB_BRACE_DIR}" != "x"; then
+           GLOB_BRACE_INCLUDE="-I${GLOB_BRACE_DIR}/include"
+       fi
+       CPPFLAGS="${CPPFLAGS} ${GLOB_BRACE_INCLUDE}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <fcntl.h>
+ #include <glob.h>
 int
 main ()
 {
-int a = O_EVTONLY;
+#if defined(GLOB_BRACE)
+                               int foo = 0;
+                               #else
+                               int foo = bar;
+                               #endif
+                               0
+
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+               PBX_GLOB_BRACE=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_O_EVTONLY 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+$as_echo "#define HAVE_GLOB_BRACE 1" >>confdefs.h
 
-{ $as_echo "$as_me:$LINENO: checking for O_SYMLINK in fcntl.h" >&5
-$as_echo_n "checking for O_SYMLINK in fcntl.h... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <fcntl.h>
-int
-main ()
-{
-int a = O_SYMLINK;
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_O_SYMLINK 1
-_ACEOF
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CPPFLAGS="${saved_cppflags}"
+    fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 
 
-    if test "x${PBX_PTHREAD_RWLOCK_INITIALIZER}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for PTHREAD_RWLOCK_INITIALIZER in pthread.h" >&5
-$as_echo_n "checking for PTHREAD_RWLOCK_INITIALIZER in pthread.h... " >&6; }
+
+    if test "x${PBX_IP_MTU_DISCOVER}" != "x1"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IP_MTU_DISCOVER in netinet/in.h" >&5
+$as_echo_n "checking for IP_MTU_DISCOVER in netinet/in.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
-       if test "x${PTHREAD_RWLOCK_INITIALIZER_DIR}" != "x"; then
-           PTHREAD_RWLOCK_INITIALIZER_INCLUDE="-I${PTHREAD_RWLOCK_INITIALIZER_DIR}/include"
+       if test "x${IP_MTU_DISCOVER_DIR}" != "x"; then
+           IP_MTU_DISCOVER_INCLUDE="-I${IP_MTU_DISCOVER_DIR}/include"
        fi
-       CPPFLAGS="${CPPFLAGS} ${PTHREAD_RWLOCK_INITIALIZER_INCLUDE}"
+       CPPFLAGS="${CPPFLAGS} ${IP_MTU_DISCOVER_INCLUDE}"
 
-       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 <pthread.h>
+ #include <netinet/in.h>
 int
 main ()
 {
-#if defined(PTHREAD_RWLOCK_INITIALIZER)
+#if defined(IP_MTU_DISCOVER)
                                int foo = 0;
                                #else
                                int foo = bar;
@@ -21134,6228 +16411,266 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-               PBX_PTHREAD_RWLOCK_INITIALIZER=1
+               PBX_IP_MTU_DISCOVER=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD_RWLOCK_INITIALIZER 1
-_ACEOF
+$as_echo "#define HAVE_IP_MTU_DISCOVER 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h" >&5
-$as_echo_n "checking for PTHREAD_RWLOCK_PREFER_WRITER_NP in pthread.h... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
-int
-main ()
-{
-int a = PTHREAD_RWLOCK_PREFER_WRITER_NP;
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
+ac_fn_c_check_header_mongrel "$LINENO" "libkern/OSAtomic.h" "ac_cv_header_libkern_OSAtomic_h" "$ac_includes_default"
+if test "x$ac_cv_header_libkern_OSAtomic_h" = xyes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP 1
+cat >>confdefs.h <<_ACEOF
+#define HAVE_OSX_ATOMICS 1
 _ACEOF
 
+fi
+
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int"        "$ac_includes_default"; then :
 
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+else
+  if test "$ac_cv_type_int" = yes; then
+     { { $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 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_int=0
+   fi
+fi
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 
-{ $as_echo "$as_me:$LINENO: checking for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h" >&5
-$as_echo_n "checking for PTHREAD_MUTEX_RECURSIVE_NP in pthread.h... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
-int
-main ()
-{
-int a = PTHREAD_MUTEX_RECURSIVE_NP;
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD_MUTEX_RECURSIVE_NP 1
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
 _ACEOF
 
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
 
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
+else
+  if test "$ac_cv_type_long" = yes; then
+     { { $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 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long=0
+   fi
+fi
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
 
-{ $as_echo "$as_me:$LINENO: checking for pthread_rwlock_timedwrlock() in pthread.h" >&5
-$as_echo_n "checking for pthread_rwlock_timedwrlock() in pthread.h... " >&6; }
-save_LIBS="$LIBS"
-save_CFLAGS="$CFLAGS"
-LIBS="$PTHREAD_LIBS $LIBS"
-CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
-     #include <time.h>
-int
-main ()
-{
-pthread_rwlock_t foo; struct timespec bar; pthread_rwlock_timedwrlock(&foo, &bar)
-  ;
-  return 0;
-}
 
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
 
-    { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-    ac_cv_pthread_rwlock_timedwrlock="yes"
 
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-    { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-    ac_cv_pthread_rwlock_timedwrlock="no"
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS="$save_LIBS"
-CFLAGS="$save_CFLAGS"
-if test "${ac_cv_pthread_rwlock_timedwrlock}" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD_RWLOCK_TIMEDWRLOCK 1
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking if PTHREAD_ONCE_INIT needs braces" >&5
-$as_echo_n "checking if PTHREAD_ONCE_INIT needs braces... " >&6; }
-saved_CFLAGS="${CFLAGS}"
-CFLAGS="${CFLAGS} -Werror -Wmissing-braces"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
-     void empty(){}
-int
-main ()
-{
-pthread_once_t once = PTHREAD_ONCE_INIT; pthread_once(&once, empty);
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-
-    { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-    ac_cv_pthread_once_needsbraces="no"
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-    { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-    ac_cv_pthread_once_needsbraces="yes"
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-CFLAGS="${saved_CFLAGS}"
-if test "${ac_cv_pthread_once_needsbraces}" = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define PTHREAD_ONCE_INIT_NEEDS_BRACES 1
-_ACEOF
-
-fi
-
-
-    if test "x${PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in pthread.h" >&5
-$as_echo_n "checking for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP in pthread.h... " >&6; }
-       saved_cppflags="${CPPFLAGS}"
-       if test "x${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_DIR}" != "x"; then
-           PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_INCLUDE="-I${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_DIR}/include"
-       fi
-       CPPFLAGS="${CPPFLAGS} ${PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP_INCLUDE}"
-
-       cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
-int
-main ()
-{
-#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
-                               int foo = 0;
-                               #else
-                               int foo = bar;
-                               #endif
-                               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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-               PBX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 1
-_ACEOF
-
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CPPFLAGS="${saved_cppflags}"
-    fi
-
-
-
-# Can we compare a mutex to its initial value?
-# Generally yes on OpenBSD/FreeBSD and no on Mac OS X.
-{ $as_echo "$as_me:$LINENO: checking whether we can compare a mutex to its initial value" >&5
-$as_echo_n "checking whether we can compare a mutex to its initial value... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <pthread.h>
-int
-main ()
-{
-pthread_mutex_t lock;
-       if ((lock) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
-               return 0;
-       }
-       return 0
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define CAN_COMPARE_MUTEX_TO_INIT_VALUE 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-#if test "${cross_compiling}" = "no";
-#then
-#AC_MSG_CHECKING(for working epoll support)
-#AC_LINK_IFELSE(
-#AC_LANG_PROGRAM([#include <sys/epoll.h>], [int res = epoll_create(10);
-#                                        if (res < 0)
-#                                           return 1;
-#                                        close (res);
-#                                        return 0;]),
-#AC_MSG_RESULT(yes)
-#AC_DEFINE([HAVE_EPOLL], 1, [Define to 1 if your system has working epoll support.]),
-#AC_MSG_RESULT(no)
-#)
-#fi
-
-# for FreeBSD thr_self
-
-for ac_header in sys/thr.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler atomic operations" >&5
-$as_echo_n "checking for compiler atomic operations... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GCC_ATOMICS 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-# glibc, AFAIK, is the only C library that makes printing a NULL to a string safe.
-{ $as_echo "$as_me:$LINENO: checking if your system printf is NULL-safe." >&5
-$as_echo_n "checking if your system printf is NULL-safe.... " >&6; }
-if test "$cross_compiling" = yes; then
-  # It's unlikely an embedded system will have this.
-       { $as_echo "$as_me:$LINENO: result: unknown" >&5
-$as_echo "unknown" >&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 <stdio.h>
-int
-main ()
-{
-printf("%s", NULL)
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NULLSAFE_PRINTF 1
-_ACEOF
-
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-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
-
-( exit $ac_status )
-{ $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
-{ $as_echo "$as_me:$LINENO: checking if we can increase the maximum select-able file descriptor" >&5
-$as_echo_n "checking if we can increase the maximum select-able file descriptor... " >&6; }
-if test "$cross_compiling" = yes; then
-  { $as_echo "$as_me:$LINENO: result: cross-compile" >&5
-$as_echo "cross-compile" >&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 <stdio.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-int
-main ()
-{
-
-       struct rlimit rlim = { FD_SETSIZE * 2, FD_SETSIZE * 2 };
-       int fd0, fd1;
-       struct timeval tv = { 0, };
-       struct ast_fdset { long fds_bits[[1024]]; } fds = { { 0, } };
-       if (setrlimit(RLIMIT_NOFILE, &rlim)) { exit(1); }
-       if ((fd0 = open("/dev/null", O_RDONLY)) < 0) { exit(1); }
-       if (dup2(fd0, (fd1 = FD_SETSIZE + 1)) < 0) { exit(1); }
-       FD_SET(fd0, (fd_set *) &fds);
-       FD_SET(fd1, (fd_set *) &fds);
-       if (select(FD_SETSIZE + 2, (fd_set *) &fds, NULL, NULL, &tv) < 0) { exit(1); }
-       exit(0)
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_VARIABLE_FDSET 1
-_ACEOF
-
-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
-
-( exit $ac_status )
-{ $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
-if test "${ac_cv_have_variable_fdset}x" = "0x"; then
-       if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <stdlib.h>
-
-int
-main ()
-{
-if (getuid() != 0) { exit(1); }
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-
-cat >>confdefs.h <<\_ACEOF
-#define CONFIGURE_RAN_AS_ROOT 1
-_ACEOF
-
-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
-
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute pure' support" >&5
-$as_echo_n "checking for compiler 'attribute pure' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((pure)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_pure 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_pure 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute malloc' support" >&5
-$as_echo_n "checking for compiler 'attribute malloc' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((malloc)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_malloc 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_malloc 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute const' support" >&5
-$as_echo_n "checking for compiler 'attribute const' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((const)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_const 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_const 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute unused' support" >&5
-$as_echo_n "checking for compiler 'attribute unused' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((unused)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_unused 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_unused 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute always_inline' support" >&5
-$as_echo_n "checking for compiler 'attribute always_inline' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((always_inline)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_always_inline 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_always_inline 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute deprecated' support" >&5
-$as_echo_n "checking for compiler 'attribute deprecated' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((deprecated)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_deprecated 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_deprecated 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute sentinel' support" >&5
-$as_echo_n "checking for compiler 'attribute sentinel' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((sentinel)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_sentinel 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_sentinel 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute warn_unused_result' support" >&5
-$as_echo_n "checking for compiler 'attribute warn_unused_result' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((warn_unused_result)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_warn_unused_result 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_warn_unused_result 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-# Support weak symbols on a platform specific basis.  The Mac OS X
-# (Darwin) support must be isolated from the other platforms because
-# it has caused other platforms to fail.
-#
-case "${OSARCH}" in
-       darwin*)
-       # Allow weak symbol support on Darwin platforms only because there
-       # is active community support for it.
-       # However, Darwin seems to break weak symbols for each new version.
-       #
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute weak_import' support" >&5
-$as_echo_n "checking for compiler 'attribute weak_import' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((weak_import)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak_import 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak_import 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-
-       # Several other platforms including Linux have GCC versions that
-       # define the weak attribute.  However, this attribute is only
-       # setup for use in the code by Darwin.
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute weak' support" >&5
-$as_echo_n "checking for compiler 'attribute weak' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
-
-if test "x" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__((weak)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
- void __attribute__(()) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weak 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-       ;;
-       linux-gnu)
-       # Primarily support weak symbols on Linux platforms.
-       #
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute weakref' support" >&5
-$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
-
-if test "xweakref("foo")" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-       ;;
-       *)
-       # Allow weak symbols on other platforms.  However, any problems
-       # with this feature on other platforms must be fixed by the
-       # community.
-       #
-
-{ $as_echo "$as_me:$LINENO: checking for compiler 'attribute weakref' support" >&5
-$as_echo_n "checking for compiler 'attribute weakref' support... " >&6; }
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wall -Wno-unused -Werror"
-PBX_WEAKREF=0
-
-if test "xweakref("foo")" = "x"
-then
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-static void __attribute__((weakref)) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-static void __attribute__((weakref("foo"))) *test(void *muffin, ...) {return (void *) 0;}
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       PBX_WEAKREF=1
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_ATTRIBUTE_weakref 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-CFLAGS="$saved_CFLAGS"
-
-
-       ;;
-esac
-
-{ $as_echo "$as_me:$LINENO: checking for -ffunction-sections support" >&5
-$as_echo_n "checking for -ffunction-sections support... " >&6; }
-saved_CFLAGS="${CFLAGS}"
-CFLAGS="${CFLAGS} -ffunction-sections"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int x = 1;
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       saved_LDFLAGS="${LDFLAGS}"
-       LDFLAGS="${LDFLAGS} -Wl,--gc-sections"
-       { $as_echo "$as_me:$LINENO: checking for --gc-sections support" >&5
-$as_echo_n "checking for --gc-sections support... " >&6; }
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-int x = 1;
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-               GC_CFLAGS="-ffunction-sections"
-               GC_LDFLAGS="-Wl,--gc-sections"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-       LDFLAGS="${saved_LDFLAGS}"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-CFLAGS="${saved_CFLAGS}"
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for -Wdeclaration-after-statement support" >&5
-$as_echo_n "checking for -Wdeclaration-after-statement support... " >&6; }
-if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
-else
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-       AST_DECLARATION_AFTER_STATEMENT=
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for _FORTIFY_SOURCE support" >&5
-$as_echo_n "checking for _FORTIFY_SOURCE support... " >&6; }
-if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
-else
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-       AST_FORTIFY_SOURCE=
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for -fno-strict-overflow" >&5
-$as_echo_n "checking for -fno-strict-overflow... " >&6; }
-if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
-else
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-       AST_NO_STRICT_OVERFLOW=
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for -Wshadow" >&5
-$as_echo_n "checking for -Wshadow... " >&6; }
-if $(${CC} -Wshadow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       AST_SHADOW_WARNINGS=-Wshadow
-else
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-       AST_SHADOW_WARNINGS=
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for -march=native" >&5
-$as_echo_n "checking for -march=native... " >&6; }
-if $(${CC} -march=native -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-       AST_MARCH_NATIVE="-march=native"
-else
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-       AST_MARCH_NATIVE=
-fi
-
-
-{ $as_echo "$as_me:$LINENO: checking for sysinfo" >&5
-$as_echo_n "checking for sysinfo... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/sysinfo.h>
-int
-main ()
-{
-struct sysinfo sys_info; int uptime = sys_info.uptime
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSINFO 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-{ $as_echo "$as_me:$LINENO: checking for library containing res_9_ninit" >&5
-$as_echo_n "checking for library containing res_9_ninit... " >&6; }
-if test "${ac_cv_search_res_9_ninit+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_9_ninit ();
-int
-main ()
-{
-return res_9_ninit ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' resolv; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_search_res_9_ninit=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_res_9_ninit+set}" = set; then
-  break
-fi
-done
-if test "${ac_cv_search_res_9_ninit+set}" = set; then
-  :
-else
-  ac_cv_search_res_9_ninit=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_res_9_ninit" >&5
-$as_echo "$ac_cv_search_res_9_ninit" >&6; }
-ac_res=$ac_cv_search_res_9_ninit
-if test "$ac_res" != no; then
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-{ $as_echo "$as_me:$LINENO: checking for res_ninit" >&5
-$as_echo_n "checking for res_ninit... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-                       #ifdef HAVE_SYS_SOCKET_H
-                       #include <sys/socket.h>
-                       #endif
-                       #ifdef HAVE_NETINET_IN_H
-                       #include <netinet/in.h>
-                       #endif
-                       #ifdef HAVE_ARPA_NAMESER_H
-                       #include <arpa/nameser.h>
-                       #endif
-                       #include <resolv.h>
-int
-main ()
-{
-int foo = res_ninit(NULL);
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_RES_NINIT 1
-_ACEOF
-
-       { $as_echo "$as_me:$LINENO: checking for library containing res_9_ndestroy" >&5
-$as_echo_n "checking for library containing res_9_ndestroy... " >&6; }
-if test "${ac_cv_search_res_9_ndestroy+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_9_ndestroy ();
-int
-main ()
-{
-return res_9_ndestroy ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' resolv; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_search_res_9_ndestroy=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_res_9_ndestroy+set}" = set; then
-  break
-fi
-done
-if test "${ac_cv_search_res_9_ndestroy+set}" = set; then
-  :
-else
-  ac_cv_search_res_9_ndestroy=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_res_9_ndestroy" >&5
-$as_echo "$ac_cv_search_res_9_ndestroy" >&6; }
-ac_res=$ac_cv_search_res_9_ndestroy
-if test "$ac_res" != no; then
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-       { $as_echo "$as_me:$LINENO: checking for res_ndestroy" >&5
-$as_echo_n "checking for res_ndestroy... " >&6; }
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-                               #ifdef HAVE_SYS_SOCKET_H
-                               #include <sys/socket.h>
-                               #endif
-                               #ifdef HAVE_NETINET_IN_H
-                               #include <netinet/in.h>
-                               #endif
-                               #ifdef HAVE_ARPA_NAMESER_H
-                               #include <arpa/nameser.h>
-                               #endif
-                               #include <resolv.h>
-int
-main ()
-{
-res_ndestroy(NULL);
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_RES_NDESTROY 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-       { $as_echo "$as_me:$LINENO: checking for library containing res_9_close" >&5
-$as_echo_n "checking for library containing res_9_close... " >&6; }
-if test "${ac_cv_search_res_9_close+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char res_9_close ();
-int
-main ()
-{
-return res_9_close ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' resolv; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  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:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_search_res_9_close=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_res_9_close+set}" = set; then
-  break
-fi
-done
-if test "${ac_cv_search_res_9_close+set}" = set; then
-  :
-else
-  ac_cv_search_res_9_close=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_res_9_close" >&5
-$as_echo "$ac_cv_search_res_9_close" >&6; }
-ac_res=$ac_cv_search_res_9_close
-if test "$ac_res" != no; then
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-       { $as_echo "$as_me:$LINENO: checking for res_close" >&5
-$as_echo_n "checking for res_close... " >&6; }
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-                               #ifdef HAVE_SYS_SOCKET_H
-                               #include <sys/socket.h>
-                               #endif
-                               #ifdef HAVE_NETINET_IN_H
-                               #include <netinet/in.h>
-                               #endif
-                               #ifdef HAVE_ARPA_NAMESER_H
-                               #include <arpa/nameser.h>
-                               #endif
-                               #include <resolv.h>
-int
-main ()
-{
-res_close();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_RES_CLOSE 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
-
-    if test "x${PBX_GLOB_NOMAGIC}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for GLOB_NOMAGIC in glob.h" >&5
-$as_echo_n "checking for GLOB_NOMAGIC in glob.h... " >&6; }
-       saved_cppflags="${CPPFLAGS}"
-       if test "x${GLOB_NOMAGIC_DIR}" != "x"; then
-           GLOB_NOMAGIC_INCLUDE="-I${GLOB_NOMAGIC_DIR}/include"
-       fi
-       CPPFLAGS="${CPPFLAGS} ${GLOB_NOMAGIC_INCLUDE}"
-
-       cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <glob.h>
-int
-main ()
-{
-#if defined(GLOB_NOMAGIC)
-                               int foo = 0;
-                               #else
-                               int foo = bar;
-                               #endif
-                               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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-               PBX_GLOB_NOMAGIC=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GLOB_NOMAGIC 1
-_ACEOF
-
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CPPFLAGS="${saved_cppflags}"
-    fi
-
-
-
-
-    if test "x${PBX_GLOB_BRACE}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for GLOB_BRACE in glob.h" >&5
-$as_echo_n "checking for GLOB_BRACE in glob.h... " >&6; }
-       saved_cppflags="${CPPFLAGS}"
-       if test "x${GLOB_BRACE_DIR}" != "x"; then
-           GLOB_BRACE_INCLUDE="-I${GLOB_BRACE_DIR}/include"
-       fi
-       CPPFLAGS="${CPPFLAGS} ${GLOB_BRACE_INCLUDE}"
-
-       cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <glob.h>
-int
-main ()
-{
-#if defined(GLOB_BRACE)
-                               int foo = 0;
-                               #else
-                               int foo = bar;
-                               #endif
-                               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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-               PBX_GLOB_BRACE=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GLOB_BRACE 1
-_ACEOF
-
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CPPFLAGS="${saved_cppflags}"
-    fi
-
-
-
-
-    if test "x${PBX_IP_MTU_DISCOVER}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for IP_MTU_DISCOVER in netinet/in.h" >&5
-$as_echo_n "checking for IP_MTU_DISCOVER in netinet/in.h... " >&6; }
-       saved_cppflags="${CPPFLAGS}"
-       if test "x${IP_MTU_DISCOVER_DIR}" != "x"; then
-           IP_MTU_DISCOVER_INCLUDE="-I${IP_MTU_DISCOVER_DIR}/include"
-       fi
-       CPPFLAGS="${CPPFLAGS} ${IP_MTU_DISCOVER_INCLUDE}"
-
-       cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <netinet/in.h>
-int
-main ()
-{
-#if defined(IP_MTU_DISCOVER)
-                               int foo = 0;
-                               #else
-                               int foo = bar;
-                               #endif
-                               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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-               PBX_IP_MTU_DISCOVER=1
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_IP_MTU_DISCOVER 1
-_ACEOF
-
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-       CPPFLAGS="${saved_cppflags}"
-    fi
-
-
-
-if test "${ac_cv_header_libkern_OSAtomic_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libkern/OSAtomic.h" >&5
-$as_echo_n "checking for libkern/OSAtomic.h... " >&6; }
-if test "${ac_cv_header_libkern_OSAtomic_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libkern_OSAtomic_h" >&5
-$as_echo "$ac_cv_header_libkern_OSAtomic_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libkern/OSAtomic.h usability" >&5
-$as_echo_n "checking libkern/OSAtomic.h usability... " >&6; }
-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 <libkern/OSAtomic.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libkern/OSAtomic.h presence" >&5
-$as_echo_n "checking libkern/OSAtomic.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libkern/OSAtomic.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libkern/OSAtomic.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libkern/OSAtomic.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libkern/OSAtomic.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libkern/OSAtomic.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libkern/OSAtomic.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libkern/OSAtomic.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libkern/OSAtomic.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libkern/OSAtomic.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libkern/OSAtomic.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libkern/OSAtomic.h" >&5
-$as_echo_n "checking for libkern/OSAtomic.h... " >&6; }
-if test "${ac_cv_header_libkern_OSAtomic_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libkern_OSAtomic_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libkern_OSAtomic_h" >&5
-$as_echo "$ac_cv_header_libkern_OSAtomic_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libkern_OSAtomic_h" = x""yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_OSX_ATOMICS 1
-_ACEOF
-
-fi
-
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if test "${ac_cv_sizeof_int+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_int=$ac_lo;;
-'') if test "$ac_cv_type_int" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi ;;
-esac
-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
-static long int longval () { return (long int) (sizeof (int)); }
-static unsigned long int ulongval () { return (long int) (sizeof (int)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (int))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (int))))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (int))))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_int=`cat conftest.val`
-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
-
-( exit $ac_status )
-if test "$ac_cv_type_int" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi ;;
-esac
-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
-static long int longval () { return (long int) (sizeof (long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long))))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long))))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long=`cat conftest.val`
-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
-
-( exit $ac_status )
-if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi ;;
-esac
-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
-static long int longval () { return (long int) (sizeof (long long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long long))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long long))))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long long))))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_long=`cat conftest.val`
-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
-
-( exit $ac_status )
-if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of char *" >&5
-$as_echo_n "checking size of char *... " >&6; }
-if test "${ac_cv_sizeof_char_p+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (char *))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_char_p=$ac_lo;;
-'') if test "$ac_cv_type_char_p" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_char_p=0
-   fi ;;
-esac
-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
-static long int longval () { return (long int) (sizeof (char *)); }
-static unsigned long int ulongval () { return (long int) (sizeof (char *)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (char *))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (char *))))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (char *))))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_char_p=`cat conftest.val`
-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
-
-( exit $ac_status )
-if test "$ac_cv_type_char_p" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (char *)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_char_p=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_char_p" >&5
-$as_echo "$ac_cv_sizeof_char_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_CHAR_P $ac_cv_sizeof_char_p
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi ;;
-esac
-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
-static long int longval () { return (long int) (sizeof (long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long))))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long))))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long=`cat conftest.val`
-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
-
-( exit $ac_status )
-if test "$ac_cv_type_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi ;;
-esac
-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
-static long int longval () { return (long int) (sizeof (long long)); }
-static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (long long))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (long long))))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (long long))))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_long=`cat conftest.val`
-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
-
-( exit $ac_status )
-if test "$ac_cv_type_long_long" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-fd_set foo;
-int
-main ()
-{
-static int test_array [1 - 2 * !((sizeof(foo.fds_bits[0])) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-fd_set foo;
-int
-main ()
-{
-static int test_array [1 - 2 * !((sizeof(foo.fds_bits[0])) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-fd_set foo;
-int
-main ()
-{
-static int test_array [1 - 2 * !((sizeof(foo.fds_bits[0])) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-fd_set foo;
-int
-main ()
-{
-static int test_array [1 - 2 * !((sizeof(foo.fds_bits[0])) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo= ac_hi=
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-fd_set foo;
-int
-main ()
-{
-static int test_array [1 - 2 * !((sizeof(foo.fds_bits[0])) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_fd_set_fds_bits=$ac_lo;;
-'')  ;;
-esac
-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
-fd_set foo;
-static long int longval () { return sizeof(foo.fds_bits[0]); }
-static unsigned long int ulongval () { return sizeof(foo.fds_bits[0]); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if ((sizeof(foo.fds_bits[0])) < 0)
-    {
-      long int i = longval ();
-      if (i != (sizeof(foo.fds_bits[0])))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != (sizeof(foo.fds_bits[0])))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
-
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_fd_set_fds_bits=`cat conftest.val`
-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
-
-fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-# This doesn't actually work; what it does is to use the variable set in the
-# previous test as a cached value to set the right output variables.
 # The cast to long int works around a bug in the HP C Compiler
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:$LINENO: checking size of fd_set.fds_bits" >&5
-$as_echo_n "checking size of fd_set.fds_bits... " >&6; }
-if test "${ac_cv_sizeof_fd_set_fds_bits+set}" = set; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (fd_set.fds_bits))) >= 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=0 ac_mid=0
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (fd_set.fds_bits))) <= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_lo=`expr $ac_mid + 1`
-                       if test $ac_lo -le $ac_mid; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (fd_set.fds_bits))) < 0)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=-1 ac_mid=-1
-  while :; do
-    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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (fd_set.fds_bits))) >= $ac_mid)];
-test_array [0] = 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_lo=$ac_mid; break
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $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 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
 
-       ac_hi=`expr '(' $ac_mid ')' - 1`
-                       if test $ac_mid -le $ac_hi; then
-                         ac_lo= ac_hi=
-                         break
-                       fi
-                       ac_mid=`expr 2 '*' $ac_mid`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char *" >&5
+$as_echo_n "checking size of char *... " >&6; }
+if ${ac_cv_sizeof_char_p+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (char *))" "ac_cv_sizeof_char_p"        "$ac_includes_default"; then :
 
-       ac_lo= ac_hi=
+else
+  if test "$ac_cv_type_char_p" = yes; then
+     { { $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 "cannot compute sizeof (char *)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_char_p=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char_p" >&5
+$as_echo "$ac_cv_sizeof_char_p" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  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
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (fd_set.fds_bits))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR_P $ac_cv_sizeof_char_p
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_hi=$ac_mid
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
 
-       ac_lo=`expr '(' $ac_mid ')' + 1`
+else
+  if test "$ac_cv_type_long" = yes; then
+     { { $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 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long=0
+   fi
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_fd_set_fds_bits=$ac_lo;;
-'') if test "$ac_cv_type_fd_set_fds_bits" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_long_long" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (fd_set.fds_bits)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (fd_set.fds_bits)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+as_fn_error 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
    else
-     ac_cv_sizeof_fd_set_fds_bits=0
-   fi ;;
-esac
-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
-static long int longval () { return (long int) (sizeof (fd_set.fds_bits)); }
-static unsigned long int ulongval () { return (long int) (sizeof (fd_set.fds_bits)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+     ac_cv_sizeof_long_long=0
+   fi
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (fd_set.fds_bits))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (fd_set.fds_bits))))
-       return 1;
-      fprintf (f, "%ld", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (fd_set.fds_bits))))
-       return 1;
-      fprintf (f, "%lu", i);
-    }
-  /* Do not output a trailing newline, as this causes \r\n confusion
-     on some platforms.  */
-  return ferror (f) || fclose (f) != 0;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
 
-  ;
-  return 0;
-}
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_fd_set_fds_bits=`cat conftest.val`
+
+
+if ac_fn_c_compute_int "$LINENO" "sizeof(foo.fds_bits[0])" "ac_cv_sizeof_fd_set_fds_bits"        "$ac_includes_default
+fd_set foo;"; then :
+
+fi
+
+# This doesn't actually work; what it does is to use the variable set in the
+# previous test as a cached value to set the right output variables.
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of fd_set.fds_bits" >&5
+$as_echo_n "checking size of fd_set.fds_bits... " >&6; }
+if ${ac_cv_sizeof_fd_set_fds_bits+:} false; then :
+  $as_echo_n "(cached) " >&6
 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
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (fd_set.fds_bits))" "ac_cv_sizeof_fd_set_fds_bits"        "$ac_includes_default"; then :
 
-( exit $ac_status )
-if test "$ac_cv_type_fd_set_fds_bits" = yes; then
-     { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+else
+  if test "$ac_cv_type_fd_set_fds_bits" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (fd_set.fds_bits)
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute sizeof (fd_set.fds_bits)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+as_fn_error 77 "cannot compute sizeof (fd_set.fds_bits)
+See \`config.log' for more details" "$LINENO" 5; }
    else
      ac_cv_sizeof_fd_set_fds_bits=0
    fi
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
+
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_fd_set_fds_bits" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_fd_set_fds_bits" >&5
 $as_echo "$ac_cv_sizeof_fd_set_fds_bits" >&6; }
 
 
@@ -27371,34 +16686,24 @@ _ACEOF
 # correctly if the size is wrong.
 if test $ac_cv_sizeof_int = $ac_cv_sizeof_fd_set_fds_bits; then
 
-cat >>confdefs.h <<\_ACEOF
-#define TYPEOF_FD_SET_FDS_BITS int
-_ACEOF
+$as_echo "#define TYPEOF_FD_SET_FDS_BITS int" >>confdefs.h
 
 else if test $ac_cv_sizeof_long = $ac_cv_sizeof_fd_set_fds_bits; then
 
-cat >>confdefs.h <<\_ACEOF
-#define TYPEOF_FD_SET_FDS_BITS long
-_ACEOF
+$as_echo "#define TYPEOF_FD_SET_FDS_BITS long" >>confdefs.h
 
 else if test $ac_cv_sizeof_long_long = $ac_cv_sizeof_fd_set_fds_bits; then
 
-cat >>confdefs.h <<\_ACEOF
-#define TYPEOF_FD_SET_FDS_BITS long long
-_ACEOF
+$as_echo "#define TYPEOF_FD_SET_FDS_BITS long long" >>confdefs.h
 
 fi ; fi ; fi
 
-{ $as_echo "$as_me:$LINENO: checking for dladdr in dlfcn.h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dladdr in dlfcn.h" >&5
 $as_echo_n "checking for dladdr in dlfcn.h... " >&6; }
 PBX_DLADDR=0
 old_LIBS=${LIBS}
 LIBS="${LIBS} -ldl"
-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.  */
 #define _GNU_SOURCE 1
 #include <dlfcn.h>
@@ -27411,57 +16716,30 @@ dladdr((void *)0, (void *)0)
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
        PBX_DLADDR=1
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DLADDR 1
-_ACEOF
+$as_echo "#define HAVE_DLADDR 1" >>confdefs.h
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
-rm -rf conftest.dSYM
-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=${old_LIBS}
 
 # PKGCONFIG is used in later tests
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_PKGCONFIG+set}" = set; then
+if ${ac_cv_prog_PKGCONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$PKGCONFIG"; then
@@ -27472,24 +16750,24 @@ 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_PKGCONFIG="${ac_tool_prefix}pkg-config"
-    $as_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
 PKGCONFIG=$ac_cv_prog_PKGCONFIG
 if test -n "$PKGCONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKGCONFIG" >&5
 $as_echo "$PKGCONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -27499,9 +16777,9 @@ if test -z "$ac_cv_prog_PKGCONFIG"; then
   ac_ct_PKGCONFIG=$PKGCONFIG
   # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_PKGCONFIG+set}" = set; then
+if ${ac_cv_prog_ac_ct_PKGCONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_PKGCONFIG"; then
@@ -27512,24 +16790,24 @@ 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_PKGCONFIG="pkg-config"
-    $as_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_PKGCONFIG=$ac_cv_prog_ac_ct_PKGCONFIG
 if test -n "$ac_ct_PKGCONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_PKGCONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_PKGCONFIG" >&5
 $as_echo "$ac_ct_PKGCONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -27538,7 +16816,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -27570,18 +16848,14 @@ if test "x${PBX_ALSA}" != "x1" -a "${USE_ALSA}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_asound_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lasound" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lasound" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lasound... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lasound ${pbxlibdir} -lm -ldl $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.
@@ -27599,47 +16873,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_ALSA_FOUND=yes
 else
   AST_ALSA_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ALSA_INCLUDE}"
-         if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
-$as_echo_n "checking for alsa/asoundlib.h... " >&6; }
-if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
-$as_echo "$ac_cv_header_alsa_asoundlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking alsa/asoundlib.h usability" >&5
-$as_echo_n "checking alsa/asoundlib.h usability... " >&6; }
-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 <alsa/asoundlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking alsa/asoundlib.h presence" >&5
-$as_echo_n "checking alsa/asoundlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <alsa/asoundlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: alsa/asoundlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for alsa/asoundlib.h" >&5
-$as_echo_n "checking for alsa/asoundlib.h... " >&6; }
-if test "${ac_cv_header_alsa_asoundlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_alsa_asoundlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_alsa_asoundlib_h" >&5
-$as_echo "$ac_cv_header_alsa_asoundlib_h" >&6; }
-
-fi
-if test "x$ac_cv_header_alsa_asoundlib_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "alsa/asoundlib.h" "ac_cv_header_alsa_asoundlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_alsa_asoundlib_h" = xyes; then :
   ALSA_HEADER_FOUND=1
 else
   ALSA_HEADER_FOUND=0
@@ -27838,18 +16953,14 @@ if test "x${PBX_BFD}" != "x1" -a "${USE_BFD}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_bfd_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lbfd" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lbfd" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lbfd... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lbfd ${pbxlibdir}  $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.
@@ -27867,47 +16978,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_BFD_FOUND=yes
 else
   AST_BFD_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${BFD_INCLUDE}"
-         if test "${ac_cv_header_bfd_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for bfd.h" >&5
-$as_echo_n "checking for bfd.h... " >&6; }
-if test "${ac_cv_header_bfd_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_bfd_h" >&5
-$as_echo "$ac_cv_header_bfd_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking bfd.h usability" >&5
-$as_echo_n "checking bfd.h usability... " >&6; }
-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 <bfd.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking bfd.h presence" >&5
-$as_echo_n "checking bfd.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <bfd.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: bfd.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: bfd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bfd.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: bfd.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: bfd.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: bfd.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bfd.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: bfd.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bfd.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: bfd.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bfd.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: bfd.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bfd.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: bfd.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bfd.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: bfd.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for bfd.h" >&5
-$as_echo_n "checking for bfd.h... " >&6; }
-if test "${ac_cv_header_bfd_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_bfd_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_bfd_h" >&5
-$as_echo "$ac_cv_header_bfd_h" >&6; }
-
-fi
-if test "x$ac_cv_header_bfd_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "bfd.h" "ac_cv_header_bfd_h" "$ac_includes_default"
+if test "x$ac_cv_header_bfd_h" = xyes; then :
   BFD_HEADER_FOUND=1
 else
   BFD_HEADER_FOUND=0
@@ -28107,18 +17059,14 @@ if test "x${PBX_CAP}" != "x1" -a "${USE_CAP}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_cap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lcap" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcap" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lcap... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcap ${pbxlibdir}  $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.
@@ -28136,47 +17084,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_CAP_FOUND=yes
 else
   AST_CAP_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${CAP_INCLUDE}"
-         if test "${ac_cv_header_sys_capability_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/capability.h" >&5
-$as_echo_n "checking for sys/capability.h... " >&6; }
-if test "${ac_cv_header_sys_capability_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_capability_h" >&5
-$as_echo "$ac_cv_header_sys_capability_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/capability.h usability" >&5
-$as_echo_n "checking sys/capability.h usability... " >&6; }
-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 <sys/capability.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/capability.h presence" >&5
-$as_echo_n "checking sys/capability.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/capability.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/capability.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/capability.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/capability.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/capability.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/capability.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/capability.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/capability.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/capability.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/capability.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/capability.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/capability.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/capability.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/capability.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/capability.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/capability.h" >&5
-$as_echo_n "checking for sys/capability.h... " >&6; }
-if test "${ac_cv_header_sys_capability_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_capability_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_capability_h" >&5
-$as_echo "$ac_cv_header_sys_capability_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sys_capability_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sys/capability.h" "ac_cv_header_sys_capability_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_capability_h" = xyes; then :
   CAP_HEADER_FOUND=1
 else
   CAP_HEADER_FOUND=0
@@ -28360,7 +17149,7 @@ fi
 
 
     if test "x${PBX_DAHDI}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for DAHDI_RESET_COUNTERS in dahdi/user.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DAHDI_RESET_COUNTERS in dahdi/user.h" >&5
 $as_echo_n "checking for DAHDI_RESET_COUNTERS in dahdi/user.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${DAHDI_DIR}" != "x"; then
@@ -28368,13 +17157,9 @@ $as_echo_n "checking for DAHDI_RESET_COUNTERS in dahdi/user.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${DAHDI_INCLUDE}"
 
-       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 <dahdi/user.h>
+ #include <dahdi/user.h>
 int
 main ()
 {
@@ -28389,47 +17174,22 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_DAHDI=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI 1
-_ACEOF
+$as_echo "#define HAVE_DAHDI 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI_VERSION 230
-_ACEOF
+$as_echo "#define HAVE_DAHDI_VERSION 230" >>confdefs.h
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28437,7 +17197,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_DAHDI}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for DAHDI_DEFAULT_MTU_MRU in dahdi/user.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DAHDI_DEFAULT_MTU_MRU in dahdi/user.h" >&5
 $as_echo_n "checking for DAHDI_DEFAULT_MTU_MRU in dahdi/user.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${DAHDI_DIR}" != "x"; then
@@ -28445,13 +17205,9 @@ $as_echo_n "checking for DAHDI_DEFAULT_MTU_MRU in dahdi/user.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${DAHDI_INCLUDE}"
 
-       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 <dahdi/user.h>
+ #include <dahdi/user.h>
 int
 main ()
 {
@@ -28466,47 +17222,22 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_DAHDI=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI 1
-_ACEOF
+$as_echo "#define HAVE_DAHDI 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI_VERSION 220
-_ACEOF
+$as_echo "#define HAVE_DAHDI_VERSION 220" >>confdefs.h
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28514,7 +17245,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_DAHDI}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for DAHDI_CODE in dahdi/user.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DAHDI_CODE in dahdi/user.h" >&5
 $as_echo_n "checking for DAHDI_CODE in dahdi/user.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${DAHDI_DIR}" != "x"; then
@@ -28522,13 +17253,9 @@ $as_echo_n "checking for DAHDI_CODE in dahdi/user.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${DAHDI_INCLUDE}"
 
-       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 <dahdi/user.h>
+ #include <dahdi/user.h>
 int
 main ()
 {
@@ -28543,47 +17270,22 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_DAHDI=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI 1
-_ACEOF
+$as_echo "#define HAVE_DAHDI 1" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI_VERSION 200
-_ACEOF
+$as_echo "#define HAVE_DAHDI_VERSION 200" >>confdefs.h
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28592,7 +17294,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_DAHDI_HALF_FULL}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for DAHDI_POLICY_HALF_FULL in dahdi/user.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DAHDI_POLICY_HALF_FULL in dahdi/user.h" >&5
 $as_echo_n "checking for DAHDI_POLICY_HALF_FULL in dahdi/user.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${DAHDI_HALF_FULL_DIR}" != "x"; then
@@ -28600,13 +17302,9 @@ $as_echo_n "checking for DAHDI_POLICY_HALF_FULL in dahdi/user.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${DAHDI_HALF_FULL_INCLUDE}"
 
-       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 <dahdi/user.h>
+ #include <dahdi/user.h>
 int
 main ()
 {
@@ -28621,43 +17319,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_DAHDI_HALF_FULL=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI_HALF_FULL 1
-_ACEOF
+$as_echo "#define HAVE_DAHDI_HALF_FULL 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28667,10 +17342,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
     if test "x${PBX_DAHDI_LINEREVERSE_VMWI}" != "x1" -a "${USE_DAHDI_LINEREVERSE_VMWI}" != "no"; then
         if test "xenhanced dahdi vmwi support" != "x"; then
-            { $as_echo "$as_me:$LINENO: checking for enhanced dahdi vmwi support" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for enhanced dahdi vmwi support" >&5
 $as_echo_n "checking for enhanced dahdi vmwi support... " >&6; }
        else
-            { $as_echo "$as_me:$LINENO: checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/user.h" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/user.h" >&5
 $as_echo_n "checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/user.h... " >&6; }
        fi
        saved_cppflags="${CPPFLAGS}"
@@ -28679,13 +17354,9 @@ $as_echo_n "checking if \"struct dahdi_vmwi_info booger\" compiles using dahdi/u
        fi
        CPPFLAGS="${CPPFLAGS} ${DAHDI_LINEREVERSE_VMWI_INCLUDE}"
 
-       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 <dahdi/user.h>
+ #include <dahdi/user.h>
 int
 main ()
 {
@@ -28695,43 +17366,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_DAHDI_LINEREVERSE_VMWI=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI_LINEREVERSE_VMWI 1
-_ACEOF
+$as_echo "#define HAVE_DAHDI_LINEREVERSE_VMWI 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-              { $as_echo "$as_me:$LINENO: result: no" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28740,10 +17388,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
     if test "x${PBX_DAHDI_ECHOCANCEL_FAX_MODE}" != "x1" -a "${USE_DAHDI_ECHOCANCEL_FAX_MODE}" != "no"; then
         if test "x" != "x"; then
-            { $as_echo "$as_me:$LINENO: checking for " >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for " >&5
 $as_echo_n "checking for ... " >&6; }
        else
-            { $as_echo "$as_me:$LINENO: checking if \"int foo = DAHDI_ECHOCANCEL_FAX_MODE\" compiles using dahdi/user.h" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"int foo = DAHDI_ECHOCANCEL_FAX_MODE\" compiles using dahdi/user.h" >&5
 $as_echo_n "checking if \"int foo = DAHDI_ECHOCANCEL_FAX_MODE\" compiles using dahdi/user.h... " >&6; }
        fi
        saved_cppflags="${CPPFLAGS}"
@@ -28752,13 +17400,9 @@ $as_echo_n "checking if \"int foo = DAHDI_ECHOCANCEL_FAX_MODE\" compiles using d
        fi
        CPPFLAGS="${CPPFLAGS} ${DAHDI_ECHOCANCEL_FAX_MODE_INCLUDE}"
 
-       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 <dahdi/user.h>
+ #include <dahdi/user.h>
 int
 main ()
 {
@@ -28768,43 +17412,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_DAHDI_ECHOCANCEL_FAX_MODE=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_DAHDI_ECHOCANCEL_FAX_MODE 1
-_ACEOF
+$as_echo "#define HAVE_DAHDI_ECHOCANCEL_FAX_MODE 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-              { $as_echo "$as_me:$LINENO: result: no" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28813,10 +17434,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
     if test "x${PBX_GETIFADDRS}" != "x1" -a "${USE_GETIFADDRS}" != "no"; then
         if test "xgetifaddrs() support" != "x"; then
-            { $as_echo "$as_me:$LINENO: checking for getifaddrs() support" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getifaddrs() support" >&5
 $as_echo_n "checking for getifaddrs() support... " >&6; }
        else
-            { $as_echo "$as_me:$LINENO: checking if \"struct ifaddrs *p; getifaddrs(&p)\" compiles using ifaddrs.h" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"struct ifaddrs *p; getifaddrs(&p)\" compiles using ifaddrs.h" >&5
 $as_echo_n "checking if \"struct ifaddrs *p; getifaddrs(&p)\" compiles using ifaddrs.h... " >&6; }
        fi
        saved_cppflags="${CPPFLAGS}"
@@ -28825,13 +17446,9 @@ $as_echo_n "checking if \"struct ifaddrs *p; getifaddrs(&p)\" compiles using ifa
        fi
        CPPFLAGS="${CPPFLAGS} ${GETIFADDRS_INCLUDE}"
 
-       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 <ifaddrs.h>
+ #include <ifaddrs.h>
 int
 main ()
 {
@@ -28841,43 +17458,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_GETIFADDRS=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETIFADDRS 1
-_ACEOF
+$as_echo "#define HAVE_GETIFADDRS 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-              { $as_echo "$as_me:$LINENO: result: no" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28885,10 +17479,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
     if test "x${PBX_TIMERFD}" != "x1" -a "${USE_TIMERFD}" != "no"; then
         if test "xtimerfd support" != "x"; then
-            { $as_echo "$as_me:$LINENO: checking for timerfd support" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for timerfd support" >&5
 $as_echo_n "checking for timerfd support... " >&6; }
        else
-            { $as_echo "$as_me:$LINENO: checking if \"timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);\" compiles using sys/timerfd.h" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);\" compiles using sys/timerfd.h" >&5
 $as_echo_n "checking if \"timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);\" compiles using sys/timerfd.h... " >&6; }
        fi
        saved_cppflags="${CPPFLAGS}"
@@ -28897,13 +17491,9 @@ $as_echo_n "checking if \"timerfd_create(0,0); timerfd_settime(0,0,NULL,NULL);\"
        fi
        CPPFLAGS="${CPPFLAGS} ${TIMERFD_INCLUDE}"
 
-       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 <sys/timerfd.h>
+ #include <sys/timerfd.h>
 int
 main ()
 {
@@ -28913,43 +17503,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_TIMERFD=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_TIMERFD 1
-_ACEOF
+$as_echo "#define HAVE_TIMERFD 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-              { $as_echo "$as_me:$LINENO: result: no" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -28973,18 +17540,14 @@ if test "${USE_GSM}" != "no"; then
             gsmlibdir="-L${GSM_DIR}"
          fi
       fi
-      { $as_echo "$as_me:$LINENO: checking for gsm_create in -lgsm" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gsm_create in -lgsm" >&5
 $as_echo_n "checking for gsm_create in -lgsm... " >&6; }
-if test "${ac_cv_lib_gsm_gsm_create+set}" = set; then
+if ${ac_cv_lib_gsm_gsm_create+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgsm ${gsmlibdir} $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.
@@ -29002,43 +17565,18 @@ return gsm_create ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_gsm_gsm_create=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_gsm_gsm_create=no
+  ac_cv_lib_gsm_gsm_create=no
 fi
-
-rm -rf conftest.dSYM
-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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_gsm_gsm_create" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gsm_gsm_create" >&5
 $as_echo "$ac_cv_lib_gsm_gsm_create" >&6; }
-if test "x$ac_cv_lib_gsm_gsm_create" = x""yes; then
+if test "x$ac_cv_lib_gsm_gsm_create" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_GSM 1
       if test "${ac_cv_lib_gsm_gsm_create}" = "yes"; then
          if test "x${GSM_DIR}" != "x" ; then
             as_ac_Header=`$as_echo "ac_cv_header_${GSM_DIR}/include/gsm.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for ${GSM_DIR}/include/gsm.h" >&5
-$as_echo_n "checking for ${GSM_DIR}/include/gsm.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ${GSM_DIR}/include/gsm.h usability" >&5
-$as_echo_n "checking ${GSM_DIR}/include/gsm.h usability... " >&6; }
-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 <${GSM_DIR}/include/gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ${GSM_DIR}/include/gsm.h presence" >&5
-$as_echo_n "checking ${GSM_DIR}/include/gsm.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${GSM_DIR}/include/gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ${GSM_DIR}/include/gsm.h" >&5
-$as_echo_n "checking for ${GSM_DIR}/include/gsm.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+ac_fn_c_check_header_mongrel "$LINENO" "${GSM_DIR}/include/gsm.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   GSM_HEADER_FOUND=1
 else
   GSM_HEADER_FOUND=0
 
 
             as_ac_Header=`$as_echo "ac_cv_header_${GSM_DIR}/include/gsm/gsm.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for ${GSM_DIR}/include/gsm/gsm.h" >&5
-$as_echo_n "checking for ${GSM_DIR}/include/gsm/gsm.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ${GSM_DIR}/include/gsm/gsm.h usability" >&5
-$as_echo_n "checking ${GSM_DIR}/include/gsm/gsm.h usability... " >&6; }
-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 <${GSM_DIR}/include/gsm/gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ${GSM_DIR}/include/gsm/gsm.h presence" >&5
-$as_echo_n "checking ${GSM_DIR}/include/gsm/gsm.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${GSM_DIR}/include/gsm/gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${GSM_DIR}/include/gsm/gsm.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ${GSM_DIR}/include/gsm/gsm.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ${GSM_DIR}/include/gsm/gsm.h" >&5
-$as_echo_n "checking for ${GSM_DIR}/include/gsm/gsm.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+ac_fn_c_check_header_mongrel "$LINENO" "${GSM_DIR}/include/gsm/gsm.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   GSM_GSM_HEADER_FOUND=1
 else
   GSM_GSM_HEADER_FOUND=0
 
 
          else
-            if test "${ac_cv_header_gsm_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for gsm.h" >&5
-$as_echo_n "checking for gsm.h... " >&6; }
-if test "${ac_cv_header_gsm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gsm_h" >&5
-$as_echo "$ac_cv_header_gsm_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking gsm.h usability" >&5
-$as_echo_n "checking gsm.h usability... " >&6; }
-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 <gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking gsm.h presence" >&5
-$as_echo_n "checking gsm.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: gsm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: gsm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: gsm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: gsm.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: gsm.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: gsm.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: gsm.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: gsm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: gsm.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: gsm.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for gsm.h" >&5
-$as_echo_n "checking for gsm.h... " >&6; }
-if test "${ac_cv_header_gsm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_gsm_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gsm_h" >&5
-$as_echo "$ac_cv_header_gsm_h" >&6; }
-
-fi
-if test "x$ac_cv_header_gsm_h" = x""yes; then
+            ac_fn_c_check_header_mongrel "$LINENO" "gsm.h" "ac_cv_header_gsm_h" "$ac_includes_default"
+if test "x$ac_cv_header_gsm_h" = xyes; then :
   GSM_HEADER_FOUND=1
 else
   GSM_HEADER_FOUND=0
 fi
 
 
-            if test "${ac_cv_header_gsm_gsm_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for gsm/gsm.h" >&5
-$as_echo_n "checking for gsm/gsm.h... " >&6; }
-if test "${ac_cv_header_gsm_gsm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gsm_gsm_h" >&5
-$as_echo "$ac_cv_header_gsm_gsm_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking gsm/gsm.h usability" >&5
-$as_echo_n "checking gsm/gsm.h usability... " >&6; }
-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 <gsm/gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking gsm/gsm.h presence" >&5
-$as_echo_n "checking gsm/gsm.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <gsm/gsm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: gsm/gsm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm/gsm.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: gsm/gsm.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm/gsm.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm/gsm.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm/gsm.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm/gsm.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: gsm/gsm.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: gsm/gsm.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for gsm/gsm.h" >&5
-$as_echo_n "checking for gsm/gsm.h... " >&6; }
-if test "${ac_cv_header_gsm_gsm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_gsm_gsm_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_gsm_gsm_h" >&5
-$as_echo "$ac_cv_header_gsm_gsm_h" >&6; }
-
-fi
-if test "x$ac_cv_header_gsm_gsm_h" = x""yes; then
+            ac_fn_c_check_header_mongrel "$LINENO" "gsm/gsm.h" "ac_cv_header_gsm_gsm_h" "$ac_includes_default"
+if test "x$ac_cv_header_gsm_gsm_h" = xyes; then :
   GSM_GSM_HEADER_FOUND=1
 else
   GSM_GSM_HEADER_FOUND=0
          if test "${GSM_HEADER_FOUND}" = "0" ; then
             if test "{GSM_GSM_HEADER_FOUND}" = "0" ; then
                if test "x${GSM_MANDATORY}" = "xyes" ; then
-                  { $as_echo "$as_me:$LINENO: ***" >&5
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
 $as_echo "$as_me: ***" >&6;}
-                  { $as_echo "$as_me:$LINENO: *** It appears that you do not have the gsm development package installed." >&5
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: *** It appears that you do not have the gsm development package installed." >&5
 $as_echo "$as_me: *** It appears that you do not have the gsm development package installed." >&6;}
-                  { $as_echo "$as_me:$LINENO: *** Please install it to include ${GSM_DESCRIP} support, or re-run configure" >&5
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: *** Please install it to include ${GSM_DESCRIP} support, or re-run configure" >&5
 $as_echo "$as_me: *** Please install it to include ${GSM_DESCRIP} support, or re-run configure" >&6;}
-                  { $as_echo "$as_me:$LINENO: *** without explicitly specifying --with-${GSM_OPTION}" >&5
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: *** without explicitly specifying --with-${GSM_OPTION}" >&5
 $as_echo "$as_me: *** without explicitly specifying --with-${GSM_OPTION}" >&6;}
                   exit 1
                fi
@@ -29692,18 +17694,14 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_iconv_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -liconv" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liconv" >&5
 $as_echo_n "checking for ${pbxfuncname} in -liconv... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-liconv ${pbxlibdir}  $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.
@@ -29721,47 +17719,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_ICONV_FOUND=yes
 else
   AST_ICONV_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
-         if test "${ac_cv_header_iconv_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for iconv.h" >&5
-$as_echo_n "checking for iconv.h... " >&6; }
-if test "${ac_cv_header_iconv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
-$as_echo "$ac_cv_header_iconv_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking iconv.h usability" >&5
-$as_echo_n "checking iconv.h usability... " >&6; }
-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 <iconv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking iconv.h presence" >&5
-$as_echo_n "checking iconv.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <iconv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: iconv.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: iconv.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: iconv.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: iconv.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: iconv.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: iconv.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for iconv.h" >&5
-$as_echo_n "checking for iconv.h... " >&6; }
-if test "${ac_cv_header_iconv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_iconv_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
-$as_echo "$ac_cv_header_iconv_h" >&6; }
-
-fi
-if test "x$ac_cv_header_iconv_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
+if test "x$ac_cv_header_iconv_h" = xyes; then :
   ICONV_HEADER_FOUND=1
 else
   ICONV_HEADER_FOUND=0
@@ -29960,18 +17799,14 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_iconv_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -liconv" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liconv" >&5
 $as_echo_n "checking for ${pbxfuncname} in -liconv... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-liconv ${pbxlibdir}  $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.
@@ -29989,47 +17824,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_ICONV_FOUND=yes
 else
   AST_ICONV_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
-         if test "${ac_cv_header_iconv_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for iconv.h" >&5
-$as_echo_n "checking for iconv.h... " >&6; }
-if test "${ac_cv_header_iconv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
-$as_echo "$ac_cv_header_iconv_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking iconv.h usability" >&5
-$as_echo_n "checking iconv.h usability... " >&6; }
-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 <iconv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking iconv.h presence" >&5
-$as_echo_n "checking iconv.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <iconv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: iconv.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: iconv.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: iconv.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: iconv.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: iconv.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: iconv.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for iconv.h" >&5
-$as_echo_n "checking for iconv.h... " >&6; }
-if test "${ac_cv_header_iconv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_iconv_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
-$as_echo "$ac_cv_header_iconv_h" >&6; }
-
-fi
-if test "x$ac_cv_header_iconv_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
+if test "x$ac_cv_header_iconv_h" = xyes; then :
   ICONV_HEADER_FOUND=1
 else
   ICONV_HEADER_FOUND=0
@@ -30228,18 +17904,14 @@ if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lc ${pbxlibdir}  $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.
@@ -30257,47 +17929,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_ICONV_FOUND=yes
 else
   AST_ICONV_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICONV_INCLUDE}"
-         if test "${ac_cv_header_iconv_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for iconv.h" >&5
-$as_echo_n "checking for iconv.h... " >&6; }
-if test "${ac_cv_header_iconv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
-$as_echo "$ac_cv_header_iconv_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking iconv.h usability" >&5
-$as_echo_n "checking iconv.h usability... " >&6; }
-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 <iconv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking iconv.h presence" >&5
-$as_echo_n "checking iconv.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <iconv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: iconv.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: iconv.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: iconv.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: iconv.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: iconv.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iconv.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: iconv.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for iconv.h" >&5
-$as_echo_n "checking for iconv.h... " >&6; }
-if test "${ac_cv_header_iconv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_iconv_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
-$as_echo "$ac_cv_header_iconv_h" >&6; }
-
-fi
-if test "x$ac_cv_header_iconv_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
+if test "x$ac_cv_header_iconv_h" = xyes; then :
   ICONV_HEADER_FOUND=1
 else
   ICONV_HEADER_FOUND=0
@@ -30497,18 +18010,14 @@ if test "x${PBX_ICAL}" != "x1" -a "${USE_ICAL}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
       as_ac_Lib=`$as_echo "ac_cv_lib_ical_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lical" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lical" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lical... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lical ${pbxlibdir} ${PTHREAD_LIBS} $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.
@@ -30526,47 +18035,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_ICAL_FOUND=yes
 else
   AST_ICAL_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ICAL_INCLUDE}"
-         if test "${ac_cv_header_libical_ical_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libical/ical.h" >&5
-$as_echo_n "checking for libical/ical.h... " >&6; }
-if test "${ac_cv_header_libical_ical_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libical_ical_h" >&5
-$as_echo "$ac_cv_header_libical_ical_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libical/ical.h usability" >&5
-$as_echo_n "checking libical/ical.h usability... " >&6; }
-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 <libical/ical.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libical/ical.h presence" >&5
-$as_echo_n "checking libical/ical.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libical/ical.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libical/ical.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libical/ical.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libical/ical.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libical/ical.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libical/ical.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libical/ical.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libical/ical.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libical/ical.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libical/ical.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libical/ical.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libical/ical.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libical/ical.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libical/ical.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libical/ical.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libical/ical.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libical/ical.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libical/ical.h" >&5
-$as_echo_n "checking for libical/ical.h... " >&6; }
-if test "${ac_cv_header_libical_ical_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libical_ical_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libical_ical_h" >&5
-$as_echo "$ac_cv_header_libical_ical_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libical_ical_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libical/ical.h" "ac_cv_header_libical_ical_h" "$ac_includes_default"
+if test "x$ac_cv_header_libical_ical_h" = xyes; then :
   ICAL_HEADER_FOUND=1
 else
   ICAL_HEADER_FOUND=0
@@ -30765,18 +18115,14 @@ if test "x${PBX_IKSEMEL}" != "x1" -a "${USE_IKSEMEL}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_iksemel_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -liksemel" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liksemel" >&5
 $as_echo_n "checking for ${pbxfuncname} in -liksemel... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-liksemel ${pbxlibdir}  $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.
@@ -30794,47 +18140,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_IKSEMEL_FOUND=yes
 else
   AST_IKSEMEL_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${IKSEMEL_INCLUDE}"
-         if test "${ac_cv_header_iksemel_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for iksemel.h" >&5
-$as_echo_n "checking for iksemel.h... " >&6; }
-if test "${ac_cv_header_iksemel_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iksemel_h" >&5
-$as_echo "$ac_cv_header_iksemel_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking iksemel.h usability" >&5
-$as_echo_n "checking iksemel.h usability... " >&6; }
-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 <iksemel.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking iksemel.h presence" >&5
-$as_echo_n "checking iksemel.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <iksemel.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: iksemel.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iksemel.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: iksemel.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: iksemel.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: iksemel.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iksemel.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: iksemel.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iksemel.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: iksemel.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iksemel.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: iksemel.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iksemel.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: iksemel.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: iksemel.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: iksemel.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for iksemel.h" >&5
-$as_echo_n "checking for iksemel.h... " >&6; }
-if test "${ac_cv_header_iksemel_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_iksemel_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_iksemel_h" >&5
-$as_echo "$ac_cv_header_iksemel_h" >&6; }
-
-fi
-if test "x$ac_cv_header_iksemel_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "iksemel.h" "ac_cv_header_iksemel_h" "$ac_includes_default"
+if test "x$ac_cv_header_iksemel_h" = xyes; then :
   IKSEMEL_HEADER_FOUND=1
 else
   IKSEMEL_HEADER_FOUND=0
@@ -31024,7 +18211,7 @@ if test "${USE_IMAP_TK}" != "no"; then
                switch_to_system_on_failure="yes"
        fi
        if test "${IMAP_TK_DIR}" != "system"; then
-               { $as_echo "$as_me:$LINENO: checking for UW IMAP Toolkit c-client library" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for UW IMAP Toolkit c-client library" >&5
 $as_echo_n "checking for UW IMAP Toolkit c-client library... " >&6; }
                if test -f "${IMAP_TK_DIR}/c-client/LDFLAGS"; then
                imap_ldflags=`cat ${IMAP_TK_DIR}/c-client/LDFLAGS`
@@ -31033,11 +18220,7 @@ $as_echo_n "checking for UW IMAP Toolkit c-client library... " >&6; }
                imap_include="-I${IMAP_TK_DIR}/c-client"
        CPPFLAGS="${CPPFLAGS} ${imap_include}"
                LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
-               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 "c-client.h"
                                void mm_searched (MAILSTREAM *stream,unsigned long number)
@@ -31096,45 +18279,16 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk="no"
+  ac_cv_imap_tk="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                if test "${ac_cv_imap_tk}" = "yes"; 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 "c-client.h"
                                        void mm_searched (MAILSTREAM *stream,unsigned long number)
@@ -31193,49 +18347,24 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk2006="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk2006="no"
+  ac_cv_imap_tk2006="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                fi
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
                if test "${ac_cv_imap_tk}" = "no"; then
-                       { $as_echo "$as_me:$LINENO: result: no" >&5
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                        if test "${switch_to_system_on_failure}" = "yes"; then
                                IMAP_TK_DIR="system"
                        else #This means they specified a directory. Search for a package installation there too
-                               { $as_echo "$as_me:$LINENO: checking for system c-client library..." >&5
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for system c-client library..." >&5
 $as_echo_n "checking for system c-client library...... " >&6; }
                                CPPFLAGS="${saved_cppflags}"
                                LIBS="${saved_libs}"
@@ -31244,11 +18373,7 @@ $as_echo_n "checking for system c-client library...... " >&6; }
                                imap_libs="-lc-client"
                                CPPFLAGS="${CPPFLAGS} ${imap_include}"
                                LIBS="${LIBS} ${imap_libs} ${imap_ldflags}"
-                               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 "c-client.h"
                                                void mm_searched (MAILSTREAM *stream,unsigned long number)
@@ -31307,45 +18432,16 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk="no"
+  ac_cv_imap_tk="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                                if test "${ac_cv_imap_tk}" = "yes"; 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 "c-client.h"
                                                        void mm_searched (MAILSTREAM *stream,unsigned long number)
@@ -31404,46 +18500,21 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk2006="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk2006="no"
+  ac_cv_imap_tk2006="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                                fi
                        fi
                fi
        fi
        if test "${IMAP_TK_DIR}" = "system"; then
                #We will enter here if user specified "system" or if any of above checks failed
-               { $as_echo "$as_me:$LINENO: checking for system c-client library..." >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking for system c-client library..." >&5
 $as_echo_n "checking for system c-client library...... " >&6; }
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
@@ -31452,11 +18523,7 @@ $as_echo_n "checking for system c-client library...... " >&6; }
                imap_include="-DUSE_SYSTEM_IMAP" #Try the imap directory first
                CPPFLAGS="${CPPFLAGS} ${imap_include}"
                LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
-               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 <stdio.h>
                                #include <imap/c-client.h>
@@ -31516,45 +18583,16 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk="no"
+  ac_cv_imap_tk="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                if test "${ac_cv_imap_tk}" = "yes"; 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 <stdio.h>
                                        #include <imap/c-client.h>
@@ -31614,39 +18652,14 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk2006="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk2006="no"
+  ac_cv_imap_tk2006="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                else #looking in imap directory didn't work, try c-client
                        imap_ldflags=""
                        imap_libs="-lc-client"
@@ -31655,11 +18668,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
                        LIBS="${saved_libs}"
                        CPPFLAGS="${CPPFLAGS} ${imap_include}"
                        LIBS="${LIBS} ${imap_libs} "`echo ${imap_ldflags}`
-                       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 <stdio.h>
                                        #include <c-client/c-client.h>
@@ -31719,45 +18728,16 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk="no"
+  ac_cv_imap_tk="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                        if test "${ac_cv_imap_tk}" = "yes"; 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 <stdio.h>
                                                #include <c-client/c-client.h>
@@ -31817,62 +18797,33 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_imap_tk2006="yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_imap_tk2006="no"
+  ac_cv_imap_tk2006="no"
 
 fi
-
-rm -rf conftest.dSYM
-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
                        fi
                fi
        fi
        if test "${ac_cv_imap_tk}" = "yes"; then
-               { $as_echo "$as_me:$LINENO: result: yes" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                IMAP_TK_LIB="${imap_libs} "`echo ${imap_ldflags}`
                IMAP_TK_INCLUDE="${imap_include}"
                PBX_IMAP_TK=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_IMAP_TK 1
-_ACEOF
+$as_echo "#define HAVE_IMAP_TK 1" >>confdefs.h
 
                if test "${ac_cv_imap_tk2006}" = "yes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_IMAP_TK2006 1
-_ACEOF
+$as_echo "#define HAVE_IMAP_TK2006 1" >>confdefs.h
 
                fi
        else
-               { $as_echo "$as_me:$LINENO: result: no" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
        fi
        CPPFLAGS="${saved_cppflags}"
@@ -31897,18 +18848,14 @@ if test "x${PBX_IODBC}" != "x1" -a "${USE_IODBC}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
       as_ac_Lib=`$as_echo "ac_cv_lib_iodbc_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -liodbc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -liodbc" >&5
 $as_echo_n "checking for ${pbxfuncname} in -liodbc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-liodbc ${pbxlibdir} ${PTHREAD_LIBS} $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.
@@ -31922,51 +18869,23 @@ int
 main ()
 {
 return ${pbxfuncname} ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_IODBC_FOUND=yes
 else
   AST_IODBC_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${IODBC_INCLUDE}"
-         if test "${ac_cv_header_sql_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sql.h" >&5
-$as_echo_n "checking for sql.h... " >&6; }
-if test "${ac_cv_header_sql_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
-$as_echo "$ac_cv_header_sql_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sql.h usability" >&5
-$as_echo_n "checking sql.h usability... " >&6; }
-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 <sql.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sql.h presence" >&5
-$as_echo_n "checking sql.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sql.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sql.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sql.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sql.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sql.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sql.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sql.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sql.h" >&5
-$as_echo_n "checking for sql.h... " >&6; }
-if test "${ac_cv_header_sql_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sql_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
-$as_echo "$ac_cv_header_sql_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sql_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
+if test "x$ac_cv_header_sql_h" = xyes; then :
   IODBC_HEADER_FOUND=1
 else
   IODBC_HEADER_FOUND=0
@@ -32165,18 +18953,14 @@ if test "x${PBX_INOTIFY}" != "x1" -a "${USE_INOTIFY}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lc ${pbxlibdir}  $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.
@@ -32194,47 +18978,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_INOTIFY_FOUND=yes
 else
   AST_INOTIFY_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${INOTIFY_INCLUDE}"
-         if test "${ac_cv_header_sys_inotify_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/inotify.h" >&5
-$as_echo_n "checking for sys/inotify.h... " >&6; }
-if test "${ac_cv_header_sys_inotify_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_inotify_h" >&5
-$as_echo "$ac_cv_header_sys_inotify_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/inotify.h usability" >&5
-$as_echo_n "checking sys/inotify.h usability... " >&6; }
-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 <sys/inotify.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/inotify.h presence" >&5
-$as_echo_n "checking sys/inotify.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/inotify.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sys/inotify.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/inotify.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/inotify.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/inotify.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/inotify.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/inotify.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/inotify.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/inotify.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/inotify.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/inotify.h" >&5
-$as_echo_n "checking for sys/inotify.h... " >&6; }
-if test "${ac_cv_header_sys_inotify_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_inotify_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_inotify_h" >&5
-$as_echo "$ac_cv_header_sys_inotify_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sys_inotify_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sys/inotify.h" "ac_cv_header_sys_inotify_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_inotify_h" = xyes; then :
   INOTIFY_HEADER_FOUND=1
 else
   INOTIFY_HEADER_FOUND=0
@@ -32433,18 +19058,14 @@ if test "x${PBX_JACK}" != "x1" -a "${USE_JACK}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_jack_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -ljack" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ljack" >&5
 $as_echo_n "checking for ${pbxfuncname} in -ljack... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ljack ${pbxlibdir}  $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.
@@ -32462,47 +19083,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_JACK_FOUND=yes
 else
   AST_JACK_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${JACK_INCLUDE}"
-         if test "${ac_cv_header_jack_jack_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for jack/jack.h" >&5
-$as_echo_n "checking for jack/jack.h... " >&6; }
-if test "${ac_cv_header_jack_jack_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_jack_jack_h" >&5
-$as_echo "$ac_cv_header_jack_jack_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking jack/jack.h usability" >&5
-$as_echo_n "checking jack/jack.h usability... " >&6; }
-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 <jack/jack.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking jack/jack.h presence" >&5
-$as_echo_n "checking jack/jack.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <jack/jack.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: jack/jack.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: jack/jack.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jack/jack.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: jack/jack.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: jack/jack.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: jack/jack.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jack/jack.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: jack/jack.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jack/jack.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: jack/jack.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jack/jack.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: jack/jack.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jack/jack.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: jack/jack.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: jack/jack.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: jack/jack.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for jack/jack.h" >&5
-$as_echo_n "checking for jack/jack.h... " >&6; }
-if test "${ac_cv_header_jack_jack_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_jack_jack_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_jack_jack_h" >&5
-$as_echo "$ac_cv_header_jack_jack_h" >&6; }
-
-fi
-if test "x$ac_cv_header_jack_jack_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "jack/jack.h" "ac_cv_header_jack_jack_h" "$ac_includes_default"
+if test "x$ac_cv_header_jack_jack_h" = xyes; then :
   JACK_HEADER_FOUND=1
 else
   JACK_HEADER_FOUND=0
@@ -32702,18 +19164,14 @@ if test "x${PBX_KQUEUE}" != "x1" -a "${USE_KQUEUE}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lc ${pbxlibdir}  $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.
@@ -32731,47 +19189,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_KQUEUE_FOUND=yes
 else
   AST_KQUEUE_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${KQUEUE_INCLUDE}"
-         if test "${ac_cv_header_sys_event_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/event.h" >&5
-$as_echo_n "checking for sys/event.h... " >&6; }
-if test "${ac_cv_header_sys_event_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_event_h" >&5
-$as_echo "$ac_cv_header_sys_event_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/event.h usability" >&5
-$as_echo_n "checking sys/event.h usability... " >&6; }
-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 <sys/event.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/event.h presence" >&5
-$as_echo_n "checking sys/event.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/event.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sys/event.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/event.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/event.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/event.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/event.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/event.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/event.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/event.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/event.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/event.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/event.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/event.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/event.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/event.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/event.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/event.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/event.h" >&5
-$as_echo_n "checking for sys/event.h... " >&6; }
-if test "${ac_cv_header_sys_event_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_event_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_event_h" >&5
-$as_echo "$ac_cv_header_sys_event_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sys_event_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sys/event.h" "ac_cv_header_sys_event_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_event_h" = xyes; then :
   KQUEUE_HEADER_FOUND=1
 else
   KQUEUE_HEADER_FOUND=0
 
 
 # 64-bit version of kevent (from kqueue) on OS X
-
 for ac_func in kevent64
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; 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
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#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
-   builtin and then its argument prototype would still apply.  */
-#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
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+do :
+  ac_fn_c_check_func "$LINENO" "kevent64" "ac_cv_func_kevent64"
+if test "x$ac_cv_func_kevent64" = xyes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_KEVENT64 1
 _ACEOF
 
 fi
@@ -33074,18 +19283,14 @@ if test "x${PBX_LTDL}" != "x1" -a "${USE_LTDL}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ltdl_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lltdl" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lltdl" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lltdl... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lltdl ${pbxlibdir}  $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.
@@ -33103,47 +19308,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_LTDL_FOUND=yes
 else
   AST_LTDL_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${LTDL_INCLUDE}"
-         if test "${ac_cv_header_ltdl_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for ltdl.h" >&5
-$as_echo_n "checking for ltdl.h... " >&6; }
-if test "${ac_cv_header_ltdl_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_ltdl_h" >&5
-$as_echo "$ac_cv_header_ltdl_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ltdl.h usability" >&5
-$as_echo_n "checking ltdl.h usability... " >&6; }
-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 <ltdl.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ltdl.h presence" >&5
-$as_echo_n "checking ltdl.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ltdl.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: ltdl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ltdl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ltdl.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ltdl.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ltdl.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ltdl.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ltdl.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ltdl.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ltdl.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ltdl.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ltdl.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ltdl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ltdl.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ltdl.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ltdl.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ltdl.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ltdl.h" >&5
-$as_echo_n "checking for ltdl.h... " >&6; }
-if test "${ac_cv_header_ltdl_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_ltdl_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_ltdl_h" >&5
-$as_echo "$ac_cv_header_ltdl_h" >&6; }
-
-fi
-if test "x$ac_cv_header_ltdl_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "ltdl.h" "ac_cv_header_ltdl_h" "$ac_includes_default"
+if test "x$ac_cv_header_ltdl_h" = xyes; then :
   LTDL_HEADER_FOUND=1
 else
   LTDL_HEADER_FOUND=0
@@ -33342,18 +19388,14 @@ if test "x${PBX_LDAP}" != "x1" -a "${USE_LDAP}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ldap_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lldap" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lldap" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lldap... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lldap ${pbxlibdir}  $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.
@@ -33370,202 +19412,43 @@ return ${pbxfuncname} ();
   ;
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_LDAP_FOUND=yes
-else
-  AST_LDAP_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_LDAP_FOUND}" = "yes"; then
-      LDAP_LIB="${pbxlibdir} -lldap "
-      # if --with-LDAP=DIR has been specified, use it.
-      if test "x${LDAP_DIR}" != "x"; then
-         LDAP_INCLUDE="-I${LDAP_DIR}/include"
-      fi
-      LDAP_INCLUDE="${LDAP_INCLUDE} "
-      if test "xldap.h" = "x" ; then   # no header, assume found
-         LDAP_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${LDAP_INCLUDE}"
-         if test "${ac_cv_header_ldap_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for ldap.h" >&5
-$as_echo_n "checking for ldap.h... " >&6; }
-if test "${ac_cv_header_ldap_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_ldap_h" >&5
-$as_echo "$ac_cv_header_ldap_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ldap.h usability" >&5
-$as_echo_n "checking ldap.h usability... " >&6; }
-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 <ldap.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ldap.h presence" >&5
-$as_echo_n "checking ldap.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ldap.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: ldap.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ldap.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ldap.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ldap.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ldap.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ldap.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ldap.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ldap.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ldap.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ldap.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ldap.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ldap.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ldap.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ldap.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ldap.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ldap.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ldap.h" >&5
-$as_echo_n "checking for ldap.h... " >&6; }
-if test "${ac_cv_header_ldap_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_LDAP_FOUND=yes
 else
-  ac_cv_header_ldap_h=$ac_header_preproc
+  AST_LDAP_FOUND=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_ldap_h" >&5
-$as_echo "$ac_cv_header_ldap_h" >&6; }
 
-fi
-if test "x$ac_cv_header_ldap_h" = x""yes; then
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_LDAP_FOUND}" = "yes"; then
+      LDAP_LIB="${pbxlibdir} -lldap "
+      # if --with-LDAP=DIR has been specified, use it.
+      if test "x${LDAP_DIR}" != "x"; then
+         LDAP_INCLUDE="-I${LDAP_DIR}/include"
+      fi
+      LDAP_INCLUDE="${LDAP_INCLUDE} "
+      if test "xldap.h" = "x" ; then   # no header, assume found
+         LDAP_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${LDAP_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "ldap.h" "ac_cv_header_ldap_h" "$ac_includes_default"
+if test "x$ac_cv_header_ldap_h" = xyes; then :
   LDAP_HEADER_FOUND=1
 else
   LDAP_HEADER_FOUND=0
@@ -33610,18 +19493,14 @@ if test "x${PBX_MISDN}" != "x1" -a "${USE_MISDN}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_mISDN_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lmISDN" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lmISDN" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lmISDN... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lmISDN ${pbxlibdir}  $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.
@@ -33639,47 +19518,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_MISDN_FOUND=yes
 else
   AST_MISDN_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${MISDN_INCLUDE}"
-         if test "${ac_cv_header_mISDNuser_mISDNlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for mISDNuser/mISDNlib.h" >&5
-$as_echo_n "checking for mISDNuser/mISDNlib.h... " >&6; }
-if test "${ac_cv_header_mISDNuser_mISDNlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_mISDNlib_h" >&5
-$as_echo "$ac_cv_header_mISDNuser_mISDNlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking mISDNuser/mISDNlib.h usability" >&5
-$as_echo_n "checking mISDNuser/mISDNlib.h usability... " >&6; }
-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 <mISDNuser/mISDNlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking mISDNuser/mISDNlib.h presence" >&5
-$as_echo_n "checking mISDNuser/mISDNlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <mISDNuser/mISDNlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: mISDNuser/mISDNlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/mISDNlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/mISDNlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/mISDNlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/mISDNlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/mISDNlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/mISDNlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/mISDNlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: mISDNuser/mISDNlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for mISDNuser/mISDNlib.h" >&5
-$as_echo_n "checking for mISDNuser/mISDNlib.h... " >&6; }
-if test "${ac_cv_header_mISDNuser_mISDNlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_mISDNuser_mISDNlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_mISDNlib_h" >&5
-$as_echo "$ac_cv_header_mISDNuser_mISDNlib_h" >&6; }
-
-fi
-if test "x$ac_cv_header_mISDNuser_mISDNlib_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/mISDNlib.h" "ac_cv_header_mISDNuser_mISDNlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_mISDNuser_mISDNlib_h" = xyes; then :
   MISDN_HEADER_FOUND=1
 else
   MISDN_HEADER_FOUND=0
@@ -33879,18 +19599,14 @@ if test "x${PBX_ISDNNET}" != "x1" -a "${USE_ISDNNET}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_isdnnet_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lisdnnet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lisdnnet" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lisdnnet... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lisdnnet ${pbxlibdir} -lmISDN -lpthread $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.
@@ -33908,47 +19624,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_ISDNNET_FOUND=yes
 else
   AST_ISDNNET_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ISDNNET_INCLUDE}"
-         if test "${ac_cv_header_mISDNuser_isdn_net_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for mISDNuser/isdn_net.h" >&5
-$as_echo_n "checking for mISDNuser/isdn_net.h... " >&6; }
-if test "${ac_cv_header_mISDNuser_isdn_net_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_isdn_net_h" >&5
-$as_echo "$ac_cv_header_mISDNuser_isdn_net_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking mISDNuser/isdn_net.h usability" >&5
-$as_echo_n "checking mISDNuser/isdn_net.h usability... " >&6; }
-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 <mISDNuser/isdn_net.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking mISDNuser/isdn_net.h presence" >&5
-$as_echo_n "checking mISDNuser/isdn_net.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <mISDNuser/isdn_net.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/isdn_net.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: mISDNuser/isdn_net.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for mISDNuser/isdn_net.h" >&5
-$as_echo_n "checking for mISDNuser/isdn_net.h... " >&6; }
-if test "${ac_cv_header_mISDNuser_isdn_net_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_mISDNuser_isdn_net_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_isdn_net_h" >&5
-$as_echo "$ac_cv_header_mISDNuser_isdn_net_h" >&6; }
-
-fi
-if test "x$ac_cv_header_mISDNuser_isdn_net_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/isdn_net.h" "ac_cv_header_mISDNuser_isdn_net_h" "$ac_includes_default"
+if test "x$ac_cv_header_mISDNuser_isdn_net_h" = xyes; then :
   ISDNNET_HEADER_FOUND=1
 else
   ISDNNET_HEADER_FOUND=0
@@ -34146,18 +19703,14 @@ if test "x${PBX_SUPPSERV}" != "x1" -a "${USE_SUPPSERV}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_suppserv_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lsuppserv" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsuppserv" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lsuppserv... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsuppserv ${pbxlibdir}  $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.
@@ -34175,47 +19728,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SUPPSERV_FOUND=yes
 else
   AST_SUPPSERV_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SUPPSERV_INCLUDE}"
-         if test "${ac_cv_header_mISDNuser_suppserv_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for mISDNuser/suppserv.h" >&5
-$as_echo_n "checking for mISDNuser/suppserv.h... " >&6; }
-if test "${ac_cv_header_mISDNuser_suppserv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_suppserv_h" >&5
-$as_echo "$ac_cv_header_mISDNuser_suppserv_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking mISDNuser/suppserv.h usability" >&5
-$as_echo_n "checking mISDNuser/suppserv.h usability... " >&6; }
-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 <mISDNuser/suppserv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking mISDNuser/suppserv.h presence" >&5
-$as_echo_n "checking mISDNuser/suppserv.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <mISDNuser/suppserv.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: mISDNuser/suppserv.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/suppserv.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/suppserv.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/suppserv.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/suppserv.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/suppserv.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/suppserv.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: mISDNuser/suppserv.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: mISDNuser/suppserv.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for mISDNuser/suppserv.h" >&5
-$as_echo_n "checking for mISDNuser/suppserv.h... " >&6; }
-if test "${ac_cv_header_mISDNuser_suppserv_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_mISDNuser_suppserv_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mISDNuser_suppserv_h" >&5
-$as_echo "$ac_cv_header_mISDNuser_suppserv_h" >&6; }
-
-fi
-if test "x$ac_cv_header_mISDNuser_suppserv_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "mISDNuser/suppserv.h" "ac_cv_header_mISDNuser_suppserv_h" "$ac_includes_default"
+if test "x$ac_cv_header_mISDNuser_suppserv_h" = xyes; then :
   SUPPSERV_HEADER_FOUND=1
 else
   SUPPSERV_HEADER_FOUND=0
@@ -34397,7 +19791,7 @@ fi
 
 
     if test "x${PBX_MISDN_FAC_RESULT}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for Fac_RESULT in mISDNuser/suppserv.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fac_RESULT in mISDNuser/suppserv.h" >&5
 $as_echo_n "checking for Fac_RESULT in mISDNuser/suppserv.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${MISDN_FAC_RESULT_DIR}" != "x"; then
@@ -34405,13 +19799,9 @@ $as_echo_n "checking for Fac_RESULT in mISDNuser/suppserv.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${MISDN_FAC_RESULT_INCLUDE}"
 
-       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 <mISDNuser/suppserv.h>
+ #include <mISDNuser/suppserv.h>
 int
 main ()
 {
@@ -34426,43 +19816,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_MISDN_FAC_RESULT=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MISDN_FAC_RESULT 1
-_ACEOF
+$as_echo "#define HAVE_MISDN_FAC_RESULT 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -34470,7 +19837,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_MISDN_FAC_ERROR}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for Fac_ERROR in mISDNuser/suppserv.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fac_ERROR in mISDNuser/suppserv.h" >&5
 $as_echo_n "checking for Fac_ERROR in mISDNuser/suppserv.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${MISDN_FAC_ERROR_DIR}" != "x"; then
@@ -34478,13 +19845,9 @@ $as_echo_n "checking for Fac_ERROR in mISDNuser/suppserv.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${MISDN_FAC_ERROR_INCLUDE}"
 
-       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 <mISDNuser/suppserv.h>
+ #include <mISDNuser/suppserv.h>
 int
 main ()
 {
@@ -34499,181 +19862,27 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_MISDN_FAC_ERROR=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MISDN_FAC_ERROR 1
-_ACEOF
+$as_echo "#define HAVE_MISDN_FAC_ERROR 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
 
 
-   if test "${ac_cv_header_linux_mISDNdsp_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for linux/mISDNdsp.h" >&5
-$as_echo_n "checking for linux/mISDNdsp.h... " >&6; }
-if test "${ac_cv_header_linux_mISDNdsp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_mISDNdsp_h" >&5
-$as_echo "$ac_cv_header_linux_mISDNdsp_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking linux/mISDNdsp.h usability" >&5
-$as_echo_n "checking linux/mISDNdsp.h usability... " >&6; }
-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 <linux/mISDNdsp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking linux/mISDNdsp.h presence" >&5
-$as_echo_n "checking linux/mISDNdsp.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <linux/mISDNdsp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: linux/mISDNdsp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/mISDNdsp.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: linux/mISDNdsp.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/mISDNdsp.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/mISDNdsp.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/mISDNdsp.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/mISDNdsp.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/mISDNdsp.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: linux/mISDNdsp.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for linux/mISDNdsp.h" >&5
-$as_echo_n "checking for linux/mISDNdsp.h... " >&6; }
-if test "${ac_cv_header_linux_mISDNdsp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_linux_mISDNdsp_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_mISDNdsp_h" >&5
-$as_echo "$ac_cv_header_linux_mISDNdsp_h" >&6; }
-
-fi
-if test "x$ac_cv_header_linux_mISDNdsp_h" = x""yes; then
+   ac_fn_c_check_header_mongrel "$LINENO" "linux/mISDNdsp.h" "ac_cv_header_linux_mISDNdsp_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_mISDNdsp_h" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define MISDN_1_2 1
@@ -34682,105 +19891,10 @@ _ACEOF
 fi
 
 
-   { $as_echo "$as_me:$LINENO: checking for Q931_info_t.redirect_dn" >&5
-$as_echo_n "checking for Q931_info_t.redirect_dn... " >&6; }
-if test "${ac_cv_member_Q931_info_t_redirect_dn+set}" = set; 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
-/* end confdefs.h.  */
-#include <mISDNuser/mISDNlib.h>
-
-int
-main ()
-{
-static Q931_info_t ac_aggr;
-if (ac_aggr.redirect_dn)
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_Q931_info_t_redirect_dn=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <mISDNuser/mISDNlib.h>
-
-int
-main ()
-{
-static Q931_info_t ac_aggr;
-if (sizeof ac_aggr.redirect_dn)
-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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_member_Q931_info_t_redirect_dn=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_member_Q931_info_t_redirect_dn=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+   ac_fn_c_check_member "$LINENO" "Q931_info_t" "redirect_dn" "ac_cv_member_Q931_info_t_redirect_dn" "#include <mISDNuser/mISDNlib.h>
+"
+if test "x$ac_cv_member_Q931_info_t_redirect_dn" = xyes; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_Q931_info_t_redirect_dn" >&5
-$as_echo "$ac_cv_member_Q931_info_t_redirect_dn" >&6; }
-if test "x$ac_cv_member_Q931_info_t_redirect_dn" = x""yes; then
-  :
 else
   PBX_MISDN=0
 fi
@@ -34793,9 +19907,9 @@ fi
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}mysql_config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}mysql_config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_MYSQLCLIENT+set}" = set; then
+if ${ac_cv_path_CONFIG_MYSQLCLIENT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CONFIG_MYSQLCLIENT in
@@ -34809,14 +19923,14 @@ for as_dir in $as_dummy
 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_path_CONFIG_MYSQLCLIENT="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -34824,10 +19938,10 @@ esac
 fi
 CONFIG_MYSQLCLIENT=$ac_cv_path_CONFIG_MYSQLCLIENT
 if test -n "$CONFIG_MYSQLCLIENT"; then
-  { $as_echo "$as_me:$LINENO: result: $CONFIG_MYSQLCLIENT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_MYSQLCLIENT" >&5
 $as_echo "$CONFIG_MYSQLCLIENT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -34837,9 +19951,9 @@ if test -z "$ac_cv_path_CONFIG_MYSQLCLIENT"; then
   ac_pt_CONFIG_MYSQLCLIENT=$CONFIG_MYSQLCLIENT
   # Extract the first word of "mysql_config", so it can be a program name with args.
 set dummy mysql_config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_MYSQLCLIENT+set}" = set; then
+if ${ac_cv_path_ac_pt_CONFIG_MYSQLCLIENT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_CONFIG_MYSQLCLIENT in
@@ -34853,14 +19967,14 @@ for as_dir in $as_dummy
 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_path_ac_pt_CONFIG_MYSQLCLIENT="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -34868,10 +19982,10 @@ esac
 fi
 ac_pt_CONFIG_MYSQLCLIENT=$ac_cv_path_ac_pt_CONFIG_MYSQLCLIENT
 if test -n "$ac_pt_CONFIG_MYSQLCLIENT"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_CONFIG_MYSQLCLIENT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_MYSQLCLIENT" >&5
 $as_echo "$ac_pt_CONFIG_MYSQLCLIENT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -34880,7 +19994,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
                saved_libs="${LIBS}"
                LIBS="${MYSQLCLIENT_LIB}"
 
-               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
@@ -34921,53 +20031,21 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
      PBX_MYSQLCLIENT=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MYSQLCLIENT 1
-_ACEOF
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_MYSQLCLIENT 1" >>confdefs.h
 
 
 fi
-
-rm -rf conftest.dSYM
-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
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
            else
                PBX_MYSQLCLIENT=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MYSQLCLIENT 1
-_ACEOF
+$as_echo "#define HAVE_MYSQLCLIENT 1" >>confdefs.h
 
            fi
        fi
@@ -34992,18 +20070,14 @@ if test "x${PBX_NBS}" != "x1" -a "${USE_NBS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_nbs_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lnbs" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lnbs" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lnbs... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lnbs ${pbxlibdir}  $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.
@@ -35021,201 +20095,42 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_NBS_FOUND=yes
-else
-  AST_NBS_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_NBS_FOUND}" = "yes"; then
-      NBS_LIB="${pbxlibdir} -lnbs "
-      # if --with-NBS=DIR has been specified, use it.
-      if test "x${NBS_DIR}" != "x"; then
-         NBS_INCLUDE="-I${NBS_DIR}/include"
-      fi
-      NBS_INCLUDE="${NBS_INCLUDE} "
-      if test "xnbs.h" = "x" ; then    # no header, assume found
-         NBS_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${NBS_INCLUDE}"
-         if test "${ac_cv_header_nbs_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for nbs.h" >&5
-$as_echo_n "checking for nbs.h... " >&6; }
-if test "${ac_cv_header_nbs_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
-$as_echo "$ac_cv_header_nbs_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking nbs.h usability" >&5
-$as_echo_n "checking nbs.h usability... " >&6; }
-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 <nbs.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking nbs.h presence" >&5
-$as_echo_n "checking nbs.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <nbs.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+else
+  eval "$as_ac_Lib=no"
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: nbs.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: nbs.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: nbs.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: nbs.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: nbs.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: nbs.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: nbs.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: nbs.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: nbs.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: nbs.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: nbs.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: nbs.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: nbs.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: nbs.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for nbs.h" >&5
-$as_echo_n "checking for nbs.h... " >&6; }
-if test "${ac_cv_header_nbs_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_NBS_FOUND=yes
 else
-  ac_cv_header_nbs_h=$ac_header_preproc
+  AST_NBS_FOUND=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_nbs_h" >&5
-$as_echo "$ac_cv_header_nbs_h" >&6; }
 
-fi
-if test "x$ac_cv_header_nbs_h" = x""yes; then
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_NBS_FOUND}" = "yes"; then
+      NBS_LIB="${pbxlibdir} -lnbs "
+      # if --with-NBS=DIR has been specified, use it.
+      if test "x${NBS_DIR}" != "x"; then
+         NBS_INCLUDE="-I${NBS_DIR}/include"
+      fi
+      NBS_INCLUDE="${NBS_INCLUDE} "
+      if test "xnbs.h" = "x" ; then    # no header, assume found
+         NBS_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${NBS_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "nbs.h" "ac_cv_header_nbs_h" "$ac_includes_default"
+if test "x$ac_cv_header_nbs_h" = xyes; then :
   NBS_HEADER_FOUND=1
 else
   NBS_HEADER_FOUND=0
@@ -35248,9 +20163,9 @@ fi
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}neon-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}neon-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_NEON+set}" = set; then
+if ${ac_cv_path_CONFIG_NEON+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CONFIG_NEON in
@@ -35264,14 +20179,14 @@ for as_dir in $as_dummy
 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_path_CONFIG_NEON="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -35279,10 +20194,10 @@ esac
 fi
 CONFIG_NEON=$ac_cv_path_CONFIG_NEON
 if test -n "$CONFIG_NEON"; then
-  { $as_echo "$as_me:$LINENO: result: $CONFIG_NEON" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_NEON" >&5
 $as_echo "$CONFIG_NEON" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -35292,9 +20207,9 @@ if test -z "$ac_cv_path_CONFIG_NEON"; then
   ac_pt_CONFIG_NEON=$CONFIG_NEON
   # Extract the first word of "neon-config", so it can be a program name with args.
 set dummy neon-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_NEON+set}" = set; then
+if ${ac_cv_path_ac_pt_CONFIG_NEON+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_CONFIG_NEON in
@@ -35308,14 +20223,14 @@ for as_dir in $as_dummy
 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_path_ac_pt_CONFIG_NEON="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -35323,10 +20238,10 @@ esac
 fi
 ac_pt_CONFIG_NEON=$ac_cv_path_ac_pt_CONFIG_NEON
 if test -n "$ac_pt_CONFIG_NEON"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_CONFIG_NEON" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_NEON" >&5
 $as_echo "$ac_pt_CONFIG_NEON" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -35335,7 +20250,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
                saved_libs="${LIBS}"
                LIBS="${NEON_LIB}"
 
-               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
@@ -35376,53 +20287,21 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
      PBX_NEON=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NEON 1
-_ACEOF
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_NEON 1" >>confdefs.h
 
 
 fi
-
-rm -rf conftest.dSYM
-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
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
            else
                PBX_NEON=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NEON 1
-_ACEOF
+$as_echo "#define HAVE_NEON 1" >>confdefs.h
 
            fi
        fi
@@ -35435,9 +20314,9 @@ _ACEOF
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}neon-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}neon-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_NEON29+set}" = set; then
+if ${ac_cv_path_CONFIG_NEON29+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CONFIG_NEON29 in
@@ -35451,14 +20330,14 @@ for as_dir in $as_dummy
 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_path_CONFIG_NEON29="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -35466,10 +20345,10 @@ esac
 fi
 CONFIG_NEON29=$ac_cv_path_CONFIG_NEON29
 if test -n "$CONFIG_NEON29"; then
-  { $as_echo "$as_me:$LINENO: result: $CONFIG_NEON29" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_NEON29" >&5
 $as_echo "$CONFIG_NEON29" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -35479,9 +20358,9 @@ if test -z "$ac_cv_path_CONFIG_NEON29"; then
   ac_pt_CONFIG_NEON29=$CONFIG_NEON29
   # Extract the first word of "neon-config", so it can be a program name with args.
 set dummy neon-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_NEON29+set}" = set; then
+if ${ac_cv_path_ac_pt_CONFIG_NEON29+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_CONFIG_NEON29 in
@@ -35495,14 +20374,14 @@ for as_dir in $as_dummy
 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_path_ac_pt_CONFIG_NEON29="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -35510,10 +20389,10 @@ esac
 fi
 ac_pt_CONFIG_NEON29=$ac_cv_path_ac_pt_CONFIG_NEON29
 if test -n "$ac_pt_CONFIG_NEON29"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_CONFIG_NEON29" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_NEON29" >&5
 $as_echo "$ac_pt_CONFIG_NEON29" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -35522,7 +20401,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
                saved_libs="${LIBS}"
                LIBS="${NEON29_LIB}"
 
-               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 <ne_auth.h>
 #include <ne_auth.h>
 int
 main ()
 {
@@ -35565,53 +20440,21 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
      PBX_NEON29=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NEON29 1
-_ACEOF
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_NEON29 1" >>confdefs.h
 
 
 fi
-
-rm -rf conftest.dSYM
-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
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
            else
                PBX_NEON29=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NEON29 1
-_ACEOF
+$as_echo "#define HAVE_NEON29 1" >>confdefs.h
 
            fi
        fi
@@ -35624,9 +20467,9 @@ _ACEOF
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}net-snmp-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}net-snmp-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_NETSNMP+set}" = set; then
+if ${ac_cv_path_CONFIG_NETSNMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CONFIG_NETSNMP in
@@ -35640,14 +20483,14 @@ for as_dir in $as_dummy
 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_path_CONFIG_NETSNMP="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -35655,10 +20498,10 @@ esac
 fi
 CONFIG_NETSNMP=$ac_cv_path_CONFIG_NETSNMP
 if test -n "$CONFIG_NETSNMP"; then
-  { $as_echo "$as_me:$LINENO: result: $CONFIG_NETSNMP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_NETSNMP" >&5
 $as_echo "$CONFIG_NETSNMP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -35668,9 +20511,9 @@ if test -z "$ac_cv_path_CONFIG_NETSNMP"; then
   ac_pt_CONFIG_NETSNMP=$CONFIG_NETSNMP
   # Extract the first word of "net-snmp-config", so it can be a program name with args.
 set dummy net-snmp-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_NETSNMP+set}" = set; then
+if ${ac_cv_path_ac_pt_CONFIG_NETSNMP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_CONFIG_NETSNMP in
@@ -35684,14 +20527,14 @@ for as_dir in $as_dummy
 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_path_ac_pt_CONFIG_NETSNMP="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -35699,10 +20542,10 @@ esac
 fi
 ac_pt_CONFIG_NETSNMP=$ac_cv_path_ac_pt_CONFIG_NETSNMP
 if test -n "$ac_pt_CONFIG_NETSNMP"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_CONFIG_NETSNMP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_NETSNMP" >&5
 $as_echo "$ac_pt_CONFIG_NETSNMP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -35711,7 +20554,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
                saved_libs="${LIBS}"
                LIBS="${NETSNMP_LIB}"
 
-               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 <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-config.h>
 #include <net-snmp/net-snmp-includes.h>
 #include <net-snmp/agent/net-snmp-agent-includes.h>
 int
@@ -35756,53 +20595,21 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
      PBX_NETSNMP=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NETSNMP 1
-_ACEOF
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_NETSNMP 1" >>confdefs.h
 
 
 fi
-
-rm -rf conftest.dSYM
-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
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
            else
                PBX_NETSNMP=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_NETSNMP 1
-_ACEOF
+$as_echo "#define HAVE_NETSNMP 1" >>confdefs.h
 
            fi
        fi
@@ -35827,18 +20634,14 @@ if test "x${PBX_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_newt_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lnewt" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lnewt" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lnewt... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lnewt ${pbxlibdir}  $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.
@@ -35856,47 +20659,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_NEWT_FOUND=yes
 else
   AST_NEWT_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${NEWT_INCLUDE}"
-         if test "${ac_cv_header_newt_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for newt.h" >&5
-$as_echo_n "checking for newt.h... " >&6; }
-if test "${ac_cv_header_newt_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
-$as_echo "$ac_cv_header_newt_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking newt.h usability" >&5
-$as_echo_n "checking newt.h usability... " >&6; }
-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 <newt.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking newt.h presence" >&5
-$as_echo_n "checking newt.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <newt.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: newt.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: newt.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: newt.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: newt.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: newt.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: newt.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: newt.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: newt.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: newt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: newt.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: newt.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: newt.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for newt.h" >&5
-$as_echo_n "checking for newt.h... " >&6; }
-if test "${ac_cv_header_newt_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_newt_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5
-$as_echo "$ac_cv_header_newt_h" >&6; }
-
-fi
-if test "x$ac_cv_header_newt_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "newt.h" "ac_cv_header_newt_h" "$ac_includes_default"
+if test "x$ac_cv_header_newt_h" = xyes; then :
   NEWT_HEADER_FOUND=1
 else
   NEWT_HEADER_FOUND=0
@@ -36095,18 +20739,14 @@ if test "x${PBX_UNIXODBC}" != "x1" -a "${USE_UNIXODBC}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_odbc_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lodbc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lodbc" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lodbc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lodbc ${pbxlibdir}  $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.
@@ -36124,47 +20764,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_UNIXODBC_FOUND=yes
 else
   AST_UNIXODBC_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${UNIXODBC_INCLUDE}"
-         if test "${ac_cv_header_sql_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sql.h" >&5
-$as_echo_n "checking for sql.h... " >&6; }
-if test "${ac_cv_header_sql_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
-$as_echo "$ac_cv_header_sql_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sql.h usability" >&5
-$as_echo_n "checking sql.h usability... " >&6; }
-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 <sql.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sql.h presence" >&5
-$as_echo_n "checking sql.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sql.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sql.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sql.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sql.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sql.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sql.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sql.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sql.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sql.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sql.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sql.h" >&5
-$as_echo_n "checking for sql.h... " >&6; }
-if test "${ac_cv_header_sql_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sql_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sql_h" >&5
-$as_echo "$ac_cv_header_sql_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sql_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sql.h" "ac_cv_header_sql_h" "$ac_includes_default"
+if test "x$ac_cv_header_sql_h" = xyes; then :
   UNIXODBC_HEADER_FOUND=1
 else
   UNIXODBC_HEADER_FOUND=0
@@ -36363,18 +20844,14 @@ if test "x${PBX_OGG}" != "x1" -a "${USE_OGG}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ogg_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -logg" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -logg" >&5
 $as_echo_n "checking for ${pbxfuncname} in -logg... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-logg ${pbxlibdir}  $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.
@@ -36392,47 +20869,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_OGG_FOUND=yes
 else
   AST_OGG_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OGG_INCLUDE}"
-         if test "${ac_cv_header_+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking  usability" >&5
-$as_echo_n "checking  usability... " >&6; }
-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 <>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking  presence" >&5
-$as_echo_n "checking  presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-
-fi
-if test "x$ac_cv_header_" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = xyes; then :
   OGG_HEADER_FOUND=1
 else
   OGG_HEADER_FOUND=0
@@ -36632,18 +20950,14 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_execinfo_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lexecinfo" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lexecinfo" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lexecinfo... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lexecinfo ${pbxlibdir}  $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.
@@ -36661,47 +20975,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_BKTR_FOUND=yes
 else
   AST_BKTR_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE}"
-         if test "${ac_cv_header_execinfo_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for execinfo.h" >&5
-$as_echo_n "checking for execinfo.h... " >&6; }
-if test "${ac_cv_header_execinfo_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
-$as_echo "$ac_cv_header_execinfo_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking execinfo.h usability" >&5
-$as_echo_n "checking execinfo.h usability... " >&6; }
-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 <execinfo.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking execinfo.h presence" >&5
-$as_echo_n "checking execinfo.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <execinfo.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: execinfo.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: execinfo.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: execinfo.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: execinfo.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: execinfo.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: execinfo.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for execinfo.h" >&5
-$as_echo_n "checking for execinfo.h... " >&6; }
-if test "${ac_cv_header_execinfo_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_execinfo_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
-$as_echo "$ac_cv_header_execinfo_h" >&6; }
-
-fi
-if test "x$ac_cv_header_execinfo_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
+if test "x$ac_cv_header_execinfo_h" = xyes; then :
   BKTR_HEADER_FOUND=1
 else
   BKTR_HEADER_FOUND=0
@@ -36900,18 +21055,14 @@ if test "x${PBX_BKTR}" != "x1" -a "${USE_BKTR}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_c_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lc" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lc... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lc ${pbxlibdir}  $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.
@@ -36929,201 +21080,42 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_BKTR_FOUND=yes
-else
-  AST_BKTR_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_BKTR_FOUND}" = "yes"; then
-      BKTR_LIB="${pbxlibdir} -lc "
-      # if --with-BKTR=DIR has been specified, use it.
-      if test "x${BKTR_DIR}" != "x"; then
-         BKTR_INCLUDE="-I${BKTR_DIR}/include"
-      fi
-      BKTR_INCLUDE="${BKTR_INCLUDE} "
-      if test "xexecinfo.h" = "x" ; then       # no header, assume found
-         BKTR_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE}"
-         if test "${ac_cv_header_execinfo_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for execinfo.h" >&5
-$as_echo_n "checking for execinfo.h... " >&6; }
-if test "${ac_cv_header_execinfo_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
-$as_echo "$ac_cv_header_execinfo_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking execinfo.h usability" >&5
-$as_echo_n "checking execinfo.h usability... " >&6; }
-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 <execinfo.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking execinfo.h presence" >&5
-$as_echo_n "checking execinfo.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <execinfo.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: execinfo.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: execinfo.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: execinfo.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: execinfo.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: execinfo.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: execinfo.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: execinfo.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: execinfo.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for execinfo.h" >&5
-$as_echo_n "checking for execinfo.h... " >&6; }
-if test "${ac_cv_header_execinfo_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_BKTR_FOUND=yes
 else
-  ac_cv_header_execinfo_h=$ac_header_preproc
+  AST_BKTR_FOUND=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
-$as_echo "$ac_cv_header_execinfo_h" >&6; }
 
-fi
-if test "x$ac_cv_header_execinfo_h" = x""yes; then
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_BKTR_FOUND}" = "yes"; then
+      BKTR_LIB="${pbxlibdir} -lc "
+      # if --with-BKTR=DIR has been specified, use it.
+      if test "x${BKTR_DIR}" != "x"; then
+         BKTR_INCLUDE="-I${BKTR_DIR}/include"
+      fi
+      BKTR_INCLUDE="${BKTR_INCLUDE} "
+      if test "xexecinfo.h" = "x" ; then       # no header, assume found
+         BKTR_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${BKTR_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default"
+if test "x$ac_cv_header_execinfo_h" = xyes; then :
   BKTR_HEADER_FOUND=1
 else
   BKTR_HEADER_FOUND=0
@@ -37168,18 +21160,14 @@ if test "x${PBX_BLUETOOTH}" != "x1" -a "${USE_BLUETOOTH}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_bluetooth_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lbluetooth" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lbluetooth" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lbluetooth... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lbluetooth ${pbxlibdir}  $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.
@@ -37197,47 +21185,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_BLUETOOTH_FOUND=yes
 else
   AST_BLUETOOTH_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${BLUETOOTH_INCLUDE}"
-         if test "${ac_cv_header_bluetooth_bluetooth_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for bluetooth/bluetooth.h" >&5
-$as_echo_n "checking for bluetooth/bluetooth.h... " >&6; }
-if test "${ac_cv_header_bluetooth_bluetooth_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_bluetooth_bluetooth_h" >&5
-$as_echo "$ac_cv_header_bluetooth_bluetooth_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking bluetooth/bluetooth.h usability" >&5
-$as_echo_n "checking bluetooth/bluetooth.h usability... " >&6; }
-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 <bluetooth/bluetooth.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking bluetooth/bluetooth.h presence" >&5
-$as_echo_n "checking bluetooth/bluetooth.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <bluetooth/bluetooth.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: bluetooth/bluetooth.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: bluetooth/bluetooth.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: bluetooth/bluetooth.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for bluetooth/bluetooth.h" >&5
-$as_echo_n "checking for bluetooth/bluetooth.h... " >&6; }
-if test "${ac_cv_header_bluetooth_bluetooth_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_bluetooth_bluetooth_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_bluetooth_bluetooth_h" >&5
-$as_echo "$ac_cv_header_bluetooth_bluetooth_h" >&6; }
-
-fi
-if test "x$ac_cv_header_bluetooth_bluetooth_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "bluetooth/bluetooth.h" "ac_cv_header_bluetooth_bluetooth_h" "$ac_includes_default"
+if test "x$ac_cv_header_bluetooth_bluetooth_h" = xyes; then :
   BLUETOOTH_HEADER_FOUND=1
 else
   BLUETOOTH_HEADER_FOUND=0
@@ -37437,18 +21266,14 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lossaudio" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lossaudio ${pbxlibdir}  $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.
@@ -37466,47 +21291,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_OSS_FOUND=yes
 else
   AST_OSS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
-         if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
-$as_echo_n "checking for linux/soundcard.h... " >&6; }
-if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
-$as_echo "$ac_cv_header_linux_soundcard_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking linux/soundcard.h usability" >&5
-$as_echo_n "checking linux/soundcard.h usability... " >&6; }
-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 <linux/soundcard.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking linux/soundcard.h presence" >&5
-$as_echo_n "checking linux/soundcard.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <linux/soundcard.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: linux/soundcard.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/soundcard.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/soundcard.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: linux/soundcard.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for linux/soundcard.h" >&5
-$as_echo_n "checking for linux/soundcard.h... " >&6; }
-if test "${ac_cv_header_linux_soundcard_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_linux_soundcard_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_soundcard_h" >&5
-$as_echo "$ac_cv_header_linux_soundcard_h" >&6; }
-
-fi
-if test "x$ac_cv_header_linux_soundcard_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "linux/soundcard.h" "ac_cv_header_linux_soundcard_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_soundcard_h" = xyes; then :
   OSS_HEADER_FOUND=1
 else
   OSS_HEADER_FOUND=0
@@ -37704,18 +21370,14 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lossaudio" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lossaudio ${pbxlibdir}  $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.
@@ -37733,47 +21395,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_OSS_FOUND=yes
 else
   AST_OSS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
-         if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
-$as_echo_n "checking for sys/soundcard.h... " >&6; }
-if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5
-$as_echo "$ac_cv_header_sys_soundcard_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sys/soundcard.h usability" >&5
-$as_echo_n "checking sys/soundcard.h usability... " >&6; }
-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 <sys/soundcard.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sys/soundcard.h presence" >&5
-$as_echo_n "checking sys/soundcard.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/soundcard.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/soundcard.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sys/soundcard.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/soundcard.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/soundcard.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/soundcard.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5
-$as_echo_n "checking for sys/soundcard.h... " >&6; }
-if test "${ac_cv_header_sys_soundcard_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sys_soundcard_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5
-$as_echo "$ac_cv_header_sys_soundcard_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sys_soundcard_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sys/soundcard.h" "ac_cv_header_sys_soundcard_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_soundcard_h" = xyes; then :
   OSS_HEADER_FOUND=1
 else
   OSS_HEADER_FOUND=0
@@ -37971,18 +21474,14 @@ if test "x${PBX_OSS}" != "x1" -a "${USE_OSS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ossaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lossaudio" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lossaudio" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lossaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lossaudio ${pbxlibdir}  $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.
@@ -38000,47 +21499,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_OSS_FOUND=yes
 else
   AST_OSS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OSS_INCLUDE}"
-         if test "${ac_cv_header_soundcard_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for soundcard.h" >&5
-$as_echo_n "checking for soundcard.h... " >&6; }
-if test "${ac_cv_header_soundcard_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
-$as_echo "$ac_cv_header_soundcard_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking soundcard.h usability" >&5
-$as_echo_n "checking soundcard.h usability... " >&6; }
-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 <soundcard.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking soundcard.h presence" >&5
-$as_echo_n "checking soundcard.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <soundcard.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: soundcard.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: soundcard.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: soundcard.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: soundcard.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: soundcard.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: soundcard.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: soundcard.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: soundcard.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: soundcard.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: soundcard.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: soundcard.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: soundcard.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: soundcard.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: soundcard.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for soundcard.h" >&5
-$as_echo_n "checking for soundcard.h... " >&6; }
-if test "${ac_cv_header_soundcard_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_soundcard_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_soundcard_h" >&5
-$as_echo "$ac_cv_header_soundcard_h" >&6; }
-
-fi
-if test "x$ac_cv_header_soundcard_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "soundcard.h" "ac_cv_header_soundcard_h" "$ac_includes_default"
+if test "x$ac_cv_header_soundcard_h" = xyes; then :
   OSS_HEADER_FOUND=1
 else
   OSS_HEADER_FOUND=0
@@ -38227,9 +21567,9 @@ if test "${USE_PGSQL}" != "no"; then
       if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pg_config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pg_config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PG_CONFIG+set}" = set; then
+if ${ac_cv_path_PG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PG_CONFIG in
@@ -38242,14 +21582,14 @@ for as_dir in ${PGSQL_DIR}/bin
 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_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -38257,10 +21597,10 @@ esac
 fi
 PG_CONFIG=$ac_cv_path_PG_CONFIG
 if test -n "$PG_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $PG_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PG_CONFIG" >&5
 $as_echo "$PG_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -38270,9 +21610,9 @@ if test -z "$ac_cv_path_PG_CONFIG"; then
   ac_pt_PG_CONFIG=$PG_CONFIG
   # Extract the first word of "pg_config", so it can be a program name with args.
 set dummy pg_config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then
+if ${ac_cv_path_ac_pt_PG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PG_CONFIG in
@@ -38285,14 +21625,14 @@ for as_dir in ${PGSQL_DIR}/bin
 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_path_ac_pt_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -38300,10 +21640,10 @@ esac
 fi
 ac_pt_PG_CONFIG=$ac_cv_path_ac_pt_PG_CONFIG
 if test -n "$ac_pt_PG_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_PG_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PG_CONFIG" >&5
 $as_echo "$ac_pt_PG_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -38312,7 +21652,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -38323,15 +21663,15 @@ else
 fi
 
       if test x"${PG_CONFIG}" = xNo; then
-         { $as_echo "$as_me:$LINENO: ***" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
 $as_echo "$as_me: ***" >&6;}
-         { $as_echo "$as_me:$LINENO: *** pg_config was not found in the path you specified:" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** pg_config was not found in the path you specified:" >&5
 $as_echo "$as_me: *** pg_config was not found in the path you specified:" >&6;}
-         { $as_echo "$as_me:$LINENO: *** ${PGSQL_DIR}/bin" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** ${PGSQL_DIR}/bin" >&5
 $as_echo "$as_me: *** ${PGSQL_DIR}/bin" >&6;}
-         { $as_echo "$as_me:$LINENO: *** Either correct the installation, or run configure" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
 $as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
-         { $as_echo "$as_me:$LINENO: *** including --without-postgres" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-postgres" >&5
 $as_echo "$as_me: *** including --without-postgres" >&6;}
          exit 1
       fi
@@ -38339,9 +21679,9 @@ $as_echo "$as_me: *** including --without-postgres" >&6;}
       if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}pg_config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}pg_config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PG_CONFIG+set}" = set; then
+if ${ac_cv_path_PG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PG_CONFIG in
@@ -38354,14 +21694,14 @@ 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_path_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -38369,10 +21709,10 @@ esac
 fi
 PG_CONFIG=$ac_cv_path_PG_CONFIG
 if test -n "$PG_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $PG_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PG_CONFIG" >&5
 $as_echo "$PG_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -38382,9 +21722,9 @@ if test -z "$ac_cv_path_PG_CONFIG"; then
   ac_pt_PG_CONFIG=$PG_CONFIG
   # Extract the first word of "pg_config", so it can be a program name with args.
 set dummy pg_config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PG_CONFIG+set}" = set; then
+if ${ac_cv_path_ac_pt_PG_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_PG_CONFIG in
@@ -38397,14 +21737,14 @@ 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_path_ac_pt_PG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -38412,10 +21752,10 @@ esac
 fi
 ac_pt_PG_CONFIG=$ac_cv_path_ac_pt_PG_CONFIG
 if test -n "$ac_pt_PG_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_PG_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PG_CONFIG" >&5
 $as_echo "$ac_pt_PG_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -38424,7 +21764,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
@@ -38441,29 +21781,25 @@ if test "${PG_CONFIG}" != No; then
    PGSQL_includedir=`${PG_CONFIG} --includedir`
    if test "x$?" != "x0" ; then
       if test -n "${PGSQL_MANDATORY}" ; then
-         { $as_echo "$as_me:$LINENO: ***" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
 $as_echo "$as_me: ***" >&6;}
-         { $as_echo "$as_me:$LINENO: *** The PostgreSQL installation on this system appears to be broken." >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** The PostgreSQL installation on this system appears to be broken." >&5
 $as_echo "$as_me: *** The PostgreSQL installation on this system appears to be broken." >&6;}
-         { $as_echo "$as_me:$LINENO: *** Either correct the installation, or run configure" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
 $as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
-         { $as_echo "$as_me:$LINENO: *** including --without-postgres" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-postgres" >&5
 $as_echo "$as_me: *** including --without-postgres" >&6;}
          exit 1
          fi
    else
-      { $as_echo "$as_me:$LINENO: checking for PQescapeStringConn in -lpq" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PQescapeStringConn in -lpq" >&5
 $as_echo_n "checking for PQescapeStringConn in -lpq... " >&6; }
-if test "${ac_cv_lib_pq_PQescapeStringConn+set}" = set; then
+if ${ac_cv_lib_pq_PQescapeStringConn+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpq -L${PGSQL_libdir} -lz $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.
@@ -38481,43 +21817,18 @@ return PQescapeStringConn ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_pq_PQescapeStringConn=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_pq_PQescapeStringConn=no
+  ac_cv_lib_pq_PQescapeStringConn=no
 fi
-
-rm -rf conftest.dSYM
-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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pq_PQescapeStringConn" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pq_PQescapeStringConn" >&5
 $as_echo "$ac_cv_lib_pq_PQescapeStringConn" >&6; }
-if test "x$ac_cv_lib_pq_PQescapeStringConn" = x""yes; then
+if test "x$ac_cv_lib_pq_PQescapeStringConn" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_PGSQL 1
@@ -38526,17 +21837,13 @@ _ACEOF
 fi
 
 
-      { $as_echo "$as_me:$LINENO: checking for pg_encoding_to_char within Postgres headers" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pg_encoding_to_char within Postgres headers" >&5
 $as_echo_n "checking for pg_encoding_to_char within Postgres headers... " >&6; }
       old_CFLAGS=${CFLAGS}
       CFLAGS="${CFLAGS} -I${PGSQL_includedir} -Werror"
       old_LDFLAGS=${LDFLAGS}
       LDFLAGS="${LDFLAGS} -L${PGSQL_libdir} -lpq -lz"
-      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 <libpq-fe.h>
 int
@@ -38547,28 +21854,8 @@ const char *foo = pg_encoding_to_char(1)
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 
 cat >>confdefs.h <<_ACEOF
@@ -38576,16 +21863,11 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-
-rm -rf conftest.dSYM
-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
       CFLAGS=${old_CFLAGS}
       LDFLAGS=${old_LDFLAGS}
 
@@ -38595,13 +21877,13 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
          PBX_PGSQL=1
       elif test -n "${PGSQL_MANDATORY}";
       then
-         { $as_echo "$as_me:$LINENO: ***" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
 $as_echo "$as_me: ***" >&6;}
-         { $as_echo "$as_me:$LINENO: *** The PostgreSQL installation on this system appears to be broken." >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** The PostgreSQL installation on this system appears to be broken." >&5
 $as_echo "$as_me: *** The PostgreSQL installation on this system appears to be broken." >&6;}
-         { $as_echo "$as_me:$LINENO: *** Either correct the installation, or run configure" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
 $as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
-         { $as_echo "$as_me:$LINENO: *** including --without-postgres" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-postgres" >&5
 $as_echo "$as_me: *** including --without-postgres" >&6;}
          exit 1
       fi
@@ -38626,18 +21908,14 @@ if test "x${PBX_POPT}" != "x1" -a "${USE_POPT}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_popt_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpopt" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpopt" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpopt... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpopt ${pbxlibdir}  $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.
@@ -38655,47 +21933,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_POPT_FOUND=yes
 else
   AST_POPT_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${POPT_INCLUDE}"
-         if test "${ac_cv_header_popt_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for popt.h" >&5
-$as_echo_n "checking for popt.h... " >&6; }
-if test "${ac_cv_header_popt_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5
-$as_echo "$ac_cv_header_popt_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking popt.h usability" >&5
-$as_echo_n "checking popt.h usability... " >&6; }
-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 <popt.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking popt.h presence" >&5
-$as_echo_n "checking popt.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <popt.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: popt.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: popt.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: popt.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: popt.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: popt.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: popt.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: popt.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: popt.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: popt.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: popt.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: popt.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: popt.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: popt.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: popt.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for popt.h" >&5
-$as_echo_n "checking for popt.h... " >&6; }
-if test "${ac_cv_header_popt_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_popt_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_popt_h" >&5
-$as_echo "$ac_cv_header_popt_h" >&6; }
-
-fi
-if test "x$ac_cv_header_popt_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "popt.h" "ac_cv_header_popt_h" "$ac_includes_default"
+if test "x$ac_cv_header_popt_h" = xyes; then :
   POPT_HEADER_FOUND=1
 else
   POPT_HEADER_FOUND=0
@@ -38894,18 +22013,14 @@ if test "x${PBX_PORTAUDIO}" != "x1" -a "${USE_PORTAUDIO}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_portaudio_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lportaudio" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lportaudio" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lportaudio... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lportaudio ${pbxlibdir}  $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.
 main ()
 {
 return ${pbxfuncname} ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_PORTAUDIO_FOUND=yes
-else
-  AST_PORTAUDIO_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_PORTAUDIO_FOUND}" = "yes"; then
-      PORTAUDIO_LIB="${pbxlibdir} -lportaudio "
-      # if --with-PORTAUDIO=DIR has been specified, use it.
-      if test "x${PORTAUDIO_DIR}" != "x"; then
-         PORTAUDIO_INCLUDE="-I${PORTAUDIO_DIR}/include"
-      fi
-      PORTAUDIO_INCLUDE="${PORTAUDIO_INCLUDE} "
-      if test "xportaudio.h" = "x" ; then      # no header, assume found
-         PORTAUDIO_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PORTAUDIO_INCLUDE}"
-         if test "${ac_cv_header_portaudio_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for portaudio.h" >&5
-$as_echo_n "checking for portaudio.h... " >&6; }
-if test "${ac_cv_header_portaudio_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_portaudio_h" >&5
-$as_echo "$ac_cv_header_portaudio_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking portaudio.h usability" >&5
-$as_echo_n "checking portaudio.h usability... " >&6; }
-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 <portaudio.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking portaudio.h presence" >&5
-$as_echo_n "checking portaudio.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <portaudio.h>
+  ;
+  return 0;
+}
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  eval "$as_ac_Lib=no"
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: portaudio.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: portaudio.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: portaudio.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: portaudio.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: portaudio.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: portaudio.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: portaudio.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: portaudio.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: portaudio.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: portaudio.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: portaudio.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: portaudio.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: portaudio.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: portaudio.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: portaudio.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: portaudio.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for portaudio.h" >&5
-$as_echo_n "checking for portaudio.h... " >&6; }
-if test "${ac_cv_header_portaudio_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_PORTAUDIO_FOUND=yes
 else
-  ac_cv_header_portaudio_h=$ac_header_preproc
+  AST_PORTAUDIO_FOUND=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_portaudio_h" >&5
-$as_echo "$ac_cv_header_portaudio_h" >&6; }
 
-fi
-if test "x$ac_cv_header_portaudio_h" = x""yes; then
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_PORTAUDIO_FOUND}" = "yes"; then
+      PORTAUDIO_LIB="${pbxlibdir} -lportaudio "
+      # if --with-PORTAUDIO=DIR has been specified, use it.
+      if test "x${PORTAUDIO_DIR}" != "x"; then
+         PORTAUDIO_INCLUDE="-I${PORTAUDIO_DIR}/include"
+      fi
+      PORTAUDIO_INCLUDE="${PORTAUDIO_INCLUDE} "
+      if test "xportaudio.h" = "x" ; then      # no header, assume found
+         PORTAUDIO_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PORTAUDIO_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "portaudio.h" "ac_cv_header_portaudio_h" "$ac_includes_default"
+if test "x$ac_cv_header_portaudio_h" = xyes; then :
   PORTAUDIO_HEADER_FOUND=1
 else
   PORTAUDIO_HEADER_FOUND=0
@@ -39162,18 +22118,14 @@ if test "x${PBX_PRI}" != "x1" -a "${USE_PRI}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -39191,47 +22143,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_FOUND=yes
 else
   AST_PRI_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_HEADER_FOUND=1
 else
   PRI_HEADER_FOUND=0
@@ -39429,18 +22222,14 @@ if test "x${PBX_PRI_L2_PERSISTENCE}" != "x1" -a "${USE_PRI_L2_PERSISTENCE}" != "
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -39458,47 +22247,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_L2_PERSISTENCE_FOUND=yes
 else
   AST_PRI_L2_PERSISTENCE_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_L2_PERSISTENCE_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_L2_PERSISTENCE_HEADER_FOUND=1
 else
   PRI_L2_PERSISTENCE_HEADER_FOUND=0
@@ -39696,18 +22326,14 @@ if test "x${PBX_PRI_DATETIME_SEND}" != "x1" -a "${USE_PRI_DATETIME_SEND}" != "no
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -39725,47 +22351,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_DATETIME_SEND_FOUND=yes
 else
   AST_PRI_DATETIME_SEND_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_DATETIME_SEND_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_DATETIME_SEND_HEADER_FOUND=1
 else
   PRI_DATETIME_SEND_HEADER_FOUND=0
@@ -39963,18 +22430,14 @@ if test "x${PBX_PRI_MWI_V2}" != "x1" -a "${USE_PRI_MWI_V2}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -39992,47 +22455,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_MWI_V2_FOUND=yes
 else
   AST_PRI_MWI_V2_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_MWI_V2_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_MWI_V2_HEADER_FOUND=1
 else
   PRI_MWI_V2_HEADER_FOUND=0
@@ -40230,18 +22534,14 @@ if test "x${PBX_PRI_DISPLAY_TEXT}" != "x1" -a "${USE_PRI_DISPLAY_TEXT}" != "no";
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -40259,47 +22559,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_DISPLAY_TEXT_FOUND=yes
 else
   AST_PRI_DISPLAY_TEXT_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_DISPLAY_TEXT_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_DISPLAY_TEXT_HEADER_FOUND=1
 else
   PRI_DISPLAY_TEXT_HEADER_FOUND=0
@@ -40497,18 +22638,14 @@ if test "x${PBX_PRI_MWI}" != "x1" -a "${USE_PRI_MWI}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -40519,208 +22656,49 @@ extern "C"
 #endif
 char ${pbxfuncname} ();
 int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_PRI_MWI_FOUND=yes
-else
-  AST_PRI_MWI_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_PRI_MWI_FOUND}" = "yes"; then
-      PRI_MWI_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_MWI=DIR has been specified, use it.
-      if test "x${PRI_MWI_DIR}" != "x"; then
-         PRI_MWI_INCLUDE="-I${PRI_MWI_DIR}/include"
-      fi
-      PRI_MWI_INCLUDE="${PRI_MWI_INCLUDE} "
-      if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_MWI_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_MWI_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+main ()
+{
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  eval "$as_ac_Lib=no"
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_PRI_MWI_FOUND=yes
 else
-  ac_cv_header_libpri_h=$ac_header_preproc
+  AST_PRI_MWI_FOUND=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
 
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_PRI_MWI_FOUND}" = "yes"; then
+      PRI_MWI_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_MWI=DIR has been specified, use it.
+      if test "x${PRI_MWI_DIR}" != "x"; then
+         PRI_MWI_INCLUDE="-I${PRI_MWI_DIR}/include"
+      fi
+      PRI_MWI_INCLUDE="${PRI_MWI_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_MWI_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_MWI_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_MWI_HEADER_FOUND=1
 else
   PRI_MWI_HEADER_FOUND=0
@@ -40764,18 +22742,14 @@ if test "x${PBX_PRI_MCID}" != "x1" -a "${USE_PRI_MCID}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -40793,47 +22767,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_MCID_FOUND=yes
 else
   AST_PRI_MCID_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_MCID_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_MCID_HEADER_FOUND=1
 else
   PRI_MCID_HEADER_FOUND=0
@@ -41031,18 +22846,14 @@ if test "x${PBX_PRI_CALL_WAITING}" != "x1" -a "${USE_PRI_CALL_WAITING}" != "no";
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -41060,47 +22871,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_CALL_WAITING_FOUND=yes
 else
   AST_PRI_CALL_WAITING_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_CALL_WAITING_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_CALL_WAITING_HEADER_FOUND=1
 else
   PRI_CALL_WAITING_HEADER_FOUND=0
@@ -41298,18 +22950,14 @@ if test "x${PBX_PRI_AOC_EVENTS}" != "x1" -a "${USE_PRI_AOC_EVENTS}" != "no"; the
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -41327,47 +22975,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_AOC_EVENTS_FOUND=yes
 else
   AST_PRI_AOC_EVENTS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_AOC_EVENTS_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_AOC_EVENTS_HEADER_FOUND=1
 else
   PRI_AOC_EVENTS_HEADER_FOUND=0
@@ -41565,18 +23054,14 @@ if test "x${PBX_PRI_TRANSFER}" != "x1" -a "${USE_PRI_TRANSFER}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -41594,47 +23079,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_TRANSFER_FOUND=yes
 else
   AST_PRI_TRANSFER_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_TRANSFER_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_TRANSFER_HEADER_FOUND=1
 else
   PRI_TRANSFER_HEADER_FOUND=0
@@ -41832,18 +23158,14 @@ if test "x${PBX_PRI_CCSS}" != "x1" -a "${USE_PRI_CCSS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -41861,47 +23183,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_CCSS_FOUND=yes
 else
   AST_PRI_CCSS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_CCSS_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_CCSS_HEADER_FOUND=1
 else
   PRI_CCSS_HEADER_FOUND=0
@@ -42099,18 +23262,14 @@ if test "x${PBX_PRI_HANGUP_FIX}" != "x1" -a "${USE_PRI_HANGUP_FIX}" != "no"; the
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -42128,47 +23287,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_HANGUP_FIX_FOUND=yes
 else
   AST_PRI_HANGUP_FIX_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_HANGUP_FIX_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_HANGUP_FIX_HEADER_FOUND=1
 else
   PRI_HANGUP_FIX_HEADER_FOUND=0
@@ -42366,18 +23366,14 @@ if test "x${PBX_PRI_SUBADDR}" != "x1" -a "${USE_PRI_SUBADDR}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -42395,47 +23391,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+else
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_SUBADDR_FOUND=yes
 else
   AST_PRI_SUBADDR_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_SUBADDR_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_SUBADDR_HEADER_FOUND=1
 else
   PRI_SUBADDR_HEADER_FOUND=0
@@ -42633,18 +23470,14 @@ if test "x${PBX_PRI_CALL_HOLD}" != "x1" -a "${USE_PRI_CALL_HOLD}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -42662,47 +23495,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_CALL_HOLD_FOUND=yes
 else
   AST_PRI_CALL_HOLD_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_CALL_HOLD_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_CALL_HOLD_HEADER_FOUND=1
 else
   PRI_CALL_HOLD_HEADER_FOUND=0
@@ -42900,18 +23574,14 @@ if test "x${PBX_PRI_CALL_REROUTING}" != "x1" -a "${USE_PRI_CALL_REROUTING}" != "
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -42929,47 +23599,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_CALL_REROUTING_FOUND=yes
 else
   AST_PRI_CALL_REROUTING_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_CALL_REROUTING_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_CALL_REROUTING_HEADER_FOUND=1
 else
   PRI_CALL_REROUTING_HEADER_FOUND=0
@@ -43167,18 +23678,14 @@ if test "x${PBX_PRI_SETUP_KEYPAD}" != "x1" -a "${USE_PRI_SETUP_KEYPAD}" != "no";
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -43196,47 +23703,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_SETUP_KEYPAD_FOUND=yes
 else
   AST_PRI_SETUP_KEYPAD_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_SETUP_KEYPAD_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_SETUP_KEYPAD_HEADER_FOUND=1
 else
   PRI_SETUP_KEYPAD_HEADER_FOUND=0
@@ -43438,18 +23786,14 @@ if test "x${PBX_PRI_PROG_W_CAUSE}" != "x1" -a "${USE_PRI_PROG_W_CAUSE}" != "no";
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -43467,47 +23811,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_PROG_W_CAUSE_FOUND=yes
 else
   AST_PRI_PROG_W_CAUSE_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_PROG_W_CAUSE_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_PROG_W_CAUSE_HEADER_FOUND=1
 else
   PRI_PROG_W_CAUSE_HEADER_FOUND=0
@@ -43705,18 +23890,14 @@ if test "x${PBX_PRI_INBANDDISCONNECT}" != "x1" -a "${USE_PRI_INBANDDISCONNECT}"
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -43734,47 +23915,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_INBANDDISCONNECT_FOUND=yes
 else
   AST_PRI_INBANDDISCONNECT_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_INBANDDISCONNECT_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_INBANDDISCONNECT_HEADER_FOUND=1
 else
   PRI_INBANDDISCONNECT_HEADER_FOUND=0
@@ -43972,18 +23994,14 @@ if test "x${PBX_PRI_SERVICE_MESSAGES}" != "x1" -a "${USE_PRI_SERVICE_MESSAGES}"
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -43996,206 +24014,47 @@ char ${pbxfuncname} ();
 int
 main ()
 {
-return ${pbxfuncname} ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_PRI_SERVICE_MESSAGES_FOUND=yes
-else
-  AST_PRI_SERVICE_MESSAGES_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_PRI_SERVICE_MESSAGES_FOUND}" = "yes"; then
-      PRI_SERVICE_MESSAGES_LIB="${pbxlibdir} -lpri "
-      # if --with-PRI_SERVICE_MESSAGES=DIR has been specified, use it.
-      if test "x${PRI_SERVICE_MESSAGES_DIR}" != "x"; then
-         PRI_SERVICE_MESSAGES_INCLUDE="-I${PRI_SERVICE_MESSAGES_DIR}/include"
-      fi
-      PRI_SERVICE_MESSAGES_INCLUDE="${PRI_SERVICE_MESSAGES_INCLUDE} "
-      if test "xlibpri.h" = "x" ; then # no header, assume found
-         PRI_SERVICE_MESSAGES_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${PRI_SERVICE_MESSAGES_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
+return ${pbxfuncname} ();
+  ;
+  return 0;
+}
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  eval "$as_ac_Lib=no"
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_PRI_SERVICE_MESSAGES_FOUND=yes
 else
-  ac_cv_header_libpri_h=$ac_header_preproc
+  AST_PRI_SERVICE_MESSAGES_FOUND=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
 
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_PRI_SERVICE_MESSAGES_FOUND}" = "yes"; then
+      PRI_SERVICE_MESSAGES_LIB="${pbxlibdir} -lpri "
+      # if --with-PRI_SERVICE_MESSAGES=DIR has been specified, use it.
+      if test "x${PRI_SERVICE_MESSAGES_DIR}" != "x"; then
+         PRI_SERVICE_MESSAGES_INCLUDE="-I${PRI_SERVICE_MESSAGES_DIR}/include"
+      fi
+      PRI_SERVICE_MESSAGES_INCLUDE="${PRI_SERVICE_MESSAGES_INCLUDE} "
+      if test "xlibpri.h" = "x" ; then # no header, assume found
+         PRI_SERVICE_MESSAGES_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${PRI_SERVICE_MESSAGES_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_SERVICE_MESSAGES_HEADER_FOUND=1
 else
   PRI_SERVICE_MESSAGES_HEADER_FOUND=0
@@ -44239,18 +24098,14 @@ if test "x${PBX_PRI_REVERSE_CHARGE}" != "x1" -a "${USE_PRI_REVERSE_CHARGE}" != "
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_pri_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lpri" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lpri" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lpri... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpri ${pbxlibdir}  $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.
@@ -44268,47 +24123,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_PRI_REVERSE_CHARGE_FOUND=yes
 else
   AST_PRI_REVERSE_CHARGE_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${PRI_REVERSE_CHARGE_INCLUDE}"
-         if test "${ac_cv_header_libpri_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libpri.h usability" >&5
-$as_echo_n "checking libpri.h usability... " >&6; }
-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 <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libpri.h presence" >&5
-$as_echo_n "checking libpri.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libpri.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libpri.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libpri.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libpri.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libpri.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libpri.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libpri.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libpri.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libpri.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libpri.h" >&5
-$as_echo_n "checking for libpri.h... " >&6; }
-if test "${ac_cv_header_libpri_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libpri_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libpri_h" >&5
-$as_echo "$ac_cv_header_libpri_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libpri_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libpri.h" "ac_cv_header_libpri_h" "$ac_includes_default"
+if test "x$ac_cv_header_libpri_h" = xyes; then :
   PRI_REVERSE_CHARGE_HEADER_FOUND=1
 else
   PRI_REVERSE_CHARGE_HEADER_FOUND=0
@@ -44508,18 +24204,14 @@ if test "x${PBX_RESAMPLE}" != "x1" -a "${USE_RESAMPLE}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_resample_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lresample" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lresample" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lresample... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lresample ${pbxlibdir} -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.
@@ -44537,47 +24229,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_RESAMPLE_FOUND=yes
 else
   AST_RESAMPLE_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${RESAMPLE_INCLUDE}"
-         if test "${ac_cv_header_libresample_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libresample.h" >&5
-$as_echo_n "checking for libresample.h... " >&6; }
-if test "${ac_cv_header_libresample_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libresample_h" >&5
-$as_echo "$ac_cv_header_libresample_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libresample.h usability" >&5
-$as_echo_n "checking libresample.h usability... " >&6; }
-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 <libresample.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libresample.h presence" >&5
-$as_echo_n "checking libresample.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libresample.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libresample.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libresample.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libresample.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libresample.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libresample.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libresample.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libresample.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libresample.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libresample.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libresample.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libresample.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libresample.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libresample.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libresample.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libresample.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libresample.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libresample.h" >&5
-$as_echo_n "checking for libresample.h... " >&6; }
-if test "${ac_cv_header_libresample_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libresample_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libresample_h" >&5
-$as_echo "$ac_cv_header_libresample_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libresample_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libresample.h" "ac_cv_header_libresample_h" "$ac_includes_default"
+if test "x$ac_cv_header_libresample_h" = xyes; then :
   RESAMPLE_HEADER_FOUND=1
 else
   RESAMPLE_HEADER_FOUND=0
 
     if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
         if test "xminimum version of SpanDSP" != "x"; then
-            { $as_echo "$as_me:$LINENO: checking for minimum version of SpanDSP" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for minimum version of SpanDSP" >&5
 $as_echo_n "checking for minimum version of SpanDSP... " >&6; }
        else
-            { $as_echo "$as_me:$LINENO: checking if \"
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if \"
                #if SPANDSP_RELEASE_DATE < 20080516
                #error \"spandsp 0.0.5 or greater is required\"
                #endif
@@ -44781,13 +24314,9 @@ $as_echo_n "checking if \"
        fi
        CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
 
-       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 <spandsp/version.h>
+ #include <spandsp/version.h>
 int
 main ()
 {
@@ -44801,43 +24330,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SPANDSP=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SPANDSP 1
-_ACEOF
+$as_echo "#define HAVE_SPANDSP 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-              { $as_echo "$as_me:$LINENO: result: no" >&5
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -44865,18 +24371,14 @@ if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspandsp" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lspandsp ${pbxlibdir} -ltiff $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.
@@ -44894,47 +24396,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SPANDSP_FOUND=yes
 else
   AST_SPANDSP_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
-         if test "${ac_cv_header_spandsp_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for spandsp.h" >&5
-$as_echo_n "checking for spandsp.h... " >&6; }
-if test "${ac_cv_header_spandsp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
-$as_echo "$ac_cv_header_spandsp_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking spandsp.h usability" >&5
-$as_echo_n "checking spandsp.h usability... " >&6; }
-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 <spandsp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking spandsp.h presence" >&5
-$as_echo_n "checking spandsp.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <spandsp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: spandsp.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: spandsp.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: spandsp.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: spandsp.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: spandsp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: spandsp.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: spandsp.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for spandsp.h" >&5
-$as_echo_n "checking for spandsp.h... " >&6; }
-if test "${ac_cv_header_spandsp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_spandsp_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
-$as_echo "$ac_cv_header_spandsp_h" >&6; }
-
-fi
-if test "x$ac_cv_header_spandsp_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
+if test "x$ac_cv_header_spandsp_h" = xyes; then :
   SPANDSP_HEADER_FOUND=1
 else
   SPANDSP_HEADER_FOUND=0
@@ -45137,18 +24480,14 @@ if test "x${PBX_SPANDSP}" != "x1" -a "${USE_SPANDSP}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_spandsp_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspandsp" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspandsp" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lspandsp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lspandsp ${pbxlibdir} -ltiff $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.
@@ -45166,47 +24505,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SPANDSP_FOUND=yes
 else
   AST_SPANDSP_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SPANDSP_INCLUDE}"
-         if test "${ac_cv_header_spandsp_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for spandsp.h" >&5
-$as_echo_n "checking for spandsp.h... " >&6; }
-if test "${ac_cv_header_spandsp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
-$as_echo "$ac_cv_header_spandsp_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking spandsp.h usability" >&5
-$as_echo_n "checking spandsp.h usability... " >&6; }
-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 <spandsp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking spandsp.h presence" >&5
-$as_echo_n "checking spandsp.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <spandsp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: spandsp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: spandsp.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: spandsp.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: spandsp.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: spandsp.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: spandsp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: spandsp.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: spandsp.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: spandsp.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for spandsp.h" >&5
-$as_echo_n "checking for spandsp.h... " >&6; }
-if test "${ac_cv_header_spandsp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_spandsp_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_spandsp_h" >&5
-$as_echo "$ac_cv_header_spandsp_h" >&6; }
-
-fi
-if test "x$ac_cv_header_spandsp_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "spandsp.h" "ac_cv_header_spandsp_h" "$ac_includes_default"
+if test "x$ac_cv_header_spandsp_h" = xyes; then :
   SPANDSP_HEADER_FOUND=1
 else
   SPANDSP_HEADER_FOUND=0
@@ -45406,18 +24586,14 @@ if test "x${PBX_SS7}" != "x1" -a "${USE_SS7}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ss7_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lss7" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lss7" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lss7... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lss7 ${pbxlibdir}  $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.
@@ -45435,47 +24611,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SS7_FOUND=yes
 else
   AST_SS7_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SS7_INCLUDE}"
-         if test "${ac_cv_header_libss7_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for libss7.h" >&5
-$as_echo_n "checking for libss7.h... " >&6; }
-if test "${ac_cv_header_libss7_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libss7_h" >&5
-$as_echo "$ac_cv_header_libss7_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking libss7.h usability" >&5
-$as_echo_n "checking libss7.h usability... " >&6; }
-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 <libss7.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking libss7.h presence" >&5
-$as_echo_n "checking libss7.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libss7.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: libss7.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: libss7.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libss7.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: libss7.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: libss7.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: libss7.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libss7.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: libss7.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libss7.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: libss7.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libss7.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: libss7.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libss7.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: libss7.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: libss7.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: libss7.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for libss7.h" >&5
-$as_echo_n "checking for libss7.h... " >&6; }
-if test "${ac_cv_header_libss7_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_libss7_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_libss7_h" >&5
-$as_echo "$ac_cv_header_libss7_h" >&6; }
-
-fi
-if test "x$ac_cv_header_libss7_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "libss7.h" "ac_cv_header_libss7_h" "$ac_includes_default"
+if test "x$ac_cv_header_libss7_h" = xyes; then :
   SS7_HEADER_FOUND=1
 else
   SS7_HEADER_FOUND=0
@@ -45674,18 +24691,14 @@ if test "x${PBX_OPENR2}" != "x1" -a "${USE_OPENR2}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_openr2_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lopenr2" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lopenr2" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lopenr2... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lopenr2 ${pbxlibdir}  $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.
@@ -45703,201 +24716,42 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_OPENR2_FOUND=yes
-else
-  AST_OPENR2_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_OPENR2_FOUND}" = "yes"; then
-      OPENR2_LIB="${pbxlibdir} -lopenr2 "
-      # if --with-OPENR2=DIR has been specified, use it.
-      if test "x${OPENR2_DIR}" != "x"; then
-         OPENR2_INCLUDE="-I${OPENR2_DIR}/include"
-      fi
-      OPENR2_INCLUDE="${OPENR2_INCLUDE} "
-      if test "xopenr2.h" = "x" ; then # no header, assume found
-         OPENR2_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${OPENR2_INCLUDE}"
-         if test "${ac_cv_header_openr2_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for openr2.h" >&5
-$as_echo_n "checking for openr2.h... " >&6; }
-if test "${ac_cv_header_openr2_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openr2_h" >&5
-$as_echo "$ac_cv_header_openr2_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking openr2.h usability" >&5
-$as_echo_n "checking openr2.h usability... " >&6; }
-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 <openr2.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking openr2.h presence" >&5
-$as_echo_n "checking openr2.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <openr2.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
+  eval "$as_ac_Lib=no"
 fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: openr2.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: openr2.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openr2.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: openr2.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: openr2.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: openr2.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openr2.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: openr2.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openr2.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: openr2.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openr2.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: openr2.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openr2.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: openr2.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openr2.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: openr2.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for openr2.h" >&5
-$as_echo_n "checking for openr2.h... " >&6; }
-if test "${ac_cv_header_openr2_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_OPENR2_FOUND=yes
 else
-  ac_cv_header_openr2_h=$ac_header_preproc
+  AST_OPENR2_FOUND=no
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openr2_h" >&5
-$as_echo "$ac_cv_header_openr2_h" >&6; }
 
-fi
-if test "x$ac_cv_header_openr2_h" = x""yes; then
+      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
+   fi
+
+   # now check for the header.
+   if test "${AST_OPENR2_FOUND}" = "yes"; then
+      OPENR2_LIB="${pbxlibdir} -lopenr2 "
+      # if --with-OPENR2=DIR has been specified, use it.
+      if test "x${OPENR2_DIR}" != "x"; then
+         OPENR2_INCLUDE="-I${OPENR2_DIR}/include"
+      fi
+      OPENR2_INCLUDE="${OPENR2_INCLUDE} "
+      if test "xopenr2.h" = "x" ; then # no header, assume found
+         OPENR2_HEADER_FOUND="1"
+      else                             # check for the header
+         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
+         CPPFLAGS="${CPPFLAGS} ${OPENR2_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "openr2.h" "ac_cv_header_openr2_h" "$ac_includes_default"
+if test "x$ac_cv_header_openr2_h" = xyes; then :
   OPENR2_HEADER_FOUND=1
 else
   OPENR2_HEADER_FOUND=0
@@ -45941,145 +24795,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 if test "${PWLIBDIR:-unset}" != "unset" ; then
   as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/version.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for ${PWLIBDIR}/version.h" >&5
-$as_echo_n "checking for ${PWLIBDIR}/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ${PWLIBDIR}/version.h usability" >&5
-$as_echo_n "checking ${PWLIBDIR}/version.h usability... " >&6; }
-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 <${PWLIBDIR}/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ${PWLIBDIR}/version.h presence" >&5
-$as_echo_n "checking ${PWLIBDIR}/version.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${PWLIBDIR}/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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_cxx_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/version.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/version.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ${PWLIBDIR}/version.h" >&5
-$as_echo_n "checking for ${PWLIBDIR}/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   HAS_PWLIB=1
 fi
 
 if test "${HAS_PWLIB:-unset}" = "unset" ; then
   if test "${OPENH323DIR:-unset}" != "unset"; then
     as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/../pwlib/version.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for ${OPENH323DIR}/../pwlib/version.h" >&5
-$as_echo_n "checking for ${OPENH323DIR}/../pwlib/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ${OPENH323DIR}/../pwlib/version.h usability" >&5
-$as_echo_n "checking ${OPENH323DIR}/../pwlib/version.h usability... " >&6; }
-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 <${OPENH323DIR}/../pwlib/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ${OPENH323DIR}/../pwlib/version.h presence" >&5
-$as_echo_n "checking ${OPENH323DIR}/../pwlib/version.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${OPENH323DIR}/../pwlib/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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_cxx_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/../pwlib/version.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/../pwlib/version.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ${OPENH323DIR}/../pwlib/version.h" >&5
-$as_echo_n "checking for ${OPENH323DIR}/../pwlib/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/../pwlib/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   HAS_PWLIB=1
 fi
 
     PWLIBDIR="${OPENH323DIR}/../pwlib"
   else
     as_ac_Header=`$as_echo "ac_cv_header_${HOME}/pwlib/include/ptlib.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for ${HOME}/pwlib/include/ptlib.h" >&5
-$as_echo_n "checking for ${HOME}/pwlib/include/ptlib.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ${HOME}/pwlib/include/ptlib.h usability" >&5
-$as_echo_n "checking ${HOME}/pwlib/include/ptlib.h usability... " >&6; }
-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 <${HOME}/pwlib/include/ptlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ${HOME}/pwlib/include/ptlib.h presence" >&5
-$as_echo_n "checking ${HOME}/pwlib/include/ptlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${HOME}/pwlib/include/ptlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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_cxx_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${HOME}/pwlib/include/ptlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ${HOME}/pwlib/include/ptlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ${HOME}/pwlib/include/ptlib.h" >&5
-$as_echo_n "checking for ${HOME}/pwlib/include/ptlib.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+ac_fn_cxx_check_header_mongrel "$LINENO" "${HOME}/pwlib/include/ptlib.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   HAS_PWLIB=1
 fi
 
     if test "${HAS_PWLIB:-unset}" != "unset" ; then
       PWLIBDIR="${HOME}/pwlib"
     else
-      if test "${ac_cv_header__usr_local_include_ptlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for /usr/local/include/ptlib.h" >&5
-$as_echo_n "checking for /usr/local/include/ptlib.h... " >&6; }
-if test "${ac_cv_header__usr_local_include_ptlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header__usr_local_include_ptlib_h" >&5
-$as_echo "$ac_cv_header__usr_local_include_ptlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking /usr/local/include/ptlib.h usability" >&5
-$as_echo_n "checking /usr/local/include/ptlib.h usability... " >&6; }
-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 </usr/local/include/ptlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking /usr/local/include/ptlib.h presence" >&5
-$as_echo_n "checking /usr/local/include/ptlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include </usr/local/include/ptlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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_cxx_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/local/include/ptlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: /usr/local/include/ptlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for /usr/local/include/ptlib.h" >&5
-$as_echo_n "checking for /usr/local/include/ptlib.h... " >&6; }
-if test "${ac_cv_header__usr_local_include_ptlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header__usr_local_include_ptlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header__usr_local_include_ptlib_h" >&5
-$as_echo "$ac_cv_header__usr_local_include_ptlib_h" >&6; }
-
-fi
-if test "x$ac_cv_header__usr_local_include_ptlib_h" = x""yes; then
+      ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/local/include/ptlib.h" "ac_cv_header__usr_local_include_ptlib_h" "$ac_includes_default"
+if test "x$ac_cv_header__usr_local_include_ptlib_h" = xyes; then :
   HAS_PWLIB=1
 fi
 
@@ -46522,9 +24834,9 @@ fi
       if test "${HAS_PWLIB:-unset}" != "unset" ; then
         # Extract the first word of "ptlib-config", so it can be a program name with args.
 set dummy ptlib-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PTLIB_CONFIG+set}" = set; then
+if ${ac_cv_path_PTLIB_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PTLIB_CONFIG in
@@ -46537,14 +24849,14 @@ for as_dir in /usr/local/bin$PATH_SEPARATOR/usr/local/share/pwlib/make
 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_path_PTLIB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -46552,10 +24864,10 @@ esac
 fi
 PTLIB_CONFIG=$ac_cv_path_PTLIB_CONFIG
 if test -n "$PTLIB_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $PTLIB_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTLIB_CONFIG" >&5
 $as_echo "$PTLIB_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
         PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs`
         PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`"
       else
-        if test "${ac_cv_header__usr_include_ptlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for /usr/include/ptlib.h" >&5
-$as_echo_n "checking for /usr/include/ptlib.h... " >&6; }
-if test "${ac_cv_header__usr_include_ptlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header__usr_include_ptlib_h" >&5
-$as_echo "$ac_cv_header__usr_include_ptlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking /usr/include/ptlib.h usability" >&5
-$as_echo_n "checking /usr/include/ptlib.h usability... " >&6; }
-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 </usr/include/ptlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking /usr/include/ptlib.h presence" >&5
-$as_echo_n "checking /usr/include/ptlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include </usr/include/ptlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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_cxx_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: /usr/include/ptlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: /usr/include/ptlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for /usr/include/ptlib.h" >&5
-$as_echo_n "checking for /usr/include/ptlib.h... " >&6; }
-if test "${ac_cv_header__usr_include_ptlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header__usr_include_ptlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header__usr_include_ptlib_h" >&5
-$as_echo "$ac_cv_header__usr_include_ptlib_h" >&6; }
-
-fi
-if test "x$ac_cv_header__usr_include_ptlib_h" = x""yes; then
+        ac_fn_cxx_check_header_mongrel "$LINENO" "/usr/include/ptlib.h" "ac_cv_header__usr_include_ptlib_h" "$ac_includes_default"
+if test "x$ac_cv_header__usr_include_ptlib_h" = xyes; then :
   HAS_PWLIB=1
 fi
 
@@ -46715,9 +24896,9 @@ fi
         if test "${HAS_PWLIB:-unset}" != "unset" ; then
           # Extract the first word of "ptlib-config", so it can be a program name with args.
 set dummy ptlib-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PTLIB_CONFIG+set}" = set; then
+if ${ac_cv_path_PTLIB_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $PTLIB_CONFIG in
@@ -46730,14 +24911,14 @@ for as_dir in /usr/bin$PATH_SEPARATOR/usr/share/pwlib/make
 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_path_PTLIB_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -46745,10 +24926,10 @@ esac
 fi
 PTLIB_CONFIG=$ac_cv_path_PTLIB_CONFIG
 if test -n "$PTLIB_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $PTLIB_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PTLIB_CONFIG" >&5
 $as_echo "$PTLIB_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -46845,19 +25026,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
                        PWLIB_MAX=$((*10000+*100+))
                fi
 
-               { $as_echo "$as_me:$LINENO: checking if PWLib version ${PWLIB_VERSION} is compatible with chan_h323" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PWLib version ${PWLIB_VERSION} is compatible with chan_h323" >&5
 $as_echo_n "checking if PWLib version ${PWLIB_VERSION} is compatible with chan_h323... " >&6; }
                if test ${PWLIB_VER} -lt ${PWLIB_REQ}; then
-                       { $as_echo "$as_me:$LINENO: result: no" >&5
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                        unset HAS_PWLIB
                else
                        if test ${PWLIB_VER} -gt ${PWLIB_MAX}; then
-                               { $as_echo "$as_me:$LINENO: result: no" >&5
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                                unset HAS_PWLIB
                        else
-                               { $as_echo "$as_me:$LINENO: result: yes" >&5
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                        fi
                fi
@@ -46892,7 +25073,7 @@ case "$host_os" in
                           ENDLDLIBS="-lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32" ;
                ;;
   * )                 PWLIB_OSTYPE="$host_os" ;
-                          { $as_echo "$as_me:$LINENO: WARNING: \"OS $PWLIB_OSTYPE not recognized - proceed with caution!\"" >&5
+                          { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"OS $PWLIB_OSTYPE not recognized - proceed with caution!\"" >&5
 $as_echo "$as_me: WARNING: \"OS $PWLIB_OSTYPE not recognized - proceed with caution!\"" >&2;} ;
                ;;
 esac
@@ -46943,7 +25124,7 @@ case "$host_cpu" in
                   ;;
 
    * )            PWLIB_MACHTYPE="$host_cpu";
-                  { $as_echo "$as_me:$LINENO: WARNING: \"CPU $PWLIB_MACHTYPE not recognized - proceed with caution!\"" >&5
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"CPU $PWLIB_MACHTYPE not recognized - proceed with caution!\"" >&5
 $as_echo "$as_me: WARNING: \"CPU $PWLIB_MACHTYPE not recognized - proceed with caution!\"" >&2;} ;;
 esac
 
@@ -46956,7 +25137,7 @@ PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}"
 
 
        if test "${HAS_PWLIB:-unset}" != "unset"; then
-          { $as_echo "$as_me:$LINENO: checking PWLib installation validity" >&5
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking PWLib installation validity" >&5
 $as_echo_n "checking PWLib installation validity... " >&6; }
 
           saved_cppflags="${CPPFLAGS}"
@@ -46975,11 +25156,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
-          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 "ptlib.h"
 int
@@ -46990,45 +25167,20 @@ int q = (int) PTime::IsDaylightSavings();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_cxx_try_link "$LINENO"; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                        ac_cv_lib_PWLIB="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-               { $as_echo "$as_me:$LINENO: result: no" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                        ac_cv_lib_PWLIB="no"
 
 
 fi
-
-rm -rf conftest.dSYM
-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
 
           ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -47053,9 +25205,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
              fi
                  PBX_PWLIB=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PWLIB 1
-_ACEOF
+$as_echo "#define HAVE_PWLIB 1" >>confdefs.h
 
           fi
        fi
@@ -47069,300 +25219,26 @@ if test "${PBX_PWLIB}" = "1" -a "${USE_OPENH323}" != "no" ; then
        fi
 
 OPENH323_INCDIR=
-OPENH323_LIBDIR=
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-if test "${OPENH323DIR:-unset}" != "unset" ; then
-  as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/version.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for ${OPENH323DIR}/version.h" >&5
-$as_echo_n "checking for ${OPENH323DIR}/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ${OPENH323DIR}/version.h usability" >&5
-$as_echo_n "checking ${OPENH323DIR}/version.h usability... " >&6; }
-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 <${OPENH323DIR}/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ${OPENH323DIR}/version.h presence" >&5
-$as_echo_n "checking ${OPENH323DIR}/version.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${OPENH323DIR}/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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_cxx_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${OPENH323DIR}/version.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ${OPENH323DIR}/version.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ${OPENH323DIR}/version.h" >&5
-$as_echo_n "checking for ${OPENH323DIR}/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  HAS_OPENH323=1
-fi
-
-
-fi
-if test "${HAS_OPENH323:-unset}" = "unset" ; then
-  as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/../openh323/version.h" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for ${PWLIBDIR}/../openh323/version.h" >&5
-$as_echo_n "checking for ${PWLIBDIR}/../openh323/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ${PWLIBDIR}/../openh323/version.h usability" >&5
-$as_echo_n "checking ${PWLIBDIR}/../openh323/version.h usability... " >&6; }
-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 <${PWLIBDIR}/../openh323/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ${PWLIBDIR}/../openh323/version.h presence" >&5
-$as_echo_n "checking ${PWLIBDIR}/../openh323/version.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <${PWLIBDIR}/../openh323/version.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-        test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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_cxx_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ${PWLIBDIR}/../openh323/version.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ${PWLIBDIR}/../openh323/version.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ${PWLIBDIR}/../openh323/version.h" >&5
-$as_echo_n "checking for ${PWLIBDIR}/../openh323/version.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
+OPENH323_LIBDIR=
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+if test "${OPENH323DIR:-unset}" != "unset" ; then
+  as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/version.h" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "${OPENH323DIR}/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  HAS_OPENH323=1
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
+
 
 fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if test "${HAS_OPENH323:-unset}" = "unset" ; then
+  as_ac_Header=`$as_echo "ac_cv_header_${PWLIBDIR}/../openh323/version.h" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "${PWLIBDIR}/../openh323/version.h" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1
 fi
 
     saved_cppflags="${CPPFLAGS}"
     CPPFLAGS="${CPPFLAGS} -I${PWLIB_INCDIR}/openh323 -I${PWLIB_INCDIR}"
     as_ac_Header=`$as_echo "ac_cv_header_${OPENH323DIR}/include/h323.h" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${OPENH323DIR}/include/h323.h" >&5
-$as_echo_n "checking for ${OPENH323DIR}/include/h323.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; 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
-/* end confdefs.h.  */
-#include <ptlib.h>
-
-#include <${OPENH323DIR}/include/h323.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Header=no"
-fi
+ac_fn_cxx_check_header_compile "$LINENO" "${OPENH323DIR}/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  :
 else
   OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}"
 fi
     saved_cppflags="${CPPFLAGS}"
     CPPFLAGS="${CPPFLAGS} -I${HOME}/openh323/include -I${PWLIB_INCDIR}"
     as_ac_Header=`$as_echo "ac_cv_header_${HOME}/openh323/include/h323.h" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${HOME}/openh323/include/h323.h" >&5
-$as_echo_n "checking for ${HOME}/openh323/include/h323.h... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; 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
-/* end confdefs.h.  */
-#include <ptlib.h>
-
-#include <${HOME}/openh323/include/h323.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_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 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+ac_fn_cxx_check_header_compile "$LINENO" "${HOME}/openh323/include/h323.h" "$as_ac_Header" "#include <ptlib.h>
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   HAS_OPENH323=1
 fi
 
     else
       saved_cppflags="${CPPFLAGS}"
       CPPFLAGS="${CPPFLAGS} -I/usr/local/include/openh323 -I${PWLIB_INCDIR}"
-      { $as_echo "$as_me:$LINENO: checking for /usr/local/include/openh323/h323.h" >&5
-$as_echo_n "checking for /usr/local/include/openh323/h323.h... " >&6; }
-if test "${ac_cv_header__usr_local_include_openh323_h323_h+set}" = set; 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
-/* end confdefs.h.  */
-#include <ptlib.h>
-
-#include </usr/local/include/openh323/h323.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header__usr_local_include_openh323_h323_h=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header__usr_local_include_openh323_h323_h=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header__usr_local_include_openh323_h323_h" >&5
-$as_echo "$ac_cv_header__usr_local_include_openh323_h323_h" >&6; }
-if test "x$ac_cv_header__usr_local_include_openh323_h323_h" = x""yes; then
+      ac_fn_cxx_check_header_compile "$LINENO" "/usr/local/include/openh323/h323.h" "ac_cv_header__usr_local_include_openh323_h323_h" "#include <ptlib.h>
+"
+if test "x$ac_cv_header__usr_local_include_openh323_h323_h" = xyes; then :
   HAS_OPENH323=1
 fi
 
       else
         saved_cppflags="${CPPFLAGS}"
         CPPFLAGS="${CPPFLAGS} -I/usr/include/openh323 -I${PWLIB_INCDIR}"
-        { $as_echo "$as_me:$LINENO: checking for /usr/include/openh323/h323.h" >&5
-$as_echo_n "checking for /usr/include/openh323/h323.h... " >&6; }
-if test "${ac_cv_header__usr_include_openh323_h323_h+set}" = set; 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
-/* end confdefs.h.  */
-#include <ptlib.h>
-
-#include </usr/include/openh323/h323.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header__usr_include_openh323_h323_h=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header__usr_include_openh323_h323_h=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header__usr_include_openh323_h323_h" >&5
-$as_echo "$ac_cv_header__usr_include_openh323_h323_h" >&6; }
-if test "x$ac_cv_header__usr_include_openh323_h323_h" = x""yes; then
+        ac_fn_cxx_check_header_compile "$LINENO" "/usr/include/openh323/h323.h" "ac_cv_header__usr_include_openh323_h323_h" "#include <ptlib.h>
+"
+if test "x$ac_cv_header__usr_include_openh323_h323_h" = xyes; then :
   HAS_OPENH323=1
 fi
 
@@ -47663,19 +25359,19 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
                        OPENH323_MAX=$((1*10000+19*100+0))
                fi
 
-               { $as_echo "$as_me:$LINENO: checking if OpenH323 version ${OPENH323_VERSION} is compatible with chan_h323" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OpenH323 version ${OPENH323_VERSION} is compatible with chan_h323" >&5
 $as_echo_n "checking if OpenH323 version ${OPENH323_VERSION} is compatible with chan_h323... " >&6; }
                if test ${OPENH323_VER} -lt ${OPENH323_REQ}; then
-                       { $as_echo "$as_me:$LINENO: result: no" >&5
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                        unset HAS_OPENH323
                else
                        if test ${OPENH323_VER} -gt ${OPENH323_MAX}; then
-                               { $as_echo "$as_me:$LINENO: result: no" >&5
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                                unset HAS_OPENH323
                        else
-                               { $as_echo "$as_me:$LINENO: result: yes" >&5
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                        fi
                fi
@@ -47683,7 +25379,7 @@ $as_echo "yes" >&6; }
 
 
        if test "${HAS_OPENH323:-unset}" != "unset"; then
-               { $as_echo "$as_me:$LINENO: checking OpenH323 build option" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenH323 build option" >&5
 $as_echo_n "checking OpenH323 build option... " >&6; }
                OPENH323_SUFFIX=
                prefixes="h323_${PWLIB_PLATFORM}_ h323_ openh323"
@@ -47735,7 +25431,7 @@ $as_echo_n "checking OpenH323 build option... " >&6; }
                                fi
                                ;;
                esac
-               { $as_echo "$as_me:$LINENO: result: ${OPENH323_BUILD}" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENH323_BUILD}" >&5
 $as_echo "${OPENH323_BUILD}" >&6; }
 
 
@@ -47745,7 +25441,7 @@ $as_echo "${OPENH323_BUILD}" >&6; }
        PLATFORM_OPENH323="h323_${PWLIB_PLATFORM}_${OPENH323_SUFFIX}"
 
        if test "${HAS_OPENH323:-unset}" != "unset"; then
-          { $as_echo "$as_me:$LINENO: checking OpenH323 installation validity" >&5
+          { $as_echo "$as_me:${as_lineno-$LINENO}: checking OpenH323 installation validity" >&5
 $as_echo_n "checking OpenH323 installation validity... " >&6; }
 
           saved_cppflags="${CPPFLAGS}"
@@ -47764,11 +25460,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
-          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 "ptlib.h"
                #include "h323.h"
@@ -47781,45 +25473,20 @@ H323EndPoint ep = H323EndPoint();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_cxx_try_link "$LINENO"; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                        ac_cv_lib_OPENH323="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-               { $as_echo "$as_me:$LINENO: result: no" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                        ac_cv_lib_OPENH323="no"
 
 
 fi
-
-rm -rf conftest.dSYM
-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
 
           ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -47844,9 +25511,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
              fi
                  PBX_OPENH323=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_OPENH323 1
-_ACEOF
+$as_echo "#define HAVE_OPENH323 1" >>confdefs.h
 
           fi
        fi
@@ -47871,18 +25536,14 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_lua5.1_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -llua5.1" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua5.1" >&5
 $as_echo_n "checking for ${pbxfuncname} in -llua5.1... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-llua5.1 ${pbxlibdir} -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.
@@ -47900,47 +25561,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_LUA_FOUND=yes
 else
   AST_LUA_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
-         if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
-$as_echo_n "checking for lua5.1/lua.h... " >&6; }
-if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
-$as_echo "$ac_cv_header_lua5_1_lua_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking lua5.1/lua.h usability" >&5
-$as_echo_n "checking lua5.1/lua.h usability... " >&6; }
-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 <lua5.1/lua.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking lua5.1/lua.h presence" >&5
-$as_echo_n "checking lua5.1/lua.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <lua5.1/lua.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua5.1/lua.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua5.1/lua.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua5.1/lua.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: lua5.1/lua.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for lua5.1/lua.h" >&5
-$as_echo_n "checking for lua5.1/lua.h... " >&6; }
-if test "${ac_cv_header_lua5_1_lua_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_lua5_1_lua_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_lua5_1_lua_h" >&5
-$as_echo "$ac_cv_header_lua5_1_lua_h" >&6; }
-
-fi
-if test "x$ac_cv_header_lua5_1_lua_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "lua5.1/lua.h" "ac_cv_header_lua5_1_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua5_1_lua_h" = xyes; then :
   LUA_HEADER_FOUND=1
 else
   LUA_HEADER_FOUND=0
@@ -48147,18 +25649,14 @@ if test "x${PBX_LUA}" != "x1" -a "${USE_LUA}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_lua_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -llua" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -llua" >&5
 $as_echo_n "checking for ${pbxfuncname} in -llua... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-llua ${pbxlibdir} -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.
@@ -48176,47 +25674,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_LUA_FOUND=yes
 else
   AST_LUA_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${LUA_INCLUDE}"
-         if test "${ac_cv_header_lua_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for lua.h" >&5
-$as_echo_n "checking for lua.h... " >&6; }
-if test "${ac_cv_header_lua_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_lua_h" >&5
-$as_echo "$ac_cv_header_lua_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking lua.h usability" >&5
-$as_echo_n "checking lua.h usability... " >&6; }
-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 <lua.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking lua.h presence" >&5
-$as_echo_n "checking lua.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <lua.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: lua.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: lua.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: lua.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: lua.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: lua.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: lua.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: lua.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: lua.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: lua.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: lua.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: lua.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for lua.h" >&5
-$as_echo_n "checking for lua.h... " >&6; }
-if test "${ac_cv_header_lua_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_lua_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_lua_h" >&5
-$as_echo "$ac_cv_header_lua_h" >&6; }
-
-fi
-if test "x$ac_cv_header_lua_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "lua.h" "ac_cv_header_lua_h" "$ac_includes_default"
+if test "x$ac_cv_header_lua_h" = xyes; then :
   LUA_HEADER_FOUND=1
 else
   LUA_HEADER_FOUND=0
@@ -48415,18 +25754,14 @@ if test "x${PBX_RADIUS}" != "x1" -a "${USE_RADIUS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_radiusclient-ng_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lradiusclient-ng" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lradiusclient-ng" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lradiusclient-ng... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lradiusclient-ng ${pbxlibdir}  $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.
@@ -48444,47 +25779,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_RADIUS_FOUND=yes
 else
   AST_RADIUS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${RADIUS_INCLUDE}"
-         if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for radiusclient-ng.h" >&5
-$as_echo_n "checking for radiusclient-ng.h... " >&6; }
-if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_radiusclient_ng_h" >&5
-$as_echo "$ac_cv_header_radiusclient_ng_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking radiusclient-ng.h usability" >&5
-$as_echo_n "checking radiusclient-ng.h usability... " >&6; }
-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 <radiusclient-ng.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking radiusclient-ng.h presence" >&5
-$as_echo_n "checking radiusclient-ng.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <radiusclient-ng.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: radiusclient-ng.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: radiusclient-ng.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: radiusclient-ng.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for radiusclient-ng.h" >&5
-$as_echo_n "checking for radiusclient-ng.h... " >&6; }
-if test "${ac_cv_header_radiusclient_ng_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_radiusclient_ng_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_radiusclient_ng_h" >&5
-$as_echo "$ac_cv_header_radiusclient_ng_h" >&6; }
-
-fi
-if test "x$ac_cv_header_radiusclient_ng_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "radiusclient-ng.h" "ac_cv_header_radiusclient_ng_h" "$ac_includes_default"
+if test "x$ac_cv_header_radiusclient_ng_h" = xyes; then :
   RADIUS_HEADER_FOUND=1
 else
   RADIUS_HEADER_FOUND=0
@@ -48692,18 +25868,14 @@ if test "x${PBX_OPENAIS}" != "x1" -a "${USE_OPENAIS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_SaClm_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lSaClm" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lSaClm" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lSaClm... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lSaClm ${pbxlibdir} -L/usr/lib/openais -L/usr/lib64/openais $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.
@@ -48721,47 +25893,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_OPENAIS_FOUND=yes
 else
   AST_OPENAIS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OPENAIS_INCLUDE}"
-         if test "${ac_cv_header_openais_saClm_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for openais/saClm.h" >&5
-$as_echo_n "checking for openais/saClm.h... " >&6; }
-if test "${ac_cv_header_openais_saClm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openais_saClm_h" >&5
-$as_echo "$ac_cv_header_openais_saClm_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking openais/saClm.h usability" >&5
-$as_echo_n "checking openais/saClm.h usability... " >&6; }
-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 <openais/saClm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking openais/saClm.h presence" >&5
-$as_echo_n "checking openais/saClm.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <openais/saClm.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: openais/saClm.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openais/saClm.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: openais/saClm.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openais/saClm.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openais/saClm.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openais/saClm.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openais/saClm.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openais/saClm.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: openais/saClm.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for openais/saClm.h" >&5
-$as_echo_n "checking for openais/saClm.h... " >&6; }
-if test "${ac_cv_header_openais_saClm_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_openais_saClm_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openais_saClm_h" >&5
-$as_echo "$ac_cv_header_openais_saClm_h" >&6; }
-
-fi
-if test "x$ac_cv_header_openais_saClm_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "openais/saClm.h" "ac_cv_header_openais_saClm_h" "$ac_includes_default"
+if test "x$ac_cv_header_openais_saClm_h" = xyes; then :
   OPENAIS_HEADER_FOUND=1
 else
   OPENAIS_HEADER_FOUND=0
@@ -48975,18 +25988,14 @@ if test "x${PBX_SPEEX}" != "x1" -a "${USE_SPEEX}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspeex" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeex" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lspeex... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lspeex ${pbxlibdir} -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.
@@ -49004,47 +26013,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SPEEX_FOUND=yes
 else
   AST_SPEEX_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SPEEX_INCLUDE}"
-         if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-$as_echo_n "checking for speex/speex.h... " >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-$as_echo "$ac_cv_header_speex_speex_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking speex/speex.h usability" >&5
-$as_echo_n "checking speex/speex.h usability... " >&6; }
-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 <speex/speex.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking speex/speex.h presence" >&5
-$as_echo_n "checking speex/speex.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <speex/speex.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-$as_echo_n "checking for speex/speex.h... " >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_speex_speex_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-$as_echo "$ac_cv_header_speex_speex_h" >&6; }
-
-fi
-if test "x$ac_cv_header_speex_speex_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
   SPEEX_HEADER_FOUND=1
 else
   SPEEX_HEADER_FOUND=0
@@ -49244,18 +26094,14 @@ if test "x${PBX_SPEEX_PREPROCESS}" != "x1" -a "${USE_SPEEX_PREPROCESS}" != "no";
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_speex_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspeex" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeex" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lspeex... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lspeex ${pbxlibdir} -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.
@@ -49273,47 +26119,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+else
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SPEEX_PREPROCESS_FOUND=yes
 else
   AST_SPEEX_PREPROCESS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SPEEX_PREPROCESS_INCLUDE}"
-         if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-$as_echo_n "checking for speex/speex.h... " >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-$as_echo "$ac_cv_header_speex_speex_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking speex/speex.h usability" >&5
-$as_echo_n "checking speex/speex.h usability... " >&6; }
-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 <speex/speex.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking speex/speex.h presence" >&5
-$as_echo_n "checking speex/speex.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <speex/speex.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-$as_echo_n "checking for speex/speex.h... " >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_speex_speex_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-$as_echo "$ac_cv_header_speex_speex_h" >&6; }
-
-fi
-if test "x$ac_cv_header_speex_speex_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
   SPEEX_PREPROCESS_HEADER_FOUND=1
 else
   SPEEX_PREPROCESS_HEADER_FOUND=0
@@ -49515,18 +26202,14 @@ if test "x${PBX_SPEEXDSP}" != "x1" -a "${USE_SPEEXDSP}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_speexdsp_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lspeexdsp" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lspeexdsp" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lspeexdsp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lspeexdsp ${pbxlibdir} -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.
@@ -49544,47 +26227,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SPEEXDSP_FOUND=yes
 else
   AST_SPEEXDSP_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SPEEXDSP_INCLUDE}"
-         if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-$as_echo_n "checking for speex/speex.h... " >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-$as_echo "$ac_cv_header_speex_speex_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking speex/speex.h usability" >&5
-$as_echo_n "checking speex/speex.h usability... " >&6; }
-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 <speex/speex.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking speex/speex.h presence" >&5
-$as_echo_n "checking speex/speex.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <speex/speex.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: speex/speex.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: speex/speex.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: speex/speex.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for speex/speex.h" >&5
-$as_echo_n "checking for speex/speex.h... " >&6; }
-if test "${ac_cv_header_speex_speex_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_speex_speex_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_speex_speex_h" >&5
-$as_echo "$ac_cv_header_speex_speex_h" >&6; }
-
-fi
-if test "x$ac_cv_header_speex_speex_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "speex/speex.h" "ac_cv_header_speex_speex_h" "$ac_includes_default"
+if test "x$ac_cv_header_speex_speex_h" = xyes; then :
   SPEEXDSP_HEADER_FOUND=1
 else
   SPEEXDSP_HEADER_FOUND=0
@@ -49788,18 +26312,14 @@ if test "x${PBX_SQLITE}" != "x1" -a "${USE_SQLITE}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_sqlite_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lsqlite" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lsqlite... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsqlite ${pbxlibdir}  $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.
@@ -49817,47 +26337,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SQLITE_FOUND=yes
 else
   AST_SQLITE_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SQLITE_INCLUDE}"
-         if test "${ac_cv_header_sqlite_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sqlite.h" >&5
-$as_echo_n "checking for sqlite.h... " >&6; }
-if test "${ac_cv_header_sqlite_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sqlite_h" >&5
-$as_echo "$ac_cv_header_sqlite_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sqlite.h usability" >&5
-$as_echo_n "checking sqlite.h usability... " >&6; }
-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 <sqlite.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sqlite.h presence" >&5
-$as_echo_n "checking sqlite.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sqlite.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sqlite.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sqlite.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sqlite.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sqlite.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sqlite.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sqlite.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sqlite.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sqlite.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sqlite.h" >&5
-$as_echo_n "checking for sqlite.h... " >&6; }
-if test "${ac_cv_header_sqlite_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sqlite_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sqlite_h" >&5
-$as_echo "$ac_cv_header_sqlite_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sqlite_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sqlite.h" "ac_cv_header_sqlite_h" "$ac_includes_default"
+if test "x$ac_cv_header_sqlite_h" = xyes; then :
   SQLITE_HEADER_FOUND=1
 else
   SQLITE_HEADER_FOUND=0
@@ -50056,18 +26417,14 @@ if test "x${PBX_SQLITE3}" != "x1" -a "${USE_SQLITE3}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
       as_ac_Lib=`$as_echo "ac_cv_lib_sqlite3_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lsqlite3" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsqlite3" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lsqlite3... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsqlite3 ${pbxlibdir} ${PTHREAD_LIBS} $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.
@@ -50085,47 +26442,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SQLITE3_FOUND=yes
 else
   AST_SQLITE3_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SQLITE3_INCLUDE}"
-         if test "${ac_cv_header_sqlite3_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sqlite3.h" >&5
-$as_echo_n "checking for sqlite3.h... " >&6; }
-if test "${ac_cv_header_sqlite3_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5
-$as_echo "$ac_cv_header_sqlite3_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sqlite3.h usability" >&5
-$as_echo_n "checking sqlite3.h usability... " >&6; }
-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 <sqlite3.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sqlite3.h presence" >&5
-$as_echo_n "checking sqlite3.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sqlite3.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sqlite3.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sqlite3.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite3.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sqlite3.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite3.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sqlite3.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite3.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sqlite3.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite3.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sqlite3.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sqlite3.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sqlite3.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sqlite3.h" >&5
-$as_echo_n "checking for sqlite3.h... " >&6; }
-if test "${ac_cv_header_sqlite3_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sqlite3_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sqlite3_h" >&5
-$as_echo "$ac_cv_header_sqlite3_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sqlite3_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
+if test "x$ac_cv_header_sqlite3_h" = xyes; then :
   SQLITE3_HEADER_FOUND=1
 else
   SQLITE3_HEADER_FOUND=0
@@ -50307,9 +26505,9 @@ fi
 
 
 if test "${PBX_SQLITE3}" != 1; then
-       { $as_echo "$as_me:$LINENO: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database." >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database." >&5
 $as_echo "$as_me: WARNING: *** Asterisk now uses SQLite3 for the internal Asterisk database." >&2;}
-       { $as_echo "$as_me:$LINENO: WARNING: *** Please install the SQLite3 development package." >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Please install the SQLite3 development package." >&5
 $as_echo "$as_me: WARNING: *** Please install the SQLite3 development package." >&2;}
        exit 1
 fi
@@ -50332,18 +26530,14 @@ if test "x${PBX_CRYPTO}" != "x1" -a "${USE_CRYPTO}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_crypto_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lcrypto" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lcrypto" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lcrypto... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcrypto ${pbxlibdir}  $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.
@@ -50361,47 +26555,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_CRYPTO_FOUND=yes
 else
   AST_CRYPTO_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${CRYPTO_INCLUDE}"
-         if test "${ac_cv_header_openssl_aes_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for openssl/aes.h" >&5
-$as_echo_n "checking for openssl/aes.h... " >&6; }
-if test "${ac_cv_header_openssl_aes_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openssl_aes_h" >&5
-$as_echo "$ac_cv_header_openssl_aes_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking openssl/aes.h usability" >&5
-$as_echo_n "checking openssl/aes.h usability... " >&6; }
-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 <openssl/aes.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking openssl/aes.h presence" >&5
-$as_echo_n "checking openssl/aes.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <openssl/aes.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: openssl/aes.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/aes.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/aes.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/aes.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/aes.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/aes.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/aes.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/aes.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: openssl/aes.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for openssl/aes.h" >&5
-$as_echo_n "checking for openssl/aes.h... " >&6; }
-if test "${ac_cv_header_openssl_aes_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_openssl_aes_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openssl_aes_h" >&5
-$as_echo "$ac_cv_header_openssl_aes_h" >&6; }
-
-fi
-if test "x$ac_cv_header_openssl_aes_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "openssl/aes.h" "ac_cv_header_openssl_aes_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_aes_h" = xyes; then :
   CRYPTO_HEADER_FOUND=1
 else
   CRYPTO_HEADER_FOUND=0
@@ -50602,18 +26637,14 @@ if test "x${PBX_OPENSSL}" != "x1" -a "${USE_OPENSSL}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_ssl_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lssl" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lssl" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lssl... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lssl ${pbxlibdir} -lcrypto $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.
@@ -50631,47 +26662,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_OPENSSL_FOUND=yes
 else
   AST_OPENSSL_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${OPENSSL_INCLUDE}"
-         if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
-$as_echo_n "checking for openssl/ssl.h... " >&6; }
-if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
-$as_echo "$ac_cv_header_openssl_ssl_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking openssl/ssl.h usability" >&5
-$as_echo_n "checking openssl/ssl.h usability... " >&6; }
-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 <openssl/ssl.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking openssl/ssl.h presence" >&5
-$as_echo_n "checking openssl/ssl.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <openssl/ssl.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/ssl.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/ssl.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/ssl.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: openssl/ssl.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: openssl/ssl.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
-$as_echo_n "checking for openssl/ssl.h... " >&6; }
-if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_openssl_ssl_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
-$as_echo "$ac_cv_header_openssl_ssl_h" >&6; }
-
-fi
-if test "x$ac_cv_header_openssl_ssl_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default"
+if test "x$ac_cv_header_openssl_ssl_h" = xyes; then :
   OPENSSL_HEADER_FOUND=1
 else
   OPENSSL_HEADER_FOUND=0
@@ -50870,139 +26742,8 @@ then
                # check for the header
                osptk_saved_cppflags="${CPPFLAGS}"
                CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
-               if test "${ac_cv_header_osp_osp_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for osp/osp.h" >&5
-$as_echo_n "checking for osp/osp.h... " >&6; }
-if test "${ac_cv_header_osp_osp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_osp_osp_h" >&5
-$as_echo "$ac_cv_header_osp_osp_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking osp/osp.h usability" >&5
-$as_echo_n "checking osp/osp.h usability... " >&6; }
-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 <osp/osp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking osp/osp.h presence" >&5
-$as_echo_n "checking osp/osp.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <osp/osp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: osp/osp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: osp/osp.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: osp/osp.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: osp/osp.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: osp/osp.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: osp/osp.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: osp/osp.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: osp/osp.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: osp/osp.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: osp/osp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: osp/osp.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: osp/osp.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: osp/osp.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: osp/osp.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for osp/osp.h" >&5
-$as_echo_n "checking for osp/osp.h... " >&6; }
-if test "${ac_cv_header_osp_osp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_osp_osp_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_osp_osp_h" >&5
-$as_echo "$ac_cv_header_osp_osp_h" >&6; }
-
-fi
-if test "x$ac_cv_header_osp_osp_h" = x""yes; then
+               ac_fn_c_check_header_mongrel "$LINENO" "osp/osp.h" "ac_cv_header_osp_osp_h" "$ac_includes_default"
+if test "x$ac_cv_header_osp_osp_h" = xyes; then :
   osptk_header_found=yes
 else
   osptk_header_found=no
                if test "${osptk_header_found}" = "yes"; then
                        osptk_extralibs="-lssl -lcrypto"
 
-                       { $as_echo "$as_me:$LINENO: checking for OSPPInit in -losptk" >&5
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OSPPInit in -losptk" >&5
 $as_echo_n "checking for OSPPInit in -losptk... " >&6; }
-if test "${ac_cv_lib_osptk_OSPPInit+set}" = set; then
+if ${ac_cv_lib_osptk_OSPPInit+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-losptk ${osptk_ldflags} ${osptk_extralibs} $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.
@@ -51044,43 +26781,18 @@ return OSPPInit ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_osptk_OSPPInit=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_osptk_OSPPInit=no
+else
+  ac_cv_lib_osptk_OSPPInit=no
 fi
-
-rm -rf conftest.dSYM
-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
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_osptk_OSPPInit" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_osptk_OSPPInit" >&5
 $as_echo "$ac_cv_lib_osptk_OSPPInit" >&6; }
-if test "x$ac_cv_lib_osptk_OSPPInit" = x""yes; then
+if test "x$ac_cv_lib_osptk_OSPPInit" = xyes; then :
   osptk_library_found=yes
 else
   osptk_library_found=no
 
                        # check OSP Toolkit version
                        if test "${osptk_library_found}" = "yes"; then
-                               { $as_echo "$as_me:$LINENO: checking if OSP Toolkit version is compatible with app_osplookup" >&5
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if OSP Toolkit version is compatible with app_osplookup" >&5
 $as_echo_n "checking if OSP Toolkit version is compatible with app_osplookup... " >&6; }
 
                                osptk_saved_cppflags="${CPPFLAGS}"
                                CPPFLAGS="${CPPFLAGS} ${osptk_cflags}"
-                               if test "$cross_compiling" = yes; then
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+                               if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run test program while cross compiling
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
 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 <osp/osp.h>
@@ -51118,47 +26823,20 @@ cat >>conftest.$ac_ext <<_ACEOF
                                                }
 
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
   osptk_compatible=yes
 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
-
-( exit $ac_status )
-osptk_compatible=no
+  osptk_compatible=no
 
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
                                CPPFLAGS="${osptk_saved_cppflags}"
 
                                if test "${osptk_compatible}" = "yes"; then
-                                       { $as_echo "$as_me:$LINENO: result: yes" >&5
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                                        PBX_OSPTK=1
                                        OSPTK_INCLUDE="${osptk_cflags}"
@@ -51169,7 +26847,7 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
                                else
-                                       { $as_echo "$as_me:$LINENO: result: no" >&5
+                                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                                fi
                        fi
@@ -51196,18 +26874,14 @@ if test "x${PBX_SRTP}" != "x1" -a "${USE_SRTP}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_srtp_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lsrtp" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsrtp" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lsrtp... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsrtp ${pbxlibdir}  $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.
@@ -51225,47 +26899,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SRTP_FOUND=yes
 else
   AST_SRTP_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SRTP_INCLUDE}"
-         if test "${ac_cv_header_srtp_srtp_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for srtp/srtp.h" >&5
-$as_echo_n "checking for srtp/srtp.h... " >&6; }
-if test "${ac_cv_header_srtp_srtp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_srtp_srtp_h" >&5
-$as_echo "$ac_cv_header_srtp_srtp_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking srtp/srtp.h usability" >&5
-$as_echo_n "checking srtp/srtp.h usability... " >&6; }
-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 <srtp/srtp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking srtp/srtp.h presence" >&5
-$as_echo_n "checking srtp/srtp.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <srtp/srtp.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: srtp/srtp.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: srtp/srtp.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: srtp/srtp.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: srtp/srtp.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: srtp/srtp.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: srtp/srtp.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: srtp/srtp.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: srtp/srtp.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: srtp/srtp.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for srtp/srtp.h" >&5
-$as_echo_n "checking for srtp/srtp.h... " >&6; }
-if test "${ac_cv_header_srtp_srtp_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_srtp_srtp_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_srtp_srtp_h" >&5
-$as_echo "$ac_cv_header_srtp_srtp_h" >&6; }
-
-fi
-if test "x$ac_cv_header_srtp_srtp_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "srtp/srtp.h" "ac_cv_header_srtp_srtp_h" "$ac_includes_default"
+if test "x$ac_cv_header_srtp_srtp_h" = xyes; then :
   SRTP_HEADER_FOUND=1
 else
   SRTP_HEADER_FOUND=0
@@ -51454,16 +26969,12 @@ then
     LIBS="${LIBS} ${SRTP_LIB}"
     LDFLAGS="${LDFLAGS} -shared -fPIC"
     CFLAGS="${CFLAGS} ${SRTP_INCLUDE}"
-    { $as_echo "$as_me:$LINENO: checking for the ability of -lsrtp to be linked in a shared object" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the ability of -lsrtp to be linked in a shared object" >&5
 $as_echo_n "checking for the ability of -lsrtp to be linked in a shared object... " >&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.  */
-#include <srtp/srtp.h>
+
+        #include <srtp/srtp.h>
 int
 main ()
 {
@@ -51474,64 +26985,39 @@ srtp_init();
 }
 
 _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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-   { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_link "$LINENO"; then :
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
 
-        { $as_echo "$as_me:$LINENO: result: no" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-        { $as_echo "$as_me:$LINENO: WARNING: ***" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ***" >&5
 $as_echo "$as_me: WARNING: ***" >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** libsrtp could not be linked as a shared object." >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** libsrtp could not be linked as a shared object." >&5
 $as_echo "$as_me: WARNING: *** libsrtp could not be linked as a shared object." >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** Try compiling libsrtp manually. Configure libsrtp" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Try compiling libsrtp manually. Configure libsrtp" >&5
 $as_echo "$as_me: WARNING: *** Try compiling libsrtp manually. Configure libsrtp" >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** with ./configure CFLAGS=-fPIC --prefix=/usr" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** with ./configure CFLAGS=-fPIC --prefix=/usr" >&5
 $as_echo "$as_me: WARNING: *** with ./configure CFLAGS=-fPIC --prefix=/usr" >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** replacing /usr with the prefix of your choice." >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** replacing /usr with the prefix of your choice." >&5
 $as_echo "$as_me: WARNING: *** replacing /usr with the prefix of your choice." >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** After re-installing libsrtp" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** After re-installing libsrtp" >&5
 $as_echo "$as_me: WARNING: *** After re-installing libsrtp" >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** configure script." >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** configure script." >&5
 $as_echo "$as_me: WARNING: *** configure script." >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: ***" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ***" >&5
 $as_echo "$as_me: WARNING: ***" >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** If you do not need SRTP support re-run configure" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** If you do not need SRTP support re-run configure" >&5
 $as_echo "$as_me: WARNING: *** If you do not need SRTP support re-run configure" >&2;}
-        { $as_echo "$as_me:$LINENO: WARNING: *** with the --without-srtp option." >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** with the --without-srtp option." >&5
 $as_echo "$as_me: WARNING: *** with the --without-srtp option." >&2;}
         exit 1
 
 
 fi
-
-rm -rf conftest.dSYM
-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="${saved_libs}"
     LDFLAGS="${saved_ldflags}"
     CFLAGS="${saved_cflags}"
@@ -51543,9 +27029,9 @@ fi
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gmime-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gmime-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_GMIME+set}" = set; then
+if ${ac_cv_path_CONFIG_GMIME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CONFIG_GMIME in
@@ -51559,14 +27045,14 @@ for as_dir in $as_dummy
 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_path_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -51574,10 +27060,10 @@ esac
 fi
 CONFIG_GMIME=$ac_cv_path_CONFIG_GMIME
 if test -n "$CONFIG_GMIME"; then
-  { $as_echo "$as_me:$LINENO: result: $CONFIG_GMIME" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_GMIME" >&5
 $as_echo "$CONFIG_GMIME" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -51587,9 +27073,9 @@ if test -z "$ac_cv_path_CONFIG_GMIME"; then
   ac_pt_CONFIG_GMIME=$CONFIG_GMIME
   # Extract the first word of "gmime-config", so it can be a program name with args.
 set dummy gmime-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_GMIME+set}" = set; then
+if ${ac_cv_path_ac_pt_CONFIG_GMIME+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_CONFIG_GMIME in
@@ -51603,14 +27089,14 @@ for as_dir in $as_dummy
 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_path_ac_pt_CONFIG_GMIME="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -51618,10 +27104,10 @@ esac
 fi
 ac_pt_CONFIG_GMIME=$ac_cv_path_ac_pt_CONFIG_GMIME
 if test -n "$ac_pt_CONFIG_GMIME"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_CONFIG_GMIME" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_GMIME" >&5
 $as_echo "$ac_pt_CONFIG_GMIME" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -51630,7 +27116,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
                saved_libs="${LIBS}"
                LIBS="${GMIME_LIB}"
 
-               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 <gmime/gmime.h>
 #include <gmime/gmime.h>
 int
 main ()
 {
@@ -51671,53 +27153,21 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
      PBX_GMIME=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GMIME 1
-_ACEOF
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_GMIME 1" >>confdefs.h
 
 
 fi
-
-rm -rf conftest.dSYM
-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
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
            else
                PBX_GMIME=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GMIME 1
-_ACEOF
+$as_echo "#define HAVE_GMIME 1" >>confdefs.h
 
            fi
        fi
@@ -51734,9 +27184,7 @@ if test "x${PBX_GMIME}" = "x0" -a "${PKGCONFIG}" != "No"; then
                GMIME_LIB=$(${PKGCONFIG} gmime-$ver --libs)
                PBX_GMIME=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GMIME 1
-_ACEOF
+$as_echo "#define HAVE_GMIME 1" >>confdefs.h
 
                break;
        done
@@ -51760,18 +27208,14 @@ if test "x${PBX_HOARD}" != "x1" -a "${USE_HOARD}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_hoard_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lhoard" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lhoard" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lhoard... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lhoard ${pbxlibdir}  $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.
@@ -51789,47 +27233,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_HOARD_FOUND=yes
 else
   AST_HOARD_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${HOARD_INCLUDE}"
-         if test "${ac_cv_header_+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking  usability" >&5
-$as_echo_n "checking  usability... " >&6; }
-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 <>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking  presence" >&5
-$as_echo_n "checking  presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: : accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: : present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: : present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: :     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: : see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: :     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: :     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: : proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: : in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: : in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for " >&5
-$as_echo_n "checking for ... " >&6; }
-if test "${ac_cv_header_+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_" >&5
-$as_echo "$ac_cv_header_" >&6; }
-
-fi
-if test "x$ac_cv_header_" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "" "ac_cv_header_" "$ac_includes_default"
+if test "x$ac_cv_header_" = xyes; then :
   HOARD_HEADER_FOUND=1
 else
   HOARD_HEADER_FOUND=0
@@ -52028,18 +27313,14 @@ if test "x${PBX_FREETDS}" != "x1" -a "${USE_FREETDS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_sybdb_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lsybdb" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lsybdb" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lsybdb... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsybdb ${pbxlibdir}  $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.
@@ -52057,47 +27338,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_FREETDS_FOUND=yes
 else
   AST_FREETDS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${FREETDS_INCLUDE}"
-         if test "${ac_cv_header_sybdb_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for sybdb.h" >&5
-$as_echo_n "checking for sybdb.h... " >&6; }
-if test "${ac_cv_header_sybdb_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sybdb_h" >&5
-$as_echo "$ac_cv_header_sybdb_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking sybdb.h usability" >&5
-$as_echo_n "checking sybdb.h usability... " >&6; }
-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 <sybdb.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking sybdb.h presence" >&5
-$as_echo_n "checking sybdb.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sybdb.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: sybdb.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: sybdb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sybdb.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: sybdb.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: sybdb.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: sybdb.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sybdb.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: sybdb.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sybdb.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: sybdb.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sybdb.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: sybdb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sybdb.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: sybdb.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: sybdb.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: sybdb.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for sybdb.h" >&5
-$as_echo_n "checking for sybdb.h... " >&6; }
-if test "${ac_cv_header_sybdb_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_sybdb_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sybdb_h" >&5
-$as_echo "$ac_cv_header_sybdb_h" >&6; }
-
-fi
-if test "x$ac_cv_header_sybdb_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "sybdb.h" "ac_cv_header_sybdb_h" "$ac_includes_default"
+if test "x$ac_cv_header_sybdb_h" = xyes; then :
   FREETDS_HEADER_FOUND=1
 else
   FREETDS_HEADER_FOUND=0
          FREETDS_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            FREETDS_LIB=""
-         fi
-         PBX_FREETDS=1
-         cat >>confdefs.h <<_ACEOF
-#define HAVE_FREETDS 1
-_ACEOF
-
-      fi
-   fi
-fi
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for tone_zone_find_by_num in -ltonezone" >&5
-$as_echo_n "checking for tone_zone_find_by_num in -ltonezone... " >&6; }
-if test "${ac_cv_lib_tonezone_tone_zone_find_by_num+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltonezone  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char tone_zone_find_by_num ();
-int
-main ()
-{
-return tone_zone_find_by_num ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_tonezone_tone_zone_find_by_num=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_lib_tonezone_tone_zone_find_by_num=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_tonezone_tone_zone_find_by_num" >&5
-$as_echo "$ac_cv_lib_tonezone_tone_zone_find_by_num" >&6; }
-if test "x$ac_cv_lib_tonezone_tone_zone_find_by_num" = x""yes; then
-  tonezone_does_not_need_lm=yes
-else
-  tonezone_does_not_need_lm=no
-fi
-
-
-if test "${tonezone_does_not_need_lm}" = "no" ; then
-  tonezone_extra="-lm"
-fi
-
-
-if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
-   pbxlibdir=""
-   # if --with-TONEZONE=DIR has been specified, use it.
-   if test "x${TONEZONE_DIR}" != "x"; then
-      if test -d ${TONEZONE_DIR}/lib; then
-        pbxlibdir="-L${TONEZONE_DIR}/lib"
-      else
-        pbxlibdir="-L${TONEZONE_DIR}"
-      fi
-   fi
-   pbxfuncname="tone_zone_find"
-   if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_TONEZONE_FOUND=yes
-   else
-      ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
-      CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_tonezone_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -ltonezone" >&5
-$as_echo_n "checking for ${pbxfuncname} in -ltonezone... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltonezone ${pbxlibdir} ${tonezone_extra} ${DAHDI_INCLUDE} $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char ${pbxfuncname} ();
-int
-main ()
-{
-return ${pbxfuncname} ();
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_Lib=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_TONEZONE_FOUND=yes
-else
-  AST_TONEZONE_FOUND=no
-fi
-
-      CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
-   fi
-
-   # now check for the header.
-   if test "${AST_TONEZONE_FOUND}" = "yes"; then
-      TONEZONE_LIB="${pbxlibdir} -ltonezone ${tonezone_extra} ${DAHDI_INCLUDE}"
-      # if --with-TONEZONE=DIR has been specified, use it.
-      if test "x${TONEZONE_DIR}" != "x"; then
-         TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
-      fi
-      TONEZONE_INCLUDE="${TONEZONE_INCLUDE} "
-      if test "xdahdi/tonezone.h" = "x" ; then # no header, assume found
-         TONEZONE_HEADER_FOUND="1"
-      else                             # check for the header
-         ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE}"
-         if test "${ac_cv_header_dahdi_tonezone_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for dahdi/tonezone.h" >&5
-$as_echo_n "checking for dahdi/tonezone.h... " >&6; }
-if test "${ac_cv_header_dahdi_tonezone_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_dahdi_tonezone_h" >&5
-$as_echo "$ac_cv_header_dahdi_tonezone_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking dahdi/tonezone.h usability" >&5
-$as_echo_n "checking dahdi/tonezone.h usability... " >&6; }
-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 <dahdi/tonezone.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking dahdi/tonezone.h presence" >&5
-$as_echo_n "checking dahdi/tonezone.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <dahdi/tonezone.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: dahdi/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: dahdi/tonezone.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: dahdi/tonezone.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: dahdi/tonezone.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: dahdi/tonezone.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: dahdi/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: dahdi/tonezone.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: dahdi/tonezone.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: dahdi/tonezone.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for dahdi/tonezone.h" >&5
-$as_echo_n "checking for dahdi/tonezone.h... " >&6; }
-if test "${ac_cv_header_dahdi_tonezone_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_dahdi_tonezone_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_dahdi_tonezone_h" >&5
-$as_echo "$ac_cv_header_dahdi_tonezone_h" >&6; }
-
-fi
-if test "x$ac_cv_header_dahdi_tonezone_h" = x""yes; then
-  TONEZONE_HEADER_FOUND=1
-else
-  TONEZONE_HEADER_FOUND=0
-fi
-
-
-         CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
-      fi
-      if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
-         TONEZONE_LIB=""
-         TONEZONE_INCLUDE=""
-      else
-         if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            TONEZONE_LIB=""
+            FREETDS_LIB=""
          fi
-         PBX_TONEZONE=1
+         PBX_FREETDS=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_TONEZONE 1
+#define HAVE_FREETDS 1
 _ACEOF
 
       fi
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tone_zone_find_by_num in -ltonezone" >&5
+$as_echo_n "checking for tone_zone_find_by_num in -ltonezone... " >&6; }
+if ${ac_cv_lib_tonezone_tone_zone_find_by_num+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltonezone  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char tone_zone_find_by_num ();
+int
+main ()
+{
+return tone_zone_find_by_num ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tonezone_tone_zone_find_by_num=yes
+else
+  ac_cv_lib_tonezone_tone_zone_find_by_num=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_tonezone_tone_zone_find_by_num" >&5
+$as_echo "$ac_cv_lib_tonezone_tone_zone_find_by_num" >&6; }
+if test "x$ac_cv_lib_tonezone_tone_zone_find_by_num" = xyes; then :
+  tonezone_does_not_need_lm=yes
+else
+  tonezone_does_not_need_lm=no
+fi
+
+
+if test "${tonezone_does_not_need_lm}" = "no" ; then
+  tonezone_extra="-lm"
+fi
+
 
-if test "x${PBX_USB}" != "x1" -a "${USE_USB}" != "no"; then
+if test "x${PBX_TONEZONE}" != "x1" -a "${USE_TONEZONE}" != "no"; then
    pbxlibdir=""
-   # if --with-USB=DIR has been specified, use it.
-   if test "x${USB_DIR}" != "x"; then
-      if test -d ${USB_DIR}/lib; then
-        pbxlibdir="-L${USB_DIR}/lib"
+   # if --with-TONEZONE=DIR has been specified, use it.
+   if test "x${TONEZONE_DIR}" != "x"; then
+      if test -d ${TONEZONE_DIR}/lib; then
+        pbxlibdir="-L${TONEZONE_DIR}/lib"
       else
-        pbxlibdir="-L${USB_DIR}"
+        pbxlibdir="-L${TONEZONE_DIR}"
       fi
    fi
-   pbxfuncname="usb_init"
+   pbxfuncname="tone_zone_find"
    if test "x${pbxfuncname}" = "x" ; then   # empty lib, assume only headers
-      AST_USB_FOUND=yes
+      AST_TONEZONE_FOUND=yes
    else
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
-      as_ac_Lib=`$as_echo "ac_cv_lib_usb_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lusb" >&5
-$as_echo_n "checking for ${pbxfuncname} in -lusb... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+      as_ac_Lib=`$as_echo "ac_cv_lib_tonezone_${pbxfuncname}" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -ltonezone" >&5
+$as_echo_n "checking for ${pbxfuncname} in -ltonezone... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lusb ${pbxlibdir}  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+LIBS="-ltonezone ${pbxlibdir} ${tonezone_extra} ${DAHDI_INCLUDE} $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -52669,219 +27490,60 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  AST_USB_FOUND=yes
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  AST_TONEZONE_FOUND=yes
 else
-  AST_USB_FOUND=no
+  AST_TONEZONE_FOUND=no
 fi
 
       CFLAGS="${ast_ext_lib_check_save_CFLAGS}"
    fi
 
    # now check for the header.
-   if test "${AST_USB_FOUND}" = "yes"; then
-      USB_LIB="${pbxlibdir} -lusb "
-      # if --with-USB=DIR has been specified, use it.
-      if test "x${USB_DIR}" != "x"; then
-         USB_INCLUDE="-I${USB_DIR}/include"
-      fi
-      USB_INCLUDE="${USB_INCLUDE} "
-      if test "xusb.h" = "x" ; then    # no header, assume found
-         USB_HEADER_FOUND="1"
+   if test "${AST_TONEZONE_FOUND}" = "yes"; then
+      TONEZONE_LIB="${pbxlibdir} -ltonezone ${tonezone_extra} ${DAHDI_INCLUDE}"
+      # if --with-TONEZONE=DIR has been specified, use it.
+      if test "x${TONEZONE_DIR}" != "x"; then
+         TONEZONE_INCLUDE="-I${TONEZONE_DIR}/include"
+      fi
+      TONEZONE_INCLUDE="${TONEZONE_INCLUDE} "
+      if test "xdahdi/tonezone.h" = "x" ; then # no header, assume found
+         TONEZONE_HEADER_FOUND="1"
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
-         CPPFLAGS="${CPPFLAGS} ${USB_INCLUDE}"
-         if test "${ac_cv_header_usb_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for usb.h" >&5
-$as_echo_n "checking for usb.h... " >&6; }
-if test "${ac_cv_header_usb_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5
-$as_echo "$ac_cv_header_usb_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking usb.h usability" >&5
-$as_echo_n "checking usb.h usability... " >&6; }
-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 <usb.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking usb.h presence" >&5
-$as_echo_n "checking usb.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <usb.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: usb.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: usb.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: usb.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: usb.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: usb.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: usb.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: usb.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: usb.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: usb.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: usb.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: usb.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: usb.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: usb.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: usb.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for usb.h" >&5
-$as_echo_n "checking for usb.h... " >&6; }
-if test "${ac_cv_header_usb_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_usb_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_usb_h" >&5
-$as_echo "$ac_cv_header_usb_h" >&6; }
-
-fi
-if test "x$ac_cv_header_usb_h" = x""yes; then
-  USB_HEADER_FOUND=1
+         CPPFLAGS="${CPPFLAGS} ${TONEZONE_INCLUDE}"
+         ac_fn_c_check_header_mongrel "$LINENO" "dahdi/tonezone.h" "ac_cv_header_dahdi_tonezone_h" "$ac_includes_default"
+if test "x$ac_cv_header_dahdi_tonezone_h" = xyes; then :
+  TONEZONE_HEADER_FOUND=1
 else
-  USB_HEADER_FOUND=0
+  TONEZONE_HEADER_FOUND=0
 fi
 
 
          CPPFLAGS="${ast_ext_lib_check_saved_CPPFLAGS}"
       fi
-      if test "x${USB_HEADER_FOUND}" = "x0" ; then
-         USB_LIB=""
-         USB_INCLUDE=""
+      if test "x${TONEZONE_HEADER_FOUND}" = "x0" ; then
+         TONEZONE_LIB=""
+         TONEZONE_INCLUDE=""
       else
          if test "x${pbxfuncname}" = "x" ; then                # only checking headers -> no library
-            USB_LIB=""
+            TONEZONE_LIB=""
          fi
-         PBX_USB=1
+         PBX_TONEZONE=1
          cat >>confdefs.h <<_ACEOF
-#define HAVE_USB 1
+#define HAVE_TONEZONE 1
 _ACEOF
 
       fi
@@ -52910,18 +27572,14 @@ if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_vorbis_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lvorbis" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lvorbis" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lvorbis... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lvorbis ${pbxlibdir} -lm -lvorbisenc -lvorbisfile -logg $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.
@@ -52939,47 +27597,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_VORBIS_FOUND=yes
 else
   AST_VORBIS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${VORBIS_INCLUDE}"
-         if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
-$as_echo_n "checking for vorbis/codec.h... " >&6; }
-if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
-$as_echo "$ac_cv_header_vorbis_codec_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking vorbis/codec.h usability" >&5
-$as_echo_n "checking vorbis/codec.h usability... " >&6; }
-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 <vorbis/codec.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking vorbis/codec.h presence" >&5
-$as_echo_n "checking vorbis/codec.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <vorbis/codec.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
-$as_echo_n "checking for vorbis/codec.h... " >&6; }
-if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_vorbis_codec_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
-$as_echo "$ac_cv_header_vorbis_codec_h" >&6; }
-
-fi
-if test "x$ac_cv_header_vorbis_codec_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "vorbis/codec.h" "ac_cv_header_vorbis_codec_h" "$ac_includes_default"
+if test "x$ac_cv_header_vorbis_codec_h" = xyes; then :
   VORBIS_HEADER_FOUND=1
 else
   VORBIS_HEADER_FOUND=0
@@ -53178,18 +27677,14 @@ if test "x${PBX_VORBIS}" != "x1" -a "${USE_VORBIS}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_vorbis_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lvorbis" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lvorbis" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lvorbis... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lvorbis ${pbxlibdir} -lm -lvorbisenc -lvorbisfile $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.
@@ -53207,47 +27702,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_VORBIS_FOUND=yes
 else
   AST_VORBIS_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${VORBIS_INCLUDE}"
-         if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
-$as_echo_n "checking for vorbis/codec.h... " >&6; }
-if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
-$as_echo "$ac_cv_header_vorbis_codec_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking vorbis/codec.h usability" >&5
-$as_echo_n "checking vorbis/codec.h usability... " >&6; }
-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 <vorbis/codec.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking vorbis/codec.h presence" >&5
-$as_echo_n "checking vorbis/codec.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <vorbis/codec.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: vorbis/codec.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for vorbis/codec.h" >&5
-$as_echo_n "checking for vorbis/codec.h... " >&6; }
-if test "${ac_cv_header_vorbis_codec_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_vorbis_codec_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_vorbis_codec_h" >&5
-$as_echo "$ac_cv_header_vorbis_codec_h" >&6; }
-
-fi
-if test "x$ac_cv_header_vorbis_codec_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "vorbis/codec.h" "ac_cv_header_vorbis_codec_h" "$ac_includes_default"
+if test "x$ac_cv_header_vorbis_codec_h" = xyes; then :
   VORBIS_HEADER_FOUND=1
 else
   VORBIS_HEADER_FOUND=0
@@ -53430,7 +27766,7 @@ fi
 fi
 
     if test "x${PBX_VORBIS_OPEN_CALLBACKS}" != "x1" -a "${USE_VORBIS_OPEN_CALLBACKS}" != "no"; then
-        { $as_echo "$as_me:$LINENO: checking for OV_CALLBACKS_NOCLOSE declared in vorbis/vorbisfile.h" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OV_CALLBACKS_NOCLOSE declared in vorbis/vorbisfile.h" >&5
 $as_echo_n "checking for OV_CALLBACKS_NOCLOSE declared in vorbis/vorbisfile.h... " >&6; }
         saved_cppflags="${CPPFLAGS}"
         if test "x${VORBIS_OPEN_CALLBACKS_DIR}" != "x"; then
@@ -53438,13 +27774,9 @@ $as_echo_n "checking for OV_CALLBACKS_NOCLOSE declared in vorbis/vorbisfile.h...
         fi
         CPPFLAGS="${CPPFLAGS} ${VORBIS_OPEN_CALLBACKS_INCLUDE}"
 
-        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 <vorbis/vorbisfile.h>
+ #include <vorbis/vorbisfile.h>
 int
 main ()
 {
@@ -53456,43 +27788,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                 PBX_VORBIS_OPEN_CALLBACKS=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_VORBIS_OPEN_CALLBACKS 1
-_ACEOF
+$as_echo "#define HAVE_VORBIS_OPEN_CALLBACKS 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
         CPPFLAGS="${saved_cppflags}"
@@ -53507,7 +27816,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 if test "${USE_VPB}" != "no"; then
-   { $as_echo "$as_me:$LINENO: checking for vpb_open in -lvpb" >&5
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for vpb_open in -lvpb" >&5
 $as_echo_n "checking for vpb_open in -lvpb... " >&6; }
    saved_libs="${LIBS}"
    saved_cppflags="${CPPFLAGS}"
@@ -53522,14 +27831,10 @@ $as_echo_n "checking for vpb_open in -lvpb... " >&6; }
    fi
    LIBS="${PTHREAD_LIBS} ${LIBS} -lvpb"
    CPPFLAGS="${CPPFLAGS} ${PTHREAD_CFLAGS}"
-   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 <vpbapi.h>
+
+       #include <vpbapi.h>
 int
 main ()
 {
@@ -53539,45 +27844,20 @@ int q = vpb_open(0,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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-        test -z "$ac_cxx_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-       { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_cxx_try_link "$LINENO"; then :
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                ac_cv_lib_vpb_vpb_open="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-               { $as_echo "$as_me:$LINENO: result: no" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
                ac_cv_lib_vpb_vpb_open="no"
 
 
 fi
-
-rm -rf conftest.dSYM
-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="${saved_libs}"
    CPPFLAGS="${saved_cppflags}"
    if test "${ac_cv_lib_vpb_vpb_open}" = "yes"; then
@@ -53588,9 +27868,7 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
        fi
        PBX_VPB=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_VPB 1
-_ACEOF
+$as_echo "#define HAVE_VPB 1" >>confdefs.h
 
    fi
 fi
@@ -53620,18 +27898,14 @@ if test "x${PBX_ZLIB}" != "x1" -a "${USE_ZLIB}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_z_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lz" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lz" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lz... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lz ${pbxlibdir}  $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.
@@ -53649,47 +27923,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_ZLIB_FOUND=yes
 else
   AST_ZLIB_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${ZLIB_INCLUDE}"
-         if test "${ac_cv_header_zlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for zlib.h" >&5
-$as_echo_n "checking for zlib.h... " >&6; }
-if test "${ac_cv_header_zlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
-$as_echo "$ac_cv_header_zlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking zlib.h usability" >&5
-$as_echo_n "checking zlib.h usability... " >&6; }
-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 <zlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking zlib.h presence" >&5
-$as_echo_n "checking zlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <zlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: zlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: zlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for zlib.h" >&5
-$as_echo_n "checking for zlib.h... " >&6; }
-if test "${ac_cv_header_zlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_zlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5
-$as_echo "$ac_cv_header_zlib_h" >&6; }
-
-fi
-if test "x$ac_cv_header_zlib_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = xyes; then :
   ZLIB_HEADER_FOUND=1
 else
   ZLIB_HEADER_FOUND=0
 _ACEOF
 
       fi
-   fi
-fi
-
-
-
-if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
-       # Does ODBC support wide characters?
-       { $as_echo "$as_me:$LINENO: checking whether ODBC has support for Unicode types" >&5
-$as_echo_n "checking whether ODBC has support for Unicode types... " >&6; }
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sql.h>
-#include <sqlext.h>
-int
-main ()
-{
-int foo = SQL_WCHAR
-  ;
-  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ODBC_WCHAR 1
-_ACEOF
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-
-if test "${ac_cv_header_h323_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for h323.h" >&5
-$as_echo_n "checking for h323.h... " >&6; }
-if test "${ac_cv_header_h323_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_h323_h" >&5
-$as_echo "$ac_cv_header_h323_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking h323.h usability" >&5
-$as_echo_n "checking h323.h usability... " >&6; }
-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 <h323.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking h323.h presence" >&5
-$as_echo_n "checking h323.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <h323.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: h323.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: h323.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: h323.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: h323.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: h323.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: h323.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: h323.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: h323.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: h323.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: h323.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: h323.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: h323.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: h323.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: h323.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: h323.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: h323.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for h323.h" >&5
-$as_echo_n "checking for h323.h... " >&6; }
-if test "${ac_cv_header_h323_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_h323_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_h323_h" >&5
-$as_echo "$ac_cv_header_h323_h" >&6; }
-
-fi
-if test "x$ac_cv_header_h323_h" = x""yes; then
-  PBX_H323=1
-else
-  PBX_H323=0
+   fi
 fi
 
 
 
-
-if test "${ac_cv_header_linux_compiler_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for linux/compiler.h" >&5
-$as_echo_n "checking for linux/compiler.h... " >&6; }
-if test "${ac_cv_header_linux_compiler_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_compiler_h" >&5
-$as_echo "$ac_cv_header_linux_compiler_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking linux/compiler.h usability" >&5
-$as_echo_n "checking linux/compiler.h usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if test "x${PBX_UNIXODBC}" = "x1" -o "x${PBX_IODBC}" = "x1"; then
+       # Does ODBC support wide characters?
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ODBC has support for Unicode types" >&5
+$as_echo_n "checking whether ODBC has support for Unicode types... " >&6; }
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#include <linux/compiler.h>
+#include <sql.h>
+#include <sqlext.h>
+int
+main ()
+{
+int foo = SQL_WCHAR
+  ;
+  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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
+if ac_fn_c_try_link "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
+$as_echo "#define HAVE_ODBC_WCHAR 1" >>confdefs.h
 
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking linux/compiler.h presence" >&5
-$as_echo_n "checking linux/compiler.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <linux/compiler.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-  ac_header_preproc=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 fi
 
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: linux/compiler.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/compiler.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: linux/compiler.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/compiler.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/compiler.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/compiler.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/compiler.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/compiler.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: linux/compiler.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for linux/compiler.h" >&5
-$as_echo_n "checking for linux/compiler.h... " >&6; }
-if test "${ac_cv_header_linux_compiler_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
+ac_fn_c_check_header_mongrel "$LINENO" "h323.h" "ac_cv_header_h323_h" "$ac_includes_default"
+if test "x$ac_cv_header_h323_h" = xyes; then :
+  PBX_H323=1
 else
-  ac_cv_header_linux_compiler_h=$ac_header_preproc
+  PBX_H323=0
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_compiler_h" >&5
-$as_echo "$ac_cv_header_linux_compiler_h" >&6; }
 
-fi
-if test "x$ac_cv_header_linux_compiler_h" = x""yes; then
+
+
+
+ac_fn_c_check_header_mongrel "$LINENO" "linux/compiler.h" "ac_cv_header_linux_compiler_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_compiler_h" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_LINUX_COMPILER_H 1
 
 
 
-{ $as_echo "$as_me:$LINENO: checking for linux/ixjuser.h" >&5
-$as_echo_n "checking for linux/ixjuser.h... " >&6; }
-if test "${ac_cv_header_linux_ixjuser_h+set}" = set; 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
-/* end confdefs.h.  */
-
+ac_fn_c_check_header_compile "$LINENO" "linux/ixjuser.h" "ac_cv_header_linux_ixjuser_h" "
                                   #include <linux/version.h>
                                   #ifdef HAVE_LINUX_COMPILER_H
                                   #include <linux/compiler.h>
                                   #endif
 
-
-#include <linux/ixjuser.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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_linux_ixjuser_h=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_linux_ixjuser_h=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_ixjuser_h" >&5
-$as_echo "$ac_cv_header_linux_ixjuser_h" >&6; }
-if test "x$ac_cv_header_linux_ixjuser_h" = x""yes; then
+"
+if test "x$ac_cv_header_linux_ixjuser_h" = xyes; then :
   PBX_IXJUSER=1
 else
   PBX_IXJUSER=0
@@ -54277,7 +28056,7 @@ fi
 # Used in res/res_pktccops
 
     if test "x${PBX_MSG_NOSIGNAL}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for MSG_NOSIGNAL in sys/socket.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MSG_NOSIGNAL in sys/socket.h" >&5
 $as_echo_n "checking for MSG_NOSIGNAL in sys/socket.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${MSG_NOSIGNAL_DIR}" != "x"; then
@@ -54285,13 +28064,9 @@ $as_echo_n "checking for MSG_NOSIGNAL in sys/socket.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${MSG_NOSIGNAL_INCLUDE}"
 
-       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 <sys/socket.h>
+ #include <sys/socket.h>
 int
 main ()
 {
@@ -54306,43 +28081,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_MSG_NOSIGNAL=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MSG_NOSIGNAL 1
-_ACEOF
+$as_echo "#define HAVE_MSG_NOSIGNAL 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -54350,7 +28102,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SO_NOSIGPIPE}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for SO_NOSIGPIPE in sys/socket.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SO_NOSIGPIPE in sys/socket.h" >&5
 $as_echo_n "checking for SO_NOSIGPIPE in sys/socket.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SO_NOSIGPIPE_DIR}" != "x"; then
@@ -54358,13 +28110,9 @@ $as_echo_n "checking for SO_NOSIGPIPE in sys/socket.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SO_NOSIGPIPE_INCLUDE}"
 
-       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 <sys/socket.h>
+ #include <sys/socket.h>
 int
 main ()
 {
@@ -54379,43 +28127,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SO_NOSIGPIPE=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SO_NOSIGPIPE 1
-_ACEOF
+$as_echo "#define HAVE_SO_NOSIGPIPE 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -54428,9 +28153,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}sdl-config", so it can be a program name with args.
 set dummy ${ac_tool_prefix}sdl-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CONFIG_SDL+set}" = set; then
+if ${ac_cv_path_CONFIG_SDL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $CONFIG_SDL in
@@ -54444,14 +28169,14 @@ for as_dir in $as_dummy
 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_path_CONFIG_SDL="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -54459,10 +28184,10 @@ esac
 fi
 CONFIG_SDL=$ac_cv_path_CONFIG_SDL
 if test -n "$CONFIG_SDL"; then
-  { $as_echo "$as_me:$LINENO: result: $CONFIG_SDL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CONFIG_SDL" >&5
 $as_echo "$CONFIG_SDL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -54472,9 +28197,9 @@ if test -z "$ac_cv_path_CONFIG_SDL"; then
   ac_pt_CONFIG_SDL=$CONFIG_SDL
   # Extract the first word of "sdl-config", so it can be a program name with args.
 set dummy sdl-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_CONFIG_SDL+set}" = set; then
+if ${ac_cv_path_ac_pt_CONFIG_SDL+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $ac_pt_CONFIG_SDL in
@@ -54488,14 +28213,14 @@ for as_dir in $as_dummy
 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_path_ac_pt_CONFIG_SDL="$as_dir/$ac_word$ac_exec_ext"
-    $as_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
 
   ;;
@@ -54503,10 +28228,10 @@ esac
 fi
 ac_pt_CONFIG_SDL=$ac_cv_path_ac_pt_CONFIG_SDL
 if test -n "$ac_pt_CONFIG_SDL"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_pt_CONFIG_SDL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CONFIG_SDL" >&5
 $as_echo "$ac_pt_CONFIG_SDL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -54515,7 +28240,7 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $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
                saved_libs="${LIBS}"
                LIBS="${SDL_LIB}"
 
-               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
@@ -54556,53 +28277,21 @@ main ()
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
      PBX_SDL=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SDL 1
-_ACEOF
-
-
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+$as_echo "#define HAVE_SDL 1" >>confdefs.h
 
 
 fi
-
-rm -rf conftest.dSYM
-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
                CPPFLAGS="${saved_cppflags}"
                LIBS="${saved_libs}"
            else
                PBX_SDL=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SDL 1
-_ACEOF
+$as_echo "#define HAVE_SDL 1" >>confdefs.h
 
            fi
        fi
@@ -54626,18 +28315,14 @@ if test "x${PBX_SDL_IMAGE}" != "x1" -a "${USE_SDL_IMAGE}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} ${SDL_INCLUDE}"
       as_ac_Lib=`$as_echo "ac_cv_lib_SDL_image_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lSDL_image" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lSDL_image" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lSDL_image... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lSDL_image ${pbxlibdir} ${SDL_LIB} $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.
@@ -54655,47 +28340,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_SDL_IMAGE_FOUND=yes
 else
   AST_SDL_IMAGE_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${SDL_IMAGE_INCLUDE}"
-         if test "${ac_cv_header_SDL_image_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for SDL_image.h" >&5
-$as_echo_n "checking for SDL_image.h... " >&6; }
-if test "${ac_cv_header_SDL_image_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_SDL_image_h" >&5
-$as_echo "$ac_cv_header_SDL_image_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking SDL_image.h usability" >&5
-$as_echo_n "checking SDL_image.h usability... " >&6; }
-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 <SDL_image.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking SDL_image.h presence" >&5
-$as_echo_n "checking SDL_image.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <SDL_image.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: SDL_image.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: SDL_image.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: SDL_image.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: SDL_image.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: SDL_image.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: SDL_image.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: SDL_image.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: SDL_image.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: SDL_image.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: SDL_image.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: SDL_image.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: SDL_image.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: SDL_image.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: SDL_image.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for SDL_image.h" >&5
-$as_echo_n "checking for SDL_image.h... " >&6; }
-if test "${ac_cv_header_SDL_image_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_SDL_image_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_SDL_image_h" >&5
-$as_echo "$ac_cv_header_SDL_image_h" >&6; }
-
-fi
-if test "x$ac_cv_header_SDL_image_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "SDL_image.h" "ac_cv_header_SDL_image_h" "$ac_includes_default"
+if test "x$ac_cv_header_SDL_image_h" = xyes; then :
   SDL_IMAGE_HEADER_FOUND=1
 else
   SDL_IMAGE_HEADER_FOUND=0
@@ -54893,18 +28419,14 @@ if test "x${PBX_FFMPEG}" != "x1" -a "${USE_FFMPEG}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
       as_ac_Lib=`$as_echo "ac_cv_lib_avcodec_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lavcodec" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lavcodec" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lavcodec... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lavcodec ${pbxlibdir} ${PTHREAD_LIBS} -lz -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.
@@ -54922,47 +28444,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_FFMPEG_FOUND=yes
 else
   AST_FFMPEG_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${FFMPEG_INCLUDE}"
-         if test "${ac_cv_header_ffmpeg_avcodec_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for ffmpeg/avcodec.h" >&5
-$as_echo_n "checking for ffmpeg/avcodec.h... " >&6; }
-if test "${ac_cv_header_ffmpeg_avcodec_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_ffmpeg_avcodec_h" >&5
-$as_echo "$ac_cv_header_ffmpeg_avcodec_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking ffmpeg/avcodec.h usability" >&5
-$as_echo_n "checking ffmpeg/avcodec.h usability... " >&6; }
-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 <ffmpeg/avcodec.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking ffmpeg/avcodec.h presence" >&5
-$as_echo_n "checking ffmpeg/avcodec.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ffmpeg/avcodec.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: ffmpeg/avcodec.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ffmpeg/avcodec.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: ffmpeg/avcodec.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ffmpeg/avcodec.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ffmpeg/avcodec.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ffmpeg/avcodec.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ffmpeg/avcodec.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: ffmpeg/avcodec.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: ffmpeg/avcodec.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for ffmpeg/avcodec.h" >&5
-$as_echo_n "checking for ffmpeg/avcodec.h... " >&6; }
-if test "${ac_cv_header_ffmpeg_avcodec_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_ffmpeg_avcodec_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_ffmpeg_avcodec_h" >&5
-$as_echo "$ac_cv_header_ffmpeg_avcodec_h" >&6; }
-
-fi
-if test "x$ac_cv_header_ffmpeg_avcodec_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "ffmpeg/avcodec.h" "ac_cv_header_ffmpeg_avcodec_h" "$ac_includes_default"
+if test "x$ac_cv_header_ffmpeg_avcodec_h" = xyes; then :
   FFMPEG_HEADER_FOUND=1
 else
   FFMPEG_HEADER_FOUND=0
 
 
 # possible places for video4linux version 1
-if test "${ac_cv_header_linux_videodev_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for linux/videodev.h" >&5
-$as_echo_n "checking for linux/videodev.h... " >&6; }
-if test "${ac_cv_header_linux_videodev_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_videodev_h" >&5
-$as_echo "$ac_cv_header_linux_videodev_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking linux/videodev.h usability" >&5
-$as_echo_n "checking linux/videodev.h usability... " >&6; }
-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 <linux/videodev.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking linux/videodev.h presence" >&5
-$as_echo_n "checking linux/videodev.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <linux/videodev.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: linux/videodev.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/videodev.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: linux/videodev.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/videodev.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/videodev.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/videodev.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/videodev.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: linux/videodev.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: linux/videodev.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for linux/videodev.h" >&5
-$as_echo_n "checking for linux/videodev.h... " >&6; }
-if test "${ac_cv_header_linux_videodev_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_linux_videodev_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_linux_videodev_h" >&5
-$as_echo "$ac_cv_header_linux_videodev_h" >&6; }
-
-fi
-if test "x$ac_cv_header_linux_videodev_h" = x""yes; then
+ac_fn_c_check_header_mongrel "$LINENO" "linux/videodev.h" "ac_cv_header_linux_videodev_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_videodev_h" = xyes; then :
 
 cat >>confdefs.h <<_ACEOF
 #define HAVE_VIDEODEV_H 1
@@ -55305,18 +28537,14 @@ if test "x${PBX_X11}" != "x1" -a "${USE_X11}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} "
       as_ac_Lib=`$as_echo "ac_cv_lib_X11_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lX11" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lX11" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lX11... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lX11 ${pbxlibdir}  $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.
@@ -55334,47 +28562,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_X11_FOUND=yes
 else
   AST_X11_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${X11_INCLUDE}"
-         if test "${ac_cv_header_X11_Xlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for X11/Xlib.h" >&5
-$as_echo_n "checking for X11/Xlib.h... " >&6; }
-if test "${ac_cv_header_X11_Xlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xlib_h" >&5
-$as_echo "$ac_cv_header_X11_Xlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking X11/Xlib.h usability" >&5
-$as_echo_n "checking X11/Xlib.h usability... " >&6; }
-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 <X11/Xlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking X11/Xlib.h presence" >&5
-$as_echo_n "checking X11/Xlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: X11/Xlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for X11/Xlib.h" >&5
-$as_echo_n "checking for X11/Xlib.h... " >&6; }
-if test "${ac_cv_header_X11_Xlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_X11_Xlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xlib_h" >&5
-$as_echo "$ac_cv_header_X11_Xlib_h" >&6; }
-
-fi
-if test "x$ac_cv_header_X11_Xlib_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "X11/Xlib.h" "ac_cv_header_X11_Xlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_X11_Xlib_h" = xyes; then :
   X11_HEADER_FOUND=1
 else
   X11_HEADER_FOUND=0
@@ -55559,7 +28628,6 @@ fi
 
 
 
-
 if test "x${PBX_X11}" != "x1" -a "${USE_X11}" != "no"; then
    pbxlibdir=""
    # if --with-X11=DIR has been specified, use it.
@@ -55577,18 +28645,14 @@ if test "x${PBX_X11}" != "x1" -a "${USE_X11}" != "no"; then
       ast_ext_lib_check_save_CFLAGS="${CFLAGS}"
       CFLAGS="${CFLAGS} -I/usr/X11R6/include"
       as_ac_Lib=`$as_echo "ac_cv_lib_X11_${pbxfuncname}" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for ${pbxfuncname} in -lX11" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${pbxfuncname} in -lX11" >&5
 $as_echo_n "checking for ${pbxfuncname} in -lX11... " >&6; }
-if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lX11 ${pbxlibdir}  $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.
@@ -55606,47 +28670,19 @@ return ${pbxfuncname} ();
   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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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 && {
-        test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   eval "$as_ac_Lib=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Lib=no"
+  eval "$as_ac_Lib=no"
 fi
-
-rm -rf conftest.dSYM
-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
-ac_res=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-              { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Lib'}
-                $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
   AST_X11_FOUND=yes
 else
   AST_X11_FOUND=no
       else                             # check for the header
          ast_ext_lib_check_saved_CPPFLAGS="${CPPFLAGS}"
          CPPFLAGS="${CPPFLAGS} ${X11_INCLUDE}"
-         if test "${ac_cv_header_X11_Xlib_h+set}" = set; then
-  { $as_echo "$as_me:$LINENO: checking for X11/Xlib.h" >&5
-$as_echo_n "checking for X11/Xlib.h... " >&6; }
-if test "${ac_cv_header_X11_Xlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xlib_h" >&5
-$as_echo "$ac_cv_header_X11_Xlib_h" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking X11/Xlib.h usability" >&5
-$as_echo_n "checking X11/Xlib.h usability... " >&6; }
-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 <X11/Xlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking X11/Xlib.h presence" >&5
-$as_echo_n "checking X11/Xlib.h presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-_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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$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:$LINENO: WARNING: X11/Xlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: X11/Xlib.h: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: X11/Xlib.h: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to https://issues.asterisk.org ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for X11/Xlib.h" >&5
-$as_echo_n "checking for X11/Xlib.h... " >&6; }
-if test "${ac_cv_header_X11_Xlib_h+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_header_X11_Xlib_h=$ac_header_preproc
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xlib_h" >&5
-$as_echo "$ac_cv_header_X11_Xlib_h" >&6; }
-
-fi
-if test "x$ac_cv_header_X11_Xlib_h" = x""yes; then
+         ac_fn_c_check_header_mongrel "$LINENO" "X11/Xlib.h" "ac_cv_header_X11_Xlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_X11_Xlib_h" = xyes; then :
   X11_HEADER_FOUND=1
 else
   X11_HEADER_FOUND=0
 
 
 
-
 PBX_LAUNCHD=0
 if test "${cross_compiling}" = "no";
 then
-  { $as_echo "$as_me:$LINENO: checking for /sbin/launchd" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /sbin/launchd" >&5
 $as_echo_n "checking for /sbin/launchd... " >&6; }
-if test "${ac_cv_file__sbin_launchd+set}" = set; then
+if ${ac_cv_file__sbin_launchd+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   test "$cross_compiling" = yes &&
-  { { $as_echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-$as_echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
 if test -r "/sbin/launchd"; then
   ac_cv_file__sbin_launchd=yes
 else
   ac_cv_file__sbin_launchd=no
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_file__sbin_launchd" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__sbin_launchd" >&5
 $as_echo "$ac_cv_file__sbin_launchd" >&6; }
-if test "x$ac_cv_file__sbin_launchd" = x""yes; then
+if test "x$ac_cv_file__sbin_launchd" = xyes; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SBIN_LAUNCHD 1
-_ACEOF
+$as_echo "#define HAVE_SBIN_LAUNCHD 1" >>confdefs.h
 
 fi
 
@@ -55870,9 +28770,7 @@ if test "${PKGCONFIG}" != "No"; then
    GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs)
    PBX_GTK2=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GTK2 1
-_ACEOF
+$as_echo "#define HAVE_GTK2 1" >>confdefs.h
 
 fi
 
@@ -55904,7 +28802,7 @@ if test "${ac_cv_header_syslog_h}" = "yes"; then
    # syslog facilities
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_AUTH}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_AUTH in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_AUTH in syslog.h" >&5
 $as_echo_n "checking for LOG_AUTH in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_AUTH_DIR}" != "x"; then
@@ -55912,13 +28810,9 @@ $as_echo_n "checking for LOG_AUTH in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_AUTH_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -55933,43 +28827,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_AUTH=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_AUTH 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_AUTH 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -55977,7 +28848,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_AUTHPRIV}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_AUTHPRIV in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_AUTHPRIV in syslog.h" >&5
 $as_echo_n "checking for LOG_AUTHPRIV in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_AUTHPRIV_DIR}" != "x"; then
@@ -55985,13 +28856,9 @@ $as_echo_n "checking for LOG_AUTHPRIV in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_AUTHPRIV_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56006,43 +28873,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_AUTHPRIV=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_AUTHPRIV 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_AUTHPRIV 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56050,7 +28894,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_CRON}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_CRON in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_CRON in syslog.h" >&5
 $as_echo_n "checking for LOG_CRON in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_CRON_DIR}" != "x"; then
@@ -56058,13 +28902,9 @@ $as_echo_n "checking for LOG_CRON in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_CRON_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56079,43 +28919,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_CRON=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_CRON 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_CRON 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56123,7 +28940,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_DAEMON}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_DAEMON in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_DAEMON in syslog.h" >&5
 $as_echo_n "checking for LOG_DAEMON in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_DAEMON_DIR}" != "x"; then
@@ -56131,13 +28948,9 @@ $as_echo_n "checking for LOG_DAEMON in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_DAEMON_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56152,43 +28965,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_DAEMON=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_DAEMON 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_DAEMON 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56196,7 +28986,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_FTP}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_FTP in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_FTP in syslog.h" >&5
 $as_echo_n "checking for LOG_FTP in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_FTP_DIR}" != "x"; then
@@ -56204,13 +28994,9 @@ $as_echo_n "checking for LOG_FTP in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_FTP_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56225,43 +29011,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_FTP=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_FTP 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_FTP 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56269,7 +29032,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_KERN}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_KERN in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_KERN in syslog.h" >&5
 $as_echo_n "checking for LOG_KERN in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_KERN_DIR}" != "x"; then
@@ -56277,13 +29040,9 @@ $as_echo_n "checking for LOG_KERN in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_KERN_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56298,43 +29057,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_KERN=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_KERN 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_KERN 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56342,7 +29078,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_LPR}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_LPR in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_LPR in syslog.h" >&5
 $as_echo_n "checking for LOG_LPR in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_LPR_DIR}" != "x"; then
@@ -56350,13 +29086,9 @@ $as_echo_n "checking for LOG_LPR in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_LPR_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56371,43 +29103,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_LPR=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_LPR 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_LPR 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56415,7 +29124,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_MAIL}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_MAIL in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_MAIL in syslog.h" >&5
 $as_echo_n "checking for LOG_MAIL in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_MAIL_DIR}" != "x"; then
@@ -56423,13 +29132,9 @@ $as_echo_n "checking for LOG_MAIL in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_MAIL_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56444,43 +29149,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_MAIL=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_MAIL 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_MAIL 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56488,7 +29170,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_NEWS}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_NEWS in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_NEWS in syslog.h" >&5
 $as_echo_n "checking for LOG_NEWS in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_NEWS_DIR}" != "x"; then
@@ -56496,13 +29178,9 @@ $as_echo_n "checking for LOG_NEWS in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_NEWS_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56517,43 +29195,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_NEWS=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_NEWS 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_NEWS 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56561,7 +29216,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_SYSLOG}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_SYSLOG in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_SYSLOG in syslog.h" >&5
 $as_echo_n "checking for LOG_SYSLOG in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_SYSLOG_DIR}" != "x"; then
@@ -56569,13 +29224,9 @@ $as_echo_n "checking for LOG_SYSLOG in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_SYSLOG_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56590,43 +29241,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_SYSLOG=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_SYSLOG 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_SYSLOG 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
@@ -56634,7 +29262,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 
     if test "x${PBX_SYSLOG_FACILITY_LOG_UUCP}" != "x1"; then
-       { $as_echo "$as_me:$LINENO: checking for LOG_UUCP in syslog.h" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOG_UUCP in syslog.h" >&5
 $as_echo_n "checking for LOG_UUCP in syslog.h... " >&6; }
        saved_cppflags="${CPPFLAGS}"
        if test "x${SYSLOG_FACILITY_LOG_UUCP_DIR}" != "x"; then
@@ -56642,13 +29270,9 @@ $as_echo_n "checking for LOG_UUCP in syslog.h... " >&6; }
        fi
        CPPFLAGS="${CPPFLAGS} ${SYSLOG_FACILITY_LOG_UUCP_INCLUDE}"
 
-       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 <syslog.h>
+ #include <syslog.h>
 int
 main ()
 {
@@ -56663,43 +29287,20 @@ 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 ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$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
-  $as_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
-     { $as_echo "$as_me:$LINENO: result: yes" >&5
+if ac_fn_c_try_compile "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
                PBX_SYSLOG_FACILITY_LOG_UUCP=1
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYSLOG_FACILITY_LOG_UUCP 1
-_ACEOF
+$as_echo "#define HAVE_SYSLOG_FACILITY_LOG_UUCP 1" >>confdefs.h
 
 
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-          { $as_echo "$as_me:$LINENO: result: no" >&5
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
        CPPFLAGS="${saved_cppflags}"
     fi
 ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts channels/h323/Makefile"
 
 
-       { $as_echo "$as_me:$LINENO: checking for mandatory modules: ${ac_mandatory_list}" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mandatory modules: ${ac_mandatory_list}" >&5
 $as_echo_n "checking for mandatory modules: ${ac_mandatory_list}... " >&6; }
        err=0;
        for i in ${ac_mandatory_list}; do
                eval "a=\${PBX_$i}"
                if test "x${a}" = "x1" ; then continue; fi
-               if test ${err} = "0" ; then { $as_echo "$as_me:$LINENO: result: fail" >&5
+               if test ${err} = "0" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: fail" >&5
 $as_echo "fail" >&6; } ; fi
-               { $as_echo "$as_me:$LINENO: result: " >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
 $as_echo "" >&6; }
                eval "a=\${${i}_OPTION}"
-               { $as_echo "$as_me:$LINENO: ***" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: ***" >&5
 $as_echo "$as_me: ***" >&6;}
-               { $as_echo "$as_me:$LINENO: *** The $i installation appears to be missing or broken." >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: *** The $i installation appears to be missing or broken." >&5
 $as_echo "$as_me: *** The $i installation appears to be missing or broken." >&6;}
-               { $as_echo "$as_me:$LINENO: *** Either correct the installation, or run configure" >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: *** Either correct the installation, or run configure" >&5
 $as_echo "$as_me: *** Either correct the installation, or run configure" >&6;}
-               { $as_echo "$as_me:$LINENO: *** including --without-${a}." >&5
+               { $as_echo "$as_me:${as_lineno-$LINENO}: *** including --without-${a}." >&5
 $as_echo "$as_me: *** including --without-${a}." >&6;}
                err=1
        done
        if test $err = 1 ; then exit 1; fi
-       { $as_echo "$as_me:$LINENO: result: ok" >&5
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
 $as_echo "ok" >&6; }
 
 
@@ -56782,13 +29383,13 @@ _ACEOF
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_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) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -56796,8 +29397,8 @@ $as_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 quotesdouble-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
        "s/'/'\\\\''/g;
          s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -56819,12 +29420,23 @@ $as_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" &&
-      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+    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;}
-    cat confcache >$cache_file
+      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
-    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+    { $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
@@ -56838,14 +29450,15 @@ DEFS=-DHAVE_CONFIG_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=`$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
 
@@ -56853,13 +29466,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"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+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.
@@ -56869,17 +29483,18 @@ cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 debug=false
 ac_cs_recheck=false
 ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
 
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## 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=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -56887,23 +29502,15 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   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
-
 as_nl='
 '
 export as_nl
@@ -56911,7 +29518,13 @@ export as_nl
 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
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# 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
@@ -56922,7 +29535,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
        expr "X$arg" : "X\\(.*\\)$as_nl";
        arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -56945,13 +29558,6 @@ if test "${PATH_SEPARATOR+set}" != set; then
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
 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
 
      ;;
@@ -56981,12 +29588,16 @@ if test "x$as_myself" = x; then
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  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='> '
@@ -56998,7 +29609,89 @@ export LC_ALL
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# 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
+  $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
+
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -57012,8 +29705,12 @@ 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\(//\)$' \| \
@@ -57033,76 +29730,25 @@ $as_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" ||
-    { $as_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$$ 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
@@ -57151,10 +29845,10 @@ else
       if test -d "$1"; then
        test -d "$1/.";
       else
-       case $1 in
+       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
   '
@@ -57169,13 +29863,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 asterisk $as_me trunk, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -57206,13 +29906,15 @@ _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 [OPTION]... [FILE]...
+Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
   -q, --quiet, --silent
                    do not print progress messages
   -d, --debug      don't remove temporary files
@@ -57228,16 +29930,17 @@ $config_files
 Configuration headers:
 $config_headers
 
-Report bugs to <bug-autoconf@gnu.org>."
+Report bugs to <https://issues.asterisk.org>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 asterisk config.status trunk
-configured by $0, generated by GNU Autoconf 2.63,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.68,
+  with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2008 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."
 
@@ -57254,11 +29957,16 @@ 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
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $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
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
     esac
-    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
@@ -57300,11 +30010,10 @@ Try \`$0 --help' for more information." >&2
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { $as_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
@@ -57355,9 +30064,7 @@ do
     "makeopts") CONFIG_FILES="$CONFIG_FILES makeopts" ;;
     "channels/h323/Makefile") CONFIG_FILES="$CONFIG_FILES channels/h323/Makefile" ;;
 
-  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_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
 
 # 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")
-} ||
-{
-   $as_echo "$as_me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -57406,7 +30111,13 @@ $debug ||
 if test -n "$CONFIG_FILES"; then
 
 
-ac_cr='\r'
+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 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
   ac_cs_awk_cr='\\r'
@@ -57414,7 +30125,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -57423,24 +30134,18 @@ _ACEOF
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+  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
   . ./conf$$subs.sh ||
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
   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
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_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
@@ -57448,7 +30153,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -57462,7 +30167,7 @@ s/'"$ac_delim"'$//
 t delim
 :nl
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -57476,7 +30181,7 @@ s/.\{148\}//
 t nl
 :delim
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
@@ -57496,7 +30201,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = "\a"
 
@@ -57528,23 +30233,29 @@ 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 < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
-   { (exit 1); exit 1; }; }
+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
@@ -57556,7 +30267,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -57568,13 +30279,11 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -57659,9 +30368,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -57674,9 +30381,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_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
@@ -57695,7 +30400,7 @@ $as_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 `:'.
@@ -57704,12 +30409,10 @@ $as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
           [\\/$]*) false;;
           *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
           esac ||
-          { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_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
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      ac_file_inputs="$ac_file_inputs '$ac_f'"
+      as_fn_append ac_file_inputs " '$ac_f'"
     done
 
     # Let's still pretend it is `configure' which instantiates (i.e., don't
@@ -57720,7 +30423,7 @@ $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
        `' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+      { $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.
@@ -57732,10 +30435,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; } ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -57763,47 +30464,7 @@ $as_echo X"$ac_file" |
            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=`$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_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_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
@@ -57855,7 +30516,6 @@ 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=
-
 ac_sed_dataroot='
 /datarootdir/ {
   p
@@ -57865,12 +30525,11 @@ ac_sed_dataroot='
 /@docdir@/p
 /@infodir@/p
 /@localedir@/p
-/@mandir@/p
-'
+/@mandir@/p'
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+  { $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 || ac_write_fail=1
@@ -57880,7 +30539,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   s&@infodir@&$infodir&g
   s&@localedir@&$localedir&g
   s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
 _ACEOF
 
@@ -57907,27 +30566,24 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
 s&@INSTALL@&$ac_INSTALL&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+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"; } &&
-  { $as_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
+  { 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;}
+which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  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";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -57936,27 +30592,21 @@ $as_echo "$as_me: error: could not create $ac_file" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
-       || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+      mv "$ac_tmp/config.h" "$ac_file" \
+       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
-   { (exit 1); exit 1; }; }
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
   fi
  ;;
 
@@ -57966,15 +30616,12 @@ $as_echo "$as_me: error: could not create -" >&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_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -57995,10 +30642,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:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+  { $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
 
@@ -58039,17 +30686,17 @@ echo "       \$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$.                "
 echo
 fi
 
-{ $as_echo "$as_me:$LINENO: Package configured for: " >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Package configured for: " >&5
 $as_echo "$as_me: Package configured for: " >&6;}
-{ $as_echo "$as_me:$LINENO: OS type  : $host_os" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: OS type  : $host_os" >&5
 $as_echo "$as_me: OS type  : $host_os" >&6;}
-{ $as_echo "$as_me:$LINENO: Host CPU : $host_cpu" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: Host CPU : $host_cpu" >&5
 $as_echo "$as_me: Host CPU : $host_cpu" >&6;}
-{ $as_echo "$as_me:$LINENO: build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :" >&5
 $as_echo "$as_me: build-cpu:vendor:os: $build_cpu : $build_vendor : $build_os :" >&6;}
-{ $as_echo "$as_me:$LINENO: host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :" >&5
 $as_echo "$as_me: host-cpu:vendor:os: $host_cpu : $host_vendor : $host_os :" >&6;}
 if test "${cross_compiling}" = "yes"; then
-   { $as_echo "$as_me:$LINENO: Cross Compilation = YES" >&5
+   { $as_echo "$as_me:${as_lineno-$LINENO}: Cross Compilation = YES" >&5
 $as_echo "$as_me: Cross Compilation = YES" >&6;}
 fi
index 573ebbd9c4f0db211ce69ca2d8b80f51c40b0ae2..40afdfa75e89cc09d3c455d71d4d3283ddafc38d 100644 (file)
@@ -460,7 +460,6 @@ AST_EXT_LIB_SETUP([TIMERFD], [timerfd], [timerfd])
 AST_EXT_LIB_SETUP([TINFO], [Term Info], [tinfo])
 AST_EXT_LIB_SETUP([TONEZONE], [tonezone], [tonezone])
 AST_EXT_LIB_SETUP([UNIXODBC], [unixODBC], [unixodbc])
-AST_EXT_LIB_SETUP([USB], [usb], [usb])
 AST_EXT_LIB_SETUP([VORBIS], [Vorbis], [vorbis])
 AST_EXT_LIB_SETUP([VPB], [Voicetronix API], [vpb])
 AST_EXT_LIB_SETUP([X11], [X11], [x11])
@@ -2104,8 +2103,6 @@ fi
 
 AST_EXT_LIB_CHECK([TONEZONE], [tonezone], [tone_zone_find], [dahdi/tonezone.h], [${tonezone_extra} ${DAHDI_INCLUDE}])
 
-AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h], [])
-
 if test "${OSARCH}" = "OpenBSD";
 then
        AST_EXT_LIB_CHECK([VORBIS], [vorbis], [vorbis_info_init], [vorbis/codec.h], [-lm -lvorbisenc -lvorbisfile -logg])
index 65d743b906ae043ccea873467663a064a6bc38b6..ee41a5bc9f264a4726870f6c2b03806e9e2e14b5 100644 (file)
 /* Define to 1 if you have the `strtoq' function. */
 #undef HAVE_STRTOQ
 
-/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
+/* Define to 1 if `ifr_ifru.ifru_hwaddr' is member of `struct ifreq'. */
 #undef HAVE_STRUCT_IFREQ_IFR_IFRU_IFRU_HWADDR
 
-/* Define to 1 if `uid' is member of `struct sockpeercred'. */
+/* Define to 1 if `uid' is member of `struct sockpeercred'. */
 #undef HAVE_STRUCT_SOCKPEERCRED_UID
 
-/* Define to 1 if `st_blksize' is member of `struct stat'. */
+/* Define to 1 if `st_blksize' is member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_BLKSIZE
 
-/* Define to 1 if `cr_uid' is member of `struct ucred'. */
+/* Define to 1 if `cr_uid' is member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_CR_UID
 
-/* Define to 1 if `uid' is member of `struct ucred'. */
+/* Define to 1 if `uid' is member of `struct ucred'. */
 #undef HAVE_STRUCT_UCRED_UID
 
 /* Define to 1 if you have the mISDN Supplemental Services library. */
 /* Define to 1 if you have the `unsetenv' function. */
 #undef HAVE_UNSETENV
 
-/* Define to 1 if you have the usb library. */
-#undef HAVE_USB
-
 /* Define to 1 if you have the `utime' function. */
 #undef HAVE_UTIME
 
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
index c7a5eafc688eefad3a83292363045fce7954826a..0a136140be15db82515608b78cf245c557ed7f70 100644 (file)
@@ -263,9 +263,6 @@ CRYPTO_LIB=@CRYPTO_LIB@
 TONEZONE_INCLUDE=@TONEZONE_INCLUDE@
 TONEZONE_LIB=@TONEZONE_LIB@
 
-USB_INCLUDE=@USB_INCLUDE@
-USB_LIB=@USB_LIB@
-
 UNIXODBC_INCLUDE=@UNIXODBC_INCLUDE@
 UNIXODBC_LIB=@UNIXODBC_LIB@