dahdi-tools-2.2.0-rc2/0000775000000000000000000000000011176143303013105 5ustar rootrootdahdi-tools-2.2.0-rc2/system.conf.sample0000664000000000000000000002666011104370540016566 0ustar rootroot# # DAHDI Configuration File # # This file is parsed by the DAHDI Configurator, dahdi_cfg # # Span Configuration # ^^^^^^^^^^^^^^^^^^ # First come the span definitions, in the format # # span=,,,,[,yellow] # # All T1/E1/BRI spans generate a clock signal on their transmit side. The # parameter determines whether the clock signal from the far # end of the T1/E1/BRI is used as the master source of clock timing. If it is, our # own clock will synchronise to it. T1/E1/BRI connected directly or indirectly to # a PSTN provider (telco) should generally be the first choice to sync to. The # PSTN will never be a slave to you. You must be a slave to it. # # Choose 1 to make the equipment at the far end of the E1/T1/BRI link the preferred # source of the master clock. Choose 2 to make it the second choice for the master # clock, if the first choice port fails (the far end dies, a cable breaks, or # whatever). Choose 3 to make a port the third choice, and so on. If you have, say, # 2 ports connected to the PSTN, mark those as 1 and 2. The number used for each # port should be different. # # If you choose 0, the port will never be used as a source of timing. This is # appropriate when you know the far end should always be a slave to you. If # the port is connected to a channel bank, for example, you should always be # its master. Likewise, BRI TE ports should always be configured as a slave. # Any number of ports can be marked as 0. # # Incorrect timing sync may cause clicks/noise in the audio, poor quality or failed # faxes, unreliable modem operation, and is a general all round bad thing. # # The line build-out (or LBO) is an integer, from the following table: # # 0: 0 db (CSU) / 0-133 feet (DSX-1) # 1: 133-266 feet (DSX-1) # 2: 266-399 feet (DSX-1) # 3: 399-533 feet (DSX-1) # 4: 533-655 feet (DSX-1) # 5: -7.5db (CSU) # 6: -15db (CSU) # 7: -22.5db (CSU) # # If the span is a BRI port the line build-out is not used and should be set # to 0. # # framing:: # one of 'd4' or 'esf' for T1 or 'cas' or 'ccs' for E1. Use 'ccs' for BRI. # 'd4' could be referred to as 'sf' or 'superframe' # # coding:: # one of 'ami' or 'b8zs' for T1 or 'ami' or 'hdb3' for E1. Use 'ami' for # BRI. # # * For E1 there is the optional keyword 'crc4' to enable CRC4 checking. # * If the keyword 'yellow' follows, yellow alarm is transmitted when no # channels are open. # #span=1,0,0,esf,b8zs #span=2,1,0,esf,b8zs #span=3,0,0,ccs,hdb3,crc4 # # Dynamic Spans # ^^^^^^^^^^^^^ # Next come the dynamic span definitions, in the form: # # dynamic=,
,, # # Where is the name of the driver (e.g. eth),
is the # driver specific address (like a MAC for eth), is the number # of channels, and is a timing priority, like for a normal span. # use "0" to not use this as a timing source, or prioritize them as # primary, secondard, etc. Note that you MUST have a REAL DAHDI device # if you are not using external timing. # # dynamic=eth,eth0/00:02:b3:35:43:9c,24,0 # # If a non-zero timing value is used, as above, only the last span should # have the non-zero value. # # Channel Configuration # ^^^^^^^^^^^^^^^^^^^^^ # Next come the definitions for using the channels. The format is: # = # # Valid devices are: # # e&m:: # Channel(s) are signalled using E&M signalling (specific # implementation, such as Immediate, Wink, or Feature Group D # are handled by the userspace library). # fxsls:: # Channel(s) are signalled using FXS Loopstart protocol. # fxsgs:: # Channel(s) are signalled using FXS Groundstart protocol. # fxsks:: # Channel(s) are signalled using FXS Koolstart protocol. # fxols:: # Channel(s) are signalled using FXO Loopstart protocol. # fxogs:: # Channel(s) are signalled using FXO Groundstart protocol. # fxoks:: # Channel(s) are signalled using FXO Koolstart protocol. # sf:: # Channel(s) are signalled using in-band single freq tone. # Syntax as follows: # # channel# => sf:,,,,, # # rxfreq is rx tone freq in Hz, rxbw is rx notch (and decode) # bandwith in hz (typically 10.0), rxflag is either 'normal' or # 'inverted', txfreq is tx tone freq in hz, txlevel is tx tone # level in dbm, txflag is either 'normal' or 'inverted'. Set # rxfreq or txfreq to 0.0 if that tone is not desired. # # unused:: # No signalling is performed, each channel in the list remains idle # clear:: # Channel(s) are bundled into a single span. No conversion or # signalling is performed, and raw data is available on the master. # bchan:: # Like 'clear' except all channels are treated individually and # are not bundled. 'inclear' is an alias for this. # rawhdlc:: # The DAHDI driver performs HDLC encoding and decoding on the # bundle, and the resulting data is communicated via the master # device. # dchan:: # The DAHDI driver performs HDLC encoding and decoding on the # bundle and also performs incoming and outgoing FCS insertion # and verification. 'fcshdlc' is an alias for this. # hardhdlc:: # The hardware driver performs HDLC encoding and decoding on the # bundle and also performs incoming and outgoing FCS insertion # and verification. Is subject to limitations and support of underlying # hardware. BRI spans serviced by the wcb4xxp driver must use hardhdlc # channels for the signalling channels. # nethdlc:: # The DAHDI driver bundles the channels together into an # hdlc network device, which in turn can be configured with # sethdlc (available separately). In 2.6.x kernels you can also optionally # pass the name for the network interface after the channel list. # Syntax: # # nethdlc=[:interface name] # Use original names, don't use the names which have been already registered # in system e.g eth. # # dacs:: # The DAHDI driver cross connects the channels starting at # the channel number listed at the end, after a colon # dacsrbs:: # The DAHDI driver cross connects the channels starting at # the channel number listed at the end, after a colon and # also performs the DACSing of RBS bits # # The channel list is a comma-separated list of channels or ranges, for # example: # # 1,3,5 (channels one, three, and five) # 16-23, 29 (channels 16 through 23, as well as channel 29) # # So, some complete examples are: # # e&m=1-12 # nethdlc=13-24 # fxsls=25,26,27,28 # fxols=29-32 # # An example of BRI port: # # span=1,1,0,ccs,ami # bchan=1,2 # hardhdlc=3 # # NOTE: When using BRI channels in asterisk, use the bri_cpe, bri_net, or # bri_cpe_ptmp (for point to multipoint mode). libpri does not currently # support point to multipoint when in NT mode. Otherwise, the bearer channel # are configured identically to other DAHDI channels. # #fxoks=1-24 #bchan=25-47 #dchan=48 #fxols=1-12 #fxols=13-24 #e&m=25-29 #nethdlc=30-33 #clear=44 #clear=45 #clear=46 #clear=47 #fcshdlc=48 #dacs=1-24:48 #dacsrbs=1-24:48 # # Tone Zone Data # ^^^^^^^^^^^^^^ # Finally, you can preload some tone zones, to prevent them from getting # overwritten by other users (if you allow non-root users to open /dev/dahdi/* # interfaces anyway. Also this means they won't have to be loaded at runtime. # The format is "loadzone=" where the zone is a two letter country code. # # You may also specify a default zone with "defaultzone=" where zone # is a two letter country code. # # An up-to-date list of the zones can be found in the file zonedata.c # loadzone = us #loadzone = us-old #loadzone=gr #loadzone=it #loadzone=fr #loadzone=de #loadzone=uk #loadzone=fi #loadzone=jp #loadzone=sp #loadzone=no #loadzone=hu #loadzone=lt #loadzone=pl defaultzone=us # # PCI Radio Interface # ^^^^^^^^^^^^^^^^^^^ # (see http://www.zapatatelephony.org/app_rpt.html) # # The PCI Radio Interface card interfaces up to 4 two-way radios (either # a base/mobile radio or repeater system) to DAHDI channels. The driver # may work either independent of an application, or with it, through # the driver;s ioctl() interface. This file gives you access to specify # load-time parameters for Radio channels, so that the driver may run # by itself, and just act like a generic DAHDI radio interface. # # Unlike the rest of this file, you specify a block of parameters, and # then the channel(s) to which they apply. CTCSS is specified as a frequency # in tenths of hertz, for example 131.8 HZ is specified as 1318. DCS # for receive is specified as the code directly, for example 223. DCS for # transmit is specified as D and then the code, for example D223. # # The hardware supports a "community" CTCSS decoder system that has # arbitrary transmit CTCSS or DCS codes associated with them, unlike # traditional "community" systems that encode the same tone they decode. # # this example is a single tone DCS transmit and receive # # specify the transmit tone (in DCS mode this stays constant): #tx=D371 # # specify the receive DCS code: #dcsrx=223 # # this example is a "community" CTCSS (if you only want a single tone, then # only specify 1 in the ctcss list) # # specify the default transmit tone (when not receiving): #tx=1000 # # Specify the receive freq, the tag (use 0 if none), and the transmit code. # The tag may be used by applications to determine classification of tones. # The tones are to be specified in order of presedence, most important first. # Currently, 15 tones may be specified.. # #ctcss=1318,1,1318 #ctcss=1862,1,1862 # # The following parameters may be omitted if their default value is acceptible # # Set the receive debounce time in milliseconds: #debouncetime=123 # # set the transmit quiet dropoff burst time in milliseconds: #bursttime=234 # # set the COR level threshold (specified in tenths of millivolts) # valid values are {3125,6250,9375,12500,15625,18750,21875,25000} #corthresh=12500 # # Invert COR signal {y,n} #invertcor=y # Set the external tone mode; yes, no, internal {y,n,i} #exttone=y # # Now apply the configuration to the specified channels: # # We are all done with our channel parameters, so now we specify what # channels they apply to #channels=1-4 # # Overiding PCM encoding # ^^^^^^^^^^^^^^^^^^^^^^ # Usually the channel driver sets the encoding of the PCM for the # channel (mulaw / alaw. That is: g711u or g711a). However there are # some cases where you would like to override that. 'mulaw' and 'alaw' # set different such encoding. Use them for channels you have already # defined with e.g. 'bchan' or 'fxoks'. #mulaw=1-4 #alaw=1-4 # # 'deflaw' is similar, but resets the encoding to the channel driver's # default. It must be useful for something, I guess. #mulaw=1-10 #deflaw=5 # # Echo Cancellers # ^^^^^^^^^^^^^^^ # DAHDI uses modular echo cancellers that are configured per channel. The echo # cancellers are compiled and installed as part of the dahdi-linux package. # You can specify in this file the echo canceller to be used for each # channel. The default behavior is for there to be NO echo canceller on any # channel, so it is very important that you specify one here if you do # not have hardware echo cancellers and need echo cancellation. # # Valid echo cancellers are: mg2, kb1, sec2, and sec. # If compiled, 'hpec' is also a valid echo canceller. # # To configure the default echo cancellers, use the format: # echocanceller=, # # Example: # Configure channels 1 through 8 to use the mg2 echo canceller #echocanceller=mg2,1-8 # # And change channel 2 to use the kb1 echo canceller. #echocanceller=kb1,2 # dahdi-tools-2.2.0-rc2/patgen.c0000664000000000000000000000537511111641664014543 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include "bittest.h" #include #include "dahdi_tools_version.h" /* #define BLOCK_SIZE 2048 */ #define BLOCK_SIZE 2041 void print_packet(unsigned char *buf, int len) { int x; printf("{ "); for (x=0;x\n", argv[0]); exit(1); } fd = open(argv[1], O_RDWR, 0600); if (fd < 0) { fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &bs)) { fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_GET_PARAMS, &tp)) { fprintf(stderr, "Unable to get channel parameters\n"); exit(1); } ioctl(fd, DAHDI_GETEVENT); #if 0 print_packet(outbuf, res); printf("FCS is %x, PPP_GOODFCS is %x\n", fcs,PPP_GOODFCS); #endif for(;;) { res = bs; for (x=0;x * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include "tonezone.h" #include "dahdi_tools_version.h" #define CONFIG_FILENAME "/etc/dahdi/system.conf" #define MASTER_DEVICE "/dev/dahdi/ctl" #define NUM_SPANS DAHDI_MAX_SPANS #define NUM_TONES 15 /*! A sanity check for the timing parameter of the span. * * Note that each driver using it is still responsible for validating * that value. */ #define MAX_TIMING 255 /* Assume no more than 1024 dynamics */ #define NUM_DYNAMIC 1024 static int lineno=0; static FILE *cf; static char *filename=CONFIG_FILENAME; int rxtones[NUM_TONES + 1],rxtags[NUM_TONES + 1],txtones[NUM_TONES + 1]; int bursttime = 0, debouncetime = 0, invertcor = 0, exttone = 0, corthresh = 0; int txgain = 0, rxgain = 0, deemp = 0, preemp = 0; int corthreshes[] = {3125,6250,9375,12500,15625,18750,21875,25000,0} ; static int toneindex = 1; #define DEBUG_READER (1 << 0) #define DEBUG_PARSER (1 << 1) #define DEBUG_APPLY (1 << 2) static int debug = 0; static int errcnt = 0; static int deftonezone = -1; static struct dahdi_lineconfig lc[DAHDI_MAX_SPANS]; static struct dahdi_chanconfig cc[DAHDI_MAX_CHANNELS]; static struct dahdi_attach_echocan ae[DAHDI_MAX_CHANNELS]; static struct dahdi_dynamic_span zds[NUM_DYNAMIC]; static const char *sig[DAHDI_MAX_CHANNELS]; /* Signalling */ static int slineno[DAHDI_MAX_CHANNELS]; /* Line number where signalling specified */ static int fiftysixkhdlc[DAHDI_MAX_CHANNELS]; static int spans=0; static int fo_real = 1; static int verbose = 0; static int force = 0; static int stopmode = 0; static int numdynamic = 0; static char zonestoload[DAHDI_TONE_ZONE_MAX][10]; static int numzones = 0; static int fd = -1; static const char *lbostr[] = { "0 db (CSU)/0-133 feet (DSX-1)", "133-266 feet (DSX-1)", "266-399 feet (DSX-1)", "399-533 feet (DSX-1)", "533-655 feet (DSX-1)", "-7.5db (CSU)", "-15db (CSU)", "-22.5db (CSU)" }; static const char *laws[] = { "Default", "Mu-law", "A-law" }; static const char *sigtype_to_str(const int sig) { switch (sig) { case 0: return "Unused"; case DAHDI_SIG_EM: return "E & M"; case DAHDI_SIG_EM_E1: return "E & M E1"; case DAHDI_SIG_FXSLS: return "FXS Loopstart"; case DAHDI_SIG_FXSGS: return "FXS Groundstart"; case DAHDI_SIG_FXSKS: return "FXS Kewlstart"; case DAHDI_SIG_FXOLS: return "FXO Loopstart"; case DAHDI_SIG_FXOGS: return "FXO Groundstart"; case DAHDI_SIG_FXOKS: return "FXO Kewlstart"; case DAHDI_SIG_CAS: return "CAS / User"; case DAHDI_SIG_DACS: return "DACS"; case DAHDI_SIG_DACS_RBS: return "DACS w/RBS"; case DAHDI_SIG_CLEAR: return "Clear channel"; case DAHDI_SIG_SLAVE: return "Slave channel"; case DAHDI_SIG_HDLCRAW: return "Raw HDLC"; case DAHDI_SIG_HDLCNET: return "Network HDLC"; case DAHDI_SIG_HDLCFCS: return "HDLC with FCS check"; case DAHDI_SIG_HARDHDLC: return "Hardware assisted D-channel"; case DAHDI_SIG_MTP2: return "MTP2"; default: return "Unknown"; } } int ind_ioctl(int channo, int fd, int op, void *data) { struct dahdi_indirect_data ind; ind.chan = channo; ind.op = op; ind.data = data; return ioctl(fd, DAHDI_INDIRECT, &ind); } static void clear_fields() { memset(rxtones,0,sizeof(rxtones)); memset(rxtags,0,sizeof(rxtags)); memset(txtones,0,sizeof(txtones)); bursttime = 0; debouncetime = 0; invertcor = 0; exttone = 0; txgain = 0; rxgain = 0; deemp = 0; preemp = 0; } static int error(char *fmt, ...) __attribute__ ((format(printf, 1, 2))); static int error(char *fmt, ...) { int res; static int shown=0; va_list ap; if (!shown) { fprintf(stderr, "Notice: Configuration file is %s\n", filename); shown++; } res = fprintf(stderr, "line %d: ", lineno); va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); errcnt++; return res; } static char *trim(char *buf) { size_t len; while (*buf && (*buf < 33)) { buf++; } len = strlen(buf); while (len && buf[len-1] < 33) { buf[--len] = '\0'; } return buf; } static int parseargs(char *input, char *output[], int maxargs, char sep) { char *c; int pos=0; c = input; output[pos++] = c; while(*c) { while(*c && (*c != sep)) c++; if (*c) { *c = '\0'; c++; while(*c && (*c < 33)) c++; if (*c) { if (pos >= maxargs) return -1; output[pos] = c; trim(output[pos]); pos++; output[pos] = NULL; /* Return error if we have too many */ } else return pos; } } return pos; } int dspanconfig(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int chans; int timing; argc = res = parseargs(args, realargs, 4, ','); if (res != 4) { error("Incorrect number of arguments to 'dynamic' (should be ,
,, )\n"); return -1; } res = sscanf(realargs[2], "%d", &chans); if ((res == 1) && (chans < 1)) res = -1; if (res != 1) { error("Invalid number of channels '%s', should be a number > 0.\n", realargs[2]); return -1; } res = sscanf(realargs[3], "%d", &timing); if ((res == 1) && (timing < 0)) res = -1; if (res != 1) { error("Invalid timing '%s', should be a number > 0.\n", realargs[3]); return -1; } dahdi_copy_string(zds[numdynamic].driver, realargs[0], sizeof(zds[numdynamic].driver)); dahdi_copy_string(zds[numdynamic].addr, realargs[1], sizeof(zds[numdynamic].addr)); zds[numdynamic].numchans = chans; zds[numdynamic].timing = timing; numdynamic++; return 0; } int spanconfig(char *keyword, char *args) { static char *realargs[10]; int res; int argc; int span; int timing; argc = res = parseargs(args, realargs, 7, ','); if ((res < 5) || (res > 7)) { error("Incorrect number of arguments to 'span' (should be ,,,,[, crc4 | yellow [, yellow]])\n"); return -1; } res = sscanf(realargs[0], "%i", &span); if (res != 1) { error("Span number should be a valid span number, not '%s'\n", realargs[0]); return -1; } res = sscanf(realargs[1], "%i", &timing); if ((res != 1) || (timing < 0) || (timing > MAX_TIMING)) { error("Timing should be a number from 0 to %d, not '%s'\n", MAX_TIMING, realargs[1]); return -1; } res = sscanf(realargs[2], "%i", &lc[spans].lbo); if (res != 1) { error("Line build-out (LBO) should be a number from 0 to 7 (usually 0) not '%s'\n", realargs[2]); return -1; } if ((lc[spans].lbo < 0) || (lc[spans].lbo > 7)) { error("Line build-out should be in the range 0 to 7, not %d\n", lc[spans].lbo); return -1; } if (!strcasecmp(realargs[3], "d4")) { lc[spans].lineconfig |= DAHDI_CONFIG_D4; lc[spans].lineconfig &= ~DAHDI_CONFIG_ESF; lc[spans].lineconfig &= ~DAHDI_CONFIG_CCS; } else if (!strcasecmp(realargs[3], "esf")) { lc[spans].lineconfig |= DAHDI_CONFIG_ESF; lc[spans].lineconfig &= ~DAHDI_CONFIG_D4; lc[spans].lineconfig &= ~DAHDI_CONFIG_CCS; } else if (!strcasecmp(realargs[3], "ccs")) { lc[spans].lineconfig |= DAHDI_CONFIG_CCS; lc[spans].lineconfig &= ~(DAHDI_CONFIG_ESF | DAHDI_CONFIG_D4); } else if (!strcasecmp(realargs[3], "cas")) { lc[spans].lineconfig &= ~DAHDI_CONFIG_CCS; lc[spans].lineconfig &= ~(DAHDI_CONFIG_ESF | DAHDI_CONFIG_D4); } else { error("Framing(T1)/Signalling(E1) must be one of 'd4', 'esf', 'cas' or 'ccs', not '%s'\n", realargs[3]); return -1; } if (!strcasecmp(realargs[4], "ami")) { lc[spans].lineconfig &= ~(DAHDI_CONFIG_B8ZS | DAHDI_CONFIG_HDB3); lc[spans].lineconfig |= DAHDI_CONFIG_AMI; } else if (!strcasecmp(realargs[4], "b8zs")) { lc[spans].lineconfig |= DAHDI_CONFIG_B8ZS; lc[spans].lineconfig &= ~(DAHDI_CONFIG_AMI | DAHDI_CONFIG_HDB3); } else if (!strcasecmp(realargs[4], "hdb3")) { lc[spans].lineconfig |= DAHDI_CONFIG_HDB3; lc[spans].lineconfig &= ~(DAHDI_CONFIG_AMI | DAHDI_CONFIG_B8ZS); } else { error("Coding must be one of 'ami', 'b8zs' or 'hdb3', not '%s'\n", realargs[4]); return -1; } if (argc > 5) { if (!strcasecmp(realargs[5], "yellow")) lc[spans].lineconfig |= DAHDI_CONFIG_NOTOPEN; else if (!strcasecmp(realargs[5], "crc4")) { lc[spans].lineconfig |= DAHDI_CONFIG_CRC4; } else { error("Only valid fifth arguments are 'yellow' or 'crc4', not '%s'\n", realargs[5]); return -1; } } if (argc > 6) { if (!strcasecmp(realargs[6], "yellow")) lc[spans].lineconfig |= DAHDI_CONFIG_NOTOPEN; else { error("Only valid sixth argument is 'yellow', not '%s'\n", realargs[6]); return -1; } } lc[spans].span = span; lc[spans].sync = timing; /* Valid span */ spans++; return 0; } int apply_channels(int chans[], char *argstr) { char *args[DAHDI_MAX_CHANNELS+1]; char *range[3]; int res,x, res2,y; int chan; int start, finish; char argcopy[256]; res = parseargs(argstr, args, DAHDI_MAX_CHANNELS, ','); if (res < 0) { error("Too many arguments... Max is %d\n", DAHDI_MAX_CHANNELS); return -1; } for (x=0;x-.\n", args[x]); return -1; } res2 =sscanf(range[0], "%i", &start); if (res2 != 1) { error("Syntax error. Start of range '%s' should be a number from 1 to %d\n", args[x], DAHDI_MAX_CHANNELS - 1); return -1; } else if ((start < 1) || (start >= DAHDI_MAX_CHANNELS)) { error("Start of range '%s' must be between 1 and %d (not '%d')\n", args[x], DAHDI_MAX_CHANNELS - 1, start); return -1; } res2 =sscanf(range[1], "%i", &finish); if (res2 != 1) { error("Syntax error. End of range '%s' should be a number from 1 to %d\n", args[x], DAHDI_MAX_CHANNELS - 1); return -1; } else if ((finish < 1) || (finish >= DAHDI_MAX_CHANNELS)) { error("end of range '%s' must be between 1 and %d (not '%d')\n", args[x], DAHDI_MAX_CHANNELS - 1, finish); return -1; } if (start > finish) { error("Range '%s' should start before it ends\n", args[x]); return -1; } for (y=start;y<=finish;y++) chans[y]=1; } else { /* It's a single channel */ res2 =sscanf(args[x], "%i", &chan); if (res2 != 1) { error("Syntax error. Channel should be a number from 1 to %d, not '%s'\n", DAHDI_MAX_CHANNELS - 1, args[x]); return -1; } else if ((chan < 1) || (chan >= DAHDI_MAX_CHANNELS)) { error("Channel must be between 1 and %d (not '%d')\n", DAHDI_MAX_CHANNELS - 1, chan); return -1; } chans[chan]=1; } } return res; } int parse_idle(int *i, char *s) { char a,b,c,d; if (s) { if (sscanf(s, "%c%c%c%c", &a,&b,&c,&d) == 4) { if (((a == '0') || (a == '1')) && ((b == '0') || (b == '1')) && ((c == '0') || (c == '1')) && ((d == '0') || (d == '1'))) { *i = 0; if (a == '1') *i |= DAHDI_ABIT; if (b == '1') *i |= DAHDI_BBIT; if (c == '1') *i |= DAHDI_CBIT; if (d == '1') *i |= DAHDI_DBIT; return 0; } } } error("CAS Signalling requires idle definition in the form ':xxxx' at the end of the channel definition, where xxxx represent the a, b, c, and d bits\n"); return -1; } static int parse_channel(char *channel, int *startchan) { if (!channel || (sscanf(channel, "%i", startchan) != 1) || (*startchan < 1)) { error("DACS requires a starting channel in the form ':x' where x is the channel\n"); return -1; } return 0; } static int chanconfig(char *keyword, char *args) { int chans[DAHDI_MAX_CHANNELS]; int res = 0; int x; int master=0; int dacschan = 0; char *idle; bzero(chans, sizeof(chans)); strtok(args, ":"); idle = strtok(NULL, ":"); if (!strcasecmp(keyword, "dacs") || !strcasecmp(keyword, "dacsrbs")) { res = parse_channel(idle, &dacschan); } if (!res) res = apply_channels(chans, args); if (res <= 0) return -1; for (x=1;x= DAHDI_TONE_ZONE_MAX) { error("Too many tone zones specified\n"); return 0; } dahdi_copy_string(zonestoload[numzones++], args, sizeof(zonestoload[0])); return 0; } static int defaultzone(char *keyword, char *args) { struct tone_zone *z; if (!(z = tone_zone_find(args))) { error("No such tone zone known: %s\n", args); return 0; } deftonezone = z->zone; return 0; } #if 0 static int unimplemented(char *keyword, char *args) { fprintf(stderr, "Warning: '%s' is not yet implemented\n", keyword); return 0; } #endif /* Radio functions */ int ctcss(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int rxtone; int rxtag; int txtone; int isdcs = 0; argc = res = parseargs(args, realargs, 3, ','); if (res != 3) { error("Incorrect number of arguments to 'ctcss' (should be ,,)\n"); return -1; } res = sscanf(realargs[0], "%d", &rxtone); if ((res == 1) && (rxtone < 1)) res = -1; if (res != 1) { error("Invalid rxtone '%s', should be a number > 0.\n", realargs[0]); return -1; } res = sscanf(realargs[1], "%i", &rxtag); if ((res == 1) && (rxtag < 0)) res = -1; if (res != 1) { error("Invalid rxtag '%s', should be a number > 0.\n", realargs[1]); return -1; } if ((*realargs[2] == 'D') || (*realargs[2] == 'd')) { realargs[2]++; isdcs = 0x8000; } res = sscanf(realargs[2], "%d", &txtone); if ((res == 1) && (rxtag < 0)) res = -1; if (res != 1) { error("Invalid txtone '%s', should be a number > 0.\n", realargs[2]); return -1; } if (toneindex >= NUM_TONES) { error("Cannot specify more then %d CTCSS tones\n",NUM_TONES); return -1; } rxtones[toneindex] = rxtone; rxtags[toneindex] = rxtag; txtones[toneindex] = txtone | isdcs; toneindex++; return 0; } int dcsrx(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int rxtone; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'dcsrx' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &rxtone); if ((res == 1) && (rxtone < 1)) res = -1; if (res != 1) { error("Invalid rxtone '%s', should be a number > 0.\n", realargs[0]); return -1; } rxtones[0] = rxtone; return 0; } int tx(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int txtone; int isdcs = 0; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'tx' (should be )\n"); return -1; } if ((*realargs[0] == 'D') || (*realargs[0] == 'd')) { realargs[0]++; isdcs = 0x8000; } res = sscanf(realargs[0], "%d", &txtone); if ((res == 1) && (txtone < 1)) res = -1; if (res != 1) { error("Invalid tx (tone) '%s', should be a number > 0.\n", realargs[0]); return -1; } txtones[0] = txtone | isdcs; return 0; } int debounce_time(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'debouncetime' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &val); if ((res == 1) && (val < 1)) res = -1; if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } debouncetime = val; return 0; } int burst_time(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'bursttime' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &val); if ((res == 1) && (val < 1)) res = -1; if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } bursttime = val; return 0; } int tx_gain(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'txgain' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &val); if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } txgain = val; return 0; } int rx_gain(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'rxgain' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &val); if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } rxgain = val; return 0; } int de_emp(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'de-emp' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &val); if ((res == 1) && (val < 1)) res = -1; if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } deemp = val; return 0; } int pre_emp(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'pre_emp' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &val); if ((res == 1) && (val < 1)) res = -1; if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } preemp = val; return 0; } int invert_cor(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'invertcor' (should be )\n"); return -1; } if ((*realargs[0] == 'y') || (*realargs[0] == 'Y')) val = 1; else if ((*realargs[0] == 'n') || (*realargs[0] == 'N')) val = 0; else { res = sscanf(realargs[0], "%d", &val); if ((res == 1) && (val < 0)) res = -1; if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } } invertcor = (val > 0); return 0; } int ext_tone(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'exttone' (should be )\n"); return -1; } if ((*realargs[0] == 'y') || (*realargs[0] == 'Y')) val = 1; else if ((*realargs[0] == 'n') || (*realargs[0] == 'N')) val = 0; else if ((*realargs[0] == 'i') || (*realargs[0] == 'I')) val = 2; else { res = sscanf(realargs[0], "%d", &val); if ((res == 1) && (val < 0)) res = -1; if (val > 2) res = -1; if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } } exttone = val; return 0; } int cor_thresh(char *keyword, char *args) { static char *realargs[10]; int argc; int res; int val; int x = 0; argc = res = parseargs(args, realargs, 1, ','); if (res != 1) { error("Incorrect number of arguments to 'corthresh' (should be )\n"); return -1; } res = sscanf(realargs[0], "%d", &val); if ((res == 1) && (val < 1)) res = -1; for(x = 0; corthreshes[x]; x++) { if (corthreshes[x] == val) break; } if (!corthreshes[x]) res = -1; if (res != 1) { error("Invalid value '%s', should be a number > 0.\n", realargs[0]); return -1; } corthresh = x + 1; return 0; } int rad_apply_channels(int chans[], char *argstr) { char *args[DAHDI_MAX_CHANNELS+1]; char *range[3]; int res,x, res2,y; int chan; int start, finish; char argcopy[256]; res = parseargs(argstr, args, DAHDI_MAX_CHANNELS, ','); if (res < 0) { error("Too many arguments... Max is %d\n", DAHDI_MAX_CHANNELS); return -1; } for (x=0;x-.\n", args[x]); return -1; } res2 =sscanf(range[0], "%i", &start); if (res2 != 1) { error("Syntax error. Start of range '%s' should be a number from 1 to %d\n", args[x], DAHDI_MAX_CHANNELS - 1); return -1; } else if ((start < 1) || (start >= DAHDI_MAX_CHANNELS)) { error("Start of range '%s' must be between 1 and %d (not '%d')\n", args[x], DAHDI_MAX_CHANNELS - 1, start); return -1; } res2 =sscanf(range[1], "%i", &finish); if (res2 != 1) { error("Syntax error. End of range '%s' should be a number from 1 to %d\n", args[x], DAHDI_MAX_CHANNELS - 1); return -1; } else if ((finish < 1) || (finish >= DAHDI_MAX_CHANNELS)) { error("end of range '%s' must be between 1 and %d (not '%d')\n", args[x], DAHDI_MAX_CHANNELS - 1, finish); return -1; } if (start > finish) { error("Range '%s' should start before it ends\n", args[x]); return -1; } for (y=start;y<=finish;y++) chans[y]=1; } else { /* It's a single channel */ res2 =sscanf(args[x], "%i", &chan); if (res2 != 1) { error("Syntax error. Channel should be a number from 1 to %d, not '%s'\n", DAHDI_MAX_CHANNELS - 1, args[x]); return -1; } else if ((chan < 1) || (chan >= DAHDI_MAX_CHANNELS)) { error("Channel must be between 1 and %d (not '%d')\n", DAHDI_MAX_CHANNELS - 1, chan); return -1; } chans[chan]=1; } } return res; } static int rad_chanconfig(char *keyword, char *args) { int chans[DAHDI_MAX_CHANNELS]; int res = 0; int x,i,n; struct dahdi_radio_param p; toneindex = 1; bzero(chans, sizeof(chans)); res = rad_apply_channels(chans, args); if (res <= 0) return -1; for (x=1;x 1) { printf("\nChannel map:\n\n"); for (x=1;x -- Use instead of " CONFIG_FILENAME "\n" " -d [level] -- Generate debugging output. (Default level is 1.)\n" " -f -- Always reconfigure every channel\n" " -h -- Generate this help statement\n" " -s -- Shutdown spans only\n" " -t -- Test mode only, do not apply\n" " -v -- Verbose (more -v's means more verbose)\n" ,c); exit(exitcode); } int main(int argc, char *argv[]) { int c; char *buf; char *key, *value; int x,found; while((c = getopt(argc, argv, "fthc:vsd::")) != -1) { switch(c) { case 'c': filename=optarg; break; case 'h': usage(argv[0], 0); break; case '?': usage(argv[0], 1); break; case 'v': verbose++; break; case 'f': force++; break; case 't': fo_real = 0; break; case 's': stopmode = 1; break; case 'd': if (optarg) debug = atoi(optarg); else debug = 1; break; } } if (verbose) { fprintf(stderr, "%s\n", dahdi_tools_version); } if (fd == -1) fd = open(MASTER_DEVICE, O_RDWR); if (fd < 0) { error("Unable to open master device '%s'\n", MASTER_DEVICE); goto finish; } cf = fopen(filename, "r"); if (cf) { while((buf = readline())) { if (*buf == 10) /* skip new line */ continue; if (debug & DEBUG_READER) fprintf(stderr, "Line %d: %s\n", lineno, buf); if ((value = strchr(buf, '='))) { *value++ = '\0'; value = trim(value); key = trim(buf); } if (!value || !*value || !*key) { error("Syntax error. Should be =\n"); continue; } if (debug & DEBUG_PARSER) fprintf(stderr, "Keyword: [%s], Value: [%s]\n", key, value); found = 0; for (x = 0; x < sizeof(handlers) / sizeof(handlers[0]); x++) { if (!strcasecmp(key, handlers[x].keyword)) { found++; handlers[x].func(key, value); break; } } if (!found) error("Unknown keyword '%s'\n", key); } if (debug & DEBUG_READER) fprintf(stderr, "\n"); /* fclose(cf); // causes seg fault (double free) */ } else { error("Unable to open configuration file '%s'\n", filename); } finish: if (errcnt) { fprintf(stderr, "\n%d error(s) detected\n\n", errcnt); exit(1); } if (verbose) { printconfig(fd); } if (!fo_real) exit(0); if (debug & DEBUG_APPLY) { printf("About to open Master device\n"); fflush(stdout); } for (x=0;x> 16; if (cc[x].sigtype != current_state.sigtype) { needupdate++; if (verbose > 1) printf("Changing signalling on channel %d from %s to %s\n", cc[x].chan, sigtype_to_str(current_state.sigtype), sigtype_to_str(cc[x].sigtype)); } if ((cc[x].deflaw != DAHDI_LAW_DEFAULT) && (cc[x].deflaw != current_state.curlaw)) { needupdate++; if (verbose > 1) printf("Changing law on channel %d from %s to %s\n", cc[x].chan, laws[current_state.curlaw], laws[cc[x].deflaw]); } if (cc[x].master != master) { needupdate++; if (verbose > 1) printf("Changing master of channel %d from %d to %d\n", cc[x].chan, master, cc[x].master); } if (cc[x].idlebits != current_state.idlebits) { needupdate++; if (verbose > 1) printf("Changing idle bits of channel %d from %d to %d\n", cc[x].chan, current_state.idlebits, cc[x].idlebits); } } if (needupdate && ioctl(fd, DAHDI_CHANCONFIG, &cc[x])) { fprintf(stderr, "DAHDI_CHANCONFIG failed on channel %d: %s (%d)\n", x, strerror(errno), errno); if (errno == EINVAL) { fprintf(stderr, "Did you forget that FXS interfaces are configured with FXO signalling\n" "and that FXO interfaces use FXS signalling?\n"); } close(fd); exit(1); } ae[x].chan = x; if (verbose) { printf("Setting echocan for channel %d to %s\n", ae[x].chan, ae[x].echocan[0] ? ae[x].echocan : "none"); } if (ioctl(fd, DAHDI_ATTACH_ECHOCAN, &ae[x])) { fprintf(stderr, "DAHDI_ATTACH_ECHOCAN failed on channel %d: %s (%d)\n", x, strerror(errno), errno); close(fd); exit(1); } } for (x=0;x -1) { if (ioctl(fd, DAHDI_DEFAULTZONE, &deftonezone)) { fprintf(stderr, "DAHDI_DEFAULTZONE failed: %s (%d)\n", strerror(errno), errno); close(fd); exit(1); } } for (x=0;x&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: dahdi-tools-2.2.0-rc2/hdlcgen.c0000664000000000000000000000674411111641664014672 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #define FAST_HDLC_NEED_TABLES #include #include "dahdi_tools_version.h" #define RANDOM "/dev/urandom" /* Not genuinely random */ /* #define RANDOM "/dev/random" */ /* Quite genuinely random */ int myread(int fd, char *buf, int len) { int sofar; int res; sofar = 0; while(sofar < len) { res = read(fd, buf + sofar, len - sofar); if (res < 0) return res; sofar += res; } return sofar; } int main(int argc, char *argv[]) { unsigned char buf[1024]; unsigned char outbuf[2048]; int res; int randin; int randout; int hdlcout; int cnt; int hdlccnt; int x; int flags; struct fasthdlc_state transmitter; fasthdlc_precalc(); fasthdlc_init(&transmitter, FASTHDLC_MODE_64); randin = open(RANDOM, O_RDONLY); if (randin < 0) { fprintf(stderr, "Unable to open %s: %s\n", RANDOM, strerror(errno)); exit(1); } randout = open("random.raw", O_WRONLY|O_TRUNC|O_CREAT, 0666); if (randout < 0) { fprintf(stderr, "Unable to open random.raw: %s\n", strerror(errno)); exit(1); } hdlcout = open("random.hdlc", O_WRONLY|O_TRUNC|O_CREAT, 0666); if (hdlcout < 0) { fprintf(stderr, "Unable to open random.hdlc: %s\n", strerror(errno)); exit(1); } for (;;) { cnt = (rand() % 256) + 4; /* Read a pseudo-random amount of stuff */ res = myread(randin, buf, cnt); if (res != cnt) { fprintf(stderr, "Tried to read %d bytes, but read %d instead\n", cnt, res); exit(1); } res = write(randout, buf, cnt); if (res != cnt) { fprintf(stderr, "Tried to write %d bytes, but wrote %d instead\n", cnt, res); exit(1); } /* HDLC encode */ hdlccnt = 0; /* Start with a flag */ fasthdlc_tx_frame(&transmitter); if (transmitter.bits >= 8) outbuf[hdlccnt++] = fasthdlc_tx_run(&transmitter); for (x=0;x= 8) { outbuf[hdlccnt++] = fasthdlc_tx_run(&transmitter); } } flags = (rand() % 4); for (x=0;x 1) printf("Encoded %d byte message with %d bytes of HDLC and %d extra flags\n", cnt, hdlccnt, flags); res = write(hdlcout, outbuf, hdlccnt); if (res != hdlccnt) { fprintf(stderr, "Tried to write %d HDLC bytes, but wrote %d instead\n", cnt, res); exit(1); } } } dahdi-tools-2.2.0-rc2/tonezone.h0000664000000000000000000000570211046162606015126 0ustar rootroot/* * BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01 * * Working with the "Tormenta ISA" Card * * Copyright (C) 2001-2008, Digium, Inc. * * Primary Author: Mark Spencer * */ /* * 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 Lesser General Public License Version 2.1 as published * by the Free Software Foundation. See the LICENSE.LGPL file * included with this program for more details. * * In addition, when this program is distributed with Asterisk in * any form that would qualify as a 'combined work' or as a * 'derivative work' (but not mere aggregation), you can redistribute * and/or modify the combination under the terms of the license * provided with that copy of Asterisk, instead of the license * terms granted here. */ #ifndef _TONEZONE_H #define _TONEZONE_H #include struct tone_zone_sound { int toneid; char data[256]; /* Actual zone description */ /* Description is a series of tones of the format: [!]freq1[+freq2][/time] separated by commas. There are no spaces. The sequence is repeated back to the first tone description not preceeded by !. time is specified in milliseconds */ }; struct tone_zone { int zone; /* Zone number */ char country[10]; /* Country code */ char description[40]; /* Description */ int ringcadence[DAHDI_MAX_CADENCE]; /* Ring cadence */ struct tone_zone_sound tones[DAHDI_TONE_MAX]; int dtmf_high_level; /* Power level of high frequency component of DTMF, expressed in dBm0. */ int dtmf_low_level; /* Power level of low frequency component of DTMF, expressed in dBm0. */ int mfr1_level; /* Power level of MFR1, expressed in dBm0. */ int mfr2_level; /* Power level of MFR2, expressed in dBm0. */ }; extern struct tone_zone builtin_zones[]; /* Register a given two-letter tone zone if we can */ int tone_zone_register(int fd, char *country); /* Register a given two-letter tone zone if we can */ int tone_zone_register_zone(int fd, struct tone_zone *z); /* Retrieve a raw tone zone structure */ struct tone_zone *tone_zone_find(char *country); /* Retrieve a raw tone zone structure by id instead of country*/ struct tone_zone *tone_zone_find_by_num(int id); /* Retrieve a string name for a given tone id */ char *tone_zone_tone_name(int id); /* Set a given file descriptor into a given country -- USE THIS INTERFACE INSTEAD OF THE IOCTL ITSELF. Auto-loads tone zone if necessary */ int tone_zone_set_zone(int fd, char *country); /* Get the current tone zone */ int tone_zone_get_zone(int fd); /* Play a given tone, loading tone zone automatically if necessary */ int tone_zone_play_tone(int fd, int toneid); #endif dahdi-tools-2.2.0-rc2/Makefile0000664000000000000000000002757211175033611014561 0ustar rootroot# # Makefile for DAHDI tools # # Copyright (C) 2001-2008 Digium, Inc. # # # If the file .dahdi.makeopts is present in your home directory, you can # include all of your favorite menuselect options so that every time you download # a new version of Asterisk, you don't have to run menuselect to set them. # The file /etc/dahdi.makeopts will also be included but can be overridden # by the file in your home directory. GLOBAL_MAKEOPTS=$(wildcard /etc/dahdi.makeopts) USER_MAKEOPTS=$(wildcard ~/.dahdi.makeopts) ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),) ifneq ($(wildcard menuselect.makeopts),) include menuselect.makeopts endif endif ifeq ($(strip $(foreach var,clean distclean dist-clean update,$(findstring $(var),$(MAKECMDGOALS)))),) ifneq ($(wildcard makeopts),) include makeopts endif endif SUBDIRS_UTILS_ALL:= ppp SUBDIRS_UTILS := xpp OPTFLAGS=-O2 CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER ifneq (,$(findstring ppc,$(UNAME_M))) CFLAGS+=-fsigned-char endif ifneq (,$(findstring x86_64,$(UNAME_M))) CFLAGS+=-m64 endif ifeq ($(DAHDI_DEVMODE),yes) CFLAGS+=-Werror -Wunused -Wundef $(DAHDI_DECLARATION_AFTER_STATEMENT) -Wmissing-format-attribute -Wformat-security #-Wformat=2 endif ROOT_PREFIX= # extra cflags to build dependencies. Recursively expanded. MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP CFLAGS+=$(DAHDI_INCLUDE) CHKCONFIG := $(wildcard /sbin/chkconfig) UPDATE_RCD := $(wildcard /usr/sbin/update-rc.d) ifeq (,$(DESTDIR)) ifneq (,$(CHKCONFIG)) ADD_INITD := $(CHKCONFIG) --add dahdi else ifneq (,$(UPDATE_RCD)) ADD_INITD := $(UPDATE_RCD) dahdi defaults 15 30 endif endif endif INITRD_DIR := $(firstword $(wildcard $(DESTDIR)/etc/rc.d/init.d $(DESTDIR)/etc/init.d)) ifneq (,$(INITRD_DIR)) INIT_TARGET := $(INITRD_DIR)/dahdi COPY_INITD := install -D dahdi.init $(INIT_TARGET) endif RCCONF_FILE = /etc/dahdi/init.conf MODULES_FILE = /etc/dahdi/modules GENCONF_FILE = /etc/dahdi/genconf_parameters MODPROBE_FILE = /etc/modprobe.d/dahdi BLACKLIST_FILE = /etc/modprobe.d/dahdi.blacklist NETSCR_DIR := $(firstword $(wildcard $(DESTDIR)/etc/sysconfig/network-scripts )) ifneq (,$(NETSCR_DIR)) NETSCR_TARGET := $(NETSCR_DIR)/ifup-hdlc COPY_NETSCR := install -D ifup-hdlc $(NETSCR_TARGET) endif ifneq ($(wildcard .version),) TOOLSVERSION:=$(shell cat .version) else ifneq ($(wildcard .svn),) TOOLSVERSION=$(shell build_tools/make_version . dahdi/tools) endif endif LTZ_A:=libtonezone.a LTZ_A_OBJS:=zonedata.o tonezone.o version.o LTZ_SO:=libtonezone.so LTZ_SO_OBJS:=zonedata.lo tonezone.lo version.o LTZ_SO_MAJOR_VER:=2 LTZ_SO_MINOR_VER:=0 # sbindir, libdir, includedir and mandir are defined in makeopts # (from configure). BIN_DIR:=$(sbindir) LIB_DIR:=$(libdir) INC_DIR:=$(includedir)/dahdi MAN_DIR:=$(mandir)/man8 CONFIG_DIR:=$(sysconfdir)/dahdi CONFIG_FILE:=$(CONFIG_DIR)/system.conf # Utilities we build with a standard build procedure: UTILS = dahdi_tool dahdi_test dahdi_monitor dahdi_speed sethdlc dahdi_cfg \ fxstest fxotune dahdi_diag dahdi_scan # some tests: UTILS += patgen pattest patlooptest hdlcstress hdlctest hdlcgen \ hdlcverify timertest BINS:=fxotune fxstest sethdlc dahdi_cfg dahdi_diag dahdi_monitor dahdi_speed dahdi_test dahdi_scan dahdi_tool BINS:=$(filter-out $(MENUSELECT_UTILS),$(BINS)) MAN_PAGES:=$(wildcard $(BINS:%=doc/%.8)) TEST_BINS:=patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest # All the man pages. Not just installed ones: GROFF_PAGES := $(wildcard doc/*.8 xpp/*.8) GROFF_HTML := $(GROFF_PAGES:%=%.html) GENERATED_DOCS := $(GROFF_HTML) README.html README.Astribank.html all: menuselect.makeopts @$(MAKE) _all _all: prereq programs libs: $(LTZ_SO) $(LTZ_A) utils-subdirs: @for dir in $(SUBDIRS_UTILS); do \ $(MAKE) -C $$dir; \ done programs: libs utils utils: $(BINS) utils-subdirs version.c: FORCE @TOOLSVERSION="${TOOLSVERSION}" build_tools/make_version_c > $@.tmp @if cmp -s $@.tmp $@ ; then :; else \ mv $@.tmp $@ ; \ fi @rm -f $@.tmp tests: $(TEST_BINS) $(UTILS): %: %.o $(UTILS): version.o %.o: %.c $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< %.lo: %.c $(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $< %: %.o $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ prereq: config.status dahdi_tool: CFLAGS+=$(NEWT_INCLUDE) dahdi_tool: LIBS+=$(NEWT_LIB) dahdi_speed: CFLAGS+=-O0 $(LTZ_A): $(LTZ_A_OBJS) ar rcs $@ $^ ranlib $@ $(LTZ_SO): $(LTZ_SO_OBJS) $(CC) $(CFLAGS) -shared -Wl,-soname,$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) -o $@ $^ -lm dahdi_cfg: $(LTZ_A) dahdi_cfg: LIBS+=-lm fxstest: $(LTZ_SO) fxstest: LIBS+=-lm fxotune: LIBS+=-lm tonezones.txt: zonedata.c perl -ne 'next unless (/\.(country|description) = *"([^"]*)/); \ print (($$1 eq "country")? "* $$2\t":"$$2\n");' $< \ >$@ %.asciidoc: %.sample perl -n -e \ 'if (/^#($$|\s)(.*)/){ if (!$$in_doc){print "\n"}; $$in_doc=1; print "$$2\n" } else { if ($$in_doc){print "\n"}; $$in_doc=0; print " $$_" }' \ $< \ | perl -p -e 'if (/^ #?(\w+)=/ && ! exists $$cfgs{$$1}){my $$cfg = $$1; $$cfgs{$$cfg} = 1; s/^/\n[[cfg_$$cfg]]\n/}' >$@ docs: $(GENERATED_DOCS) genconf_parameters.sample: xpp/genconf_parameters cp $< $@ README.html: README system.conf.asciidoc init.conf.asciidoc tonezones.txt \ UPGRADE.txt genconf_parameters.asciidoc $(ASCIIDOC) -n -a toc -a toclevels=3 $< README.Astribank.html: xpp/README.Astribank $(ASCIIDOC) -o $@ -n -a toc -a toclevels=4 $< # on Debian: this requires the full groof, not just groff-base. %.8.html: %.8 man -Thtml $^ >$@ htmlman: $(GROFF_HTML) install: all install-programs @echo "###################################################" @echo "###" @echo "### DAHDI tools installed successfully." @echo "### If you have not done so before, install init scripts with:" @echo "###" @echo "### make config" @echo "###" @echo "###################################################" install-programs: install-utils install-libs install-utils: utils install-utils-subdirs ifneq (,$(BINS)) install -d $(DESTDIR)$(BIN_DIR) install $(BINS) $(DESTDIR)$(BIN_DIR)/ install -d $(DESTDIR)$(MAN_DIR) install -m 644 $(MAN_PAGES) $(DESTDIR)$(MAN_DIR)/ endif ifeq (,$(wildcard $(DESTDIR)$(CONFIG_FILE))) $(INSTALL) -D -m 644 system.conf.sample $(DESTDIR)$(CONFIG_FILE) endif install-libs: libs $(INSTALL) -D -m 755 $(LTZ_A) $(DESTDIR)$(LIB_DIR)/$(LTZ_A) $(INSTALL) -D -m 755 $(LTZ_SO) $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) ifeq (,$(DESTDIR)) if [ `id -u` = 0 ]; then \ /sbin/ldconfig || : ;\ fi endif rm -f $(DESTDIR)$(LIB_DIR)$(LTZ_SO) $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).$(LTZ_SO_MAJOR_VER) $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ $(DESTDIR)$(LIB_DIR)/$(LTZ_SO) # Overwrite the 1.0 links out there. dahdi-tools 2.0.0 installed # 1.0 links but dahdi-tools changed them to 2.0 in order to explicitly # break applications linked with zaptel. But, this also meant that # applications linked with libtonezone.so.1.0 broke when dahdi-tools # 2.1.0 was installed. $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).1.0 $(LN) -sf $(LTZ_SO).$(LTZ_SO_MAJOR_VER).$(LTZ_SO_MINOR_VER) \ $(DESTDIR)$(LIB_DIR)/$(LTZ_SO).1 ifneq (no,$(USE_SELINUX)) ifeq (,$(DESTDIR)) /sbin/restorecon -v $(DESTDIR)$(LIB_DIR)/$(LTZ_SO) endif endif $(INSTALL) -D -m 644 tonezone.h $(DESTDIR)$(INC_DIR)/tonezone.h install-utils-subdirs: @for dir in $(SUBDIRS_UTILS); do \ $(MAKE) -C $$dir install; \ done config: ifneq (,$(COPY_INITD)) $(COPY_INITD) endif ifeq (,$(wildcard $(DESTDIR)$(RCCONF_FILE))) $(INSTALL) -D -m 644 init.conf.sample $(DESTDIR)$(RCCONF_FILE) endif ifeq (,$(wildcard $(DESTDIR)$(MODULES_FILE))) $(INSTALL) -D -m 644 modules.sample $(DESTDIR)$(MODULES_FILE) endif ifeq (,$(wildcard $(DESTDIR)$(GENCONF_FILE))) $(INSTALL) -D -m 644 xpp/genconf_parameters $(DESTDIR)$(GENCONF_FILE) endif ifeq (,$(wildcard $(DESTDIR)$(MODPROBE_FILE))) $(INSTALL) -D -m 644 modprobe.conf.sample $(DESTDIR)$(MODPROBE_FILE) endif ifeq (,$(wildcard $(DESTDIR)$(BLACKLIST_FILE))) $(INSTALL) -D -m 644 blacklist.sample $(DESTDIR)$(BLACKLIST_FILE) endif ifneq (,$(COPY_NETSCR)) $(COPY_NETSCR) endif ifneq (,$(ADD_INITD)) $(ADD_INITD) endif @echo "DAHDI has been configured." @echo "" @echo "If you have any DAHDI hardware it is now recommended you " @echo "edit /etc/dahdi/modules in order to load support for only" @echo "the DAHDI hardware installed in this system. By default " @echo "support for all DAHDI hardware is loaded at DAHDI start. " @echo "" @echo "I think that the DAHDI hardware you have on your system is:" @xpp/dahdi_hardware || true update: @if [ -d .svn ]; then \ echo "Updating from Subversion..." ; \ svn update | tee update.out; \ rm -f .version; \ if [ `grep -c ^C update.out` -gt 0 ]; then \ echo ; echo "The following files have conflicts:" ; \ grep ^C update.out | cut -b4- ; \ fi ; \ rm -f update.out; \ else \ echo "Not under version control"; \ fi clean: -@$(MAKE) -C menuselect clean rm -f $(BINS) $(TEST_BINS) rm -f *.o dahdi_cfg tzdriver sethdlc rm -f $(LTZ_SO) $(LTZ_A) *.lo @for dir in $(SUBDIRS_UTILS_ALL); do \ $(MAKE) -C $$dir clean; \ done @for dir in $(SUBDIRS_UTILS); do \ $(MAKE) -C $$dir clean; \ done rm -f libtonezone* rm -f fxotune rm -f core rm -f dahdi_cfg-shared fxstest rm -rf $(GENERATED_DOCS) *.asciidoc tonezones.txt distclean: dist-clean dist-clean: clean @$(MAKE) -C menuselect dist-clean rm -f makeopts menuselect.makeopts menuselect-tree build_tools/menuselect-deps rm -f config.log config.status rm -f .*.d config.status: configure @CFLAGS="" ./configure @echo "****" @echo "**** The configure script was just executed, so 'make' needs to be" @echo "**** restarted." @echo "****" @exit 1 menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts menuselect/menuselect --check-deps $@ $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuconfig: menuselect cmenuconfig: cmenuselect gmenuconfig: gmenuselect nmenuconfig: nmenuselect menuselect: menuselect/cmenuselect menuselect/nmenuselect menuselect/gmenuselect @if [ -x menuselect/nmenuselect ]; then \ $(MAKE) nmenuselect; \ elif [ -x menuselect/cmenuselect ]; then \ $(MAKE) cmenuselect; \ elif [ -x menuselect/gmenuselect ]; then \ $(MAKE) gmenuselect; \ else \ echo "No menuselect user interface found. Install ncurses,"; \ echo "newt or GTK libraries to build one and re-rerun"; \ echo "'make menuselect'."; \ fi cmenuselect: menuselect/cmenuselect menuselect-tree -@menuselect/cmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!" gmenuselect: menuselect/gmenuselect menuselect-tree -@menuselect/gmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!" nmenuselect: menuselect/nmenuselect menuselect-tree -@menuselect/nmenuselect menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) && echo "menuselect changes saved!" || echo "menuselect changes NOT saved!" # options for make in menuselect/ MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent" menuselect/menuselect: menuselect/makeopts $(MAKE_MENUSELECT) menuselect menuselect/cmenuselect: menuselect/makeopts $(MAKE_MENUSELECT) cmenuselect menuselect/gmenuselect: menuselect/makeopts $(MAKE_MENUSELECT) gmenuselect menuselect/nmenuselect: menuselect/makeopts $(MAKE_MENUSELECT) nmenuselect menuselect/makeopts: makeopts $(MAKE_MENUSELECT) makeopts menuselect-tree: dahdi.xml @echo "Generating input for menuselect ..." @build_tools/make_tree > $@ .PHONY: menuselect distclean dist-clean clean all _all install programs tests devel data config update install-programs install-libs install-utils-subdirs utils-subdirs prereq FORCE: ifneq ($(wildcard .*.d),) include .*.d endif dahdi-tools-2.2.0-rc2/dahdi_speed.c0000664000000000000000000000271611111641664015512 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * * Generic speed test -- Run an infinite loop and * see how high we can count (in 5 seconds). You * can use this to measure how much CPU DAHDI REALLY * is taking. * * MUST BE COMPILED WITHOUT OPTIMIZATION * */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include "dahdi_tools_version.h" static long count=0; static void alm(int sig) { printf("Count: %ld\n", count); exit(0); } int main(int argc, char *argv[]) { int a=0,b=0,c; signal(SIGALRM, alm); alarm(5); for (;;) { for (c=0;c<1000;c++) a = a * b; count++; } } dahdi-tools-2.2.0-rc2/README0000664000000000000000000001575511153312553014002 0ustar rootrootDAHDI Telephony Interface Driver ================================= Asterisk Development Team $Revision: 6078 $, $Date: 2009-03-03 14:39:07 -0600 (Tue, 03 Mar 2009) $ DAHDI stands for Digium Asterisk Hardware Device Interface. This package contains the userspace tools to configure the kernel modules included in the package dahdi-linux. Build Requirements ------------------ This package needs the headers from dahdi-linux. Thus you should install dahdi-linux before building dahdi-tools. Build System ~~~~~~~~~~~~ gcc and friends. Generally you will need to install the package gcc. There may be cases where you will need a specific version of gcc to build kernel modules. Extra Libraries ~~~~~~~~~~~~~~~ Some libraries are needed for extra utilities that are provided with DAHDI. - libusb is needed for building fpga_load, needed for firmware loading of the Xorcom Astribank. - libnewt is needed to build the optional but useful utility dahdi_tool. Installation ~~~~~~~~~~~~ Note: If using `sudo` to build/install, you may need to add /sbin to your PATH. ---------------------------------- ./configure # optional step: select custom configuration: #make menuselect make make install # To install init scripts and config files: #make config ---------------------------------- Build Tweaks ~~~~~~~~~~~~ Partial Build/Install ^^^^^^^^^^^^^^^^^^^^^ There are some make targets that are provided to build or install just parts of DAHDI: . Build targets: - make: Build DAHDI userspace programs. partial targets of it: * make 'utilname': builds 'utilname' alone (e.g: `make dahdi_diag`) * make utils: Build libtonezone. * make libs: Build libtonezone. . Install targets: - make install: Installs user space tools into /usr/sbin/ (TODO - list partial targets) - make config: should be run once to configure Installation to a Subtree ^^^^^^^^^^^^^^^^^^^^^^^^^ The following may be useful when testing the package or when preparing a package for a binary distribution (such as an rpm package) installing onto a subtree rather than on th real system. make install DESTDIR=targetdir This can be useful for any partial install target from the list above. ./configure Options ^^^^^^^^^^^^^^^^^^^ The configure script various several tests and based on them generates some files ( build_tools/menuselect-deps and makeopts). You can pass it --with options and variable settings, for instance: ./configure --without-ncurses CC="gcc-4.10" If you just want to recreate the same files without a full detection run, use: ./config.status To re-run ./configure with the same parameters it was run with last time, use: ./ocnfig.status --recheck Configuration ------------- Configuration for DAHDI resides under /etc/dahdi . /etc/dahdi/system.conf ~~~~~~~~~~~~~~~~~~~~~~ The main method to configure DAHDI devices is using the utility *dahdi_cfg*. dahdi_cfg reads data from the configuration file /etc/dahdi/system.conf , figures out what configuration to send to channels, and send it to the kernel. A sample annotated system.conf is included in this directory and installed by default. Edit it to suit your configuration. Alternatively use the script dahdi_genconf to generate one that should work with your system. /etc/dahdi/init.conf ~~~~~~~~~~~~~~~~~~~~ The configuration file of the dahdi init.d script is /etc/dahdi/init.conf . That file is used to override defaults that are set at the beginning of the init.d script. Reference Configuration ~~~~~~~~~~~~~~~~~~~~~~~ Sample system.conf ~~~~~~~~~~~~~~~~~~ include::system.conf.asciidoc[] Sample init.conf ~~~~~~~~~~~~~~~~ include::init.conf.asciidoc[] Sample genconf_parameters ~~~~~~~~~~~~~~~~~~~~~~~~~ FIXME: still not properly formatted. include::genconf_parameters.asciidoc[] Tonezones ~~~~~~~~~ The file zonedata.c contains the information about the tone zones used in libtonezone (and hence also in ztcfg). Here is a list of those zones: include::tonezones.txt[] DAHDI PERL modules ~~~~~~~~~~~~~~~~~~ The directory xpp has, in addition to helper utilities for the Xorcom Astribank, a collection of perl modules to provide information related to DAHDI. The perl modules themselves are under xpp/perl_modules/ . In xpp/ there are several utilities that use those modules: - xpp-specific: dahdi_registration, xpp_sync, xpp_blink . - General: lsdahdi, dahdi_genconf, dahdi_hardware, dahdi_drivers The DAHDI perl modules will currently only be automatically installed if you happen to install the xpp directory. Those utilities require the perl modules to be installed, however they will also look for them in the directory perl_modules, and thus can be run directly from the DAHDI source tree. For example: ./xpp/dahdi_hardware -v To get usage information on a program, you can also use perldoc (sometimes provided in a package separate from perl itself). For instance: perldoc ./xpp/lsdahdi Some of them are specific for the Xorcom Astribank and described in its docuemntation. the others are: lsdahdi:: A somewhat glorified `cat /proc/dahdi/*`. dahdi_genconf:: Generates configuration based on the existing DAHDI channels and on /etc/dahdi/genconf_parameters (replaces genzaptelconf as well). dahdi_drivers:: A two-liner script (not installed by default) that simply returns the modules that should be modprobed on this system. dahdi_hardware:: Uses the information from sysfs and its own knowledge to show what PCI/USB DAHDI hardware is connected and if it is currently used by a driver. Shows also some more information for Astribanks from /proc/xpp . PPP Support ~~~~~~~~~~~ DAHDI digital cards can provide data channels through ppp as point-to-point connections. This requires a plugin to the ppp daemon that is included in the ppp/ subdirectory. To install it: 1. Make sure you have the PPP source / headers installed. On Debian: apt-get install ppp-dev 2. Run 'make' on the ppp subdirectory: make -C ppp make -C ppp install 3. Make sure your kernel has support for both PPP (which is common is distribution kernels and for HDLC (much less common) - CONFIG_PPP and CONFIG_HDLC . include::UPGRADE.txt[] License ------- This package is distributed under the terms of the GNU General Public License Version 2, except for some components which are distributed under the terms of the GNU Lesser General Public License Version 2.1. Both licenses are included in this directory, and each file is clearly marked as to which license applies. If you wish to use the DAHDI drivers in an application for which the license terms are not appropriate (e.g. a proprietary embedded system), licenses under more flexible terms can be readily obtained through Digium, Inc. at reasonable cost. Reporting Bugs -------------- Please report bug and patches to the Asterisk bug tracker at http://bugs.digium.com/[] in the "DAHDI" category. Links ----- - http://asterisk.org/[] - The Asterisk PBX - http://voip-info.org/[] - http://voip-info.org/wiki/view/DAHDI[] - http://docs.tzafrir.org.il/dahdi-tools/README.html[Up-to-date HTML version of this file] dahdi-tools-2.2.0-rc2/sethdlc.c0000664000000000000000000003570711055276445014725 0ustar rootroot/* * sethdlc.c * * Copyright (C) 1999 - 2002 Krzysztof Halasa * */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "dahdi_tools_version.h" #if GENERIC_HDLC_VERSION != 4 #error Generic HDLC layer version mismatch, please get correct sethdlc.c #endif #if !defined(IF_PROTO_HDLC_ETH) || !defined(IF_PROTO_FR_ETH_PVC) #warning "No kernel support for Ethernet over Frame Relay / HDLC, skipping it" #endif static struct ifreq req; /* for ioctl */ static int argc; static char **argv; int sock; static void error(const char *format, ...) __attribute__ ((noreturn, format(printf, 1, 2))); static void error(const char *format, ...) { va_list args; va_start(args, format); fprintf(stderr, "%s: ", req.ifr_name); vfprintf(stderr, format, args); va_end(args); exit(1); } typedef struct { const char *name; const unsigned int value; } parsertab; static int checkkey(const char* name) { if (argc < 1) return -1; /* no enough parameters */ if (strcmp(name, argv[0])) return -1; argc--; argv++; return 0; } static int checktab(parsertab *tab, unsigned int *value) { int i; if (argc < 1) return -1; /* no enough parameters */ for (i = 0; tab[i].name; i++) if (!strcmp(tab[i].name, argv[0])) { argc--; argv++; *value = tab[i].value; return 0; } return -1; /* Not found */ } static const char* tabstr(unsigned int value, parsertab *tab, const char* unknown) { int i; for (i = 0; tab[i].name; i++) if (tab[i].value == value) return tab[i].name; return unknown; /* Not found */ } static unsigned int match(const char* name, unsigned int *value, unsigned int minimum, unsigned int maximum) { char test; if (argc < 1) return -1; /* no enough parameters */ if (name) { if (strcmp(name, argv[0])) return -1; argc--; argv++; } if (argc < 1) error("Missing parameter\n"); if (sscanf(argv[0], "%u%c", value, &test) != 1) error("Invalid parameter: %s\n", argv[0]); if ((*value > maximum) || (*value < minimum)) error("Parameter out of range [%u - %u]: %u\n", minimum, maximum, *value); argc--; argv++; return 0; } static parsertab ifaces[] = {{ "v35", IF_IFACE_V35 }, { "v24", IF_IFACE_V24 }, { "x21", IF_IFACE_X21 }, { "e1", IF_IFACE_E1 }, { "t1", IF_IFACE_T1 }, { NULL, 0 }}; static parsertab clocks[] = {{ "int", CLOCK_INT }, { "ext", CLOCK_EXT }, { "txint", CLOCK_TXINT }, { "txfromrx", CLOCK_TXFROMRX }, { NULL, 0 }}; static parsertab protos[] = {{ "hdlc", IF_PROTO_HDLC}, { "cisco", IF_PROTO_CISCO}, { "fr", IF_PROTO_FR}, { "ppp", IF_PROTO_PPP}, { "x25", IF_PROTO_X25}, #ifdef IF_PROTO_HDLC_ETH { "hdlc-eth", IF_PROTO_HDLC_ETH}, #endif { NULL, 0 }}; static parsertab hdlc_enc[] = {{ "nrz", ENCODING_NRZ }, { "nrzi", ENCODING_NRZI }, { "fm-mark", ENCODING_FM_MARK }, { "fm-space", ENCODING_FM_SPACE }, { "manchester", ENCODING_MANCHESTER }, { NULL, 0 }}; static parsertab hdlc_par[] = {{ "no-parity", PARITY_NONE }, { "crc16", PARITY_CRC16_PR1 }, { "crc16-pr0", PARITY_CRC16_PR0 }, { "crc16-itu", PARITY_CRC16_PR1_CCITT }, { "crc16-itu-pr0", PARITY_CRC16_PR0_CCITT }, { "crc32-itu", PARITY_CRC32_PR1_CCITT }, { NULL, 0 }}; static parsertab lmi[] = {{ "none", LMI_NONE }, { "ansi", LMI_ANSI }, { "ccitt", LMI_CCITT }, { NULL, 0 }}; static void set_iface(void) { int orig_argc = argc; te1_settings te1; memset(&te1, 0, sizeof(te1)); req.ifr_settings.type = IF_IFACE_SYNC_SERIAL; while (argc > 0) { if (req.ifr_settings.type == IF_IFACE_SYNC_SERIAL) if (!checktab(ifaces, &req.ifr_settings.type)) continue; if (!te1.clock_type) if (!checkkey("clock")) { if (!checktab(clocks, &te1.clock_type)) continue; error("Invalid clock type\n"); } if (!te1.clock_rate && (te1.clock_type == CLOCK_INT || te1.clock_type == CLOCK_TXINT)) if (!match("rate", &te1.clock_rate, 1, 0xFFFFFFFF)) continue; if (!te1.loopback) { if (!checkkey("loopback") || !checkkey("lb")) { te1.loopback = 1; continue; } } /* slotmap goes here */ if (orig_argc == argc) return; /* not an iface definition */ error("Invalid parameter: %s\n", argv[0]); } if (!te1.clock_rate && (te1.clock_type == CLOCK_INT || te1.clock_type == CLOCK_TXINT)) te1.clock_rate = 64000; /* FIXME stupid hack, will remove it later */ req.ifr_settings.ifs_ifsu.te1 = &te1; if (req.ifr_settings.type == IF_IFACE_E1 || req.ifr_settings.type == IF_IFACE_T1) req.ifr_settings.size = sizeof(te1_settings); else req.ifr_settings.size = sizeof(sync_serial_settings); if (ioctl(sock, SIOCWANDEV, &req)) error("Unable to set interface information: %s\n", strerror(errno)); exit(0); } static void set_proto_fr(void) { unsigned int lmi_type = 0; fr_proto fr; memset(&fr, 0, sizeof(fr)); while (argc > 0) { if (!lmi_type) if (!checkkey("lmi")) { if (!checktab(lmi, &lmi_type)) continue; error("Invalid LMI type: %s\n", argv[0]); } if (lmi_type && lmi_type != LMI_NONE) { if (!fr.dce) if (!checkkey("dce")) { fr.dce = 1; continue; } if (!fr.t391) if (!match("t391", &fr.t391, 1, 1000)) continue; if (!fr.t392) if (!match("t392", &fr.t392, 1, 1000)) continue; if (!fr.n391) if (!match("n391", &fr.n391, 1, 1000)) continue; if (!fr.n392) if (!match("n392", &fr.n392, 1, 1000)) continue; if (!fr.n393) if (!match("n393", &fr.n393, 1, 1000)) continue; } error("Invalid parameter: %s\n", argv[0]); } /* polling verification timer*/ if (!fr.t391) fr.t391 = 10; /* link integrity verification polling timer */ if (!fr.t392) fr.t392 = 15; /* full status polling counter*/ if (!fr.n391) fr.n391 = 6; /* error threshold */ if (!fr.n392) fr.n392 = 3; /* monitored events count */ if (!fr.n393) fr.n393 = 4; if (!lmi_type) fr.lmi = LMI_DEFAULT; else fr.lmi = lmi_type; req.ifr_settings.ifs_ifsu.fr = &fr; req.ifr_settings.size = sizeof(fr); if (ioctl(sock, SIOCWANDEV, &req)) error("Unable to set FR protocol information: %s\n", strerror(errno)); } static void set_proto_hdlc(int eth) { unsigned int enc = 0, par = 0; raw_hdlc_proto raw; memset(&raw, 0, sizeof(raw)); while (argc > 0) { if (!enc) if (!checktab(hdlc_enc, &enc)) continue; if (!par) if (!checktab(hdlc_par, &par)) continue; error("Invalid parameter: %s\n", argv[0]); } if (!enc) raw.encoding = ENCODING_DEFAULT; else raw.encoding = enc; if (!par) raw.parity = ENCODING_DEFAULT; else raw.parity = par; req.ifr_settings.ifs_ifsu.raw_hdlc = &raw; req.ifr_settings.size = sizeof(raw); if (ioctl(sock, SIOCWANDEV, &req)) error("Unable to set HDLC%s protocol information: %s\n", eth ? "-ETH" : "", strerror(errno)); } static void set_proto_cisco(void) { cisco_proto cisco; memset(&cisco, 0, sizeof(cisco)); while (argc > 0) { if (!cisco.interval) if (!match("interval", &cisco.interval, 1, 100)) continue; if (!cisco.timeout) if (!match("timeout", &cisco.timeout, 1, 100)) continue; error("Invalid parameter: %s\n", argv[0]); } if (!cisco.interval) cisco.interval = 10; if (!cisco.timeout) cisco.timeout = 25; req.ifr_settings.ifs_ifsu.cisco = &cisco; req.ifr_settings.size = sizeof(cisco); if (ioctl(sock, SIOCWANDEV, &req)) error("Unable to set Cisco HDLC protocol information: %s\n", strerror(errno)); } static void set_proto(void) { if (checktab(protos, &req.ifr_settings.type)) return; switch(req.ifr_settings.type) { case IF_PROTO_HDLC: set_proto_hdlc(0); break; #ifdef IF_PROTO_HDLC_ETH case IF_PROTO_HDLC_ETH: set_proto_hdlc(1); break; #endif case IF_PROTO_CISCO: set_proto_cisco(); break; case IF_PROTO_FR: set_proto_fr(); break; case IF_PROTO_PPP: case IF_PROTO_X25: req.ifr_settings.ifs_ifsu.sync = NULL; /* FIXME */ req.ifr_settings.size = 0; if (!ioctl(sock, SIOCWANDEV, &req)) break; error("Unable to set %s protocol information: %s\n", req.ifr_settings.type == IF_PROTO_PPP ? "PPP" : "X.25", strerror(errno)); default: error("Unknown protocol %u\n", req.ifr_settings.type); } if (argc > 0) error("Unexpected parameter: %s\n", argv[0]); close(sock); exit(0); } static void set_pvc(void) { char *op = argv[0]; parsertab ops[] = {{ "create", IF_PROTO_FR_ADD_PVC }, { "delete", IF_PROTO_FR_DEL_PVC }, { NULL, 0 }}; fr_proto_pvc pvc; memset(&pvc, 0, sizeof(pvc)); if (checktab(ops, &req.ifr_settings.type)) return; #ifdef IF_PROTO_FR_ETH_PVC if (!match("ether", &pvc.dlci, 0, 1023)) { if (req.ifr_settings.type == IF_PROTO_FR_ADD_PVC) req.ifr_settings.type = IF_PROTO_FR_ADD_ETH_PVC; else req.ifr_settings.type = IF_PROTO_FR_DEL_ETH_PVC; } else #endif if (match(NULL, &pvc.dlci, 0, 1023)) return; if (argc != 0) return; req.ifr_settings.ifs_ifsu.fr_pvc = &pvc; req.ifr_settings.size = sizeof(pvc); if (ioctl(sock, SIOCWANDEV, &req)) error("Unable to %s PVC: %s\n", op, strerror(errno)); exit(0); } static void private(void) { if (argc < 1) return; if (!strcmp(argv[0], "private")) { if (argc != 1) return; if (ioctl(sock, SIOCDEVPRIVATE, &req)) error("SIOCDEVPRIVATE: %s\n", strerror(errno)); exit(0); } } static void show_port(void) { const char *s; char buffer[128]; const te1_settings *te1 = (void*)buffer; const raw_hdlc_proto *raw = (void*)buffer; const cisco_proto *cisco = (void*)buffer; const fr_proto *fr = (void*)buffer; #ifdef IF_PROTO_FR_PVC const fr_proto_pvc_info *pvc = (void*)buffer; #endif req.ifr_settings.ifs_ifsu.sync = (void*)buffer; /* FIXME */ printf("%s: ", req.ifr_name); req.ifr_settings.size = sizeof(buffer); req.ifr_settings.type = IF_GET_IFACE; if (ioctl(sock, SIOCWANDEV, &req)) if (errno != EINVAL) { printf("unable to get interface information: %s\n", strerror(errno)); close(sock); exit(1); } /* Get and print physical interface settings */ if (req.ifr_settings.type == IF_IFACE_SYNC_SERIAL) s = ""; /* Unspecified serial interface */ else s = tabstr(req.ifr_settings.type, ifaces, NULL); if (!s) printf("unknown interface 0x%x\n", req.ifr_settings.type); else { if (*s) printf("interface %s ", s); printf("clock %s", tabstr(te1->clock_type, clocks, "type unknown")); if (te1->clock_type == CLOCK_INT || te1->clock_type == CLOCK_TXINT) printf(" rate %u", te1->clock_rate); if (te1->loopback) printf(" loopback"); if (req.ifr_settings.type == IF_IFACE_E1 || req.ifr_settings.type == IF_IFACE_T1) { unsigned int u; printf(" slotmap "); for (u = te1->slot_map; u != 0; u /= 2) printf("%u", u % 2); } printf("\n"); } /* Get and print protocol settings */ do { printf("\t"); req.ifr_settings.size = sizeof(buffer); req.ifr_settings.type = IF_GET_PROTO; if (ioctl(sock, SIOCWANDEV, &req)) { if (errno == EINVAL) printf("no protocol set\n"); else printf("unable to get protocol information: " "%s\n", strerror(errno)); break; } switch(req.ifr_settings.type) { case IF_PROTO_FR: printf("protocol fr lmi %s", tabstr(fr->lmi, lmi, "unknown")); if (fr->lmi == LMI_ANSI || fr->lmi == LMI_CCITT) printf("%s t391 %u t392 %u n391 %u n392 %u " "n393 %u\n", fr->dce ? " dce" : "", fr->t391, fr->t392, fr->n391, fr->n392, fr->n393); else putchar('\n'); break; #ifdef IF_PROTO_FR_PVC case IF_PROTO_FR_PVC: printf("Frame-Relay PVC: DLCI %u, master device %s\n", pvc->dlci, pvc->master); break; #endif #ifdef IF_PROTO_FR_ETH_PVC case IF_PROTO_FR_ETH_PVC: printf("Frame-Relay PVC (Ethernet emulation): DLCI %u," " master device %s\n", pvc->dlci, pvc->master); break; #endif case IF_PROTO_HDLC: printf("protocol hdlc %s %s\n", tabstr(raw->encoding, hdlc_enc, "unknown"), tabstr(raw->parity, hdlc_par, "unknown")); break; #ifdef IF_PROTO_HDLC_ETH case IF_PROTO_HDLC_ETH: printf("protocol hdlc-eth %s %s\n", tabstr(raw->encoding, hdlc_enc, "unknown"), tabstr(raw->parity, hdlc_par, "unknown")); break; #endif case IF_PROTO_CISCO: printf("protocol cisco interval %u timeout %u\n", cisco->interval, cisco->timeout); break; case IF_PROTO_PPP: printf("protocol ppp\n"); break; case IF_PROTO_X25: printf("protocol x25\n"); break; default: printf("unknown protocol %u\n", req.ifr_settings.type); } }while(0); close(sock); exit(0); } static void usage(void) { fprintf(stderr, "sethdlc version 1.15\n" "Copyright (C) 2000 - 2003 Krzysztof Halasa \n" "\n" "Usage: sethdlc INTERFACE [PHYSICAL] [clock CLOCK] [LOOPBACK] " "[slotmap SLOTMAP]\n" " sethdlc INTERFACE [PROTOCOL]\n" " sethdlc INTERFACE create | delete" #ifdef IF_PROTO_FR_ETH_PVC " [ether]" #endif " DLCI\n" " sethdlc INTERFACE private...\n" "\n" "PHYSICAL := v24 | v35 | x21 | e1 | t1\n" "CLOCK := int [rate RATE] | ext | txint [rate RATE] | txfromrx\n" "LOOPBACK := loopback | lb\n" "\n" "PROTOCOL := hdlc [ENCODING] [PARITY] |\n" #ifdef IF_PROTO_HDLC_ETH " hdlc-eth [ENCODING] [PARITY] |\n" #endif " cisco [interval val] [timeout val] |\n" " fr [lmi LMI] |\n" " ppp |\n" " x25\n" "\n" "ENCODING := nrz | nrzi | fm-mark | fm-space | manchester\n" "PARITY := no-parity | crc16 | crc16-pr0 | crc16-itu | crc16-itu-pr0 | crc32-itu\n" "LMI := none | ansi [LMI_SPEC] | ccitt [LMI_SPEC]\n" "LMI_SPEC := [dce] [t391 val] [t392 val] [n391 val] [n392 val] [n393 val]\n"); exit(0); } int main(int arg_c, char *arg_v[]) { argc = arg_c; argv = arg_v; if (argc <= 1) usage(); sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); if (sock < 0) error("Unable to create socket: %s\n", strerror(errno)); dahdi_copy_string(req.ifr_name, argv[1], sizeof(req.ifr_name)); /* Device name */ if (argc == 2) show_port(); argc -= 2; argv += 2; set_iface(); set_proto(); set_pvc(); private(); close(sock); usage(); exit(0); } dahdi-tools-2.2.0-rc2/dahdi_test.c0000664000000000000000000000754011111641664015371 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include "dahdi_tools_version.h" #define SIZE 8000 static int pass = 0; static float best = 0.0; static float worst = 100.0; static double total = 0.0; static double delay_total = 0.0; void hup_handler(int sig) { printf("\n--- Results after %d passes ---\n", pass); printf("Best: %.3f -- Worst: %.3f -- Average: %f, Difference: %f\n", best, worst, pass ? total/pass : 100.00, pass ? delay_total/pass : 100); exit(0); } static void usage(char *argv0) { char *c; c = strrchr(argv0, '/'); if (!c) c = argv0; else c++; fprintf(stderr, "Usage: %s [-c COUNT] [-v]\n" " Valid options are:\n" " -c COUNT Run just COUNT cycles (otherwise: forever).\n" " -v More verbose output.\n" " -h This help text.\n" , c); } int main(int argc, char *argv[]) { int fd; int res; int c; int count = 0; int seconds = 0; int curarg = 1; int verbose = 0; char buf[8192]; float score; float ms; struct timeval start, now; fd = open("/dev/dahdi/pseudo", O_RDWR); if (fd < 0) { fprintf(stderr, "Unable to open dahdi interface: %s\n", strerror(errno)); exit(1); } while ((c = getopt(argc, argv, "c:hv")) != -1) { switch(c) { case 'c': seconds = atoi(optarg); break; case 'h': usage(argv[0]); exit(0); break; case '?': usage(argv[0]); exit(1); break; case 'v': verbose++; break; } } while (curarg < argc) { if (!strcasecmp(argv[curarg], "-v")) verbose++; if (!strcasecmp(argv[curarg], "-c") && argc > curarg) seconds = atoi(argv[curarg + 1]); curarg++; } printf("Opened pseudo dahdi interface, measuring accuracy...\n"); signal(SIGHUP, hup_handler); signal(SIGINT, hup_handler); signal(SIGALRM, hup_handler); /* Flush input buffer */ for (count = 0; count < 4; count++) res = read(fd, buf, sizeof(buf)); count = 0; ms = 0; /* Makes the compiler happy */ if (seconds > 0) alarm(seconds + 1); /* This will give 'seconds' cycles */ for (;;) { if (count == 0) ms = 0; gettimeofday(&start, NULL); res = read(fd, buf, sizeof(buf)); if (res < 0) { fprintf(stderr, "Failed to read from pseudo interface: %s\n", strerror(errno)); exit(1); } count += res; gettimeofday(&now, NULL); ms += (now.tv_sec - start.tv_sec) * 8000; ms += (now.tv_usec - start.tv_usec) / 125.0; if (count >= SIZE) { double percent = 100.0 * (count - ms) / count; if (verbose) { printf("\n%d samples in %0.3f system clock sample intervals (%.3f%%)", count, ms, 100 - percent); } else if (pass > 0 && (pass % 8) == 0) { printf("\n"); } score = 100.0 - fabs(percent); if (score > best) best = score; if (score < worst) worst = score; if (!verbose) printf("%.3f%% ", score); total += score; delay_total += 100 - percent; fflush(stdout); count = 0; pass++; } } } dahdi-tools-2.2.0-rc2/bootstrap.sh0000775000000000000000000000066211015552613015465 0ustar rootroot#!/bin/sh check_for_app() { $1 --version 2>&1 >/dev/null if [ $? != 0 ] then echo "Please install $1 and run bootstrap.sh again!" exit 1 fi } AUTOCONF_VERSION=2.59 AUTOMAKE_VERSION=1.9 export AUTOCONF_VERSION export AUTOMAKE_VERSION check_for_app autoconf check_for_app automake check_for_app aclocal echo "Generating the configure script ..." aclocal 2>/dev/null autoconf automake --add-missing --copy 2>/dev/null exit 0 dahdi-tools-2.2.0-rc2/blacklist.sample0000664000000000000000000000051111165074230016255 0ustar rootroot# blacklist all the drivers by default in order to ensure that # /etc/init.d/dahdi installs them in the correct order so that the spans are # ordered consistently. blacklist wct4xxp blacklist wcte12xp blacklist wct1xxp blacklist wcte11xp blacklist wctdm24xxp blacklist wcfxo blacklist wctdm blacklist wctc4xxp blacklist wcb4xxp dahdi-tools-2.2.0-rc2/fxotune.h0000664000000000000000000001002011046162606014742 0ustar rootroot/* * fxotune.h -- data structures and associated definitions for fxotune.c * * By Matthew Fredrickson * * Echo coefficients and acim register values taken from AN84 from Silicon * Laboratories app note AN84 for setting echo cancellation coefficients * * (C) 2005 Digium, Inc. */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ struct wctdm_echo_coefs echo_trys [] = { /* 600 ohm echo settings */ { 0, 0, 0, 0, 0, 0, 0, 0, 0}, { 10, 0, 6, 1, 254, 2, 255, 0, 0}, { 3, 255, 255, 0, 1, 0, 0, 0, 0}, { 3, 1, 253, 253, 2, 255, 0, 0, 0}, { 9, 254, 251, 255, 2, 0, 1, 0, 0}, { 5, 3, 251, 250, 2, 254, 0, 0, 255}, { 8, 253, 2, 244, 255, 10, 244, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* 900 ohm echo settings */ { 1, 0, 0, 0, 0, 0, 0, 0, 0}, { 10, 252, 255, 1, 255, 0, 0, 0, 0}, { 7, 255, 251, 251, 2, 255, 255, 1, 255}, { 3, 1, 251, 250, 1, 254, 255, 0, 255}, { 5, 252, 250, 0, 0, 255, 1, 0, 0}, { 5, 3, 251, 250, 1, 253, 0, 0, 255}, { 8, 253, 2, 244, 255, 10, 244, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* 270 ohm + (750 ohm || 150 nF) (CTR21) */ { 2, 0, 0, 0, 0, 0, 0, 0, 0}, { 7, 0, 0, 255, 254, 0, 0, 0, 0}, { 9, 0, 253, 254, 2, 255, 0, 0, 0}, { 5, 1, 249, 254, 4, 253, 1, 0, 0}, { 5, 252, 250, 1, 1, 254, 0, 255, 0}, { 5, 3, 251, 250, 2, 253, 255, 255, 255}, { 8, 253, 2, 244, 255, 10, 244, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* 220 ohm + (820 ohm || 120 nF) (Australia/NewZealand) and 220 ohm + (820 ohm * || 115nF) (Slovakia/SAfrica/Germany/Austria/Bulgaria) */ { 3, 0, 0, 0, 0, 0, 0, 0, 0}, { 7, 0, 255, 254, 255, 0, 255, 0, 0}, { 9, 0, 253, 253, 1, 255, 0, 0, 0}, { 5, 1, 249, 254, 3, 253, 1, 0, 0}, { 5, 252, 250, 1, 1, 254, 0, 255, 0}, { 5, 3, 251, 251, 2, 253, 255, 255, 255}, { 8, 253, 2, 244, 255, 10, 244, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* 370 ohm + (620ohm || 310nF) (New Zealand #2/India) CO Termination */ { 4, 0, 0, 0, 0, 0, 0, 0, 0}, { 9, 255, 1, 4, 0, 0, 1, 255, 0}, { 9, 0, 253, 0, 3, 254, 0, 0, 255}, { 9, 2, 250, 253, 5, 253, 1, 0 ,255}, { 5, 252, 250, 1, 2, 255, 0 ,255, 0}, { 5, 3, 251, 250, 3, 254, 255, 255, 255}, { 8, 253, 2, 244, 255, 10, 244, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* 320 ohm + (1050ohm || 230 nF) (England) CO Termination */ { 5, 0, 0, 0, 0, 0, 0, 0, 0}, { 9, 0 ,255, 1, 255, 255, 0, 255, 0}, { 5, 255, 252, 0, 2, 254, 0, 255, 255}, { 9, 2, 250, 253, 4, 252, 0, 255, 255}, { 5, 252, 250, 1, 1, 254, 0 ,255, 255}, { 5, 3, 251, 250, 2, 253, 255, 255, 254}, { 3, 1, 1, 242, 2, 9, 245, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* 370 ohm + (820 ohm || 110 nF) CO Termination */ { 6, 0, 0, 0, 0, 0, 0, 0, 0}, { 6, 1, 254, 253, 0, 255, 0, 0, 0}, { 9, 0, 251, 252, 2, 255, 0, 0, 0}, { 5, 1, 248, 252, 4, 253, 1, 0, 0}, { 5, 252, 250, 0, 0, 254, 0 , 255, 0}, { 5, 3, 251, 250, 2, 253, 255, 255, 254}, { 3, 1, 1, 242, 2, 9, 245, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* 275 ohm + (780 ohm || 115 nF) CO Termination */ { 7, 0, 0, 0, 0, 0, 0, 0, 0}, { 7, 255, 255, 255, 255, 0, 0, 0, 0}, { 9, 0, 253, 254, 2, 255, 0, 0, 0}, { 5, 1, 249, 254, 4, 253, 1, 0, 0}, { 5, 252, 250, 1, 1, 254, 0, 255, 0}, { 5, 3, 251, 250, 2, 253, 255, 255, 255}, { 8, 253, 2, 244, 255, 10, 244, 3, 253}, { 10, 249, 244, 8, 12, 245, 252, 0, 1}, /* Make sure we include the rest of the impedances */ { 8, 0, 0, 0, 0, 0, 0, 0, 0}, { 9, 0, 0, 0, 0, 0, 0, 0, 0}, { 10, 0, 0, 0, 0, 0, 0, 0, 0}, { 11, 0, 0, 0, 0, 0, 0, 0, 0}, { 12, 0, 0, 0, 0, 0, 0, 0, 0}, { 13, 0, 0, 0, 0, 0, 0, 0, 0}, { 14, 0, 0, 0, 0, 0, 0, 0, 0}, { 15, 0, 0, 0, 0, 0, 0, 0, 0}, }; dahdi-tools-2.2.0-rc2/configure.ac0000664000000000000000000001172411134113442015373 0ustar rootroot# Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) m4_define([TOOLSVERSION], m4_bpatsubst(m4_esyscmd([build_tools/make_version . dahdi/tools]), [\([0-9.]*\)\(\w\|\W\)*], [\1])) AC_INIT(dahdi, TOOLSVERSION, www.asterisk.org) # check existence of the package AC_CONFIG_SRCDIR([dahdi_cfg.c]) AC_COPYRIGHT("dahdi-tools") AC_REVISION($Revision: 5662 $) ac_default_prefix=/usr if test ${sysconfdir} = '${prefix}/etc'; then sysconfdir=/etc fi if test ${mandir} = '${prefix}/man'; then mandir=/usr/share/man fi if test ${localstatedir} = '${prefix}/var'; then localstatedir=/var fi # This needs to be before any macros that use the C compiler AC_GNU_SOURCE # Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AST_CHECK_GNU_MAKE test_obj=conftest.o AC_COMPILE_IFELSE(AC_LANG_SOURCE(),[ BDFNAME=`LANG=C objdump -f $test_obj | grep -e "$test_obj:" | sed "s/.*file format \(.*\)/\1/"` BDFARCH=`LANG=C objdump -f $test_obj | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"` ],[]) AC_SUBST(BDFNAME) AC_SUBST(BDFARCH) # Set the default value of HOSTCC from CC if --host was not provided: HOSTCC=${HOSTCC:=${CC}} AC_SUBST(HOSTCC) AC_PATH_PROG([GREP], [grep], :) AC_PATH_PROG([SHELL], [sh], :) AC_PATH_PROG([LN], [ln], :) AC_PATH_PROG([WGET], [wget], :) if test "${WGET}" != ":" ; then DOWNLOAD=${WGET} else AC_PATH_PROG([FETCH], [fetch], [:]) DOWNLOAD=${FETCH} fi AC_SUBST(DOWNLOAD) AC_LANG(C) AC_ARG_ENABLE(dev-mode, [ --enable-dev-mode Turn on developer mode], [case "${enableval}" in y|ye|yes) DAHDI_DEVMODE=yes ;; n|no) DAHDI_DEVMODE=no ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-dev-mode) ;; esac]) AC_SUBST(DAHDI_DEVMODE) AC_MSG_CHECKING(for -Wdeclaration-after-statement support) if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then AC_MSG_RESULT(yes) DAHDI_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement else AC_MSG_RESULT(no) DAHDI_DECLARATION_AFTER_STATEMENT= fi AC_SUBST(DAHDI_DECLARATION_AFTER_STATEMENT) AST_EXT_LIB_SETUP([DAHDI], [DAHDI], [dahdi]) AST_EXT_LIB_SETUP([NEWT], [newt], [newt]) AST_EXT_LIB_SETUP([USB], [usb], [usb]) AST_C_DEFINE_CHECK([DAHDI], [DAHDI_CODE], [dahdi/user.h]) AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h]) AST_EXT_LIB_CHECK([USB], [usb], [usb_init], [usb.h]) PBX_HDLC=0 AC_MSG_CHECKING([for GENERIC_HDLC_VERSION version 4 in linux/hdlc.h]) AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM( [#include ], [#if defined(GENERIC_HDLC_VERSION) && GENERIC_HDLC_VERSION >= 4 int foo = 0; #else int foo = bar; #endif 0])], [AC_MSG_RESULT(yes) PBX_HDLC=1], [AC_MSG_RESULT(no)] ) if test $PBX_HDLC = 0; then AC_MSG_CHECKING([for GENERIC_HDLC_VERSION version 4 in linux/hdlc/ioctl.h]) AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM( [ #include #include ], [#if defined(GENERIC_HDLC_VERSION) && GENERIC_HDLC_VERSION >= 4 int foo = 0; #else int foo = bar; #endif 0])], [AC_MSG_RESULT(yes) PBX_HDLC=1], [AC_MSG_RESULT(no)] ) fi if test "x${PBX_HDLC}" != "x1"; then AC_MSG_NOTICE([GENERIC_HDLC_VERSION (version 4) not found, disabling sethdlc.]) fi AC_SUBST(PBX_HDLC) AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable (with) / disable (without) SELinux])], [USE_SELINUX=$withval], [ if test ! -x /usr/sbin/sestatus; then USE_SELINUX=no; elif /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"; then USE_SELINUX=yes fi ] ) AC_SUBST(USE_SELINUX) # for asciidoc before ver. 7, the backend must be stated explicitly: ASCIIDOC='asciidoc' asciidoc_ver=`asciidoc --version 2>&1 | awk '/^asciidoc /{print $2}' | cut -d. -f 1 | head -n 1` if test "$asciidoc_ver" != '' && test $asciidoc_ver -lt 7; then ASCIIDOC="asciidoc -b xhtml" fi AC_SUBST(ASCIIDOC) AC_ARG_WITH(ppp, [AS_HELP_STRING([--with-ppp=PATH],[Use PPP support from PATH])], [], [with_ppp=check] ) # somebody will fix that default_ppp_path=/usr case "$with_ppp" in yes|check) ppp_path="$default_ppp_path";; no) ppp_path='' ;; *) ppp_path="$with_ppp" ;; esac level_file="$ppp_path/include/pppd/patchlevel.h" PPP_VERSION= if test "$ppp_path" != '' && test -r "$level_file"; then PPPD_VERSION=`awk -F '"' '/VERSION/ { print $$2; }' $level_file` fi case "$with_ppp" in check|no) :;; *) # If we asked explicitly for ppp support if test "$PPPD_VERSION" = ''; then # but have not detected it AC_MSG_ERROR(failed to find pppd/patchlevel.h: no ppp support.) fi ;; esac if test "x${PBX_DAHDI}" != "x1"; then AC_MSG_NOTICE([***]) AC_MSG_NOTICE([*** Building this package requires DAHDI support. *** ]) AC_MSG_NOTICE([*** Please install the dahdi-linux package. ***]) AC_MSG_NOTICE([***]) exit 1 fi AC_SUBST(PPPD_VERSION) AC_CONFIG_FILES([build_tools/menuselect-deps makeopts]) AC_OUTPUT AC_MSG_NOTICE(*** dahdi-tools build successfully configured ***) dahdi-tools-2.2.0-rc2/dahdi.init0000775000000000000000000001474011173570226015061 0ustar rootroot#!/bin/sh # # dahdi This shell script takes care of loading and unloading \ # DAHDI Telephony interfaces # chkconfig: 2345 9 92 # description: The DAHDI drivers allow you to use your linux \ # computer to accept incoming data and voice interfaces # # config: /etc/dahdi/init.conf ### BEGIN INIT INFO # Provides: dahdi # Required-Start: $local_fs $remote_fs # Required-Stop: # Should-Start: $network $syslog # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Description: dahdi - load and configure DAHDI modules ### END INIT INFO initdir=/etc/init.d # Don't edit the following values. Edit /etc/dahdi/init.conf instead. DAHDI_CFG=/usr/sbin/dahdi_cfg DAHDI_CFG_CMD="$DAHDI_CFG" # e.g: for a custom system.conf location FXOTUNE=/usr/sbin/fxotune # The default syncer Astribank. Usually set automatically to a sane # value by xpp_sync(1) if you have an Astribank. You can set this to an # explicit Astribank (e.g: 01). XPP_SYNC=auto # The maximal timeout (seconds) to wait for udevd to finish generating # device nodes after the modules have loaded and before running dahdi_cfg. DAHDI_DEV_TIMEOUT=20 # # Determine which kind of configuration we're using # system=redhat # assume redhat if [ -f /etc/debian_version ]; then system=debian fi if [ -f /etc/gentoo-release ]; then system=debian fi # Source function library. if [ $system = redhat ]; then . $initdir/functions || exit 0 fi DAHDI_MODULES_FILE="/etc/dahdi/modules" [ -r /etc/dahdi/init.conf ] && . /etc/dahdi/init.conf if [ $system = redhat ]; then LOCKFILE=/var/lock/subsys/dahdi fi # recursively unload a module and its dependencies, if possible. # where's modprobe -r when you need it? # inputs: module to unload. # returns: the result from unload_module() { module="$1" line=`lsmod 2>/dev/null | grep "^$1 "` if [ "$line" = '' ]; then return; fi # module was not loaded set -- $line # $1: the original module, $2: size, $3: refcount, $4: deps list mods=`echo $4 | tr , ' '` # xpp_usb keeps the xpds below busy if an xpp hardware is # connected. Hence must be removed before them: case "$module" in xpd_*) mods="xpp_usb $mods";; esac for mod in $mods; do # run in a subshell, so it won't step over our vars: (unload_module $mod) # TODO: the following is probably the error handling we want: # if [ $? != 0 ]; then return 1; fi done rmmod $module } # Initialize the Xorcom Astribank (xpp/) using perl utiliites: xpp_startup() { # do nothing if there are no astribank devices: if ! grep -q connected /proc/xpp/xbuses 2>/dev/null; then return 0; fi if ! /usr/share/dahdi/waitfor_xpds; then return 0; fi # overriding locales for the above two, as perl can be noisy # when locales are missing. # No register all the devices if they didn't auto-register: LC_ALL=C dahdi_registration on } hpec_start() { # HPEC license found if ! echo /var/lib/digium/licenses/HPEC-*.lic | grep -v '\*' | grep -q .; then return fi # dahdihpec_enable not installed in /usr/sbin if [ ! -f /usr/sbin/dahdihpec_enable ]; then echo -n "Running dahdihpec_enable: Failed" echo -n "." echo " The dahdihpec_enable binary is not installed in /usr/sbin." return fi # dahdihpec_enable not set executable if [ ! -x /usr/sbin/dahdihpec_enable ]; then echo -n "Running dahdihpec_enable: Failed" echo -n "." echo " /usr/sbin/dahdihpec_enable is not set as executable." return fi # dahdihpec_enable properly installed if [ $system = debian ]; then echo -n "Running dahdihpec_enable: " /usr/sbin/dahdihpec_enable 2> /dev/null elif [ $system = redhat ]; then action "Running dahdihpec_enable: " /usr/sbin/dahdihpec_enable fi if [ $? = 0 ]; then echo -n "done" echo "." else echo -n "Failed" echo -n "." echo " This can be caused if you had already run dahdihpec_enable, or if your HPEC license is no longer valid." fi } shutdown_dynamic() { if ! grep -q ' DYN/' /proc/dahdi/* 2>/dev/null; then return; fi # we should only get here if we have dynamic spans. Right? $DAHDI_CFG_CMD -s } if [ ! -x "$DAHDI_CFG" ]; then echo "dahdi_cfg not executable" exit 0 fi if [ ! -f /etc/dahdi/system.conf ]; then echo "/etc/dahdi/system.conf not found. Nothing to do." exit 0 fi RETVAL=0 # See how we were called. case "$1" in start) # Some systems, e.g. Debian Lenny, add here -b, which will break # loading of modules blacklisted in modprobe.d/* unset MODPROBE_OPTIONS modules=`sed -e 's/#.*$//' $DAHDI_MODULES_FILE 2>/dev/null` #if [ "$modules" = '' ]; then # what? #fi echo "Loading DAHDI hardware modules:" modprobe dahdi for line in $modules; do if [ $system = debian ]; then echo -n " ${line}: " if modprobe $line 2> /dev/null; then echo -n "done" else echo -n "error" fi elif [ $system = redhat ]; then action " ${line}: " modprobe $line fi done echo "" TMOUT=$DAHDI_DEV_TIMEOUT # max secs to wait while [ ! -d /dev/dahdi ] ; do sleep 1 TMOUT=`expr $TMOUT - 1` if [ $TMOUT -eq 0 ] ; then echo "Error: missing /dev/dahdi!" exit 1 fi done xpp_startup if [ ! -e /proc/dahdi/1 ]; then echo "No hardware timing source found in /proc/dahdi, loading dahdi_dummy" modprobe dahdi_dummy 2> /dev/null fi if [ $system = debian ]; then echo -n "Running dahdi_cfg: " $DAHDI_CFG_CMD 2> /dev/null && echo -n "done" echo "." elif [ $system = redhat ]; then action "Running dahdi_cfg: " $DAHDI_CFG_CMD fi RETVAL=$? if [ "$LOCKFILE" != '' ]; then [ $RETVAL -eq 0 ] && touch $LOCKFILE fi if [ -x "$FXOTUNE" ] && [ -r /etc/fxotune.conf ]; then # Allowed to fail if e.g. Asterisk already uses channels: $FXOTUNE -s || : fi # Set the right Astribanks ticker: LC_ALL=C xpp_sync "$XPP_SYNC" hpec_start ;; stop) # Unload drivers #shutdown_dynamic # FIXME: needs test from someone with dynamic spans echo -n "Unloading DAHDI hardware modules: " if unload_module dahdi; then echo "done" else echo "error" fi if [ "$LOCKFILE" != '' ]; then [ $RETVAL -eq 0 ] && rm -f $LOCKFILE fi ;; unload) unload_module dahdi ;; restart|force-reload) $0 stop $0 start ;; reload) if [ $system = debian ]; then echo -n "Rerunning dahdi_cfg: " $DAHDI_CFG_CMD 2> /dev/null && echo -n "done" echo "." elif [ $system = redhat ]; then action "Rerunning dahdi_cfg: " $DAHDI_CFG_CMD fi RETVAL=$? ;; status) if [ -d /proc/dahdi ]; then /usr/sbin/lsdahdi RETVAL=0 else RETVAL=3 fi ;; *) echo "Usage: dahdi {start|stop|restart|status|reload|unload}" exit 1 esac exit $RETVAL dahdi-tools-2.2.0-rc2/doc/0000775000000000000000000000000011176143301013650 5ustar rootrootdahdi-tools-2.2.0-rc2/doc/dahdi_test.80000664000000000000000000000230511046423506016055 0ustar rootroot.TH dahdi_test 8 "2005-06-25" .SH "NAME" dahdi_test \(em Test if the DAHDI timer provides timely response .SH "SYNOPSIS" .B dahdi_test .I [ -v ] .SH DESCRIPTION .B dahdi_test dahdi_test runs a timing test in a loop and prints the result of each loop. The test is as follows: It reads 8192 bytes from the DAHDI timer device (\fI/dev/dahdi/pseudo\fR). This should take exactly 8000 ms . It uses calls to .I gettimeofday(2) before and after that read to check that indeed exactly 8000ms have passed. Values of 100% and 99.99% Are normally considered a definite .I pass. Values of 99.98% and 99.97% are probably OK as well. .SH OPTIONS .B -v .RS Be more verbose: print one line per test. .RE .B -c .I count .RS Run for .I count times instead of running forever. .RE .SH FILES .B /dev/dahdi/pseudo .RS .RE The device file used to access the DAHDI timer. .SH SEE ALSO dahdi_tool(8), dahdi_cfg(8), asterisk(8). gettimeofday(2) .SH AUTHOR This manual page was written by Tzafrir Cohen Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. dahdi-tools-2.2.0-rc2/doc/patgen.80000664000000000000000000000222011025526107015215 0ustar rootroot.TH patgen 8 "2008-01-08" .SH NAME patgen \(em Generates a Pattern for a DAHDI Clear Channel Test .SH SYNOPSIS .B patgen .I dahdi-device .SH DESCRIPTION .B patgen Sends test data to a DAHDI channel. The channel should be of CLEAR signalling (e.g: B channel of a PRI line). pattest(8) is used to test the data at the other side. See its manual for more information. .B patgen Must be able to write to the channel. Hence this cannot be used for a channel used by Asterisk. .SH OPTIONS .I dahdi-device .RS A DAHDI device file. .RE .SH EXAMPLE patgen /dev/dahdi/5 .SH BUGS Will not work with channels whose number > 249 as they don't have device files. For a simple workaround, see dahdi_diag.c . .SH SEE ALSO pattest(8), dahdi_cfg(8), asterisk(8). .SH AUTHOR This manual page was written by Tzafrir Cohen Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. dahdi-tools-2.2.0-rc2/doc/dahdi_scan.80000664000000000000000000000507111162744524016032 0ustar rootroot.TH dahdi_scan 8 "2008-03-18" .SH NAME dahdi_scan \(em Print Configuration of DAHDI Spans .SH SYNOPSIS .B dahdi_scan .I [spans] .SH DESCRIPTION .B dahdi_scan prints information about DAHDI spans in the system. For analog spans it also provides a list of channels. By default it prints information about all the spans in the system. However if parameters are provided, they will be considered to be a list of span numbers and information will be printed for them. Output is printed to the standard output. The format is that of an Asterisk configuration file (similar to a "ini" configuration file), where the name of the section is the number of the span. Note that the specifically for analog spans some keys may appear more than once, and hence you can not use a parser for an "ini" format and assume you have a dictionary. .SH EXAMPLES Printing information for spans 1, 2 and 4: dahdi_scan 1 2 4 And to print all the spans: dahdi_scan Information about a certain analog span: [5] active=yes alarms=OK description=Xorcom XPD #00/10: FXS name=XBUS-00/XPD-10 manufacturer=Xorcom Inc. devicetype=Astribank: Unit 1 Subunit 0: FXS location=usb-0000:00:03.3-4 basechan=125 totchans=8 irq=0 type=analog port=125,FXS port=126,FXS port=127,FXS port=128,FXS port=129,FXS port=130,FXS port=131,FXS port=132,FXS And an example of a digital span: [1] active=yes alarms=RED description=T2XXP (PCI) Card 0 Span 1 name=TE2/0/1 manufacturer=Digium devicetype=Wildcard TE205P (4th Gen) location=Board ID Switch 0 basechan=1 totchans=24 irq=193 type=digital-T1 syncsrc=0 lbo=0 db (CSU)/0-133 feet (DSX-1) coding_opts=B8ZS,AMI framing_opts=ESF,D4 coding=B8ZS framing=ESF The "type" field may contain: "analog", "digital-T1", "digital-E1", "digital-J1" or "digital-BRI". .SH FILES Requires read access to /dev/dahdi/ctl . .SH SEE ALSO dahdi_cfg(8), asterisk(8). .SH BUGS The program still does not do everything described in the man page. It also assumes that spans don't skip channel numbers, and that their channel numbers are "running". This is anyway almost always the case. And always the case in a normal boot process. .SH AUTHOR This manual page was written by Tzafrir Cohen Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. dahdi-tools-2.2.0-rc2/doc/fxstest.80000664000000000000000000000257411046423506015455 0ustar rootroot.TH "FXSTEST" "8" "9 June 2007" "asterisk" "System Manager's Manuals: Asterisk" .SH NAME fxstest \- Simple tests for DAHDI FXS adapters .SH SYNOPSIS .B fxstest /dev/dahdi/\fIN comand\fR .SH DESCRIPTION fxstest can be used to issue one of a number simple tests to FXS adapters (analog adapters intended to connect phones). .SH OPTIONS All of those tests operate on a single dahdi channel which has to be an FXS port, and must not be in use by Asterisk or any other program. The command has two mandatory parameters. The first parameter is the device file to operate on. It is typically /dev/dahdi/NN , a device file under /dev/dahdi . The second parameter is the name of the command to run on that channel: .I stats .RS Reports voltages .RE .I regdump .RS Dumps ProSLIC registers .RE .I tones .RS Plays a series of tones .RE .I polarity .RS Requests channel to reverse polarity. .RE .I ring .RS Rings phone .RE .SH "SEE ALSO" .PP dahdi_tool(8), dahdi_cfg(8), dahdi_monitor(8), asterisk(8). .SH BUGS Does not allow testing channels beyond 249. Should support opening channels through /dev/dahdi/channel . .SH AUTHOR .PP This manual page was written by Tzafrir Cohen . Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. .PP dahdi-tools-2.2.0-rc2/doc/dahdi_monitor.80000664000000000000000000000177511046423506016577 0ustar rootroot.TH "DAHDI_MONITOR" "8" "16 June 2008" "" "" .SH NAME dahdi_monitor \- checks the rx/tx levels of DAHDI channels .SH SYNOPSIS .B dahdi_monitor \fIchannel number\fB [-v] [-f \fIFILE\fB] .SH DESCRIPTION dahdi_monitor monitors a DAHDI channel. It gives you a visual representation of the sound strengths and makes it easy to see if the received or transmitted signals are too high or out of balance .SH OPTIONS The first (mandatory) parameter is the number of the channel to monitor. .B -v .RS Display visual audio levels. .RE .B -f \fIFILE .RS Write output to FILE .RE Some extra, yet undocumented, options. .SH SEE ALSO .PP dahdi_tool(8), dahdi_cfg(8), asterisk(8). .SH AUTHOR .PP This manual page was written by Santiago Ruano Rinc\['o]n for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. dahdi-tools-2.2.0-rc2/doc/dahdi_cfg.80000664000000000000000000000262411046423506015641 0ustar rootroot.TH "DAHDI_CFG" "8" "16 Jun 2008" "" "" .SH NAME dahdi_cfg \- configures DAHDI kernel modules from /etc/dahdi/system.conf .SH SYNOPSIS .B dahdi_cfg [-c \fICFG_FILE\fB] [-s] [-f] [-t] [-v [-v ... ] ] .B dahdi_cfg -h .SH DESCRIPTION .B dahdi_cfg configures DAHDI interface cards from a config file. You generally need to run it with a valid configurations in order for DAHDI modules to work properly. It must be run to configure every DAHDI span. Normally it is run from the DAHDI init script. .SH OPTIONS .B -c \fICFG_FILE .RS Use an alternative configuration file instead of .I /etc/dahdi/system.conf .RE .B -s .RS Only shutdown spans. .RE .B -f .RS Always configure every channel, even if it appears not to have changed. .RE .B -t .RS Test mode. Don't do anything, just report what you wanted to do. .RE .B -v .RS Be more verbose. Add extra v-s for extra verbosity. .RE .B -h .RS Display a brief help message. .RE .SH FILES .I /etc/dahdi/system.conf .RS The default location for the configuration file. .RE .SH SEE ALSO dahdi_tool(8), dahdi_monitor(8), asterisk(8). .SH AUTHOR This manual page was written by Santiago Ruano Rinc\['o]n for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. dahdi-tools-2.2.0-rc2/doc/dahdi_tool.80000664000000000000000000000131011046423506016046 0ustar rootroot.TH "DAHDI_TOOL" "8" "16 June 2008" "" "" .SH NAME dahdi_tool \- Shows status of DAHDI interfaces .SH SYNOPSIS .B dahdi_tool .SH DESCRIPTION dahdi_tool shows the current status the DAHDI inteface cards plugged to the computer. It displays values like Current Alarms, SyncSource, Tx/Rx Levels for each DAHDI interface. .SH SEE ALSO dahdi_monitor(8), asterisk (8). .SH AUTHOR This manual page was written by Santiago Ruano Rinc\['o]n for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. dahdi-tools-2.2.0-rc2/doc/pattest.80000664000000000000000000000263111025526107015431 0ustar rootroot.TH pattest 8 "2008-01-08" .SH NAME pattest \(em Tests a Pattern for a DAHDI Clear Channel Test .SH SYNOPSIS .B pattest .I dahdi-device .SH DESCRIPTION .B pattest Recieves test data from a DAHDI channel and checks if it matches the test pattern. The channel should be of CLEAR signalling (e.g: B channel of a PRI line). patgen(8) is used to generate the data at the other side. .B pattest Must be able to read from the channel. Hence this cannot be used for a channel used by Asterisk. The pattern is a simple series of values from 0 to 255. Hence it takes at most one sample to get in sync with the other side. If there is no output, all is well. Output is an error message. .SH OPTIONS .I dahdi-device .RS A DAHDI device file. .RE .SH EXAMPLE pattest /dev/dahdi/5 .SH BUGS Will not work with channels whose number > 249 as they don't have device files. For a simple workaround, see dahdi_diag.c . Gives way too many errors when does not get any input. .SH SEE ALSO patgen(8), dahdi_cfg(8), asterisk(8). .SH AUTHOR This manual page was written by Tzafrir Cohen Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. dahdi-tools-2.2.0-rc2/doc/dahdi_diag.80000664000000000000000000000317711046423506016012 0ustar rootroot.TH dahdi_diag 8 "2008-01-07" .SH NAME dahdi_diag \(em Dump DAHDI channel parameters .SH SYNOPSIS .B dahdi_diag .I channel .SH DESCRIPTION .B dahdi_diag asks the kernel to dump parameters for DAHDI channel no. .I channel to the kernel logs. You will be able to see them using, e.g. dmesg(1). .SH OPTIONS .I channel .RS The number of the DAHDI channel whose parammeters should be dumped. May be any DAHDI channel (even if it is open). .RE .SH EXAMPLE # /tmp/dahdi_diag 5 # dmesg | tail -n 15 Dump of DAHDI Channel 5 (XPP_BRI_TE/00/01/1,5,2): flags: 501 hex, writechunk: c5190948, readchunk: c5190954 rxgain: ccad2e80, txgain: ccad2e80, gainalloc: 0 span: c48a900c, sig: 80 hex, sigcap: 80 hex inreadbuf: -1, outreadbuf: 0, inwritebuf: 0, outwritebuf: -1 blocksize: 160, numbufs: 4, txbufpolicy: 0, txbufpolicy: 0 txdisable: 0, rxdisable: 0, iomask: 0 curzone: c78e7000, tonezone: 0, curtone: 00000000, tonep: 0 digitmode: 0, txdialbuf: , dialing: 0, aftdialtimer: 0, cadpos. 0 confna: 0, confn: 0, confmode: 0, confmute: 0 ec: 00000000, echocancel: 0, deflaw: 0, xlaw: ccab5e80 echostate: 00, echotimer: 0, echolastupdate: 0 itimer: 0, otimer: 0, ringdebtimer: 0 .SH SEE ALSO dahdi_cfg(8), asterisk(8), dmesg(1). .SH AUTHOR This manual page was written by Tzafrir Cohen Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. dahdi-tools-2.2.0-rc2/doc/fxotune.80000664000000000000000000001423011046423506015435 0ustar rootroot.TH FXOTUNE "8" "9 June 2007" "asterisk" "System Manager's Manuals: Asterisk" .SH NAME fxotune \- automatically tune DAHDI FXO channels .SH SYNOPSIS .B fxotune -i .I [options] - detect mode .B fxotune -d .I [ options ] - dump mode .B fxotune -s - Startup mode .SH .SH DESCRIPTION .B fxotune is a script that fine-tune parameters of the FXO modules of the card. It has three modes of operation: .I Detect mode (-i): it detects and tunes all the available FXO channels. It writes settings to a configuration file (/etc/fxotune.conf) from which it can be loaded (e.g: at startup) using -s . .I Dump mode (-d): Runs detection on a single DAHDI channel, and just dumps waveforms to .B fxotune_dump.vals is generated in the current directory. .I Startup mode (-s): fxotune just reads the settings from fxotune.conf into the FXO modules. You are advised to run fxotune on all FXO ports you have that support it and that are connected. Note that the tunning is affected by e.g. the physical parameters of the connection, and thus if it has been radically changed, you may need to re-run fxotune. This program only works for the Digium TDM400P/800P/2400P cards and compatible and the Xorcom Astribank devices. Other cards (notably X100P cards and clones) do not have the hardware to support such tuning. The tuning process needs a clear line to do the tuning. In order to do that, it runs in cycles of the following: sets the line off-hook, dials a dial string (which should set the PSTN provider waiting for the next digit), and then starts tuning. It has a limited ammount of time for tuning before the PSTN gives up and gives a busy tone. So after a while it hangs up and starts a new cycle. .B fxotune has two operation modes: tune (-i) and set (-s). In the tune mode it generates /etc/fxotune.conf, and in the set mode it merely applies the parameters from fxotune.conf to device's ports. .SH OPTIONS The following options below except -v (verbose) affect only the detection process and hence apply only to the .I detect and .I dump modes. In addition, to maintain compatibility with older versions of fxotune, if in detect or dump mode there is a parameter with option before it, it is considered to be the .I dialstring parameter (-n). .B -b .I startdev .RS Start tuning from dahdi channel num. \fI startdev\fR: skip all previous channels. By default starting from channel 1. In dump mode (-d) this is the single channel that will be tested. .RE .B -e .I stopdev .RS Tune only up to dahdi channel num. \fI stopdev\fR: skip all previous channels. By default stopping at channel 252. In dump mode (-d) this parameter is ignored. .RE .B -l .I delay-to-silence .RS Time in seconds to wait after dialing the dial-string to get a clear line. The default is 0. before .RE .B -m .I silence-good-for .RS Time in seconds which states how long the PSTN will wait after we dialed the dial-string until it starts giving a busy tone. You can test this by connecting an analog phone to the line and dialing. The default is 18 (18 seconds). .RE .B -n .I dial-string .RS Digits to dial to the PSTN in order to get it stop its dialtone and waiting for the next digit. The default is "4" (sending just the digit 4). It should work in most cases. Again, this can be tested by connecting a phone to the PSTN line and dialing the dial-string. .RE .B -t .I detect-type .RS This option allows using the older detection method used by fxotune of Zaptel 1.2. use .B -t 1 for that older method. whereas .B -t 2 (the default) uses the current method. This option only applies to detect mode (-i). .RE .B -v[vvvv] .RS Sets debugging on. The more v-s, the higher debug level. Note that: -vv -v will actually set debug level to 1 instead of 3. .RE .B -w .I wave-form .RS The default: -1, for multitone waveform. Alternatively: a frequency of a single tone. This option only applies to dump mode (-d). .RE .SH EXAMPLES .RS fxotune -i 9 .RE if you need to dial 9 for an external line. If you always get a line, you can simply use any digit. .RE .B -s .RS Load settings from the last test. Used at startup. .RE .SH FILES .I /etc/fxotune.conf .RS The configuration file generated by fxotune in detect mode and from which configuration is loaded when .B -s is used. .SH NOTES Running fxotune takes approximately a minute per port. If you wish to only run fxotune for several ports, you can use the options -b and -e to set a specific range of ports. Another useful trick is to actually keep asterisk running, and only "destroy" the dahdi channels you wish to tune (dahdi destroy channel NNN): other channels will be used by Asterisk, and hence skipped. This can be useful if you have many FXO ports that are not connected. .B fxotune writes immediately to .B /etc/fxotune.conf so if you stop it half-way, you may get a half-configured system. If you have already tuned your FXO channels and wish to test-run fxotune again, you are advised to backup /etc/fxotune.conf . The default for -m is 18 seconds. This asusmes that you get a clear line for at least 18 seconds. It is advised that you test that timeout earlier by connecting a phone to the FXO line, dialing 4 (or whatever dial string you put with -n) and see how much time of silence you have. If you connect your device to a PSTN provider that is not in the US, there is a similar operation you should apply before even getting to fxotune: setting the opermode. The opermode sets a number of country-specific parameters. For the Digium analog cards this is set through the kernel module parameter 'opermode' . For the Xorcom Astribank this is set through the variable 'opermode' in /etc/dahdi/xpp.conf . For valid values of this parameter, see /usr/share/asterisk/init_fxo_modes (FIXME: this has changed and will change. Tzafrir). .SH SEE ALSO dahdi_cfg(8), dahdi_tool(8), dahdi_monitor(8), asterisk(8). .SH AUTHOR This manual page was written by Tzafrir Cohen Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. dahdi-tools-2.2.0-rc2/timertest.c0000664000000000000000000000413111111641664015272 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include "dahdi_tools_version.h" int main(int argc, char *argv[]) { int fd; int x = 8000; int res; fd_set fds; struct timeval orig, now; fd = open("/dev/dahdi/timer", O_RDWR); if (fd < 0) { fprintf(stderr, "Unable to open timer: %s\n", strerror(errno)); exit(1); } printf("Opened timer...\n"); if (ioctl(fd, DAHDI_TIMERCONFIG, &x)) { fprintf(stderr, "Unable to set timer: %s\n", strerror(errno)); exit(1); } printf("Set timer duration to %d samples (%d ms)\n", x, x/8); printf("Waiting...\n"); gettimeofday(&orig, NULL); for(;;) { FD_ZERO(&fds); FD_SET(fd, &fds); res = select(fd + 1, NULL, NULL, &fds, NULL); if (res != 1) { fprintf(stderr, "Unexpected result %d: %s\n", res, strerror(errno)); exit(1); } x = -1; if (ioctl(fd, DAHDI_TIMERACK, &x)) { fprintf(stderr, "Unable to ack timer: %s\n", strerror(errno)); exit(1); } gettimeofday(&now, NULL); printf("Timer Expired (%ld ms)!\n", (now.tv_sec - orig.tv_sec) * 1000 + (now.tv_usec - orig.tv_usec) / 1000); } exit(0); } dahdi-tools-2.2.0-rc2/patlooptest.c0000664000000000000000000000635511111641664015642 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include "dahdi_tools_version.h" #define BLOCK_SIZE 2039 void print_packet(unsigned char *buf, int len) { int x; printf("{ "); for (x=0;x 3 ) { fprintf(stderr, "Usage: %s [timeout]\n",argv[0]); exit(1); } fd = open(argv[1], O_RDWR, 0600); if (fd < 0) { fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &bs)) { fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_GET_PARAMS, &tp)) { fprintf(stderr, "Unable to get channel parameters\n"); exit(1); } ioctl(fd, DAHDI_GETEVENT); i = DAHDI_FLUSH_ALL; if (ioctl(fd,DAHDI_FLUSH,&i) == -1) { perror("DAHDI_FLUSH"); exit(255); } if(argc==3){ timeout=atoi(argv[2]); start_time=time(NULL); printf("Using Timeout of %d Seconds\n",timeout); } for(;;) { res = bs; for (x=0;x 1) read(fd,inbuf,bs); skipcount--; if (!skipcount) puts("Going for it..."); continue; } res = read(fd, inbuf, bs); if (res < bs) { printf("Res is %d\n", res); exit(1); } if (!setup) { c = inbuf[0]; setup++; } for (x=0;xtimeout){ printf("Timeout achieved Ending Program\n"); return errors; } } } dahdi-tools-2.2.0-rc2/fxotune.c0000664000000000000000000011102511121757467014755 0ustar rootroot/* * fxotune.c -- A utility for tuning the various settings on the fxo * modules for the TDM400 cards. * * by Matthew Fredrickson * * (C) 2004-2008 Digium, Inc. */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "dahdi_tools_version.h" #include "fxotune.h" #define TEST_DURATION 2000 #define BUFFER_LENGTH (2 * TEST_DURATION) #define SKIP_SAMPLES 800 #define SINE_SAMPLES 8000 static float sintable[SINE_SAMPLES]; static const float amplitude = 16384.0; static char *dahdipath = "/dev/dahdi"; static char *configfile = "/etc/fxotune.conf"; static int audio_dump_fd = -1; static int printbest = 0; #define MAX_RESULTS (5) struct result_catalog { int idx; float echo; float freqres; struct wctdm_echo_coefs settings; }; struct { struct result_catalog results[MAX_RESULTS]; int numactive; } topresults; static char *usage = "Usage: fxotune [-v[vv] (-s | -i | -d )\n" "\n" " -s : set previously calibrated echo settings\n" " -i : calibrate echo settings\n" " options : [] [-t ]\n" " [-b ][-e ]\n" " [-n ][-l ][-m ]\n" " -d : dump input and output waveforms to ./fxotune_dump.vals\n" " options : [-b ][-w ]\n" " [-n ][-l ][-m ]\n" " -v : more output (-vv, -vvv also)\n" " -p : print the 5 best candidates for acim and coefficients settings\n" " -x : Perform sin/cos functions using table lookup\n" " -o : Write the received raw 16-bit signed linear audio that is\n" " used in processing to the file specified by \n" " -c \n" "\n" " - type of calibration\n" " (default 2, old method 1)\n" " \n" " - defines a range of devices to test\n" " (default: 1-252)\n" " - string to dial to clear the line\n" " (default 5)\n" " - seconds to wait for line to clear (default 0)\n" " - seconds before line will no longer be clear\n" " (default 18)\n" " - the device to perform waveform dump on\n" " (default 1)\n" " - -1 for multitone waveform, or frequency of\n" " single tone (default -1)\n" " - Alternative file to set from / calibrate to.\n" " (Default: /etc/fxotune.conf)\n" ; #define OUT_OF_BOUNDS(x) ((x) < 0 || (x) > 255) struct silence_info{ char *dialstr; /** fd of device we are working with */ int device; /** seconds we should wait after dialing the dialstring before we know for sure we'll have silence */ int initial_delay; /** seconds after which a reset should occur */ int reset_after; /** time of last reset */ struct timeval last_reset; }; static short outbuf[TEST_DURATION]; static int debug = 0; static FILE *debugoutfile = NULL; static int use_table = 0; static int fxotune_read(int fd, void *buffer, int len) { int res; res = read(fd, buffer, len); if ((res > 0) && (audio_dump_fd != -1)) { res = write(audio_dump_fd, buffer, len); } return res; } /** * Makes sure that the line is clear. * Right now, we do this by relying on the user to specify how long after dialing the * dialstring we can rely on the line being silent (before the telco complains about * the user not hitting the next digit). * * A more robust way to do this would be to actually measure the sound levels on the line, * but that's a lot more complicated, and this should work. * * @return 0 if succesful (no errors), 1 if unsuccesful */ static int ensure_silence(struct silence_info *info) { struct timeval tv; long int elapsedms; int x = DAHDI_ONHOOK; struct dahdi_dialoperation dop; gettimeofday(&tv, NULL); if (info->last_reset.tv_sec == 0) { /* this is the first request, we will force it to run */ elapsedms = -1; } else { /* this is not the first request, we will compute elapsed time */ elapsedms = ((tv.tv_sec - info->last_reset.tv_sec) * 1000L + (tv.tv_usec - info->last_reset.tv_usec) / 1000L); } if (debug > 4) { fprintf(stdout, "Reset line request received - elapsed ms = %li / reset after = %ld\n", elapsedms, info->reset_after * 1000L); } if (elapsedms > 0 && elapsedms < info->reset_after * 1000L) return 0; if (debug > 1){ fprintf(stdout, "Resetting line\n"); } /* do a line reset */ /* prepare line for silence */ /* Do line hookstate reset */ if (ioctl(info->device, DAHDI_HOOK, &x)) { fprintf(stderr, "Unable to hang up fd %d\n", info->device); return -1; } sleep(2); x = DAHDI_OFFHOOK; if (ioctl(info->device, DAHDI_HOOK, &x)) { fprintf(stderr, "Cannot bring fd %d off hook\n", info->device); return -1; } sleep(2); /* Added to ensure that dial can actually takes place */ memset(&dop, 0, sizeof(dop)); dop.op = DAHDI_DIAL_OP_REPLACE; dop.dialstr[0] = 'T'; dahdi_copy_string(dop.dialstr + 1, info->dialstr, sizeof(dop.dialstr)); if (ioctl(info->device, DAHDI_DIAL, &dop)) { fprintf(stderr, "Unable to dial!\n"); return -1; } sleep(1); sleep(info->initial_delay); gettimeofday(&info->last_reset, NULL); return 0; } /** * Generates a tone of specified frequency. * * @param hz the frequency of the tone to be generated * @param idx the current sample * to begenerated. For a normal waveform you need to increment * this every time you execute the function. * * @return 16bit slinear sample for the specified index */ static short inline gentone(int hz, int idx) { return amplitude * sin((idx * 2.0 * M_PI * hz)/8000); } /* Using DTMF tones for now since they provide good mid band testing * while not being harmonics of each other */ static int freqs[] = {697, 770, 941, 1209, 1336, 1633}; static int freqcount = 6; /** * Generates a waveform of several frequencies. * * @param idx the current sample * to begenerated. For a normal waveform you need to increment * this every time you execute the function. * * @return 16bit slinear sample for the specified index */ static short inline genwaveform(int idx) { int i = 0; float response = (float)0; for (i = 0; i < freqcount; i++){ response += sin((idx * 2.0 * M_PI * freqs[i])/8000); } return amplitude * response / freqcount; } /** * Calculates the RMS of the waveform buffer of samples in 16bit slinear format. * prebuf the buffer of either shorts or floats * bufsize the number of elements in the prebuf buffer (not the number of bytes!) * short_format 1 if prebuf points to an array of shorts, 0 if it points to an array of floats * * Formula for RMS (http://en.wikipedia.org/wiki/Root_mean_square): * * Xrms = sqrt(1/N Sum(x1^2, x2^2, ..., xn^2)) * * Note: this isn't really a power calculation - but it gives a good measure of the level of the response * * @param prebuf the buffer containing the values to compute * @param bufsize the size of the buffer * @param short_format 1 if prebuf contains short values, 0 if it contains float values */ static float power_of(void *prebuf, int bufsize, int short_format) { float sum_of_squares = 0; int numsamples = 0; float finalanswer = 0; short *sbuf = (short*)prebuf; float *fbuf = (float*)prebuf; int i = 0; if (short_format) { /* idiot proof checks */ if (bufsize <= 0) return -1; numsamples = bufsize; /* Got rid of divide by 2 - the bufsize parameter should give the number of samples (that's what it does for the float computation, and it should do it here as well) */ for (i = 0; i < numsamples; i++) { sum_of_squares += ((float)sbuf[i] * (float)sbuf[i]); } } else { /* Version for float inputs */ for (i = 0; i < bufsize; i++) { sum_of_squares += (fbuf[i] * fbuf[i]); } } finalanswer = sum_of_squares/(float)bufsize; /* need to divide by the number of elements in the sample for RMS calc */ if (finalanswer < 0) { fprintf(stderr, "Error: Final answer negative number %f\n", finalanswer); return -3; } return sqrtf(finalanswer); } /* * In an effort to eliminate as much as possible the effect of outside noise, we use principles * from the Fourier Transform to attempt to calculate the return loss of our signal for each setting. * * To begin, we send our output signal out on the line. We then receive back the reflected * response. In the Fourier Transform, each evenly distributed frequency within the window * is correlated (multiplied against, then the resulting samples are added together) with * the real (cos) and imaginary (sin) portions of that frequency base to detect that frequency. * * Instead of doing a complete Fourier Transform, we solve the transform for only our signal * by multiplying the received signal by the real and imaginary portions of our reference * signal. This then gives us the real and imaginary values that we can use to calculate * the return loss of the sinusoids that we sent out on the line. This is done by finding * the magnitude (think polar form) of the vector resulting from the real and imaginary * portions calculated above. * * This essentially filters out any other noise which maybe present on the line which is outside * the frequencies used in our test multi-tone. */ void init_sinetable(void) { int i; if (debug) { fprintf(stdout, "Using sine tables with %d samples\n", SINE_SAMPLES); } for (i = 0; i < SINE_SAMPLES; i++) { sintable[i] = sin(((float)i * 2.0 * M_PI )/(float)(SINE_SAMPLES)); } } /* Sine and cosine table lookup to use periodicity of the calculations being done */ float sin_tbl(int arg, int num_per_period) { arg = arg % num_per_period; arg = (arg * SINE_SAMPLES)/num_per_period; return sintable[arg]; } float cos_tbl(int arg, int num_per_period) { arg = arg % num_per_period; arg = (arg * SINE_SAMPLES)/num_per_period; arg = (arg + SINE_SAMPLES/4) % SINE_SAMPLES; /* Pi/2 adjustment */ return sintable[arg]; } static float db_loss(float measured, float reference) { return 20 * (logf(measured/reference)/logf(10)); } static void one_point_dft(const short *inbuf, int len, int frequency, float *real, float *imaginary) { float myreal = 0, myimag = 0; int i; for (i = 0; i < len; i++) { if (use_table) { myreal += (float) inbuf[i] * cos_tbl(i*frequency, 8000); myimag += (float) inbuf[i] * sin_tbl(i*frequency, 8000); } else { myreal += (float) inbuf[i] * cos((i * 2.0 * M_PI * frequency)/8000); myimag += (float) inbuf[i] * sin((i * 2.0 * M_PI * frequency)/8000); } } myimag *= -1; *real = myreal / (float) len; *imaginary = myimag / (float) len; } static float calc_magnitude(short *inbuf, int insamps) { float real, imaginary, magnitude; float totalmagnitude = 0; int i; for (i = 0; i < freqcount; i++) { one_point_dft(inbuf, insamps, freqs[i], &real, &imaginary); magnitude = sqrtf((real * real) + (imaginary * imaginary)); totalmagnitude += magnitude; } return totalmagnitude; } /** * dumps input and output buffer contents for the echo test - used to see exactly what's going on */ static int maptone(int whichdahdi, int freq, char *dialstr, int delayuntilsilence) { int i = 0; int res = 0, x = 0; struct dahdi_bufferinfo bi; short inbuf[TEST_DURATION]; /* changed from BUFFER_LENGTH - this buffer is for short values, so it should be allocated using the length of the test */ FILE *outfile = NULL; int leadin = 50; int trailout = 100; struct silence_info sinfo; float power_result; float power_waveform; float echo; outfile = fopen("fxotune_dump.vals", "w"); if (!outfile) { fprintf(stdout, "Cannot create fxotune_dump.vals\n"); return -1; } x = 1; if (ioctl(whichdahdi, DAHDI_SETLINEAR, &x)) { fprintf(stderr, "Unable to set channel to signed linear mode.\n"); return -1; } memset(&bi, 0, sizeof(bi)); if (ioctl(whichdahdi, DAHDI_GET_BUFINFO, &bi)) { fprintf(stderr, "Unable to get buffer information!\n"); return -1; } bi.numbufs = 2; bi.bufsize = TEST_DURATION; /* KD - changed from BUFFER_LENGTH; */ bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE; bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE; if (ioctl(whichdahdi, DAHDI_SET_BUFINFO, &bi)) { fprintf(stderr, "Unable to set buffer information!\n"); return -1; } /* Fill the output buffers */ for (i = 0; i < leadin; i++) outbuf[i] = 0; for (; i < TEST_DURATION - trailout; i++){ outbuf[i] = freq > 0 ? gentone(freq, i) : genwaveform(i); /* if frequency is negative, use a multi-part waveform instead of a single frequency */ } for (; i < TEST_DURATION; i++) outbuf[i] = 0; /* Make sure the line is clear */ memset(&sinfo, 0, sizeof(sinfo)); sinfo.device = whichdahdi; sinfo.dialstr = dialstr; sinfo.initial_delay = delayuntilsilence; sinfo.reset_after = 4; /* doesn't matter - we are only running one test */ if (ensure_silence(&sinfo)){ fprintf(stderr, "Unable to get a clear outside line\n"); return -1; } /* Flush buffers */ x = DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE | DAHDI_FLUSH_EVENT; if (ioctl(whichdahdi, DAHDI_FLUSH, &x)) { fprintf(stderr, "Unable to flush I/O: %s\n", strerror(errno)); return -1; } /* send data out on line */ res = write(whichdahdi, outbuf, BUFFER_LENGTH); /* we are sending a TEST_DURATION length array of shorts (which are 2 bytes each) */ if (res != BUFFER_LENGTH) { fprintf(stderr, "Could not write all data to line\n"); return -1; } retry: /* read return response */ res = fxotune_read(whichdahdi, inbuf, BUFFER_LENGTH); if (res != BUFFER_LENGTH) { int dummy; ioctl(whichdahdi, DAHDI_GETEVENT, &dummy); goto retry; } /* write content of output buffer to debug file */ power_result = power_of(inbuf, TEST_DURATION, 1); power_waveform = power_of(outbuf, TEST_DURATION, 1); echo = power_result/power_waveform; fprintf(outfile, "Buffers, freq=%d, outpower=%0.0f, echo=%0.4f\n", freq, power_result, echo); fprintf(outfile, "Sample, Input (received from the line), Output (sent to the line)\n"); for (i = 0; i < TEST_DURATION; i++){ fprintf(outfile, "%d, %d, %d\n", i, inbuf[i], outbuf[i] ); } fclose(outfile); fprintf(stdout, "echo ratio = %0.4f (%0.1f / %0.1f)\n", echo, power_result, power_waveform); return 0; } /** * Initialize the data store for storing off best calculated results */ static void init_topresults(void) { topresults.numactive = 0; } /** * If this is a best result candidate, store in the top results data store * This is dependent on being the lowest echo value * * @param tbleoffset - The offset into the echo_trys table used * @param setting - Pointer to the settings used to achieve the fgiven value * @param echo - The calculated echo return value (in dB) * @param echo - The calculated magnitude of the response */ static void set_topresults(int tbloffset, struct wctdm_echo_coefs *setting, float echo, float freqres) { int place; int idx; for ( place = 0; place < MAX_RESULTS && place < topresults.numactive; place++) { if (echo < topresults.results[place].echo) { break; } } if (place < MAX_RESULTS) { /* move results to the bottom */ for (idx = topresults.numactive-2; idx >= place; idx--) { topresults.results[idx+1] = topresults.results[idx]; } topresults.results[place].idx = tbloffset; topresults.results[place].settings = *setting; topresults.results[place].echo = echo; topresults.results[place].freqres = freqres; if (MAX_RESULTS > topresults.numactive) { topresults.numactive++; } } } /** * Prints the top results stored to stdout * * @param header - Text that goes in the header of the response */ static void print_topresults(char * header) { int item; fprintf(stdout, "Top %d results for %s\n", topresults.numactive, header); for (item = 0; item < topresults.numactive; item++) { fprintf(stdout, "Res #%d: index=%d, %3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d: magnitude = %0.0f, echo = %0.4f dB\n", item+1, topresults.results[item].idx, topresults.results[item].settings.acim, topresults.results[item].settings.coef1, topresults.results[item].settings.coef2, topresults.results[item].settings.coef3, topresults.results[item].settings.coef4, topresults.results[item].settings.coef5, topresults.results[item].settings.coef6, topresults.results[item].settings.coef7, topresults.results[item].settings.coef8, topresults.results[item].freqres, topresults.results[item].echo); } } /** * Perform calibration type 2 on the specified device * * Determine optimum echo coefficients for the specified device * * New tuning strategy. If we have a number that we can dial that will result in silence from the * switch, the tune will be *much* faster (we don't have to keep hanging up and dialing a digit, etc...) * The downside is that the user needs to actually find a 'no tone' phone number at their CO's switch - but for * really fixing echo problems, this is what it takes. * * Also, for the purposes of optimizing settings, if we pick a single frequency and test with that, * we can try a whole bunch of impedence/echo coefficients. This should give better results than trying * a bunch of frequencies, and we can always do a a frequency sweep to pick between the best 3 or 4 * impedence/coefficients configurations. * * Note: It may be possible to take this even further and do some pertubation analysis on the echo coefficients * themselves (maybe use the 72 entry sweep to find some settings that are close to working well, then * deviate the coefficients a bit to see if we can improve things). A better way to do this would be to * use the optimization strategy from silabs. For reference, here is an application note that describes * the echo coefficients (and acim values): * * http://www.silabs.com/public/documents/tpub_doc/anote/Wireline/Silicon_DAA/en/an84.pdf * */ static int acim_tune2(int whichdahdi, int freq, char *dialstr, int delayuntilsilence, int silencegoodfor, struct wctdm_echo_coefs *coefs_out) { int i = 0; int res = 0, x = 0; int lowesttry = -1; float lowesttryresult = 999999999999.0; float lowestecho = 999999999999.0; struct dahdi_bufferinfo bi; short inbuf[TEST_DURATION * 2]; struct silence_info sinfo; int echo_trys_size = 72; int trys = 0; float waveform_power; float freq_result; float echo; init_topresults(); if (debug && !debugoutfile) { if (!(debugoutfile = fopen("fxotune.vals", "w"))) { fprintf(stdout, "Cannot create fxotune.vals\n"); return -1; } } /* Set echo settings */ if (ioctl(whichdahdi, WCTDM_SET_ECHOTUNE, &echo_trys[0])) { fprintf(stderr, "Unable to set impedance on fd %d\n", whichdahdi); return -1; } x = 1; if (ioctl(whichdahdi, DAHDI_SETLINEAR, &x)) { fprintf(stderr, "Unable to set channel to signed linear mode.\n"); return -1; } memset(&bi, 0, sizeof(bi)); if (ioctl(whichdahdi, DAHDI_GET_BUFINFO, &bi)) { fprintf(stderr, "Unable to get buffer information!\n"); return -1; } bi.numbufs = 2; bi.bufsize = BUFFER_LENGTH; bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE; bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE; if (ioctl(whichdahdi, DAHDI_SET_BUFINFO, &bi)) { fprintf(stderr, "Unable to set buffer information!\n"); return -1; } x = DAHDI_OFFHOOK; if (ioctl(whichdahdi, DAHDI_HOOK, &x)) { fprintf(stderr, "Cannot bring fd %d off hook", whichdahdi); return -1; } /* Set up silence settings */ memset(&sinfo, 0, sizeof(sinfo)); sinfo.device = whichdahdi; sinfo.dialstr = dialstr; sinfo.initial_delay = delayuntilsilence; sinfo.reset_after = silencegoodfor; /* Fill the output buffers */ for (i = 0; i < TEST_DURATION; i++) outbuf[i] = freq > 0 ? gentone(freq, i) : genwaveform(i); /* if freq is negative, use a multi-frequency waveform */ /* compute power of input (so we can later compute echo levels relative to input) */ waveform_power = calc_magnitude(outbuf, TEST_DURATION); /* sweep through the various coefficient settings and see how our responses look */ for (trys = 0; trys < echo_trys_size; trys++){ /* ensure silence on the line */ if (ensure_silence(&sinfo)){ fprintf(stderr, "Unable to get a clear outside line\n"); return -1; } if (ioctl(whichdahdi, WCTDM_SET_ECHOTUNE, &echo_trys[trys])) { fprintf(stderr, "Unable to set echo coefficients on fd %d\n", whichdahdi); return -1; } /* Flush buffers */ x = DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE | DAHDI_FLUSH_EVENT; if (ioctl(whichdahdi, DAHDI_FLUSH, &x)) { fprintf(stderr, "Unable to flush I/O: %s\n", strerror(errno)); return -1; } /* send data out on line */ res = write(whichdahdi, outbuf, BUFFER_LENGTH); if (res != BUFFER_LENGTH) { fprintf(stderr, "Could not write all data to line\n"); return -1; } retry: /* read return response */ res = fxotune_read(whichdahdi, inbuf, BUFFER_LENGTH * 2); if (res != BUFFER_LENGTH * 2) { int dummy; ioctl(whichdahdi, DAHDI_GETEVENT, &dummy); goto retry; } freq_result = calc_magnitude(inbuf, TEST_DURATION * 2); echo = db_loss(freq_result, waveform_power); #if 0 if (debug > 0) fprintf(stdout, "%3d,%d,%d,%d,%d,%d,%d,%d,%d: magnitude = %0.0f, echo = %0.4f dB\n", echo_trys[trys].acim, echo_trys[trys].coef1, echo_trys[trys].coef2, echo_trys[trys].coef3, echo_trys[trys].coef4, echo_trys[trys].coef5, echo_trys[trys].coef6, echo_trys[trys].coef7, echo_trys[trys].coef8, freq_result, echo); #endif if (freq_result < lowesttryresult){ lowesttry = trys; lowesttryresult = freq_result; lowestecho = echo; } if (debug) { char result[256]; snprintf(result, sizeof(result), "%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%f,%f", echo_trys[trys].acim, echo_trys[trys].coef1, echo_trys[trys].coef2, echo_trys[trys].coef3, echo_trys[trys].coef4, echo_trys[trys].coef5, echo_trys[trys].coef6, echo_trys[trys].coef7, echo_trys[trys].coef8, freq_result, echo ); fprintf(debugoutfile, "%s\n", result); fprintf(stdout, "%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d,%3d: magnitude = %0.0f, echo = %0.4f dB\n", echo_trys[trys].acim, echo_trys[trys].coef1, echo_trys[trys].coef2, echo_trys[trys].coef3, echo_trys[trys].coef4, echo_trys[trys].coef5, echo_trys[trys].coef6, echo_trys[trys].coef7, echo_trys[trys].coef8, freq_result, echo); } if (printbest) { set_topresults(trys, &echo_trys[trys], echo, freq_result); } } if (debug > 0) fprintf(stdout, "Config with lowest response = %d, magnitude = %0.0f, echo = %0.4f dB\n", lowesttry, lowesttryresult, lowestecho); memcpy(coefs_out, &echo_trys[lowesttry], sizeof(struct wctdm_echo_coefs)); if (printbest) { print_topresults("Acim2_tune Test"); } return 0; } /** * Perform calibration type 1 on the specified device. Only tunes the line impedance. Look for best response range */ static int acim_tune(int whichdahdi, char *dialstr, int delayuntilsilence, int silencegoodfor, struct wctdm_echo_coefs *coefs_out) { int i = 0, freq = 0, acim = 0; int res = 0, x = 0; struct dahdi_bufferinfo bi; struct wctdm_echo_coefs coefs; short inbuf[TEST_DURATION]; /* changed from BUFFER_LENGTH - this buffer is for short values, so it should be allocated using the length of the test */ int lowest = 0; FILE *outfile = NULL; float acim_results[16]; struct silence_info sinfo; if (debug) { outfile = fopen("fxotune.vals", "w"); if (!outfile) { fprintf(stdout, "Cannot create fxotune.vals\n"); return -1; } } /* Set up silence settings */ memset(&sinfo, 0, sizeof(sinfo)); sinfo.device = whichdahdi; sinfo.dialstr = dialstr; sinfo.initial_delay = delayuntilsilence; sinfo.reset_after = silencegoodfor; /* Set echo settings */ memset(&coefs, 0, sizeof(coefs)); if (ioctl(whichdahdi, WCTDM_SET_ECHOTUNE, &coefs)) { fprintf(stdout, "Skipping non-TDM / non-FXO\n"); return -1; } x = 1; if (ioctl(whichdahdi, DAHDI_SETLINEAR, &x)) { fprintf(stderr, "Unable to set channel to signed linear mode.\n"); return -1; } memset(&bi, 0, sizeof(bi)); if (ioctl(whichdahdi, DAHDI_GET_BUFINFO, &bi)) { fprintf(stderr, "Unable to get buffer information!\n"); return -1; } bi.numbufs = 2; bi.bufsize = BUFFER_LENGTH; bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE; bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE; if (ioctl(whichdahdi, DAHDI_SET_BUFINFO, &bi)) { fprintf(stderr, "Unable to set buffer information!\n"); return -1; } for (acim = 0; acim < 16; acim++) { float freq_results[15]; coefs.acim = acim; if (ioctl(whichdahdi, WCTDM_SET_ECHOTUNE, &coefs)) { fprintf(stderr, "Unable to set impedance on fd %d\n", whichdahdi); return -1; } for (freq = 200; freq <=3000; freq+=200) { /* Fill the output buffers */ for (i = 0; i < TEST_DURATION; i++) outbuf[i] = gentone(freq, i); /* Make sure line is ready for next test iteration */ if (ensure_silence(&sinfo)){ fprintf(stderr, "Unable to get a clear line\n"); return -1; } /* Flush buffers */ x = DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE | DAHDI_FLUSH_EVENT; if (ioctl(whichdahdi, DAHDI_FLUSH, &x)) { fprintf(stderr, "Unable to flush I/O: %s\n", strerror(errno)); return -1; } /* send data out on line */ res = write(whichdahdi, outbuf, BUFFER_LENGTH); if (res != BUFFER_LENGTH) { fprintf(stderr, "Could not write all data to line\n"); return -1; } /* read return response */ retry: /* read return response */ res = fxotune_read(whichdahdi, inbuf, BUFFER_LENGTH); if (res != BUFFER_LENGTH) { int dummy; ioctl(whichdahdi, DAHDI_GETEVENT, &dummy); goto retry; } /* calculate power of response */ freq_results[(freq/200)-1] = power_of(inbuf+SKIP_SAMPLES, TEST_DURATION-SKIP_SAMPLES, 1); /* changed from inbuf+SKIP_BYTES, BUFFER_LENGTH-SKIP_BYTES, 1 */ if (debug) fprintf(outfile, "%d,%d,%f\n", acim, freq, freq_results[(freq/200)-1]); } acim_results[acim] = power_of(freq_results, 15, 0); } if (debug) { for (i = 0; i < 16; i++) fprintf(outfile, "acim_results[%d] = %f\n", i, acim_results[i]); } /* Find out what the "best" impedance is for the line */ lowest = 0; for (i = 0; i < 16; i++) { if (acim_results[i] < acim_results[lowest]) { lowest = i; } } coefs_out->acim = lowest; coefs_out->coef1 = 0; coefs_out->coef2 = 0; coefs_out->coef3 = 0; coefs_out->coef4 = 0; coefs_out->coef5 = 0; coefs_out->coef6 = 0; coefs_out->coef7 = 0; coefs_out->coef8 = 0; return 0; } /** * Reads echo register settings from the configuration file and pushes them into * the appropriate devices * * @param configfilename the path of the file that the calibration results should be written to * * @return 0 if successful, !0 otherwise */ static int do_set(char *configfilename) { FILE *fp = NULL; int res = 0; int fd = 0; fp = fopen(configfile, "r"); if (!fp) { fprintf(stdout, "Cannot open %s!\n",configfile); return -1; } while (res != EOF) { struct wctdm_echo_coefs mycoefs; char completedahdipath[56] = ""; int mydahdi,myacim,mycoef1,mycoef2,mycoef3,mycoef4,mycoef5,mycoef6,mycoef7,mycoef8; res = fscanf(fp, "%d=%d,%d,%d,%d,%d,%d,%d,%d,%d",&mydahdi,&myacim,&mycoef1, &mycoef2,&mycoef3,&mycoef4,&mycoef5,&mycoef6,&mycoef7, &mycoef8); if (res == EOF) { break; } /* Check to be sure conversion is done correctly */ if (OUT_OF_BOUNDS(myacim) || OUT_OF_BOUNDS(mycoef1)|| OUT_OF_BOUNDS(mycoef2)|| OUT_OF_BOUNDS(mycoef3)|| OUT_OF_BOUNDS(mycoef4)|| OUT_OF_BOUNDS(mycoef5)|| OUT_OF_BOUNDS(mycoef6)|| OUT_OF_BOUNDS(mycoef7)|| OUT_OF_BOUNDS(mycoef8)) { fprintf(stdout, "Bounds check error on inputs from %s:%d\n", configfile, mydahdi); return -1; } mycoefs.acim = myacim; mycoefs.coef1 = mycoef1; mycoefs.coef2 = mycoef2; mycoefs.coef3 = mycoef3; mycoefs.coef4 = mycoef4; mycoefs.coef5 = mycoef5; mycoefs.coef6 = mycoef6; mycoefs.coef7 = mycoef7; mycoefs.coef8 = mycoef8; snprintf(completedahdipath, sizeof(completedahdipath), "%s/%d", dahdipath, mydahdi); fd = open(completedahdipath, O_RDWR); if (fd < 0) { fprintf(stdout, "open error on %s: %s\n", completedahdipath, strerror(errno)); return -1; } if (ioctl(fd, WCTDM_SET_ECHOTUNE, &mycoefs)) { fprintf(stdout, "%s: %s\n", completedahdipath, strerror(errno)); return -1; } close(fd); } fclose(fp); if (debug) fprintf(stdout, "fxotune: successfully set echo coeffecients on FXO modules\n"); return 0; } /** * Output waveform information from a single test * * Clears the line, then sends a single waveform (multi-tone, or single tone), and listens * for the response on the line. Output is written to fxotune_dump.vals * * @param startdev the device to test * @param dialstr the string that should be dialed to clear the dialtone from the line * @param delayuntilsilence the number of seconds to wait after dialing dialstr before starting the test * @param silencegoodfor the number of seconds that the test can run before having to reset the line again * (this is basically the amount of time it takes before the 'if you'd like to make a call...' message * kicks in after you dial dialstr. This test is so short that the value is pretty much ignored. * @param waveformtype the type of waveform to use - -1 = multi-tone waveform, otherwise the specified value * is used as the frequency of a single tone. A value of 0 will output silence. */ static int do_dump(int startdev, char* dialstr, int delayuntilsilence, int silencegoodfor, int waveformtype) { int res = 0; int fd; char dahdidev[80] = ""; int dahdimodule = startdev; snprintf(dahdidev, sizeof(dahdidev), "%s/%d", dahdipath, dahdimodule); fd = open(dahdidev, O_RDWR); if (fd < 0) { fprintf(stdout, "%s absent: %s\n", dahdidev, strerror(errno)); return -1; } fprintf(stdout, "Dumping module %s\n", dahdidev); res = maptone(fd, waveformtype, dialstr, delayuntilsilence); close(fd); if (res) { fprintf(stdout, "Failure!\n"); return res; } else { fprintf(stdout, "Done!\n"); return 0; } } /** * Performs calibration on all specified devices * * @param startdev the first device to check * @param enddev the last device to check * @param calibtype the type of calibration to perform. 1=old style (loops through individual frequencies * doesn't optimize echo coefficients. 2=new style (uses multi-tone and optimizes echo coefficients * and acim setting) * @param configfilename the path of the file that the calibration results should be written to * @param dialstr the string that should be dialed to clear the dialtone from the line * @param delayuntilsilence the number of seconds to wait after dialing dialstr before starting the test * @param silencegoodfor the number of seconds that the test can run before having to reset the line again * (this is basically the amount of time it takes before the 'if you'd like to make a call...' message * kicks in after you dial dialstr * * @return 0 if successful, -1 for serious error such as device not available , > 0 indicates the number of channels */ static int do_calibrate(int startdev, int enddev, int calibtype, char* configfilename, char* dialstr, int delayuntilsilence, int silencegoodfor) { int problems = 0; int res = 0; int configfd, fd; int devno = 0; char dahdidev[80] = ""; struct wctdm_echo_coefs coefs; configfd = open(configfile, O_CREAT|O_TRUNC|O_WRONLY, 0666); if (configfd < 0) { fprintf(stderr, "Cannot generate config file %s: open: %s\n", configfile, strerror(errno)); return -1; } for (devno = startdev; devno <= enddev; devno++) { snprintf(dahdidev, sizeof(dahdidev), "%s/%d", dahdipath, devno); fd = open(dahdidev, O_RDWR); if (fd < 0) { fprintf(stdout, "%s absent: %s\n", dahdidev, strerror(errno)); continue; } fprintf(stdout, "Tuning module %s\n", dahdidev); if (1 == calibtype) res = acim_tune(fd, dialstr, delayuntilsilence, silencegoodfor, &coefs); else res = acim_tune2(fd, -1, dialstr, delayuntilsilence, silencegoodfor, &coefs); close(fd); if (res) { fprintf(stdout, "Failure!\n"); problems++; } else { fprintf(stdout, "Done!\n"); } if (res == 0) { /* Do output to file */ int len = 0; static char output[255] = ""; snprintf(output, sizeof(output), "%d=%d,%d,%d,%d,%d,%d,%d,%d,%d\n", devno, coefs.acim, coefs.coef1, coefs.coef2, coefs.coef3, coefs.coef4, coefs.coef5, coefs.coef6, coefs.coef7, coefs.coef8 ); if (debug) fprintf(stdout, "Found best echo coefficients: %s\n", output); len = strlen(output); res = write(configfd, output, strlen(output)); if (res != len) { fprintf(stdout, "Unable to write line \"%s\" to file.\n", output); return -1; } } } close(configfd); if (problems) fprintf(stdout, "Unable to tune %d devices, even though those devices are present\n", problems); return problems; } int main(int argc , char **argv) { int startdev = 1; /* -b */ int stopdev = 252; /* -e */ int calibtype = 2; /* -t */ int waveformtype = -1; /* -w multi-tone by default. If > 0, single tone of specified frequency */ int delaytosilence = 0; /* -l */ int silencegoodfor = 18; /* -m */ char* dialstr = "5"; /* -n */ int res = 0; int doset = 0; /* -s */ int docalibrate = 0; /* -i */ int dodump = 0; /* -d */ int i = 0; int moreargs; for (i = 1; i < argc; i++){ if (!(argv[i][0] == '-' || argv[i][0] == '/') || (strlen(argv[i]) <= 1)){ fprintf(stdout, "Unknown option : %s\n", argv[i]); /* Show usage */ fputs(usage, stdout); return -1; } moreargs = (i < argc - 1); switch(argv[i][1]){ case 's': doset=1; continue; case 'i': docalibrate = 1; if (moreargs){ /* we need to check for a value after 'i' for backwards compatability with command line options of old fxotune */ if (argv[i+1][0] != '-' && argv[i+1][0] != '/') dialstr = argv[++i]; } continue; case 'c': configfile = moreargs ? argv[++i] : configfile; continue; case 'd': dodump = 1; continue; case 'b': startdev = moreargs ? atoi(argv[++i]) : startdev; break; case 'e': stopdev = moreargs ? atoi(argv[++i]) : stopdev; break; case 't': calibtype = moreargs ? atoi(argv[++i]) : calibtype; break; case 'w': waveformtype = moreargs ? atoi(argv[++i]) : waveformtype; break; case 'l': delaytosilence = moreargs ? atoi(argv[++i]) : delaytosilence; break; case 'm': silencegoodfor = moreargs ? atoi(argv[++i]) : silencegoodfor; break; case 'n': dialstr = moreargs ? argv[++i] : dialstr; break; case 'p': printbest++; break; case 'x': use_table = 1; break; case 'v': debug = strlen(argv[i])-1; break; case 'o': if (moreargs) { audio_dump_fd = open(argv[++i], O_WRONLY|O_CREAT|O_TRUNC, 0666); if (audio_dump_fd == -1) { fprintf(stdout, "Unable to open file %s: %s\n", argv[i], strerror(errno)); return -1; } break; } else { fprintf(stdout, "No path supplied to -o option!\n"); return -1; } default: fprintf(stdout, "Unknown option : %s\n", argv[i]); /* Show usage */ fputs(usage, stdout); return -1; } } if (debug > 3){ fprintf(stdout, "Running with parameters:\n"); fprintf(stdout, "\tdoset=%d\n", doset); fprintf(stdout, "\tdocalibrate=%d\n", docalibrate); fprintf(stdout, "\tdodump=%d\n", dodump); fprintf(stdout, "\tprint best settings=%d\n", printbest); fprintf(stdout, "\tstartdev=%d\n", startdev); fprintf(stdout, "\tstopdev=%d\n", stopdev); fprintf(stdout, "\tcalibtype=%d\n", calibtype); fprintf(stdout, "\twaveformtype=%d\n", waveformtype); fprintf(stdout, "\tdelaytosilence=%d\n", delaytosilence); fprintf(stdout, "\tsilencegoodfor=%d\n", silencegoodfor); fprintf(stdout, "\tdialstr=%s\n", dialstr); fprintf(stdout, "\tdebug=%d\n", debug); } if(use_table) { init_sinetable(); } if (docalibrate){ res = do_calibrate(startdev, stopdev, calibtype, configfile, dialstr, delaytosilence, silencegoodfor); if (!res) return do_set(configfile); else return -1; } if (doset) return do_set(configfile); if (dodump){ res = do_dump(startdev, dialstr, delaytosilence, silencegoodfor, waveformtype); if (!res) return 0; else return -1; } fputs(usage, stdout); return -1; } dahdi-tools-2.2.0-rc2/init.conf.sample0000664000000000000000000000064011037140005016167 0ustar rootroot# # Shell settings for Dahdi initialization scripts. # This replaces the old/per-platform files (/etc/sysconfig/zaptel, # /etc/defaults/zaptel) # # The maximal timeout (seconds) to wait for udevd to finish generating # device nodes after the modules have loaded and before running dahdi_cfg. #DAHDI_DEV_TIMEOUT=40 # Override settings for xpp_fxloader #XPP_FIRMWARE_DIR=/usr/share/dahdi #XPP_HOTPLUG_DISABLED=yes dahdi-tools-2.2.0-rc2/hdlcstress.c0000664000000000000000000001551111165151503015431 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include #include #define FAST_HDLC_NEED_TABLES #include #include "bittest.h" #include "dahdi_tools_version.h" /* #define BLOCK_SIZE 2048 */ #define BLOCK_SIZE 2041 static int hdlcmode = 0; static int bri_delay = 0; static unsigned short fcstab[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 }; #define PPP_INITFCS 0xffff /* Initial FCS value */ #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ #define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) void print_packet(unsigned char *buf, int len) { int x; printf("{ "); for (x=0;x 7) outbuf[pos++] = fasthdlc_tx_run(&fs); } fcs ^= 0xffff; if (fasthdlc_tx_load(&fs, (fcs & 0xff))) fprintf(stderr, "Load error (fcs1)\n"); outbuf[pos++] = fasthdlc_tx_run(&fs); if (fs.bits > 7) outbuf[pos++] = fasthdlc_tx_run(&fs); if (fasthdlc_tx_load(&fs, ((fcs >> 8) & 0xff))) fprintf(stderr, "Load error (fcs2)\n"); outbuf[pos++] = fasthdlc_tx_run(&fs); if (fs.bits > 7) outbuf[pos++] = fasthdlc_tx_run(&fs); if (fasthdlc_tx_frame(&fs)) fprintf(stderr, "Frame error\n"); if (fs.bits > 7) outbuf[pos++] = fasthdlc_tx_run(&fs); if (fs.bits > 7) outbuf[pos++] = fasthdlc_tx_run(&fs); write(fd, outbuf, pos); } } int main(int argc, char *argv[]) { int res, ch, x; struct dahdi_params tp; struct dahdi_bufferinfo bi; int bs = BLOCK_SIZE; unsigned char c=0; unsigned char outbuf[BLOCK_SIZE]; while((ch = getopt(argc, argv, "b")) != -1) { switch(ch) { case 'b': bri_delay = 300000; break; case '?': exit(1); } } if (argc - optind != 1) { fprintf(stderr, "Usage: %s [-b] \n", argv[0]); exit(1); } fd = open(argv[optind], O_RDWR, 0600); if (fd < 0) { fprintf(stderr, "Unable to open %s: %s\n", argv[optind], strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &bs)) { fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_GET_PARAMS, &tp)) { fprintf(stderr, "Unable to get channel parameters\n"); exit(1); } if ((tp.sigtype & DAHDI_SIG_HDLCRAW) == DAHDI_SIG_HDLCRAW) { printf("In HDLC mode\n"); hdlcmode = 1; } else if ((tp.sigtype & DAHDI_SIG_CLEAR) == DAHDI_SIG_CLEAR) { printf("In CLEAR mode\n"); hdlcmode = 0; } else { fprintf(stderr, "Not in a reasonable mode\n"); exit(1); } res = ioctl(fd, DAHDI_GET_BUFINFO, &bi); if (!res) { bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE; bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE; bi.numbufs = 4; res = ioctl(fd, DAHDI_SET_BUFINFO, &bi); if (res < 0) { fprintf(stderr, "Unable to set buf info: %s\n", strerror(errno)); exit(1); } } else { fprintf(stderr, "Unable to get buf info: %s\n", strerror(errno)); exit(1); } ioctl(fd, DAHDI_GETEVENT); fasthdlc_precalc(); fasthdlc_init(&fs, FASTHDLC_MODE_64); #if 0 print_packet(outbuf, res); printf("FCS is %x, PPP_GOODFCS is %x\n", fcs,PPP_GOODFCS); #endif for(;;) { if (c < 1) c = 1; for (x=0;x<50;x++) { outbuf[x] = c; } send_packet(outbuf, 50); #if 0 printf("Wrote %d of %d bytes\n", res, c); #endif /* The HFC chip can't be bombarded too much. If a write has failed, let it recover */ if (bri_delay) usleep(bri_delay); c = bit_next(c); #if 0 printf("(%d) Wrote %d bytes\n", packets++, res); #endif } } dahdi-tools-2.2.0-rc2/fxstest.c0000664000000000000000000001366411147075615014773 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include "tonezone.h" #include "dahdi_tools_version.h" static int tones[] = { DAHDI_TONE_DIALTONE, DAHDI_TONE_BUSY, DAHDI_TONE_RINGTONE, DAHDI_TONE_CONGESTION, DAHDI_TONE_DIALRECALL, }; struct dahdi_vmwi_info mwisend_setting; /*!< Which VMWI methods to use */ int main(int argc, char *argv[]) { int fd; int res; int x; if (argc < 3) { fprintf(stderr, "Usage: fxstest \n" " where cmd is one of:\n" " stats - reports voltages\n" " regdump - dumps ProSLIC registers\n" " tones - plays a series of tones\n" " polarity - tests polarity reversal\n" " ring - rings phone\n" " vmwi - toggles VMWI LED lamp\n" " hvdc - toggles VMWI HV lamp\n" " neon - toggles VMWI NEON lamp\n"); exit(1); } fd = open(argv[1], O_RDWR); if (fd < 0) { fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); exit(1); } if ( !strcasecmp(argv[2], "neon") || !strcasecmp(argv[2], "vmwi") || !strcasecmp(argv[2], "hvdc")) { fprintf(stderr, "Twiddling %s ...\n", argv[2]); if ( !strcasecmp(argv[2], "vmwi") ) { mwisend_setting.vmwi_type = DAHDI_VMWI_LREV; } else if ( !strcasecmp(argv[2], "neon") ) { mwisend_setting.vmwi_type = DAHDI_VMWI_HVAC; } else if ( !strcasecmp(argv[2], "hvdc") ) { mwisend_setting.vmwi_type = DAHDI_VMWI_HVDC; } res = ioctl(fd, DAHDI_VMWI_CONFIG, &mwisend_setting); x = 1; res = ioctl(fd, DAHDI_VMWI, &x); if (res) { fprintf(stderr, "Unable to set %s ...\n", argv[2]); } else { fprintf(stderr, "Set 1 Voice Message...\n"); sleep(5); x = 2; ioctl(fd, DAHDI_VMWI, &x); fprintf(stderr, "Set 2 Voice Messages...\n"); sleep(5); x = 0; ioctl(fd, DAHDI_VMWI, &x); fprintf(stderr, "Set No Voice messages...\n"); sleep(2); mwisend_setting.vmwi_type = 0; } } else if (!strcasecmp(argv[2], "ring")) { fprintf(stderr, "Ringing phone...\n"); x = DAHDI_RING; res = ioctl(fd, DAHDI_HOOK, &x); if (res) { fprintf(stderr, "Unable to ring phone...\n"); } else { fprintf(stderr, "Phone is ringing...\n"); sleep(2); } } else if (!strcasecmp(argv[2], "polarity")) { fprintf(stderr, "Twiddling polarity...\n"); /* Insure that the channel is in active mode */ x = DAHDI_RING; res = ioctl(fd, DAHDI_HOOK, &x); usleep(100000); x = 0; res = ioctl(fd, DAHDI_HOOK, &x); x = 0; res = ioctl(fd, DAHDI_SETPOLARITY, &x); if (res) { fprintf(stderr, "Unable to polarity...\n"); } else { fprintf(stderr, "Polarity is forward...\n"); sleep(2); x = 1; ioctl(fd, DAHDI_SETPOLARITY, &x); fprintf(stderr, "Polarity is reversed...\n"); sleep(5); x = 0; ioctl(fd, DAHDI_SETPOLARITY, &x); fprintf(stderr, "Polarity is forward...\n"); sleep(2); } } else if (!strcasecmp(argv[2], "tones")) { int x = 0; for (;;) { res = tone_zone_play_tone(fd, tones[x]); if (res) fprintf(stderr, "Unable to play tone %d\n", tones[x]); sleep(3); x=(x+1) % (sizeof(tones) / sizeof(tones[0])); } } else if (!strcasecmp(argv[2], "stats")) { struct wctdm_stats stats; res = ioctl(fd, WCTDM_GET_STATS, &stats); if (res) { fprintf(stderr, "Unable to get stats on channel %s\n", argv[1]); } else { printf("TIP: %7.4f Volts\n", (float)stats.tipvolt / 1000.0); printf("RING: %7.4f Volts\n", (float)stats.ringvolt / 1000.0); printf("VBAT: %7.4f Volts\n", (float)stats.batvolt / 1000.0); } } else if (!strcasecmp(argv[2], "regdump")) { struct wctdm_regs regs; int numregs = NUM_REGS; memset(®s, 0, sizeof(regs)); res = ioctl(fd, WCTDM_GET_REGS, ®s); if (res) { fprintf(stderr, "Unable to get registers on channel %s\n", argv[1]); } else { for (x=60;x * */ /* * 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 Lesser General Public License Version 2.1 as published * by the Free Software Foundation. See the LICENSE.LGPL file * included with this program for more details. * * In addition, when this program is distributed with Asterisk in * any form that would qualify as a 'combined work' or as a * 'derivative work' (but not mere aggregation), you can redistribute * and/or modify the combination under the terms of the license * provided with that copy of Asterisk, instead of the license * terms granted here. */ #include #include #include #include #include #include #include #include #include "dahdi/user.h" #include "tonezone.h" #include "dahdi_tools_version.h" #define DEFAULT_DAHDI_DEV "/dev/dahdi/ctl" #define MAX_SIZE 16384 #define CLIP 32635 #define BIAS 0x84 struct tone_zone *tone_zone_find(char *country) { struct tone_zone *z; z = builtin_zones; while(z->zone > -1) { if (!strcasecmp(country, z->country)) return z; z++; } return NULL; } struct tone_zone *tone_zone_find_by_num(int id) { struct tone_zone *z; z = builtin_zones; while(z->zone > -1) { if (z->zone == id) return z; z++; } return NULL; } #define LEVEL -10 static int build_tone(void *data, int size, struct tone_zone_sound *t, int *count) { char *dup, *s; struct dahdi_tone_def *td=NULL; int firstnobang = -1; int freq1, freq2, time; int modulate = 0; float gain; int used = 0; dup = strdup(t->data); s = strtok(dup, ","); while(s && strlen(s)) { /* Handle optional ! which signifies don't start here*/ if (s[0] == '!') s++; else if (firstnobang < 0) { #if 0 printf("First no bang: %s\n", s); #endif firstnobang = *count; } if (sscanf(s, "%d+%d/%d", &freq1, &freq2, &time) == 3) { /* f1+f2/time format */ #if 0 printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time); #endif } else if (sscanf(s, "%d*%d/%d", &freq1, &freq2, &time) == 3) { /* f1*f2/time format */ modulate = 1; #if 0 printf("f1+f2/time format: %d, %d, %d\n", freq1, freq2, time); #endif } else if (sscanf(s, "%d+%d", &freq1, &freq2) == 2) { #if 0 printf("f1+f2 format: %d, %d\n", freq1, freq2); #endif time = 0; } else if (sscanf(s, "%d*%d", &freq1, &freq2) == 2) { modulate = 1; #if 0 printf("f1+f2 format: %d, %d\n", freq1, freq2); #endif time = 0; } else if (sscanf(s, "%d/%d", &freq1, &time) == 2) { #if 0 printf("f1/time format: %d, %d\n", freq1, time); #endif freq2 = 0; } else if (sscanf(s, "%d", &freq1) == 1) { #if 0 printf("f1 format: %d\n", freq1); #endif firstnobang = *count; freq2 = 0; time = 0; } else { fprintf(stderr, "tone component '%s' of '%s' is a syntax error\n", s,t->data); return -1; } #if 0 printf("Using %d samples for %d and %d\n", time * 8, freq1, freq2); #endif if (size < sizeof(*td)) { fprintf(stderr, "Not enough space for tones\n"); return -1; } td = data; /* Bring it down -8 dbm */ gain = pow(10.0, (LEVEL - 3.14) / 20.0) * 65536.0 / 2.0; td->fac1 = 2.0 * cos(2.0 * M_PI * (freq1 / 8000.0)) * 32768.0; td->init_v2_1 = sin(-4.0 * M_PI * (freq1 / 8000.0)) * gain; td->init_v3_1 = sin(-2.0 * M_PI * (freq1 / 8000.0)) * gain; td->fac2 = 2.0 * cos(2.0 * M_PI * (freq2 / 8000.0)) * 32768.0; td->init_v2_2 = sin(-4.0 * M_PI * (freq2 / 8000.0)) * gain; td->init_v3_2 = sin(-2.0 * M_PI * (freq2 / 8000.0)) * gain; td->modulate = modulate; data += sizeof(*td); used += sizeof(*td); size -= sizeof(*td); td->tone = t->toneid; if (time) { /* We should move to the next tone */ td->next = *count + 1; td->samples = time * 8; } else { /* Stay with us */ td->next = *count; td->samples = 8000; } *count += 1; s = strtok(NULL, ","); } if (td && time) { /* If we don't end on a solid tone, return */ td->next = firstnobang; } if (firstnobang < 0) fprintf(stderr, "tone '%s' does not end with a solid tone or silence (all tone components have an exclamation mark)\n", t->data); return used; } char *tone_zone_tone_name(int id) { static char tmp[80]; switch(id) { case DAHDI_TONE_DIALTONE: return "Dialtone"; case DAHDI_TONE_BUSY: return "Busy"; case DAHDI_TONE_RINGTONE: return "Ringtone"; case DAHDI_TONE_CONGESTION: return "Congestion"; case DAHDI_TONE_CALLWAIT: return "Call Waiting"; case DAHDI_TONE_DIALRECALL: return "Dial Recall"; case DAHDI_TONE_RECORDTONE: return "Record Tone"; case DAHDI_TONE_CUST1: return "Custom 1"; case DAHDI_TONE_CUST2: return "Custom 2"; case DAHDI_TONE_INFO: return "Special Information"; case DAHDI_TONE_STUTTER: return "Stutter Dialtone"; default: snprintf(tmp, sizeof(tmp), "Unknown tone %d", id); return tmp; } } #ifdef TONEZONE_DRIVER static void dump_tone_zone(void *data, int size) { struct dahdi_tone_def_header *z; struct dahdi_tone_def *td; int x; int len = sizeof(*z); z = data; data += sizeof(*z); printf("Header: %d tones, %d bytes of data, zone %d (%s)\n", z->count, size, z->zone, z->name); for (x = 0; x < z->count; x++) { td = data; printf("Tone Fragment %d: tone is %d, next is %d, %d samples\n", x, td->tone, td->next, td->samples); data += sizeof(*td); len += sizeof(*td); } printf("Total measured bytes of data: %d\n", len); } #endif /* Tone frequency tables */ struct mf_tone { int tone; float f1; /* first freq */ float f2; /* second freq */ }; static struct mf_tone dtmf_tones[] = { { DAHDI_TONE_DTMF_0, 941.0, 1336.0 }, { DAHDI_TONE_DTMF_1, 697.0, 1209.0 }, { DAHDI_TONE_DTMF_2, 697.0, 1336.0 }, { DAHDI_TONE_DTMF_3, 697.0, 1477.0 }, { DAHDI_TONE_DTMF_4, 770.0, 1209.0 }, { DAHDI_TONE_DTMF_5, 770.0, 1336.0 }, { DAHDI_TONE_DTMF_6, 770.0, 1477.0 }, { DAHDI_TONE_DTMF_7, 852.0, 1209.0 }, { DAHDI_TONE_DTMF_8, 852.0, 1336.0 }, { DAHDI_TONE_DTMF_9, 852.0, 1477.0 }, { DAHDI_TONE_DTMF_s, 941.0, 1209.0 }, { DAHDI_TONE_DTMF_p, 941.0, 1477.0 }, { DAHDI_TONE_DTMF_A, 697.0, 1633.0 }, { DAHDI_TONE_DTMF_B, 770.0, 1633.0 }, { DAHDI_TONE_DTMF_C, 852.0, 1633.0 }, { DAHDI_TONE_DTMF_D, 941.0, 1633.0 }, { 0, 0, 0 } }; static struct mf_tone mfr1_tones[] = { { DAHDI_TONE_MFR1_0, 1300.0, 1500.0 }, { DAHDI_TONE_MFR1_1, 700.0, 900.0 }, { DAHDI_TONE_MFR1_2, 700.0, 1100.0 }, { DAHDI_TONE_MFR1_3, 900.0, 1100.0 }, { DAHDI_TONE_MFR1_4, 700.0, 1300.0 }, { DAHDI_TONE_MFR1_5, 900.0, 1300.0 }, { DAHDI_TONE_MFR1_6, 1100.0, 1300.0 }, { DAHDI_TONE_MFR1_7, 700.0, 1500.0 }, { DAHDI_TONE_MFR1_8, 900.0, 1500.0 }, { DAHDI_TONE_MFR1_9, 1100.0, 1500.0 }, { DAHDI_TONE_MFR1_KP, 1100.0, 1700.0 }, /* KP */ { DAHDI_TONE_MFR1_ST, 1500.0, 1700.0 }, /* ST */ { DAHDI_TONE_MFR1_STP, 900.0, 1700.0 }, /* KP' or ST' */ { DAHDI_TONE_MFR1_ST2P, 1300.0, 1700.0 }, /* KP'' or ST'' */ { DAHDI_TONE_MFR1_ST3P, 700.0, 1700.0 }, /* KP''' or ST''' */ { 0, 0, 0 } }; static struct mf_tone mfr2_fwd_tones[] = { { DAHDI_TONE_MFR2_FWD_1, 1380.0, 1500.0 }, { DAHDI_TONE_MFR2_FWD_2, 1380.0, 1620.0 }, { DAHDI_TONE_MFR2_FWD_3, 1500.0, 1620.0 }, { DAHDI_TONE_MFR2_FWD_4, 1380.0, 1740.0 }, { DAHDI_TONE_MFR2_FWD_5, 1500.0, 1740.0 }, { DAHDI_TONE_MFR2_FWD_6, 1620.0, 1740.0 }, { DAHDI_TONE_MFR2_FWD_7, 1380.0, 1860.0 }, { DAHDI_TONE_MFR2_FWD_8, 1500.0, 1860.0 }, { DAHDI_TONE_MFR2_FWD_9, 1620.0, 1860.0 }, { DAHDI_TONE_MFR2_FWD_10, 1740.0, 1860.0 }, { DAHDI_TONE_MFR2_FWD_11, 1380.0, 1980.0 }, { DAHDI_TONE_MFR2_FWD_12, 1500.0, 1980.0 }, { DAHDI_TONE_MFR2_FWD_13, 1620.0, 1980.0 }, { DAHDI_TONE_MFR2_FWD_14, 1740.0, 1980.0 }, { DAHDI_TONE_MFR2_FWD_15, 1860.0, 1980.0 }, { 0, 0, 0 } }; static struct mf_tone mfr2_rev_tones[] = { { DAHDI_TONE_MFR2_REV_1, 1020.0, 1140.0 }, { DAHDI_TONE_MFR2_REV_2, 900.0, 1140.0 }, { DAHDI_TONE_MFR2_REV_3, 900.0, 1020.0 }, { DAHDI_TONE_MFR2_REV_4, 780.0, 1140.0 }, { DAHDI_TONE_MFR2_REV_5, 780.0, 1020.0 }, { DAHDI_TONE_MFR2_REV_6, 780.0, 900.0 }, { DAHDI_TONE_MFR2_REV_7, 660.0, 1140.0 }, { DAHDI_TONE_MFR2_REV_8, 660.0, 1020.0 }, { DAHDI_TONE_MFR2_REV_9, 660.0, 900.0 }, { DAHDI_TONE_MFR2_REV_10, 660.0, 780.0 }, { DAHDI_TONE_MFR2_REV_11, 540.0, 1140.0 }, { DAHDI_TONE_MFR2_REV_12, 540.0, 1020.0 }, { DAHDI_TONE_MFR2_REV_13, 540.0, 900.0 }, { DAHDI_TONE_MFR2_REV_14, 540.0, 780.0 }, { DAHDI_TONE_MFR2_REV_15, 540.0, 660.0 }, { 0, 0, 0 } }; static int build_mf_tones(void *data, int size, int *count, struct mf_tone *tone, int low_tone_level, int high_tone_level) { struct dahdi_tone_def *td; float gain; int used = 0; while (tone->tone) { if (size < sizeof(*td)) { fprintf(stderr, "Not enough space for samples\n"); return -1; } td = data; data += sizeof(*td); used += sizeof(*td); size -= sizeof(*td); td->tone = tone->tone; *count += 1; /* Bring it down 6 dBm */ gain = pow(10.0, (low_tone_level - 3.14) / 20.0) * 65536.0 / 2.0; td->fac1 = 2.0 * cos(2.0 * M_PI * (tone->f1 / 8000.0)) * 32768.0; td->init_v2_1 = sin(-4.0 * M_PI * (tone->f1 / 8000.0)) * gain; td->init_v3_1 = sin(-2.0 * M_PI * (tone->f1 / 8000.0)) * gain; gain = pow(10.0, (high_tone_level - 3.14) / 20.0) * 65536.0 / 2.0; td->fac2 = 2.0 * cos(2.0 * M_PI * (tone->f2 / 8000.0)) * 32768.0; td->init_v2_2 = sin(-4.0 * M_PI * (tone->f2 / 8000.0)) * gain; td->init_v3_2 = sin(-2.0 * M_PI * (tone->f2 / 8000.0)) * gain; tone++; } return used; } int tone_zone_register_zone(int fd, struct tone_zone *z) { char buf[MAX_SIZE]; int res; int count = 0; int x; int space = MAX_SIZE; void *ptr = buf; int iopenedit = 1; struct dahdi_tone_def_header *h; memset(buf, 0, sizeof(buf)); h = ptr; ptr += sizeof(*h); space -= sizeof(*h); h->zone = z->zone; dahdi_copy_string(h->name, z->description, sizeof(h->name)); for (x = 0; x < DAHDI_MAX_CADENCE; x++) h->ringcadence[x] = z->ringcadence[x]; for (x = 0; x < DAHDI_TONE_MAX; x++) { if (!strlen(z->tones[x].data)) continue; #if 0 printf("Tone: %d, string: %s\n", z->tones[x].toneid, z->tones[x].data); #endif if ((res = build_tone(ptr, space, &z->tones[x], &count)) < 0) { fprintf(stderr, "Tone %d not built.\n", x); return -1; } ptr += res; space -= res; } if ((res = build_mf_tones(ptr, space, &count, dtmf_tones, z->dtmf_low_level, z->dtmf_high_level)) < 0) { fprintf(stderr, "Could not build DTMF tones.\n"); return -1; } ptr += res; space -= res; if ((res = build_mf_tones(ptr, space, &count, mfr1_tones, z->mfr1_level, z->mfr1_level)) < 0) { fprintf(stderr, "Could not build MFR1 tones.\n"); return -1; } ptr += res; space -= res; if ((res = build_mf_tones(ptr, space, &count, mfr2_fwd_tones, z->mfr2_level, z->mfr2_level)) < 0) { fprintf(stderr, "Could not build MFR2 FWD tones.\n"); return -1; } ptr += res; space -= res; if ((res = build_mf_tones(ptr, space, &count, mfr2_rev_tones, z->mfr2_level, z->mfr2_level)) < 0) { fprintf(stderr, "Could not build MFR2 REV tones.\n"); return -1; } ptr += res; space -= res; h->count = count; if (fd < 0) { if ((fd = open(DEFAULT_DAHDI_DEV, O_RDWR)) < 0) { fprintf(stderr, "Unable to open %s and fd not provided\n", DEFAULT_DAHDI_DEV); return -1; } iopenedit = 1; } x = z->zone; if ((res = ioctl(fd, DAHDI_FREEZONE, &x))) { if (errno != EBUSY) fprintf(stderr, "ioctl(DAHDI_FREEZONE) failed: %s\n", strerror(errno)); return res; } #if defined(TONEZONE_DRIVER) dump_tone_zone(h, MAX_SIZE - space); #endif if ((res = ioctl(fd, DAHDI_LOADZONE, h))) { fprintf(stderr, "ioctl(DAHDI_LOADZONE) failed: %s\n", strerror(errno)); return res; } if (iopenedit) close(fd); return res; } int tone_zone_register(int fd, char *country) { struct tone_zone *z; z = tone_zone_find(country); if (z) { return tone_zone_register_zone(-1, z); } else { return -1; } } int tone_zone_set_zone(int fd, char *country) { int res=-1; struct tone_zone *z; if (fd > -1) { z = tone_zone_find(country); if (z) res = ioctl(fd, DAHDI_SETTONEZONE, &z->zone); if ((res < 0) && (errno == ENODATA)) { tone_zone_register_zone(fd, z); res = ioctl(fd, DAHDI_SETTONEZONE, &z->zone); } } return res; } int tone_zone_get_zone(int fd) { int x=-1; if (fd > -1) { ioctl(fd, DAHDI_GETTONEZONE, &x); return x; } return -1; } int tone_zone_play_tone(int fd, int tone) { struct tone_zone *z; int res = -1; int zone; #if 0 fprintf(stderr, "Playing tone %d (%s) on %d\n", tone, tone_zone_tone_name(tone), fd); #endif if (fd > -1) { res = ioctl(fd, DAHDI_SENDTONE, &tone); if ((res < 0) && (errno == ENODATA)) { ioctl(fd, DAHDI_GETTONEZONE, &zone); z = tone_zone_find_by_num(zone); if (z) { res = tone_zone_register_zone(fd, z); /* Recall the zone */ ioctl(fd, DAHDI_SETTONEZONE, &zone); if (res < 0) { fprintf(stderr, "Failed to register zone '%s': %s\n", z->description, strerror(errno)); } else { res = ioctl(fd, DAHDI_SENDTONE, &tone); } } else fprintf(stderr, "Don't know anything about zone %d\n", zone); } } return res; } dahdi-tools-2.2.0-rc2/ifup-hdlc0000664000000000000000000000146211033237351014705 0ustar rootroot#!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin cd /etc/sysconfig/network-scripts . network-functions CONFIG=$1 source_config if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ] then exit fi if [ -z "${MODE}" ]; then echo "No mode specified!" exit fi sethdlc ${DEVICE} mode ${MODE} ifconfig ${DEVICE} ${IPADDR} pointopoint ${REMIP} route add -net ${NETWORK} netmask ${NETMASK} ${DEVICE} # this is broken! it's only here to keep compatibility with old RH sytstems if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ] then route add default gw ${GATEWAY} metric 1 ${DEVICE} fi . /etc/sysconfig/network if [ "${GATEWAY}" != "" ]; then if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then # set up default gateway route add default gw ${GATEWAY} fi fi /etc/sysconfig/network-scripts/ifup-post $1 dahdi-tools-2.2.0-rc2/dahdi_diag.c0000664000000000000000000000263311111641664015314 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include "dahdi_tools_version.h" int main(int argc, char *argv[]) { int fd; int chan; if ((argc < 2) || (sscanf(argv[1], "%d", &chan) != 1)) { fprintf(stderr, "Usage: dahdi_diag \n"); exit(1); } fd = open("/dev/dahdi/ctl", O_RDWR); if (fd < 0) { perror("open(/dev/dahdi/ctl"); exit(1); } if (ioctl(fd, DAHDI_CHANDIAG, &chan)) { perror("ioctl(DAHDI_CHANDIAG)"); exit(1); } exit(0); } dahdi-tools-2.2.0-rc2/dahdi.xml0000664000000000000000000000175011066515340014705 0ustar rootroot no hdlc no libnewt dahdi-tools-2.2.0-rc2/dahdi_scan.c0000664000000000000000000001253411071460715015336 0ustar rootroot/* * Scan and output information about DAHDI spans and ports. * * Written by Brandon Kruse * and Kevin P. Fleming * Copyright (C) 2007 Digium, Inc. * * Based on zttool written by Mark Spencer * * All rights reserved. * */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include "dahdi_tools_version.h" int main(int argc, char *argv[]) { int ctl; int x, y, z; struct dahdi_params params; unsigned int basechan = 1; struct dahdi_spaninfo s; char buf[100]; char alarms[50]; int filter_count = 0; int span_filter[DAHDI_MAX_SPANS]; if ((ctl = open("/dev/dahdi/ctl", O_RDWR)) < 0) { fprintf(stderr, "Unable to open /dev/dahdi/ctl: %s\n", strerror(errno)); exit(1); } for (x = 1; x < argc && filter_count < DAHDI_MAX_SPANS; x++) { int s = atoi(argv[x]); if (s > 0) { span_filter[filter_count++] = s; } } for (x = 1; x < DAHDI_MAX_SPANS; x++) { if (filter_count > 0) { int match = 0; for (z = 0; z < filter_count; z++) { if (x == span_filter[z]) { match = 1; break; } } if (!match) { continue; } } memset(&s, 0, sizeof(s)); s.spanno = x; if (ioctl(ctl, DAHDI_SPANSTAT, &s)) continue; alarms[0] = '\0'; if (s.alarms) { if (s.alarms & DAHDI_ALARM_BLUE) strcat(alarms,"BLU/"); if (s.alarms & DAHDI_ALARM_YELLOW) strcat(alarms, "YEL/"); if (s.alarms & DAHDI_ALARM_RED) strcat(alarms, "RED/"); if (s.alarms & DAHDI_ALARM_LOOPBACK) strcat(alarms,"LB/"); if (s.alarms & DAHDI_ALARM_RECOVER) strcat(alarms,"REC/"); if (s.alarms & DAHDI_ALARM_NOTOPEN) strcat(alarms, "NOP/"); if (!strlen(alarms)) strcat(alarms, "UUU/"); if (strlen(alarms)) { /* Strip trailing / */ alarms[strlen(alarms)-1]='\0'; } } else { if (s.numchans) strcpy(alarms, "OK"); else strcpy(alarms, "UNCONFIGURED"); } fprintf(stdout, "[%d]\n", x); fprintf(stdout, "active=yes\n"); fprintf(stdout, "alarms=%s\n", alarms); fprintf(stdout, "description=%s\n", s.desc); fprintf(stdout, "name=%s\n", s.name); fprintf(stdout, "manufacturer=%s\n", s.manufacturer); fprintf(stdout, "devicetype=%s\n", s.devicetype); fprintf(stdout, "location=%s\n", s.location); fprintf(stdout, "basechan=%d\n", basechan); fprintf(stdout, "totchans=%d\n", s.totalchans); fprintf(stdout, "irq=%d\n", s.irq); y = basechan; memset(¶ms, 0, sizeof(params)); params.channo = y; if (ioctl(ctl, DAHDI_GET_PARAMS, ¶ms)) { basechan += s.totalchans; continue; } if (params.sigcap & (__DAHDI_SIG_DACS | DAHDI_SIG_CAS)) { /* this is a digital span */ fprintf(stdout, "type=digital-%s\n", s.spantype); fprintf(stdout, "syncsrc=%d\n", s.syncsrc); fprintf(stdout, "lbo=%s\n", s.lboname); fprintf(stdout, "coding_opts="); buf[0] = '\0'; if (s.linecompat & DAHDI_CONFIG_B8ZS) strcat(buf, "B8ZS,"); if (s.linecompat & DAHDI_CONFIG_AMI) strcat(buf, "AMI,"); if (s.linecompat & DAHDI_CONFIG_HDB3) strcat(buf, "HDB3,"); buf[strlen(buf) - 1] = '\0'; fprintf(stdout, "%s\n", buf); fprintf(stdout, "framing_opts="); buf[0] = '\0'; if (s.linecompat & DAHDI_CONFIG_ESF) strcat(buf, "ESF,"); if (s.linecompat & DAHDI_CONFIG_D4) strcat(buf, "D4,"); if (s.linecompat & DAHDI_CONFIG_CCS) strcat(buf, "CCS,"); if (s.linecompat & DAHDI_CONFIG_CRC4) strcat(buf, "CRC4,"); buf[strlen(buf) - 1] = '\0'; fprintf(stdout, "%s\n", buf); fprintf(stdout, "coding="); if (s.lineconfig & DAHDI_CONFIG_B8ZS) fprintf(stdout, "B8ZS"); else if (s.lineconfig & DAHDI_CONFIG_AMI) fprintf(stdout, "AMI"); else if (s.lineconfig & DAHDI_CONFIG_HDB3) fprintf(stdout, "HDB3"); fprintf(stdout, "\n"); fprintf(stdout, "framing="); if (s.lineconfig & DAHDI_CONFIG_ESF) fprintf(stdout, "ESF"); else if (s.lineconfig & DAHDI_CONFIG_D4) fprintf(stdout, "D4"); else if (s.lineconfig & DAHDI_CONFIG_CCS) fprintf(stdout, "CCS"); else if (s.lineconfig & DAHDI_CONFIG_CRC4) fprintf(stdout, "/CRC4"); fprintf(stdout, "\n"); } else { /* this is an analog span */ fprintf(stdout, "type=analog\n"); for (y = basechan; y < (basechan + s.totalchans); y++) { memset(¶ms, 0, sizeof(params)); params.channo = y; if (ioctl(ctl, DAHDI_GET_PARAMS, ¶ms)) { fprintf(stdout, "port=%d,unknown\n", y); continue; }; fprintf(stdout, "port=%d,", y); switch (params.sigcap & (__DAHDI_SIG_FXO | __DAHDI_SIG_FXS)) { case __DAHDI_SIG_FXO: fprintf(stdout, "FXS"); break; case __DAHDI_SIG_FXS: fprintf(stdout, "FXO"); break; default: fprintf(stdout, "none"); } if (params.sigcap & DAHDI_SIG_BROKEN) fprintf(stdout, " FAILED"); fprintf(stdout, "\n"); } } basechan += s.totalchans; } exit(0); } dahdi-tools-2.2.0-rc2/dahdi_monitor.c0000664000000000000000000004510311173346732016104 0ustar rootroot/* * Monitor a DAHDI Channel * * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include #include #include "dahdi_tools_version.h" #include /* * defines for file handle numbers */ #define MON_BRX 0 /*!< both channels if multichannel==1 or receive otherwise */ #define MON_TX 1 /*!< transmit channel */ #define MON_PRE_BRX 2 /*!< same as MON_BRX but before echo cancellation */ #define MON_PRE_TX 3 /*!< same as MON_TX but before echo cancellation */ #define MON_STEREO 4 /*!< stereo mix of rx/tx streams */ #define MON_PRE_STEREO 5 /*!< stereo mix of rx/tx before echo can. This is exactly what is fed into the echo can */ #define BLOCK_SIZE 240 #define BUFFERS 4 #define FRAG_SIZE 8 /* Put the ofh (output file handles) outside the main loop in case we ever add a * signal handler. */ static FILE *ofh[6]; static int stereo; static int verbose; int audio_open(void) { int fd; int speed = 8000; int fmt = AFMT_S16_LE; int fragsize = (BUFFERS << 16) | (FRAG_SIZE); struct audio_buf_info ispace, ospace; fd = open("/dev/dsp", O_WRONLY); if (fd < 0) { fprintf(stderr, "Unable to open /dev/dsp: %s\n", strerror(errno)); return -1; } /* Step 1: Signed linear */ if (ioctl(fd, SNDCTL_DSP_SETFMT, &fmt) < 0) { fprintf(stderr, "ioctl(SETFMT) failed: %s\n", strerror(errno)); close(fd); return -1; } /* Step 2: Make non-stereo */ if (ioctl(fd, SNDCTL_DSP_STEREO, &stereo) < 0) { fprintf(stderr, "ioctl(STEREO) failed: %s\n", strerror(errno)); close(fd); return -1; } if (stereo != 0) { fprintf(stderr, "Can't turn stereo off :(\n"); } /* Step 3: Make 8000 Hz */ if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) < 0) { fprintf(stderr, "ioctl(SPEED) failed: %s\n", strerror(errno)); close(fd); return -1; } if (speed != 8000) { fprintf(stderr, "Warning: Requested 8000 Hz, got %d\n", speed); } if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &fragsize)) { fprintf(stderr, "Sound card won't let me set fragment size to %u %u-byte buffers (%x)\n" "so sound may be choppy: %s.\n", BUFFERS, (1 << FRAG_SIZE), fragsize, strerror(errno)); } bzero(&ispace, sizeof(ispace)); bzero(&ospace, sizeof(ospace)); if (ioctl(fd, SNDCTL_DSP_GETISPACE, &ispace)) { /* They don't support block size stuff, so just return but notify the user */ fprintf(stderr, "Sound card won't let me know the input buffering...\n"); } if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &ospace)) { /* They don't support block size stuff, so just return but notify the user */ fprintf(stderr, "Sound card won't let me know the output buffering...\n"); } fprintf(stderr, "New input space: %d of %d %d byte fragments (%d bytes left)\n", ispace.fragments, ispace.fragstotal, ispace.fragsize, ispace.bytes); fprintf(stderr, "New output space: %d of %d %d byte fragments (%d bytes left)\n", ospace.fragments, ospace.fragstotal, ospace.fragsize, ospace.bytes); return fd; } int pseudo_open(void) { int fd; int x = 1; fd = open("/dev/dahdi/pseudo", O_RDWR); if (fd < 0) { fprintf(stderr, "Unable to open pseudo channel: %s\n", strerror(errno)); return -1; } if (ioctl(fd, DAHDI_SETLINEAR, &x)) { fprintf(stderr, "Unable to set linear mode: %s\n", strerror(errno)); close(fd); return -1; } x = BLOCK_SIZE; if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &x)) { fprintf(stderr, "unable to set sane block size: %s\n", strerror(errno)); close(fd); return -1; } return fd; } #define barlen 35 #define baroptimal 3250 //define barlevel 200 #define barlevel ((baroptimal/barlen)*2) #define maxlevel (barlen*barlevel) void draw_barheader() { char bar[barlen + 4]; memset(bar, '-', sizeof(bar)); memset(bar, '<', 1); memset(bar + barlen + 2, '>', 1); memset(bar + barlen + 3, '\0', 1); memcpy(bar + (barlen / 2), "(RX)", 4); printf("%s", bar); memcpy(bar + (barlen / 2), "(TX)", 4); printf(" %s\n", bar); } void draw_bar(int avg, int max) { char bar[barlen+5]; memset(bar, ' ', sizeof(bar)); max /= barlevel; avg /= barlevel; if (avg > barlen) avg = barlen; if (max > barlen) max = barlen; if (avg > 0) memset(bar, '#', avg); if (max > 0) memset(bar + max, '*', 1); bar[barlen+1] = '\0'; printf("%s", bar); fflush(stdout); } void visualize(short *tx, short *rx, int cnt) { int x; float txavg = 0; float rxavg = 0; static int txmax = 0; static int rxmax = 0; static int sametxmax = 0; static int samerxmax = 0; static int txbest = 0; static int rxbest = 0; float ms; static struct timeval last; struct timeval tv; gettimeofday(&tv, NULL); ms = (tv.tv_sec - last.tv_sec) * 1000.0 + (tv.tv_usec - last.tv_usec) / 1000.0; for (x = 0; x < cnt; x++) { txavg += abs(tx[x]); rxavg += abs(rx[x]); } txavg = abs(txavg / cnt); rxavg = abs(rxavg / cnt); if (txavg > txbest) txbest = txavg; if (rxavg > rxbest) rxbest = rxavg; /* Update no more than 10 times a second */ if (ms < 100) return; /* Save as max levels, if greater */ if (txbest > txmax) { txmax = txbest; sametxmax = 0; } if (rxbest > rxmax) { rxmax = rxbest; samerxmax = 0; } memcpy(&last, &tv, sizeof(last)); /* Clear screen */ printf("\r "); draw_bar(rxbest, rxmax); printf(" "); draw_bar(txbest, txmax); if (verbose) printf(" Rx: %5d (%5d) Tx: %5d (%5d)", rxbest, rxmax, txbest, txmax); txbest = 0; rxbest = 0; /* If we have had the same max hits for x times, clear the values */ sametxmax++; samerxmax++; if (sametxmax > 6) { txmax = 0; sametxmax = 0; } if (samerxmax > 6) { rxmax = 0; samerxmax = 0; } } int main(int argc, char *argv[]) { int afd = -1; int pfd[4] = {-1, -1, -1, -1}; short buf_brx[BLOCK_SIZE * 2]; short buf_tx[BLOCK_SIZE * 4]; short stereobuf[BLOCK_SIZE * 4]; int res_brx, res_tx; int visual = 0; int multichannel = 0; int ossoutput = 0; int preecho = 0; int savefile = 0; int stereo_output = 0; int limit = 0; int readcount = 0; int x, chan; struct dahdi_confinfo zc; int opt; extern char *optarg; if ((argc < 2) || (atoi(argv[1]) < 1)) { fprintf(stderr, "Usage: dahdi_monitor [-v[v]] [-m] [-o] [-l limit] [-f FILE | -s FILE | -r FILE1 -t FILE2] [-F FILE | -S FILE | -R FILE1 -T FILE2]\n"); fprintf(stderr, "Options:\n"); fprintf(stderr, " -v: Visual mode. Implies -m.\n"); fprintf(stderr, " -vv: Visual/Verbose mode. Implies -m.\n"); fprintf(stderr, " -l LIMIT: Stop after reading LIMIT bytes\n"); fprintf(stderr, " -m: Separate rx/tx streams.\n"); fprintf(stderr, " -o: Output audio via OSS. Note: Only 'normal' combined rx/tx streams are output via OSS.\n"); fprintf(stderr, " -f FILE: Save combined rx/tx stream to FILE. Cannot be used with -m.\n"); fprintf(stderr, " -r FILE: Save rx stream to FILE. Implies -m.\n"); fprintf(stderr, " -t FILE: Save tx stream to FILE. Implies -m.\n"); fprintf(stderr, " -s FILE: Save stereo rx/tx stream to FILE. Implies -m.\n"); fprintf(stderr, " -F FILE: Save combined pre-echocanceled rx/tx stream to FILE. Cannot be used with -m.\n"); fprintf(stderr, " -R FILE: Save pre-echocanceled rx stream to FILE. Implies -m.\n"); fprintf(stderr, " -T FILE: Save pre-echocanceled tx stream to FILE. Implies -m.\n"); fprintf(stderr, " -S FILE: Save pre-echocanceled stereo rx/tx stream to FILE. Implies -m.\n"); fprintf(stderr, "Examples:\n"); fprintf(stderr, "Save a stream to a file\n"); fprintf(stderr, " dahdi_monitor 1 -f stream.raw\n"); fprintf(stderr, "Visualize an rx/tx stream and save them to separate files.\n"); fprintf(stderr, " dahdi_monitor 1 -v -r streamrx.raw -t streamtx.raw\n"); fprintf(stderr, "Play a combined rx/tx stream via OSS and save it to a file\n"); fprintf(stderr, " dahdi_monitor 1 -o -f stream.raw\n"); fprintf(stderr, "Save a combined normal rx/tx stream and a combined 'preecho' rx/tx stream to files\n"); fprintf(stderr, " dahdi_monitor 1 -f stream.raw -F streampreecho.raw\n"); fprintf(stderr, "Save a normal rx/tx stream and a 'preecho' rx/tx stream to separate files\n"); fprintf(stderr, " dahdi_monitor 1 -m -r streamrx.raw -t streamtx.raw -R streampreechorx.raw -T streampreechotx.raw\n"); exit(1); } chan = atoi(argv[1]); while ((opt = getopt(argc, argv, "vmol:f:r:t:s:F:R:T:S:")) != -1) { switch (opt) { case '?': exit(EXIT_FAILURE); case 'v': if (visual) verbose = 1; visual = 1; multichannel = 1; break; case 'm': multichannel = 1; break; case 'o': ossoutput = 1; break; case 'l': if (sscanf(optarg, "%d", &limit) != 1 || limit < 0) limit = 0; fprintf(stderr, "Will stop reading after %d bytes\n", limit); break; case 'f': if (multichannel) { fprintf(stderr, "'%c' mode cannot be used when multichannel mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_BRX]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing combined stream to %s\n", optarg); savefile = 1; break; case 'F': if (multichannel) { fprintf(stderr, "'%c' mode cannot be used when multichannel mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_PRE_BRX]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing pre-echo combined stream to %s\n", optarg); preecho = 1; savefile = 1; break; case 'r': if (!multichannel && ofh[MON_BRX]) { fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_BRX]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing receive stream to %s\n", optarg); multichannel = 1; savefile = 1; break; case 'R': if (!multichannel && ofh[MON_PRE_BRX]) { fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_PRE_BRX]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_PRE_BRX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing pre-echo receive stream to %s\n", optarg); preecho = 1; multichannel = 1; savefile = 1; break; case 't': if (!multichannel && ofh[MON_BRX]) { fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_TX]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_TX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing transmit stream to %s\n", optarg); multichannel = 1; savefile = 1; break; case 'T': if (!multichannel && ofh[MON_PRE_BRX]) { fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_PRE_TX]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_PRE_TX] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing pre-echo transmit stream to %s\n", optarg); preecho = 1; multichannel = 1; savefile = 1; break; case 's': if (!multichannel && ofh[MON_BRX]) { fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_STEREO]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_STEREO] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing stereo stream to %s\n", optarg); multichannel = 1; savefile = 1; break; case 'S': if (!multichannel && ofh[MON_PRE_BRX]) { fprintf(stderr, "'%c' mode cannot be used when combined mode is enabled.\n", opt); exit(EXIT_FAILURE); } if (ofh[MON_PRE_STEREO]) { fprintf(stderr, "Cannot specify option '%c' more than once.\n", opt); exit(EXIT_FAILURE); } if ((ofh[MON_PRE_STEREO] = fopen(optarg, "w")) == NULL) { fprintf(stderr, "Could not open %s for writing: %s\n", optarg, strerror(errno)); exit(EXIT_FAILURE); } fprintf(stderr, "Writing pre-echo stereo stream to %s\n", optarg); preecho = 1; multichannel = 1; savefile = 1; break; } } if (ossoutput) { if (multichannel) { printf("Multi-channel audio is enabled. OSS output will be disabled.\n"); ossoutput = 0; } else { /* Open audio */ if ((afd = audio_open()) < 0) { printf("Cannot open audio ...\n"); ossoutput = 0; } } } if (!ossoutput && !multichannel && !savefile) { fprintf(stderr, "Nothing to do with the stream(s) ...\n"); exit(1); } /* Open Pseudo device */ if ((pfd[MON_BRX] = pseudo_open()) < 0) exit(1); if (multichannel && ((pfd[MON_TX] = pseudo_open()) < 0)) exit(1); if (preecho) { if ((pfd[MON_PRE_BRX] = pseudo_open()) < 0) exit(1); if (multichannel && ((pfd[MON_PRE_TX] = pseudo_open()) < 0)) exit(1); } /* Conference them */ if (multichannel) { memset(&zc, 0, sizeof(zc)); zc.chan = 0; zc.confno = chan; /* Two pseudo's, one for tx, one for rx */ zc.confmode = DAHDI_CONF_MONITOR; if (ioctl(pfd[MON_BRX], DAHDI_SETCONF, &zc) < 0) { fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); exit(1); } memset(&zc, 0, sizeof(zc)); zc.chan = 0; zc.confno = chan; zc.confmode = DAHDI_CONF_MONITORTX; if (ioctl(pfd[MON_TX], DAHDI_SETCONF, &zc) < 0) { fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); exit(1); } if (preecho) { memset(&zc, 0, sizeof(zc)); zc.chan = 0; zc.confno = chan; /* Two pseudo's, one for tx, one for rx */ zc.confmode = DAHDI_CONF_MONITOR_RX_PREECHO; if (ioctl(pfd[MON_PRE_BRX], DAHDI_SETCONF, &zc) < 0) { fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); exit(1); } memset(&zc, 0, sizeof(zc)); zc.chan = 0; zc.confno = chan; zc.confmode = DAHDI_CONF_MONITOR_TX_PREECHO; if (ioctl(pfd[MON_PRE_TX], DAHDI_SETCONF, &zc) < 0) { fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); exit(1); } } } else { memset(&zc, 0, sizeof(zc)); zc.chan = 0; zc.confno = chan; zc.confmode = DAHDI_CONF_MONITORBOTH; if (ioctl(pfd[MON_BRX], DAHDI_SETCONF, &zc) < 0) { fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); exit(1); } if (preecho) { memset(&zc, 0, sizeof(zc)); zc.chan = 0; zc.confno = chan; zc.confmode = DAHDI_CONF_MONITORBOTH_PREECHO; if (ioctl(pfd[MON_PRE_BRX], DAHDI_SETCONF, &zc) < 0) { fprintf(stderr, "Unable to monitor: %s\n", strerror(errno)); exit(1); } } } if (visual) { printf("\nVisual Audio Levels.\n"); printf("--------------------\n"); printf(" Use chan_dahdi.conf file to adjust the gains if needed.\n\n"); printf("( # = Audio Level * = Max Audio Hit )\n"); draw_barheader(); } /* Now, copy from pseudo to audio */ for (;;) { res_brx = read(pfd[MON_BRX], buf_brx, sizeof(buf_brx)); if (res_brx < 1) break; readcount += res_brx; if (ofh[MON_BRX]) x = fwrite(buf_brx, 1, res_brx, ofh[MON_BRX]); if (multichannel) { res_tx = read(pfd[MON_TX], buf_tx, res_brx); if (res_tx < 1) break; if (ofh[MON_TX]) x = fwrite(buf_tx, 1, res_tx, ofh[MON_TX]); if (stereo_output && ofh[MON_STEREO]) { for (x = 0; x < res_tx; x++) { stereobuf[x*2] = buf_brx[x]; stereobuf[x*2+1] = buf_tx[x]; } x = fwrite(stereobuf, 1, res_tx*2, ofh[MON_STEREO]); } if (visual) { if (res_brx == res_tx) visualize((short *)buf_tx, (short *)buf_brx, res_brx/2); else printf("Huh? res_tx = %d, res_brx = %d?\n", res_tx, res_brx); } } if (preecho) { res_brx = read(pfd[MON_PRE_BRX], buf_brx, sizeof(buf_brx)); if (res_brx < 1) break; if (ofh[MON_PRE_BRX]) x = fwrite(buf_brx, 1, res_brx, ofh[MON_PRE_BRX]); if (multichannel) { res_tx = read(pfd[MON_PRE_TX], buf_tx, res_brx); if (res_tx < 1) break; if (ofh[MON_PRE_TX]) x = fwrite(buf_tx, 1, res_tx, ofh[MON_PRE_TX]); if (stereo_output && ofh[MON_PRE_STEREO]) { for (x = 0; x < res_brx; x++) { stereobuf[x*2] = buf_brx[x]; stereobuf[x*2+1] = buf_tx[x]; } x = fwrite(stereobuf, 1, res_brx * 2, ofh[MON_PRE_STEREO]); } } } if (ossoutput && afd) { if (stereo) { for (x = 0; x < res_brx; x++) { buf_tx[x << 1] = buf_tx[(x << 1) + 1] = buf_brx[x]; } x = write(afd, buf_tx, res_brx << 1); } else { x = write(afd, buf_brx, res_brx); } } if (limit && readcount >= limit) { /* bail if we've read too much */ break; } } if (ofh[MON_BRX]) fclose(ofh[MON_BRX]); if (ofh[MON_TX]) fclose(ofh[MON_TX]); if (ofh[MON_PRE_BRX]) fclose(ofh[MON_PRE_BRX]); if (ofh[MON_PRE_TX]) fclose(ofh[MON_PRE_TX]); if (ofh[MON_STEREO]) fclose(ofh[MON_STEREO]); if (ofh[MON_PRE_STEREO]) fclose(ofh[MON_PRE_STEREO]); exit(0); } dahdi-tools-2.2.0-rc2/ChangeLog0000664000000000000000000007672011176125103014671 0ustar rootroot2009-04-29 Shaun Ruffell * dahdi-tools version 2.2.0-rc2 released. 2009-04-27 19:45 +0000 [r6512] Kevin P. Fleming * configure, acinclude.m4: incorporate the autoconf 2.63 fixes here too 2009-04-26 10:29 +0000 [r6492] Tzafrir Cohen * Makefile, xpp/xpp_order (removed): Remove useless sample file The sample xpp_order will be generated anyway when running 'dahdi_genconf xpporder' (see xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm) . No need to clutter the main DAHDI installation with it. 2009-04-23 17:03 +0000 [r6476] Tzafrir Cohen * Makefile, xpp/xpp_order: xpp: xpp_order is another config file that should go to /etc/dahdi Also slightly fix the sample config. 2009-04-22 10:25 +0000 [r6427-6442] Tzafrir Cohen * dahdi.init: make sure '/etc/init.d/dahdi stop' ends with a newline * ppp/dahdi.c: Yet another left-over DAHDI_PARAMS. ppp almost builds * xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm: Dahdi::Config::Gen::Xpporder: use number rather than object in warning 2009-04-21 13:44 +0000 [r6419-6421] Sean Bright * dahdi_monitor.c: Correct error check for fopen() calls in dahdi_monitor.c. dahdi_monitor.c was checking for an error calling fopen() by determining if the return value was less than 0. fopen(), however, returns a FILE * and returns NULL on failure. (closes issue #14894) Reported by: gknispel_proformatique Patches: dahdi_monitor_fix_check_fopen_result.patch uploaded by gknispel (license 261) * dahdi_monitor.c: Use correct return value type for getopt(). In dahdi_monitor.c, the return value of getopt() was being assigned to a char while the function actually returns an int. Fix suggested by reporter. (closes issue #14893) Reported by: gknispel_proformatique * dahdi_monitor.c: Whitespace and coding guidelines changes 2009-04-20 13:44 +0000 [r6417] Tzafrir Cohen * xpp/dahdi_hardware, xpp/perl_modules/Dahdi/Xpp/Xbus.pm, xpp/test_parse.c, xpp/twinstar, xpp/twinstar_hook, xpp/twinstar_setup, xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm (added), xpp/perl_modules/Dahdi/Xpp/Mpp.pm: xpp: twinstar-related perl improvements * New generator Dahdi::Config::Gen::Xpporder can generate and xpp_order config for an existing setup. * Add more TwinStar related logic to Dahdi::Xpp::Mpp. Simplifies the twinstar utility accordingly. * twinstar_hook: for the multiple Astribanks case. * twinstar_setup: More logic tests. Now delegates configuration generation to dahdi_genconf (with new Xpporder generator). * dahdi_hardware: Show number of channels with -v 2009-04-16 17:32 +0000 [r6375] Tzafrir Cohen * xpp/xpp_fxloader: xpp_fxloader: exit properly when run with incorrect argument 2009-04-10 09:53 +0000 [r6344] Tzafrir Cohen * xpp/Makefile, xpp/astribank_hook (added): Move astribank_hook from linux to tools. Install it by default 2009-04-07 08:13 +0000 [r6337] Tzafrir Cohen * xpp/hexfile.c: hexfile.c was accidentally left out of r6313 2009-04-02 20:56 +0000 [r6278-6313] Tzafrir Cohen * xpp/pic_loader.h (added), xpp/astribank_hexload.8 (added), xpp/twinstar_setup (added), xpp/xpp_fxloader, xpp/astribank_tool.c (added), xpp/astribank_allow.c (added), xpp, xpp/xpp_sync, xpp/dahdi_genconf, xpp/twinstar (added), xpp/mpp_funcs.c (added), xpp/Makefile, xpp/mpp_funcs.h (added), xpp/astribank_tool.8 (added), xpp/perl_modules/Dahdi/Xpp/Mpp.pm (added), xpp/astribank_upgrade (added), xpp/perl_modules/Dahdi/Xpp.pm, xpp/perl_modules/Dahdi/Hardware/PCI.pm, xpp/dahdi_hardware, xpp/twinstar_hook (added), xpp/xpp_order (added), xpp/astribank_hexload.c (added), xpp/dahdi_registration, xpp/perl_modules/Dahdi/Hardware/USB.pm, xpp/perl_modules/Dahdi/Xpp/Xbus.pm, xpp/debug.c (added), xpp/dahdi_drivers, xpp/lsdahdi, xpp/astribank_usb.c (added), xpp/hexfile.h, xpp/perl_modules/Dahdi/Hardware.pm, xpp/debug.h (added), xpp/astribank_usb.h (added), xpp/perl_modules/Dahdi/Xpp/Xpd.pm, xpp/mpp.h (added), xpp/pic_loader.c (added): Support for Astribanks 116x: tools part * New USB firmware loading mechanism. - Incompatible with previous one: upgrade using fxload or hard reset - astribank_hexload is the new low-level loading tool - fpga_load remains for backward compatibility. - xpp/astribank_upgrade: automate upgrading using fxload * Much enhanced control protocol ("MPP") - astribank_tool is the low-level tool for that. * Support for the TwinStar (dual USB port) - Managed through astribank_tool - Wrapper perl modules and scripts provided * Allow explicit ordering of Astribanks - /etc/dahdi/xpp_order - explicit order of Astribanks on the system - The default sorter is now to use those and fall back to connectors (previous default). - An option to dahdi_registration to change sorting. * hdlcstress.c: hdlcstress.c: add option -b not to stress BRI too much Aparantly the HFC chip can't stand the heat of this test. Let's give it an occasional rest. Also add getopts support. * Makefile: Install genconf_parameters on 'make install' as well * blacklist.sample: xpp_usb should not be blacklisted: it does not register automatically anyway. * xpp/perl_modules/Dahdi/Config/Gen/Modules.pm (added): Implement 'dahdi_genconf modules' (generate /etc/dahdi/modules) 2009-03-29 18:53 +0000 [r6272] Tzafrir Cohen * xpp/perl_modules/Dahdi/Config/Gen.pm: dahdi_genconf: Set the context same as groups. 2009-03-26 18:28 +0000 [r6261] Tzafrir Cohen * doc/dahdi_scan.8: s/zap/dahdi/ again in dahd_scan.8 2009-03-26 18:02 +0000 [r6259] Kevin P. Fleming * dahdi_cfg.c: when /etc/dahdi/system.conf does not have an echo canceller defined for a channel, but the channel previously had one assigned, running dahdi_cfg does not remove the assigned echo canceller from the channel as it should. this commit changes that behavior, so that every channel with a defined signaling mode is updated to have the proper (or no) echo canceller assigned. 2009-03-22 10:31 +0000 [r6215] Tzafrir Cohen * xpp/perl_modules/Dahdi/Config/Gen/Users.pm, xpp/perl_modules/Dahdi/Config/Gen/Chandahdi.pm, xpp/perl_modules/Dahdi/Config/Gen/System.pm, xpp/perl_modules/Dahdi/Config/Gen/Unicall.pm: dahdi-perl: "allow" hand-editing of generated files Rework the text added by dahdi_genconf generators to say that you can hand-edit files. But just don't complain if they get mysteriously overriden when it is run again :-) (closes issue #14569) Reported by: jtodd 2009-03-17 17:07 +0000 [r6189] Jason Parker * dahdi_monitor.c: Remove remnants of -p option, since it no longer exists. 2009-03-17 13:52 +0000 [r6187] Russell Bryant * zonedata.c: Add tone definitions for Turkey. (closes issue #10450) Reported by: msahinbas 2009-03-17 09:10 +0000 [r6167-6185] Tzafrir Cohen * Makefile: Use LIBS instead of LDFLAGS directly in tools Makefile The Makefile of dahdi-tools set the variable LDFLAGS directly, rather than adding to LIBS. This does not allow placing LIBS after all the linked objects. (closes issue #14638) Reported by: Chainsaw Patches: dahdi-tools-2.1.0.2-asneeded.patch uploaded by Chainsaw (license 723) * xpp/README.Astribank, xpp/xpp_sync, dahdi.init: dahdi.init: call xpp_sync a bit later. xpp_sync needs to only be called after dahdi_cfg was run, because the application of system.conf may change the priority of a PRI module span (If it is a sync provider, "NT", priority is lower). Also some documentation-only changes for xpp_sync. 2009-03-09 16:30 +0000 [r6110] Tzafrir Cohen * xpp/perl_modules/Dahdi/Chans.pm: Fix detection of channels of dynamic spans in Dahdi::Chans Fix the pattern detection of channels belonging to dynamic (dahdi_dynamic) spans in perl programs that use Dahdi::Chans (e.g.: lsdahdi) (closes issue #14630) Reported by: tamiel Patches: 20090309-perl5-Dahdi-Chans.diff uploaded by tamiel (license 712) 2009-03-07 00:10 +0000 [r6107] Tzafrir Cohen * xpp/perl_modules/Dahdi/Chans.pm, xpp/perl_modules/Dahdi/Hardware/USB.pm: Detect Sangoma USB FXO device; fix detection of Sangoma DAHDI channels (By Alessandro Zummo) 2009-03-05 21:10 +0000 [r6095] Tzafrir Cohen * dahdi.init: Fix a typo in shutting down dynamic spans in dahdi.init Fixes shutdown_dynamic() in the dahdi init.d script. Not enabling it by default just yet (the second half of the patch) until we get some further confirmation that such a shutdown is always good. (from issue #14603) Reported by: tamiel Patches: 20090304_dahdi.init.patch uploaded by tamiel (license 712) 2009-03-03 20:39 +0000 [r6071-6078] Tzafrir Cohen * Makefile, README, /: Include sample genconf_parameters in dahdi-tools README. * xpp/perl_modules/Dahdi/Config/Params.pm, xpp/perl_modules/Dahdi/Config/Gen.pm, xpp/genconf_parameters: genconf_parameters: Add option fxo_default_start; Document genconf_parameters * Add a dqahdi_genconf option fxo_default_start, equivalent of fxs_default_start. * Set all trunks in group 'group_lines' rather than hard-coded 0 (for TE) and 6 (for NT). * Document all parameters in genconf_parameters. * xpp/perl_modules/Dahdi/Config/Params.pm (added), xpp/dahdi_genconf, xpp/perl_modules/Dahdi/Config/Gen.pm, xpp/perl_modules/Dahdi/Config/Gen/Users.pm, xpp/perl_modules/Dahdi/Config/Gen/Chandahdi.pm, xpp/perl_modules/Dahdi/Config/Gen/System.pm, xpp/perl_modules/Dahdi/Config/Gen/Unicall.pm: dahdi_genconf: configuration handling cleanup. * Parsing genconf_parameters is now in Dahdi::Config::Params All hard-coded defaults are there too (in the item() method). * Dahdi::Config::Genconf is gone (merged into Dahdi::Config::Gen) All semantic mapping is in the constructor. * dahdi_genconf is now lean and mean. * Add some implementation docs into these files. * xpp/perl_modules/Dahdi/Config/Gen/System.pm: dahdi-perl: Do generate 'echocanceller' in system.conf Fixed a regression from r6013 . * xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm (removed): dahdi-perl: Remove an obsolete and unused module GenconfDefaults.pm * xpp/README.Astribank: README.Astribank: Killed one remaining /sys/devices/xpp 2009-03-01 14:29 +0000 [r6054-6058] Tzafrir Cohen * xpp/README.Astribank: More README updates * xpp/perl_modules/Dahdi/Xpp/Xbus.pm, xpp/dahdi_genconf, xpp/perl_modules/Dahdi/Config/Gen/Chandahdi.pm, xpp/perl_modules/Dahdi/Xpp/Xpd.pm: xpp-dahdi: freepbx code generation; better procfs compatibility * dahdi_genconf -F will generate chan_dahdi.conf for freepbx (like genzaptelconf -F) * Better procfs compatibility for xpp modules. * xpp/dahdi_drivers, xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm, xpp/perl_modules/Dahdi/Config/Gen.pm, xpp/perl_modules/Dahdi/Config/Gen/Users.pm: dahdi-perl: more defensive coding and some docs * xpp/perl_modules/Dahdi.pm: Dahdi.pm: the sample code should actually work. * xpp/fpga_load.c: fpga_load.c: Flush USB device buffer on startup. Fixes some firmware loading issues. 2009-02-26 15:41 +0000 [r6041-6043] Tzafrir Cohen * xpp/perl_modules/Dahdi/Hardware/PCI.pm: Add PCI IDs of another HFC-S card that zaphfc can handle. * xpp/perl_modules/Dahdi/Chans.pm: Fix a typo for detecting zaphfc. 2009-02-18 21:20 +0000 [r6022] Doug Bailey * fxstest.c: Remove 8 bit restriction on setting indirect registers (closes issue #14323) Reported by: alecdavis Patches: fxstest_setindirect.diff.txt uploaded by alecdavis (license 585) Tested by: alecdavis 2009-02-13 21:09 +0000 [r6013] Tzafrir Cohen * xpp/dahdi_genconf, xpp/perl_modules/Dahdi/Config/Gen.pm (added), xpp/perl_modules/Dahdi/Config/Gen/Users.pm (added), xpp/perl_modules/Dahdi/Config/Gen/Chandahdi.pm (added), xpp/perl_modules/Dahdi/Config/Gen/System.pm (added), xpp/perl_modules/Dahdi/Config/Gen (added), xpp/perl_modules/Dahdi/Config/Gen/Unicall.pm (added): Rework dahdi_genconf to have separate configuration generation modules. 'dahdi_genconf foo bar' will use the modules Dahdi::Config::Gen::Foo and Dahdi::Config::Gen::Bar to generate configuraion files. Extra formats can thus be added without modifying dahdi_genconf and independently of DAHDI. 2009-02-08 11:04 +0000 [r5984] Tzafrir Cohen * xpp/dahdi_genconf: dahdi_genconf: do reset default files list when command-line has files This fixes a regression that was added whwn handling of R2 was added. Originally: Xorcom rev 6683. 2009-01-28 18:49 +0000 [r5886] Shaun Ruffell * dahdi.init: Use the dahdihpec_enable tool instead of the zaphpec_enable. Issue: DAHDI-233 patch by: cmoye 2009-01-27 15:14 +0000 [r5827] Doug Bailey * fxstest.c: Break VMWI ioctl calls into two separate calls to maintain old revision compatibility (issue #14104) Reported by: alecdavis Tested by: dbailey 2009-01-25 00:50 +0000 [r5808-5809] Sean Bright * dahdi.init: Use the debian commands on Gentoo. (closes issue #14277) Reported by: darren1713 Patches: dahdi.init.txt uploaded by darren1713 (license 116) 2009-01-22 15:45 +0000 [r5800] Doug Bailey * fxstest.c: Alec Davis change to modify vmwi test to use new ioctl call structure and enhance functionality (issue #14104) Reported by: alecdavis Patches: mwiioctl_structure_fxstest.diff.txt uploaded by dbailey (license ) Tested by: alecdavis, dbailey 2009-01-20 18:54 +0000 [r5768] Tzafrir Cohen * xpp/dahdi_genconf: dahdi_genconf: Finally set $fxs_default_start = 'ks' rather than 'ls' 2009-01-19 15:19 +0000 [r5728] Doug Bailey * fxstest.c: Add test to excercise VMWI Enhance polarity test by making sure the line is in an active state before testing (issue #14104) Reported by: alecdavis Patches: dahditools-14104.diff.txt uploaded by dbailey (license ) Tested by: alecdavis 2009-01-19 12:46 +0000 [r5705-5707] Tzafrir Cohen * Makefile: dahdi-tools: Delete test binaries on 'make clean' * xpp/perl_modules/Dahdi/Xpp/Xpd.pm, xpp/xpp_sync: xpp_sync xpd order fix. * xpp/perl_modules/Dahdi/Span.pm: Dahdi-perl: Do detect Astribank PRI modules. 2009-01-18 10:22 +0000 [r5671] Tzafrir Cohen * xpp/perl_modules/Dahdi/Xpp/Xbus.pm, xpp/perl_modules/Dahdi/Chans.pm, xpp/perl_modules/Dahdi/Xpp/Line.pm, xpp/perl_modules/Dahdi/Span.pm, xpp/perl_modules/Dahdi/Xpp/Xpd.pm, xpp/xpp_sync, xpp/perl_modules/Dahdi/Xpp.pm: XPP tool updates to match r5663: sysfs migration. 2009-01-16 14:18 +0000 [r5662] Sean Bright * configure, configure.ac: Properly detect GENERIC_HDLC_VERSION on various kernel versions. (closes issue #14150) Reported by: ccesario Patches: 20090115__bug14150.diff.txt uploaded by seanbright (license 71) Tested by: ccesario 2009-01-15 12:47 +0000 [r5661] Tzafrir Cohen * xpp/dahdi_genconf: Add an extra output format, 'asterisk': make the configuration readable for an Asterisk configuration parser. 2009-01-14 20:06 +0000 [r5656-5660] Sean Bright * hdlctest.c: Whitespace and coding guidelines changes only. * hdlctest.c: Fix some uninitialized variable warnings that were causing hdlctest to not compile. Tested the program as well and it appears to work correctly. (closes issue #13906) Reported by: tzafrir * dahdi_monitor.c: This commit deserves no comment. * dahdi_monitor.c: The problem with using dahdi_copy_string here is that it is guaranteed to NULL terminate the destination string, which in this case was not correct. So revert back to using strncpy and also decrease the buffer by 1 since it was reserving an extra byte behind NULL for some reason. Fix suggested by reporter. (closes issue #14103) Reported by: gork 2009-01-06 08:09 +0000 [r5643] Tzafrir Cohen * xpp/perl_modules/Dahdi/Hardware/PCI.pm: d00d must be in small caps 2009-01-03 21:14 +0000 [r5626] Tzafrir Cohen * xpp/perl_modules/Dahdi/Span.pm: Dahdi::Span: Remove an over-general span header "pri" pattern. Should fix #14061 . 2008-12-16 17:02 +0000 [r5555] Doug Bailey * fxotune.c: Add ability to use sine tables for systems that don't have efficient floating point Add the ability to print out the best results found during tuning Some format cleanup 2008-12-15 Shaun Ruffell * dahdi-tools version 2.1.0.2 released. 2008-12-15 20:19 +0000 [r5533] Shaun Ruffell * Makefile: Overwrite the libtonezone.so.1.0 and libtonezone.so.1 links and libraries in order to maintain binary compatibility with applications linked with dahdi-tools 2.0.0. 2008-12-15 11:19 +0000 [r5530-5532] Tzafrir Cohen * xpp/README.Astribank: README.Astribank: minor formatting fix. * xpp/README.Astribank: Document patching the xpp BRI driver for now. * dahdi_cfg.c: Allow the span timing to be up to 255. The test for 15 was ineffective anyway. Some drivers can use higher values. See issue #13954 . 2008-12-11 Shaun Ruffell * dahdi-tools version 2.1.0.1 released. 2008-12-11 22:45 +0000 [r5514] Tzafrir Cohen * dahdi.init: Drop the "redhat" action at the 'stop' case for now: RHEL4's 'action' only works with programs and not with functions. 2008-12-09 Shaun Ruffell * dahdi-tools version 2.1.0 released. 2008-12-09 19:41 +0000 [r5461] Shaun Ruffell * modules.sample: Adding the wctc4xxp driver to the modules.sample. 2008-12-08 14:02 +0000 [r5452] Tzafrir Cohen * xpp/perl_modules/Dahdi/Span.pm: Fix detection of the B410P card. All ports will be reported as TE. Tested by write_erase on #asterisk-dev. 2008-12-05 00:24 +0000 [r5432-5440] Tzafrir Cohen * xpp/dahdi_genconf: dahdi_genconf: add output type 'modules' (/etc/dahdi/modules) Also improved documentation. * xpp/README.Astribank: A minor formatting fix. 2008-12-01 18:41 +0000 [r5409-5426] Tzafrir Cohen * xpp/README.Astribank: Next README.Astribank revision: Devices are not under the bun. (And various other fixes) * xpp/README.Astribank: README.Astribank catching up with sysfs, dahdi and all. Many more entries in the table of contents. Most of sysfs is documented. 2008-11-27 10:01 +0000 [r5402-5404] Tzafrir Cohen * Makefile, /: dahdi-tools: Re-add README.Astribank.html generation. * xpp/README.Astribank (added): Moving README.Astribank to dahdi-tools . 2008-11-25 Shaun Ruffell * dahdi-tools version 2.1.0-rc5 released. 2008-11-24 20:42 +0000 [r5379-5381] Tzafrir Cohen * dahdi_cfg.c: dahdi_cfg: {} as per coding guidelines. * dahdi_cfg.c: dahdi_cfg: Make the message about echo canceller selection verbose. * xpp/waitfor_xpds, xpp/test_parse.c, xpp/xpp_fxloader, xpp/fpga_load.c: Add some missing copyright statements in the xpp/ directory as well. 2008-11-21 23:26 +0000 [r5365-5366] Kevin P. Fleming * dahdi_diag.c, hdlcstress.c, patgen.c, patlooptest.c, hdlcverify.c, fxstest.c, timertest.c, hdlcgen.c, pattest.c, dahdi_test.c, dahdi_speed.c, hdlctest.c: add copyright headers to all the files that don't have them * dahdi_monitor.c, fxotune.c: minor fixes to accommodate compilers who check return result usage 2008-11-19 21:16 +0000 [r5334] Tzafrir Cohen * dahdi.init: LSB init script comments. 2008-11-17 Shaun Ruffell * dahdi-tools version 2.1.0-rc4 released. 2008-11-16 17:55 +0000 [r5308-5309] Tzafrir Cohen * hdlcverify.c: Fix a compilation warning about signedness * hdlcstress.c, patgen.c, patlooptest.c, pattest.c, hdlctest.c: Fix usage strings and eliminate all traces of tor 2008-11-10 Shaun Ruffell * dahdi-tools 2.1.0-rc3 released. 2008-11-06 22:38 +0000 [r5266] Doug Bailey * zonedata.c: set DTMF twist levels for listed EU countries to meet TBR-21 standard of -9/-11 dB 2008-11-05 Shaun Ruffell * dahdi-tools 2.1.0-rc2 released. 2008-11-05 19:17 +0000 [r5231] Shaun Ruffell * system.conf.sample: Update system.conf.sample to clarify BRI configuration. 2008-11-04 15:58 +0000 [r5228] Shaun Ruffell * hdlcstress.c, hdlcverify.c, hdlcgen.c, hdlctest.c: Fix compilation issues with the hdlc tests. 2008-11-03 20:14 +0000 [r5226] Tzafrir Cohen * Makefile: Bump SONAME of libtonezone to 2.0: API and ABI have not changed from Zaptel, but the library behaves differently. 2008-11-03 Shaun Ruffell * dahdi-tools 2.1.0-rc1 released. 2008-10-28 20:42 +0000 [r5160] Tzafrir Cohen * xpp/perl_modules/Dahdi/Chans.pm: Get wcb4xxp listed in lsdahdi . 2008-10-28 18:34 +0000 [r5155] Shaun Ruffell * xpp/perl_modules/Dahdi/Hardware/PCI.pm, blacklist.sample, modules.sample: Adding support for the wcb4xxp module. 2008-10-27 16:07 +0000 [r5134] Tzafrir Cohen * xpp/perl_modules/Dahdi/Xpp/Line.pm, xpp/perl_modules/Dahdi/Xpp.pm: perl xpp: Support for FXO batter attribute from sysfs (from r5133). Still falls back to reading the battery status from procfs. Also fixes error message. 2008-10-16 18:03 +0000 [r5098-5099] Tzafrir Cohen * xpp/waitfor_xpds (added), xpp/perl_modules/Dahdi/Xpp/Line.pm, xpp/Makefile, xpp/perl_modules/Dahdi/Xpp/Xpd.pm, dahdi.init, xpp/perl_modules/Dahdi/Xpp.pm: xpp: userspace support for sysfx migration. The userspace side of dahdi-linux r5097. * Perl modules default to using xpp sysfs but will fallback (with warning) to procfs interface. * An additional /usr/share/dahdi/waitfor_xpds to replace the line in the init.d script. * xpp/dahdi_genconf: dahdi_genconf: report channel number in case of error. 2008-10-15 17:11 +0000 [r5094] Tzafrir Cohen * xpp/perl_modules/Dahdi/Chans.pm: Dahdi-perl: Fix detection of empty slots in Rhino analog cards. Closes issue #13685 2008-10-12 23:09 +0000 [r5088] Tzafrir Cohen * xpp/dahdi.cgi (added): A CGI script to give some information about Zaptel through the Dahdi perl interface. A simple demo. Not installed automatically. 2008-10-10 18:29 +0000 [r5079-5082] Tzafrir Cohen * Makefile: Fix 'make config' for distros with no chkconfig and no update-rc.d . This would cause the error on 'make config' for "unknown command dahdi", and 'make -n config' would show that it tries to run "dahdi defaults 15 30" * dahdi_test.c: revert r5077 as r5078 fixes this better: now we can use 8 entries in a line. * dahdi_test.c: make dahdi_test's prints fit in one line. It makes them slightly less "accurate", but we already use it in the verbose messages, and dahdi_test is not really accurate. 2008-10-10 16:15 +0000 [r5072-5077] Sean Bright * dahdi_test.c: Wrap at 6 instead of 8 so we are sure to fit on an 80 column terminal. * dahdi.init: Return the appropriate values to indicate if the modules are loaded or not. * dahdi.init: Add a status command to the DAHDI init script. (closes issue #13655) Reported by: jcollie Patches: 0001-Add-a-trivial-status-command-to-the-init-script.patch uploaded by jcollie (license 412) (Slight modification by me to update the usage text) 2008-10-03 19:37 +0000 [r5044] Tzafrir Cohen * xpp/perl_modules/Dahdi/Config/GenconfDefaults.pm: When the config file is not found: return "empty" data and don't die. Closes issues #13615 . 2008-10-03 19:03 +0000 [r5038-5042] Sean Bright * dahdi_test.c: Whitespace and formatting only. * dahdi_test.c: The first line was getting wrapped after 7 instead of 8. * xpp/genzaptelconf (removed), xpp/genzaptelconf.8 (removed): Remove some leftovers. * dahdi_scan.c, doc/dahdi_scan.8: Fix the dahdi_scan manpage (s/dahdi_span/dahdi_scan/) and make dahdi_scan do what it is advertised to do. Namely take span numbers on the command line. (closes issue #13614) Reported by: jfinstrom 2008-09-29 Shaun Ruffell * dahdi-tools 2.0.0 released. 2008-09-25 15:47 +0000 [r4984] Tzafrir Cohen * dahdi.init: dahdi_init: Fix a typo in xpp initialization (Stephen Farrell) 2008-09-24 19:54 +0000 [r4977] Sean Bright * build_tools/menuselect-deps.in, configure, configure.ac, dahdi.xml: Re-enable sethdlc by default in menuselect. Add configure checks to properly discover the linux/hdlc.h dependency. 2008-09-24 17:35 +0000 [r4975] Jason Parker * dahdi.xml: Disable sethdlc in menuselect by default. This is how it was in Zaptel, and it's causing issues. Ideally, this would eventually be checked in the configure script. 2008-09-23 04:56 +0000 [r4969] Shaun Ruffell * README: Removing the note about running install_prereq since from the README since that script is not present currently. 2008-09-16 18:26 +0000 [r4913-4915] Shaun Ruffell * dahdi.init: Remove the extra space printed after each line when a module is loaded. * dahdi_cfg.c: Close the /dev/dahdi/channel file handle if we're unable to associate it with a particular channel. * dahdi_cfg.c: Provide system error information if open on /dev/dahdi/channel fails. 2008-09-12 18:06 +0000 [r4904] Sean Bright * Makefile, /, configure, configure.ac, makeopts.in: A few changes: 1) Start using menuselect trunk 2) Bring in changes similar to those in asterisk trunk so that 'make menuselect' works as it should from the dahdi-tools directory. 3) Stop looking for curses/ncurses in the top level configure since nothing uses it (except menuselect which will find it on it's own). 2008-09-11 20:52 +0000 [r4894] Tzafrir Cohen * xpp/Makefile, xpp/xpp.rules (removed): Move udev rules xpp.rules from dahdi-tools to dahdi-linux . 2008-09-11 15:45 +0000 [r4891-4893] Jason Parker * Makefile: Fix installation of ifup-hdlc and init script when using DESTDIR. (Step 2 of cleanup) (closes issue #13430) Reported by: jcollie Patches: 0001-Fix-install-of-ifup-hdlc-when-installing-into-an-alt.patch uploaded by jcollie (license 412) Tested by: qwell Note: Patch from #13430 was extended to modify init script installation as well. * build_tools/genmodconf (removed), dahdi.rules (removed), build_tools/genudevrules (removed): Remove files that aren't used or are duplicated from dahdi-linux. Step 1 of cleanup. 2008-09-09 18:21 +0000 [r4882-4883] Jason Parker * Makefile: Fix a few typos * dahdi.init: Fix location of fxotune (closes issue #13428) Reported by: eeman 2008-09-04 16:37 +0000 [r4860] Shaun Ruffell * Makefile, UPGRADE.txt: * Updates the instructions presented after 'make config' about where to set which modules are loaded. * Update UPGRADE.txt to indicate where to set which modules are loaded and where the module parameters are set. Issue# DAHDI-187 2008-09-03 19:38 +0000 [r4859] Tzafrir Cohen * Makefile, README, UPGRADE.txt: Slightly reformat UPDATES.txt for asciidoc . Include it in README.html . See e.g. http://docs.tzafrir.org.il/dahdi-tools/README.html#_upgrade_notes Also fix some links in the README. 2008-08-28 21:40 +0000 [r4853-4855] Tzafrir Cohen * dahdi.init: Simplify reading list of modules from /etc/dahdi/modules . * doc, xpp: Ignore generated HTML files. * xpp/Makefile: Don't install genzaptelconf: deprecated, and collides with Zaptel. 2008-08-27 17:13 +0000 [r4845-4850] Kevin P. Fleming * modules.sample, dahdi.init: remove some silly echo statement constructions in the init script clean up the modules.sample file to have proper lists of cards supported by each module and remove reference to dahdi_dummy since the init script takes care of loading that module * makeopts.in, fxotune.c: actually implement the rest of --enable-dev-mode, and fix up more problems it found * Makefile, configure, configure.ac, sethdlc.c, makeopts.in, dahdi_cfg.c: add --enable-dev-mode support, and fix up a couple of warnings found using it (only two, surprisingly) 2008-08-26 14:35 +0000 [r4833-4844] Tzafrir Cohen * Makefile, README, system.conf.sample: * Add a "docs" target to generate documentation. * Demote/promote some headers. * Fix URL for on-line copy of the README. * xpp/perl_modules/Dahdi/Chans.pm: Fix default path of dahdi_cfg (used for probing type of wctdm channels) 2008-08-25 16:12 +0000 [r4826-4827] Jason Parker * dahdi_cfg.c: Fix more crazy formatting * dahdi_cfg.c: Reverse some incorrect logic, and cleanup some very ugly formatting in passing. 2008-08-24 10:53 +0000 [r4821-4822] Tzafrir Cohen * dahdi_cfg.c: We've got a new "zap" string to zap. * dahdi_cfg.c: dahdi_cfg.c: Reduce nesting in main() . 2008-08-24 05:54 +0000 [r4818] Matthew Fredrickson * dahdi_cfg.c: Add support for 56 KB HDLC as well as selectable rate in system.conf 2008-08-20 Kevin P. Fleming * dahdi-tools version 2.0.0-rc2 released. 2008-08-17 15:50 +0000 [r4787] Tzafrir Cohen * xpp/perl_modules/Dahdi/Chans.pm: Dahdi::Chans: fix leftovers from r4767 (handling of spaces) While r4767 solved some parsing problems of channels with "strange" encoding names, it introduced a new problem (e.g.: "RED" after "(In use)" which is fixed here. 2008-08-12 12:59 +0000 [r4764-4767] Tzafrir Cohen * xpp/perl_modules/Dahdi/Chans.pm: Dahdi-perl: More robust parsing of channel signalling types. Use a list of signalling types rather than a regular experssion of a "word". * xpp/dahdi_genconf, xpp/genconf_parameters: MFC/R2 configuration generation support If optional setting 'pri_connection_type' is set to R2, configure E1 spans as CAS and generate a unicall.conf snippet (unicall-channels.conf). * xpp/perl_modules/Dahdi/Hardware/PCI.pm, xpp/xpp_fxloader: * xpp_fxloader: shows USB firmware version. * Update PCI IDs database. * xpp/lsdahdi, xpp/perl_modules/Dahdi/Chans.pm: Dahdi-perl: Add alarms() method for channels. Use it in lsdahdi. * Better paring of the /proc/dahdi/N channel lines for alarms * Provide it as a separate alarms() method. 2008-08-06 Kevin P. Fleming * dahdi-tools version 2.0.0-rc1 released. dahdi-tools-2.2.0-rc2/menuselect/0000775000000000000000000000000011176143304015252 5ustar rootrootdahdi-tools-2.2.0-rc2/menuselect/make_version0000775000000000000000000000173610472743350017676 0ustar rootroot#!/bin/sh if [ -f ${1}/.version ]; then cat ${1}.version elif [ -f ${1}/.svnrevision ]; then echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision` elif [ -d .svn ]; then PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e 's:^.*/svn/menuselect/::' | sed -e 's:/: :g'` BRANCH=0 TEAM=0 REV=`svnversion -c ${1} | cut -d: -f2` if [ "${PARTS}" = "trunk" ] then echo SVN-'trunk'-r${REV} exit 0 fi for PART in $PARTS do if [ ${BRANCH} != 0 ] then RESULT="${RESULT}-${PART}" break fi if [ ${TEAM} != 0 ] then RESULT="${RESULT}-${PART}" continue fi if [ "${PART}" = "branches" ] then BRANCH=1 RESULT="branch" continue fi if [ "${PART}" = "tags" ] then BRANCH=1 RESULT="tag" continue fi if [ "${PART}" = "team" ] then TEAM=1 continue fi done echo SVN-${RESULT##-}-r${REV} fi dahdi-tools-2.2.0-rc2/menuselect/mxml/0000775000000000000000000000000011176143304016227 5ustar rootrootdahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-file.c0000664000000000000000000016466010446600454020305 0ustar rootroot/* * "$Id: mxml-file.c 22267 2006-04-24 17:11:45Z kpfleming $" * * File loading code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxmlLoadFd() - Load a file descriptor into an XML node tree. * mxmlLoadFile() - Load a file into an XML node tree. * mxmlLoadString() - Load a string into an XML node tree. * mxmlSaveAllocString() - Save an XML node tree to an allocated string. * mxmlSaveFd() - Save an XML tree to a file descriptor. * mxmlSaveFile() - Save an XML tree to a file. * mxmlSaveString() - Save an XML node tree to a string. * mxmlSetCustomHandlers() - Set the handling functions for custom data. * mxmlSetErrorCallback() - Set the error message callback. * mxml_add_char() - Add a character to a buffer, expanding as needed. * mxml_fd_getc() - Read a character from a file descriptor. * mxml_fd_putc() - Write a character to a file descriptor. * mxml_fd_read() - Read a buffer of data from a file descriptor. * mxml_fd_write() - Write a buffer of data to a file descriptor. * mxml_file_getc() - Get a character from a file. * mxml_file_putc() - Write a character to a file. * mxml_get_entity() - Get the character corresponding to an entity... * mxml_load_data() - Load data into an XML node tree. * mxml_parse_element() - Parse an element for any attributes... * mxml_string_getc() - Get a character from a string. * mxml_string_putc() - Write a character to a string. * mxml_write_name() - Write a name string. * mxml_write_node() - Save an XML node to a file. * mxml_write_string() - Write a string, escaping & and < as needed. * mxml_write_ws() - Do whitespace callback... */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" #ifdef WIN32 # include #else # include #endif /* WIN32 */ /* * Character encoding... */ #define ENCODE_UTF8 0 /* UTF-8 */ #define ENCODE_UTF16BE 1 /* UTF-16 Big-Endian */ #define ENCODE_UTF16LE 2 /* UTF-16 Little-Endian */ /* * Macro to test for a bad XML character... */ #define mxml_bad_char(ch) ((ch) < ' ' && (ch) != '\n' && (ch) != '\r' && (ch) != '\t') /* * Structures... */ typedef struct mxml_fdbuf_s /**** File descriptor buffer (@private) ****/ { int fd; /* File descriptor */ unsigned char *current, /* Current position in buffer */ *end, /* End of buffer */ buffer[8192]; /* Character buffer */ } mxml_fdbuf_t; /* * Global error handler... */ extern void (*mxml_error_cb)(const char *); /* * Custom data handlers... */ static mxml_custom_load_cb_t mxml_custom_load_cb = NULL; static mxml_custom_save_cb_t mxml_custom_save_cb = NULL; /* * Local functions... */ static int mxml_add_char(int ch, char **ptr, char **buffer, int *bufsize); static int mxml_fd_getc(void *p, int *encoding); static int mxml_fd_putc(int ch, void *p); static int mxml_fd_read(mxml_fdbuf_t *buf); static int mxml_fd_write(mxml_fdbuf_t *buf); static int mxml_file_getc(void *p, int *encoding); static int mxml_file_putc(int ch, void *p); static int mxml_get_entity(mxml_node_t *parent, void *p, int *encoding, int (*getc_cb)(void *, int *)); static mxml_node_t *mxml_load_data(mxml_node_t *top, void *p, mxml_type_t (*cb)(mxml_node_t *), int (*getc_cb)(void *, int *)); static int mxml_parse_element(mxml_node_t *node, void *p, int *encoding, int (*getc_cb)(void *, int *)); static int mxml_string_getc(void *p, int *encoding); static int mxml_string_putc(int ch, void *p); static int mxml_write_name(const char *s, void *p, int (*putc_cb)(int, void *)); static int mxml_write_node(mxml_node_t *node, void *p, const char *(*cb)(mxml_node_t *, int), int col, int (*putc_cb)(int, void *)); static int mxml_write_string(const char *s, void *p, int (*putc_cb)(int, void *)); static int mxml_write_ws(mxml_node_t *node, void *p, const char *(*cb)(mxml_node_t *, int), int ws, int col, int (*putc_cb)(int, void *)); /* * 'mxmlLoadFd()' - Load a file descriptor into an XML node tree. * * The nodes in the specified file are added to the specified top node. * If no top node is provided, the XML file MUST be well-formed with a * single parent node like for the entire file. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. */ mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxmlLoadFd(mxml_node_t *top, /* I - Top node */ int fd, /* I - File descriptor to read from */ mxml_type_t (*cb)(mxml_node_t *node)) /* I - Callback function or MXML_NO_CALLBACK */ { mxml_fdbuf_t buf; /* File descriptor buffer */ /* * Initialize the file descriptor buffer... */ buf.fd = fd; buf.current = buf.buffer; buf.end = buf.buffer; /* * Read the XML data... */ return (mxml_load_data(top, &buf, cb, mxml_fd_getc)); } /* * 'mxmlLoadFile()' - Load a file into an XML node tree. * * The nodes in the specified file are added to the specified top node. * If no top node is provided, the XML file MUST be well-formed with a * single parent node like for the entire file. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. */ mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxmlLoadFile(mxml_node_t *top, /* I - Top node */ FILE *fp, /* I - File to read from */ mxml_type_t (*cb)(mxml_node_t *node)) /* I - Callback function or MXML_NO_CALLBACK */ { /* * Read the XML data... */ return (mxml_load_data(top, fp, cb, mxml_file_getc)); } /* * 'mxmlLoadString()' - Load a string into an XML node tree. * * The nodes in the specified string are added to the specified top node. * If no top node is provided, the XML string MUST be well-formed with a * single parent node like for the entire string. The callback * function returns the value type that should be used for child nodes. * If MXML_NO_CALLBACK is specified then all child nodes will be either * MXML_ELEMENT or MXML_TEXT nodes. * * The constants MXML_INTEGER_CALLBACK, MXML_OPAQUE_CALLBACK, * MXML_REAL_CALLBACK, and MXML_TEXT_CALLBACK are defined for loading * child nodes of the specified type. */ mxml_node_t * /* O - First node or NULL if the string has errors. */ mxmlLoadString(mxml_node_t *top, /* I - Top node */ const char *s, /* I - String to load */ mxml_type_t (*cb)(mxml_node_t *node)) /* I - Callback function or MXML_NO_CALLBACK */ { /* * Read the XML data... */ return (mxml_load_data(top, &s, cb, mxml_string_getc)); } /* * 'mxmlSaveAllocString()' - Save an XML node tree to an allocated string. * * This function returns a pointer to a string containing the textual * representation of the XML node tree. The string should be freed * using the free() function when you are done with it. NULL is returned * if the node would produce an empty string or if the string cannot be * allocated. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ char * /* O - Allocated string or NULL */ mxmlSaveAllocString(mxml_node_t *node, /* I - Node to write */ const char *(*cb)(mxml_node_t *node, int ws)) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int bytes; /* Required bytes */ char buffer[8192]; /* Temporary buffer */ char *s; /* Allocated string */ /* * Write the node to the temporary buffer... */ bytes = mxmlSaveString(node, buffer, sizeof(buffer), cb); if (bytes <= 0) return (NULL); if (bytes < (int)(sizeof(buffer) - 1)) { /* * Node fit inside the buffer, so just duplicate that string and * return... */ return (strdup(buffer)); } /* * Allocate a buffer of the required size and save the node to the * new buffer... */ if ((s = malloc(bytes + 1)) == NULL) return (NULL); mxmlSaveString(node, s, bytes + 1, cb); /* * Return the allocated string... */ return (s); } /* * 'mxmlSaveFd()' - Save an XML tree to a file descriptor. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ int /* O - 0 on success, -1 on error. */ mxmlSaveFd(mxml_node_t *node, /* I - Node to write */ int fd, /* I - File descriptor to write to */ const char *(*cb)(mxml_node_t *node, int ws)) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int col; /* Final column */ mxml_fdbuf_t buf; /* File descriptor buffer */ /* * Initialize the file descriptor buffer... */ buf.fd = fd; buf.current = buf.buffer; buf.end = buf.buffer + sizeof(buf.buffer) - 4; /* * Write the node... */ if ((col = mxml_write_node(node, &buf, cb, 0, mxml_fd_putc)) < 0) return (-1); if (col > 0) if (mxml_fd_putc('\n', &buf) < 0) return (-1); /* * Flush and return... */ return (mxml_fd_write(&buf)); } /* * 'mxmlSaveFile()' - Save an XML tree to a file. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ int /* O - 0 on success, -1 on error. */ mxmlSaveFile(mxml_node_t *node, /* I - Node to write */ FILE *fp, /* I - File to write to */ const char *(*cb)(mxml_node_t *node, int ws)) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int col; /* Final column */ /* * Write the node... */ if ((col = mxml_write_node(node, fp, cb, 0, mxml_file_putc)) < 0) return (-1); if (col > 0) if (putc('\n', fp) < 0) return (-1); /* * Return 0 (success)... */ return (0); } /* * 'mxmlSaveString()' - Save an XML node tree to a string. * * This function returns the total number of bytes that would be * required for the string but only copies (bufsize - 1) characters * into the specified buffer. * * The callback argument specifies a function that returns a whitespace * string or NULL before and after each element. If MXML_NO_CALLBACK * is specified, whitespace will only be added before MXML_TEXT nodes * with leading whitespace and before attribute names inside opening * element tags. */ int /* O - Size of string */ mxmlSaveString(mxml_node_t *node, /* I - Node to write */ char *buffer, /* I - String buffer */ int bufsize, /* I - Size of string buffer */ const char *(*cb)(mxml_node_t *node, int ws)) /* I - Whitespace callback or MXML_NO_CALLBACK */ { int col; /* Final column */ char *ptr[2]; /* Pointers for putc_cb */ /* * Write the node... */ ptr[0] = buffer; ptr[1] = buffer + bufsize; if ((col = mxml_write_node(node, ptr, cb, 0, mxml_string_putc)) < 0) return (-1); if (col > 0) mxml_string_putc('\n', ptr); /* * Nul-terminate the buffer... */ if (ptr[0] >= ptr[1]) buffer[bufsize - 1] = '\0'; else ptr[0][0] = '\0'; /* * Return the number of characters... */ return (ptr[0] - buffer); } /* * 'mxmlSetCustomHandlers()' - Set the handling functions for custom data. * * The load function accepts a node pointer and a data string and must * return 0 on success and non-zero on error. * * The save function accepts a node pointer and must return a malloc'd * string on success and NULL on error. * */ void mxmlSetCustomHandlers(mxml_custom_load_cb_t load, /* I - Load function */ mxml_custom_save_cb_t save) /* I - Save function */ { mxml_custom_load_cb = load; mxml_custom_save_cb = save; } /* * 'mxmlSetErrorCallback()' - Set the error message callback. */ void mxmlSetErrorCallback(void (*cb)(const char *)) /* I - Error callback function */ { mxml_error_cb = cb; } /* * 'mxml_add_char()' - Add a character to a buffer, expanding as needed. */ static int /* O - 0 on success, -1 on error */ mxml_add_char(int ch, /* I - Character to add */ char **bufptr, /* IO - Current position in buffer */ char **buffer, /* IO - Current buffer */ int *bufsize) /* IO - Current buffer size */ { char *newbuffer; /* New buffer value */ if (*bufptr >= (*buffer + *bufsize - 4)) { /* * Increase the size of the buffer... */ if (*bufsize < 1024) (*bufsize) *= 2; else (*bufsize) += 1024; if ((newbuffer = realloc(*buffer, *bufsize)) == NULL) { free(*buffer); mxml_error("Unable to expand string buffer to %d bytes!", *bufsize); return (-1); } *bufptr = newbuffer + (*bufptr - *buffer); *buffer = newbuffer; } if (ch < 0x80) { /* * Single byte ASCII... */ *(*bufptr)++ = ch; } else if (ch < 0x800) { /* * Two-byte UTF-8... */ *(*bufptr)++ = 0xc0 | (ch >> 6); *(*bufptr)++ = 0x80 | (ch & 0x3f); } else if (ch < 0x10000) { /* * Three-byte UTF-8... */ *(*bufptr)++ = 0xe0 | (ch >> 12); *(*bufptr)++ = 0x80 | ((ch >> 6) & 0x3f); *(*bufptr)++ = 0x80 | (ch & 0x3f); } else { /* * Four-byte UTF-8... */ *(*bufptr)++ = 0xf0 | (ch >> 18); *(*bufptr)++ = 0x80 | ((ch >> 12) & 0x3f); *(*bufptr)++ = 0x80 | ((ch >> 6) & 0x3f); *(*bufptr)++ = 0x80 | (ch & 0x3f); } return (0); } /* * 'mxml_fd_getc()' - Read a character from a file descriptor. */ static int /* O - Character or EOF */ mxml_fd_getc(void *p, /* I - File descriptor buffer */ int *encoding) /* IO - Encoding */ { mxml_fdbuf_t *buf; /* File descriptor buffer */ int ch, /* Current character */ temp; /* Temporary character */ /* * Grab the next character in the buffer... */ buf = (mxml_fdbuf_t *)p; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); ch = *(buf->current)++; switch (*encoding) { case ENCODE_UTF8 : /* * Got a UTF-8 character; convert UTF-8 to Unicode and return... */ if (!(ch & 0x80)) { #if DEBUG > 1 printf("mxml_fd_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } return (ch); } else if (ch == 0xfe) { /* * UTF-16 big-endian BOM? */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); ch = *(buf->current)++; if (ch != 0xff) return (EOF); *encoding = ENCODE_UTF16BE; return (mxml_fd_getc(p, encoding)); } else if (ch == 0xff) { /* * UTF-16 little-endian BOM? */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); ch = *(buf->current)++; if (ch != 0xfe) return (EOF); *encoding = ENCODE_UTF16LE; return (mxml_fd_getc(p, encoding)); } else if ((ch & 0xe0) == 0xc0) { /* * Two-byte value... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x1f) << 6) | (temp & 0x3f); if (ch < 0x80) return (EOF); } else if ((ch & 0xf0) == 0xe0) { /* * Three-byte value... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x0f) << 6) | (temp & 0x3f); if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x800) return (EOF); } else if ((ch & 0xf8) == 0xf0) { /* * Four-byte value... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x07) << 6) | (temp & 0x3f); if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; if ((temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x10000) return (EOF); } else return (EOF); break; case ENCODE_UTF16BE : /* * Read UTF-16 big-endian char... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; ch = (ch << 8) | temp; if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); lch = *(buf->current)++; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; lch = (lch << 8) | temp; if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; case ENCODE_UTF16LE : /* * Read UTF-16 little-endian char... */ if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; ch |= (temp << 8); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); lch = *(buf->current)++; if (buf->current >= buf->end) if (mxml_fd_read(buf) < 0) return (EOF); temp = *(buf->current)++; lch |= (temp << 8); if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; } #if DEBUG > 1 printf("mxml_fd_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } /* * 'mxml_fd_putc()' - Write a character to a file descriptor. */ static int /* O - 0 on success, -1 on error */ mxml_fd_putc(int ch, /* I - Character */ void *p) /* I - File descriptor buffer */ { mxml_fdbuf_t *buf; /* File descriptor buffer */ /* * Flush the write buffer as needed - note above that "end" still leaves * 4 characters at the end so that we can avoid a lot of extra tests... */ buf = (mxml_fdbuf_t *)p; if (buf->current >= buf->end) if (mxml_fd_write(buf) < 0) return (-1); if (ch < 0x80) { /* * Write ASCII character directly... */ *(buf->current)++ = ch; } else if (ch < 0x800) { /* * Two-byte UTF-8 character... */ *(buf->current)++ = 0xc0 | (ch >> 6); *(buf->current)++ = 0x80 | (ch & 0x3f); } else if (ch < 0x10000) { /* * Three-byte UTF-8 character... */ *(buf->current)++ = 0xe0 | (ch >> 12); *(buf->current)++ = 0x80 | ((ch >> 6) & 0x3f); *(buf->current)++ = 0x80 | (ch & 0x3f); } else { /* * Four-byte UTF-8 character... */ *(buf->current)++ = 0xf0 | (ch >> 18); *(buf->current)++ = 0x80 | ((ch >> 12) & 0x3f); *(buf->current)++ = 0x80 | ((ch >> 6) & 0x3f); *(buf->current)++ = 0x80 | (ch & 0x3f); } /* * Return successfully... */ return (0); } /* * 'mxml_fd_read()' - Read a buffer of data from a file descriptor. */ static int /* O - 0 on success, -1 on error */ mxml_fd_read(mxml_fdbuf_t *buf) /* I - File descriptor buffer */ { int bytes; /* Bytes read... */ /* * Range check input... */ if (!buf) return (-1); /* * Read from the file descriptor... */ while ((bytes = read(buf->fd, buf->buffer, sizeof(buf->buffer))) < 0) if (errno != EAGAIN && errno != EINTR) return (-1); if (bytes == 0) return (-1); /* * Update the pointers and return success... */ buf->current = buf->buffer; buf->end = buf->buffer + bytes; return (0); } /* * 'mxml_fd_write()' - Write a buffer of data to a file descriptor. */ static int /* O - 0 on success, -1 on error */ mxml_fd_write(mxml_fdbuf_t *buf) /* I - File descriptor buffer */ { int bytes; /* Bytes written */ unsigned char *ptr; /* Pointer into buffer */ /* * Range check... */ if (!buf) return (-1); /* * Return 0 if there is nothing to write... */ if (buf->current == buf->buffer) return (0); /* * Loop until we have written everything... */ for (ptr = buf->buffer; ptr < buf->current; ptr += bytes) if ((bytes = write(buf->fd, ptr, buf->current - ptr)) < 0) return (-1); /* * All done, reset pointers and return success... */ buf->current = buf->buffer; return (0); } /* * 'mxml_file_getc()' - Get a character from a file. */ static int /* O - Character or EOF */ mxml_file_getc(void *p, /* I - Pointer to file */ int *encoding) /* IO - Encoding */ { int ch, /* Character from file */ temp; /* Temporary character */ FILE *fp; /* Pointer to file */ /* * Read a character from the file and see if it is EOF or ASCII... */ fp = (FILE *)p; ch = getc(fp); if (ch == EOF) return (EOF); switch (*encoding) { case ENCODE_UTF8 : /* * Got a UTF-8 character; convert UTF-8 to Unicode and return... */ if (!(ch & 0x80)) { if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } #if DEBUG > 1 printf("mxml_file_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else if (ch == 0xfe) { /* * UTF-16 big-endian BOM? */ ch = getc(fp); if (ch != 0xff) return (EOF); *encoding = ENCODE_UTF16BE; return (mxml_file_getc(p, encoding)); } else if (ch == 0xff) { /* * UTF-16 little-endian BOM? */ ch = getc(fp); if (ch != 0xfe) return (EOF); *encoding = ENCODE_UTF16LE; return (mxml_file_getc(p, encoding)); } else if ((ch & 0xe0) == 0xc0) { /* * Two-byte value... */ if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x1f) << 6) | (temp & 0x3f); if (ch < 0x80) return (EOF); } else if ((ch & 0xf0) == 0xe0) { /* * Three-byte value... */ if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x0f) << 6) | (temp & 0x3f); if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x800) return (EOF); } else if ((ch & 0xf8) == 0xf0) { /* * Four-byte value... */ if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x07) << 6) | (temp & 0x3f); if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if ((temp = getc(fp)) == EOF || (temp & 0xc0) != 0x80) return (EOF); ch = (ch << 6) | (temp & 0x3f); if (ch < 0x10000) return (EOF); } else return (EOF); break; case ENCODE_UTF16BE : /* * Read UTF-16 big-endian char... */ ch = (ch << 8) | getc(fp); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch = (getc(fp) << 8) | getc(fp); if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; case ENCODE_UTF16LE : /* * Read UTF-16 little-endian char... */ ch |= (getc(fp) << 8); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch = getc(fp) | (getc(fp) << 8); if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } break; } #if DEBUG > 1 printf("mxml_file_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } /* * 'mxml_file_putc()' - Write a character to a file. */ static int /* O - 0 on success, -1 on failure */ mxml_file_putc(int ch, /* I - Character to write */ void *p) /* I - Pointer to file */ { char buffer[4], /* Buffer for character */ *bufptr; /* Pointer into buffer */ int buflen; /* Number of bytes to write */ if (ch < 0x80) return (putc(ch, (FILE *)p) == EOF ? -1 : 0); bufptr = buffer; if (ch < 0x800) { /* * Two-byte UTF-8 character... */ *bufptr++ = 0xc0 | (ch >> 6); *bufptr++ = 0x80 | (ch & 0x3f); } else if (ch < 0x10000) { /* * Three-byte UTF-8 character... */ *bufptr++ = 0xe0 | (ch >> 12); *bufptr++ = 0x80 | ((ch >> 6) & 0x3f); *bufptr++ = 0x80 | (ch & 0x3f); } else { /* * Four-byte UTF-8 character... */ *bufptr++ = 0xf0 | (ch >> 18); *bufptr++ = 0x80 | ((ch >> 12) & 0x3f); *bufptr++ = 0x80 | ((ch >> 6) & 0x3f); *bufptr++ = 0x80 | (ch & 0x3f); } buflen = bufptr - buffer; return (fwrite(buffer, 1, buflen, (FILE *)p) < buflen ? -1 : 0); } /* * 'mxml_get_entity()' - Get the character corresponding to an entity... */ static int /* O - Character value or EOF on error */ mxml_get_entity(mxml_node_t *parent, /* I - Parent node */ void *p, /* I - Pointer to source */ int *encoding, /* IO - Character encoding */ int (*getc_cb)(void *, int *)) /* I - Get character function */ { int ch; /* Current character */ char entity[64], /* Entity string */ *entptr; /* Pointer into entity */ entptr = entity; while ((ch = (*getc_cb)(p, encoding)) != EOF) if (ch > 126 || (!isalnum(ch) && ch != '#')) break; else if (entptr < (entity + sizeof(entity) - 1)) *entptr++ = ch; else { mxml_error("Entity name too long under parent <%s>!", parent ? parent->value.element.name : "null"); break; } *entptr = '\0'; if (ch != ';') { mxml_error("Character entity \"%s\" not terminated under parent <%s>!", entity, parent ? parent->value.element.name : "null"); return (EOF); } if (entity[0] == '#') { if (entity[1] == 'x') ch = strtol(entity + 2, NULL, 16); else ch = strtol(entity + 1, NULL, 10); } else if ((ch = mxmlEntityGetValue(entity)) < 0) mxml_error("Entity name \"%s;\" not supported under parent <%s>!", entity, parent ? parent->value.element.name : "null"); if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x under parent <%s> not allowed by XML standard!", ch, parent ? parent->value.element.name : "null"); return (EOF); } return (ch); } /* * 'mxml_load_data()' - Load data into an XML node tree. */ static mxml_node_t * /* O - First node or NULL if the file could not be read. */ mxml_load_data(mxml_node_t *top, /* I - Top node */ void *p, /* I - Pointer to data */ mxml_type_t (*cb)(mxml_node_t *), /* I - Callback function or MXML_NO_CALLBACK */ int (*getc_cb)(void *, int *)) /* I - Read function */ { mxml_node_t *node, /* Current node */ *first, /* First node added */ *parent; /* Current parent node */ int ch, /* Character from file */ whitespace; /* Non-zero if whitespace seen */ char *buffer, /* String buffer */ *bufptr; /* Pointer into buffer */ int bufsize; /* Size of buffer */ mxml_type_t type; /* Current node type */ int encoding; /* Character encoding */ static const char * const types[] = /* Type strings... */ { "MXML_ELEMENT", /* XML element with attributes */ "MXML_INTEGER", /* Integer value */ "MXML_OPAQUE", /* Opaque string */ "MXML_REAL", /* Real value */ "MXML_TEXT", /* Text fragment */ "MXML_CUSTOM" /* Custom data */ }; /* * Read elements and other nodes from the file... */ if ((buffer = malloc(64)) == NULL) { mxml_error("Unable to allocate string buffer!"); return (NULL); } bufsize = 64; bufptr = buffer; parent = top; first = NULL; whitespace = 0; encoding = ENCODE_UTF8; if (cb && parent) type = (*cb)(parent); else type = MXML_TEXT; while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if ((ch == '<' || (isspace(ch) && type != MXML_OPAQUE && type != MXML_CUSTOM)) && bufptr > buffer) { /* * Add a new value node... */ *bufptr = '\0'; switch (type) { case MXML_INTEGER : node = mxmlNewInteger(parent, strtol(buffer, &bufptr, 0)); break; case MXML_OPAQUE : node = mxmlNewOpaque(parent, buffer); break; case MXML_REAL : node = mxmlNewReal(parent, strtod(buffer, &bufptr)); break; case MXML_TEXT : node = mxmlNewText(parent, whitespace, buffer); break; case MXML_CUSTOM : if (mxml_custom_load_cb) { /* * Use the callback to fill in the custom data... */ node = mxmlNewCustom(parent, NULL, NULL); if ((*mxml_custom_load_cb)(node, buffer)) { mxml_error("Bad custom value '%s' in parent <%s>!", buffer, parent ? parent->value.element.name : "null"); mxmlDelete(node); node = NULL; } break; } default : /* Should never happen... */ node = NULL; break; } if (*bufptr) { /* * Bad integer/real number value... */ mxml_error("Bad %s value '%s' in parent <%s>!", type == MXML_INTEGER ? "integer" : "real", buffer, parent ? parent->value.element.name : "null"); break; } bufptr = buffer; whitespace = isspace(ch) && type == MXML_TEXT; if (!node) { /* * Print error and return... */ mxml_error("Unable to add value node of type %s to parent <%s>!", types[type], parent ? parent->value.element.name : "null"); goto error; } if (!first) first = node; } else if (isspace(ch) && type == MXML_TEXT) whitespace = 1; /* * Add lone whitespace node if we have an element and existing * whitespace... */ if (ch == '<' && whitespace && type == MXML_TEXT) { mxmlNewText(parent, whitespace, ""); whitespace = 0; } if (ch == '<') { /* * Start of open/close tag... */ bufptr = buffer; while ((ch = (*getc_cb)(p, &encoding)) != EOF) if (isspace(ch) || ch == '>' || (ch == '/' && bufptr > buffer)) break; else if (ch == '&') { if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; else if (((bufptr - buffer) == 1 && buffer[0] == '?') || ((bufptr - buffer) == 3 && !strncmp(buffer, "!--", 3)) || ((bufptr - buffer) == 8 && !strncmp(buffer, "![CDATA[", 8))) break; *bufptr = '\0'; if (!strcmp(buffer, "!--")) { /* * Gather rest of comment... */ while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if (ch == '>' && bufptr > (buffer + 4) && bufptr[-3] != '-' && bufptr[-2] == '-' && bufptr[-1] == '-') break; else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } /* * Error out if we didn't get the whole comment... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in comment node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; if (!mxmlNewElement(parent, buffer)) { /* * Just print error for now... */ mxml_error("Unable to add comment node to parent <%s>!", parent ? parent->value.element.name : "null"); break; } } else if (!strcmp(buffer, "![CDATA[")) { /* * Gather CDATA section... */ while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if (ch == '>' && !strncmp(bufptr - 2, "]]", 2)) break; else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } /* * Error out if we didn't get the whole comment... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in CDATA node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; if (!mxmlNewElement(parent, buffer)) { /* * Print error and return... */ mxml_error("Unable to add CDATA node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } } else if (buffer[0] == '?') { /* * Gather rest of processing instruction... */ while ((ch = (*getc_cb)(p, &encoding)) != EOF) { if (ch == '>' && bufptr > buffer && bufptr[-1] == '?') break; else if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } /* * Error out if we didn't get the whole processing instruction... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in processing instruction node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; if (!(parent = mxmlNewElement(parent, buffer))) { /* * Print error and return... */ mxml_error("Unable to add processing instruction node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } if (cb) type = (*cb)(parent); } else if (buffer[0] == '!') { /* * Gather rest of declaration... */ do { if (ch == '>') break; else { if (ch == '&') if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } } while ((ch = (*getc_cb)(p, &encoding)) != EOF); /* * Error out if we didn't get the whole declaration... */ if (ch != '>') { /* * Print error and return... */ mxml_error("Early EOF in declaration node!"); goto error; } /* * Otherwise add this as an element under the current parent... */ *bufptr = '\0'; node = mxmlNewElement(parent, buffer); if (!node) { /* * Print error and return... */ mxml_error("Unable to add declaration node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } /* * Descend into this node, setting the value type as needed... */ parent = node; if (cb) type = (*cb)(parent); } else if (buffer[0] == '/') { /* * Handle close tag... */ if (!parent || strcmp(buffer + 1, parent->value.element.name)) { /* * Close tag doesn't match tree; print an error for now... */ mxml_error("Mismatched close tag <%s> under parent <%s>!", buffer, parent->value.element.name); goto error; } /* * Keep reading until we see >... */ while (ch != '>' && ch != EOF) ch = (*getc_cb)(p, &encoding); /* * Ascend into the parent and set the value type as needed... */ parent = parent->parent; if (cb && parent) type = (*cb)(parent); } else { /* * Handle open tag... */ node = mxmlNewElement(parent, buffer); if (!node) { /* * Just print error for now... */ mxml_error("Unable to add element node to parent <%s>!", parent ? parent->value.element.name : "null"); goto error; } if (isspace(ch)) ch = mxml_parse_element(node, p, &encoding, getc_cb); else if (ch == '/') { if ((ch = (*getc_cb)(p, &encoding)) != '>') { mxml_error("Expected > but got '%c' instead for element <%s/>!", ch, buffer); goto error; } ch = '/'; } if (ch == EOF) break; if (ch != '/') { /* * Descend into this node, setting the value type as needed... */ parent = node; if (cb && parent) type = (*cb)(parent); } } bufptr = buffer; } else if (ch == '&') { /* * Add character entity to current buffer... */ if ((ch = mxml_get_entity(parent, p, &encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } else if (type == MXML_OPAQUE || type == MXML_CUSTOM || !isspace(ch)) { /* * Add character to current buffer... */ if (mxml_add_char(ch, &bufptr, &buffer, &bufsize)) goto error; } } /* * Free the string buffer - we don't need it anymore... */ free(buffer); /* * Find the top element and return it... */ if (parent) { while (parent->parent != top && parent->parent) parent = parent->parent; } return (parent); /* * Common error return... */ error: mxmlDelete(first); free(buffer); return (NULL); } /* * 'mxml_parse_element()' - Parse an element for any attributes... */ static int /* O - Terminating character */ mxml_parse_element(mxml_node_t *node, /* I - Element node */ void *p, /* I - Data to read from */ int *encoding, /* IO - Encoding */ int (*getc_cb)(void *, int *)) /* I - Data callback */ { int ch, /* Current character in file */ quote; /* Quoting character */ char *name, /* Attribute name */ *value, /* Attribute value */ *ptr; /* Pointer into name/value */ int namesize, /* Size of name string */ valsize; /* Size of value string */ /* * Initialize the name and value buffers... */ if ((name = malloc(64)) == NULL) { mxml_error("Unable to allocate memory for name!"); return (EOF); } namesize = 64; if ((value = malloc(64)) == NULL) { free(name); mxml_error("Unable to allocate memory for value!"); return (EOF); } valsize = 64; /* * Loop until we hit a >, /, ?, or EOF... */ while ((ch = (*getc_cb)(p, encoding)) != EOF) { #if DEBUG > 1 fprintf(stderr, "parse_element: ch='%c'\n", ch); #endif /* DEBUG > 1 */ /* * Skip leading whitespace... */ if (isspace(ch)) continue; /* * Stop at /, ?, or >... */ if (ch == '/' || ch == '?') { /* * Grab the > character and print an error if it isn't there... */ quote = (*getc_cb)(p, encoding); if (quote != '>') { mxml_error("Expected '>' after '%c' for element %s, but got '%c'!", ch, node->value.element.name, quote); ch = EOF; } break; } else if (ch == '>') break; /* * Read the attribute name... */ name[0] = ch; ptr = name + 1; if (ch == '\"' || ch == '\'') { /* * Name is in quotes, so get a quoted string... */ quote = ch; while ((ch = (*getc_cb)(p, encoding)) != EOF) { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &name, &namesize)) goto error; if (ch == quote) break; } } else { /* * Grab an normal, non-quoted name... */ while ((ch = (*getc_cb)(p, encoding)) != EOF) if (isspace(ch) || ch == '=' || ch == '/' || ch == '>' || ch == '?') break; else { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &name, &namesize)) goto error; } } *ptr = '\0'; if (mxmlElementGetAttr(node, name)) goto error; if (ch == '=') { /* * Read the attribute value... */ if ((ch = (*getc_cb)(p, encoding)) == EOF) { mxml_error("Missing value for attribute '%s' in element %s!", name, node->value.element.name); return (EOF); } if (ch == '\'' || ch == '\"') { /* * Read quoted value... */ quote = ch; ptr = value; while ((ch = (*getc_cb)(p, encoding)) != EOF) if (ch == quote) break; else { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &value, &valsize)) goto error; } *ptr = '\0'; } else { /* * Read unquoted value... */ value[0] = ch; ptr = value + 1; while ((ch = (*getc_cb)(p, encoding)) != EOF) if (isspace(ch) || ch == '=' || ch == '/' || ch == '>') break; else { if (ch == '&') if ((ch = mxml_get_entity(node, p, encoding, getc_cb)) == EOF) goto error; if (mxml_add_char(ch, &ptr, &value, &valsize)) goto error; } *ptr = '\0'; } /* * Set the attribute with the given string value... */ mxmlElementSetAttr(node, name, value); } else { /* * Set the attribute with a NULL value... */ mxmlElementSetAttr(node, name, NULL); } /* * Check the end character... */ if (ch == '/' || ch == '?') { /* * Grab the > character and print an error if it isn't there... */ quote = (*getc_cb)(p, encoding); if (quote != '>') { mxml_error("Expected '>' after '%c' for element %s, but got '%c'!", ch, node->value.element.name, quote); ch = EOF; } break; } else if (ch == '>') break; } /* * Free the name and value buffers and return... */ free(name); free(value); return (ch); /* * Common error return point... */ error: free(name); free(value); return (EOF); } /* * 'mxml_string_getc()' - Get a character from a string. */ static int /* O - Character or EOF */ mxml_string_getc(void *p, /* I - Pointer to file */ int *encoding) /* IO - Encoding */ { int ch; /* Character */ const char **s; /* Pointer to string pointer */ s = (const char **)p; if ((ch = (*s)[0] & 255) != 0 || *encoding == ENCODE_UTF16LE) { /* * Got character; convert UTF-8 to integer and return... */ (*s)++; switch (*encoding) { case ENCODE_UTF8 : if (!(ch & 0x80)) { #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } return (ch); } else if (ch == 0xfe) { /* * UTF-16 big-endian BOM? */ if (((*s)[0] & 255) != 0xff) return (EOF); *encoding = ENCODE_UTF16BE; (*s)++; return (mxml_string_getc(p, encoding)); } else if (ch == 0xff) { /* * UTF-16 little-endian BOM? */ if (((*s)[0] & 255) != 0xfe) return (EOF); *encoding = ENCODE_UTF16LE; (*s)++; return (mxml_string_getc(p, encoding)); } else if ((ch & 0xe0) == 0xc0) { /* * Two-byte value... */ if (((*s)[0] & 0xc0) != 0x80) return (EOF); ch = ((ch & 0x1f) << 6) | ((*s)[0] & 0x3f); (*s)++; if (ch < 0x80) return (EOF); #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else if ((ch & 0xf0) == 0xe0) { /* * Three-byte value... */ if (((*s)[0] & 0xc0) != 0x80 || ((*s)[1] & 0xc0) != 0x80) return (EOF); ch = ((((ch & 0x0f) << 6) | ((*s)[0] & 0x3f)) << 6) | ((*s)[1] & 0x3f); (*s) += 2; if (ch < 0x800) return (EOF); #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else if ((ch & 0xf8) == 0xf0) { /* * Four-byte value... */ if (((*s)[0] & 0xc0) != 0x80 || ((*s)[1] & 0xc0) != 0x80 || ((*s)[2] & 0xc0) != 0x80) return (EOF); ch = ((((((ch & 0x07) << 6) | ((*s)[0] & 0x3f)) << 6) | ((*s)[1] & 0x3f)) << 6) | ((*s)[2] & 0x3f); (*s) += 3; if (ch < 0x10000) return (EOF); #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } else return (EOF); case ENCODE_UTF16BE : /* * Read UTF-16 big-endian char... */ ch = (ch << 8) | ((*s)[0] & 255); (*s) ++; if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; /* Lower word */ if (!(*s)[0]) return (EOF); lch = (((*s)[0] & 255) << 8) | ((*s)[1] & 255); (*s) += 2; if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); case ENCODE_UTF16LE : /* * Read UTF-16 little-endian char... */ ch = ch | (((*s)[0] & 255) << 8); if (!ch) { (*s) --; return (EOF); } (*s) ++; if (mxml_bad_char(ch)) { mxml_error("Bad control character 0x%02x not allowed by XML standard!", ch); return (EOF); } else if (ch >= 0xd800 && ch <= 0xdbff) { /* * Multi-word UTF-16 char... */ int lch; /* Lower word */ if (!(*s)[1]) return (EOF); lch = (((*s)[1] & 255) << 8) | ((*s)[0] & 255); (*s) += 2; if (lch < 0xdc00 || lch >= 0xdfff) return (EOF); ch = (((ch & 0x3ff) << 10) | (lch & 0x3ff)) + 0x10000; } #if DEBUG > 1 printf("mxml_string_getc: %c (0x%04x)\n", ch < ' ' ? '.' : ch, ch); #endif /* DEBUG > 1 */ return (ch); } } return (EOF); } /* * 'mxml_string_putc()' - Write a character to a string. */ static int /* O - 0 on success, -1 on failure */ mxml_string_putc(int ch, /* I - Character to write */ void *p) /* I - Pointer to string pointers */ { char **pp; /* Pointer to string pointers */ pp = (char **)p; if (ch < 0x80) { /* * Plain ASCII doesn't need special encoding... */ if (pp[0] < pp[1]) pp[0][0] = ch; pp[0] ++; } else if (ch < 0x800) { /* * Two-byte UTF-8 character... */ if ((pp[0] + 1) < pp[1]) { pp[0][0] = 0xc0 | (ch >> 6); pp[0][1] = 0x80 | (ch & 0x3f); } pp[0] += 2; } else if (ch < 0x10000) { /* * Three-byte UTF-8 character... */ if ((pp[0] + 2) < pp[1]) { pp[0][0] = 0xe0 | (ch >> 12); pp[0][1] = 0x80 | ((ch >> 6) & 0x3f); pp[0][2] = 0x80 | (ch & 0x3f); } pp[0] += 3; } else { /* * Four-byte UTF-8 character... */ if ((pp[0] + 2) < pp[1]) { pp[0][0] = 0xf0 | (ch >> 18); pp[0][1] = 0x80 | ((ch >> 12) & 0x3f); pp[0][2] = 0x80 | ((ch >> 6) & 0x3f); pp[0][3] = 0x80 | (ch & 0x3f); } pp[0] += 4; } return (0); } /* * 'mxml_write_name()' - Write a name string. */ static int /* O - 0 on success, -1 on failure */ mxml_write_name(const char *s, /* I - Name to write */ void *p, /* I - Write pointer */ int (*putc_cb)(int, void *)) /* I - Write callback */ { char quote; /* Quote character */ const char *name; /* Entity name */ if (*s == '\"' || *s == '\'') { /* * Write a quoted name string... */ if ((*putc_cb)(*s, p) < 0) return (-1); quote = *s++; while (*s && *s != quote) { if ((name = mxmlEntityGetName(*s)) != NULL) { if ((*putc_cb)('&', p) < 0) return (-1); while (*name) { if ((*putc_cb)(*name, p) < 0) return (-1); name ++; } if ((*putc_cb)(';', p) < 0) return (-1); } else if ((*putc_cb)(*s, p) < 0) return (-1); s ++; } /* * Write the end quote... */ if ((*putc_cb)(quote, p) < 0) return (-1); } else { /* * Write a non-quoted name string... */ while (*s) { if ((*putc_cb)(*s, p) < 0) return (-1); s ++; } } return (0); } /* * 'mxml_write_node()' - Save an XML node to a file. */ static int /* O - Column or -1 on error */ mxml_write_node(mxml_node_t *node, /* I - Node to write */ void *p, /* I - File to write to */ const char *(*cb)(mxml_node_t *, int), /* I - Whitespace callback */ int col, /* I - Current column */ int (*putc_cb)(int, void *)) { int i, /* Looping var */ width; /* Width of attr + value */ mxml_attr_t *attr; /* Current attribute */ char s[255]; /* Temporary string */ while (node != NULL) { /* * Print the node value... */ switch (node->type) { case MXML_ELEMENT : col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_OPEN, col, putc_cb); if ((*putc_cb)('<', p) < 0) return (-1); if (node->value.element.name[0] == '?' || !strncmp(node->value.element.name, "!--", 3) || !strncmp(node->value.element.name, "![CDATA[", 8)) { /* * Comments, CDATA, and processing instructions do not * use character entities. */ const char *ptr; /* Pointer into name */ for (ptr = node->value.element.name; *ptr; ptr ++) if ((*putc_cb)(*ptr, p) < 0) return (-1); /* * Prefer a newline for whitespace after ?xml... */ if (!strncmp(node->value.element.name, "?xml", 4)) col = MXML_WRAP; } else if (mxml_write_name(node->value.element.name, p, putc_cb) < 0) return (-1); col += strlen(node->value.element.name) + 1; for (i = node->value.element.num_attrs, attr = node->value.element.attrs; i > 0; i --, attr ++) { width = strlen(attr->name); if (attr->value) width += strlen(attr->value) + 3; if ((col + width) > MXML_WRAP) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else { if ((*putc_cb)(' ', p) < 0) return (-1); col ++; } if (mxml_write_name(attr->name, p, putc_cb) < 0) return (-1); if (attr->value) { if ((*putc_cb)('=', p) < 0) return (-1); if ((*putc_cb)('\"', p) < 0) return (-1); if (mxml_write_string(attr->value, p, putc_cb) < 0) return (-1); if ((*putc_cb)('\"', p) < 0) return (-1); } col += width; } if (node->child) { /* * Write children... */ if ((*putc_cb)('>', p) < 0) return (-1); else col ++; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); if ((col = mxml_write_node(node->child, p, cb, col, putc_cb)) < 0) return (-1); /* * The ? and ! elements are special-cases and have no end tags... */ if (node->value.element.name[0] != '!' && node->value.element.name[0] != '?') { col = mxml_write_ws(node, p, cb, MXML_WS_BEFORE_CLOSE, col, putc_cb); if ((*putc_cb)('<', p) < 0) return (-1); if ((*putc_cb)('/', p) < 0) return (-1); if (mxml_write_string(node->value.element.name, p, putc_cb) < 0) return (-1); if ((*putc_cb)('>', p) < 0) return (-1); col += strlen(node->value.element.name) + 3; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_CLOSE, col, putc_cb); } } else if (node->value.element.name[0] == '!' || node->value.element.name[0] == '?') { /* * The ? and ! elements are special-cases... */ if ((*putc_cb)('>', p) < 0) return (-1); else col ++; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); } else { if ((*putc_cb)(' ', p) < 0) return (-1); if ((*putc_cb)('/', p) < 0) return (-1); if ((*putc_cb)('>', p) < 0) return (-1); col += 3; col = mxml_write_ws(node, p, cb, MXML_WS_AFTER_OPEN, col, putc_cb); } break; case MXML_INTEGER : if (node->prev) { if (col > MXML_WRAP) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else if ((*putc_cb)(' ', p) < 0) return (-1); else col ++; } sprintf(s, "%d", node->value.integer); if (mxml_write_string(s, p, putc_cb) < 0) return (-1); col += strlen(s); break; case MXML_OPAQUE : if (mxml_write_string(node->value.opaque, p, putc_cb) < 0) return (-1); col += strlen(node->value.opaque); break; case MXML_REAL : if (node->prev) { if (col > MXML_WRAP) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else if ((*putc_cb)(' ', p) < 0) return (-1); else col ++; } sprintf(s, "%f", node->value.real); if (mxml_write_string(s, p, putc_cb) < 0) return (-1); col += strlen(s); break; case MXML_TEXT : if (node->value.text.whitespace && col > 0) { if (col > MXML_WRAP) { if ((*putc_cb)('\n', p) < 0) return (-1); col = 0; } else if ((*putc_cb)(' ', p) < 0) return (-1); else col ++; } if (mxml_write_string(node->value.text.string, p, putc_cb) < 0) return (-1); col += strlen(node->value.text.string); break; case MXML_CUSTOM : if (mxml_custom_save_cb) { char *data; /* Custom data string */ const char *newline; /* Last newline in string */ if ((data = (*mxml_custom_save_cb)(node)) == NULL) return (-1); if (mxml_write_string(data, p, putc_cb) < 0) return (-1); if ((newline = strrchr(data, '\n')) == NULL) col += strlen(data); else col = strlen(newline); free(data); break; } default : /* Should never happen */ return (-1); } /* * Next node... */ node = node->next; } return (col); } /* * 'mxml_write_string()' - Write a string, escaping & and < as needed. */ static int /* O - 0 on success, -1 on failure */ mxml_write_string(const char *s, /* I - String to write */ void *p, /* I - Write pointer */ int (*putc_cb)(int, void *)) /* I - Write callback */ { const char *name; /* Entity name, if any */ while (*s) { if ((name = mxmlEntityGetName(*s)) != NULL) { if ((*putc_cb)('&', p) < 0) return (-1); while (*name) { if ((*putc_cb)(*name, p) < 0) return (-1); name ++; } if ((*putc_cb)(';', p) < 0) return (-1); } else if ((*putc_cb)(*s, p) < 0) return (-1); s ++; } return (0); } /* * 'mxml_write_ws()' - Do whitespace callback... */ static int /* O - New column */ mxml_write_ws(mxml_node_t *node, /* I - Current node */ void *p, /* I - Write pointer */ const char *(*cb)(mxml_node_t *, int), /* I - Callback function */ int ws, /* I - Where value */ int col, /* I - Current column */ int (*putc_cb)(int, void *)) /* I - Write callback */ { const char *s; /* Whitespace string */ if (cb && (s = (*cb)(node, ws)) != NULL) { while (*s) { if ((*putc_cb)(*s, p) < 0) return (-1); else if (*s == '\n') col = 0; else if (*s == '\t') { col += MXML_TAB; col = col - (col % MXML_TAB); } else col ++; s ++; } } return (col); } /* * End of "$Id: mxml-file.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-entity.c0000664000000000000000000002446310446600454020676 0ustar rootroot/* * "$Id: mxml-entity.c 22267 2006-04-24 17:11:45Z kpfleming $" * * Character entity support code for Mini-XML, a small XML-like * file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxmlEntityAddCallback() - Add a callback to convert entities to * Unicode. * mxmlEntityGetName() - Get the name that corresponds to the * character value. * mxmlEntityGetValue() - Get the character corresponding to a named * entity. * mxmlEntityRemoveCallback() - Remove a callback. * default_callback() - Lookup standard (X)HTML entities. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Local functions... */ static int default_callback(const char *name); /* * Callback array... */ static int num_callbacks = 1; static int (*callbacks[100])(const char *name) = { default_callback }; /* * 'mxmlEntityAddCallback()' - Add a callback to convert entities to Unicode. */ int /* O - 0 on success, -1 on failure */ mxmlEntityAddCallback(int (*cb)(const char *name)) /* I - Callback function to add */ { if (num_callbacks < (int)(sizeof(callbacks) / sizeof(callbacks[0]))) { callbacks[num_callbacks] = cb; num_callbacks ++; return (0); } else { mxml_error("Unable to add entity callback!"); return (-1); } } /* * 'mxmlEntityGetName()' - Get the name that corresponds to the character value. * * If val does not need to be represented by a named entity, NULL is returned. */ const char * /* O - Entity name or NULL */ mxmlEntityGetName(int val) /* I - Character value */ { switch (val) { case '&' : return ("amp"); case '<' : return ("lt"); case '>' : return ("gt"); case '\"' : return ("quot"); default : return (NULL); } } /* * 'mxmlEntityGetValue()' - Get the character corresponding to a named entity. * * The entity name can also be a numeric constant. -1 is returned if the * name is not known. */ int /* O - Character value or -1 on error */ mxmlEntityGetValue(const char *name) /* I - Entity name */ { int i; /* Looping var */ int ch; /* Character value */ for (i = 0; i < num_callbacks; i ++) if ((ch = (callbacks[i])(name)) >= 0) return (ch); return (-1); } /* * 'mxmlEntityRemoveCallback()' - Remove a callback. */ void mxmlEntityRemoveCallback(int (*cb)(const char *name)) /* I - Callback function to remove */ { int i; /* Looping var */ for (i = 0; i < num_callbacks; i ++) if (cb == callbacks[i]) { /* * Remove the callback... */ num_callbacks --; if (i < num_callbacks) memmove(callbacks + i, callbacks + i + 1, (num_callbacks - i) * sizeof(callbacks[0])); return; } } /* * 'default_callback()' - Lookup standard (X)HTML entities. */ static int /* O - Unicode value or -1 */ default_callback(const char *name) /* I - Entity name */ { int diff, /* Difference between names */ current, /* Current entity in search */ first, /* First entity in search */ last; /* Last entity in search */ static const struct { const char *name; /* Entity name */ int val; /* Character value */ } entities[] = { { "AElig", 198 }, { "Aacute", 193 }, { "Acirc", 194 }, { "Agrave", 192 }, { "Alpha", 913 }, { "Aring", 197 }, { "Atilde", 195 }, { "Auml", 196 }, { "Beta", 914 }, { "Ccedil", 199 }, { "Chi", 935 }, { "Dagger", 8225 }, { "Delta", 916 }, { "Dstrok", 208 }, { "ETH", 208 }, { "Eacute", 201 }, { "Ecirc", 202 }, { "Egrave", 200 }, { "Epsilon", 917 }, { "Eta", 919 }, { "Euml", 203 }, { "Gamma", 915 }, { "Iacute", 205 }, { "Icirc", 206 }, { "Igrave", 204 }, { "Iota", 921 }, { "Iuml", 207 }, { "Kappa", 922 }, { "Lambda", 923 }, { "Mu", 924 }, { "Ntilde", 209 }, { "Nu", 925 }, { "OElig", 338 }, { "Oacute", 211 }, { "Ocirc", 212 }, { "Ograve", 210 }, { "Omega", 937 }, { "Omicron", 927 }, { "Oslash", 216 }, { "Otilde", 213 }, { "Ouml", 214 }, { "Phi", 934 }, { "Pi", 928 }, { "Prime", 8243 }, { "Psi", 936 }, { "Rho", 929 }, { "Scaron", 352 }, { "Sigma", 931 }, { "THORN", 222 }, { "Tau", 932 }, { "Theta", 920 }, { "Uacute", 218 }, { "Ucirc", 219 }, { "Ugrave", 217 }, { "Upsilon", 933 }, { "Uuml", 220 }, { "Xi", 926 }, { "Yacute", 221 }, { "Yuml", 376 }, { "Zeta", 918 }, { "aacute", 225 }, { "acirc", 226 }, { "acute", 180 }, { "aelig", 230 }, { "agrave", 224 }, { "alefsym", 8501 }, { "alpha", 945 }, { "amp", '&' }, { "and", 8743 }, { "ang", 8736 }, { "aring", 229 }, { "asymp", 8776 }, { "atilde", 227 }, { "auml", 228 }, { "bdquo", 8222 }, { "beta", 946 }, { "brkbar", 166 }, { "brvbar", 166 }, { "bull", 8226 }, { "cap", 8745 }, { "ccedil", 231 }, { "cedil", 184 }, { "cent", 162 }, { "chi", 967 }, { "circ", 710 }, { "clubs", 9827 }, { "cong", 8773 }, { "copy", 169 }, { "crarr", 8629 }, { "cup", 8746 }, { "curren", 164 }, { "dArr", 8659 }, { "dagger", 8224 }, { "darr", 8595 }, { "deg", 176 }, { "delta", 948 }, { "diams", 9830 }, { "die", 168 }, { "divide", 247 }, { "eacute", 233 }, { "ecirc", 234 }, { "egrave", 232 }, { "empty", 8709 }, { "emsp", 8195 }, { "ensp", 8194 }, { "epsilon", 949 }, { "equiv", 8801 }, { "eta", 951 }, { "eth", 240 }, { "euml", 235 }, { "euro", 8364 }, { "exist", 8707 }, { "fnof", 402 }, { "forall", 8704 }, { "frac12", 189 }, { "frac14", 188 }, { "frac34", 190 }, { "frasl", 8260 }, { "gamma", 947 }, { "ge", 8805 }, { "gt", '>' }, { "hArr", 8660 }, { "harr", 8596 }, { "hearts", 9829 }, { "hellip", 8230 }, { "hibar", 175 }, { "iacute", 237 }, { "icirc", 238 }, { "iexcl", 161 }, { "igrave", 236 }, { "image", 8465 }, { "infin", 8734 }, { "int", 8747 }, { "iota", 953 }, { "iquest", 191 }, { "isin", 8712 }, { "iuml", 239 }, { "kappa", 954 }, { "lArr", 8656 }, { "lambda", 955 }, { "lang", 9001 }, { "laquo", 171 }, { "larr", 8592 }, { "lceil", 8968 }, { "ldquo", 8220 }, { "le", 8804 }, { "lfloor", 8970 }, { "lowast", 8727 }, { "loz", 9674 }, { "lrm", 8206 }, { "lsaquo", 8249 }, { "lsquo", 8216 }, { "lt", '<' }, { "macr", 175 }, { "mdash", 8212 }, { "micro", 181 }, { "middot", 183 }, { "minus", 8722 }, { "mu", 956 }, { "nabla", 8711 }, { "nbsp", 160 }, { "ndash", 8211 }, { "ne", 8800 }, { "ni", 8715 }, { "not", 172 }, { "notin", 8713 }, { "nsub", 8836 }, { "ntilde", 241 }, { "nu", 957 }, { "oacute", 243 }, { "ocirc", 244 }, { "oelig", 339 }, { "ograve", 242 }, { "oline", 8254 }, { "omega", 969 }, { "omicron", 959 }, { "oplus", 8853 }, { "or", 8744 }, { "ordf", 170 }, { "ordm", 186 }, { "oslash", 248 }, { "otilde", 245 }, { "otimes", 8855 }, { "ouml", 246 }, { "para", 182 }, { "part", 8706 }, { "permil", 8240 }, { "perp", 8869 }, { "phi", 966 }, { "pi", 960 }, { "piv", 982 }, { "plusmn", 177 }, { "pound", 163 }, { "prime", 8242 }, { "prod", 8719 }, { "prop", 8733 }, { "psi", 968 }, { "quot", '\"' }, { "rArr", 8658 }, { "radic", 8730 }, { "rang", 9002 }, { "raquo", 187 }, { "rarr", 8594 }, { "rceil", 8969 }, { "rdquo", 8221 }, { "real", 8476 }, { "reg", 174 }, { "rfloor", 8971 }, { "rho", 961 }, { "rlm", 8207 }, { "rsaquo", 8250 }, { "rsquo", 8217 }, { "sbquo", 8218 }, { "scaron", 353 }, { "sdot", 8901 }, { "sect", 167 }, { "shy", 173 }, { "sigma", 963 }, { "sigmaf", 962 }, { "sim", 8764 }, { "spades", 9824 }, { "sub", 8834 }, { "sube", 8838 }, { "sum", 8721 }, { "sup", 8835 }, { "sup1", 185 }, { "sup2", 178 }, { "sup3", 179 }, { "supe", 8839 }, { "szlig", 223 }, { "tau", 964 }, { "there4", 8756 }, { "theta", 952 }, { "thetasym", 977 }, { "thinsp", 8201 }, { "thorn", 254 }, { "tilde", 732 }, { "times", 215 }, { "trade", 8482 }, { "uArr", 8657 }, { "uacute", 250 }, { "uarr", 8593 }, { "ucirc", 251 }, { "ugrave", 249 }, { "uml", 168 }, { "upsih", 978 }, { "upsilon", 965 }, { "uuml", 252 }, { "weierp", 8472 }, { "xi", 958 }, { "yacute", 253 }, { "yen", 165 }, { "yuml", 255 }, { "zeta", 950 }, { "zwj", 8205 }, { "zwnj", 8204 } }; /* * Do a binary search for the named entity... */ first = 0; last = (int)(sizeof(entities) / sizeof(entities[0]) - 1); while ((last - first) > 1) { current = (first + last) / 2; if ((diff = strcmp(name, entities[current].name)) == 0) return (entities[current].val); else if (diff < 0) last = current; else first = current; } /* * If we get here, there is a small chance that there is still * a match; check first and last... */ if (!strcmp(name, entities[first].name)) return (entities[first].val); else if (!strcmp(name, entities[last].name)) return (entities[last].val); else return (-1); } /* * End of "$Id: mxml-entity.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml.h0000664000000000000000000002111310446600454017356 0ustar rootroot/* * "$Id: mxml.h 22267 2006-04-24 17:11:45Z kpfleming $" * * Header file for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. */ /* * Prevent multiple inclusion... */ #ifndef _mxml_h_ # define _mxml_h_ /* * Include necessary headers... */ # include # include # include # include # include /* * Constants... */ # define MXML_WRAP 72 /* Wrap XML output at this column position */ # define MXML_TAB 8 /* Tabs every N columns */ # define MXML_NO_CALLBACK 0 /* Don't use a type callback */ # define MXML_INTEGER_CALLBACK mxml_integer_cb /* Treat all data as integers */ # define MXML_OPAQUE_CALLBACK mxml_opaque_cb /* Treat all data as opaque */ # define MXML_REAL_CALLBACK mxml_real_cb /* Treat all data as real numbers */ # define MXML_TEXT_CALLBACK 0 /* Treat all data as text */ # define MXML_NO_PARENT 0 /* No parent for the node */ # define MXML_DESCEND 1 /* Descend when finding/walking */ # define MXML_NO_DESCEND 0 /* Don't descend when finding/walking */ # define MXML_DESCEND_FIRST -1 /* Descend for first find */ # define MXML_WS_BEFORE_OPEN 0 /* Callback for before open tag */ # define MXML_WS_AFTER_OPEN 1 /* Callback for after open tag */ # define MXML_WS_BEFORE_CLOSE 2 /* Callback for before close tag */ # define MXML_WS_AFTER_CLOSE 3 /* Callback for after close tag */ # define MXML_ADD_BEFORE 0 /* Add node before specified node */ # define MXML_ADD_AFTER 1 /* Add node after specified node */ # define MXML_ADD_TO_PARENT NULL /* Add node relative to parent */ /* * Data types... */ typedef enum mxml_type_e /**** The XML node type. ****/ { MXML_ELEMENT, /* XML element with attributes */ MXML_INTEGER, /* Integer value */ MXML_OPAQUE, /* Opaque string */ MXML_REAL, /* Real value */ MXML_TEXT, /* Text fragment */ MXML_CUSTOM /* Custom data */ } mxml_type_t; typedef struct mxml_attr_s /**** An XML element attribute value. ****/ { char *name; /* Attribute name */ char *value; /* Attribute value */ } mxml_attr_t; typedef struct mxml_value_s /**** An XML element value. ****/ { char *name; /* Name of element */ int num_attrs; /* Number of attributes */ mxml_attr_t *attrs; /* Attributes */ } mxml_element_t; typedef struct mxml_text_s /**** An XML text value. ****/ { int whitespace; /* Leading whitespace? */ char *string; /* Fragment string */ } mxml_text_t; typedef struct mxml_custom_s /**** An XML custom value. ****/ { void *data; /* Pointer to (allocated) custom data */ void (*destroy)(void *); /* Pointer to destructor function */ } mxml_custom_t; typedef union mxml_value_u /**** An XML node value. ****/ { mxml_element_t element; /* Element */ int integer; /* Integer number */ char *opaque; /* Opaque string */ double real; /* Real number */ mxml_text_t text; /* Text fragment */ mxml_custom_t custom; /* Custom data */ } mxml_value_t; typedef struct mxml_node_s /**** An XML node. ****/ { mxml_type_t type; /* Node type */ struct mxml_node_s *next; /* Next node under same parent */ struct mxml_node_s *prev; /* Previous node under same parent */ struct mxml_node_s *parent; /* Parent node */ struct mxml_node_s *child; /* First child node */ struct mxml_node_s *last_child; /* Last child node */ mxml_value_t value; /* Node value */ } mxml_node_t; typedef struct mxml_index_s /**** An XML node index. ****/ { char *attr; /* Attribute used for indexing or NULL */ int num_nodes; /* Number of nodes in index */ int alloc_nodes; /* Allocated nodes in index */ int cur_node; /* Current node */ mxml_node_t **nodes; /* Node array */ } mxml_index_t; typedef int (*mxml_custom_load_cb_t)(mxml_node_t *, const char *); /**** Custom data load callback function ****/ typedef char *(*mxml_custom_save_cb_t)(mxml_node_t *); /**** Custom data save callback function ****/ /* * C++ support... */ # ifdef __cplusplus extern "C" { # endif /* __cplusplus */ /* * Prototypes... */ extern void mxmlAdd(mxml_node_t *parent, int where, mxml_node_t *child, mxml_node_t *node); extern void mxmlDelete(mxml_node_t *node); extern const char *mxmlElementGetAttr(mxml_node_t *node, const char *name); extern void mxmlElementSetAttr(mxml_node_t *node, const char *name, const char *value); extern int mxmlEntityAddCallback(int (*cb)(const char *name)); extern const char *mxmlEntityGetName(int val); extern int mxmlEntityGetValue(const char *name); extern void mxmlEntityRemoveCallback(int (*cb)(const char *name)); extern mxml_node_t *mxmlFindElement(mxml_node_t *node, mxml_node_t *top, const char *name, const char *attr, const char *value, int descend); extern void mxmlIndexDelete(mxml_index_t *ind); extern mxml_node_t *mxmlIndexEnum(mxml_index_t *ind); extern mxml_node_t *mxmlIndexFind(mxml_index_t *ind, const char *element, const char *value); extern mxml_index_t *mxmlIndexNew(mxml_node_t *node, const char *element, const char *attr); extern mxml_node_t *mxmlIndexReset(mxml_index_t *ind); extern mxml_node_t *mxmlLoadFd(mxml_node_t *top, int fd, mxml_type_t (*cb)(mxml_node_t *)); extern mxml_node_t *mxmlLoadFile(mxml_node_t *top, FILE *fp, mxml_type_t (*cb)(mxml_node_t *)); extern mxml_node_t *mxmlLoadString(mxml_node_t *top, const char *s, mxml_type_t (*cb)(mxml_node_t *)); extern mxml_node_t *mxmlNewCustom(mxml_node_t *parent, void *data, void (*destroy)(void *)); extern mxml_node_t *mxmlNewElement(mxml_node_t *parent, const char *name); extern mxml_node_t *mxmlNewInteger(mxml_node_t *parent, int integer); extern mxml_node_t *mxmlNewOpaque(mxml_node_t *parent, const char *opaque); extern mxml_node_t *mxmlNewReal(mxml_node_t *parent, double real); extern mxml_node_t *mxmlNewText(mxml_node_t *parent, int whitespace, const char *string); extern mxml_node_t *mxmlNewTextf(mxml_node_t *parent, int whitespace, const char *format, ...) # ifdef __GNUC__ __attribute__ ((__format__ (__printf__, 3, 4))) # endif /* __GNUC__ */ ; extern void mxmlRemove(mxml_node_t *node); extern char *mxmlSaveAllocString(mxml_node_t *node, const char *(*cb)(mxml_node_t *, int)); extern int mxmlSaveFd(mxml_node_t *node, int fd, const char *(*cb)(mxml_node_t *, int)); extern int mxmlSaveFile(mxml_node_t *node, FILE *fp, const char *(*cb)(mxml_node_t *, int)); extern int mxmlSaveString(mxml_node_t *node, char *buffer, int bufsize, const char *(*cb)(mxml_node_t *, int)); extern int mxmlSetCustom(mxml_node_t *node, void *data, void (*destroy)(void *)); extern void mxmlSetCustomHandlers(mxml_custom_load_cb_t load, mxml_custom_save_cb_t save); extern int mxmlSetElement(mxml_node_t *node, const char *name); extern void mxmlSetErrorCallback(void (*cb)(const char *)); extern int mxmlSetInteger(mxml_node_t *node, int integer); extern int mxmlSetOpaque(mxml_node_t *node, const char *opaque); extern int mxmlSetReal(mxml_node_t *node, double real); extern int mxmlSetText(mxml_node_t *node, int whitespace, const char *string); extern int mxmlSetTextf(mxml_node_t *node, int whitespace, const char *format, ...) # ifdef __GNUC__ __attribute__ ((__format__ (__printf__, 3, 4))) # endif /* __GNUC__ */ ; extern mxml_node_t *mxmlWalkNext(mxml_node_t *node, mxml_node_t *top, int descend); extern mxml_node_t *mxmlWalkPrev(mxml_node_t *node, mxml_node_t *top, int descend); /* * Private functions... */ extern void mxml_error(const char *format, ...); extern mxml_type_t mxml_integer_cb(mxml_node_t *node); extern mxml_type_t mxml_opaque_cb(mxml_node_t *node); extern mxml_type_t mxml_real_cb(mxml_node_t *node); /* * C++ support... */ # ifdef __cplusplus } # endif /* __cplusplus */ #endif /* !_mxml_h_ */ /* * End of "$Id: mxml.h 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/install-sh0000775000000000000000000001267110446600454020245 0ustar rootroot#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-node.c0000664000000000000000000003663410446600454020312 0ustar rootroot/* * "$Id: mxml-node.c 22267 2006-04-24 17:11:45Z kpfleming $" * * Node support code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxmlAdd() - Add a node to a tree. * mxmlDelete() - Delete a node and all of its children. * mxmlNewElement() - Create a new element node. * mxmlNewInteger() - Create a new integer node. * mxmlNewOpaque() - Create a new opaque string. * mxmlNewReal() - Create a new real number node. * mxmlNewText() - Create a new text fragment node. * mxmlNewTextf() - Create a new formatted text fragment node. * mxmlRemove() - Remove a node from its parent. * mxml_new() - Create a new node. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Local functions... */ static mxml_node_t *mxml_new(mxml_node_t *parent, mxml_type_t type); /* * 'mxmlAdd()' - Add a node to a tree. * * Adds the specified node to the parent. If the child argument is not * NULL, puts the new node before or after the specified child depending * on the value of the where argument. If the child argument is NULL, * puts the new node at the beginning of the child list (MXML_ADD_BEFORE) * or at the end of the child list (MXML_ADD_AFTER). The constant * MXML_ADD_TO_PARENT can be used to specify a NULL child pointer. */ void mxmlAdd(mxml_node_t *parent, /* I - Parent node */ int where, /* I - Where to add, MXML_ADD_BEFORE or MXML_ADD_AFTER */ mxml_node_t *child, /* I - Child node for where or MXML_ADD_TO_PARENT */ mxml_node_t *node) /* I - Node to add */ { #ifdef DEBUG fprintf(stderr, "mxmlAdd(parent=%p, where=%d, child=%p, node=%p)\n", parent, where, child, node); #endif /* DEBUG */ /* * Range check input... */ if (!parent || !node) return; #if DEBUG > 1 fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent); if (parent) { fprintf(stderr, " BEFORE: parent->child=%p\n", parent->child); fprintf(stderr, " BEFORE: parent->last_child=%p\n", parent->last_child); fprintf(stderr, " BEFORE: parent->prev=%p\n", parent->prev); fprintf(stderr, " BEFORE: parent->next=%p\n", parent->next); } #endif /* DEBUG > 1 */ /* * Remove the node from any existing parent... */ if (node->parent) mxmlRemove(node); /* * Reset pointers... */ node->parent = parent; switch (where) { case MXML_ADD_BEFORE : if (!child || child == parent->child || child->parent != parent) { /* * Insert as first node under parent... */ node->next = parent->child; if (parent->child) parent->child->prev = node; else parent->last_child = node; parent->child = node; } else { /* * Insert node before this child... */ node->next = child; node->prev = child->prev; if (child->prev) child->prev->next = node; else parent->child = node; child->prev = node; } break; case MXML_ADD_AFTER : if (!child || child == parent->last_child || child->parent != parent) { /* * Insert as last node under parent... */ node->parent = parent; node->prev = parent->last_child; if (parent->last_child) parent->last_child->next = node; else parent->child = node; parent->last_child = node; } else { /* * Insert node after this child... */ node->prev = child; node->next = child->next; if (child->next) child->next->prev = node; else parent->last_child = node; child->next = node; } break; } #if DEBUG > 1 fprintf(stderr, " AFTER: node->parent=%p\n", node->parent); if (parent) { fprintf(stderr, " AFTER: parent->child=%p\n", parent->child); fprintf(stderr, " AFTER: parent->last_child=%p\n", parent->last_child); fprintf(stderr, " AFTER: parent->prev=%p\n", parent->prev); fprintf(stderr, " AFTER: parent->next=%p\n", parent->next); } #endif /* DEBUG > 1 */ } /* * 'mxmlDelete()' - Delete a node and all of its children. * * If the specified node has a parent, this function first removes the * node from its parent using the mxmlRemove() function. */ void mxmlDelete(mxml_node_t *node) /* I - Node to delete */ { int i; /* Looping var */ #ifdef DEBUG fprintf(stderr, "mxmlDelete(node=%p)\n", node); #endif /* DEBUG */ /* * Range check input... */ if (!node) return; /* * Remove the node from its parent, if any... */ mxmlRemove(node); /* * Delete children... */ while (node->child) mxmlDelete(node->child); /* * Now delete any node data... */ switch (node->type) { case MXML_ELEMENT : if (node->value.element.name) free(node->value.element.name); if (node->value.element.num_attrs) { for (i = 0; i < node->value.element.num_attrs; i ++) { if (node->value.element.attrs[i].name) free(node->value.element.attrs[i].name); if (node->value.element.attrs[i].value) free(node->value.element.attrs[i].value); } free(node->value.element.attrs); } break; case MXML_INTEGER : /* Nothing to do */ break; case MXML_OPAQUE : if (node->value.opaque) free(node->value.opaque); break; case MXML_REAL : /* Nothing to do */ break; case MXML_TEXT : if (node->value.text.string) free(node->value.text.string); break; case MXML_CUSTOM : if (node->value.custom.data && node->value.custom.destroy) (*(node->value.custom.destroy))(node->value.custom.data); break; } /* * Free this node... */ free(node); } /* * 'mxmlNewCustom()' - Create a new custom data node. * * The new custom node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * element node has no parent. NULL can be passed when the data in the * node is not dynamically allocated or is separately managed. */ mxml_node_t * /* O - New node */ mxmlNewCustom(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ void *data, /* I - Pointer to data */ void (*destroy)(void *)) /* I - Function to destroy data */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewCustom(parent=%p, data=%p, destroy=%p)\n", parent, data, destroy); #endif /* DEBUG */ /* * Create the node and set the value... */ if ((node = mxml_new(parent, MXML_CUSTOM)) != NULL) { node->value.custom.data = data; node->value.custom.destroy = destroy; } return (node); } /* * 'mxmlNewElement()' - Create a new element node. * * The new element node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * element node has no parent. */ mxml_node_t * /* O - New node */ mxmlNewElement(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ const char *name) /* I - Name of element */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewElement(parent=%p, name=\"%s\")\n", parent, name ? name : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!name) return (NULL); /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_ELEMENT)) != NULL) node->value.element.name = strdup(name); return (node); } /* * 'mxmlNewInteger()' - Create a new integer node. * * The new integer node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * integer node has no parent. */ mxml_node_t * /* O - New node */ mxmlNewInteger(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ int integer) /* I - Integer value */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewInteger(parent=%p, integer=%d)\n", parent, integer); #endif /* DEBUG */ /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_INTEGER)) != NULL) node->value.integer = integer; return (node); } /* * 'mxmlNewOpaque()' - Create a new opaque string. * * The new opaque node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * opaque node has no parent. The opaque string must be nul-terminated and * is copied into the new node. */ mxml_node_t * /* O - New node */ mxmlNewOpaque(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ const char *opaque) /* I - Opaque string */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewOpaque(parent=%p, opaque=\"%s\")\n", parent, opaque ? opaque : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!opaque) return (NULL); /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_OPAQUE)) != NULL) node->value.opaque = strdup(opaque); return (node); } /* * 'mxmlNewReal()' - Create a new real number node. * * The new real number node is added to the end of the specified parent's * child list. The constant MXML_NO_PARENT can be used to specify that * the new real number node has no parent. */ mxml_node_t * /* O - New node */ mxmlNewReal(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ double real) /* I - Real number value */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewReal(parent=%p, real=%g)\n", parent, real); #endif /* DEBUG */ /* * Create the node and set the element name... */ if ((node = mxml_new(parent, MXML_REAL)) != NULL) node->value.real = real; return (node); } /* * 'mxmlNewText()' - Create a new text fragment node. * * The new text node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * text node has no parent. The whitespace parameter is used to specify * whether leading whitespace is present before the node. The text * string must be nul-terminated and is copied into the new node. */ mxml_node_t * /* O - New node */ mxmlNewText(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *string) /* I - String */ { mxml_node_t *node; /* New node */ #ifdef DEBUG fprintf(stderr, "mxmlNewText(parent=%p, whitespace=%d, string=\"%s\")\n", parent, whitespace, string ? string : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!string) return (NULL); /* * Create the node and set the text value... */ if ((node = mxml_new(parent, MXML_TEXT)) != NULL) { node->value.text.whitespace = whitespace; node->value.text.string = strdup(string); } return (node); } /* * 'mxmlNewTextf()' - Create a new formatted text fragment node. * * The new text node is added to the end of the specified parent's child * list. The constant MXML_NO_PARENT can be used to specify that the new * text node has no parent. The whitespace parameter is used to specify * whether leading whitespace is present before the node. The format * string must be nul-terminated and is formatted into the new node. */ mxml_node_t * /* O - New node */ mxmlNewTextf(mxml_node_t *parent, /* I - Parent node or MXML_NO_PARENT */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *format, /* I - Printf-style frmat string */ ...) /* I - Additional args as needed */ { mxml_node_t *node; /* New node */ va_list ap; /* Pointer to arguments */ #ifdef DEBUG fprintf(stderr, "mxmlNewTextf(parent=%p, whitespace=%d, format=\"%s\", ...)\n", parent, whitespace, format ? format : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!format) return (NULL); /* * Create the node and set the text value... */ if ((node = mxml_new(parent, MXML_TEXT)) != NULL) { va_start(ap, format); node->value.text.whitespace = whitespace; node->value.text.string = mxml_strdupf(format, ap); va_end(ap); } return (node); } /* * 'mxmlRemove()' - Remove a node from its parent. * * Does not free memory used by the node - use mxmlDelete() for that. * This function does nothing if the node has no parent. */ void mxmlRemove(mxml_node_t *node) /* I - Node to remove */ { #ifdef DEBUG fprintf(stderr, "mxmlRemove(node=%p)\n", node); #endif /* DEBUG */ /* * Range check input... */ if (!node || !node->parent) return; /* * Remove from parent... */ #if DEBUG > 1 fprintf(stderr, " BEFORE: node->parent=%p\n", node->parent); if (node->parent) { fprintf(stderr, " BEFORE: node->parent->child=%p\n", node->parent->child); fprintf(stderr, " BEFORE: node->parent->last_child=%p\n", node->parent->last_child); } fprintf(stderr, " BEFORE: node->child=%p\n", node->child); fprintf(stderr, " BEFORE: node->last_child=%p\n", node->last_child); fprintf(stderr, " BEFORE: node->prev=%p\n", node->prev); fprintf(stderr, " BEFORE: node->next=%p\n", node->next); #endif /* DEBUG > 1 */ if (node->prev) node->prev->next = node->next; else node->parent->child = node->next; if (node->next) node->next->prev = node->prev; else node->parent->last_child = node->prev; node->parent = NULL; node->prev = NULL; node->next = NULL; #if DEBUG > 1 fprintf(stderr, " AFTER: node->parent=%p\n", node->parent); if (node->parent) { fprintf(stderr, " AFTER: node->parent->child=%p\n", node->parent->child); fprintf(stderr, " AFTER: node->parent->last_child=%p\n", node->parent->last_child); } fprintf(stderr, " AFTER: node->child=%p\n", node->child); fprintf(stderr, " AFTER: node->last_child=%p\n", node->last_child); fprintf(stderr, " AFTER: node->prev=%p\n", node->prev); fprintf(stderr, " AFTER: node->next=%p\n", node->next); #endif /* DEBUG > 1 */ } /* * 'mxml_new()' - Create a new node. */ static mxml_node_t * /* O - New node */ mxml_new(mxml_node_t *parent, /* I - Parent node */ mxml_type_t type) /* I - Node type */ { mxml_node_t *node; /* New node */ #if DEBUG > 1 fprintf(stderr, "mxml_new(parent=%p, type=%d)\n", parent, type); #endif /* DEBUG > 1 */ /* * Allocate memory for the node... */ if ((node = calloc(1, sizeof(mxml_node_t))) == NULL) { #if DEBUG > 1 fputs(" returning NULL\n", stderr); #endif /* DEBUG > 1 */ return (NULL); } #if DEBUG > 1 fprintf(stderr, " returning %p\n", node); #endif /* DEBUG > 1 */ /* * Set the node type... */ node->type = type; /* * Add to the parent if present... */ if (parent) mxmlAdd(parent, MXML_ADD_AFTER, MXML_ADD_TO_PARENT, node); /* * Return the new node... */ return (node); } /* * End of "$Id: mxml-node.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml.pc.in0000664000000000000000000000030610446600454020137 0ustar rootrootprefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: Mini-XML Description: Lightweight XML support library Version: @VERSION@ Libs: @PC_LIBS@ Cflags: @PC_CFLAGS@ dahdi-tools-2.2.0-rc2/menuselect/mxml/README0000664000000000000000000001444410446600454017121 0ustar rootrootREADME - 05/19/2005 ------------------- INTRODUCTION This README file describes the Mini-XML library version 2.2.2. Mini-XML is a small XML parsing library that you can use to read XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a "make" program. Mini-XML provides the following functionality: - Reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings. - Data is stored in a linked-list tree structure, preserving the XML data hierarchy. - Supports arbitrary element names, attributes, and attribute values with no preset limits, just available memory. - Supports integer, real, opaque ("cdata"), and text data types in "leaf" nodes. - Functions for creating and managing trees of data. - "Find" and "walk" functions for easily locating and navigating trees of data. Mini-XML doesn't do validation or other types of processing on the data based upon schema files or other sources of definition information. BUILDING Mini-XML Mini-XML comes with an autoconf-based configure script; just type the following command to get things going: ./configure The default install prefix is /usr/local, which can be overridden using the --prefix option: ./configure --prefix=/foo Other configure options can be found using the --help option: ./configure --help Once you have configured the software, type "make" to do the build and run the test program to verify that things are working, as follows: make If you are using Mini-XML under Microsoft Windows with Visual C++, use the included project files in the "vcnet" subdirectory to build the library instead. INSTALLING Mini-XML The "install" target will install Mini-XML in the lib and include directories: make install Once you have installed it, use the "-lmxml" option to link your application against it. DOCUMENTATION The documentation is available in the "doc" subdirectory in the files "mxml.html" (HTML) and "mxml.pdf" (PDF). You can also look at the "testmxml.c" and "mxmldoc.c" source files for examples of using Mini-XML. Mini-XML provides a single header file which you include: #include Nodes are defined by the "mxml_node_t" structure; the "type" member defines the node type (element, integer, opaque, real, or text) which determines which value you want to look at in the "value" union. New nodes can be created using the "mxmlNewElement()", "mxmlNewInteger()", "mxmlNewOpaque()", "mxmlNewReal()", and "mxmlNewText()" functions. Only elements can have child nodes, and the top node must be an element, usually "?xml". You load an XML file using the "mxmlLoadFile()" function: FILE *fp; mxml_node_t *tree; fp = fopen("filename.xml", "r"); tree = mxmlLoadFile(NULL, fp, MXML_NO_CALLBACK); fclose(fp); Similarly, you save an XML file using the "mxmlSaveFile()" function: FILE *fp; mxml_node_t *tree; fp = fopen("filename.xml", "w"); mxmlSaveFile(tree, fp, MXML_NO_CALLBACK); fclose(fp); The "mxmlLoadString()", "mxmlSaveAllocString()", and "mxmlSaveString()" functions load XML node trees from and save XML node trees to strings: char buffer[8192]; char *ptr; mxml_node_t *tree; ... tree = mxmlLoadString(NULL, buffer, MXML_NO_CALLBACK); ... mxmlSaveString(tree, buffer, sizeof(buffer), MXML_NO_CALLBACK); ... ptr = mxmlSaveAllocString(tree, MXML_NO_CALLBACK); You can find a named element/node using the "mxmlFindElement()" function: mxml_node_t *node = mxmlFindElement(tree, tree, "name", "attr", "value", MXML_DESCEND); The "name", "attr", and "value" arguments can be passed as NULL to act as wildcards, e.g.: /* Find the first "a" element */ node = mxmlFindElement(tree, tree, "a", NULL, NULL, MXML_DESCEND); /* Find the first "a" element with "href" attribute */ node = mxmlFindElement(tree, tree, "a", "href", NULL, MXML_DESCEND); /* Find the first "a" element with "href" to a URL */ node = mxmlFindElement(tree, tree, "a", "href", "http://www.easysw.com/~mike/mxml/", MXML_DESCEND); /* Find the first element with a "src" attribute*/ node = mxmlFindElement(tree, tree, NULL, "src", NULL, MXML_DESCEND); /* Find the first element with a "src" = "foo.jpg" */ node = mxmlFindElement(tree, tree, NULL, "src", "foo.jpg", MXML_DESCEND); You can also iterate with the same function: mxml_node_t *node; for (node = mxmlFindElement(tree, tree, "name", NULL, NULL, MXML_DESCEND); node != NULL; node = mxmlFindElement(node, tree, "name", NULL, NULL, MXML_DESCEND)) { ... do something ... } Finally, once you are done with the XML data, use the "mxmlDelete()" function to recursively free the memory that is used for a particular node or the entire tree: mxmlDelete(tree); GETTING HELP AND REPORTING PROBLEMS You can email me at "mxml@easysw.com" to report problems and/or ask for help. Just don't expect an instant response, as I get a *lot* of email... LEGAL STUFF The Mini-XML library is Copyright 2003-2005 by Michael Sweet. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. dahdi-tools-2.2.0-rc2/menuselect/mxml/ANNOUNCEMENT0000664000000000000000000000024710446600454020052 0ustar rootrootMini-XML 2.2.2 is now available for download from: http://www.easysw.com/~mike/mxml/software.php Mini-XML 2.2.2 fixes a bug in the reading of custom data nodes. dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-search.c0000664000000000000000000001212610446600454020620 0ustar rootroot/* * "$Id: mxml-search.c 22267 2006-04-24 17:11:45Z kpfleming $" * * Search/navigation functions for Mini-XML, a small XML-like file * parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxmlFindElement() - Find the named element. * mxmlWalkNext() - Walk to the next logical node in the tree. * mxmlWalkPrev() - Walk to the previous logical node in the tree. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * 'mxmlFindElement()' - Find the named element. * * The search is constrained by the name, attribute name, and value; any * NULL names or values are treated as wildcards, so different kinds of * searches can be implemented by looking for all elements of a given name * or all elements with a specific attribute. The descend argument determines * whether the search descends into child nodes; normally you will use * MXML_DESCEND_FIRST for the initial search and MXML_NO_DESCEND to find * additional direct descendents of the node. The top node argument * constrains the search to a particular node's children. */ mxml_node_t * /* O - Element node or NULL */ mxmlFindElement(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ const char *name, /* I - Element name or NULL for any */ const char *attr, /* I - Attribute name, or NULL for none */ const char *value, /* I - Attribute value, or NULL for any */ int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ { const char *temp; /* Current attribute value */ /* * Range check input... */ if (!node || !top || (!attr && value)) return (NULL); /* * Start with the next node... */ node = mxmlWalkNext(node, top, descend); /* * Loop until we find a matching element... */ while (node != NULL) { /* * See if this node matches... */ if (node->type == MXML_ELEMENT && node->value.element.name && (!name || !strcmp(node->value.element.name, name))) { /* * See if we need to check for an attribute... */ if (!attr) return (node); /* No attribute search, return it... */ /* * Check for the attribute... */ if ((temp = mxmlElementGetAttr(node, attr)) != NULL) { /* * OK, we have the attribute, does it match? */ if (!value || !strcmp(value, temp)) return (node); /* Yes, return it... */ } } /* * No match, move on to the next node... */ if (descend == MXML_DESCEND) node = mxmlWalkNext(node, top, MXML_DESCEND); else node = node->next; } return (NULL); } /* * 'mxmlWalkNext()' - Walk to the next logical node in the tree. * * The descend argument controls whether the first child is considered * to be the next node. The top node argument constrains the walk to * the node's children. */ mxml_node_t * /* O - Next node or NULL */ mxmlWalkNext(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ { if (!node) return (NULL); else if (node->child && descend) return (node->child); else if (node->next) return (node->next); else if (node->parent && node->parent != top) { node = node->parent; while (!node->next) if (node->parent == top || !node->parent) return (NULL); else node = node->parent; return (node->next); } else return (NULL); } /* * 'mxmlWalkPrev()' - Walk to the previous logical node in the tree. * * The descend argument controls whether the previous node's last child * is considered to be the previous node. The top node argument constrains * the walk to the node's children. */ mxml_node_t * /* O - Previous node or NULL */ mxmlWalkPrev(mxml_node_t *node, /* I - Current node */ mxml_node_t *top, /* I - Top node */ int descend) /* I - Descend into tree - MXML_DESCEND, MXML_NO_DESCEND, or MXML_DESCEND_FIRST */ { if (!node) return (NULL); else if (node->prev) { if (node->prev->last_child && descend) { /* * Find the last child under the previous node... */ node = node->prev->last_child; while (node->last_child) node = node->last_child; return (node); } else return (node->prev); } else if (node->parent != top) return (node->parent); else return (NULL); } /* * End of "$Id: mxml-search.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-attr.c0000664000000000000000000001025710446600454020330 0ustar rootroot/* * "$Id: mxml-attr.c 22267 2006-04-24 17:11:45Z kpfleming $" * * Attribute support code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxmlElementGetAttr() - Get an attribute. * mxmlElementSetAttr() - Set an attribute. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * 'mxmlElementGetAttr()' - Get an attribute. * * This function returns NULL if the node is not an element or the * named attribute does not exist. */ const char * /* O - Attribute value or NULL */ mxmlElementGetAttr(mxml_node_t *node, /* I - Element node */ const char *name) /* I - Name of attribute */ { int i; /* Looping var */ mxml_attr_t *attr; /* Cirrent attribute */ #ifdef DEBUG fprintf(stderr, "mxmlElementGetAttr(node=%p, name=\"%s\")\n", node, name ? name : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name) return (NULL); /* * Look for the attribute... */ for (i = node->value.element.num_attrs, attr = node->value.element.attrs; i > 0; i --, attr ++) if (!strcmp(attr->name, name)) return (attr->value); /* * Didn't find attribute, so return NULL... */ return (NULL); } /* * 'mxmlElementSetAttr()' - Set an attribute. * * If the named attribute already exists, the value of the attribute * is replaced by the new string value. The string value is copied * into the element node. This function does nothing if the node is * not an element. */ void mxmlElementSetAttr(mxml_node_t *node, /* I - Element node */ const char *name, /* I - Name of attribute */ const char *value) /* I - Attribute value */ { int i; /* Looping var */ mxml_attr_t *attr; /* New attribute */ #ifdef DEBUG fprintf(stderr, "mxmlElementSetAttr(node=%p, name=\"%s\", value=\"%s\")\n", node, name ? name : "(null)", value ? value : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name) return; /* * Look for the attribute... */ for (i = node->value.element.num_attrs, attr = node->value.element.attrs; i > 0; i --, attr ++) if (!strcmp(attr->name, name)) { /* * Replace the attribute value and return... */ if (attr->value) free(attr->value); if (value) { if ((attr->value = strdup(value)) == NULL) mxml_error("Unable to allocate memory for attribute '%s' in element %s!", name, node->value.element.name); } else attr->value = NULL; return; } /* * Attribute not found, so add a new one... */ if (node->value.element.num_attrs == 0) attr = malloc(sizeof(mxml_attr_t)); else attr = realloc(node->value.element.attrs, (node->value.element.num_attrs + 1) * sizeof(mxml_attr_t)); if (!attr) { mxml_error("Unable to allocate memory for attribute '%s' in element %s!", name, node->value.element.name); return; } node->value.element.attrs = attr; attr += node->value.element.num_attrs; attr->name = strdup(name); if (value) attr->value = strdup(value); else attr->value = NULL; if (!attr->name || (!attr->value && value)) { if (attr->name) free(attr->name); if (attr->value) free(attr->value); mxml_error("Unable to allocate memory for attribute '%s' in element %s!", name, node->value.element.name); return; } node->value.element.num_attrs ++; } /* * End of "$Id: mxml-attr.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/config.h.in0000664000000000000000000000272610446600454020264 0ustar rootroot/* * "$Id: config.h.in 22267 2006-04-24 17:11:45Z kpfleming $" * * Configuration file for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. */ /* * Include necessary headers... */ #include #include #include #include #include /* * Version number... */ #define MXML_VERSION "" /* * Do we have the vsnprintf() function? */ #undef HAVE_VSNPRINTF /* * Do we have the strXXX() functions? */ #undef HAVE_STRDUP /* * Define prototypes for string functions as needed... */ # ifndef HAVE_STRDUP extern char *mxml_strdup(const char *); # define strdup mxml_strdup # endif /* !HAVE_STRDUP */ extern char *mxml_strdupf(const char *, va_list); # ifndef HAVE_VSNPRINTF extern int mxml_vsnprintf(char *, size_t, const char *, va_list); # define vsnprintf mxml_vsnprintf # endif /* !HAVE_VSNPRINTF */ /* * End of "$Id: config.h.in 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-index.c0000664000000000000000000003333010446600454020462 0ustar rootroot/* * "$Id: mxml-index.c 22267 2006-04-24 17:11:45Z kpfleming $" * * Index support code for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxmlIndexDelete() - Delete an index. * mxmlIndexEnum() - Return the next node in the index. * mxmlIndexFind() - Find the next matching node. * mxmlIndexNew() - Create a new index. * mxmlIndexReset() - Reset the enumeration/find pointer in the index and * return the first node in the index. * index_compare() - Compare two nodes. * index_find() - Compare a node with index values. * index_sort() - Sort the nodes in the index... */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Sort functions... */ static int index_compare(mxml_index_t *ind, mxml_node_t *first, mxml_node_t *second); static int index_find(mxml_index_t *ind, const char *element, const char *value, mxml_node_t *node); static void index_sort(mxml_index_t *ind, int left, int right); /* * 'mxmlIndexDelete()' - Delete an index. */ void mxmlIndexDelete(mxml_index_t *ind) /* I - Index to delete */ { /* * Range check input.. */ if (!ind) return; /* * Free memory... */ if (ind->attr) free(ind->attr); if (ind->alloc_nodes) free(ind->nodes); free(ind); } /* * 'mxmlIndexEnum()' - Return the next node in the index. * * Nodes are returned in the sorted order of the index. */ mxml_node_t * /* O - Next node or NULL if there is none */ mxmlIndexEnum(mxml_index_t *ind) /* I - Index to enumerate */ { /* * Range check input... */ if (!ind) return (NULL); /* * Return the next node... */ if (ind->cur_node < ind->num_nodes) return (ind->nodes[ind->cur_node ++]); else return (NULL); } /* * 'mxmlIndexFind()' - Find the next matching node. * * You should call mxmlIndexReset() prior to using this function for * the first time with a particular set of "element" and "value" * strings. Passing NULL for both "element" and "value" is equivalent * to calling mxmlIndexEnum(). */ mxml_node_t * /* O - Node or NULL if none found */ mxmlIndexFind(mxml_index_t *ind, /* I - Index to search */ const char *element, /* I - Element name to find, if any */ const char *value) /* I - Attribute value, if any */ { int diff, /* Difference between names */ current, /* Current entity in search */ first, /* First entity in search */ last; /* Last entity in search */ #ifdef DEBUG printf("mxmlIndexFind(ind=%p, element=\"%s\", value=\"%s\")\n", ind, element ? element : "(null)", value ? value : "(null)"); #endif /* DEBUG */ /* * Range check input... */ if (!ind || (!ind->attr && value)) { #ifdef DEBUG puts(" returning NULL..."); printf(" ind->attr=\"%s\"\n", ind->attr ? ind->attr : "(null)"); #endif /* DEBUG */ return (NULL); } /* * If both element and value are NULL, just enumerate the nodes in the * index... */ if (!element && !value) return (mxmlIndexEnum(ind)); /* * If there are no nodes in the index, return NULL... */ if (!ind->num_nodes) { #ifdef DEBUG puts(" returning NULL..."); puts(" no nodes!"); #endif /* DEBUG */ return (NULL); } /* * If cur_node == 0, then find the first matching node... */ if (ind->cur_node == 0) { /* * Find the first node using a modified binary search algorithm... */ first = 0; last = ind->num_nodes - 1; #ifdef DEBUG printf(" find first time, num_nodes=%d...\n", ind->num_nodes); #endif /* DEBUG */ while ((last - first) > 1) { current = (first + last) / 2; #ifdef DEBUG printf(" first=%d, last=%d, current=%d\n", first, last, current); #endif /* DEBUG */ if ((diff = index_find(ind, element, value, ind->nodes[current])) == 0) { /* * Found a match, move back to find the first... */ #ifdef DEBUG puts(" match!"); #endif /* DEBUG */ while (current > 0 && !index_find(ind, element, value, ind->nodes[current - 1])) current --; #ifdef DEBUG printf(" returning first match=%d\n", current); #endif /* DEBUG */ /* * Return the first match and save the index to the next... */ ind->cur_node = current + 1; return (ind->nodes[current]); } else if (diff < 0) last = current; else first = current; #ifdef DEBUG printf(" diff=%d\n", diff); #endif /* DEBUG */ } /* * If we get this far, then we found exactly 0 or 1 matches... */ for (current = first; current <= last; current ++) if (!index_find(ind, element, value, ind->nodes[current])) { /* * Found exactly one (or possibly two) match... */ #ifdef DEBUG printf(" returning only match %d...\n", current); #endif /* DEBUG */ ind->cur_node = current + 1; return (ind->nodes[current]); } /* * No matches... */ ind->cur_node = ind->num_nodes; #ifdef DEBUG puts(" returning NULL..."); #endif /* DEBUG */ return (NULL); } else if (ind->cur_node < ind->num_nodes && !index_find(ind, element, value, ind->nodes[ind->cur_node])) { /* * Return the next matching node... */ #ifdef DEBUG printf(" returning next match %d...\n", ind->cur_node); #endif /* DEBUG */ return (ind->nodes[ind->cur_node ++]); } /* * If we get this far, then we have no matches... */ ind->cur_node = ind->num_nodes; #ifdef DEBUG puts(" returning NULL..."); #endif /* DEBUG */ return (NULL); } /* * 'mxmlIndexNew()' - Create a new index. * * The index will contain all nodes that contain the named element and/or * attribute. If both "element" and "attr" are NULL, then the index will * contain a sorted list of the elements in the node tree. Nodes are * sorted by element name and optionally by attribute value if the "attr" * argument is not NULL. */ mxml_index_t * /* O - New index */ mxmlIndexNew(mxml_node_t *node, /* I - XML node tree */ const char *element, /* I - Element to index or NULL for all */ const char *attr) /* I - Attribute to index or NULL for none */ { mxml_index_t *ind; /* New index */ mxml_node_t *current, /* Current node in index */ **temp; /* Temporary node pointer array */ /* * Range check input... */ #ifdef DEBUG printf("mxmlIndexNew(node=%p, element=\"%s\", attr=\"%s\")\n", node, element ? element : "(null)", attr ? attr : "(null)"); #endif /* DEBUG */ if (!node) return (NULL); /* * Create a new index... */ if ((ind = calloc(1, sizeof(mxml_index_t))) == NULL) { mxml_error("Unable to allocate %d bytes for index - %s", sizeof(mxml_index_t), strerror(errno)); return (NULL); } if (attr) ind->attr = strdup(attr); if (!element && !attr) current = node; else current = mxmlFindElement(node, node, element, attr, NULL, MXML_DESCEND); while (current) { if (ind->num_nodes >= ind->alloc_nodes) { if (!ind->alloc_nodes) temp = malloc(64 * sizeof(mxml_node_t *)); else temp = realloc(ind->nodes, (ind->alloc_nodes + 64) * sizeof(mxml_node_t *)); if (!temp) { /* * Unable to allocate memory for the index, so abort... */ mxml_error("Unable to allocate %d bytes for index: %s", (ind->alloc_nodes + 64) * sizeof(mxml_node_t *), strerror(errno)); mxmlIndexDelete(ind); return (NULL); } ind->nodes = temp; ind->alloc_nodes += 64; } ind->nodes[ind->num_nodes ++] = current; current = mxmlFindElement(current, node, element, attr, NULL, MXML_DESCEND); } /* * Sort nodes based upon the search criteria... */ #ifdef DEBUG { int i; /* Looping var */ printf("%d node(s) in index.\n\n", ind->num_nodes); if (attr) { printf("Node Address Element %s\n", attr); puts("-------- -------- -------------- ------------------------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %-14.14s %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name, mxmlElementGetAttr(ind->nodes[i], attr)); } else { puts("Node Address Element"); puts("-------- -------- --------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name); } putchar('\n'); } #endif /* DEBUG */ if (ind->num_nodes > 1) index_sort(ind, 0, ind->num_nodes - 1); #ifdef DEBUG { int i; /* Looping var */ puts("After sorting:\n"); if (attr) { printf("Node Address Element %s\n", attr); puts("-------- -------- -------------- ------------------------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %-14.14s %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name, mxmlElementGetAttr(ind->nodes[i], attr)); } else { puts("Node Address Element"); puts("-------- -------- --------------"); for (i = 0; i < ind->num_nodes; i ++) printf("%8d %-8p %s\n", i, ind->nodes[i], ind->nodes[i]->value.element.name); } putchar('\n'); } #endif /* DEBUG */ /* * Return the new index... */ return (ind); } /* * 'mxmlIndexReset()' - Reset the enumeration/find pointer in the index and * return the first node in the index. * * This function should be called prior to using mxmlIndexEnum() or * mxmlIndexFind() for the first time. */ mxml_node_t * /* O - First node or NULL if there is none */ mxmlIndexReset(mxml_index_t *ind) /* I - Index to reset */ { #ifdef DEBUG printf("mxmlIndexReset(ind=%p)\n", ind); #endif /* DEBUG */ /* * Range check input... */ if (!ind) return (NULL); /* * Set the index to the first element... */ ind->cur_node = 0; /* * Return the first node... */ if (ind->num_nodes) return (ind->nodes[0]); else return (NULL); } /* * 'index_compare()' - Compare two nodes. */ static int /* O - Result of comparison */ index_compare(mxml_index_t *ind, /* I - Index */ mxml_node_t *first, /* I - First node */ mxml_node_t *second) /* I - Second node */ { int diff; /* Difference */ /* * Check the element name... */ if ((diff = strcmp(first->value.element.name, second->value.element.name)) != 0) return (diff); /* * Check the attribute value... */ if (ind->attr) { if ((diff = strcmp(mxmlElementGetAttr(first, ind->attr), mxmlElementGetAttr(second, ind->attr))) != 0) return (diff); } /* * No difference, return 0... */ return (0); } /* * 'index_find()' - Compare a node with index values. */ static int /* O - Result of comparison */ index_find(mxml_index_t *ind, /* I - Index */ const char *element, /* I - Element name or NULL */ const char *value, /* I - Attribute value or NULL */ mxml_node_t *node) /* I - Node */ { int diff; /* Difference */ /* * Check the element name... */ if (element) { if ((diff = strcmp(element, node->value.element.name)) != 0) return (diff); } /* * Check the attribute value... */ if (value) { if ((diff = strcmp(value, mxmlElementGetAttr(node, ind->attr))) != 0) return (diff); } /* * No difference, return 0... */ return (0); } /* * 'index_sort()' - Sort the nodes in the index... * * This function implements the classic quicksort algorithm... */ static void index_sort(mxml_index_t *ind, /* I - Index to sort */ int left, /* I - Left node in partition */ int right) /* I - Right node in partition */ { mxml_node_t *pivot, /* Pivot node */ *temp; /* Swap node */ int templ, /* Temporary left node */ tempr; /* Temporary right node */ /* * Loop until we have sorted all the way to the right... */ do { /* * Sort the pivot in the current partition... */ pivot = ind->nodes[left]; for (templ = left, tempr = right; templ < tempr;) { /* * Move left while left node <= pivot node... */ while ((templ < right) && index_compare(ind, ind->nodes[templ], pivot) <= 0) templ ++; /* * Move right while right node > pivot node... */ while ((tempr > left) && index_compare(ind, ind->nodes[tempr], pivot) > 0) tempr --; /* * Swap nodes if needed... */ if (templ < tempr) { temp = ind->nodes[templ]; ind->nodes[templ] = ind->nodes[tempr]; ind->nodes[tempr] = temp; } } /* * When we get here, the right (tempr) node is the new position for the * pivot node... */ if (index_compare(ind, pivot, ind->nodes[tempr]) > 0) { ind->nodes[left] = ind->nodes[tempr]; ind->nodes[tempr] = pivot; } /* * Recursively sort the left partition as needed... */ if (left < (tempr - 1)) index_sort(ind, left, tempr - 1); } while (right > (left = tempr + 1)); } /* * End of "$Id: mxml-index.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml.pc0000664000000000000000000000035210446600454017533 0ustar rootrootprefix=/usr/local exec_prefix=/usr/local libdir=${exec_prefix}/lib includedir=${prefix}/include Name: Mini-XML Description: Lightweight XML support library Version: 2.2.2 Libs: -L${exec_prefix}/lib -lmxml Cflags: -I${prefix}/include dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-set.c0000664000000000000000000001310310446600454020142 0ustar rootroot/* * "$Id: mxml-set.c 22267 2006-04-24 17:11:45Z kpfleming $" * * Node set functions for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxmlSetElement() - Set the name of an element node. * mxmlSetInteger() - Set the value of an integer node. * mxmlSetOpaque() - Set the value of an opaque node. * mxmlSetReal() - Set the value of a real number node. * mxmlSetText() - Set the value of a text node. * mxmlSetTextf() - Set the value of a text node to a formatted string. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * 'mxmlSetCustom()' - Set the data and destructor of a custom data node. * * The node is not changed if it is not a custom node. */ int /* O - 0 on success, -1 on failure */ mxmlSetCustom(mxml_node_t *node, /* I - Node to set */ void *data, /* I - New data pointer */ void (*destroy)(void *)) /* I - New destructor function */ { /* * Range check input... */ if (!node || node->type != MXML_CUSTOM) return (-1); /* * Free any old element value and set the new value... */ if (node->value.custom.data && node->value.custom.destroy) (*(node->value.custom.destroy))(node->value.custom.data); node->value.custom.data = data; node->value.custom.destroy = destroy; return (0); } /* * 'mxmlSetElement()' - Set the name of an element node. * * The node is not changed if it is not an element node. */ int /* O - 0 on success, -1 on failure */ mxmlSetElement(mxml_node_t *node, /* I - Node to set */ const char *name) /* I - New name string */ { /* * Range check input... */ if (!node || node->type != MXML_ELEMENT || !name) return (-1); /* * Free any old element value and set the new value... */ if (node->value.element.name) free(node->value.element.name); node->value.element.name = strdup(name); return (0); } /* * 'mxmlSetInteger()' - Set the value of an integer node. * * The node is not changed if it is not an integer node. */ int /* O - 0 on success, -1 on failure */ mxmlSetInteger(mxml_node_t *node, /* I - Node to set */ int integer) /* I - Integer value */ { /* * Range check input... */ if (!node || node->type != MXML_INTEGER) return (-1); /* * Set the new value and return... */ node->value.integer = integer; return (0); } /* * 'mxmlSetOpaque()' - Set the value of an opaque node. * * The node is not changed if it is not an opaque node. */ int /* O - 0 on success, -1 on failure */ mxmlSetOpaque(mxml_node_t *node, /* I - Node to set */ const char *opaque) /* I - Opaque string */ { /* * Range check input... */ if (!node || node->type != MXML_OPAQUE || !opaque) return (-1); /* * Free any old opaque value and set the new value... */ if (node->value.opaque) free(node->value.opaque); node->value.opaque = strdup(opaque); return (0); } /* * 'mxmlSetReal()' - Set the value of a real number node. * * The node is not changed if it is not a real number node. */ int /* O - 0 on success, -1 on failure */ mxmlSetReal(mxml_node_t *node, /* I - Node to set */ double real) /* I - Real number value */ { /* * Range check input... */ if (!node || node->type != MXML_REAL) return (-1); /* * Set the new value and return... */ node->value.real = real; return (0); } /* * 'mxmlSetText()' - Set the value of a text node. * * The node is not changed if it is not a text node. */ int /* O - 0 on success, -1 on failure */ mxmlSetText(mxml_node_t *node, /* I - Node to set */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *string) /* I - String */ { /* * Range check input... */ if (!node || node->type != MXML_TEXT || !string) return (-1); /* * Free any old string value and set the new value... */ if (node->value.text.string) free(node->value.text.string); node->value.text.whitespace = whitespace; node->value.text.string = strdup(string); return (0); } /* * 'mxmlSetTextf()' - Set the value of a text node to a formatted string. * * The node is not changed if it is not a text node. */ int /* O - 0 on success, -1 on failure */ mxmlSetTextf(mxml_node_t *node, /* I - Node to set */ int whitespace, /* I - 1 = leading whitespace, 0 = no whitespace */ const char *format, /* I - Printf-style format string */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Pointer to arguments */ /* * Range check input... */ if (!node || node->type != MXML_TEXT || !format) return (-1); /* * Free any old string value and set the new value... */ if (node->value.text.string) free(node->value.text.string); va_start(ap, format); node->value.text.whitespace = whitespace; node->value.text.string = mxml_strdupf(format, ap); va_end(ap); return (0); } /* * End of "$Id: mxml-set.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/CHANGES0000664000000000000000000001616210446600454017233 0ustar rootrootCHANGES - 05/19/2005 -------------------- CHANGES IN Mini-XML 2.2.2 - mxmlLoad*() did not treat custom data as opaque, so whitespace characters would be lost. CHANGES IN Mini-XML 2.2.1 - mxmlLoadFd(), mxmlLoadFile(), and mxmlLoadString() now correctly return NULL on error (STR #21) - mxmlNewInteger(), mxmlNewOpaque(), mxmlNewReal(), mxmlNewText(), and mxmlNewTextf() incorrectly required a parent node (STR #22) - Fixed an XML output bug in mxmldoc. - The "make install" target now uses the install command to set the proper permissions on UNIX/Linux/OSX. - Fixed a MingW/Cygwin compilation problem (STR #18) CHANGES IN Mini-XML 2.2 - Added shared library support (STR #17) - mxmlLoad*() now returns an error when an XML stream contains illegal control characters (STR #10) - mxmlLoad*() now returns an error when an element contains two attributes with the same name in conformance with the XML spec (STR #16) - Added support for CDATA (STR #14, STR #15) - Updated comment and processing instruction handling - no entity support per XML specification. - Added checking for invalid comment termination ("--->" is not allowed) CHANGES IN Mini-XML 2.1 - Added support for custom data nodes (STR #6) - Now treat UTF-8 sequences which are longer than necessary as an error (STR #4) - Fixed entity number support (STR #8) - Fixed mxmlLoadString() bug with UTF-8 (STR #7) - Fixed entity lookup bug (STR #5) - Added mxmlLoadFd() and mxmlSaveFd() functions. - Fixed multi-word UTF-16 handling. CHANGES IN Mini-XML 2.0 - New programmers manual. - Added Visual C++ project files for Microsoft Windows users. - Added optimizations to mxmldoc, mxmlSaveFile(), and mxmlIndexNew() (STR #2) - mxmlEntityAddCallback() now returns an integer status (STR #2) - Added UTF-16 support (input only; all output is UTF-8) - Added index functions to build a searchable index of XML nodes. - Added character entity callback interface to support additional character entities beyond those defined in the XHTML specification. - Added support for XHTML character entities. - The mxmldoc utility now produces XML output which conforms to an updated XML schema, described in the file "doc/mxmldoc.xsd". - Changed the whitespace callback interface to return strings instead of a single character, allowing for greater control over the formatting of XML files written using Mini-XML. THIS CHANGE WILL REQUIRE CHANGES TO YOUR 1.x CODE IF YOU USE WHITESPACE CALLBACKS. - The mxmldoc utility is now capable of documenting C++ classes, functions, and structures, and correctly handles C++ comments. - Added new modular tests for mxmldoc. - Updated the mxmldoc output to be more compatible with embedding in manuals produced with HTMLDOC. - The makefile incorrectly included a "/" separator between the destination path and install path. This caused problems when building and installing with MingW. CHANGES IN Mini-XML 1.3 - Fixes for mxmldoc. - Added support for reading standard HTML entity names. - mxmlLoadString/File() did not decode character entities in element names, attribute names, or attribute values. - mxmlLoadString/File() would crash when loading non- conformant XML data under an existing parent (top) node. - Fixed several bugs in the mxmldoc utility. - Added new error callback function to catch a variety of errors and log them to someplace other than stderr. - The mxmlElementSetAttr() function now allows for NULL attribute values. - The load and save functions now properly handle quoted element and attribute name strings properly, e.g. for !DOCTYPE declarations. CHANGES IN Mini-XML 1.2 - Added new "set" methods to set the value of a node. - Added new formatted text methods mxmlNewTextf() and mxmlSetTextf() to create/set a text node value using printf-style formats. - Added new standard callbacks for use with the mxmlLoad functions. - Updated the HTML documentation to include examples of the walk and load function output. - Added --with/without-ansi configure option to control the strdup() function check. - Added --with/without-snprintf configure option to control the snprintf() and vsnprintf() function checks. CHANGES IN Mini-XML 1.1.2 - The mxml(3) man page wasn't updated for the string functions. - mxmlSaveString() returned the wrong number of characters. - mxml_add_char() updated the buffer pointer in the wrong place. CHANGES IN Mini-XML 1.1.1 - The private mxml_add_ch() function did not update the start-of-buffer pointer which could cause a crash when using mxmlSaveString(). - The private mxml_write_ws() function called putc() instead of using the proper callback which could cause a crash when using mxmlSaveString(). - Added a mxmlSaveAllocString() convenience function for saving an XML node tree to an allocated string. CHANGES IN Mini-XML 1.1 - The mxmlLoadFile() function now uses dynamically allocated string buffers for element names, attribute names, and attribute values. Previously they were capped at 16383, 255, and 255 bytes, respectively. - Added a new mxmlLoadString() function for loading an XML node tree from a string. - Added a new mxmlSaveString() function for saving an XML node tree to a string. - Add emulation of strdup() if the local platform does not provide the function. CHANGES IN Mini-XML 1.0 - The mxmldoc program now handles function arguments, structures, unions, enumerations, classes, and typedefs properly. - Documentation provided via mxmldoc and more in-line comments in the code. - Added man pages and packaging files. CHANGES IN Mini-XML 0.93 - New mxmldoc example program that is also used to create and update code documentation using XML and produce HTML reference pages. - Added mxmlAdd() and mxmlRemove() functions to add and remove nodes from a tree. This provides more flexibility over where the nodes are inserted and allows nodes to be moved within the tree as needed. - mxmlLoadFile() now correctly handles comments. - mxmlLoadFile() now supports the required "gt", "quot", and "nbsp" character entities. - mxmlSaveFile() now uses newlines as whitespace when valid to do so. - mxmlFindElement() now also takes attribute name and attribute value string arguments to limit the search to specific elements with attributes and/or values. NULL pointers can be used as "wildcards". - Added uninstall target to makefile, and auto-reconfig if Makefile.in or configure.in are changed. - mxmlFindElement(), mxmlWalkNext(), and mxmlWalkPrev() now all provide "descend" arguments to control whether they descend into child nodes in the tree. - Fixed some whitespace issues in mxmlLoadFile(). - Fixed Unicode output and whitespace issues in mxmlSaveFile(). - mxmlSaveFile() now supports a whitespace callback to provide more human-readable XML output under program control. CHANGES IN Mini-XML 0.92 - mxmlSaveFile() didn't return a value on success. CHANGES IN Mini-XML 0.91 - mxmlWalkNext() would go into an infinite loop. CHANGES IN Mini-XML 0.9 - Initial public release. dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-string.c0000664000000000000000000001746610446600454020675 0ustar rootroot/* * "$Id: mxml-string.c 22267 2006-04-24 17:11:45Z kpfleming $" * * String functions for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxml_strdup() - Duplicate a string. * mxml_strdupf() - Format and duplicate a string. * mxml_vsnprintf() - Format a string into a fixed size buffer. */ /* * Include necessary headers... */ #include "config.h" /* * 'mxml_strdup()' - Duplicate a string. */ #ifndef HAVE_STRDUP char * /* O - New string pointer */ mxml_strdup(const char *s) /* I - String to duplicate */ { char *t; /* New string pointer */ if (s == NULL) return (NULL); if ((t = malloc(strlen(s) + 1)) == NULL) return (NULL); return (strcpy(t, s)); } #endif /* !HAVE_STRDUP */ /* * 'mxml_strdupf()' - Format and duplicate a string. */ char * /* O - New string pointer */ mxml_strdupf(const char *format, /* I - Printf-style format string */ va_list ap) /* I - Pointer to additional arguments */ { int bytes; /* Number of bytes required */ char *buffer, /* String buffer */ temp[256]; /* Small buffer for first vsnprintf */ /* * First format with a tiny buffer; this will tell us how many bytes are * needed... */ bytes = vsnprintf(temp, sizeof(temp), format, ap); if (bytes < sizeof(temp)) { /* * Hey, the formatted string fits in the tiny buffer, so just dup that... */ return (strdup(temp)); } /* * Allocate memory for the whole thing and reformat to the new, larger * buffer... */ if ((buffer = calloc(1, bytes + 1)) != NULL) vsnprintf(buffer, bytes + 1, format, ap); /* * Return the new string... */ return (buffer); } #ifndef HAVE_VSNPRINTF /* * 'mxml_vsnprintf()' - Format a string into a fixed size buffer. */ int /* O - Number of bytes formatted */ mxml_vsnprintf(char *buffer, /* O - Output buffer */ size_t bufsize, /* O - Size of output buffer */ const char *format, /* I - Printf-style format string */ va_list ap) /* I - Pointer to additional arguments */ { char *bufptr, /* Pointer to position in buffer */ *bufend, /* Pointer to end of buffer */ sign, /* Sign of format width */ size, /* Size character (h, l, L) */ type; /* Format type character */ const char *bufformat; /* Start of format */ int width, /* Width of field */ prec; /* Number of characters of precision */ char tformat[100], /* Temporary format string for sprintf() */ temp[1024]; /* Buffer for formatted numbers */ char *s; /* Pointer to string */ int slen; /* Length of string */ int bytes; /* Total number of bytes needed */ /* * Loop through the format string, formatting as needed... */ bufptr = buffer; bufend = buffer + bufsize - 1; bytes = 0; while (*format) { if (*format == '%') { bufformat = format; format ++; if (*format == '%') { *bufptr++ = *format++; continue; } else if (strchr(" -+#\'", *format)) sign = *format++; else sign = 0; width = 0; while (isdigit(*format)) width = width * 10 + *format++ - '0'; if (*format == '.') { format ++; prec = 0; while (isdigit(*format)) prec = prec * 10 + *format++ - '0'; } else prec = -1; if (*format == 'l' && format[1] == 'l') { size = 'L'; format += 2; } else if (*format == 'h' || *format == 'l' || *format == 'L') size = *format++; if (!*format) break; type = *format++; switch (type) { case 'E' : /* Floating point formats */ case 'G' : case 'e' : case 'f' : case 'g' : if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; strncpy(tformat, bufformat, format - bufformat); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, double)); bytes += strlen(temp); if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { strncpy(bufptr, temp, bufend - bufptr); bufptr = bufend; break; } else { strcpy(bufptr, temp); bufptr += strlen(temp); } } break; case 'B' : /* Integer formats */ case 'X' : case 'b' : case 'd' : case 'i' : case 'o' : case 'u' : case 'x' : if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; strncpy(tformat, bufformat, format - bufformat); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, int)); bytes += strlen(temp); if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { strncpy(bufptr, temp, bufend - bufptr); bufptr = bufend; break; } else { strcpy(bufptr, temp); bufptr += strlen(temp); } } break; case 'p' : /* Pointer value */ if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; strncpy(tformat, bufformat, format - bufformat); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, void *)); bytes += strlen(temp); if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { strncpy(bufptr, temp, bufend - bufptr); bufptr = bufend; break; } else { strcpy(bufptr, temp); bufptr += strlen(temp); } } break; case 'c' : /* Character or character array */ bytes += width; if (bufptr) { if (width <= 1) *bufptr++ = va_arg(ap, int); else { if ((bufptr + width) > bufend) width = bufend - bufptr; memcpy(bufptr, va_arg(ap, char *), width); bufptr += width; } } break; case 's' : /* String */ if ((s = va_arg(ap, char *)) == NULL) s = "(null)"; slen = strlen(s); if (slen > width && prec != width) width = slen; bytes += width; if (bufptr) { if ((bufptr + width) > bufend) width = bufend - bufptr; if (slen > width) slen = width; if (sign == '-') { strncpy(bufptr, s, slen); memset(bufptr + slen, ' ', width - slen); } else { memset(bufptr, ' ', width - slen); strncpy(bufptr + width - slen, s, slen); } bufptr += width; } break; case 'n' : /* Output number of chars so far */ if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; strncpy(tformat, bufformat, format - bufformat); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, int)); bytes += strlen(temp); if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { strncpy(bufptr, temp, bufend - bufptr); bufptr = bufend; break; } else { strcpy(bufptr, temp); bufptr += strlen(temp); } } break; } } else { bytes ++; if (bufptr && bufptr < bufend) *bufptr++ = *format++; } } /* * Nul-terminate the string and return the number of characters needed. */ *bufptr = '\0'; return (bytes); } #endif /* !HAVE_VSNPRINTF */ /* * End of "$Id: mxml-string.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/mxml/configure0000775000000000000000000040723010446600454020147 0ustar rootroot#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # 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 before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, 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 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="mxml.h" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION LDFLAGS OPTIM docdir CC CFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB AR CP LN MKDIR NROFF GROFF RM ARFLAGS DSO DSOFLAGS LIBMXML PICFLAG CAT1EXT CAT3EXT MAN1EXT MAN3EXT PC_CFLAGS PC_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --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 --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 --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug turn on debugging, default=no --enable-shared turn on shared libraries, default=no Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ansi set full ANSI C mode, default=no --with-docdir set directory for documentation, default=${prefix}/share/doc/mxml --with-vsnprintf use vsnprintf emulation functions, default=auto Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd "$ac_popdir" done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; 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; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >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 # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers config.h" VERSION=2.2.2 cat >>confdefs.h <<_ACEOF #define MXML_VERSION "Mini-XML v$VERSION" _ACEOF CFLAGS="${CFLAGS:=}" CXXFLAGS="${CXXFLAGS:=}" LDFLAGS="${LDFLAGS:=}" OPTIM="-O" # Check whether --with-ansi or --without-ansi was given. if test "${with_ansi+set}" = set; then withval="$with_ansi" use_ansi="$withval" else use_ansi="no" fi; # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" if eval "test x$enable_debug = xyes"; then OPTIM="-g" else LDFLAGS="$LDFLAGS -s" fi fi; # Check whether --with-docdir or --without-docdir was given. if test "${with_docdir+set}" = set; then withval="$with_docdir" docdir="$withval" else docdir="NONE" fi; # Check whether --with-vsnprintf or --without-vsnprintf was given. if test "${with_vsnprintf+set}" = set; then withval="$with_vsnprintf" use_vsnprintf="$withval" else use_vsnprintf="no" fi; uname=`uname` uversion=`uname -r | sed -e '1,$s/[^0-9]//g'` if test x$uname = xIRIX64; then uname="IRIX" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f 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 /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc 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 -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f 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 /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' if test "$INSTALL" = "$ac_install_sh"; then # Use full path to install-sh script... INSTALL="`pwd`/install-sh -c" 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then echo "$as_me:$LINENO: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi 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 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi RANLIB=$ac_ct_RANLIB else RANLIB="$ac_cv_prog_RANLIB" fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $AR in [\\/]* | ?:[\\/]*) ac_cv_path_AR="$AR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi AR=$ac_cv_path_AR if test -n "$AR"; then echo "$as_me:$LINENO: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_CP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CP in [\\/]* | ?:[\\/]*) ac_cv_path_CP="$CP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi CP=$ac_cv_path_CP if test -n "$CP"; then echo "$as_me:$LINENO: result: $CP" >&5 echo "${ECHO_T}$CP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "ln", so it can be a program name with args. set dummy ln; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_LN+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $LN in [\\/]* | ?:[\\/]*) ac_cv_path_LN="$LN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_LN="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi LN=$ac_cv_path_LN if test -n "$LN"; then echo "$as_me:$LINENO: result: $LN" >&5 echo "${ECHO_T}$LN" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "mkdir", so it can be a program name with args. set dummy mkdir; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_MKDIR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $MKDIR in [\\/]* | ?:[\\/]*) ac_cv_path_MKDIR="$MKDIR" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MKDIR="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi MKDIR=$ac_cv_path_MKDIR if test -n "$MKDIR"; then echo "$as_me:$LINENO: result: $MKDIR" >&5 echo "${ECHO_T}$MKDIR" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "nroff", so it can be a program name with args. set dummy nroff; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_NROFF+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $NROFF in [\\/]* | ?:[\\/]*) ac_cv_path_NROFF="$NROFF" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_NROFF="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi NROFF=$ac_cv_path_NROFF if test -n "$NROFF"; then echo "$as_me:$LINENO: result: $NROFF" >&5 echo "${ECHO_T}$NROFF" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$NROFF = x; then # Extract the first word of "groff", so it can be a program name with args. set dummy groff; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_GROFF+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $GROFF in [\\/]* | ?:[\\/]*) ac_cv_path_GROFF="$GROFF" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GROFF="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi GROFF=$ac_cv_path_GROFF if test -n "$GROFF"; then echo "$as_me:$LINENO: result: $GROFF" >&5 echo "${ECHO_T}$GROFF" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test x$GROFF = x; then NROFF="echo" else NROFF="$GROFF -T ascii" fi fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_RM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $RM in [\\/]* | ?:[\\/]*) ac_cv_path_RM="$RM" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done ;; esac fi RM=$ac_cv_path_RM if test -n "$RM"; then echo "$as_me:$LINENO: result: $RM" >&5 echo "${ECHO_T}$RM" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi case "$uname" in Darwin* | *BSD*) ARFLAGS="-rcv" ;; *) ARFLAGS="crvs" ;; esac if test "x$use_ansi" != xyes; then for ac_func in strdup do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ 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 #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi if test "x$use_vsnprintf" != xyes; then for ac_func in vsnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ 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 #else char (*f) () = $ac_func; #endif #ifdef __cplusplus } #endif int main () { return f != $ac_func; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done fi DSO="${DSO:=:}" DSOFLAGS="${DSOFLAGS:=}" # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" fi; if test x$enable_shared = xyes; then echo "$as_me:$LINENO: checking for shared library support" >&5 echo $ECHO_N "checking for shared library support... $ECHO_C" >&6 PICFLAG=1 case "$uname" in SunOS* | UNIX_S*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 LIBMXML="libmxml.so.1.0" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-h,libmxml.so.1 -G -R\$(libdir) \$(OPTIM)" LDFLAGS="$LDFLAGS -R\$(libdir)" ;; HP-UX*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 LIBMXML="libmxml.sl.1" DSO="ld" DSOFLAGS="$DSOFLAGS -b -z +h libmxml.sl.1 +s +b \$(libdir)" LDFLAGS="$LDFLAGS -Wl,+s,+b,\$(libdir)" ;; IRIX) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 LIBMXML="libmxml.so.1.0" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-rpath,\$(libdir),-set_version,sgi1.0,-soname,libmxml.so.1 -shared \$(OPTIM)" ;; OSF1* | Linux | GNU) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 LIBMXML="libmxml.so.1.0" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-rpath,\$(libdir) -shared \$(OPTIM)" LDFLAGS="$LDFLAGS -Wl,-rpath,\$(libdir)" ;; *BSD*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 LIBMXML="libmxml.so.1.0" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS -Wl,-soname,libmxml.so.1,-R\$(libdir) -shared \$(OPTIM)" LDFLAGS="$LDFLAGS -Wl,-R\$(libdir)" ;; Darwin*) echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 LIBMXML="libmxml.1.dylib" DSO="\$(CC)" DSOFLAGS="$DSOFLAGS \$(RC_CFLAGS) -dynamiclib -lc" ;; *) echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 { echo "$as_me:$LINENO: WARNING: shared libraries not supported on this platform." >&5 echo "$as_me: WARNING: shared libraries not supported on this platform." >&2;} PICFLAG=0 LIBMXML="libmxml.a" ;; esac else PICFLAG=0 LIBMXML="libmxml.a" fi if test -n "$GCC"; then CFLAGS="-Wall $CFLAGS" if test "x$use_ansi" = xyes; then CFLAGS="-ansi -pedantic $CFLAGS" fi if test $PICFLAG = 1 -a $uname != AIX; then OPTIM="-fPIC $OPTIM" fi else case $uname in HP-UX*) CFLAGS="-Ae $CFLAGS" OPTIM="+DAportable $OPTIM" if test $PICFLAG = 1; then OPTIM="+z $OPTIM" fi ;; UNIX_SVR* | SunOS*) if test $PICFLAG = 1; then OPTIM="-KPIC $OPTIM" fi ;; esac fi if test "$prefix" = "NONE"; then prefix="/usr/local" fi if test "$exec_prefix" = "NONE"; then exec_prefix="$prefix" fi if test "$docdir" = "NONE"; then docdir="$datadir/doc/mxml" fi if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then case "$uname" in *BSD* | Darwin* | Linux*) # BSD, Darwin (MacOS X), and Linux mandir="/usr/share/man" ;; IRIX*) # SGI IRIX mandir="/usr/share/catman/u_man" ;; *) # All others mandir="/usr/man" ;; esac fi case "$uname" in *BSD* | Darwin*) # *BSD CAT1EXT="0" MAN1EXT="1" CAT3EXT="0" MAN3EXT="3" ;; *) # All others CAT1EXT="1" MAN1EXT="1" CAT3EXT="3" MAN3EXT="3" ;; esac if test "$includedir" != /usr/include; then PC_CFLAGS="-I$includedir" else PC_CFLAGS="" fi if test "$libdir" != /usr/lib; then PC_LIBS="-L$libdir -lmxml" else PC_LIBS="-lmxml" fi ac_config_files="$ac_config_files Makefile mxml.list mxml.pc" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. 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 ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # 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 before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, 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 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 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 sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. 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=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "mxml.list" ) CONFIG_FILES="$CONFIG_FILES mxml.list" ;; "mxml.pc" ) CONFIG_FILES="$CONFIG_FILES mxml.pc" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@VERSION@,$VERSION,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@OPTIM@,$OPTIM,;t t s,@docdir@,$docdir,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@RANLIB@,$RANLIB,;t t s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t s,@AR@,$AR,;t t s,@CP@,$CP,;t t s,@LN@,$LN,;t t s,@MKDIR@,$MKDIR,;t t s,@NROFF@,$NROFF,;t t s,@GROFF@,$GROFF,;t t s,@RM@,$RM,;t t s,@ARFLAGS@,$ARFLAGS,;t t s,@DSO@,$DSO,;t t s,@DSOFLAGS@,$DSOFLAGS,;t t s,@LIBMXML@,$LIBMXML,;t t s,@PICFLAG@,$PICFLAG,;t t s,@CAT1EXT@,$CAT1EXT,;t t s,@CAT3EXT@,$CAT3EXT,;t t s,@MAN1EXT@,$MAN1EXT,;t t s,@MAN3EXT@,$MAN3EXT,;t t s,@PC_CFLAGS@,$PC_CFLAGS,;t t s,@PC_LIBS@,$PC_LIBS,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false 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; } fi dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml.list.in0000664000000000000000000000667710446600454020531 0ustar rootroot# # "$Id: mxml.list.in 22267 2006-04-24 17:11:45Z kpfleming $" # # EPM software list file for Mini-XML, a small XML library. # # Copyright 2003-2005 by Michael Sweet. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2, 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. # # Directories... $prefix=@prefix@ $exec_prefix=@exec_prefix@ $bindir=@bindir@ $docdir=@docdir@ $includedir=@includedir@ $libdir=@libdir@ $mandir=@mandir@ $srcdir=@srcdir@ $PICFLAG=@PICFLAG@ # Product information %product mxml %copyright 2003-2005 by Michael Sweet %vendor Michael Sweet %license ${srcdir}/COPYING %readme ${srcdir}/README %version @VERSION@ %description <$@ # # Targets... # DOCFILES = doc/mxml.html doc/mxmldoc.xsd \ README COPYING CHANGES PUBLIBOBJS = mxml-attr.o mxml-entity.o mxml-file.o mxml-index.o \ mxml-node.o mxml-search.o mxml-set.o LIBOBJS = $(PUBLIBOBJS) mxml-private.o mxml-string.o OBJS = mxmldoc.o testmxml.o $(LIBOBJS) TARGETS = $(LIBMXML) mxmldoc doc/mxml.$(CAT3EXT) \ doc/mxmldoc.$(CAT1EXT) testmxml mxml.xml # # Make everything... # all: Makefile configure config.h $(TARGETS) # # Clean everything... # clean: $(RM) $(OBJS) $(TARGETS) $(RM) mxmldoc-static libmxml.a $(RM) *.bck *.bak $(RM) config.cache config.log config.status config.h $(RM) -r autom4te*.cache distclean: clean $(RM) mxml.list Makefile # # Install everything... # install: $(TARGETS) install-$(LIBMXML) install-libmxml.a $(INSTALL_DIR) $(BUILDROOT)$(bindir) $(INSTALL_BIN) mxmldoc $(BUILDROOT)$(bindir) $(INSTALL_DIR) $(BUILDROOT)$(docdir) for file in $(DOCFILES); do \ $(INSTALL_MAN) $$file $(BUILDROOT)$(docdir); \ done $(INSTALL_DIR) $(BUILDROOT)$(includedir) $(INSTALL_DATA) mxml.h $(BUILDROOT)$(includedir) $(INSTALL_DIR) $(BUILDROOT)$(libdir)/pkgconfig $(INSTALL_DATA) mxml.pc $(BUILDROOT)$(libdir)/pkgconfig $(INSTALL_DIR) $(BUILDROOT)$(mandir)/cat1 $(INSTALL_MAN) doc/mxmldoc.$(CAT1EXT) $(BUILDROOT)$(mandir)/cat1/mxmldoc.$(CAT1EXT) $(INSTALL_DIR) $(BUILDROOT)$(mandir)/cat3 $(INSTALL_MAN) doc/mxml.$(CAT3EXT) $(BUILDROOT)$(mandir)/cat3/mxml.$(CAT3EXT) $(INSTALL_DIR) $(BUILDROOT)$(mandir)/man1 $(INSTALL_MAN) doc/mxmldoc.man $(BUILDROOT)$(mandir)/man1/mxmldoc.$(MAN1EXT) $(INSTALL_DIR) $(BUILDROOT)$(mandir)/man3 $(INSTALL_MAN) doc/mxml.man $(BUILDROOT)$(mandir)/man3/mxml.$(MAN3EXT) install-libmxml.a: $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.a $(BUILDROOT)$(libdir) install-libmxml.so.1.0: $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.so.1.0 $(BUILDROOT)$(libdir) $(RM) $(BUILDROOT)$(libdir)/libmxml.so $(LN) libmxml.so.1.0 $(BUILDROOT)$(libdir)/libmxml.so $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1 $(LN) libmxml.so.1.0 $(BUILDROOT)$(libdir)/libmxml.so.1 install-libmxml.sl.1: $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.sl.1 $(BUILDROOT)$(libdir) $(RM) $(BUILDROOT)$(libdir)/libmxml.so $(LN) libmxml.sl.1 $(BUILDROOT)$(libdir)/libmxml.sl install-libmxml.1.dylib: $(INSTALL_DIR) $(BUILDROOT)$(libdir) $(INSTALL_LIB) libmxml.1.dylib $(BUILDROOT)$(libdir) $(RM) $(BUILDROOT)$(libdir)/libmxml.dylib $(LN) libmxml.1.dylib $(BUILDROOT)$(libdir)/libmxml.dylib # # Uninstall everything... # uninstall: uninstall-$(LIBMXML) uninstall-libmxml.a $(RM) $(BUILDROOT)$(bindir)/mxmldoc $(RM) -r $(BUILDROOT)$(docdir) $(RM) $(BUILDROOT)$(includedir)/mxml.h $(RM) $(BUILDROOT)$(libdir)/pkgconfig/mxml.pc $(RM) $(BUILDROOT)$(mandir)/cat1/mxmldoc.$(CAT1EXT) $(RM) $(BUILDROOT)$(mandir)/cat3/mxml.$(CAT3EXT) $(RM) $(BUILDROOT)$(mandir)/man1/mxmldoc.$(MAN1EXT) $(RM) $(BUILDROOT)$(mandir)/man3/mxml.$(MAN3EXT) uninstall-libmxml.a: $(RM) $(BUILDROOT)$(libdir)/libmxml.a uninstall-libmxml.so.1.0: $(RM) $(BUILDROOT)$(libdir)/libmxml.so $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1 $(RM) $(BUILDROOT)$(libdir)/libmxml.so.1.0 uninstall-libmxml.sl.1: $(RM) $(BUILDROOT)$(libdir)/libmxml.sl $(RM) $(BUILDROOT)$(libdir)/libmxml.sl.1 uninstall-libmxml.1.dylib: $(RM) $(BUILDROOT)$(libdir)/libmxml.dylib $(RM) $(BUILDROOT)$(libdir)/libmxml.1.dylib # # Make packages using EPM (http://www.easysw.com/epm/) # epm: all epm --output-dir dist -v -f native mxml epm --output-dir dist -v -f portable mxml # # autoconf stuff... # Makefile: Makefile.in if test -f config.status; then \ ./config.status --recheck; \ ./config.status; \ else \ ./configure; \ fi touch config.h config.h: configure config.h.in if test -f config.status; then \ ./config.status --recheck; \ ./config.status; \ else \ ./configure; \ fi touch config.h # # libmxml.a # libmxml.a: $(LIBOBJS) $(RM) $@ $(AR) $(ARFLAGS) $@ $(LIBOBJS) $(RANLIB) $@ $(LIBOBJS): mxml.h # # libmxml.so.1.0 # libmxml.so.1.0: $(LIBOBJS) $(DSO) $(DSOFLAGS) -o libmxml.so.1.0 $(LIBOBJS) $(RM) libmxml.so libmxml.so.1 $(LN) libmxml.so.1.0 libmxml.so $(LN) libmxml.so.1.0 libmxml.so.1 # # libmxml.sl.1 # libmxml.sl.1: $(LIBOBJS) $(DSO) $(DSOFLAGS) -o libmxml.sl.1 $(LIBOBJS) $(RM) libmxml.sl libmxml.sl.1 $(LN) libmxml.sl.1 libmxml.sl # # libmxml.1.dylib # libmxml.1.dylib: $(LIBOBJS) $(DSO) $(DSOFLAGS) -o libmxml.1.dylib \ -install_name $(libdir)/libmxml.dylib \ -current_version 1.0.0 \ -compatibility_version 1.0.0 \ $(LIBOBJS) $(RM) libmxml.dylib libmxml.1.dylib $(LN) libmxml.1.dylib libmxml.dylib # # mxmldoc # mxmldoc: $(LIBMXML) mxmldoc.o $(CC) $(LDFLAGS) -o $@ mxmldoc.o -L. -lmxml mxmldoc-static: libmxml.a mxmldoc.o $(CC) $(LDFLAGS) -o $@ mxmldoc.o libmxml.a mxmldoc.o: mxml.h # # testmxml # testmxml: libmxml.a testmxml.o $(CC) $(LDFLAGS) -o $@ testmxml.o libmxml.a @echo Testing library... ./testmxml test.xml >temp1.xml 2>temp1s.xml ./testmxml temp1.xml >temp2.xml 2>temp2s.xml @if cmp temp1.xml temp2.xml; then \ echo Stdio file test passed!; \ $(RM) temp2.xml temp2s.xml; \ else \ echo Stdio file test failed!; \ fi @if cmp temp1.xml temp1s.xml; then \ echo String test passed!; \ $(RM) temp1.xml temp1s.xml; \ else \ echo String test failed!; \ fi @if cmp test.xml test.xmlfd; then \ echo File descriptor test passed!; \ $(RM) test.xmlfd; \ else \ echo File descriptor test failed!; \ fi testmxml.o: mxml.h # # mxml.xml # mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c) $(RM) mxml.xml ./mxmldoc-static mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html valgrind: mxmldoc-static $(RM) valgrind.xml valgrind --tool=memcheck --leak-check=yes ./mxmldoc-static \ valgrind.xml mxml.h $(PUBLIBOBJS:.o=.c) \ >valgrind.html 2>valgrind.out # # All object files depend on the makefile... # $(OBJS): Makefile config.h # # End of "$Id: Makefile.in 23382 2006-04-29 15:44:02Z russell $". # dahdi-tools-2.2.0-rc2/menuselect/mxml/COPYING0000664000000000000000000006130310446600454017270 0ustar rootroot GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! dahdi-tools-2.2.0-rc2/menuselect/mxml/mxml-private.c0000664000000000000000000000463210446600454021030 0ustar rootroot/* * "$Id: mxml-private.c 22267 2006-04-24 17:11:45Z kpfleming $" * * Private functions for Mini-XML, a small XML-like file parsing library. * * Copyright 2003-2005 by Michael Sweet. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2, 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. * * Contents: * * mxml_error() - Display an error message. * mxml_integer_cb() - Default callback for integer values. * mxml_opaque_cb() - Default callback for opaque values. * mxml_real_cb() - Default callback for real number values. */ /* * Include necessary headers... */ #include "config.h" #include "mxml.h" /* * Error callback function... */ void (*mxml_error_cb)(const char *) = NULL; /* * 'mxml_error()' - Display an error message. */ void mxml_error(const char *format, /* I - Printf-style format string */ ...) /* I - Additional arguments as needed */ { va_list ap; /* Pointer to arguments */ char *s; /* Message string */ /* * Range check input... */ if (!format) return; /* * Format the error message string... */ va_start(ap, format); s = mxml_strdupf(format, ap); va_end(ap); /* * And then display the error message... */ if (mxml_error_cb) (*mxml_error_cb)(s); else fprintf(stderr, "mxml: %s\n", s); /* * Free the string... */ free(s); } /* * 'mxml_integer_cb()' - Default callback for integer values. */ mxml_type_t /* O - Node type */ mxml_integer_cb(mxml_node_t *node) /* I - Current node */ { (void)node; return (MXML_INTEGER); } /* * 'mxml_opaque_cb()' - Default callback for opaque values. */ mxml_type_t /* O - Node type */ mxml_opaque_cb(mxml_node_t *node) /* I - Current node */ { (void)node; return (MXML_OPAQUE); } /* * 'mxml_real_cb()' - Default callback for real number values. */ mxml_type_t /* O - Node type */ mxml_real_cb(mxml_node_t *node) /* I - Current node */ { (void)node; return (MXML_REAL); } /* * End of "$Id: mxml-private.c 22267 2006-04-24 17:11:45Z kpfleming $". */ dahdi-tools-2.2.0-rc2/menuselect/example_menuselect-tree0000664000000000000000000007463310471675331022035 0ustar rootroot zaptel no zaptel libosptk ssl zaptel zaptel no no zaptel zaptel zaptel unixodbc pgsql radiusclient sqlite freetds asound h323 iksemel nbs ossaudio ixjuser vpbapi zaptel no libgsm libspeex zaptel libvorbis ogg curl unixodbc zlib gtk no unixodbc pgsql ssl iksemel win32 unixodbc libosptk ssl netsnmp no yes yes unixodbc no unixodbc no dahdi-tools-2.2.0-rc2/menuselect/strcompat.c0000664000000000000000000002040510632055770017440 0ustar rootroot/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 1999 - 2006, Digium, Inc. * * 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 Compatibility functions for strsep and strtoq missing on Solaris */ #include "autoconfig.h" #include #include #include #include #include #include #ifdef HAVE_ALLOCA_H #include #endif #ifndef HAVE_STRSEP char *strsep(char **str, const char *delims) { char *token; if (!*str) { /* No more tokens */ return NULL; } token = *str; while (**str != '\0') { if (strchr(delims, **str)) { **str = '\0'; (*str)++; return token; } (*str)++; } /* There is no other token */ *str = NULL; return token; } #endif #ifndef HAVE_SETENV int setenv(const char *name, const char *value, int overwrite) { unsigned char *buf; int buflen; buflen = strlen(name) + strlen(value) + 2; buf = alloca(buflen); if (!overwrite && getenv(name)) return 0; snprintf(buf, buflen, "%s=%s", name, value); return putenv(buf); } #endif #ifndef HAVE_UNSETENV int unsetenv(const char *name) { return setenv(name, "", 0); } #endif #ifndef HAVE_STRCASESTR static char *upper(const char *orig, char *buf, int bufsize) { int i = 0; while (i < (bufsize - 1) && orig[i]) { buf[i] = toupper(orig[i]); i++; } buf[i] = '\0'; return buf; } char *strcasestr(const char *haystack, const char *needle) { char *u1, *u2; int u1len = strlen(haystack) + 1, u2len = strlen(needle) + 1; u1 = alloca(u1len); u2 = alloca(u2len); if (u1 && u2) { char *offset; if (u2len > u1len) { /* Needle bigger than haystack */ return NULL; } offset = strstr(upper(haystack, u1, u1len), upper(needle, u2, u2len)); if (offset) { /* Return the offset into the original string */ return ((char *)((unsigned long)haystack + (unsigned long)(offset - u1))); } else { return NULL; } } else { return NULL; } } #endif /* !HAVE_STRCASESTR */ #ifndef HAVE_STRNLEN size_t strnlen(const char *s, size_t n) { size_t len; for (len = 0; len < n; len++) if (s[len] == '\0') break; return len; } #endif /* !HAVE_STRNLEN */ #if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC) char *strndup(const char *s, size_t n) { size_t len = strnlen(s, n); char *new = malloc(len + 1); if (!new) return NULL; new[len] = '\0'; return memcpy(new, s, len); } #endif /* !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC) */ #if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) int vasprintf(char **strp, const char *fmt, va_list ap) { int size; va_list ap2; char s; *strp = NULL; va_copy(ap2, ap); size = vsnprintf(&s, 1, fmt, ap2); va_end(ap2); *strp = malloc(size + 1); if (!*strp) return -1; vsnprintf(*strp, size + 1, fmt, ap); return size; } #endif /* !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC) */ /* * Based on Code from bsd-asprintf from OpenSSH * Copyright (c) 2004 Darren Tucker. * * Based originally on asprintf.c from OpenBSD: * Copyright (c) 1997 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC) int asprintf(char **str, const char *fmt, ...) { va_list ap; int ret; *str = NULL; va_start(ap, fmt); ret = vasprintf(str, fmt, ap); va_end(ap); return ret; } #endif /* !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC) */ #ifndef HAVE_STRTOQ #ifndef LONG_MIN #define LONG_MIN (-9223372036854775807L-1L) /* min value of a "long int" */ #endif #ifndef LONG_MAX #define LONG_MAX 9223372036854775807L /* max value of a "long int" */ #endif /*! \brief * Convert a string to a quad integer. * * \note Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ uint64_t strtoq(const char *nptr, char **endptr, int base) { const char *s; uint64_t acc; unsigned char c; uint64_t qbase, cutoff; int neg, any, cutlim; /* * Skip white space and pick up leading +/- sign if any. * If base is 0, allow 0x for hex and 0 for octal, else * assume decimal; if base is already 16, allow 0x. */ s = nptr; do { c = *s++; } while (isspace(c)); if (c == '-') { neg = 1; c = *s++; } else { neg = 0; if (c == '+') c = *s++; } if ((base == 0 || base == 16) && c == '\0' && (*s == 'x' || *s == 'X')) { c = s[1]; s += 2; base = 16; } if (base == 0) base = c == '\0' ? 8 : 10; /* * Compute the cutoff value between legal numbers and illegal * numbers. That is the largest legal value, divided by the * base. An input number that is greater than this value, if * followed by a legal input character, is too big. One that * is equal to this value may be valid or not; the limit * between valid and invalid numbers is then based on the last * digit. For instance, if the range for quads is * [-9223372036854775808..9223372036854775807] and the input base * is 10, cutoff will be set to 922337203685477580 and cutlim to * either 7 (neg==0) or 8 (neg==1), meaning that if we have * accumulated a value > 922337203685477580, or equal but the * next digit is > 7 (or 8), the number is too big, and we will * return a range error. * * Set any if any `digits' consumed; make it negative to indicate * overflow. */ qbase = (unsigned)base; cutoff = neg ? (uint64_t)-(LONG_MIN + LONG_MAX) + LONG_MAX : LONG_MAX; cutlim = cutoff % qbase; cutoff /= qbase; for (acc = 0, any = 0;; c = *s++) { if (!isascii(c)) break; if (isdigit(c)) c -= '\0'; else if (isalpha(c)) c -= isupper(c) ? 'A' - 10 : 'a' - 10; else break; if (c >= base) break; if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim)) any = -1; else { any = 1; acc *= qbase; acc += c; } } if (any < 0) { acc = neg ? LONG_MIN : LONG_MAX; } else if (neg) acc = -acc; if (endptr != 0) *((const char **)endptr) = any ? s - 1 : nptr; return acc; } #endif /* !HAVE_STRTOQ */ #ifndef HAVE_GETLOADAVG #ifdef linux /*! \brief Alternative method of getting load avg on Linux only */ int getloadavg(double *list, int nelem) { FILE *LOADAVG; double avg[3] = { 0.0, 0.0, 0.0 }; int i, res = -1; if ((LOADAVG = fopen("/proc/loadavg", "r"))) { fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]); res = 0; fclose(LOADAVG); } for (i = 0; (i < nelem) && (i < 3); i++) { list[i] = avg[i]; } return res; } #else /* !linux */ /*! \brief Return something that won't cancel the call, but still return -1, in case * we correct the implementation to check return value */ int getloadavg(double *list, int nelem) { int i; for (i = 0; i < nelem; i++) { list[i] = 0.1; } return -1; } #endif /* linux */ #endif /* !HAVE_GETLOADAVG */ dahdi-tools-2.2.0-rc2/menuselect/makeopts.in0000664000000000000000000000100411074126326017422 0ustar rootroot# NOTE: Names of _INCLUDE and _LIB entries in this file must be # the exact uppercase equivalents of the names used for # dependencies in menuselect for the same package. CC=@CC@ OSARCH=@HOST_OS@ MENUSELECT_DEBUG=@MENUSELECT_DEBUG@ # The frontend can use curses, ncurses, newt or gtk2 CURSES_INCLUDE=@CURSES_INCLUDE@ CURSES_LIB=@CURSES_LIB@ GTK2_INCLUDE=@GTK2_INCLUDE@ GTK2_LIB=@GTK2_LIB@ NCURSES_INCLUDE=@NCURSES_INCLUDE@ NCURSES_LIB=@NCURSES_LIB@ NEWT_INCLUDE=@NEWT_INCLUDE@ NEWT_LIB=@NEWT_LIB@ dahdi-tools-2.2.0-rc2/menuselect/menuselect_curses.c0000664000000000000000000004325311145073536021162 0ustar rootroot/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 2005 - 2006, Russell Bryant * * Russell Bryant * * 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 * * \author Russell Bryant * * \brief curses frontend for selection maintenance */ #include #include #include #include #include #include #include #include #include "menuselect.h" #define MENU_HELP "Press 'h' for help." #define TITLE_HEIGHT 7 #define MIN_X 80 #define MIN_Y 24 #define PAGE_OFFSET 10 #define SCROLL_NONE 0 #define SCROLL_DOWN 1 #define SCROLL_DOWN_INDICATOR "... More ..." #define MIN(x,y) ((x)<(y)?(x):(y)) #define MAX(x,y) ((x)<(y)?(y):(x)) extern int changes_made; /*! Maximum number of characters horizontally */ static int max_x = 0; /*! Maximum number of characters vertically */ static int max_y = 0; static const char * const help_info[] = { "scroll => up/down arrows", "toggle selection => Enter", "select => y", "deselect => n", "select all => F8", "deselect all => F7", "back => left arrow", "quit => q", "save and quit => x", "", "XXX means dependencies have not been met", " or a conflict exists", "", "< > means a dependency has been deselected", " and will be automatically re-selected", " if this item is selected", "", "( ) means a conflicting item has been", " selected", }; /*! \brief Handle a window resize in xterm */ static void winch_handler(int sig) { getmaxyx(stdscr, max_y, max_x); if (max_x < MIN_X || max_y < MIN_Y) { fprintf(stderr, "Terminal must be at least %d x %d.\n", MIN_X, MIN_Y); max_x = MIN_X - 1; max_y = MIN_Y - 1; } } /*! \brief Handle a SIGQUIT */ static void sigint_handler(int sig) { } /*! \brief Display help information */ static void show_help(WINDOW *win) { int i; wclear(win); for (i = 0; i < (sizeof(help_info) / sizeof(help_info[0])); i++) { wmove(win, i, max_x / 2 - 15); waddstr(win, help_info[i]); } wrefresh(win); getch(); /* display the help until the user hits a key */ } static int really_quit(WINDOW *win) { int c; wclear(win); wmove(win, 2, max_x / 2 - 15); waddstr(win, "ARE YOU SURE?"); wmove(win, 3, max_x / 2 - 12); waddstr(win, "--- It appears you have made some changes, and"); wmove(win, 4, max_x / 2 - 12); waddstr(win, "you have opted to Quit without saving these changes!"); wmove(win, 6, max_x / 2 - 12); waddstr(win, " Please Enter Y to exit without saving;"); wmove(win, 7, max_x / 2 - 12); waddstr(win, " Enter N to cancel your decision to quit,"); wmove(win, 8, max_x / 2 - 12); waddstr(win, " and keep working in menuselect, or"); wmove(win, 9, max_x / 2 - 12); waddstr(win, " Enter S to save your changes, and exit"); wmove(win, 10, max_x / 2 - 12); wrefresh(win); while ((c=getch())) { if (c == 'Y' || c == 'y') { c = 'q'; break; } if (c == 'S' || c == 's') { c = 'S'; break; } if (c == 'N' || c == 'n') { c = '%'; break; } } return c; } static void draw_main_menu(WINDOW *menu, int curopt) { struct category *cat; char buf[64]; int i = 0; wclear(menu); AST_LIST_TRAVERSE(&categories, cat, list) { wmove(menu, i++, max_x / 2 - 10); snprintf(buf, sizeof(buf), " %s", strlen_zero(cat->displayname) ? cat->name : cat->displayname); waddstr(menu, buf); } wmove(menu, curopt, (max_x / 2) - 15); waddstr(menu, "--->"); wmove(menu, 0, 0); wrefresh(menu); } static void display_mem_info(WINDOW *menu, struct member *mem, int start, int end) { char buf[64]; struct depend *dep; struct conflict *con; struct use *use; wmove(menu, end - start + 2, max_x / 2 - 16); wclrtoeol(menu); wmove(menu, end - start + 3, max_x / 2 - 16); wclrtoeol(menu); wmove(menu, end - start + 4, max_x / 2 - 16); wclrtoeol(menu); wmove(menu, end - start + 5, max_x / 2 - 16); wclrtoeol(menu); if (mem->displayname) { wmove(menu, end - start + 2, max_x / 2 - 16); waddstr(menu, mem->displayname); } if (!AST_LIST_EMPTY(&mem->deps)) { wmove(menu, end - start + 3, max_x / 2 - 16); strcpy(buf, "Depends on: "); AST_LIST_TRAVERSE(&mem->deps, dep, list) { strncat(buf, dep->displayname, sizeof(buf) - strlen(buf) - 1); strncat(buf, dep->member ? "(M)" : "(E)", sizeof(buf) - strlen(buf) - 1); if (AST_LIST_NEXT(dep, list)) strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1); } waddstr(menu, buf); } if (!AST_LIST_EMPTY(&mem->uses)) { wmove(menu, end - start + 4, max_x / 2 - 16); strcpy(buf, "Can use: "); AST_LIST_TRAVERSE(&mem->uses, use, list) { strncat(buf, use->displayname, sizeof(buf) - strlen(buf) - 1); strncat(buf, use->member ? "(M)" : "(E)", sizeof(buf) - strlen(buf) - 1); if (AST_LIST_NEXT(use, list)) strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1); } waddstr(menu, buf); } if (!AST_LIST_EMPTY(&mem->conflicts)) { wmove(menu, end - start + 5, max_x / 2 - 16); strcpy(buf, "Conflicts with: "); AST_LIST_TRAVERSE(&mem->conflicts, con, list) { strncat(buf, con->displayname, sizeof(buf) - strlen(buf) - 1); strncat(buf, con->member ? "(M)" : "(E)", sizeof(buf) - strlen(buf) - 1); if (AST_LIST_NEXT(con, list)) strncat(buf, ", ", sizeof(buf) - strlen(buf) - 1); } waddstr(menu, buf); } } static void draw_category_menu(WINDOW *menu, struct category *cat, int start, int end, int curopt, int changed, int flags) { int i = 0; int j = 0; struct member *mem; char buf[64]; if (!changed) { /* If all we have to do is move the cursor, * then don't clear the screen and start over */ AST_LIST_TRAVERSE(&cat->members, mem, list) { i++; if (curopt + 1 == i) { display_mem_info(menu, mem, start, end); break; } } wmove(menu, curopt - start, max_x / 2 - 9); wrefresh(menu); return; } wclear(menu); i = 0; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (i < start) { i++; continue; } wmove(menu, j++, max_x / 2 - 10); i++; if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) { snprintf(buf, sizeof(buf), "XXX %s", mem->name); } else if (mem->depsfailed == SOFT_FAILURE) { snprintf(buf, sizeof(buf), "<%s> %s", mem->enabled ? "*" : " ", mem->name); } else if (mem->conflictsfailed == SOFT_FAILURE) { snprintf(buf, sizeof(buf), "(%s) %s", mem->enabled ? "*" : " ", mem->name); } else { snprintf(buf, sizeof(buf), "[%s] %s", mem->enabled ? "*" : " ", mem->name); } waddstr(menu, buf); if (curopt + 1 == i) display_mem_info(menu, mem, start, end); if (i == end - (flags & SCROLL_DOWN ? 1 : 0)) break; } if (flags & SCROLL_DOWN) { wmove(menu, j, max_x / 2 - sizeof(SCROLL_DOWN_INDICATOR) / 2); waddstr(menu, SCROLL_DOWN_INDICATOR); } wmove(menu, curopt - start, max_x / 2 - 9); wrefresh(menu); } static void play_space(void); static int move_up(int *current, int itemcount, int delta, int *start, int *end, int scroll) { if (*current > 0) { *current = MAX(*current - delta, 0); if (*current < *start) { int diff = *start - MAX(*start - delta, 0); *start -= diff; *end -= diff; return 1; } } return 0; } static int move_down(int *current, int itemcount, int delta, int *start, int *end, int scroll) { if (*current < itemcount) { *current = MIN(*current + delta, itemcount); if (*current > *end - 1 - (scroll & SCROLL_DOWN ? 1 : 0)) { int diff = MIN(*end + delta - 1, itemcount) - *end + 1; *start += diff; *end += diff; return 1; } } return 0; } static int run_category_menu(WINDOW *menu, int cat_num) { struct category *cat; int i = 0; int start = 0; int end = max_y - TITLE_HEIGHT - 6; int c; int curopt = 0; int maxopt; int changed = 1; int scroll = SCROLL_NONE; AST_LIST_TRAVERSE(&categories, cat, list) { if (i++ == cat_num) break; } if (!cat) return -1; maxopt = count_members(cat) - 1; if (maxopt > end) { scroll = SCROLL_DOWN; } draw_category_menu(menu, cat, start, end, curopt, changed, scroll); while ((c = getch())) { changed = 0; switch (c) { case KEY_UP: changed = move_up(&curopt, maxopt, 1, &start, &end, scroll); break; case KEY_DOWN: changed = move_down(&curopt, maxopt, 1, &start, &end, scroll); break; case KEY_PPAGE: changed = move_up( &curopt, maxopt, MIN(PAGE_OFFSET, max_y - TITLE_HEIGHT - 6 - (scroll & SCROLL_DOWN ? 1 : 0)), &start, &end, scroll); break; case KEY_NPAGE: changed = move_down( &curopt, maxopt, MIN(PAGE_OFFSET, max_y - TITLE_HEIGHT - 6 - (scroll & SCROLL_DOWN ? 1 : 0)), &start, &end, scroll); break; case KEY_HOME: changed = move_up(&curopt, maxopt, curopt, &start, &end, scroll); break; case KEY_END: changed = move_down(&curopt, maxopt, maxopt - curopt, &start, &end, scroll); break; case KEY_LEFT: case 27: /* Esc key */ return 0; case KEY_RIGHT: case KEY_ENTER: case '\n': case ' ': toggle_enabled_index(cat, curopt); changed = 1; break; case 'y': case 'Y': set_enabled(cat, curopt); changed = 1; break; case 'n': case 'N': clear_enabled(cat, curopt); changed = 1; break; case 'h': case 'H': show_help(menu); changed = 1; break; case KEY_F(7): set_all(cat, 0); changed = 1; break; case KEY_F(8): set_all(cat, 1); changed = 1; default: break; } if (c == 'x' || c == 'X' || c == 'Q' || c == 'q') break; if (end <= maxopt) { scroll |= SCROLL_DOWN; } else { scroll &= ~SCROLL_DOWN; } draw_category_menu(menu, cat, start, end, curopt, changed, scroll); } wrefresh(menu); return c; } static void draw_title_window(WINDOW *title) { char titlebar[strlen(menu_name) + 9]; memset(titlebar, '*', sizeof(titlebar) - 1); titlebar[sizeof(titlebar) - 1] = '\0'; wclear(title); wmove(title, 1, (max_x / 2) - (strlen(titlebar) / 2)); waddstr(title, titlebar); wmove(title, 2, (max_x / 2) - (strlen(menu_name) / 2)); waddstr(title, menu_name); wmove(title, 3, (max_x / 2) - (strlen(titlebar) / 2)); waddstr(title, titlebar); wmove(title, 5, (max_x / 2) - (strlen(MENU_HELP) / 2)); waddstr(title, MENU_HELP); wrefresh(title); } int run_menu(void) { WINDOW *title; WINDOW *menu; int maxopt; int curopt = 0; int c; int res = 0; setenv("ESCDELAY", "0", 1); /* So that ESC is processed immediately */ initscr(); getmaxyx(stdscr, max_y, max_x); signal(SIGWINCH, winch_handler); /* handle window resizing in xterm */ signal(SIGINT, sigint_handler); /* handle window resizing in xterm */ if (max_x < MIN_X || max_y < MIN_Y) { fprintf(stderr, "Terminal must be at least %d x %d.\n", MIN_X, MIN_Y); endwin(); return -1; } cbreak(); /* don't buffer input until the enter key is pressed */ noecho(); /* don't echo user input to the screen */ keypad(stdscr, TRUE); /* allow the use of arrow keys */ clear(); refresh(); maxopt = count_categories() - 1; /* We have two windows - the title window at the top, and the menu window gets the rest */ title = newwin(TITLE_HEIGHT, max_x, 0, 0); menu = newwin(max_y - TITLE_HEIGHT, max_x, TITLE_HEIGHT, 0); draw_title_window(title); draw_main_menu(menu, curopt); while ((c = getch())) { switch (c) { case KEY_UP: if (curopt > 0) curopt--; break; case KEY_DOWN: if (curopt < maxopt) curopt++; break; case KEY_HOME: curopt = 0; break; case KEY_END: curopt = maxopt; break; case KEY_RIGHT: case KEY_ENTER: case '\n': case ' ': c = run_category_menu(menu, curopt); break; case 'h': case 'H': show_help(menu); break; case 'i': case 'I': play_space(); draw_title_window(title); default: break; } if (c == 'q' || c == 'Q' || c == 27 || c == 3) { if (changes_made) { c = really_quit(menu); if (c == 'q') { res = -1; break; } } else { res = -1; break; } } if (c == 'x' || c == 'X' || c == 's' || c == 'S') break; draw_main_menu(menu, curopt); } endwin(); return res; } enum blip_type { BLIP_TANK = 0, BLIP_SHOT, BLIP_BOMB, BLIP_ALIEN }; struct blip { enum blip_type type; int x; int y; int ox; int oy; int goingleft; AST_LIST_ENTRY(blip) entry; }; static AST_LIST_HEAD_NOLOCK(, blip) blips; static int score = 0; static int num_aliens = 0; struct blip *tank = NULL; /*! Probability of a bomb, out of 100 */ #define BOMB_PROB 1 static int init_blips(void) { int i, j; struct blip *cur; srandom(time(NULL) + getpid()); /* make tank */ cur = calloc(1, sizeof(struct blip)); if (!cur) return -1; cur->type = BLIP_TANK; cur->x = max_x / 2; cur->y = max_y - 1; AST_LIST_INSERT_HEAD(&blips, cur, entry); tank = cur; /* 3 rows of 10 aliens */ num_aliens = 0; for (i = 0; i < 3; i++) { for (j = 0; j < 10; j++) { cur = calloc(1, sizeof(struct blip)); if (!cur) return -1; cur->type = BLIP_ALIEN; cur->x = (j * 2) + 1; cur->y = (i * 2) + 1; AST_LIST_INSERT_HEAD(&blips, cur, entry); num_aliens++; } } return 0; } static inline chtype type2chtype(enum blip_type type) { switch (type) { case BLIP_TANK: return 'A'; case BLIP_ALIEN: return 'X'; case BLIP_SHOT: return '|'; case BLIP_BOMB: return 'o'; default: break; } return '?'; } static int repaint_screen(void) { struct blip *cur; wmove(stdscr, 0, 0); wprintw(stdscr, "Score: %d", score); AST_LIST_TRAVERSE(&blips, cur, entry) { if (cur->x != cur->ox || cur->y != cur->oy) { wmove(stdscr, cur->oy, cur->ox); waddch(stdscr, ' '); wmove(stdscr, cur->y, cur->x); waddch(stdscr, type2chtype(cur->type)); cur->ox = cur->x; cur->oy = cur->y; } } wmove(stdscr, 0, max_x - 1); wrefresh(stdscr); return 0; } static int tank_move_left(void) { if (tank->x > 0) tank->x--; return 0; } static int tank_move_right(void) { if (tank->x < (max_x - 1)) tank->x++; return 0; } static int count_shots(void) { struct blip *cur; int count = 0; AST_LIST_TRAVERSE(&blips, cur, entry) { if (cur->type == BLIP_SHOT) count++; } return count; } static int tank_shoot(void) { struct blip *shot; if (count_shots() == 3) return 0; score--; shot = calloc(1, sizeof(struct blip)); if (!shot) return -1; shot->type = BLIP_SHOT; shot->x = tank->x; shot->y = max_y - 2; AST_LIST_INSERT_HEAD(&blips, shot, entry); return 0; } static int move_aliens(void) { struct blip *cur; AST_LIST_TRAVERSE(&blips, cur, entry) { if (cur->type != BLIP_ALIEN) { /* do nothing if it's not an alien */ continue; } if (cur->goingleft && (cur->x == 0)) { cur->y++; cur->goingleft = 0; } else if (!cur->goingleft && cur->x == (max_x - 1)) { cur->y++; cur->goingleft = 1; } else if (cur->goingleft) { cur->x--; } else { cur->x++; } /* Alien into the tank == game over */ if (cur->x == tank->x && cur->y == tank->y) return 1; if (random() % 100 < BOMB_PROB && cur->y != max_y) { struct blip *bomb = calloc(1, sizeof(struct blip)); if (!bomb) continue; bomb->type = BLIP_BOMB; bomb->x = cur->x; bomb->y = cur->y + 1; AST_LIST_INSERT_HEAD(&blips, bomb, entry); } } return 0; } static int move_bombs(void) { struct blip *cur; AST_LIST_TRAVERSE(&blips, cur, entry) { if (cur->type != BLIP_BOMB) continue; cur->y++; if (cur->x == tank->x && cur->y == tank->y) return 1; } return 0; } static void move_shots(void) { struct blip *cur; AST_LIST_TRAVERSE(&blips, cur, entry) { if (cur->type != BLIP_SHOT) continue; cur->y--; } } static int remove_blip(struct blip *blip) { if (!blip) return -1; AST_LIST_REMOVE(&blips, blip, entry); if (blip->type == BLIP_ALIEN) num_aliens--; wmove(stdscr, blip->oy, blip->ox); waddch(stdscr, ' '); free(blip); return 0; } static void game_over(int win) { clear(); wmove(stdscr, max_y / 2, max_x / 2 - 10); wprintw(stdscr, "Game over! You %s!", win ? "win" : "lose"); wmove(stdscr, 0, max_x - 1); wrefresh(stdscr); sleep(1); while (getch() != ' '); return; } static int check_shot(struct blip *shot) { struct blip *cur; AST_LIST_TRAVERSE(&blips, cur, entry) { if (cur->type != BLIP_ALIEN) continue; if (cur->x == shot->x && cur->y == shot->y) { score += 20; remove_blip(shot); remove_blip(cur); if (!num_aliens) { game_over(1); return 1; } } } return 0; } static int check_placement(void) { struct blip *cur; AST_LIST_TRAVERSE_SAFE_BEGIN(&blips, cur, entry) { if (cur->y <= 0 || cur->y >= max_y) { AST_LIST_REMOVE_CURRENT(&blips, entry); remove_blip(cur); } else if (cur->type == BLIP_SHOT && check_shot(cur)) return 1; } AST_LIST_TRAVERSE_SAFE_END return 0; } static void play_space(void) { int c; unsigned int jiffies = 1; int quit = 0; struct blip *blip; clear(); nodelay(stdscr, TRUE); init_blips(); repaint_screen(); for (;;) { c = getch(); switch (c) { case ' ': tank_shoot(); break; case KEY_LEFT: tank_move_left(); break; case KEY_RIGHT: tank_move_right(); break; case 'x': case 'X': case 'q': case 'Q': quit = 1; default: /* ignore unknown input */ break; } if (quit) break; if (!(jiffies % 25)) { if (move_aliens() || move_bombs()) { game_over(0); break; } if (check_placement()) break; } if (!(jiffies % 10)) { move_shots(); if (check_placement()) break; } repaint_screen(); jiffies++; usleep(1000); } while ((blip = AST_LIST_REMOVE_HEAD(&blips, entry))) free(blip); nodelay(stdscr, FALSE); } dahdi-tools-2.2.0-rc2/menuselect/test/0000775000000000000000000000000011176143303016230 5ustar rootrootdahdi-tools-2.2.0-rc2/menuselect/test/build_tools/0000775000000000000000000000000011176143303020547 5ustar rootrootdahdi-tools-2.2.0-rc2/menuselect/test/build_tools/menuselect-deps0000664000000000000000000000070011071665727023601 0ustar rootrootASOUND=1 CRYPTO=1 CURL=1 DAHDI=1 FREETDS=1 GMIME=1 GNU_LD=1 GSM=1 GTK2=1 GTK=0 H323=0 HOARD=0 ICONV=1 IKSEMEL=1 IMAP_TK=1 ISDNNET=0 IXJUSER=1 JACK=1 LDAP=1 LTDL=1 LUA=0 MISDN=0 NBS=0 NETSNMP=0 NEWT=1 OGG=1 OPENH323=0 OSPTK=1 OSSAUDIO=1 PGSQL=1 POPT=1 PORTAUDIO=1 PRI=0 RESAMPLE=0 AIS=0 RADIUS=1 SPANDSP=0 SPEEX=1 SPEEXDSP=1 SPEEX_PREPROCESS=1 SQLITE3=1 SQLITE=1 SS7=0 SSL=1 SUPPSERV=0 TONEZONE=1 UNIXODBC=1 USB=1 VORBIS=1 VPBAPI=0 WINARCH=0 ZLIB=1 dahdi-tools-2.2.0-rc2/menuselect/test/menuselect-tree0000664000000000000000000012261111073420655021263 0ustar rootroot res_adsi DAHDI DAHDI DAHDI chan_local app_voicemail spandsp DAHDI chan_local no jack libresample dahdi res_indications osptk ssl DAHDI app_meetme res_monitor DAHDI tonezone no no res_smdi unixodbc unixODBC libtool-ltdl PostgreSQL radius sqlite3 sqlite FreeTDS chan_local asound portaudio res_smdi DAHDI tonezone pri ss7 no iksemel res_jabber openssl openh323 yes crypto iksemel res_jabber openssl isdnnet misdn suppserv nbs ossaudio ixjuser chan_local ossaudio usb no vpbapi DAHDI gsm no resample speex speex_preprocess speexdsp vorbis ogg curl iconv unixodbc ltdl res_odbc speex speex_preprocess speexdsp res_ael_share zlib crypto gtk no lua ais curl ldap unixodbc ltdl res_odbc pgsql sqlite ssl curl gmime iksemel openssl win32 dahdi unixodbc ltdl netsnmp DAHDI no no yes no hoard no yes G711_NEW_ALGORITHM G711_NEW_ALGORITHM G711_NEW_ALGORITHM BUSYDETECT_COMPARE_TONE_AND_SILENCE no BUSYDETECT_TONEONLY no no unixodbc ltdl IMAP_STORAGE no imap_tk ODBC_STORAGE ssl no no chan_usbradio no chan_usbradio DEBUG_THREADS gnu_ld gnu_ld gnu_ld gnu_ld gnu_ld gnu_ld gnu_ld gnu_ld yes yes dahdi-tools-2.2.0-rc2/menuselect/install-sh0000775000000000000000000002202110472743350017260 0ustar rootroot#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-05-14.22 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $cpprog "$src" "$dsttmp" && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); exit 0 } # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: dahdi-tools-2.2.0-rc2/menuselect/menuselect_gtk.c0000664000000000000000000002332211073420655020434 0ustar rootroot#include #include #include #include #include "menuselect.h" enum { /*! The row name */ COLUMN_NAME, /*! Whether this row is enabled */ COLUMN_SELECTED, /*! Dependencies */ COLUMN_DEPS, /*! Optional dependencies */ COLUMN_USES, /*! Conflicts */ COLUMN_CNFS, /*! Number of columns, must be the last element in the enum */ NUM_COLUMNS, }; static void handle_save(GtkWidget *w, gpointer data); static void handle_about(GtkWidget *w, gpointer data); static void handle_quit(GtkWidget *w, gpointer data); static GtkItemFactoryEntry menu_items[] = { { "/_File", NULL, NULL, 0, "" }, { "/File/_Save And Quit", "S", handle_save, 0, "", GTK_STOCK_SAVE }, { "/File/sep1", NULL, NULL, 0, "" }, { "/File/_Quit", "Q", handle_quit, 0, "", GTK_STOCK_QUIT }, { "/_Help", NULL, NULL, 0, "" }, { "/_Help/About", NULL, handle_about, 0, "" }, }; static gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); static GtkTreeView *tree; static GtkWidget *window; /* 0, save ... non-zero, don't save */ static int main_res = 1; static int change_made = 0; static void handle_save(GtkWidget *w, gpointer data) { main_res = 0; gtk_main_quit(); } static void handle_about(GtkWidget *w, gpointer data) { GtkWidget *dialog; dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "GMenuselect - http://www.asterisk.org/\n" "Russell Bryant \n" "Copyright (C) 2007\n"); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); } static gboolean delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) { return FALSE; } static void handle_quit(GtkWidget *widget, gpointer data) { gtk_main_quit(); } static void destroy(GtkWidget *widget, gpointer data) { GtkWidget *dialog; gint response; if (!main_res || !change_made) { gtk_main_quit(); return; } dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Save before quit?"); response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); if (response == GTK_RESPONSE_YES) main_res = 0; gtk_main_quit(); } static void toggled_handler(GtkCellRendererToggle *renderer, gchar *path, gpointer data) { gchar *cat_num_str, *mem_num_str; int cat_num, mem_num; int i = 0; struct category *cat; struct member *mem; GtkTreeStore *store = data; GtkTreeModel *model; GtkTreeIter cat_iter, mem_iter; mem_num_str = alloca(strlen(path)) + 1; strcpy(mem_num_str, path); cat_num_str = strsep(&mem_num_str, ":"); if (!mem_num_str || !*mem_num_str) return; cat_num = atoi(cat_num_str); mem_num = atoi(mem_num_str); AST_LIST_TRAVERSE(&categories, cat, list) { if (i == cat_num) break; i++; } if (!cat) return; i = 0; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (i == mem_num) break; i++; } if (!mem) return; toggle_enabled(mem); model = gtk_tree_view_get_model(tree); gtk_tree_model_get_iter_first(model, &cat_iter); for (i = 0; i < cat_num; i++) { if (!gtk_tree_model_iter_next(model, &cat_iter)) break; } if (i != cat_num) return; if (!gtk_tree_model_iter_children(model, &mem_iter, &cat_iter)) return; for (i = 0; i < mem_num; i++) { if (!gtk_tree_model_iter_next(model, &mem_iter)) break; } if (i != mem_num) return; gtk_tree_store_set(store, &mem_iter, COLUMN_SELECTED, mem->enabled, -1); change_made = 1; } static void row_activated_handler(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data) { GtkTreeIter iter; GtkTreeModel *model; GtkTreeStore *store = data; gchar *name; struct category *cat; struct member *mem; model = gtk_tree_view_get_model(treeview); if (!gtk_tree_model_get_iter(model, &iter, path)) return; gtk_tree_model_get(model, &iter, COLUMN_NAME, &name, -1); AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if (strcmp(name, mem->name)) continue; toggle_enabled(mem); gtk_tree_store_set(store, &iter, COLUMN_SELECTED, mem->enabled, -1); change_made = 1; break; } if (mem) break; } g_free(name); } static GtkWidget *get_menubar_menu(GtkWidget *window) { GtkItemFactory *item_factory; GtkAccelGroup *accel_group; /* Make an accelerator group (shortcut keys) */ accel_group = gtk_accel_group_new(); /* Make an ItemFactory (that makes a menubar) */ item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accel_group); /* This function generates the menu items. Pass the item factory, the number of items in the array, the array itself, and any callback data for the the menu items. */ gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL); /* Attach the new accelerator group to the window. */ gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); /* Finally, return the actual menu bar created by the item factory. */ return gtk_item_factory_get_widget(item_factory, "
"); } int run_menu(void) { int argc = 0; char **argv = NULL; GtkWidget *s_window; GtkCellRenderer *renderer; GtkTreeViewColumn *column; GtkTreeStore *store; struct category *cat; struct member *mem; GtkWidget *main_vbox; GtkWidget *menubar; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request(window, 640, 480); gtk_window_set_title(GTK_WINDOW(window), "GMenuselect"); main_vbox = gtk_vbox_new(FALSE, 1); gtk_container_set_border_width(GTK_CONTAINER(main_vbox), 1); gtk_container_add(GTK_CONTAINER(window), main_vbox); menubar = get_menubar_menu(window); gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, FALSE, 0); s_window = gtk_scrolled_window_new(NULL, NULL); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(destroy), NULL); store = gtk_tree_store_new(NUM_COLUMNS, G_TYPE_STRING, /* COLUMN_NAME */ G_TYPE_BOOLEAN, /* COLUMN_SELECTED */ G_TYPE_STRING, /* COLUMN_DEPS */ G_TYPE_STRING, /* COLUMN_USES */ G_TYPE_STRING); /* COLUMN_CNFS */ AST_LIST_TRAVERSE(&categories, cat, list) { GtkTreeIter iter, iter2; gtk_tree_store_append(store, &iter, NULL); gtk_tree_store_set(store, &iter, COLUMN_NAME, cat->displayname, COLUMN_SELECTED, TRUE, -1); AST_LIST_TRAVERSE(&cat->members, mem, list) { char name_buf[64]; char dep_buf[64] = ""; char use_buf[64] = ""; char cnf_buf[64] = ""; struct depend *dep; struct use *use; struct conflict *cnf; AST_LIST_TRAVERSE(&mem->deps, dep, list) { strncat(dep_buf, dep->displayname, sizeof(dep_buf) - strlen(dep_buf) - 1); strncat(dep_buf, dep->member ? "(M)" : "(E)", sizeof(dep_buf) - strlen(dep_buf) - 1); if (AST_LIST_NEXT(dep, list)) strncat(dep_buf, ", ", sizeof(dep_buf) - strlen(dep_buf) - 1); } AST_LIST_TRAVERSE(&mem->uses, use, list) { strncat(use_buf, use->displayname, sizeof(use_buf) - strlen(use_buf) - 1); if (AST_LIST_NEXT(use, list)) strncat(use_buf, ", ", sizeof(use_buf) - strlen(use_buf) - 1); } AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { strncat(cnf_buf, cnf->displayname, sizeof(cnf_buf) - strlen(cnf_buf) - 1); strncat(cnf_buf, cnf->member ? "(M)" : "(E)", sizeof(cnf_buf) - strlen(cnf_buf) - 1); if (AST_LIST_NEXT(cnf, list)) strncat(cnf_buf, ", ", sizeof(cnf_buf) - strlen(cnf_buf) - 1); } snprintf(name_buf, sizeof(name_buf), "%s", mem->name); if (mem->depsfailed == HARD_FAILURE) strncat(name_buf, " (Failed Deps.)", sizeof(name_buf) - strlen(name_buf) - 1); if (mem->conflictsfailed == HARD_FAILURE) strncat(name_buf, " (In Conflict)", sizeof(name_buf) - strlen(name_buf) - 1); gtk_tree_store_append(store, &iter2, &iter); gtk_tree_store_set(store, &iter2, COLUMN_NAME, name_buf, COLUMN_SELECTED, mem->enabled, COLUMN_DEPS, dep_buf, COLUMN_USES, use_buf, COLUMN_CNFS, cnf_buf, -1); } } tree = (GtkTreeView *) gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); #if GTK_CHECK_VERSION(2,10,0) gtk_tree_view_set_enable_tree_lines(tree, TRUE); gtk_tree_view_set_grid_lines(tree, GTK_TREE_VIEW_GRID_LINES_BOTH); #endif renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", COLUMN_NAME, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); renderer = gtk_cell_renderer_toggle_new(); column = gtk_tree_view_column_new_with_attributes("Selected", renderer, "active", COLUMN_SELECTED, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); g_signal_connect(renderer, "toggled", (GCallback) toggled_handler, store); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Depends On", renderer, "text", COLUMN_DEPS, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Can Use", renderer, "text", COLUMN_USES, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Conflicts With", renderer, "text", COLUMN_CNFS, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); g_signal_connect(tree, "row-activated", (GCallback) row_activated_handler, store); gtk_container_add(GTK_CONTAINER(s_window), GTK_WIDGET(tree)); gtk_box_pack_end(GTK_BOX(main_vbox), s_window, TRUE, TRUE, 0); gtk_widget_show_all(window); gtk_main(); return main_res; } dahdi-tools-2.2.0-rc2/menuselect/menuselect.c0000664000000000000000000011150311145073536017570 0ustar rootroot/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 2005 - 2006, Russell Bryant * * Russell Bryant * * 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 * * \author Russell Bryant * * \brief A menu-driven system for Asterisk module selection */ #include #include #include #include #include #include "mxml/mxml.h" #include "linkedlists.h" #include "menuselect.h" #ifdef MENUSELECT_DEBUG static FILE *debug; #endif /*! The list of categories */ struct categories categories = AST_LIST_HEAD_NOLOCK_INIT_VALUE; /*! We have to maintain a pointer to the root of the trees generated from reading the build options XML files so that we can free it when we're done. We don't copy any of the information over from these trees. Our list is just a convenient mapping to the information contained in these lists with one additional piece of information - whether the build option is enabled or not. */ struct tree { /*! the root of the tree */ mxml_node_t *root; /*! for linking */ AST_LIST_ENTRY(tree) list; }; /*! The list of trees from menuselect-tree files */ static AST_LIST_HEAD_NOLOCK_STATIC(trees, tree); static const char * const tree_files[] = { "menuselect-tree" }; static char *output_makeopts = OUTPUT_MAKEOPTS_DEFAULT; static char *output_makedeps = OUTPUT_MAKEDEPS_DEFAULT; /*! This is set to 1 if menuselect.makeopts pre-existed the execution of this app */ static int existing_config = 0; /*! This is set when the --check-deps argument is provided. */ static int check_deps = 0; /*! This variable is non-zero when any changes are made */ int changes_made = 0; /*! Menu name */ const char *menu_name = "Menuselect"; enum dep_file_state { DEP_FILE_UNKNOWN = -2, DEP_FILE_DISABLED = -1, DEP_FILE_UNMET = 0, DEP_FILE_MET = 1, }; /*! Global list of dependencies that are external to the tree */ struct dep_file { char name[32]; enum dep_file_state met; enum dep_file_state previously_met; AST_LIST_ENTRY(dep_file) list; } *dep_file; AST_LIST_HEAD_NOLOCK_STATIC(deps_file, dep_file); #if !defined(ast_strdupa) && defined(__GNUC__) #define ast_strdupa(s) \ (__extension__ \ ({ \ const char *__old = (s); \ size_t __len = strlen(__old) + 1; \ char *__new = __builtin_alloca(__len); \ memcpy (__new, __old, __len); \ __new; \ })) #endif /*! \brief return a pointer to the first non-whitespace character */ static inline char *skip_blanks(char *str) { if (!str) return NULL; while (*str && *str < 33) str++; return str; } static int open_debug(void) { #ifdef MENUSELECT_DEBUG if (!(debug = fopen("menuselect_debug.txt", "w"))) { fprintf(stderr, "Failed to open menuselect_debug.txt for debug output.\n"); return -1; } #endif return 0; } #define print_debug(f, ...) __print_debug(__LINE__, f, ## __VA_ARGS__) static void __attribute__((format(printf, 2, 3))) __print_debug(int line, const char *format, ...) { #ifdef MENUSELECT_DEBUG va_list ap; fprintf(debug, "%d -", line); va_start(ap, format); vfprintf(debug, format, ap); va_end(ap); fflush(debug); #endif } static void close_debug(void) { #ifdef MENUSELECT_DEBUG if (debug) fclose(debug); #endif } /*! \brief Add a category to the category list, ensuring that there are no duplicates */ static struct category *add_category(struct category *cat) { struct category *tmp; AST_LIST_TRAVERSE(&categories, tmp, list) { if (!strcmp(tmp->name, cat->name)) { return tmp; } } AST_LIST_INSERT_TAIL(&categories, cat, list); return cat; } /*! \brief Add a member to the member list of a category, ensuring that there are no duplicates */ static int add_member(struct member *mem, struct category *cat) { struct member *tmp; AST_LIST_TRAVERSE(&cat->members, tmp, list) { if (!strcmp(tmp->name, mem->name)) { fprintf(stderr, "Member '%s' already exists in category '%s', ignoring.\n", mem->name, cat->name); return -1; } } AST_LIST_INSERT_TAIL(&cat->members, mem, list); return 0; } /*! \brief Free a member structure and all of its members */ static void free_member(struct member *mem) { struct depend *dep; struct conflict *cnf; struct use *use; while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list))) free(dep); while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list))) free(cnf); while ((use = AST_LIST_REMOVE_HEAD(&mem->uses, list))) free(use); free(mem); } /*! \brief Parse an input makeopts file */ static int parse_tree(const char *tree_file) { FILE *f; struct tree *tree; struct member *mem; struct depend *dep; struct conflict *cnf; struct use *use; mxml_node_t *cur; mxml_node_t *cur2; mxml_node_t *cur3; mxml_node_t *menu; const char *tmp; if (!(f = fopen(tree_file, "r"))) { fprintf(stderr, "Unable to open '%s' for reading!\n", tree_file); return -1; } if (!(tree = calloc(1, sizeof(*tree)))) { fclose(f); return -1; } if (!(tree->root = mxmlLoadFile(NULL, f, MXML_OPAQUE_CALLBACK))) { fclose(f); free(tree); return -1; } AST_LIST_INSERT_HEAD(&trees, tree, list); menu = mxmlFindElement(tree->root, tree->root, "menu", NULL, NULL, MXML_DESCEND); if ((tmp = mxmlElementGetAttr(menu, "name"))) menu_name = tmp; for (cur = mxmlFindElement(menu, menu, "category", NULL, NULL, MXML_DESCEND_FIRST); cur; cur = mxmlFindElement(cur, menu, "category", NULL, NULL, MXML_NO_DESCEND)) { struct category *cat; struct category *newcat; if (!(cat = calloc(1, sizeof(*cat)))) return -1; cat->name = mxmlElementGetAttr(cur, "name"); newcat = add_category(cat); if (newcat != cat) { /* want to append members, and potentially update the category. */ free(cat); cat = newcat; } if ((tmp = mxmlElementGetAttr(cur, "displayname"))) cat->displayname = tmp; if ((tmp = mxmlElementGetAttr(cur, "positive_output"))) cat->positive_output = !strcasecmp(tmp, "yes"); if ((tmp = mxmlElementGetAttr(cur, "exclusive"))) cat->exclusive = !strcasecmp(tmp, "yes"); if ((tmp = mxmlElementGetAttr(cur, "remove_on_change"))) cat->remove_on_change = tmp; for (cur2 = mxmlFindElement(cur, cur, "member", NULL, NULL, MXML_DESCEND_FIRST); cur2; cur2 = mxmlFindElement(cur2, cur, "member", NULL, NULL, MXML_NO_DESCEND)) { if (!(mem = calloc(1, sizeof(*mem)))) return -1; mem->name = mxmlElementGetAttr(cur2, "name"); mem->displayname = mxmlElementGetAttr(cur2, "displayname"); mem->remove_on_change = mxmlElementGetAttr(cur2, "remove_on_change"); if (!cat->positive_output) { mem->was_enabled = mem->enabled = 1; print_debug("Enabling %s because the category does not have positive output\n", mem->name); } cur3 = mxmlFindElement(cur2, cur2, "defaultenabled", NULL, NULL, MXML_DESCEND); if (cur3 && cur3->child) mem->defaultenabled = cur3->child->value.opaque; for (cur3 = mxmlFindElement(cur2, cur2, "depend", NULL, NULL, MXML_DESCEND_FIRST); cur3 && cur3->child; cur3 = mxmlFindElement(cur3, cur2, "depend", NULL, NULL, MXML_NO_DESCEND)) { if (!(dep = calloc(1, sizeof(*dep)))) { free_member(mem); return -1; } if ((tmp = mxmlElementGetAttr(cur3, "name"))) { if (!strlen_zero(tmp)) { dep->name = tmp; } } if (!strlen_zero(cur3->child->value.opaque)) { dep->displayname = cur3->child->value.opaque; if (!dep->name) { dep->name = dep->displayname; } AST_LIST_INSERT_TAIL(&mem->deps, dep, list); } else free(dep); } for (cur3 = mxmlFindElement(cur2, cur2, "conflict", NULL, NULL, MXML_DESCEND_FIRST); cur3 && cur3->child; cur3 = mxmlFindElement(cur3, cur2, "conflict", NULL, NULL, MXML_NO_DESCEND)) { if (!(cnf = calloc(1, sizeof(*cnf)))) { free_member(mem); return -1; } if ((tmp = mxmlElementGetAttr(cur3, "name"))) { if (!strlen_zero(tmp)) { cnf->name = tmp; } } if (!strlen_zero(cur3->child->value.opaque)) { cnf->displayname = cur3->child->value.opaque; if (!cnf->name) { cnf->name = cnf->displayname; } AST_LIST_INSERT_TAIL(&mem->conflicts, cnf, list); } else free(cnf); } for (cur3 = mxmlFindElement(cur2, cur2, "use", NULL, NULL, MXML_DESCEND_FIRST); cur3 && cur3->child; cur3 = mxmlFindElement(cur3, cur2, "use", NULL, NULL, MXML_NO_DESCEND)) { if (!(use = calloc(1, sizeof(*use)))) { free_member(mem); return -1; } if ((tmp = mxmlElementGetAttr(cur3, "name"))) { if (!strlen_zero(tmp)) { use->name = tmp; } } if (!strlen_zero(cur3->child->value.opaque)) { use->displayname = cur3->child->value.opaque; if (!use->name) { use->name = use->displayname; } AST_LIST_INSERT_TAIL(&mem->uses, use, list); } else free(use); } if (add_member(mem, cat)) free_member(mem); } } fclose(f); return 0; } /*! * \arg interactive Set to non-zero if being called while user is making changes */ static unsigned int calc_dep_failures(int interactive, int pre_confload) { unsigned int result = 0; struct category *cat; struct member *mem; struct depend *dep; unsigned int changed, old_failure; AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { old_failure = mem->depsfailed; AST_LIST_TRAVERSE(&mem->deps, dep, list) { if (dep->member) continue; mem->depsfailed = HARD_FAILURE; AST_LIST_TRAVERSE(&deps_file, dep_file, list) { if (!strcasecmp(dep_file->name, dep->name)) { if (dep_file->met == DEP_FILE_MET) mem->depsfailed = NO_FAILURE; break; } } if (mem->depsfailed != NO_FAILURE) { break; /* This dependency is not met, so we can stop now */ } } if (old_failure == SOFT_FAILURE && mem->depsfailed != HARD_FAILURE) mem->depsfailed = SOFT_FAILURE; } } if (pre_confload) { return 0; } do { changed = 0; AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { old_failure = mem->depsfailed; if (mem->depsfailed == HARD_FAILURE) continue; mem->depsfailed = NO_FAILURE; AST_LIST_TRAVERSE(&mem->deps, dep, list) { if (!dep->member) continue; if (dep->member->depsfailed == HARD_FAILURE) { mem->depsfailed = HARD_FAILURE; break; } else if (dep->member->depsfailed == SOFT_FAILURE) { mem->depsfailed = SOFT_FAILURE; } else if (!dep->member->enabled) { mem->depsfailed = SOFT_FAILURE; } } if (mem->depsfailed != old_failure) { if ((mem->depsfailed == NO_FAILURE) && mem->was_defaulted) { mem->enabled = !strcasecmp(mem->defaultenabled, "yes"); print_debug("Just set %s enabled to %d\n", mem->name, mem->enabled); } else { mem->enabled = interactive ? 0 : mem->was_enabled; print_debug("Just set %s enabled to %d\n", mem->name, mem->enabled); } changed = 1; break; /* This dependency is not met, so we can stop now */ } } if (changed) break; } if (changed) result = 1; } while (changed); return result; } static unsigned int calc_conflict_failures(int interactive, int pre_confload) { unsigned int result = 0; struct category *cat; struct member *mem; struct conflict *cnf; unsigned int changed, old_failure; AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { old_failure = mem->conflictsfailed; AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { if (cnf->member) continue; mem->conflictsfailed = NO_FAILURE; AST_LIST_TRAVERSE(&deps_file, dep_file, list) { if (!strcasecmp(dep_file->name, cnf->name)) { if (dep_file->met == DEP_FILE_MET) { mem->conflictsfailed = HARD_FAILURE; print_debug("Setting %s conflictsfailed to HARD_FAILURE\n", mem->name); } break; } } if (mem->conflictsfailed != NO_FAILURE) break; /* This conflict was found, so we can stop now */ } if (old_failure == SOFT_FAILURE && mem->conflictsfailed != HARD_FAILURE) { print_debug("%d - Setting %s conflictsfailed to SOFT_FAILURE\n", __LINE__, mem->name); mem->conflictsfailed = SOFT_FAILURE; } } } if (pre_confload) { return 0; } do { changed = 0; AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { old_failure = mem->conflictsfailed; if (mem->conflictsfailed == HARD_FAILURE) continue; mem->conflictsfailed = NO_FAILURE; AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { if (!cnf->member) continue; if (cnf->member->enabled) { mem->conflictsfailed = SOFT_FAILURE; print_debug("%d - Setting %s conflictsfailed to SOFT_FAILURE because %s is enabled\n", __LINE__, mem->name, cnf->member->name); break; } } if (mem->conflictsfailed != old_failure && mem->conflictsfailed != NO_FAILURE) { mem->enabled = 0; print_debug("Just set %s enabled to %d because of conflicts\n", mem->name, mem->enabled); changed = 1; break; /* This conflict has been found, so we can stop now */ } } if (changed) break; } if (changed) result = 1; } while (changed); return result; } /*! \brief Process dependencies against the input dependencies file */ static int process_deps(void) { FILE *f; char buf[80]; int res = 0; if (!(f = fopen(MENUSELECT_DEPS, "r"))) { fprintf(stderr, "Unable to open '%s' for reading! Did you run ./configure ?\n", MENUSELECT_DEPS); return -1; } /* Build a dependency list from the file generated by configure */ while (memset(buf, 0, sizeof(buf)), fgets(buf, sizeof(buf), f)) { char *name, *cur, *prev, *p; int val; /* Strip trailing CR/NL */ while ((p = strchr(buf, '\r')) || (p = strchr(buf, '\n'))) { *p = '\0'; } p = buf; name = strsep(&p, "="); if (!p) continue; cur = strsep(&p, ":"); prev = strsep(&p, ":"); if (!(dep_file = calloc(1, sizeof(*dep_file)))) break; strncpy(dep_file->name, name, sizeof(dep_file->name) - 1); dep_file->met = DEP_FILE_UNKNOWN; dep_file->previously_met = DEP_FILE_UNKNOWN; if (sscanf(cur, "%d", &val) != 1) { fprintf(stderr, "Unknown value '%s' found in %s for %s\n", cur, MENUSELECT_DEPS, name); } else { switch (val) { case DEP_FILE_MET: case DEP_FILE_UNMET: case DEP_FILE_DISABLED: dep_file->met = val; break; default: fprintf(stderr, "Unknown value '%s' found in %s for %s\n", cur, MENUSELECT_DEPS, name); break; } } if (prev) { if (sscanf(prev, "%d", &val) != 1) { fprintf(stderr, "Unknown value '%s' found in %s for %s\n", prev, MENUSELECT_DEPS, name); } else { switch (val) { case DEP_FILE_MET: case DEP_FILE_UNMET: case DEP_FILE_DISABLED: dep_file->previously_met = val; break; default: fprintf(stderr, "Unknown value '%s' found in %s for %s\n", prev, MENUSELECT_DEPS, name); break; } } } AST_LIST_INSERT_TAIL(&deps_file, dep_file, list); } fclose(f); return res; } static void free_deps_file(void) { /* Free the dependency list we built from the file */ while ((dep_file = AST_LIST_REMOVE_HEAD(&deps_file, list))) free(dep_file); } static int match_member_relations(void) { struct category *cat, *cat2; struct member *mem, *mem2; struct depend *dep; struct conflict *cnf; struct use *use; AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { AST_LIST_TRAVERSE(&mem->deps, dep, list) { AST_LIST_TRAVERSE(&cat->members, mem2, list) { if (strcasecmp(mem2->name, dep->name)) continue; dep->member = mem2; break; } if (dep->member) continue; AST_LIST_TRAVERSE(&categories, cat2, list) { AST_LIST_TRAVERSE(&cat2->members, mem2, list) { if (strcasecmp(mem2->name, dep->name)) continue; dep->member = mem2; break; } if (dep->member) break; } } } } AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { AST_LIST_TRAVERSE(&mem->uses, use, list) { AST_LIST_TRAVERSE(&cat->members, mem2, list) { if (strcasecmp(mem2->name, use->name)) continue; use->member = mem2; break; } if (use->member) continue; AST_LIST_TRAVERSE(&categories, cat2, list) { AST_LIST_TRAVERSE(&cat2->members, mem2, list) { if (strcasecmp(mem2->name, use->name)) continue; use->member = mem2; break; } if (use->member) break; } } } } AST_LIST_TRAVERSE(&categories, cat, list) { if (!cat->exclusive) continue; AST_LIST_TRAVERSE(&cat->members, mem, list) { AST_LIST_TRAVERSE(&cat->members, mem2, list) { if (mem2 == mem) continue; if (!(cnf = calloc(1, sizeof(*cnf)))) return -1; cnf->name = mem2->name; cnf->member = mem2; AST_LIST_INSERT_TAIL(&mem->conflicts, cnf, list); } } } AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) { AST_LIST_TRAVERSE(&cat->members, mem2, list) { if (strcasecmp(mem2->name, cnf->name)) continue; cnf->member = mem2; break; } if (cnf->member) continue; AST_LIST_TRAVERSE(&categories, cat2, list) { AST_LIST_TRAVERSE(&cat2->members, mem2, list) { if (strcasecmp(mem2->name, cnf->name)) continue; cnf->member = mem2; break; } if (cnf->member) break; } } } } return 0; } /*! \brief Iterate through all of the input tree files and call the parse function on them */ static int build_member_list(void) { int i; int res = -1; for (i = 0; i < (sizeof(tree_files) / sizeof(tree_files[0])); i++) { if ((res = parse_tree(tree_files[i]))) { fprintf(stderr, "Error parsing '%s'!\n", tree_files[i]); break; } } if (!res) res = match_member_relations(); return res; } /*! \brief Given the string representation of a member and category, mark it as present in a given input file */ static void mark_as_present(const char *member, const char *category) { struct category *cat; struct member *mem; char negate = 0; if (*member == '-') { member++; negate = 1; } print_debug("Marking %s of %s as present\n", member, category); AST_LIST_TRAVERSE(&categories, cat, list) { if (strcmp(category, cat->name)) continue; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (!strcmp(member, mem->name)) { mem->was_enabled = mem->enabled = (negate ? !cat->positive_output : cat->positive_output); print_debug("Just set %s enabled to %d\n", mem->name, mem->enabled); break; } } if (!mem) fprintf(stderr, "member '%s' in category '%s' not found, ignoring.\n", member, category); break; } if (!cat) fprintf(stderr, "category '%s' not found! Can't mark '%s' as disabled.\n", category, member); } unsigned int enable_member(struct member *mem) { struct depend *dep; unsigned int can_enable = 1; AST_LIST_TRAVERSE(&mem->deps, dep, list) { if (!dep->member) continue; if (!dep->member->enabled) { if (dep->member->conflictsfailed != NO_FAILURE) { can_enable = 0; break; } if (dep->member->depsfailed == HARD_FAILURE) { can_enable = 0; break; } if (!(can_enable = enable_member(dep->member))) break; } } if ((mem->enabled = can_enable)) { print_debug("Just set %s enabled to %d\n", mem->name, mem->enabled); while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0)); } return can_enable; } void toggle_enabled(struct member *mem) { if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) return; if (!mem->enabled) enable_member(mem); else mem->enabled = 0; print_debug("3- changed %s to %d\n", mem->name, mem->enabled); mem->was_defaulted = 0; changes_made++; while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0)); } /*! \brief Toggle a member of a category at the specified index to enabled/disabled */ void toggle_enabled_index(struct category *cat, int index) { struct member *mem; int i = 0; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (i++ == index) break; } if (!mem) return; toggle_enabled(mem); } void set_enabled(struct category *cat, int index) { struct member *mem; int i = 0; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (i++ == index) break; } if (!mem) return; if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) return; if (mem->enabled) return; enable_member(mem); mem->was_defaulted = 0; changes_made++; while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0)); } void clear_enabled(struct category *cat, int index) { struct member *mem; int i = 0; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (i++ == index) break; } if (!mem) return; if (!mem->enabled) return; mem->enabled = 0; mem->was_defaulted = 0; changes_made++; while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0)); } /*! \brief Process a previously failed dependency * * If a module was previously disabled because of a failed dependency * or a conflict, and not because the user selected it to be that way, * then it needs to be re-enabled by default if the problem is no longer present. */ static void process_prev_failed_deps(char *buf) { const char *cat_name, *mem_name; struct category *cat; struct member *mem; cat_name = strsep(&buf, "="); mem_name = strsep(&buf, "\n"); if (!cat_name || !mem_name) return; AST_LIST_TRAVERSE(&categories, cat, list) { if (strcasecmp(cat->name, cat_name)) continue; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (strcasecmp(mem->name, mem_name)) continue; if (!mem->depsfailed && !mem->conflictsfailed) { mem->enabled = 1; print_debug("Just set %s enabled to %d in processing of previously failed deps\n", mem->name, mem->enabled); mem->was_defaulted = 0; } break; } break; } if (!cat || !mem) fprintf(stderr, "Unable to find '%s' in category '%s'\n", mem_name, cat_name); } /*! \brief Parse an existing output makeopts file and enable members previously selected */ static int parse_existing_config(const char *infile) { FILE *f; char buf[2048]; char *category, *parse, *member; int lineno = 0; if (!(f = fopen(infile, "r"))) { /* This isn't really an error, so only print the message in debug mode */ print_debug("Unable to open '%s' for reading existing config.\n", infile); return -1; } while (fgets(buf, sizeof(buf), f)) { lineno++; if (strlen_zero(buf)) continue; /* skip lines that are not for this tool */ if (strncasecmp(buf, "MENUSELECT_", strlen("MENUSELECT_"))) continue; if (!strncasecmp(buf, "MENUSELECT_DEPENDS_", strlen("MENUSELECT_DEPENDS_"))) continue; if (!strncasecmp(buf, "MENUSELECT_BUILD_DEPS", strlen("MENUSELECT_BUILD_DEPS"))) continue; parse = buf; parse = skip_blanks(parse); if (strlen_zero(parse)) continue; /* Grab the category name */ category = strsep(&parse, "="); if (!parse) { fprintf(stderr, "Invalid string in '%s' at line '%d'!\n", output_makeopts, lineno); continue; } parse = skip_blanks(parse); if (!strcasecmp(category, "MENUSELECT_DEPSFAILED")) { process_prev_failed_deps(parse); continue; } while ((member = strsep(&parse, " \n"))) { member = skip_blanks(member); if (strlen_zero(member)) continue; mark_as_present(member, category); } } fclose(f); return 0; } /*! \brief Create the output dependencies file */ static int generate_makedeps_file(void) { FILE *f; struct category *cat; struct member *mem; struct depend *dep; struct use *use; if (!(f = fopen(output_makedeps, "w"))) { fprintf(stderr, "Unable to open dependencies file (%s) for writing!\n", output_makedeps); return -1; } /* Traverse all categories and members and output dependencies for each member */ AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if (AST_LIST_EMPTY(&mem->deps) && AST_LIST_EMPTY(&mem->uses)) continue; fprintf(f, "MENUSELECT_DEPENDS_%s=", mem->name); AST_LIST_TRAVERSE(&mem->deps, dep, list) { const char *c; for (c = dep->name; *c; c++) fputc(toupper(*c), f); fputc(' ', f); } AST_LIST_TRAVERSE(&mem->uses, use, list) { const char *c; for (c = use->name; *c; c++) fputc(toupper(*c), f); fputc(' ', f); } fprintf(f, "\n"); } } fclose(f); return 0; } /*! \brief Create the output makeopts file that results from the user's selections */ static int generate_makeopts_file(void) { FILE *f; struct category *cat; struct member *mem; struct depend *dep; struct use *use; if (!(f = fopen(output_makeopts, "w"))) { fprintf(stderr, "Unable to open build configuration file (%s) for writing!\n", output_makeopts); return -1; } /* Traverse all categories and members and output them as var/val pairs */ AST_LIST_TRAVERSE(&categories, cat, list) { fprintf(f, "%s=", cat->name); AST_LIST_TRAVERSE(&cat->members, mem, list) { if ((!cat->positive_output && (!mem->enabled || mem->depsfailed || mem->conflictsfailed)) || (cat->positive_output && mem->enabled && !mem->depsfailed && !mem->conflictsfailed)) fprintf(f, "%s ", mem->name); } fprintf(f, "\n"); } /* Traverse all categories and members, and for every member that is not disabled, if it has internal dependencies (other members), list those members one time only in a special variable */ fprintf(f, "MENUSELECT_BUILD_DEPS="); AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if ((!cat->positive_output && (!mem->enabled || mem->depsfailed || mem->conflictsfailed)) || (cat->positive_output && mem->enabled && !mem->depsfailed && !mem->conflictsfailed)) continue; AST_LIST_TRAVERSE(&mem->deps, dep, list) { /* we only care about dependencies between members (internal, not external) */ if (!dep->member) continue; /* if this has already been output, continue */ if (dep->member->build_deps_output) continue; fprintf(f, "%s ", dep->member->name); dep->member->build_deps_output = 1; } AST_LIST_TRAVERSE(&mem->uses, use, list) { /* we only care about dependencies between members (internal, not external) */ if (!use->member) continue; /* if the dependency module is not going to be built, don't list it */ if (!use->member->enabled) continue; /* if this has already been output, continue */ if (use->member->build_deps_output) continue; fprintf(f, "%s ", use->member->name); use->member->build_deps_output = 1; } } } fprintf(f, "\n"); /* Output which members were disabled because of failed dependencies or conflicts */ AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if (mem->depsfailed != HARD_FAILURE && mem->conflictsfailed != HARD_FAILURE) continue; if (!mem->defaultenabled || !strcasecmp(mem->defaultenabled, "yes")) fprintf(f, "MENUSELECT_DEPSFAILED=%s=%s\n", cat->name, mem->name); } } fclose(f); /* there is no need to process remove_on_change rules if we did not have configuration information to start from */ if (!existing_config) return 0; /* Traverse all categories and members and remove any files that are supposed to be removed when an item has been changed */ AST_LIST_TRAVERSE(&categories, cat, list) { unsigned int had_changes = 0; char rmcommand[256] = "rm -rf "; char *file, *buf; AST_LIST_TRAVERSE(&cat->members, mem, list) { if ((mem->enabled == mem->was_enabled) && !mem->was_defaulted) continue; had_changes = 1; if (mem->remove_on_change) { for (buf = ast_strdupa(mem->remove_on_change), file = strsep(&buf, " "); file; file = strsep(&buf, " ")) { strcpy(&rmcommand[7], file); system(rmcommand); } } } if (cat->remove_on_change && had_changes) { for (buf = ast_strdupa(cat->remove_on_change), file = strsep(&buf, " "); file; file = strsep(&buf, " ")) { strcpy(&rmcommand[7], file); system(rmcommand); } } } return 0; } /*! \brief Print out all of the information contained in our tree */ static void dump_member_list(void) { #ifdef MENUSELECT_DEBUG struct category *cat; struct member *mem; struct depend *dep; struct conflict *cnf; AST_LIST_TRAVERSE(&categories, cat, list) { fprintf(stderr, "Category: '%s'\n", cat->name); AST_LIST_TRAVERSE(&cat->members, mem, list) { fprintf(stderr, " ==>> Member: '%s' (%s)", mem->name, mem->enabled ? "Enabled" : "Disabled"); fprintf(stderr, " Was %s\n", mem->was_enabled ? "Enabled" : "Disabled"); if (mem->defaultenabled) fprintf(stderr, " Defaults to %s\n", !strcasecmp(mem->defaultenabled, "yes") ? "Enabled" : "Disabled"); AST_LIST_TRAVERSE(&mem->deps, dep, list) fprintf(stderr, " --> Depends on: '%s'\n", dep->name); if (!AST_LIST_EMPTY(&mem->deps)) fprintf(stderr, " --> Dependencies Met: %s\n", mem->depsfailed ? "No" : "Yes"); AST_LIST_TRAVERSE(&mem->conflicts, cnf, list) fprintf(stderr, " --> Conflicts with: '%s'\n", cnf->name); if (!AST_LIST_EMPTY(&mem->conflicts)) fprintf(stderr, " --> Conflicts Found: %s\n", mem->conflictsfailed ? "Yes" : "No"); } } #endif } /*! \brief Free all categories and their members */ static void free_member_list(void) { struct category *cat; struct member *mem; struct depend *dep; struct conflict *cnf; struct use *use; while ((cat = AST_LIST_REMOVE_HEAD(&categories, list))) { while ((mem = AST_LIST_REMOVE_HEAD(&cat->members, list))) { while ((dep = AST_LIST_REMOVE_HEAD(&mem->deps, list))) free(dep); while ((cnf = AST_LIST_REMOVE_HEAD(&mem->conflicts, list))) free(cnf); while ((use = AST_LIST_REMOVE_HEAD(&mem->uses, list))) free(use); free(mem); } free(cat); } } /*! \brief Free all of the XML trees */ static void free_trees(void) { struct tree *tree; while ((tree = AST_LIST_REMOVE_HEAD(&trees, list))) { mxmlDelete(tree->root); free(tree); } } /*! \brief Enable/Disable all members of a category as long as dependencies have been met and no conflicts are found */ void set_all(struct category *cat, int val) { struct member *mem; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (mem->enabled == val) continue; if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) continue; if (val) { enable_member(mem); } else { mem->enabled = 0; } mem->was_defaulted = 0; changes_made++; } while (calc_dep_failures(1, 0) || calc_conflict_failures(1, 0)); } int count_categories(void) { struct category *cat; int count = 0; AST_LIST_TRAVERSE(&categories, cat, list) count++; return count; } int count_members(struct category *cat) { struct member *mem; int count = 0; AST_LIST_TRAVERSE(&cat->members, mem, list) count++; return count; } static void print_sanity_dep_header(unsigned int *flag) { fprintf(stderr, "\n" "***********************************************************\n" " The '%s' dependency was previously satisfied but \n" " is now unsatisfied. \n", dep_file->name); *flag = 1; } /*! \brief Make sure an existing menuselect.makeopts disabled everything it should have */ static int sanity_check(void) { unsigned int insane = 0; struct category *cat; struct member *mem; struct depend *dep; struct use *use; unsigned int dep_header_printed; unsigned int group_header_printed; AST_LIST_TRAVERSE(&deps_file, dep_file, list) { if (!((dep_file->previously_met == DEP_FILE_MET) && (dep_file->met == DEP_FILE_UNMET))) { continue; } /* this dependency was previously met, but now is not, so warn the user about members that could be affected by it */ dep_header_printed = 0; group_header_printed = 0; AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if (!mem->enabled) { continue; } AST_LIST_TRAVERSE(&mem->deps, dep, list) { if (strcasecmp(dep->name, dep_file->name)) { continue; } if (!group_header_printed) { if (!dep_header_printed) { print_sanity_dep_header(&dep_header_printed); } fprintf(stderr, "\n" " The following modules will no longer be available:\n"); group_header_printed = 1; } fprintf(stderr, " %s\n", mem->name); insane = 1; } } } group_header_printed = 0; AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if (!mem->enabled) { continue; } AST_LIST_TRAVERSE(&mem->uses, use, list) { if (strcasecmp(use->name, dep_file->name)) { continue; } if (!group_header_printed) { if (!dep_header_printed) { print_sanity_dep_header(&dep_header_printed); } fprintf(stderr, "\n" " The functionality of the following modules will\n" " be affected:\n"); group_header_printed = 1; } fprintf(stderr, " %s\n", mem->name); insane = 1; } } } if (dep_header_printed) { fprintf(stderr, "***********************************************************\n"); } } AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if ((mem->depsfailed || mem->conflictsfailed) && mem->enabled) { fprintf(stderr, "\n" "***********************************************************\n" " The existing menuselect.makeopts file did not specify \n" " that '%s' should not be included. However, either some \n" " dependencies for this module were not found or a \n" " conflict exists. \n" " \n" " Either run 'make menuselect' or remove the existing \n" " menuselect.makeopts file to resolve this issue. \n" "***********************************************************\n" "\n", mem->name); insane = 1; } } } return insane ? -1 : 0; } /* \brief Set the forced default values if they exist */ static void process_defaults(void) { struct category *cat; struct member *mem; print_debug("Processing default values since config was not present\n"); AST_LIST_TRAVERSE(&categories, cat, list) { AST_LIST_TRAVERSE(&cat->members, mem, list) { if (!mem->defaultenabled) continue; if (mem->depsfailed == HARD_FAILURE) continue; if (mem->conflictsfailed == HARD_FAILURE) continue; if (!strcasecmp(mem->defaultenabled, "yes")) { mem->enabled = 1; mem->was_defaulted = 1; } else if (!strcasecmp(mem->defaultenabled, "no")) { mem->enabled = 0; mem->was_defaulted = 1; } else fprintf(stderr, "Invalid defaultenabled value for '%s' in category '%s'\n", mem->name, cat->name); } } } int main(int argc, char *argv[]) { int res = 0; unsigned int x; if (open_debug()) { exit(1); } /* Parse the input XML files to build the list of available options */ if ((res = build_member_list())) exit(res); /* Load module dependencies */ if ((res = process_deps())) exit(res); while (calc_dep_failures(0, 1) || calc_conflict_failures(0, 1)); /* The --check-deps option is used to ask this application to check to * see if that an existing menuselect.makeopts file contains all of the * modules that have dependencies that have not been met. If this * is not the case, an informative message will be printed to the * user and the build will fail. */ for (x = 1; x < argc; x++) { if (!strcmp(argv[x], "--check-deps")) check_deps = 1; else { res = parse_existing_config(argv[x]); if (!res && !strcasecmp(argv[x], OUTPUT_MAKEOPTS_DEFAULT)) existing_config = 1; res = 0; } } /* Dump the list produced by parsing the various input files */ dump_member_list(); while (calc_dep_failures(0, 0) || calc_conflict_failures(0, 0)); if (!existing_config) process_defaults(); else if (check_deps) res = sanity_check(); while (calc_dep_failures(0, 0) || calc_conflict_failures(0, 0)); /* Run the menu to let the user enable/disable options */ if (!check_deps && !res) res = run_menu(); if (!res) res = generate_makeopts_file(); /* Always generate the dependencies file */ if (!res) generate_makedeps_file(); /* free everything we allocated */ free_deps_file(); free_trees(); free_member_list(); close_debug(); exit(res); } dahdi-tools-2.2.0-rc2/menuselect/Makefile0000664000000000000000000000531011120035763016707 0ustar rootroot# # Asterisk -- A telephony toolkit for Linux. # # Makefile for Menuselect # # Copyright (C) 2005-2008, Digium, Inc. # # Russell Bryant # # This program is free software, distributed under the terms of # the GNU General Public License # # even though we could use '-include makeopts' here, use a wildcard # lookup anyway, so that make won't try to build makeopts if it doesn't # exist (other rules will force it to be built if needed) ifneq ($(wildcard makeopts),) include makeopts endif .PHONY: clean dist-clean distclean test ntest ctest gtest # Basic set of sources and flags/libraries/includes OBJS:=menuselect.o strcompat.o CFLAGS:=-g -c -D_GNU_SOURCE -Wall ifeq ($(MENUSELECT_DEBUG),yes) CFLAGS += -DMENUSELECT_DEBUG endif ifdef NCURSES_LIB C_OBJS += menuselect_curses.o C_LIBS +=$(NCURSES_LIB) C_INCLUDE += $(NCURSES_INCLUDE) ALL_TGTS += cmenuselect else ifdef CURSES_LIB C_OBJS += menuselect_curses.o C_LIBS +=$(CURSES_LIB) C_INCLUDE += $(CURSES_INCLUDE) ALL_TGTS += cmenuselect endif endif ifdef GTK2_LIB G_OBJS += menuselect_gtk.o G_LIBS += $(GTK2_LIB) G_INCLUDE += $(GTK2_INCLUDE) ALL_TGTS += gmenuselect endif ifdef NEWT_LIB N_OBJS += menuselect_newt.o N_LIBS += $(NEWT_LIB) N_INCLUDE += $(NEWT_INCLUDE) ALL_TGTS += nmenuselect endif M_OBJS += menuselect_stub.o ALL_TGTS += menuselect all: $(ALL_TGTS) $(OBJS) $(C_OBJS) $(N_OBJS) $(G_OBJS) $(M_OBJS): autoconfig.h menuselect.h makeopts autoconfig.h: autoconfig.h.in makeopts.in @./configure $(CONFIGURE_SILENT) CC= LD= AR= CFLAGS= $(ALL_TGTS): mxml/libmxml.a ifdef C_OBJS menuselect_curses.o: CFLAGS+=$(C_INCLUDE) cmenuselect: $(OBJS) $(C_OBJS) $(CC) -o $@ $^ $(C_LIBS) else cmenuselect: endif ifdef G_OBJS menuselect_gtk.o: CFLAGS+=$(G_INCLUDE) gmenuselect: $(OBJS) $(G_OBJS) $(CC) -o $@ $^ $(G_LIBS) else gmenuselect: endif ifdef N_OBJS menuselect_newt.o: CFLAGS+=$(N_INCLUDE) nmenuselect: $(OBJS) $(N_OBJS) $(CC) -o $@ $^ $(N_LIBS) else nmenuselect: endif menuselect: $(OBJS) $(M_OBJS) $(CC) -o $@ $^ $(M_LIBS) mxml/libmxml.a: @if test ! -f mxml/Makefile ; then cd mxml && ./configure ; fi @$(MAKE) -C mxml libmxml.a test: menuselect (cd test; ../$< menuselect.makeopts) ctest: cmenuselect (cd test; ../$< menuselect.makeopts) gtest: gmenuselect (cd test; ../$< menuselect.makeopts) ntest: nmenuselect (cd test; ../$< menuselect.makeopts) clean: rm -f menuselect cmenuselect gmenuselect nmenuselect $(OBJS) $(M_OBJS) $(C_OBJS) $(G_OBJS) $(N_OBJS) @if test -f mxml/Makefile ; then $(MAKE) -C mxml clean ; fi dist-clean: distclean distclean: clean @if test -f mxml/Makefile ; then $(MAKE) -C mxml distclean ; fi rm -f autoconfig.h config.status config.log makeopts rm -rf autom4te.cache dahdi-tools-2.2.0-rc2/menuselect/README0000664000000000000000000001437210763621520016143 0ustar rootrootMENUSELECT Copyright (C) 2005-2006, Digium, Inc. Russell Bryant ------------------------------------------------------------------------------- ABOUT Menuselect is a tool designed to be used in conjunction with GNU make. It allows for an XML specification of Makefile variables and optional space delimited values of these variables. These values can then be used in the Makefile to make various decisions during the build process. Menuselect also provides a mechanism for dependency checking for each possible member (value) of each category (Makefile variable). These dependencies are generally checked by using autoconf and the results provided to menuselect. If dependencies for a member are not met, the user will not be allowed to make that selection. In the same way the menuselect does dependency checking, it also does conflict checking. If a listed conflict for a member is met, then the user will not be allowed to select it. For use with automated builds or when the user has no desire to make selections different than the defined defaults, menuselect can generate a default output file for use in the build. Menuselect can also do a sanity check on existing input files. If any member has been selected that has conflicts or unmet dependencies, then menuselect will exit with an error and output to notify the user of the situation. This is typically done at the beginning of the build process to ensure that given all of the known information, the build is going to be successful. MENUSELECT DEPENDENCIES libncurses -- This is needed for the curses frontend. libnewt -- This is needed for the newt frontend (optional). libmxml -- This library, Mini-XML, is used for XML parsing. (http://www.easysw.com/~mike/mxml/) (Asterisk uses the code in http://svn.digium.com/svn/mxml/ ) ENVIRONMENT SETUP The file menuselect.h contains a couple of defines which specify locations for various files. These locations are relative to the directory from which menuselect will be executed. #define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts" This is the location where the menuselect output will be saved. #define MENUSELECT_DEPS "build_tools/menuselect-deps" This is the location where menuselect will expect to find the input file that provides dependency and conflict information. More information on the format of this file can be found in the section about dependency and conflict checking. DEPENDENCY AND CONFLICT CHECKING Members may have as many conflicts and dependencies specified as needed. An example of the MENUSELECT_DEPS file would look like this: DEPENDENCY1=1 DEPENDENCY2=0 CONFLICT1=0 In this case, "DEPENDENCY1" has been met, "DEPENDENCY2" has not been met, and "CONFLICT1" is not present. To ask menuselect to do a background sanity check on dependencies and conflicts, it can be called like this: ./menuselect --check-deps [input_file2] [...] The format of the input files must be of the same format menuselect uses to create the OUPUT_MAKEOPTS_DEFAULT. SETTING UP AVAILABLE OPTIONS The XML specification for the menu lives in the file "menuselect-tree" and should be in the same directory that menuselect will be executed from. An example menuselect-tree file as used in the Asterisk project (http://www.asterisk.org) is provided in example_menuselect-tree Menu: The top level tag in menuselect-tree is the tag. All of the categories reside inside of the ... block. Menu Attributes: name="Asterisk Module Selection" This specifies the title of the menu. It is displayed at the top of the screen when using the curses frontend Categories: A contains members. The category tag can contain a number of different attributes to specify different behavior. Category Attributes: name="MENUSELECT_APPS" The name attribute is required. This is the name of the variable that will be in the output from menuselect. displayname="Applications" If this is specfied, this is what will be shown in the menu to the user. positive_output="yes" The default for menuselect is to output all of the members of a category that are *not* selected. This is because it is often convenient to be able to define a full list in the Makefile and then filter out the results from menuselect. Using GNU make, an example of this would be: APPS:=$(filter-out $(MENUSELECT_APPS),$(APPS)) remove_on_change=".lastclean" This attribute can contain a space delimited list of files to be deleted when it is time to build an output file if any of the members of this category have changed values from their values for existing input when the application was started. Members: A contains conflicts and dependencies. The member tag can contain a number of different attributes to specify different behavior. Member Attributes: name="app_meetme" The name attribute is required. This is the value that will be added to the variable specified by the category when selected (or not selected) depending on the setting of the positive_output attribute of the category. displayname="Call Conferencing Application" If this is specified, this will be provided as a description of this member when the cursor is on it in the menu. remove_on_change="apps/app_meetme.o apps/app_meetme.so" This attribute can contain a space delimeted list of files to be deleted when it is time to build an output file if the value of this member has changed from its value in any existing input when the application was started. Dependencies: A dependency for a is specified using a tag. The name of the dependency corresponds to names in the MENUSELECT_DEPS file. This is an example of specifying a dependency for a member: zaptel Conflicts: A conflict for a is specified using a tag. The name of the conflict corresponds to names in the MENUSELECT_DEPS file. This is an example of specifying a dependency for a member: win32 REPORTING BUGS Any bug reports or feature enhancement submissions to menuselect should be submitted at http://bugs.digium.com/ Thank you! dahdi-tools-2.2.0-rc2/menuselect/bootstrap.sh0000775000000000000000000000142010472743350017630 0ustar rootroot#!/bin/sh check_for_app() { $1 --version 2>&1 >/dev/null if [ $? != 0 ] then echo "Please install $1 and run bootstrap.sh again!" exit 1 fi } uname -s | grep -q FreeBSD if [ $? = 0 ] then check_for_app autoconf259 check_for_app autoheader259 check_for_app automake19 check_for_app aclocal19 echo "Generating the configure script ..." aclocal19 2>/dev/null autoconf259 autoheader259 automake19 --add-missing --copy 2>/dev/null else AUTOCONF_VERSION=2.59 AUTOMAKE_VERSION=1.9 export AUTOCONF_VERSION export AUTOMAKE_VERSION check_for_app autoconf check_for_app autoheader check_for_app automake check_for_app aclocal echo "Generating the configure script ..." aclocal 2>/dev/null autoconf autoheader automake --add-missing --copy 2>/dev/null fi exit 0 dahdi-tools-2.2.0-rc2/menuselect/linkedlists.h0000664000000000000000000003075510446771713017774 0ustar rootroot/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 1999 - 2006, Digium, Inc. * * Mark Spencer * Kevin P. Fleming * * 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. */ #ifndef ASTERISK_LINKEDLISTS_H #define ASTERISK_LINKEDLISTS_H /*! \brief Defines a structure to be used to hold a list of specified type (with no lock). \param name This will be the name of the defined structure. \param type This is the type of each list entry. This macro creates a structure definition that can be used to hold a list of the entries of type \a type. It does not actually declare (allocate) a structure; to do that, either follow this macro with the desired name of the instance you wish to declare, or use the specified \a name to declare instances elsewhere. Example usage: \code static AST_LIST_HEAD_NOLOCK(entry_list, entry) entries; \endcode This would define \c struct \c entry_list, and declare an instance of it named \a entries, all intended to hold a list of type \c struct \c entry. */ #define AST_LIST_HEAD_NOLOCK(name, type) \ struct name { \ struct type *first; \ struct type *last; \ } /*! \brief Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK */ #define AST_LIST_HEAD_NOLOCK_INIT_VALUE { \ .first = NULL, \ .last = NULL, \ } /*! \brief Defines a structure to be used to hold a list of specified type, statically initialized. This is the same as AST_LIST_HEAD_STATIC, except without the lock included. */ #define AST_LIST_HEAD_NOLOCK_STATIC(name, type) \ struct name { \ struct type *first; \ struct type *last; \ } name = AST_LIST_HEAD_NOLOCK_INIT_VALUE /*! \brief Initializes a list head structure with a specified first entry. \param head This is a pointer to the list head structure \param entry pointer to the list entry that will become the head of the list This macro initializes a list head structure by setting the head entry to the supplied value. */ #define AST_LIST_HEAD_SET_NOLOCK(head, entry) do { \ (head)->first = (entry); \ (head)->last = (entry); \ } while (0) /*! \brief Declare a forward link structure inside a list entry. \param type This is the type of each list entry. This macro declares a structure to be used to link list entries together. It must be used inside the definition of the structure named in \a type, as follows: \code struct list_entry { ... AST_LIST_ENTRY(list_entry) list; } \endcode The field name \a list here is arbitrary, and can be anything you wish. */ #define AST_LIST_ENTRY(type) \ struct { \ struct type *next; \ } /*! \brief Returns the first entry contained in a list. \param head This is a pointer to the list head structure */ #define AST_LIST_FIRST(head) ((head)->first) /*! \brief Returns the last entry contained in a list. \param head This is a pointer to the list tail structure */ #define AST_LIST_LAST(head) ((head)->last) /*! \brief Returns the next entry in the list after the given entry. \param elm This is a pointer to the current entry. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. */ #define AST_LIST_NEXT(elm, field) ((elm)->field.next) /*! \brief Checks whether the specified list contains any entries. \param head This is a pointer to the list head structure Returns non-zero if the list has entries, zero if not. */ #define AST_LIST_EMPTY(head) (AST_LIST_FIRST(head) == NULL) /*! \brief Loops over (traverses) the entries in a list. \param head This is a pointer to the list head structure \param var This is the name of the variable that will hold a pointer to the current list entry on each iteration. It must be declared before calling this macro. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. This macro is use to loop over (traverse) the entries in a list. It uses a \a for loop, and supplies the enclosed code with a pointer to each list entry as it loops. It is typically used as follows: \code static AST_LIST_HEAD(entry_list, list_entry) entries; ... struct list_entry { ... AST_LIST_ENTRY(list_entry) list; } ... struct list_entry *current; ... AST_LIST_TRAVERSE(&entries, current, list) { (do something with current here) } \endcode \warning If you modify the forward-link pointer contained in the \a current entry while inside the loop, the behavior will be unpredictable. At a minimum, the following macros will modify the forward-link pointer, and should not be used inside AST_LIST_TRAVERSE() against the entry pointed to by the \a current pointer without careful consideration of their consequences: \li AST_LIST_NEXT() (when used as an lvalue) \li AST_LIST_INSERT_AFTER() \li AST_LIST_INSERT_HEAD() \li AST_LIST_INSERT_TAIL() */ #define AST_LIST_TRAVERSE(head,var,field) \ for((var) = (head)->first; (var); (var) = (var)->field.next) /*! \brief Loops safely over (traverses) the entries in a list. \param head This is a pointer to the list head structure \param var This is the name of the variable that will hold a pointer to the current list entry on each iteration. It must be declared before calling this macro. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. This macro is used to safely loop over (traverse) the entries in a list. It uses a \a for loop, and supplies the enclosed code with a pointer to each list entry as it loops. It is typically used as follows: \code static AST_LIST_HEAD(entry_list, list_entry) entries; ... struct list_entry { ... AST_LIST_ENTRY(list_entry) list; } ... struct list_entry *current; ... AST_LIST_TRAVERSE_SAFE_BEGIN(&entries, current, list) { (do something with current here) } AST_LIST_TRAVERSE_SAFE_END; \endcode It differs from AST_LIST_TRAVERSE() in that the code inside the loop can modify (or even free, after calling AST_LIST_REMOVE_CURRENT()) the entry pointed to by the \a current pointer without affecting the loop traversal. */ #define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field) { \ typeof((head)->first) __list_next; \ typeof((head)->first) __list_prev = NULL; \ typeof((head)->first) __new_prev = NULL; \ for ((var) = (head)->first, __new_prev = (var), \ __list_next = (var) ? (var)->field.next : NULL; \ (var); \ __list_prev = __new_prev, (var) = __list_next, \ __new_prev = (var), \ __list_next = (var) ? (var)->field.next : NULL \ ) /*! \brief Removes the \a current entry from a list during a traversal. \param head This is a pointer to the list head structure \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. \note This macro can \b only be used inside an AST_LIST_TRAVERSE_SAFE_BEGIN() block; it is used to unlink the current entry from the list without affecting the list traversal (and without having to re-traverse the list to modify the previous entry, if any). */ #define AST_LIST_REMOVE_CURRENT(head, field) \ __new_prev = __list_prev; \ if (__list_prev) \ __list_prev->field.next = __list_next; \ else \ (head)->first = __list_next; \ if (!__list_next) \ (head)->last = __list_prev; /*! \brief Inserts a list entry before the current entry during a traversal. \param head This is a pointer to the list head structure \param elm This is a pointer to the entry to be inserted. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. \note This macro can \b only be used inside an AST_LIST_TRAVERSE_SAFE_BEGIN() block. */ #define AST_LIST_INSERT_BEFORE_CURRENT(head, elm, field) do { \ if (__list_prev) { \ (elm)->field.next = __list_prev->field.next; \ __list_prev->field.next = elm; \ } else { \ (elm)->field.next = (head)->first; \ (head)->first = (elm); \ } \ __new_prev = (elm); \ } while (0) /*! \brief Closes a safe loop traversal block. */ #define AST_LIST_TRAVERSE_SAFE_END } /*! \brief Initializes a list head structure. \param head This is a pointer to the list head structure This macro initializes a list head structure by setting the head entry to \a NULL (empty list). There is no embedded lock handling with this macro. */ #define AST_LIST_HEAD_INIT_NOLOCK(head) { \ (head)->first = NULL; \ (head)->last = NULL; \ } /*! \brief Inserts a list entry after a given entry. \param head This is a pointer to the list head structure \param listelm This is a pointer to the entry after which the new entry should be inserted. \param elm This is a pointer to the entry to be inserted. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. */ #define AST_LIST_INSERT_AFTER(head, listelm, elm, field) do { \ (elm)->field.next = (listelm)->field.next; \ (listelm)->field.next = (elm); \ if ((head)->last == (listelm)) \ (head)->last = (elm); \ } while (0) /*! \brief Inserts a list entry at the head of a list. \param head This is a pointer to the list head structure \param elm This is a pointer to the entry to be inserted. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. */ #define AST_LIST_INSERT_HEAD(head, elm, field) do { \ (elm)->field.next = (head)->first; \ (head)->first = (elm); \ if (!(head)->last) \ (head)->last = (elm); \ } while (0) /*! \brief Appends a list entry to the tail of a list. \param head This is a pointer to the list head structure \param elm This is a pointer to the entry to be appended. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. Note: The link field in the appended entry is \b not modified, so if it is actually the head of a list itself, the entire list will be appended temporarily (until the next AST_LIST_INSERT_TAIL is performed). */ #define AST_LIST_INSERT_TAIL(head, elm, field) do { \ if (!(head)->first) { \ (head)->first = (elm); \ (head)->last = (elm); \ } else { \ (head)->last->field.next = (elm); \ (head)->last = (elm); \ } \ } while (0) /*! \brief Removes and returns the head entry from a list. \param head This is a pointer to the list head structure \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. Removes the head entry from the list, and returns a pointer to it. This macro is safe to call on an empty list. */ #define AST_LIST_REMOVE_HEAD(head, field) ({ \ typeof((head)->first) cur = (head)->first; \ if (cur) { \ (head)->first = cur->field.next; \ cur->field.next = NULL; \ if ((head)->last == cur) \ (head)->last = NULL; \ } \ cur; \ }) /*! \brief Removes a specific entry from a list. \param head This is a pointer to the list head structure \param elm This is a pointer to the entry to be removed. \param field This is the name of the field (declared using AST_LIST_ENTRY()) used to link entries of this list together. \warning The removed entry is \b not freed nor modified in any way. */ #define AST_LIST_REMOVE(head, elm, field) do { \ if ((head)->first == (elm)) { \ (head)->first = (elm)->field.next; \ if ((head)->last == (elm)) \ (head)->last = NULL; \ } else { \ typeof(elm) curelm = (head)->first; \ while (curelm && (curelm->field.next != (elm))) \ curelm = curelm->field.next; \ if (curelm) { \ curelm->field.next = (elm)->field.next; \ if ((head)->last == (elm)) \ (head)->last = curelm; \ } \ } \ (elm)->field.next = NULL; \ } while (0) #endif /* _ASTERISK_LINKEDLISTS_H */ dahdi-tools-2.2.0-rc2/menuselect/contrib/0000775000000000000000000000000011176143303016711 5ustar rootrootdahdi-tools-2.2.0-rc2/menuselect/contrib/Makefile-dummy0000664000000000000000000000036311117513256021507 0ustar rootrootall: clean: dist-clean: makeopts: menuselect: ./menuselelct # Generate some dummy files to satifsy dependencies from the main # Makefile. dummies: touch linkedlists.h menuselect.c menuselect_curses.c \ menuselect.h menuselect_stub.c dahdi-tools-2.2.0-rc2/menuselect/contrib/menuselect-dummy0000664000000000000000000003341711117513256022144 0ustar rootroot#!/usr/bin/perl -w # menuselect - a simple drop-in replacement of the batch-mode menuselect # included with Asterisk. # # Copyright (C) 2008 by Tzafrir Cohen # # 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 # Installation: copy this script to menuselect/menuselect . Copy the # included Makefile as menuselect/Makefile and run: # # make -C makefile dummies # # It takes configuration from build_tools/conf . Sample config file: # # By default all modules will be built (except those marked not be # used by default) # # # exclude: Don't try to build the following modules. # #exclude app_test # # # You can have multiple items in each line, and multiple lines. # # Each item is a perl regular expression that must match the whole # # module name. # #exclude res_config_.* # # # include: syntax is the same as exclude. Overrides exclude and # # modules that are marked as disabled by defualt: # #include res_config_sqlite3 app_skel # # # If you want to make sure some modules will be conifgured to build, # # you can require them. If modules that match any of the 'require' # # pattern are not configured to build, menuselect will panic. # # Same pattern rules apply here. Why would you want that? I have no # # idea. # #require chan_h323 app_directory # # # random - the value for this keyword is a number between 1 and # # 100. The higher it is, more chances not to include each module. # # Writes the list of modules that got hit to # # build_tools/mods_removed_random . # # Note that unlike 'make randomconfig' and such the random # # configuration changes each time you run 'make', thus if a build # # failed you should first read build_tools/mods_removed_random # # before re-running make. # #random 10 # # # Anything after a '#' is ignored, and likewise empty lines. # # Naturally. use strict; # Holds global dependncy information. Keys are module names. my %ModInfo = (); # extract configuration from kernel modules: my $AutoconfDepsFile = "build_tools/menuselect-deps"; # configuration file to read for some directives: my $ConfFile = "build_tools/conf"; # Modules removed randomely: my $RandomeModsFile = "build_tools/mods_removed_random"; my $MakedepsFile = "menuselect.makedeps"; my $MakeoptsFile = "menuselect.makeopts"; # If those modules are not present, the build will fail (PCRE patterns) my @RequiredModules = (); my @Subdirs = qw/apps cdr channels codecs formats funcs main pbx res utils/; my @XmlCategories = 'cflags'; # Modules should not bother building (PCRE patterns) my @ExcludedModules = (); # Do try building those. Overrides 'exclude' and 'defaultenable: no' my @IncludedModules = (); # A chance to rule-out a module randomely. my $RandomKnockoutFactor = 0; sub warning($) { my $msg = shift; print STDERR "$0: Warning: $msg\n"; } # Convert XML syntax to mail-header-like syntax: # value --> Var: value sub extract_xml_key($) { my $xml_line = shift; if ($xml_line !~ m{^\s*<([a-zA-Z0-9]*)>([^<]*)}) { warning "parsed empty value from XML line $xml_line"; return ('', ''); # warn? } my ($var, $val) = ($1, $2); $var =~ s{^[a-z]}{\u$&}; return ($var, $val); } # Get information embedded in source files from a subdirectory. # First parameter is the subdirectory and further ones are the actual # source files. sub get_subdir_module_info { my $subdir = shift; my @files = @_; my $dir = uc($subdir); foreach my $src (@files) { open SRC,$src or die "Can't read from source file $src: $!\n"; $src =~ m|.*/([^/]*)\.c|; my $mod_name = $1; my %data = ( Type=>'module', Module=>$mod_name, Dir=> $dir, Avail=>1 ); while () { next unless (m|^/\*\*\* MODULEINFO| .. m|^ ?\*\*\*/|); next unless (m|^[A-Z]| || m|^\s*<|); # At this point we can assume we're in the module # info section. chomp; my ($var, $val) = extract_xml_key($_); if ($var =~ /^(Depend|Use)$/i) { # use uppercase for dependency names; $val = uc($val); } if ( ! exists $data{$var} ) { $data{$var} = [$val]; } else { push @{$data{$var}},($val); } } close SRC; $ModInfo{uc($mod_name)} = \%data; } } # extract embedded information in all the source tree. sub extract_subdirs { for my $subdir(@_) { get_subdir_module_info($subdir, <$subdir/*.c> , <$subdir/*.cc>); } } # parse a partial XML document that is included as an input # for menuselect in a few places. Naturally a full-fledged XML parsing # will not be done here. A line-based parsing that happens to work will # have to do. sub parse_menuselect_xml_file($) { my $file_name = shift; open XML,$file_name or die "Failed opening XML file $file_name: $!.\n"; my $header = ; $header =~ /^\s*){ next unless (m{^\s*<(/?[a-z]+)[>\s]}); my $tag = $1; if ($tag eq 'member') { if (! m{^\s*}){ warning "Bad XML member line: $_ ($file_name:$.)\n"; next; } my ($name, $display_name) = ($1, $2); $member = { Type => 'XML', Dir => $category, Module => $1, DisplayName => $2, Avail => 1, }; } elsif ($tag eq '/member') { $ModInfo{$member->{Module}} = $member; } elsif ($tag eq '/category') { last; } else { if (! m/^\s*<([a-z]+)>([^<]+){$key}) { $member->{$key} = []; } push @{$member->{$key}}, ($val); } } close XML; } # Dump our data structure to a file. sub dump_deps($) { my $file = shift; open OUTPUT,">$file" or die "cannot open category file $file for writing: $!\n"; foreach my $mod_name (sort keys %ModInfo) { print OUTPUT "Key: $mod_name\n"; my $data = $ModInfo{$mod_name}; foreach my $var (sort keys %{$data} ) { my $val = $$data{$var}; if (ref($val) eq 'ARRAY') { print OUTPUT $var.": ". (join ", ", @$val)."\n"; } else { print OUTPUT "$var: $val\n"; } } print OUTPUT "\n"; } close OUTPUT; } # Get the available libraries that autoconf generated. sub get_autoconf_deps() { open DEPS, $AutoconfDepsFile or die "Failed to open $AutoconfDepsFile. Aborting: $!\n"; my @deps_list = (); foreach (@deps_list){ chomp; my ($lib, $avail) = split(/=/); $ModInfo{$lib} = {Type=>'lib', Avail=>$avail}; if (($avail ne "0") && ($avail ne "1")) { warning "Library $lib has invalid availability ". "value <$avail> (check $AutoconfDepsFile).\n"; } } close DEPS; } # Read our specific config file. # # Its format: # # keyword values # # values are always a spaces-separated list. sub read_conf() { open CONF,$ConfFile or return; while () { # remove comments and empty lines: chomp; s/#.*$//; next if /^\s*$/; my ($keyword, @value) = split; if ($keyword eq 'exclude') { push @ExcludedModules, @value; } elsif ($keyword eq 'include') { push @IncludedModules, @value; } elsif ($keyword eq 'require') { push @RequiredModules, @value; } elsif ($keyword eq 'random') { $RandomKnockoutFactor = $value[0] / 100; } else { warning "unknown keyword $keyword in line $. of $ConfFile."; } } } # generate menuselect.makedeps. # In this file menuselect writes dependecies of each module. CFLAGS will # then automatically include for each module the _INCLUDE and LDFLAGS # will include the _LIBS from all the depedencies of the module. sub gen_makedeps() { open MAKEDEPSS, ">$MakedepsFile" or die "Failed to open deps file $MakedepsFile for writing. Aborting: $!\n"; for my $mod_name (sort keys %ModInfo) { next unless ($ModInfo{$mod_name}{Type} eq 'module'); my $mod = $ModInfo{$mod_name}; my @deps = (); # if we have Depend or Use, put their values into # @deps . If we have none, move on. push @deps, @{$mod->{Depend}} if (exists $mod->{Depend}); push @deps, @{$mod->{Use}} if (exists $mod->{Use}); next unless @deps; # TODO: don't print dependencies that are not external libs. # Not done yet until I figure out if this is safe. my $dep = join(' ', @deps); print MAKEDEPSS "MENUSELECT_DEPENDS_".$mod->{Module}."=$dep\n"; } close MAKEDEPSS; } # Set modules from patterns specified by 'exclude' in the configuration file # to exclude modules from building (mark them as unavailable). sub apply_excluded_patterns() { foreach my $pattern (@ExcludedModules) { my @excluded = grep {/^$pattern$/i} (keys %ModInfo); foreach (@excluded) { $ModInfo{$_}{Avail} = 0; } } } # Set modules from patterns specified by 'include' in the configuration # file to exclude from building (mark them as available). sub apply_included_patterns() { foreach my $pattern (@IncludedModules) { my @included = grep {/^$pattern$/i} (keys %ModInfo); foreach (@included) { $ModInfo{$_}{Avail} = 1; } } } # If user set the "random" config to anything > 0, drop some random # modules. May help expose wrong dependencies. sub apply_random_drop() { return if ($RandomKnockoutFactor <= 0); open MODS_LIST, ">$RandomeModsFile" or die "Failed to open modules list file $RandomeModsFile for writing. Aborting: $!\n"; for my $mod (keys %ModInfo) { next unless ($ModInfo{$mod}{Type} eq 'module'); next unless (rand() < $RandomKnockoutFactor); $ModInfo{$mod}{Avail} = 0; $ModInfo{$mod}{RandomKill} = 1; print MODS_LIST $ModInfo{$mod}{Module}."\n"; } close MODS_LIST; } sub check_required_patterns() { my @failed = (); foreach my $pattern (@RequiredModules) { my @required = grep {/^$pattern$/i} (keys %ModInfo); foreach my $mod (@required) { if ((! exists $ModInfo{$mod}{Checked}) || (! $ModInfo{$mod}{Checked}) ) { push @failed, $mod; } } } return unless (@failed); my $failed_str = join ' ',@failed; die("Missing dependencies for the following modules: $failed_str\n"); } # Disable building for modules that were marked in the embedded module # information as disabled for building by default. sub apply_default_enabled() { foreach my $mod (keys %ModInfo) { if ((exists $ModInfo{$mod}{Defaultenabled}) && $ModInfo{$mod}{Defaultenabled}[0] eq 'no') { $ModInfo{$mod}{Avail} = 0; } } } # recursively check dependency for a module. # # We run a scan for modules. Modules marked as 'Checked' are ones we # have already fully verified to have proper dependencies. # # We can only use a module or library marked as Avail => 1 (library # available or module not excluded). sub check_module($); sub check_module($) { my $mod = shift; # we checked it: if (exists $ModInfo{$mod}{Checked}) { return $ModInfo{$mod}{Checked}; } # A library has no dependencies of its own. if ($ModInfo{$mod}{Type} eq 'lib') { return ($ModInfo{$mod}{Avail} || 0); } # An excluded module. if ($ModInfo{$mod}{Avail} == 0) { return 0; } # XML inputs have a reversed logic: no 'defaultenabled' means 'no' # And we need to actually print enabled ones, rather than disabled # ones. if ($ModInfo{$mod}{Type} eq 'XML') { my $res = ((not exists $ModInfo{$mod}{Defaultenabled}) || ($ModInfo{$mod}{Defaultenabled}[0] ne 'yes') ); $ModInfo{$mod}{Checked} = $res; return $res; } # no dependencies to check: if (! exists $ModInfo{$mod}{Depend}) { $ModInfo{$mod}{Checked} = 1; return 1; } my $deps_checked = 1; # may be reset below on failures: if (exists $ModInfo{$mod}{Tested}) { # this probably means a circular dependency of some sort. warning "Got to module $mod that is already tested."; } $ModInfo{$mod}{Tested} = 1; foreach my $dep_mod (@{$ModInfo{$mod}{Depend}} ) { if (!exists ${ModInfo}{$dep_mod}) { # TODO: die here? This should never happen. warning "module $mod depends on $dep_mod that does not exist."; next; } $deps_checked &= check_module($dep_mod); last if(!$deps_checked) # no point testing further if we failed. } $ModInfo{$mod}{Checked} = $deps_checked; return $deps_checked; } # The main dependency resolver function. sub resolve_deps() { apply_default_enabled(); apply_excluded_patterns(); apply_included_patterns(); foreach my $mod (keys %ModInfo) { check_module($mod); } } # generate menuselect.makeopts. Please let me know if some parts are # still missing. sub gen_makeopts() { open MAKEDEPS, ">$MakeoptsFile" or die "Failed to open opts file $MakeoptsFile for writing. Aborting: $!\n"; my %Subdirs; foreach my $mod (sort keys %ModInfo) { next unless ($ModInfo{$mod}{Type} =~ /^(module|XML)$/); next if ($ModInfo{$mod}{Checked}); my $dir = $ModInfo{$mod}{Dir}; if (! exists $Subdirs{$dir}) { $Subdirs{$dir} = []; } push @{$Subdirs{$dir}},( $ModInfo{$mod}{Module} ); } foreach my $dir (sort keys %Subdirs) { my $deps = join(' ', @{$Subdirs{$dir}}); print MAKEDEPS "MENUSELECT_$dir=$deps\n"; } close MAKEDEPS; } # # The main program start here # read_conf(); extract_subdirs(@Subdirs); parse_menuselect_xml_file('build_tools/cflags.xml'); parse_menuselect_xml_file('sounds/sounds.xml'); apply_random_drop(); get_autoconf_deps(); #dump_deps('build_tools/dump_deps_before_resolve'); resolve_deps(); # Handy debugging: dump_deps('build_tools/dump_deps'); check_required_patterns(); gen_makedeps(); gen_makeopts(); dahdi-tools-2.2.0-rc2/menuselect/configure.ac0000664000000000000000000000413311074126326017543 0ustar rootroot# Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) m4_define([MENUSELECT_VERSION], m4_bpatsubst(m4_esyscmd([./make_version .]), [\([0-9.]*\)\(\w\|\W\)*], [\1])) AC_INIT(menuselect, MENUSELECT_VERSION, www.asterisk.org) # check existence of the package AC_CONFIG_SRCDIR([menuselect.c]) # specify output header file AC_CONFIG_HEADER(autoconfig.h) AC_COPYRIGHT("Menuselect") AC_REVISION($Revision: 40837 $) AC_CANONICAL_BUILD AC_CANONICAL_HOST HOST_OS=${host_os} AC_SUBST(HOST_OS) AH_TOP( #ifndef MENUSELECT_AUTOCONFIG_H #define MENUSELECT_AUTOCONFIG_H #ifndef _REENTRANT #define _REENTRANT #endif ) AH_BOTTOM( #endif ) # Checks for programs. AC_PROG_CC AST_CHECK_GNU_MAKE AC_LANG(C) AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Turn on debug mode])], [case "${enableval}" in y|ye|yes) MENUSELECT_DEBUG=yes ;; n|no) MENUSELECT_DEBUG=no ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; esac]) AC_SUBST(MENUSELECT_DEBUG) AC_CHECK_FUNCS([asprintf getloadavg setenv strcasestr strndup strnlen strsep strtoq unsetenv vasprintf]) # The frontend can use curses, ncurses, newt or GTK2 so check for all of them AST_EXT_LIB_SETUP([NEWT], [newt], [newt]) AST_EXT_LIB_SETUP([CURSES], [curses], [curses]) AST_EXT_LIB_SETUP([NCURSES], [ncurses], [ncurses]) AST_EXT_LIB_CHECK([NEWT], [newt], [newtBell], [newt.h]) AST_EXT_LIB_CHECK([CURSES], [curses], [initscr], [curses.h]) AST_EXT_LIB_CHECK([NCURSES], [ncurses], [initscr], [curses.h]) PBX_GTK2=0 AC_CHECK_TOOL(PKGCONFIG, pkg-config, No) if test ! "x${PKGCONFIG}" = xNo; then GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null) GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs) PBX_GTK2=1 AC_DEFINE([HAVE_GTK2], 1, [Define if your system has the GTK2 libraries.]) fi AC_SUBST(PBX_GTK2) AC_SUBST(GTK2_INCLUDE) AC_SUBST(GTK2_LIB) test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent" AC_CONFIG_FILES([makeopts]) AC_CONFIG_SUBDIRS([mxml]) AC_OUTPUT AC_MSG_NOTICE(Menuselect build configuration successfully completed) dahdi-tools-2.2.0-rc2/menuselect/menuselect_newt.c0000664000000000000000000002134711073420655020631 0ustar rootroot/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 2008 Sean Bright * * Sean Bright * * 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 * * \author Sean Bright * * \brief newt frontend for selection maintenance */ #include #include #include #include #include "menuselect.h" #define MIN_X 80 #define MIN_Y 21 extern int changes_made; static newtComponent rootOptions; static newtComponent subOptions; static newtComponent memberNameTextbox; static newtComponent dependsLabel; static newtComponent usesLabel; static newtComponent conflictsLabel; static newtComponent dependsDataTextbox; static newtComponent usesDataTextbox; static newtComponent conflictsDataTextbox; static newtComponent exitButton; static newtComponent saveAndExitButton; static void build_members_menu(int overlay); static void root_menu_callback(newtComponent component, void *data); static void toggle_all_options(int select) { struct category *cat = newtListboxGetCurrent(rootOptions); set_all(cat, select); /* Redraw */ build_members_menu(1); return; } static void toggle_selected_option() { struct member *mem = newtListboxGetCurrent(subOptions); toggle_enabled(mem); /* Redraw */ build_members_menu(1); return; } static void reset_display() { newtTextboxSetText(memberNameTextbox, ""); newtTextboxSetText(dependsDataTextbox, ""); newtTextboxSetText(usesDataTextbox, ""); newtTextboxSetText(conflictsDataTextbox, ""); newtRefresh(); } static void display_member_info(struct member *mem) { char buffer[128] = { 0 }; struct depend *dep; struct conflict *con; struct use *uses; reset_display(); if (mem->displayname) { newtTextboxSetText(memberNameTextbox, mem->displayname); } if (AST_LIST_EMPTY(&mem->deps)) { newtTextboxSetText(dependsDataTextbox, "N/A"); } else { strcpy(buffer, ""); AST_LIST_TRAVERSE(&mem->deps, dep, list) { strncat(buffer, dep->displayname, sizeof(buffer) - strlen(buffer) - 1); strncat(buffer, dep->member ? "(M)" : "(E)", sizeof(buffer) - strlen(buffer) - 1); if (AST_LIST_NEXT(dep, list)) strncat(buffer, ", ", sizeof(buffer) - strlen(buffer) - 1); } newtTextboxSetText(dependsDataTextbox, buffer); } if (AST_LIST_EMPTY(&mem->uses)) { newtTextboxSetText(usesDataTextbox, "N/A"); } else { strcpy(buffer, ""); AST_LIST_TRAVERSE(&mem->uses, uses, list) { strncat(buffer, uses->displayname, sizeof(buffer) - strlen(buffer) - 1); if (AST_LIST_NEXT(uses, list)) strncat(buffer, ", ", sizeof(buffer) - strlen(buffer) - 1); } newtTextboxSetText(usesDataTextbox, buffer); } if (AST_LIST_EMPTY(&mem->conflicts)) { newtTextboxSetText(conflictsDataTextbox, "N/A"); } else { strcpy(buffer, ""); AST_LIST_TRAVERSE(&mem->conflicts, con, list) { strncat(buffer, con->displayname, sizeof(buffer) - strlen(buffer) - 1); strncat(buffer, con->member ? "(M)" : "(E)", sizeof(buffer) - strlen(buffer) - 1); if (AST_LIST_NEXT(con, list)) strncat(buffer, ", ", sizeof(buffer) - strlen(buffer) - 1); } newtTextboxSetText(conflictsDataTextbox, buffer); } return; } static void build_members_menu(int overlay) { struct category *cat; struct member *mem; char buf[64]; int i = 0; if (!overlay) { reset_display(); newtListboxClear(subOptions); } cat = newtListboxGetCurrent(rootOptions); AST_LIST_TRAVERSE(&cat->members, mem, list) { if ((mem->depsfailed == HARD_FAILURE) || (mem->conflictsfailed == HARD_FAILURE)) { snprintf(buf, sizeof(buf), "XXX %s", mem->name); } else if (mem->depsfailed == SOFT_FAILURE) { snprintf(buf, sizeof(buf), "<%s> %s", mem->enabled ? "*" : " ", mem->name); } else if (mem->conflictsfailed == SOFT_FAILURE) { snprintf(buf, sizeof(buf), "(%s) %s", mem->enabled ? "*" : " ", mem->name); } else { snprintf(buf, sizeof(buf), "[%s] %s", mem->enabled ? "*" : " ", mem->name); } if (overlay) { newtListboxSetEntry(subOptions, i, buf); } else { newtListboxAppendEntry(subOptions, buf, mem); } i++; } if (!overlay) { display_member_info(AST_LIST_FIRST(&cat->members)); } return; } static void build_main_menu() { struct category *cat; char buf[64]; int i = 1; newtListboxClear(rootOptions); AST_LIST_TRAVERSE(&categories, cat, list) { if (!strlen_zero(cat->displayname)) snprintf(buf, sizeof(buf), " %s ", cat->displayname); else snprintf(buf, sizeof(buf), " %s ", cat->name); newtListboxAppendEntry(rootOptions, buf, cat); i++; } } static void category_menu_callback(newtComponent component, void *data) { display_member_info(newtListboxGetCurrent(subOptions)); } static void root_menu_callback(newtComponent component, void *data) { build_members_menu(0); } int run_confirmation_dialog(int *result) { int res = newtWinTernary("Are You Sure?", "Discard changes & Exit", "Save & Exit", "Cancel", "It appears you have made some changes, and you have opted to Quit " "without saving these changes. Please choose \"Discard changes & Exit\" to exit " "without saving; Choose \"Cancel\" to cancel your decision to quit, and keep " "working in menuselect, or choose \"Save & Exit\" to save your changes, and exit."); switch (res) { case 1: /* Discard and exit */ *result = -1; return 1; case 2: /* Save and exit */ *result = 0; return 1; case 3: /* They either chose "No" or they hit F12 */ default: *result = -1; return 0; } } int run_menu(void) { struct newtExitStruct es; newtComponent form; int x = 0, y = 0, res = 0; newtInit(); newtCls(); newtGetScreenSize(&x, &y); if (x < MIN_X || y < MIN_Y) { newtFinished(); fprintf(stderr, "Terminal must be at least %d x %d.\n", MIN_X, MIN_Y); return -1; } newtPushHelpLine(" toggles selection | saves & exits | exits without save"); newtRefresh(); newtCenteredWindow(x - 8, y - 7, menu_name); form = newtForm(NULL, NULL, 0); /* F8 for select all */ newtFormAddHotKey(form, NEWT_KEY_F8); /* F7 for deselect all */ newtFormAddHotKey(form, NEWT_KEY_F7); newtFormSetTimer(form, 200); rootOptions = newtListbox(2, 1, y - 15, 0); newtListboxSetWidth(rootOptions, 29); newtFormAddComponent(form, rootOptions); newtComponentAddCallback(rootOptions, root_menu_callback, NULL); subOptions = newtListbox(33, 1, y - 15, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT); newtListboxSetWidth(subOptions, x - 42); newtFormAddComponent(form, subOptions); newtComponentAddCallback(subOptions, category_menu_callback, NULL); memberNameTextbox = newtTextbox(2, y - 13, x - 10, 1, 0); dependsLabel = newtLabel(2, y - 11, " Depends on:"); usesLabel = newtLabel(2, y - 10, " Can use:"); conflictsLabel = newtLabel(2, y - 9, "Conflicts with:"); dependsDataTextbox = newtTextbox(18, y - 11, x - 27, 1, 0); usesDataTextbox = newtTextbox(18, y - 10, x - 27, 1, 0); conflictsDataTextbox = newtTextbox(18, y - 9, x - 27, 1, 0); exitButton = newtButton(x - 23, y - 11, " Exit "); saveAndExitButton = newtButton(x - 43, y - 11, " Save & Exit "); newtFormAddComponents( form, memberNameTextbox, dependsLabel, dependsDataTextbox, usesLabel, usesDataTextbox, conflictsLabel, conflictsDataTextbox, saveAndExitButton, exitButton, NULL); build_main_menu(); root_menu_callback(rootOptions, AST_LIST_FIRST(&categories)); for (;;) { do { newtFormRun(form, &es); } while (es.reason == NEWT_EXIT_TIMER); if (es.reason == NEWT_EXIT_HOTKEY) { int done = 1; switch (es.u.key) { case NEWT_KEY_F12: res = 0; break; case NEWT_KEY_F7: toggle_all_options(0); done = 0; break; case NEWT_KEY_F8: toggle_all_options(1); done = 0; break; case NEWT_KEY_ESCAPE: if (changes_made) { done = run_confirmation_dialog(&res); } else { res = -1; } break; default: done = 0; break; } if (done) { break; } } else if (es.reason == NEWT_EXIT_COMPONENT) { if (es.u.co == saveAndExitButton) { res = 0; break; } else if (es.u.co == exitButton) { int done = 1; if (changes_made) { done = run_confirmation_dialog(&res); } else { res = -1; } if (done) { break; } } else if (es.u.co == subOptions) { toggle_selected_option(); } } } /* Cleanup */ reset_display(); newtFormDestroy(form); newtPopWindow(); newtPopHelpLine(); newtCls(); newtFinished(); return res; } dahdi-tools-2.2.0-rc2/menuselect/autoconfig.h.in0000664000000000000000000000464110763621520020175 0ustar rootroot/* autoconfig.h.in. Generated from configure.ac by autoheader. */ #ifndef MENUSELECT_AUTOCONFIG_H #define MENUSELECT_AUTOCONFIG_H #ifndef _REENTRANT #define _REENTRANT #endif /* Define to 1 if you have the `asprintf' function. */ #undef HAVE_ASPRINTF /* Define to indicate the ${CURSES_DESCRIP} library */ #undef HAVE_CURSES /* Define to 1 if you have the `getloadavg' function. */ #undef HAVE_GETLOADAVG /* Define if your system has the GTK2 libraries. */ #undef HAVE_GTK2 /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to indicate the ${NCURSES_DESCRIP} library */ #undef HAVE_NCURSES /* Define to indicate the ${NEWT_DESCRIP} library */ #undef HAVE_NEWT /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strndup' function. */ #undef HAVE_STRNDUP /* Define to 1 if you have the `strnlen' function. */ #undef HAVE_STRNLEN /* Define to 1 if you have the `strsep' function. */ #undef HAVE_STRSEP /* Define to 1 if you have the `strtoq' function. */ #undef HAVE_STRTOQ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `unsetenv' function. */ #undef HAVE_UNSETENV /* Define to 1 if you have the `vasprintf' function. */ #undef HAVE_VASPRINTF /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS #endif dahdi-tools-2.2.0-rc2/menuselect/aclocal.m40000664000000000000000000000113710472743350017121 0ustar rootroot# generated automatically by aclocal 1.9.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_include([acinclude.m4]) dahdi-tools-2.2.0-rc2/menuselect/configure0000775000000000000000000054476611074126326017211 0ustar rootroot#! /bin/sh # From configure.ac Revision: 40837 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # "Menuselect" ## --------------------- ## ## 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 emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh 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 # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$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 IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } 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 done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no 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 } 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. 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 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 /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac 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. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (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 } 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. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi 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=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="menuselect" ac_unique_file="menuselect.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias build build_cpu build_vendor build_os host host_cpu host_vendor host_os HOST_OS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT GNU_MAKE MENUSELECT_DEBUG NEWT_LIB NEWT_INCLUDE PBX_NEWT CURSES_LIB CURSES_INCLUDE PBX_CURSES NCURSES_LIB NCURSES_INCLUDE PBX_NCURSES CPP GREP EGREP PKGCONFIG PBX_GTK2 GTK2_INCLUDE GTK2_LIB subdirs LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' ac_subdirs_all='mxml' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --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 --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 --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-debug Turn on debug mode Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-newt=PATH use newt files in PATH --with-curses=PATH use curses files in PATH --with-ncurses=PATH use ncurses files in PATH Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. "Menuselect" _ACEOF exit fi 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 $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$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; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* 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 # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # check existence of the package # specify output header file ac_config_headers="$ac_config_headers autoconfig.h" ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} { (exit 1); exit 1; }; } { echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6; } if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 echo "$as_me: error: invalid value of canonical build" >&2;} { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6; } if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } fi fi { echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 echo "$as_me: error: invalid value of canonical host" >&2;} { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac HOST_OS=${host_os} # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 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 /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for GNU make" >&5 echo $ECHO_N "checking for GNU make... $ECHO_C" >&6; } if test "${GNU_MAKE+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else GNU_MAKE='Not Found' ; GNU_MAKE_VERSION_MAJOR=0 ; GNU_MAKE_VERSION_MINOR=0 ; for a in make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then GNU_MAKE=$a ; GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'` GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` break; fi done ; fi { echo "$as_me:$LINENO: result: $GNU_MAKE" >&5 echo "${ECHO_T}$GNU_MAKE" >&6; } ; if test "x$GNU_MAKE" = "xNot Found" ; then { { echo "$as_me:$LINENO: error: *** Please install GNU make. It is required to build Asterisk!" >&5 echo "$as_me: error: *** Please install GNU make. It is required to build Asterisk!" >&2;} { (exit 1); exit 1; }; } exit 1 fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; case "${enableval}" in y|ye|yes) MENUSELECT_DEBUG=yes ;; n|no) MENUSELECT_DEBUG=no ;; *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-debug" >&5 echo "$as_me: error: bad value ${enableval} for --enable-debug" >&2;} { (exit 1); exit 1; }; } ;; esac fi for ac_func in asprintf getloadavg setenv strcasestr strndup strnlen strsep strtoq unsetenv vasprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 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 declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done # The frontend can use curses, ncurses, newt or GTK2 so check for all of them NEWT_DESCRIP="newt" NEWT_OPTION="newt" # Check whether --with-newt was given. if test "${with_newt+set}" = set; then withval=$with_newt; case ${withval} in n|no) USE_NEWT=no ;; y|ye|yes) NEWT_MANDATORY="yes" ;; *) NEWT_DIR="${withval}" NEWT_MANDATORY="yes" ;; esac fi PBX_NEWT=0 CURSES_DESCRIP="curses" CURSES_OPTION="curses" # Check whether --with-curses was given. if test "${with_curses+set}" = set; then withval=$with_curses; case ${withval} in n|no) USE_CURSES=no ;; y|ye|yes) CURSES_MANDATORY="yes" ;; *) CURSES_DIR="${withval}" CURSES_MANDATORY="yes" ;; esac fi PBX_CURSES=0 NCURSES_DESCRIP="ncurses" NCURSES_OPTION="ncurses" # Check whether --with-ncurses was given. if test "${with_ncurses+set}" = set; then withval=$with_ncurses; case ${withval} in n|no) USE_NCURSES=no ;; y|ye|yes) NCURSES_MANDATORY="yes" ;; *) NCURSES_DIR="${withval}" NCURSES_MANDATORY="yes" ;; esac fi PBX_NCURSES=0 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err 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 /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err 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 /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" 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` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" 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` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done if test "${USE_NEWT}" != "no"; then pbxlibdir="" if test "x${NEWT_DIR}" != "x"; then if test -d ${NEWT_DIR}/lib; then pbxlibdir="-L${NEWT_DIR}/lib" else pbxlibdir="-L${NEWT_DIR}" fi fi { echo "$as_me:$LINENO: checking for newtBell in -lnewt" >&5 echo $ECHO_N "checking for newtBell in -lnewt... $ECHO_C" >&6; } if test "${ac_cv_lib_newt_newtBell+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 /* 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 newtBell (); int main () { return newtBell (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_newt_newtBell=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_newt_newtBell=no fi 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 { echo "$as_me:$LINENO: result: $ac_cv_lib_newt_newtBell" >&5 echo "${ECHO_T}$ac_cv_lib_newt_newtBell" >&6; } if test $ac_cv_lib_newt_newtBell = yes; then AST_NEWT_FOUND=yes else AST_NEWT_FOUND=no fi if test "${AST_NEWT_FOUND}" = "yes"; then NEWT_LIB="-lnewt " NEWT_HEADER_FOUND="1" if test "x${NEWT_DIR}" != "x"; then NEWT_LIB="${pbxlibdir} ${NEWT_LIB}" NEWT_INCLUDE="-I${NEWT_DIR}/include" if test "xnewt.h" != "x" ; then as_ac_Header=`echo "ac_cv_header_${NEWT_DIR}/include/newt.h" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5 echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h usability" >&5 echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <${NEWT_DIR}/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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking ${NEWT_DIR}/include/newt.h presence" >&5 echo $ECHO_N "checking ${NEWT_DIR}/include/newt.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <${NEWT_DIR}/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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: ${NEWT_DIR}/include/newt.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for ${NEWT_DIR}/include/newt.h" >&5 echo $ECHO_N "checking for ${NEWT_DIR}/include/newt.h... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then NEWT_HEADER_FOUND=1 else NEWT_HEADER_FOUND=0 fi fi else if test "xnewt.h" != "x" ; then if test "${ac_cv_header_newt_h+set}" = set; then { echo "$as_me:$LINENO: checking for newt.h" >&5 echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; } if test "${ac_cv_header_newt_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5 echo "${ECHO_T}$ac_cv_header_newt_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking newt.h usability" >&5 echo $ECHO_N "checking newt.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking newt.h presence" >&5 echo $ECHO_N "checking newt.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: newt.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: newt.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: newt.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: newt.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: newt.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: newt.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: newt.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: newt.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: newt.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: newt.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: newt.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: newt.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: newt.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: newt.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for newt.h" >&5 echo $ECHO_N "checking for newt.h... $ECHO_C" >&6; } if test "${ac_cv_header_newt_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_newt_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_newt_h" >&5 echo "${ECHO_T}$ac_cv_header_newt_h" >&6; } fi if test $ac_cv_header_newt_h = yes; then NEWT_HEADER_FOUND=1 else NEWT_HEADER_FOUND=0 fi fi fi if test "x${NEWT_HEADER_FOUND}" = "x0" ; then if test ! -z "${NEWT_MANDATORY}" ; then { echo "$as_me:$LINENO: ***" >&5 echo "$as_me: ***" >&6;} { echo "$as_me:$LINENO: *** It appears that you do not have the newt development package installed." >&5 echo "$as_me: *** It appears that you do not have the newt development package installed." >&6;} { echo "$as_me:$LINENO: *** Please install it to include ${NEWT_DESCRIP} support" >&5 echo "$as_me: *** Please install it to include ${NEWT_DESCRIP} support" >&or re-run configure;} { echo "$as_me:$LINENO: *** without explicitly specifying --with-${NEWT_OPTION}" >&5 echo "$as_me: *** without explicitly specifying --with-${NEWT_OPTION}" >&6;} exit 1 fi NEWT_LIB="" NEWT_INCLUDE="" PBX_NEWT=0 else PBX_NEWT=1 cat >>confdefs.h <<_ACEOF #define HAVE_NEWT 1 _ACEOF fi elif test ! -z "${NEWT_MANDATORY}"; then { echo "$as_me:$LINENO: ***" >&5 echo "$as_me: ***" >&6;} { echo "$as_me:$LINENO: *** The ${NEWT_DESCRIP} installation on this system appears to be broken." >&5 echo "$as_me: *** The ${NEWT_DESCRIP} installation on this system appears to be broken." >&6;} { echo "$as_me:$LINENO: *** Either correct the installation" >&5 echo "$as_me: *** Either correct the installation" >&or run configure;} { echo "$as_me:$LINENO: *** without explicitly specifying --with-${NEWT_OPTION}" >&5 echo "$as_me: *** without explicitly specifying --with-${NEWT_OPTION}" >&6;} exit 1 fi fi if test "${USE_CURSES}" != "no"; then pbxlibdir="" if test "x${CURSES_DIR}" != "x"; then if test -d ${CURSES_DIR}/lib; then pbxlibdir="-L${CURSES_DIR}/lib" else pbxlibdir="-L${CURSES_DIR}" fi fi { echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5 echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; } if test "${ac_cv_lib_curses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 /* 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 initscr (); int main () { return initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_curses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_initscr=no fi 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 { echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; } if test $ac_cv_lib_curses_initscr = yes; then AST_CURSES_FOUND=yes else AST_CURSES_FOUND=no fi if test "${AST_CURSES_FOUND}" = "yes"; then CURSES_LIB="-lcurses " CURSES_HEADER_FOUND="1" if test "x${CURSES_DIR}" != "x"; then CURSES_LIB="${pbxlibdir} ${CURSES_LIB}" CURSES_INCLUDE="-I${CURSES_DIR}/include" if test "xcurses.h" != "x" ; then as_ac_Header=`echo "ac_cv_header_${CURSES_DIR}/include/curses.h" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h usability" >&5 echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <${CURSES_DIR}/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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking ${CURSES_DIR}/include/curses.h presence" >&5 echo $ECHO_N "checking ${CURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <${CURSES_DIR}/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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: ${CURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for ${CURSES_DIR}/include/curses.h" >&5 echo $ECHO_N "checking for ${CURSES_DIR}/include/curses.h... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then CURSES_HEADER_FOUND=1 else CURSES_HEADER_FOUND=0 fi fi else if test "xcurses.h" != "x" ; then if test "${ac_cv_header_curses_h+set}" = set; then { echo "$as_me:$LINENO: checking for curses.h" >&5 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } if test "${ac_cv_header_curses_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking curses.h usability" >&5 echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking curses.h presence" >&5 echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: curses.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for curses.h" >&5 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } if test "${ac_cv_header_curses_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_curses_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } fi if test $ac_cv_header_curses_h = yes; then CURSES_HEADER_FOUND=1 else CURSES_HEADER_FOUND=0 fi fi fi if test "x${CURSES_HEADER_FOUND}" = "x0" ; then if test ! -z "${CURSES_MANDATORY}" ; then { echo "$as_me:$LINENO: ***" >&5 echo "$as_me: ***" >&6;} { echo "$as_me:$LINENO: *** It appears that you do not have the curses development package installed." >&5 echo "$as_me: *** It appears that you do not have the curses development package installed." >&6;} { echo "$as_me:$LINENO: *** Please install it to include ${CURSES_DESCRIP} support" >&5 echo "$as_me: *** Please install it to include ${CURSES_DESCRIP} support" >&or re-run configure;} { echo "$as_me:$LINENO: *** without explicitly specifying --with-${CURSES_OPTION}" >&5 echo "$as_me: *** without explicitly specifying --with-${CURSES_OPTION}" >&6;} exit 1 fi CURSES_LIB="" CURSES_INCLUDE="" PBX_CURSES=0 else PBX_CURSES=1 cat >>confdefs.h <<_ACEOF #define HAVE_CURSES 1 _ACEOF fi elif test ! -z "${CURSES_MANDATORY}"; then { echo "$as_me:$LINENO: ***" >&5 echo "$as_me: ***" >&6;} { echo "$as_me:$LINENO: *** The ${CURSES_DESCRIP} installation on this system appears to be broken." >&5 echo "$as_me: *** The ${CURSES_DESCRIP} installation on this system appears to be broken." >&6;} { echo "$as_me:$LINENO: *** Either correct the installation" >&5 echo "$as_me: *** Either correct the installation" >&or run configure;} { echo "$as_me:$LINENO: *** without explicitly specifying --with-${CURSES_OPTION}" >&5 echo "$as_me: *** without explicitly specifying --with-${CURSES_OPTION}" >&6;} exit 1 fi fi if test "${USE_NCURSES}" != "no"; then pbxlibdir="" if test "x${NCURSES_DIR}" != "x"; then if test -d ${NCURSES_DIR}/lib; then pbxlibdir="-L${NCURSES_DIR}/lib" else pbxlibdir="-L${NCURSES_DIR}" fi fi { echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6; } if test "${ac_cv_lib_ncurses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&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 /* 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 initscr (); int main () { return initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_ncurses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_initscr=no fi 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 { echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; } if test $ac_cv_lib_ncurses_initscr = yes; then AST_NCURSES_FOUND=yes else AST_NCURSES_FOUND=no fi if test "${AST_NCURSES_FOUND}" = "yes"; then NCURSES_LIB="-lncurses " NCURSES_HEADER_FOUND="1" if test "x${NCURSES_DIR}" != "x"; then NCURSES_LIB="${pbxlibdir} ${NCURSES_LIB}" NCURSES_INCLUDE="-I${NCURSES_DIR}/include" if test "xcurses.h" != "x" ; then as_ac_Header=`echo "ac_cv_header_${NCURSES_DIR}/include/curses.h" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h usability" >&5 echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <${NCURSES_DIR}/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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking ${NCURSES_DIR}/include/curses.h presence" >&5 echo $ECHO_N "checking ${NCURSES_DIR}/include/curses.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <${NCURSES_DIR}/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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: ${NCURSES_DIR}/include/curses.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for ${NCURSES_DIR}/include/curses.h" >&5 echo $ECHO_N "checking for ${NCURSES_DIR}/include/curses.h... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then NCURSES_HEADER_FOUND=1 else NCURSES_HEADER_FOUND=0 fi fi else if test "xcurses.h" != "x" ; then if test "${ac_cv_header_curses_h+set}" = set; then { echo "$as_me:$LINENO: checking for curses.h" >&5 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } if test "${ac_cv_header_curses_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking curses.h usability" >&5 echo $ECHO_N "checking curses.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else 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 { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking curses.h presence" >&5 echo $ECHO_N "checking curses.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: curses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: curses.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: curses.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: curses.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: curses.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: curses.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: curses.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: curses.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: curses.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: curses.h: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for curses.h" >&5 echo $ECHO_N "checking for curses.h... $ECHO_C" >&6; } if test "${ac_cv_header_curses_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_curses_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_curses_h" >&5 echo "${ECHO_T}$ac_cv_header_curses_h" >&6; } fi if test $ac_cv_header_curses_h = yes; then NCURSES_HEADER_FOUND=1 else NCURSES_HEADER_FOUND=0 fi fi fi if test "x${NCURSES_HEADER_FOUND}" = "x0" ; then if test ! -z "${NCURSES_MANDATORY}" ; then { echo "$as_me:$LINENO: ***" >&5 echo "$as_me: ***" >&6;} { echo "$as_me:$LINENO: *** It appears that you do not have the ncurses development package installed." >&5 echo "$as_me: *** It appears that you do not have the ncurses development package installed." >&6;} { echo "$as_me:$LINENO: *** Please install it to include ${NCURSES_DESCRIP} support" >&5 echo "$as_me: *** Please install it to include ${NCURSES_DESCRIP} support" >&or re-run configure;} { echo "$as_me:$LINENO: *** without explicitly specifying --with-${NCURSES_OPTION}" >&5 echo "$as_me: *** without explicitly specifying --with-${NCURSES_OPTION}" >&6;} exit 1 fi NCURSES_LIB="" NCURSES_INCLUDE="" PBX_NCURSES=0 else PBX_NCURSES=1 cat >>confdefs.h <<_ACEOF #define HAVE_NCURSES 1 _ACEOF fi elif test ! -z "${NCURSES_MANDATORY}"; then { echo "$as_me:$LINENO: ***" >&5 echo "$as_me: ***" >&6;} { echo "$as_me:$LINENO: *** The ${NCURSES_DESCRIP} installation on this system appears to be broken." >&5 echo "$as_me: *** The ${NCURSES_DESCRIP} installation on this system appears to be broken." >&6;} { echo "$as_me:$LINENO: *** Either correct the installation" >&5 echo "$as_me: *** Either correct the installation" >&or run configure;} { echo "$as_me:$LINENO: *** without explicitly specifying --with-${NCURSES_OPTION}" >&5 echo "$as_me: *** without explicitly specifying --with-${NCURSES_OPTION}" >&6;} exit 1 fi fi PBX_GTK2=0 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 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_PKGCONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$PKGCONFIG"; then ac_cv_prog_PKGCONFIG="$PKGCONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi PKGCONFIG=$ac_cv_prog_PKGCONFIG if test -n "$PKGCONFIG"; then { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5 echo "${ECHO_T}$PKGCONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi 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 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_PKGCONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_PKGCONFIG"; then ac_cv_prog_ac_ct_PKGCONFIG="$ac_ct_PKGCONFIG" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_PKGCONFIG=$ac_cv_prog_ac_ct_PKGCONFIG if test -n "$ac_ct_PKGCONFIG"; then { echo "$as_me:$LINENO: result: $ac_ct_PKGCONFIG" >&5 echo "${ECHO_T}$ac_ct_PKGCONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_PKGCONFIG" = x; then PKGCONFIG="No" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac PKGCONFIG=$ac_ct_PKGCONFIG fi else PKGCONFIG="$ac_cv_prog_PKGCONFIG" fi if test ! "x${PKGCONFIG}" = xNo; then GTK2_INCLUDE=$(${PKGCONFIG} gtk+-2.0 --cflags 2>/dev/null) GTK2_LIB=$(${PKGCONFIG} gtk+-2.0 --libs) PBX_GTK2=1 cat >>confdefs.h <<\_ACEOF #define HAVE_GTK2 1 _ACEOF fi test "$silent"=yes && ac_sub_configure_args="${ac_sub_configure_args} --silent" ac_config_files="$ac_config_files makeopts" subdirs="$subdirs mxml" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (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 \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 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' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## 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 emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh 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 # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$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 IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } 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 done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi 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=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&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 $as_me, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. 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=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "autoconfig.h") CONFIG_HEADERS="$CONFIG_HEADERS autoconfig.h" ;; "makeopts") CONFIG_FILES="$CONFIG_FILES makeopts" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); 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" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim build!$build$ac_delim build_cpu!$build_cpu$ac_delim build_vendor!$build_vendor$ac_delim build_os!$build_os$ac_delim host!$host$ac_delim host_cpu!$host_cpu$ac_delim host_vendor!$host_vendor$ac_delim host_os!$host_os$ac_delim HOST_OS!$HOST_OS$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim GNU_MAKE!$GNU_MAKE$ac_delim MENUSELECT_DEBUG!$MENUSELECT_DEBUG$ac_delim NEWT_LIB!$NEWT_LIB$ac_delim NEWT_INCLUDE!$NEWT_INCLUDE$ac_delim PBX_NEWT!$PBX_NEWT$ac_delim CURSES_LIB!$CURSES_LIB$ac_delim CURSES_INCLUDE!$CURSES_INCLUDE$ac_delim PBX_CURSES!$PBX_CURSES$ac_delim NCURSES_LIB!$NCURSES_LIB$ac_delim NCURSES_INCLUDE!$NCURSES_INCLUDE$ac_delim PBX_NCURSES!$PBX_NCURSES$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim PKGCONFIG!$PKGCONFIG$ac_delim PBX_GTK2!$PBX_GTK2$ac_delim GTK2_INCLUDE!$GTK2_INCLUDE$ac_delim GTK2_LIB!$GTK2_LIB$ac_delim subdirs!$subdirs$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 74; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$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 `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | 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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false 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; } fi # # CONFIG_SUBDIRS section. # if test "$no_recursion" != yes; then # Remove --cache-file and --srcdir arguments so they do not pile up. ac_sub_configure_args= ac_prev= eval "set x $ac_configure_args" shift for ac_arg do if test -n "$ac_prev"; then ac_prev= continue fi case $ac_arg in -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \ | --c=*) ;; --config-cache | -C) ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) ;; *) case $ac_arg in *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;; esac done # Always prepend --prefix to ensure using the same prefix # in subdir configurations. ac_arg="--prefix=$prefix" case $ac_arg in *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args" # Pass --silent if test "$silent" = yes; then ac_sub_configure_args="--silent $ac_sub_configure_args" fi ac_popdir=`pwd` for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue # Do not complain, so a configure script can configure whichever # parts of a large source tree are present. test -d "$srcdir/$ac_dir" || continue ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)" echo "$as_me:$LINENO: $ac_msg" >&5 echo "$ac_msg" >&6 { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | 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" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" # Check for guested configure; otherwise get Cygnus style configure. if test -f "$ac_srcdir/configure.gnu"; then ac_sub_configure=$ac_srcdir/configure.gnu elif test -f "$ac_srcdir/configure"; then ac_sub_configure=$ac_srcdir/configure elif test -f "$ac_srcdir/configure.in"; then # This should be Cygnus configure. ac_sub_configure=$ac_aux_dir/configure else { echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;} ac_sub_configure= fi # The recursion is here. if test -n "$ac_sub_configure"; then # Make the cache file name correct relative to the subdirectory. case $cache_file in [\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;; *) # Relative name. ac_sub_cache_file=$ac_top_build_prefix$cache_file ;; esac { echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5 echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;} # The eval makes quoting arguments work. eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \ --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" || { { echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5 echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;} { (exit 1); exit 1; }; } fi cd "$ac_popdir" done fi { echo "$as_me:$LINENO: Menuselect build configuration successfully completed" >&5 echo "$as_me: Menuselect build configuration successfully completed" >&6;} dahdi-tools-2.2.0-rc2/menuselect/menuselect.h0000664000000000000000000001075511145073536017604 0ustar rootroot/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 2005-2006, Russell Bryant * * Russell Bryant * * 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 public data structures and defaults for menuselect * */ #ifndef MENUSELECT_H #define MENUSELECT_H #include "linkedlists.h" #define OUTPUT_MAKEOPTS_DEFAULT "menuselect.makeopts" #define OUTPUT_MAKEDEPS_DEFAULT "menuselect.makedeps" #define MENUSELECT_DEPS "build_tools/menuselect-deps" struct member; struct depend { /*! the name of the dependency */ const char *name; /*! the display name of the dependency */ const char *displayname; /*! if this dependency is a member, not an external object */ struct member *member; /*! for linking */ AST_LIST_ENTRY(depend) list; }; struct conflict { /*! the name of the conflict */ const char *name; /*! the display name of the conflict */ const char *displayname; /*! if this conflict is a member, not an external object */ const struct member *member; /*! for linking */ AST_LIST_ENTRY(conflict) list; }; struct use { /*! the name of the used package */ const char *name; /*! the display name of the used package */ const char *displayname; /*! if this dependency is a member, not an external object */ struct member *member; /*! for linking */ AST_LIST_ENTRY(use) list; }; enum failure_types { NO_FAILURE = 0, SOFT_FAILURE = 1, HARD_FAILURE = 2, }; struct member { /*! What will be sent to the makeopts file */ const char *name; /*! Display name if known */ const char *displayname; /*! Default setting */ const char *defaultenabled; /*! Delete these file(s) if this member changes */ const char *remove_on_change; /*! This module is currently selected */ unsigned int enabled:1; /*! This module was enabled when the config was loaded */ unsigned int was_enabled:1; /*! This module has failed dependencies */ unsigned int depsfailed:2; /*! This module has failed conflicts */ unsigned int conflictsfailed:2; /*! This module's 'enabled' flag was changed by a default only */ unsigned int was_defaulted:1; /*! This module is a dependency, and if it is selected then we have included it in the MENUSELECT_BUILD_DEPS line in the output file */ unsigned int build_deps_output:1; /*! dependencies of this module */ AST_LIST_HEAD_NOLOCK(, depend) deps; /*! conflicts of this module */ AST_LIST_HEAD_NOLOCK(, conflict) conflicts; /*! optional packages used by this module */ AST_LIST_HEAD_NOLOCK(, use) uses; /*! for making a list of modules */ AST_LIST_ENTRY(member) list; }; struct category { /*! the Makefile variable */ const char *name; /*! the name displayed in the menu */ const char *displayname; /*! Delete these file(s) if anything in this category changes */ const char *remove_on_change; /*! Output what is selected, as opposed to not selected */ unsigned int positive_output:1; /*! All choices in this category are mutually exclusive */ unsigned int exclusive:1; /*! the list of possible values to be set in this variable */ AST_LIST_HEAD_NOLOCK(, member) members; /*! for linking */ AST_LIST_ENTRY(category) list; }; extern AST_LIST_HEAD_NOLOCK(categories, category) categories; extern const char *menu_name; /*! This is implemented by the frontend */ int run_menu(void); int count_categories(void); int count_members(struct category *cat); /*! \brief Toggle a member of a category at the specified index to enabled/disabled */ void toggle_enabled_index(struct category *cat, int index); void toggle_enabled(struct member *mem); /*! \brief Set a member of a category at the specified index to enabled */ void set_enabled(struct category *cat, int index); /*! \brief Set a member of a category at the specified index to not enabled */ void clear_enabled(struct category *cat, int index); /*! \brief Enable/Disable all members of a category as long as dependencies have been met and no conflicts are found */ void set_all(struct category *cat, int val); /*! \brief returns non-zero if the string is not defined, or has zero length */ static inline int strlen_zero(const char *s) { return (!s || (*s == '\0')); } #endif /* MENUSELECT_H */ dahdi-tools-2.2.0-rc2/menuselect/missing0000775000000000000000000002540610472743350016665 0ustar rootroot#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2005-06-08.21 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # 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, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: dahdi-tools-2.2.0-rc2/menuselect/menuselect_stub.c0000664000000000000000000000173410457524644020637 0ustar rootroot/* * Asterisk -- An open source telephony toolkit. * * Copyright (C) 2005 - 2006, Russell Bryant * * Russell Bryant * * 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 * * \author Russell Bryant * * \brief Menu stub */ #include #include #include "menuselect.h" int run_menu(void) { fprintf(stderr, "**************************************************\n"); fprintf(stderr, "*** Install ncurses to use the menu interface! ***\n"); fprintf(stderr, "**************************************************\n"); return -1; } dahdi-tools-2.2.0-rc2/menuselect/acinclude.m40000664000000000000000000001220610762131414017443 0ustar rootroot# AST_GCC_ATTRIBUTE([attribute name]) AC_DEFUN([AST_GCC_ATTRIBUTE], [ AC_MSG_CHECKING(checking for compiler 'attribute $1' support) AC_COMPILE_IFELSE( AC_LANG_PROGRAM([static int __attribute__(($1)) test(void) {}], []), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), AC_MSG_RESULT(no)) ]) # AST_EXT_LIB_SETUP([package symbol name], [package friendly name], [package option name], [additional help text]) AC_DEFUN([AST_EXT_LIB_SETUP], [ $1_DESCRIP="$2" $1_OPTION="$3" AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]),[ case ${withval} in n|no) USE_$1=no ;; y|ye|yes) $1_MANDATORY="yes" ;; *) $1_DIR="${withval}" $1_MANDATORY="yes" ;; esac ]) PBX_$1=0 AC_SUBST([$1_LIB]) AC_SUBST([$1_INCLUDE]) AC_SUBST([PBX_$1]) ]) # AST_EXT_LIB_CHECK([package symbol name], [package library name], [function to check], [package header], [additional LIB data]) AC_DEFUN([AST_EXT_LIB_CHECK], [ if test "${USE_$1}" != "no"; then pbxlibdir="" if test "x${$1_DIR}" != "x"; then if test -d ${$1_DIR}/lib; then pbxlibdir="-L${$1_DIR}/lib" else pbxlibdir="-L${$1_DIR}" fi fi AC_CHECK_LIB([$2], [$3], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5) if test "${AST_$1_FOUND}" = "yes"; then $1_LIB="-l$2 $5" $1_HEADER_FOUND="1" if test "x${$1_DIR}" != "x"; then $1_LIB="${pbxlibdir} ${$1_LIB}" $1_INCLUDE="-I${$1_DIR}/include" if test "x$4" != "x" ; then AC_CHECK_HEADER([${$1_DIR}/include/$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] ) fi else if test "x$4" != "x" ; then AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0] ) fi fi if test "x${$1_HEADER_FOUND}" = "x0" ; then if test ! -z "${$1_MANDATORY}" ; then AC_MSG_NOTICE( ***) AC_MSG_NOTICE( *** It appears that you do not have the $2 development package installed.) AC_MSG_NOTICE( *** Please install it to include ${$1_DESCRIP} support, or re-run configure) AC_MSG_NOTICE( *** without explicitly specifying --with-${$1_OPTION}) exit 1 fi $1_LIB="" $1_INCLUDE="" PBX_$1=0 else PBX_$1=1 AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define to indicate the ${$1_DESCRIP} library]) fi elif test ! -z "${$1_MANDATORY}"; then AC_MSG_NOTICE(***) AC_MSG_NOTICE(*** The ${$1_DESCRIP} installation on this system appears to be broken.) AC_MSG_NOTICE(*** Either correct the installation, or run configure) AC_MSG_NOTICE(*** without explicitly specifying --with-${$1_OPTION}) exit 1 fi fi ]) AC_DEFUN( [AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK(for GNU make, GNU_MAKE, GNU_MAKE='Not Found' ; GNU_MAKE_VERSION_MAJOR=0 ; GNU_MAKE_VERSION_MINOR=0 ; for a in make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then GNU_MAKE=$a ; GNU_MAKE_VERSION_MAJOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'` GNU_MAKE_VERSION_MINOR=`$GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` break; fi done ; ) ; if test "x$GNU_MAKE" = "xNot Found" ; then AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!) exit 1 fi AC_SUBST([GNU_MAKE]) ]) # AST_FUNC_FORK # ------------- AN_FUNCTION([fork], [AST_FUNC_FORK]) AN_FUNCTION([vfork], [AST_FUNC_FORK]) AC_DEFUN([AST_FUNC_FORK], [AC_REQUIRE([AC_TYPE_PID_T])dnl AC_CHECK_HEADERS(vfork.h) AC_CHECK_FUNCS(fork vfork) if test "x$ac_cv_func_fork" = xyes; then _AST_FUNC_FORK 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* | *-*-linux-uclibc* ) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation]) fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then _AC_FUNC_VFORK fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation]) fi if test "x$ac_cv_func_vfork_works" = xyes; then AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.]) else AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.]) fi if test "x$ac_cv_func_fork_works" = xyes; then AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.]) fi ])# AST_FUNC_FORK # _AST_FUNC_FORK # ------------- AC_DEFUN([_AST_FUNC_FORK], [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works, [AC_RUN_IFELSE( [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [ /* By Ruediger Kuhlmann. */ return fork () < 0; ])], [ac_cv_func_fork_works=yes], [ac_cv_func_fork_works=no], [ac_cv_func_fork_works=cross])])] )# _AST_FUNC_FORK dahdi-tools-2.2.0-rc2/menuselect/config.sub0000775000000000000000000007725510472743350017262 0ustar rootroot#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-03-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | mt \ | msp430 \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m32c) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; m32c-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: dahdi-tools-2.2.0-rc2/menuselect/config.guess0000775000000000000000000012576210472743350017614 0ustar rootroot#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. timestamp='2006-03-13' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) case ${UNAME_MACHINE} in pc98) echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; x86:Interix*:[345]*) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T:Interix*:[345]*) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^CPU/{ s: ::g p }'`" test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun) LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' /^LIBC/{ s: ::g p }'`" test x"${LIBC}" != x && { echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit } test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: dahdi-tools-2.2.0-rc2/.version0000664000000000000000000000001211176125103014562 0ustar rootroot2.2.0-rc2 dahdi-tools-2.2.0-rc2/build_tools/0000775000000000000000000000000011176143301015422 5ustar rootrootdahdi-tools-2.2.0-rc2/build_tools/make_version0000775000000000000000000000172611015561317020043 0ustar rootroot#!/bin/sh if [ -f ${1}/.version ]; then cat ${1}.version elif [ -f ${1}/.svnrevision ]; then echo SVN-`cat ${1}/.svnbranch`-r`cat ${1}/.svnrevision` elif [ -d .svn ]; then PARTS=`LANG=C svn info ${1} | grep URL | awk '{print $2;}' | sed -e s:^.*/svn/${2}/:: | sed -e 's:/: :g'` BRANCH=0 TEAM=0 REV=`svnversion -c ${1} | cut -d: -f2` if [ "${PARTS}" = "trunk" ] then echo SVN-'trunk'-r${REV} exit 0 fi for PART in $PARTS do if [ ${BRANCH} != 0 ] then RESULT="${RESULT}-${PART}" break fi if [ ${TEAM} != 0 ] then RESULT="${RESULT}-${PART}" continue fi if [ "${PART}" = "branches" ] then BRANCH=1 RESULT="branch" continue fi if [ "${PART}" = "tags" ] then BRANCH=1 RESULT="tag" continue fi if [ "${PART}" = "team" ] then TEAM=1 continue fi done echo SVN-${RESULT##-}-r${REV} fi dahdi-tools-2.2.0-rc2/build_tools/make_version_c0000775000000000000000000000022611044701167020340 0ustar rootroot#!/bin/sh cat << END /* * version.c * Automatically generated */ const char dahdi_tools_version[] = "DAHDI Tools Version - ${TOOLSVERSION}"; END dahdi-tools-2.2.0-rc2/build_tools/make_firmware_object.in0000775000000000000000000000043210711152074022114 0ustar rootroot#!/bin/sh -e # make an object file from a raw binary firmware file # arguments: # 1 - firmware file # 2 - output file bfdname=@BDFNAME@ bfdarch=@BDFARCH@ objcopy -I binary ${1} -B ${bfdarch} -O ${bfdname} ${2} --rename-section .data=.rodata,alloc,load,data,contents,readonly dahdi-tools-2.2.0-rc2/build_tools/make_tree0000775000000000000000000000017111015553737017315 0ustar rootroot#!/bin/sh echo "" echo echo "" cat dahdi.xml echo "" dahdi-tools-2.2.0-rc2/build_tools/test_kernel_git0000775000000000000000000000342510763063456020553 0ustar rootroot#!/bin/sh set -e GIT_URL=git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git CONF_FILE=build_tools/git_test.conf usage() { me=`basename $0` echo "$me: test building Zaptel vs. kernel from git" echo "Usage:" echo " $me checkout Pull a kernel version into " echo " $me update Update (pull) the kernel tree." echo " $me setver Set the kernel version" echo " $me test Test-build" echo "" echo " $me versions [pattern] List available versions." } # Set a variable in $CONF_FILE # The format of CONF_FILE is assumed to be: # VAR=value # in shell syntax. "value" may be quoted. # "value should not contain a '|' character. set_var() { var="$1" val="$2" if grep -q "^$var=" $CONF_FILE 2>/dev/null; then sed -i -e "s|^$var=.*|$var=\"$val\"|" $CONF_FILE else echo "$var=\"$val\"" >>$CONF_FILE fi } if [ -r "$CONF_FILE" ]; then . "$CONF_FILE"; fi if echo "$CONF_FILE" | grep -qv '^/'; then # make CONF_FILE an absolute path: CONF_FILE="$PWD/$CONF_FILE" fi command="$1" case "$command" in checkout) kernel_dir="$2" cd "$kernel_dir" git clone $GIT_URL set_var kernel_dir "$kernel_dir/linux-2.6" ;; update) cd "$kernel_dir" git pull ;; versions) cd "$kernel_dir" git tag -l $2 | cut -c2- ;; setver) kernel_ver="$2" tag="v$kernel_ver" cd "$kernel_dir" git-reset --hard "$tag" make defconfig prepare set_var kernel_ver "$kernel_ver" ;; test) # you can pass extra parameters to the make command in # two ways: # 1. Set th value of MAKE_PARAMS in git_test.conf . # 2. Any extra command-line parameter. shift make KSRC="$kernel_dir" KVERS=$kernel_ver $MAKE_PARAMS "$@" ;; *) echo "$0: no such command $command. Aborting." usage exit 1 ;; esac dahdi-tools-2.2.0-rc2/build_tools/uninstall-modules0000775000000000000000000000162011012353570021026 0ustar rootroot#!/bin/sh # uninstall-modules # # Remove all the modules passed in on the command line from the modules # directory. This script is called by the makefile. KERNEL_MODULES_DIR=$1 shift MODULES="$*" usage() { echo "$0: Used to delete kernel modules from the modules directory." echo "" echo "Usage:" echo " $0 MODULES_BASE_DIR mod1 [mod2 [...]]" echo "" echo " MODULES_BASE_DIR - typically /lib/modules/KVERS" echo " modN - (optionally partial) module name to remove." } if [ -z "$KERNEL_MODULES_DIR" ]; then echo "Missing kernel module directory." usage exit 1; fi if [ -z "$MODULES" ]; then echo "Missing one or more modules to delete." usage exit 1; fi for mod in $MODULES; do BASE=`basename $mod` for file in `cat $KERNEL_MODULES_DIR/modules.dep | cut -d : -f 1 | grep "$BASE$"`; do if [ -e "$file" ]; then #echo "Deleting $file." rm -f $file fi done done exit 0 dahdi-tools-2.2.0-rc2/build_tools/menuselect-deps.in0000664000000000000000000000004311066515340021050 0ustar rootrootLIBNEWT=@PBX_NEWT@ HDLC=@PBX_HDLC@ dahdi-tools-2.2.0-rc2/build_tools/dahdi_svn_tarball0000775000000000000000000000454211015571477021030 0ustar rootroot#!/bin/sh # upload_dahdi: upload a dahdi tarball to updates.xorcom.com # set -e BRANCH_NAME=1.4 REV=HEAD DAHDI_BASE=http://svn.digium.com/svn/dahdi TARBALLS_DIR=$PWD me=`basename $0` say() { echo "$me: $@" } usage() { echo >&2 "$0: Generate snapshot from DAHDI SVN" echo >&2 ' ($Id: dahdi_svn_tarball 4356 2008-05-23 16:39:27Z mattf $)' echo >&2 "" echo >&2 "$0 [-r REV] [-2] [-s]" echo >&2 "$0 <-h | --help>: This message" echo >&2 "" echo >&2 "Options:" echo >&2 " -2 --dahdi12: Use Asterisk 1.2. Implies -u." echo >&2 " -r --rev REV: extract xpp-dahdi from this revision ($REV)." echo >&2 " -s --show: Just show versions. Do nothing" } opt_showonly=no options=`getopt -o 2hr:s --long dahdi12,help,rev:,revision:,show -- "$@"` if [ $? != 0 ] ; then echo >&2 "Terminating..." ; exit 1 ; fi # Note the quotes around `$TEMP': they are essential! eval set -- "$options" while true ; do case "$1" in -2|--dahdi12) BRANCH_NAME=1.2;; -s|--show) opt_showonly=yes ;; -r|--rev|--revision) REV="$2"; shift ;; -h|--help) usage; exit 0;; --) shift ; break ;; esac shift; done BRANCH=branches/$BRANCH_NAME DAHDI_URL=$DAHDI_BASE/$BRANCH set -e # Get the name of the "previous version" for this release. # The idea is to look at the latest tag for that branhch. Tags are # global, and hence we filter tag names by branch name. # # Note: this strips any minor version number. # e.g: if last releast was 1.4.5.1, this will still return 1.4.5 . Here # we rely on the fact that the revision number will be added. dahdi_ver=`svn ls -r $REV $DAHDI_BASE/tags | grep "^$BRANCH_NAME" \ | sed -e "s/\($BRANCH_NAME\.[0-9]\+\)[/.-].*/\1/" \ | sort -nu -t . -k 3 | tail -n 1` real_rev=`svn info -r $REV $DAHDI_URL \ | awk '/^Last Changed Rev: /{print $4}'` ver_full="$dahdi_ver.9.svn.$real_rev" tar_name="dahdi-$ver_full" tar_ball_full="$TARBALLS_DIR/$tar_name.tar.gz" say "Version: $ver_full (ver: $dahdi_ver, rev: $real_rev)" say "Tarball: $tar_ball_full" if [ "$opt_showonly" = 'yes' ]; then exit 0; fi DAHDI_CHECKOUT_DIR=`mktemp -d dahdi_checkout_dir_XXXXXX` # Package a tarball from the subversion, using 'make dist': svn export -q -r $REV $DAHDI_URL $DAHDI_CHECKOUT_DIR/$tar_name echo "$ver_full" >$DAHDI_CHECKOUT_DIR/$tar_name/.version tar cz -C $DAHDI_CHECKOUT_DIR -f $tar_ball_full $tar_name rm -rf $DAHDI_CHECKOUT_DIR dahdi-tools-2.2.0-rc2/zonedata.c0000664000000000000000000011015611157725456015100 0ustar rootroot/* * BSD Telephony Of Mexico "Tormenta" Tone Zone Support 2/22/01 * * Working with the "Tormenta ISA" Card * * Primary Author: Mark Spencer * * This information from ITU E.180 Supplement 2. * UK information from BT SIN 350 Issue 1.1 * Helpful reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ /* * 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 Lesser General Public License Version 2.1 as published * by the Free Software Foundation. See the LICENSE.LGPL file * included with this program for more details. * * In addition, when this program is distributed with Asterisk in * any form that would qualify as a 'combined work' or as a * 'derivative work' (but not mere aggregation), you can redistribute * and/or modify the combination under the terms of the license * provided with that copy of Asterisk, instead of the license * terms granted here. */ #include "tonezone.h" struct tone_zone builtin_zones[] = { { .zone = 0, .country = "us", .description = "United States / North America", .ringcadence = { 2000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "350+440" }, { DAHDI_TONE_BUSY, "480+620/500,0/500" }, { DAHDI_TONE_RINGTONE, "440+480/2000,0/4000" }, { DAHDI_TONE_CONGESTION, "480+620/250,0/250" }, { DAHDI_TONE_CALLWAIT, "440/300,0/10000" }, { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, { DAHDI_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 1, .country = "au", .description = "Australia", .ringcadence = { 400, 200, 400, 2000 }, .tones = { { DAHDI_TONE_DIALTONE, "413+438" }, { DAHDI_TONE_BUSY, "425/375,0/375" }, { DAHDI_TONE_RINGTONE, "413+438/400,0/200,413+438/400,0/2000" }, /* XXX Congestion: Should reduce by 10 db every other cadence XXX */ { DAHDI_TONE_CONGESTION, "425/375,0/375,420/375,0/375" }, { DAHDI_TONE_CALLWAIT, "425/100,0/200,425/200,0/4400" }, { DAHDI_TONE_DIALRECALL, "413+428" }, { DAHDI_TONE_RECORDTONE, "!425/1000,!0/15000,425/360,0/15000" }, { DAHDI_TONE_INFO, "425/2500,0/500" }, { DAHDI_TONE_STUTTER, "413+438/100,0/40" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 2, .country = "fr", .description = "France", .ringcadence = { 1500, 3500 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ /* Dialtone can also be 440+330 */ { DAHDI_TONE_DIALTONE, "440" }, { DAHDI_TONE_BUSY, "440/500,0/500" }, { DAHDI_TONE_RINGTONE, "440/1500,0/3500" }, /* CONGESTION - not specified */ { DAHDI_TONE_CONGESTION, "440/250,0/250" }, { DAHDI_TONE_CALLWAIT, "440/300,0/10000" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, { DAHDI_TONE_STUTTER, "!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,440" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 3, .country = "nl", .description = "Netherlands", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ /* Most of these 425's can also be 450's */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/250,0/250" }, { DAHDI_TONE_CALLWAIT, "425/500,0/9500" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "425/500,0/50" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 4, .country = "uk", .description = "United Kingdom", .ringcadence = { 400, 200, 400, 2000 }, .tones = { /* From British Telecom SIN350 v1.2 */ { DAHDI_TONE_DIALTONE, "350+440" }, { DAHDI_TONE_BUSY, "400/375,0/375" }, { DAHDI_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" }, { DAHDI_TONE_CONGESTION, "400/400,0/350,400/225,0/525" }, { DAHDI_TONE_CALLWAIT, "400/100,0/4000" }, { DAHDI_TONE_DIALRECALL, "350+440" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/60000" }, { DAHDI_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "350+440/750,440/750" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 5, .country = "fi", .description = "Finland", .ringcadence = { 1000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/300,0/300" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" }, { DAHDI_TONE_DIALRECALL, "425/650,0/25" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "950/650,0/325,950/325,0/30,1400/1300,0/2600" }, { DAHDI_TONE_STUTTER, "425/650,0/25" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 6, .country = "es", .description = "Spain", .ringcadence = { 1500, 3000}, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/200,0/200" }, { DAHDI_TONE_RINGTONE, "425/1500,0/3000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200,425/200,0/200,425/200,0/600" }, { DAHDI_TONE_CALLWAIT, "425/175,0/175,425/175,0/3500" }, { DAHDI_TONE_DIALRECALL, "!425/200,!0/200,!425/200,!0/200,!425/200,!0/200,425" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "950/330,0/1000" }, { DAHDI_TONE_STUTTER, "425/500,0/50" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 7, .country = "jp", .description = "Japan", .ringcadence = { 1000, 2000 }, .tones = { { DAHDI_TONE_DIALTONE, "400" }, { DAHDI_TONE_BUSY, "400/500,0/500" }, { DAHDI_TONE_RINGTONE, "400+15/1000,0/2000" }, { DAHDI_TONE_CONGESTION, "400/500,0/500" }, { DAHDI_TONE_CALLWAIT, "400+16/500,0/8000" }, { DAHDI_TONE_DIALRECALL, "!400/200,!0/200,!400/200,!0/200,!400/200,!0/200,400" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, { DAHDI_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" }, }, .dtmf_high_level = -7, .dtmf_low_level = -7, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 8, .country = "no", .description = "Norway", .ringcadence = { 1000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" }, { DAHDI_TONE_DIALRECALL, "470/400,425/400" }, { DAHDI_TONE_RECORDTONE, "1400/400,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, { DAHDI_TONE_STUTTER, "470/400,425/400" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 9, .country = "at", .description = "Austria", .ringcadence = { 1000, 5000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "420" }, { DAHDI_TONE_BUSY, "420/400,0/400" }, { DAHDI_TONE_RINGTONE, "420/1000,0/5000" }, { DAHDI_TONE_CONGESTION, "420/200,0/200" }, { DAHDI_TONE_CALLWAIT, "420/40,0/1960" }, { DAHDI_TONE_DIALRECALL, "420" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/80,0/14920" }, { DAHDI_TONE_INFO, "950/330,1450/330,1850/330,0/1000" }, { DAHDI_TONE_STUTTER, "380+420" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 10, .country = "nz", .description = "New Zealand", .ringcadence = { 400, 200, 400, 2000 }, .tones = { { DAHDI_TONE_DIALTONE, "400" }, { DAHDI_TONE_BUSY, "400/500,0/500" }, { DAHDI_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" }, { DAHDI_TONE_CONGESTION, "400/250,0/250" }, { DAHDI_TONE_CALLWAIT, "400/250,0/250,400/250,0/3250" }, { DAHDI_TONE_DIALRECALL, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" }, { DAHDI_TONE_RECORDTONE, "1400/425,0/15000" }, { DAHDI_TONE_INFO, "400/750,0/100,400/750,0/100,400/750,0/100,400/750,0/400" }, { DAHDI_TONE_STUTTER, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" }, }, .dtmf_high_level = -11, .dtmf_low_level = -9, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 11, .country = "it", .description = "Italy", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425/200,0/200,425/600,0/1000" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "425/400,0/100,425/250,0/100,425/150,0/14000" }, { DAHDI_TONE_DIALRECALL, "470/400,425/400" }, { DAHDI_TONE_RECORDTONE, "1400/400,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, { DAHDI_TONE_STUTTER, "470/400,425/400" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 12, .country = "us-old", .description = "United States Circa 1950 / North America", .ringcadence = { 2000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "600*120" }, { DAHDI_TONE_BUSY, "500*100/500,0/500" }, { DAHDI_TONE_RINGTONE, "420*40/2000,0/4000" }, { DAHDI_TONE_CONGESTION, "500*100/250,0/250" }, { DAHDI_TONE_CALLWAIT, "440/300,0/10000" }, { DAHDI_TONE_DIALRECALL, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, { DAHDI_TONE_STUTTER, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 13, .country = "gr", .description = "Greece", .ringcadence = { 1000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "425/200,0/300,425/700,0/800" }, { DAHDI_TONE_BUSY, "425/300,0/300" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" }, { DAHDI_TONE_DIALRECALL, "425/650,0/25" }, { DAHDI_TONE_RECORDTONE, "1400/400,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, { DAHDI_TONE_STUTTER, "425/650,0/25" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 14, .country = "tw", .description = "Taiwan", .ringcadence = { 1000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "350+440" }, { DAHDI_TONE_BUSY, "480+620/500,0/500" }, { DAHDI_TONE_RINGTONE, "440+480/1000,0/2000" }, { DAHDI_TONE_CONGESTION, "480+620/250,0/250" }, { DAHDI_TONE_CALLWAIT, "350+440/250,0/250,350+440/250,0/3250" }, { DAHDI_TONE_DIALRECALL, "300/1500,0/500" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, { DAHDI_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, }, .dtmf_high_level = -11, .dtmf_low_level = -9, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 15, .country = "cl", .description = "Chile", .ringcadence = { 1000, 3000 }, .tones = { { DAHDI_TONE_DIALTONE, "400" }, { DAHDI_TONE_BUSY, "400/500,0/500" }, { DAHDI_TONE_RINGTONE, "400/1000,0/3000" }, { DAHDI_TONE_CONGESTION, "400/200,0/200" }, { DAHDI_TONE_CALLWAIT, "400/250,0/8750" }, { DAHDI_TONE_DIALRECALL, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/333,!1400/333,!1800/333,0" }, { DAHDI_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 16, .country = "se", .description = "Sweden", .ringcadence = { 1000, 5000 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/250,0/250" }, { DAHDI_TONE_RINGTONE, "425/1000,0/5000" }, { DAHDI_TONE_CONGESTION, "425/250,0/750" }, { DAHDI_TONE_CALLWAIT, "425/200,0/500,425/200,0/9100" }, { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024," "!950/332,!0/24,!1400/332,!0/24,!1800/332,0" }, /*{ DAHDI_TONE_STUTTER, "425/320,0/20" }, Real swedish standard, not used for now */ { DAHDI_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 17, .country = "be", .description = "Belgium", .ringcadence = { 1000, 3000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/3000" }, { DAHDI_TONE_CONGESTION, "425/167,0/167" }, { DAHDI_TONE_CALLWAIT, "1400/175,0/175,1400/175,0/3500" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "900/330,1400/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "425/1000,0/250" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 18, .country = "sg", .description = "Singapore", .ringcadence = { 400, 200, 400, 2000 }, .tones = { /* Reference: http://www.ida.gov.sg/idaweb/doc/download/I397/ida_ts_pstn1_i4r2.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/750,0/750" }, { DAHDI_TONE_RINGTONE, "425*24/400,0/200,425*24/400,0/2000" }, { DAHDI_TONE_CONGESTION, "425/250,0/250" }, { DAHDI_TONE_CALLWAIT, "425*24/300,0/200,425*24/300,0/3200" }, /* DIALRECALL - not specified - use repeating Holding Tone A,B*/ { DAHDI_TONE_DIALRECALL, "425*24/500,0/500,425/500,0/2500" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,425" }, }, .dtmf_high_level = -11, .dtmf_low_level = -9, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 19, .country = "il", .description = "Israel", .ringcadence = { 1000, 3000 }, .tones = { { DAHDI_TONE_DIALTONE, "414" }, { DAHDI_TONE_BUSY, "414/500,0/500" }, { DAHDI_TONE_RINGTONE, "414/1000,0/3000" }, { DAHDI_TONE_CONGESTION, "414/250,0/250" }, { DAHDI_TONE_CALLWAIT, "414/100,0/100,414/100,0/100,414/600,0/3000" }, { DAHDI_TONE_DIALRECALL, "!414/100,!0/100,!414/100,!0/100,!414/100,!0/100,414" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "1000/330,1400/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,414" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 20, .country = "br", .description = "Brazil", .ringcadence = { 1000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/250,0/250" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/250,0/250,425/750,0/250" }, { DAHDI_TONE_CALLWAIT, "425/50,0/1000" }, { DAHDI_TONE_DIALRECALL, "350+440" }, { DAHDI_TONE_RECORDTONE, "425/250,0/250" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330" }, { DAHDI_TONE_STUTTER, "350+440" } }, .dtmf_high_level = -10, .dtmf_low_level = -12, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 21, .country = "hu", .description = "Hungary", .ringcadence = { 1250, 3750 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/300,0/300" }, { DAHDI_TONE_RINGTONE, "425/1250,0/3750" }, { DAHDI_TONE_CONGESTION, "425/300,0/300" }, { DAHDI_TONE_CALLWAIT, "425/40,0/1960" }, { DAHDI_TONE_DIALRECALL, "425+450" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/400,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, { DAHDI_TONE_STUTTER, "350+375+400" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 22, .country = "lt", .description = "Lithuania", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/350,0/350" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, /* STUTTER not specified */ { DAHDI_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 23, .country = "pl", .description = "Poland", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/500,0/500" }, { DAHDI_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,0" }, /* STUTTER not specified */ { DAHDI_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 24, .country = "za", .description = "South Africa", .ringcadence = { 400, 200, 400, 2000 }, .tones = { { DAHDI_TONE_DIALTONE, "400*33" }, { DAHDI_TONE_BUSY, "400/500,0/500" }, { DAHDI_TONE_RINGTONE, "400*33/400,0/200,400*33/400,0/2000" }, { DAHDI_TONE_CONGESTION, "400/250,0/250" }, { DAHDI_TONE_CALLWAIT, "400*33/250,0/250,400*33/250,0/250,400*33/250,0/250,400*33/250,0/250" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "350+440" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" }, /* STUTTER not specified */ { DAHDI_TONE_STUTTER, "!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,400*33" }, }, .dtmf_high_level = -11, .dtmf_low_level = -13, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 25, .country = "pt", .description = "Portugal", .ringcadence = { 1000, 5000 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/5000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "425/200,425/200,425/200,0/5000" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "425/1000,0/200" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, /* STUTTER not specified */ { DAHDI_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 26, .country = "ee", .description = "Estonia", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/300,0/300" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "950/650,0/325,950/325,0/30,1400/1300,0/2600" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "425/650,0/25" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "950/0,0/325,950/325,0/30,1400/1300,0/2600" }, /* STUTTER not specified */ { DAHDI_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 27, .country = "mx", .description = "Mexico", .ringcadence = { 2000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/250,0/250" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/250,0/250" }, { DAHDI_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" }, { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, }, .dtmf_high_level = -8, .dtmf_low_level = -6, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 28, .country = "in", .description = "India", .ringcadence = { 400, 200, 400, 2000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "400*25" }, { DAHDI_TONE_BUSY, "400/750,0/750" }, { DAHDI_TONE_RINGTONE, "400*25/400,0/200,400*25/400,0/2000" }, { DAHDI_TONE_CONGESTION, "400/250,0/250" }, { DAHDI_TONE_CALLWAIT, "400/200,0/100,400/200,0/7500" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, /* INFO - not specified */ { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,0/1000" }, /* STUTTER - not specified */ { DAHDI_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 29, .country = "de", .description = "Germany", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/480,0/480" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/240,0/240" }, { DAHDI_TONE_CALLWAIT, "!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,0" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/80,0/15000" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "425+400" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 30, .country = "ch", .description = "Switzerland", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "425/200,0/200,425/200,0/4000" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/80,0/15000" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "425+340/1100,0/1100" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 31, .country = "dk", .description = "Denmark", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/200,0/200" }, { DAHDI_TONE_CALLWAIT, "!425/200,!0/600,!425/200,!0/3000,!425/200,!0/200,!425/200,0" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/80,0/15000" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, /* STUTTER - not specified */ { DAHDI_TONE_STUTTER, "425/450,0/50" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 32, .country = "cz", .description = "Czech Republic", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425/330,0/330,425/660,0/660" }, { DAHDI_TONE_BUSY, "425/330,0/330" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/165,0/165" }, { DAHDI_TONE_CALLWAIT, "425/330,0/9000" }, /* DIALRECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/14000" }, { DAHDI_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" }, /* STUTTER - not specified */ { DAHDI_TONE_STUTTER, "425/450,0/50" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 33, .country = "cn", .description = "China", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "450" }, { DAHDI_TONE_BUSY, "450/350,0/350" }, { DAHDI_TONE_RINGTONE, "450/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "450/700,0/700" }, { DAHDI_TONE_CALLWAIT, "450/400,0/4000" }, { DAHDI_TONE_DIALRECALL, "450" }, { DAHDI_TONE_RECORDTONE, "950/400,0/10000" }, { DAHDI_TONE_INFO, "450/100,0/100,450/100,0/100,450/100,0/100,450/400,0/400" }, /* STUTTER - not specified */ { DAHDI_TONE_STUTTER, "450+425" }, }, .dtmf_high_level = -11, .dtmf_low_level = -9, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 34, .country = "ar", .description = "Argentina", .ringcadence = { 1000, 4500 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/300,0/300" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4500" }, { DAHDI_TONE_CONGESTION, "425/200,0/300" }, { DAHDI_TONE_CALLWAIT, "425/200,0/9000" }, { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/14000" }, { DAHDI_TONE_INFO, "425/100,0/100" }, { DAHDI_TONE_STUTTER, "425/450,0/50" }, }, .dtmf_high_level = -11, .dtmf_low_level = -9, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 35, .country = "my", .description = "Malaysia", .ringcadence = { 400, 200, 400, 2000 }, .tones = { { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/400,0/200,425/400,0/2000" }, { DAHDI_TONE_CONGESTION, "425/500,0/500" }, { DAHDI_TONE_CALLWAIT, "425/100,0/4000" }, { DAHDI_TONE_DIALRECALL, "350+440" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/60000" }, { DAHDI_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "450+425" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 36, .country = "th", .description = "Thailand", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "400*50" }, { DAHDI_TONE_BUSY, "400/500,0/500" }, { DAHDI_TONE_RINGTONE, "400/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "400/300,0/300" }, { DAHDI_TONE_CALLWAIT, "1000/400,10000/400,1000/400" }, /* DIALRECALL - not specified - use special dial tone instead. */ { DAHDI_TONE_DIALRECALL, "400*50/400,0/100,400*50/400,0/100" }, /* RECORDTONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, /* INFO - specified as an announcement - use tones instead. */ { DAHDI_TONE_INFO, "950/330,1400/330,1800/330" }, /* STUTTER - not specified */ { DAHDI_TONE_STUTTER, "!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,400" }, }, .dtmf_high_level = -11, .dtmf_low_level = -9, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 37, .country = "bg", .description = "Bulgaria", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/250,0/250" }, { DAHDI_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" }, { DAHDI_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, { DAHDI_TONE_RECORDTONE, "1400/425,0/15000" }, { DAHDI_TONE_INFO, "950/330,1400/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "425/1500,0/100" }, }, .dtmf_high_level = -9, .dtmf_low_level = -11, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 38, .country = "ve", .description = "Venezuela", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/500,0/500" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/250,0/250" }, { DAHDI_TONE_CALLWAIT, "400+450/300,0/6000" }, { DAHDI_TONE_DIALRECALL, "425" }, { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, { DAHDI_TONE_INFO, "!950/330,!1440/330,!1800/330,0/1000" }, /* STUTTER - not specified */ { DAHDI_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, }, .dtmf_high_level = -7, .dtmf_low_level = -9, .mfr1_level = -7, .mfr2_level = -8, }, { .zone = 39, .country = "ph", .description = "Philippines", .ringcadence = { 1000, 4000 }, .tones = { /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "480+620/500,0/500" }, { DAHDI_TONE_RINGTONE, "425+480/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "480+620/250,0/250" }, { DAHDI_TONE_CALLWAIT, "440/300,0/10000" }, /* DIAL RECALL - not specified */ { DAHDI_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, /* RECORD TONE - not specified */ { DAHDI_TONE_RECORDTONE, "1400/500,0/15000" }, /* INFO TONE - not specified */ { DAHDI_TONE_INFO, "!950/330,!1400/330,!1800/330,0" }, /* STUTTER TONE - not specified */ { DAHDI_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 40, .country = "ru", .description = "Russian Federation", .ringcadence = { 1000, 4000 }, .tones = { /* References: http://www.minsvyaz.ru/site.shtml?id=1806 http://www.aboutphone.info/lib/gost/45-223-2001.html */ { DAHDI_TONE_DIALTONE, "425" }, { DAHDI_TONE_BUSY, "425/350,0/350" }, { DAHDI_TONE_RINGTONE, "425/1000,0/4000" }, { DAHDI_TONE_CONGESTION, "425/175,0/175" }, { DAHDI_TONE_CALLWAIT, "425/200,0/5000" }, { DAHDI_TONE_RECORDTONE, "1400/400,0/15000" }, { DAHDI_TONE_INFO, "950/330,1440/330,1800/330,0/1000" }, { DAHDI_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = 41, .country = "tr", .description = "Turkey", .ringcadence = { 2000, 4000 }, .tones = { { DAHDI_TONE_DIALTONE, "450" }, { DAHDI_TONE_BUSY, "450/500,0/500" }, { DAHDI_TONE_RINGTONE, "450/2000,0/4000" }, { DAHDI_TONE_CONGESTION, "!450/200,!0/200,!450/200,!0/200,!450/200,!0/200,450/600,0/200" }, { DAHDI_TONE_CALLWAIT, "450/200,0/600,450/200,0/800" }, /* This should actually be 950+1400+1800, but we only support 2 tones at a time */ { DAHDI_TONE_INFO, "!950+1400/300,!0/1000,!950+1400/300,!0/1000,!950+1400/1000,0" }, { DAHDI_TONE_STUTTER, "!450/100,!0/100,!450/100,!0/100,!450/100,!0/100,!450/100,!0/100,!450/100,!0/100,!450/100,!0/100,450" }, }, .dtmf_high_level = -10, .dtmf_low_level = -10, .mfr1_level = -10, .mfr2_level = -8, }, { .zone = -1 } }; dahdi-tools-2.2.0-rc2/configure0000775000000000000000000057520711175405532015040 0ustar rootroot#! /bin/sh # From configure.ac Revision: 5662 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.63. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # "dahdi-tools" ## --------------------- ## ## 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 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 # 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 # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # 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 # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. 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 IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (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 done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C 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 if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no 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 } 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. 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 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 /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done 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. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (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 } 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. 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_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 ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="dahdi" ac_unique_file="dahdi_cfg.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS PPPD_VERSION ASCIIDOC USE_SELINUX PBX_HDLC PBX_USB USB_DIR USB_INCLUDE USB_LIB PBX_NEWT NEWT_DIR NEWT_INCLUDE NEWT_LIB PBX_DAHDI DAHDI_DIR DAHDI_INCLUDE DAHDI_LIB DAHDI_DECLARATION_AFTER_STATEMENT DAHDI_DEVMODE DOWNLOAD FETCH WGET LN HOSTCC BDFARCH BDFNAME GNU_MAKE LN_S INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_dev_mode with_dahdi with_newt with_usb with_selinux with_ppp ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) 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; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) 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; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) 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; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_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; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --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; }; } ;; *=*) 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; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $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} ;; esac 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; }; } 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; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. 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 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- 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; }; } 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; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no 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; }; } 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; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --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 --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 --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-dev-mode Turn on developer mode Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-dahdi=PATH use DAHDI files in PATH --with-newt=PATH use newt files in PATH --with-usb=PATH use usb files in PATH --with-selinux enable (with) / disable (without) SELinux --with-ppp=PATH Use PPP support from PATH Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. "dahdi-tools" _ACEOF exit fi 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 $as_me, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$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; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var 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 $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 ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* 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 # 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 elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site 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 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" 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 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:$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: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$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: 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: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$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: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$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; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # check existence of the package ac_default_prefix=/usr if test ${sysconfdir} = '${prefix}/etc'; then sysconfdir=/etc fi if test ${mandir} = '${prefix}/man'; then mandir=/usr/share/man fi if test ${localstatedir} = '${prefix}/var'; then localstatedir=/var fi # This needs to be before any macros that use the C compiler ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$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; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$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" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) 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); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$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 # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { $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 sed 's/^/| /' conftest.$ac_ext >&5 { { $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: 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; }; }; } fi 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_n "checking for suffix of executables... " >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$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 # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:$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; }; }; } fi rm -f conftest$ac_cv_exeext { $as_echo "$as_me:$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 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+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. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$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 for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:$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; }; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:$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_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+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. */ int main () { #ifndef __GNUC__ choke me #endif ; 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_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$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 $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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_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_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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $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 "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$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 $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 /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_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 rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$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 "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #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 # Broken: fails on valid input. continue fi rm -f conftest.err 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 /* 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 # 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 done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #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 # Broken: fails on valid input. continue fi rm -f conftest.err 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 /* 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 # 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 done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f 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: 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; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then { { $as_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; }; } fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:$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_n "checking for egrep... " >&6; } if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then { { $as_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; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:$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_n "checking for ANSI C header files... " >&6; } if test "${ac_cv_header_stdc+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 #include #include #include 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_cv_header_stdc=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF 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 ( exit $ac_status ) 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 fi fi fi { $as_echo "$as_me:$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 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 cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi 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 _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_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 _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;} ;; 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 MINIX=yes else MINIX= fi if test "$MINIX" = yes; then cat >>confdefs.h <<\_ACEOF #define _POSIX_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_1_SOURCE 2 _ACEOF cat >>confdefs.h <<\_ACEOF #define _MINIX 1 _ACEOF fi { $as_echo "$as_me:$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 $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 __EXTENSIONS__ 1 $ac_includes_default 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_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 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 "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && cat >>confdefs.h <<\_ACEOF #define __EXTENSIONS__ 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _GNU_SOURCE 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _POSIX_PTHREAD_SEMANTICS 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define _TANDEM_SOURCE 1 _ACEOF # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:$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; }; }; } # Provide some information about the compiler. $as_echo "$as_me:$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" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) 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); } { $as_echo "$as_me:$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 $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. */ int main () { #ifndef __GNUC__ choke me #endif ; 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_compiler_gnu=yes else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 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 "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:$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 $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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_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_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 /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else $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 "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:$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 $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 /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_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 rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:$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 "$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #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 # Broken: fails on valid input. continue fi rm -f conftest.err 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 /* 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 # 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 done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #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 # Broken: fails on valid input. continue fi rm -f conftest.err 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 /* 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 # 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 done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f 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: 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; }; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { $as_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; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:$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 $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' 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_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 "yes" >&6; } else { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi { $as_echo "$as_me:$LINENO: checking for GNU make" >&5 $as_echo_n "checking for GNU make... " >&6; } if test "${ac_cv_GNU_MAKE+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_GNU_MAKE='Not Found' ; ac_cv_GNU_MAKE_VERSION_MAJOR=0 ; ac_cv_GNU_MAKE_VERSION_MINOR=0 ; for a in make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then ac_cv_GNU_MAKE=$a ; ac_cv_GNU_MAKE_VERSION_MAJOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'` ac_cv_GNU_MAKE_VERSION_MINOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` break; fi done ; fi { $as_echo "$as_me:$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; }; } exit 1 fi GNU_MAKE=$ac_cv_GNU_MAKE test_obj=conftest.o cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.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 BDFNAME=`LANG=C objdump -f $test_obj | grep -e "$test_obj:" | sed "s/.*file format \(.*\)/\1/"` BDFARCH=`LANG=C objdump -f $test_obj | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"` 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 # Set the default value of HOSTCC from CC if --host was not provided: HOSTCC=${HOSTCC:=${CC}} # 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_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else case $GREP in [\\/]* | ?:[\\/]*) ac_cv_path_GREP="$GREP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_GREP" && ac_cv_path_GREP=":" ;; esac fi GREP=$ac_cv_path_GREP if test -n "$GREP"; then { $as_echo "$as_me:$LINENO: result: $GREP" >&5 $as_echo "$GREP" >&6; } else { $as_echo "$as_me:$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_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_SHELL+set}" = set; then $as_echo_n "(cached) " >&6 else case $SHELL in [\\/]* | ?:[\\/]*) ac_cv_path_SHELL="$SHELL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_SHELL" && ac_cv_path_SHELL=":" ;; esac fi SHELL=$ac_cv_path_SHELL if test -n "$SHELL"; then { $as_echo "$as_me:$LINENO: result: $SHELL" >&5 $as_echo "$SHELL" >&6; } else { $as_echo "$as_me:$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_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_LN+set}" = set; then $as_echo_n "(cached) " >&6 else case $LN in [\\/]* | ?:[\\/]*) ac_cv_path_LN="$LN" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_LN" && ac_cv_path_LN=":" ;; esac fi LN=$ac_cv_path_LN if test -n "$LN"; then { $as_echo "$as_me:$LINENO: result: $LN" >&5 $as_echo "$LN" >&6; } else { $as_echo "$as_me:$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_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_WGET+set}" = set; then $as_echo_n "(cached) " >&6 else case $WGET in [\\/]* | ?:[\\/]*) ac_cv_path_WGET="$WGET" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_WGET" && ac_cv_path_WGET=":" ;; esac fi WGET=$ac_cv_path_WGET if test -n "$WGET"; then { $as_echo "$as_me:$LINENO: result: $WGET" >&5 $as_echo "$WGET" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "${WGET}" != ":" ; then DOWNLOAD=${WGET} 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_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_FETCH+set}" = set; then $as_echo_n "(cached) " >&6 else case $FETCH in [\\/]* | ?:[\\/]*) ac_cv_path_FETCH="$FETCH" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_FETCH" && ac_cv_path_FETCH=":" ;; esac fi FETCH=$ac_cv_path_FETCH if test -n "$FETCH"; then { $as_echo "$as_me:$LINENO: result: $FETCH" >&5 $as_echo "$FETCH" >&6; } else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi DOWNLOAD=${FETCH} fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Check whether --enable-dev-mode was given. if test "${enable_dev_mode+set}" = set; then enableval=$enable_dev_mode; case "${enableval}" in y|ye|yes) DAHDI_DEVMODE=yes ;; n|no) DAHDI_DEVMODE=no ;; *) { { $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; }; } ;; esac fi { $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; } DAHDI_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } DAHDI_DECLARATION_AFTER_STATEMENT= fi DAHDI_DESCRIP="DAHDI" DAHDI_OPTION="dahdi" # Check whether --with-dahdi was given. if test "${with_dahdi+set}" = set; then withval=$with_dahdi; case ${withval} in n|no) USE_DAHDI=no ;; y|ye|yes) ac_mandatory_list="${ac_mandatory_list} DAHDI" ;; *) DAHDI_DIR="${withval}" ac_mandatory_list="${ac_mandatory_list} DAHDI" ;; esac fi PBX_DAHDI=0 NEWT_DESCRIP="newt" NEWT_OPTION="newt" # Check whether --with-newt was given. if test "${with_newt+set}" = set; then withval=$with_newt; case ${withval} in n|no) USE_NEWT=no ;; y|ye|yes) ac_mandatory_list="${ac_mandatory_list} NEWT" ;; *) NEWT_DIR="${withval}" ac_mandatory_list="${ac_mandatory_list} NEWT" ;; esac fi PBX_NEWT=0 USB_DESCRIP="usb" USB_OPTION="usb" # Check whether --with-usb was given. if test "${with_usb+set}" = set; then withval=$with_usb; case ${withval} in n|no) USE_USB=no ;; y|ye|yes) ac_mandatory_list="${ac_mandatory_list} USB" ;; *) USB_DIR="${withval}" ac_mandatory_list="${ac_mandatory_list} USB" ;; esac fi PBX_USB=0 if test "x${PBX_DAHDI}" != "x1"; then { $as_echo "$as_me:$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 DAHDI_INCLUDE="-I${DAHDI_DIR}/include" fi CPPFLAGS="${CPPFLAGS} ${DAHDI_INCLUDE}" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { #if defined(DAHDI_CODE) 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_DAHDI=1 cat >>confdefs.h <<\_ACEOF #define HAVE_DAHDI 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_DAHDI_VERSION /**/ _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_NEWT}" != "x1" -a "${USE_NEWT}" != "no"; then pbxlibdir="" # if --with-NEWT=DIR has been specified, use it. if test "x${NEWT_DIR}" != "x"; then if test -d ${NEWT_DIR}/lib; then pbxlibdir="-L${NEWT_DIR}/lib" else pbxlibdir="-L${NEWT_DIR}" fi fi pbxfuncname="newtBell" if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers AST_NEWT_FOUND=yes else 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_n "checking for ${pbxfuncname} in -lnewt... " >&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="-lnewt ${pbxlibdir} $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_NEWT_FOUND=yes else AST_NEWT_FOUND=no fi fi # now check for the header. if test "${AST_NEWT_FOUND}" = "yes"; then NEWT_LIB="${pbxlibdir} -lnewt " # if --with-NEWT=DIR has been specified, use it. if test "x${NEWT_DIR}" != "x"; then NEWT_INCLUDE="-I${NEWT_DIR}/include" fi NEWT_INCLUDE="${NEWT_INCLUDE} " if test "xnewt.h" = "x" ; then # no header, assume found NEWT_HEADER_FOUND="1" else # check for the header 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 _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_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 _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;} ;; 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 NEWT_HEADER_FOUND=1 else NEWT_HEADER_FOUND=0 fi CPPFLAGS="${saved_cppflags}" fi if test "x${NEWT_HEADER_FOUND}" = "x0" ; then NEWT_LIB="" NEWT_INCLUDE="" else if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library NEWT_LIB="" fi PBX_NEWT=1 # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED cat >>confdefs.h <<_ACEOF #define HAVE_NEWT 1 _ACEOF cat >>confdefs.h <<_ACEOF #define HAVE_NEWT_VERSION /**/ _ACEOF fi fi fi if test "x${PBX_USB}" != "x1" -a "${USE_USB}" != "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" else pbxlibdir="-L${USB_DIR}" fi fi pbxfuncname="usb_init" if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers AST_USB_FOUND=yes else 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_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 /* 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_USB_FOUND=yes else AST_USB_FOUND=no fi 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" else # check for the header 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 _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" $as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 $as_echo "$as_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 _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;} ;; 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 else USB_HEADER_FOUND=0 fi CPPFLAGS="${saved_cppflags}" fi if test "x${USB_HEADER_FOUND}" = "x0" ; then USB_LIB="" USB_INCLUDE="" else if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library USB_LIB="" fi PBX_USB=1 # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED cat >>confdefs.h <<_ACEOF #define HAVE_USB 1 _ACEOF cat >>confdefs.h <<_ACEOF #define HAVE_USB_VERSION /**/ _ACEOF fi fi fi PBX_HDLC=0 { $as_echo "$as_me:$LINENO: checking for GENERIC_HDLC_VERSION version 4 in linux/hdlc.h" >&5 $as_echo_n "checking for GENERIC_HDLC_VERSION version 4 in linux/hdlc.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 int main () { #if defined(GENERIC_HDLC_VERSION) && GENERIC_HDLC_VERSION >= 4 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_HDLC=1 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 if test $PBX_HDLC = 0; then { $as_echo "$as_me:$LINENO: checking for GENERIC_HDLC_VERSION version 4 in linux/hdlc/ioctl.h" >&5 $as_echo_n "checking for GENERIC_HDLC_VERSION version 4 in linux/hdlc/ioctl.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 #include int main () { #if defined(GENERIC_HDLC_VERSION) && GENERIC_HDLC_VERSION >= 4 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_HDLC=1 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 if test "x${PBX_HDLC}" != "x1"; then { $as_echo "$as_me:$LINENO: GENERIC_HDLC_VERSION (version 4) not found, disabling sethdlc." >&5 $as_echo "$as_me: GENERIC_HDLC_VERSION (version 4) not found, disabling sethdlc." >&6;} fi # Check whether --with-selinux was given. if test "${with_selinux+set}" = set; then withval=$with_selinux; USE_SELINUX=$withval else if test ! -x /usr/sbin/sestatus; then USE_SELINUX=no; elif /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"; then USE_SELINUX=yes fi fi # for asciidoc before ver. 7, the backend must be stated explicitly: ASCIIDOC='asciidoc' asciidoc_ver=`asciidoc --version 2>&1 | awk '/^asciidoc /{print $2}' | cut -d. -f 1 | head -n 1` if test "$asciidoc_ver" != '' && test $asciidoc_ver -lt 7; then ASCIIDOC="asciidoc -b xhtml" fi # Check whether --with-ppp was given. if test "${with_ppp+set}" = set; then withval=$with_ppp; else with_ppp=check fi # somebody will fix that default_ppp_path=/usr case "$with_ppp" in yes|check) ppp_path="$default_ppp_path";; no) ppp_path='' ;; *) ppp_path="$with_ppp" ;; esac level_file="$ppp_path/include/pppd/patchlevel.h" PPP_VERSION= if test "$ppp_path" != '' && test -r "$level_file"; then PPPD_VERSION=`awk -F '"' '/VERSION/ { print $$2; }' $level_file` fi case "$with_ppp" in check|no) :;; *) # If we asked explicitly for ppp support if test "$PPPD_VERSION" = ''; then # but have not detected it { { $as_echo "$as_me:$LINENO: error: failed to find pppd/patchlevel.h: no ppp support." >&5 $as_echo "$as_me: error: failed to find pppd/patchlevel.h: no ppp support." >&2;} { (exit 1); exit 1; }; } fi ;; esac if test "x${PBX_DAHDI}" != "x1"; then { $as_echo "$as_me:$LINENO: ***" >&5 $as_echo "$as_me: ***" >&6;} { $as_echo "$as_me:$LINENO: *** Building this package requires DAHDI support. *** " >&5 $as_echo "$as_me: *** Building this package requires DAHDI support. *** " >&6;} { $as_echo "$as_me:$LINENO: *** Please install the dahdi-linux package. ***" >&5 $as_echo "$as_me: *** Please install the dahdi-linux package. ***" >&6;} { $as_echo "$as_me:$LINENO: ***" >&5 $as_echo "$as_me: ***" >&6;} exit 1 fi ac_config_files="$ac_config_files build_tools/menuselect-deps makeopts" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var 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 $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 ;; esac ;; esac done (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 \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= 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' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${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: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. 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. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh 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 # 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 # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # 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 # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. 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 IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (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 done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C 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 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 ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&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 $as_me, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --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"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { $as_echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "build_tools/menuselect-deps") CONFIG_FILES="$CONFIG_FILES build_tools/menuselect-deps" ;; "makeopts") CONFIG_FILES="$CONFIG_FILES makeopts" ;; *) { { $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; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); 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" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_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 '$'` 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; }; } 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; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$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; }; } _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ 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/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $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; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$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 `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) 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; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' 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: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $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; }; } ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$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; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/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: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " 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; }; } 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 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$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; }; } ;; esac done # for ac_tag { (exit 0); 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; }; } # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false 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; } 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: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi { $as_echo "$as_me:$LINENO: *** dahdi-tools build successfully configured ***" >&5 $as_echo "$as_me: *** dahdi-tools build successfully configured ***" >&6;} dahdi-tools-2.2.0-rc2/ppp/0000775000000000000000000000000011176143301013702 5ustar rootrootdahdi-tools-2.2.0-rc2/ppp/Makefile0000664000000000000000000000103011030207520015325 0ustar rootroot#COPTS = -O2 -g -include ../makeopts CFLAGS += $(COPTS) -fPIC LDFLAGS += -shared INCLUDE_DIR = $(includedir)/pppd LIBDIR = $(libdir)/pppd/$(PPPD_VERSION) PLUGINS := dahdi.so all: $(PLUGINS) %.so: %.c ifeq (,$(PPPD_VERSION)) @echo "pppd version not found (in patchlevel.h)." @echo "Install ppp source/headers and/or ./configure --with-ppp=PATH." exit 1 endif $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) install: $(PLUGINS) $(INSTALL) -d $(DESTDIR)$(LIBDIR) $(INSTALL) -m 0644 $? $(DESTDIR)$(LIBDIR) clean: rm -f *.o *.so *.a dahdi-tools-2.2.0-rc2/ppp/dahdi.c0000664000000000000000000001457211173437140015134 0ustar rootroot/* dahdi.c - pppd plugin to implement PPP over DAHDI HDLC channel. * * Copyright 2002 Digium, Inc. * Mark Spencer * * Borrows from PPPoE by Michal Ostrowski , * Jamal Hadi Salim * * which in turn... * * Borrows heavily from the PPPoATM plugin by Mitchell Blank Jr., * which is based in part on work from Jens Axboe and Paul Mackerras. * */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include extern int new_style_driver; const char pppd_version[] = VERSION; #define _PATH_DAHDI_OPT _ROOT_PATH "/etc/ppp/options." #define DAHDI_MTU (DAHDI_DEFAULT_MTU_MRU - 16) extern int kill_link; int retries = 0; int setdevname_dahdi(const char *cp); static option_t dahdi_options[] = { { "device name", o_wild, (void *) &setdevname_dahdi, "Serial port device name", OPT_DEVNAM | OPT_PRIVFIX | OPT_NOARG | OPT_A2STRVAL | OPT_STATIC, devnam}, { NULL } }; static int dahdi_fd = -1; static int dahdi_chan = 0; static int connect_dahdi(void) { struct dahdi_params dahdi_params; int res; int x; info("DAHDI device is '%s'\n", devnam); strlcpy(ppp_devnam, devnam, sizeof(ppp_devnam)); if (strlen(devnam) && strcmp(devnam, "stdin")) { /* Get the channel number */ dahdi_chan = atoi(devnam); if (dahdi_chan < 1) { fatal("'%s' is not a valid device name\n", devnam); return -1; } /* Open /dev/dahdi/channel interface */ dahdi_fd = open("/dev/dahdi/channel", O_RDWR); if (dahdi_fd < 0) { fatal("Unable to open DAHDI channel interface: '%s'\n", strerror(errno)); return dahdi_fd; } /* Specify which channel we really want */ x = dahdi_chan; res = ioctl(dahdi_fd, DAHDI_SPECIFY, &x); if (res) { fatal("Unable to specify channel %d: %s\n", dahdi_chan, strerror(errno)); close(dahdi_fd); dahdi_fd = -1; return -1; } } else dahdi_fd = STDIN_FILENO; /* Get channel parameters */ memset(&dahdi_params, 0, sizeof(dahdi_params)); dahdi_params.channo = -1; res = ioctl(dahdi_fd, DAHDI_GET_PARAMS, &dahdi_params); if (res) { fatal("Device '%s' does not appear to be a DAHDI device\n", devnam ? devnam : ""); } x = 1; /* Throw into HDLC/PPP mode */ res = ioctl(dahdi_fd, DAHDI_HDLCPPP, &x); if (res) { fatal("Unable to put device '%s' into HDLC mode\n", devnam); close(dahdi_fd); dahdi_fd = -1; return -1; } /* Once the logging is fixed, print a message here indicating connection parameters */ dahdi_chan = dahdi_params.channo; info("Connected to DAHDI device '%s' (%d)\n", dahdi_params.name, dahdi_params.channo); return dahdi_fd; } static void disconnect_dahdi(void) { int res; int x = 0; /* Throw out of HDLC mode */ res = ioctl(dahdi_fd, DAHDI_HDLCPPP, &x); if (res) { warn("Unable to take device '%s' out of HDLC mode\n", devnam); } /* Close if it's not stdin */ if (strlen(devnam)) close(dahdi_fd); warn("Disconnect from DAHDI"); } static int setspeed_dahdi(const char *cp) { return 0; } static void dahdi_extra_options() { int ret; char buf[256]; snprintf(buf, 256, _PATH_DAHDI_OPT "%s",devnam); if(!options_from_file(buf, 0, 0, 1)) exit(EXIT_OPTION_ERROR); } static void send_config_dahdi(int mtu, u_int32_t asyncmap, int pcomp, int accomp) { int sock; if (mtu > DAHDI_MTU) { warn("Couldn't increase MTU to %d.", mtu); mtu = DAHDI_MTU; } } static void recv_config_dahdi(int mru, u_int32_t asyncmap, int pcomp, int accomp) { if (mru > DAHDI_MTU) error("Couldn't increase MRU to %d", mru); } static void set_xaccm_pppoe(int unit, ext_accm accm) { /* NOTHING */ } struct channel dahdi_channel; /* Check is cp is a valid DAHDI device * return either 1 if "cp" is a reasonable thing to name a device * or die. * Note that we don't actually open the device at this point * We do need to fill in: * devnam: a string representation of the device */ int (*old_setdevname_hook)(const char* cp) = NULL; int setdevname_dahdi(const char *cp) { int ret; int chan; /* If already set, forgoe */ if (strlen(devnam)) return 1; if (strcmp(cp, "stdin")) { ret = sscanf(cp, "%d", &chan); if (ret != 1) { fatal("DAHDI: Invalid channel: '%s'\n", cp); return -1; } } dahdi__copy_string(devnam, cp, sizeof(devnam)); info("Using DAHDI device '%s'\n", devnam); ret = 1; if( ret == 1 && the_channel != &dahdi_channel ){ the_channel = &dahdi_channel; modem = 0; lcp_allowoptions[0].neg_accompression = 0; lcp_wantoptions[0].neg_accompression = 0; lcp_allowoptions[0].neg_pcompression = 0; lcp_wantoptions[0].neg_pcompression = 0; ccp_allowoptions[0].deflate = 0 ; ccp_wantoptions[0].deflate = 0 ; ipcp_allowoptions[0].neg_vj=0; ipcp_wantoptions[0].neg_vj=0; ccp_allowoptions[0].bsd_compress = 0; ccp_wantoptions[0].bsd_compress = 0; lcp_allowoptions[0].neg_asyncmap = 0; lcp_wantoptions[0].neg_asyncmap = 0; } return ret; } void plugin_init(void) { if (!ppp_available() && !new_style_driver) fatal("Kernel doesn't support ppp_generic needed for DAHDI PPP"); add_options(dahdi_options); info("DAHDI Plugin Initialized"); } struct channel dahdi_channel = { options: dahdi_options, process_extra_options: &dahdi_extra_options, check_options: NULL, connect: &connect_dahdi, disconnect: &disconnect_dahdi, establish_ppp: &generic_establish_ppp, disestablish_ppp: &generic_disestablish_ppp, send_config: &send_config_dahdi, recv_config: &recv_config_dahdi, close: NULL, cleanup: NULL }; dahdi-tools-2.2.0-rc2/pattest.c0000664000000000000000000000557211111641664014750 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include "bittest.h" #include #include "dahdi_tools_version.h" #define BLOCK_SIZE 2039 void print_packet(unsigned char *buf, int len) { int x; printf("{ "); for (x=0;x\n", argv[0]); exit(1); } fd = open(argv[1], O_RDWR, 0600); if (fd < 0) { fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &bs)) { fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_GET_PARAMS, &tp)) { fprintf(stderr, "Unable to get channel parameters\n"); exit(1); } ioctl(fd, DAHDI_GETEVENT); for(;;) { res = bs; res = read(fd, outbuf, res); if (res < bs) { int e; struct dahdi_spaninfo zi; res = ioctl(fd,DAHDI_GETEVENT,&e); if (res == -1) { perror("DAHDI_GETEVENT"); exit(1); } if (e == DAHDI_EVENT_NOALARM) printf("ALARMS CLEARED\n"); if (e == DAHDI_EVENT_ALARM) { zi.spanno = 0; res = ioctl(fd,DAHDI_SPANSTAT,&zi); if (res == -1) { perror("DAHDI_SPANSTAT"); exit(1); } printf("Alarm mask %x hex\n",zi.alarms); } continue; } if (!setup) { c = outbuf[0]; setup++; } for (x=0;x dahdi.ko ztd-eth.ko -> dahdi_dynamic_eth.ko ztd-loc.ko -> dahdi_dynamic_loc.ko ztdummy.ko -> dahdi_dummy.ko ztdynamic.ko -> dahdi_dynamic.ko zttranscode.ko -> dahdi_transcode.ko * The kernel modules for card drivers have *not* changed names, although the wcusb and torisa drivers are no longer included. * This package no longer includes the 'menuselect' utility for choosing which modules to build; all modules that can be built are built automatically. Echo Canceller Modules ^^^^^^^^^^^^^^^^^^^^^^ It is no longer possible and needed to select a software echo canceler at compile time to build into dahdi.ko; all four included echo cancelers (MG2, KB1, SEC and SEC2) are built as loadable modules. If the Digium HPEC binary object file has been placed into the proper directory the HPEC module will be built as well. Any or all of these modules can be loaded at the same time, and the echo canceler to be used on the system's channels can be configured using the dahdi_cfg tool from the dahdi-tools package. IMPORTANT: It is *mandatory* to configure an echo canceler for the system's channels using dahdi_cfg unless the interface cards in use have echo canceler modules available and enabled. There is *no* default software echo canceler with DAHDI. See <<_echo_cancellers,section on echo cancellers>> in sample system.conf. DAHDI-Tools ~~~~~~~~~~~ Many tool names have changed: ztcfg -> dahdi_cfg ztmonitor -> dahdi_monitor ztscan -> dahdi_scan ztspeed -> dahdi_speed zttest -> dahdi_test zttool -> dahdi_tool zapconf -> dahdi_genconf (deprecates genzaptelconf) * The system configuration file has moved from /etc/zaptel.conf to <<_sample_system_conf,/etc/dahdi/system.conf>>. * The dahdi_cfg tool can now be used to select an echo canceler on a channel-by-channel basis in the system configuration file; see system.conf.sample for examples of how to do this. * The configuration for XPP init_card_* scripts is done now in /etc/dahdi/xpp.conf and uses a simple syntax (example included). For PRI modules, the 'pri_protocol' setting, determines how to configure it (E1/T1). * In Astribank PRI modules, the LED behaviour represents which ports are *CLOCK MASTER* (red color) and which are *CLOCK SLAVE* (green color). Usually (but not always), this corresponds to the NT/TE settings in Asterisk. * The /etc/sysconfig/zaptel (or /etc/default/zaptel file, depending on your distribution) is now split into two separate files: /etc/dahdi/modules control which modules are loaded and module options are set via /etc/modprobe.d/dahdi. dahdi-tools-2.2.0-rc2/acinclude.m40000664000000000000000000010457711175405532015320 0ustar rootroot# Various support functions for configure.ac in asterisk # # Helper function to check for gcc attributes. # AST_GCC_ATTRIBUTE([attribute name]) AC_DEFUN([AST_GCC_ATTRIBUTE], [ AC_MSG_CHECKING(for compiler 'attribute $1' support) saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -Werror" AC_COMPILE_IFELSE( AC_LANG_PROGRAM([static void __attribute__(($1)) *test(void *muffin, ...) {}], []), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_$1], 1, [Define to 1 if your GCC C compiler supports the '$1' attribute.]), AC_MSG_RESULT(no)) ] CFLAGS="$saved_CFLAGS" ) # Helper function to setup variables for a package. # $1 -> the package name. Used in configure.ac and also as a prefix # for the variables ($1_DIR, $1_INCLUDE, $1_LIB) in makeopts # $3 -> option name, used in --with-$3 or --without-$3 when calling configure. # $2 and $4 are just text describing the package (short and long form) # AST_EXT_LIB_SETUP([package], [short description], [configure option name], [long description]) AC_DEFUN([AST_EXT_LIB_SETUP], [ $1_DESCRIP="$2" $1_OPTION="$3" AC_ARG_WITH([$3], AC_HELP_STRING([--with-$3=PATH],[use $2 files in PATH $4]), [ case ${withval} in n|no) USE_$1=no ;; y|ye|yes) ac_mandatory_list="${ac_mandatory_list} $1" ;; *) $1_DIR="${withval}" ac_mandatory_list="${ac_mandatory_list} $1" ;; esac ]) PBX_$1=0 AC_SUBST([$1_LIB]) AC_SUBST([$1_INCLUDE]) AC_SUBST([$1_DIR]) AC_SUBST([PBX_$1]) ]) # Check whether any of the mandatory modules are not present, and # print error messages in case. The mandatory list is built using # --with-* arguments when invoking configure. AC_DEFUN([AST_CHECK_MANDATORY], [ AC_MSG_CHECKING([for mandatory modules: ${ac_mandatory_list}]) 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 AC_MSG_RESULT(fail) ; fi AC_MSG_RESULT() eval "a=\${${i}_OPTION}" AC_MSG_NOTICE([***]) AC_MSG_NOTICE([*** The $i installation appears to be missing or broken.]) AC_MSG_NOTICE([*** Either correct the installation, or run configure]) AC_MSG_NOTICE([*** including --without-${a}.]) err=1 done if test $err = 1 ; then exit 1; fi AC_MSG_RESULT(ok) ]) # The next three functions check for the availability of a given package. # AST_C_DEFINE_CHECK looks for the presence of a #define in a header file, # AST_C_COMPILE_CHECK can be used for testing for various items in header files, # AST_EXT_LIB_CHECK looks for a symbol in a given library, or at least # for the presence of a header file. # AST_EXT_TOOL_CHECK looks for a symbol in using $1-config to determine CFLAGS and LIBS # # They are only run if PBX_$1 != 1 (where $1 is the package), # so you can call them multiple times and stop at the first matching one. # On success, they both set PBX_$1 = 1, set $1_INCLUDE and $1_LIB as applicable, # and also #define HAVE_$1 1 and #define HAVE_$1_VERSION ${last_argument} # in autoconfig.h so you can tell which test succeeded. # They should be called after AST_EXT_LIB_SETUP($1, ...) # Check if a given macro is defined in a certain header. # AST_C_DEFINE_CHECK([package], [macro name], [header file], [version]) AC_DEFUN([AST_C_DEFINE_CHECK], [ if test "x${PBX_$1}" != "x1"; then AC_MSG_CHECKING([for $2 in $3]) saved_cppflags="${CPPFLAGS}" if test "x${$1_DIR}" != "x"; then $1_INCLUDE="-I${$1_DIR}/include" fi CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}" AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM( [#include <$3>], [#if defined($2) int foo = 0; #else int foo = bar; #endif 0 ])], [ AC_MSG_RESULT(yes) PBX_$1=1 AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.]) AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version]) ], [ AC_MSG_RESULT(no) ] ) CPPFLAGS="${saved_cppflags}" fi AC_SUBST(PBX_$1) ]) # Check if a given expression will compile using a certain header. # AST_C_COMPILE_CHECK([package], [expression], [header file], [version]) AC_DEFUN([AST_C_COMPILE_CHECK], [ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then AC_MSG_CHECKING([if "$2" compiles using $3]) saved_cppflags="${CPPFLAGS}" if test "x${$1_DIR}" != "x"; then $1_INCLUDE="-I${$1_DIR}/include" fi CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}" AC_COMPILE_IFELSE( [ AC_LANG_PROGRAM( [#include <$3>], [ $2; ] )], [ AC_MSG_RESULT(yes) PBX_$1=1 AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.]) AC_DEFINE([HAVE_$1_VERSION], $4, [Define $1 headers version]) ], [ AC_MSG_RESULT(no) ] ) CPPFLAGS="${saved_cppflags}" fi ]) # Check for existence of a given package ($1), either looking up a function # in a library, or, if no function is supplied, only check for the # existence of the header files. # AST_EXT_LIB_CHECK([package], [library], [function], [header], # [extra libs], [extra cflags], [version]) AC_DEFUN([AST_EXT_LIB_CHECK], [ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then pbxlibdir="" # if --with-$1=DIR has been specified, use it. if test "x${$1_DIR}" != "x"; then if test -d ${$1_DIR}/lib; then pbxlibdir="-L${$1_DIR}/lib" else pbxlibdir="-L${$1_DIR}" fi fi pbxfuncname="$3" if test "x${pbxfuncname}" = "x" ; then # empty lib, assume only headers AST_$1_FOUND=yes else AC_CHECK_LIB([$2], [${pbxfuncname}], [AST_$1_FOUND=yes], [AST_$1_FOUND=no], ${pbxlibdir} $5) fi # now check for the header. if test "${AST_$1_FOUND}" = "yes"; then $1_LIB="${pbxlibdir} -l$2 $5" # if --with-$1=DIR has been specified, use it. if test "x${$1_DIR}" != "x"; then $1_INCLUDE="-I${$1_DIR}/include" fi $1_INCLUDE="${$1_INCLUDE} $6" if test "x$4" = "x" ; then # no header, assume found $1_HEADER_FOUND="1" else # check for the header saved_cppflags="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE} $6" AC_CHECK_HEADER([$4], [$1_HEADER_FOUND=1], [$1_HEADER_FOUND=0]) CPPFLAGS="${saved_cppflags}" fi if test "x${$1_HEADER_FOUND}" = "x0" ; then $1_LIB="" $1_INCLUDE="" else if test "x${pbxfuncname}" = "x" ; then # only checking headers -> no library $1_LIB="" fi PBX_$1=1 # XXX don't know how to evaluate the description (third argument) in AC_DEFINE_UNQUOTED AC_DEFINE_UNQUOTED([HAVE_$1], 1, [Define this to indicate the ${$1_DESCRIP} library]) AC_DEFINE_UNQUOTED([HAVE_$1_VERSION], [$7], [Define to indicate the ${$1_DESCRIP} library version]) fi fi fi ]) # Check for a package using $2-config. Similar to AST_EXT_LIB_CHECK, # but use $2-config to determine cflags and libraries to use. # $3 and $4 can be used to replace --cflags and --libs in the request # AST_EXT_TOOL_CHECK([package], [tool name], [--cflags], [--libs], [includes], [expression]) AC_DEFUN([AST_EXT_TOOL_CHECK], [ if test "x${PBX_$1}" != "x1" -a "${USE_$1}" != "no"; then PBX_$1=0 AC_CHECK_TOOL(CONFIG_$1, $2-config, No) if test ! "x${CONFIG_$1}" = xNo; then if test x"$3" = x ; then A=--cflags ; else A="$3" ; fi $1_INCLUDE=$(${CONFIG_$1} $A) if test x"$4" = x ; then A=--libs ; else A="$4" ; fi $1_LIB=$(${CONFIG_$1} $A) if test x"$5" != x ; then saved_cppflags="${CPPFLAGS}" if test "x${$1_DIR}" != "x"; then $1_INCLUDE="-I${$1_DIR}/include" fi CPPFLAGS="${CPPFLAGS} ${$1_INCLUDE}" saved_ldflags="${LDFLAGS}" LDFLAGS="${$1_LIB}" AC_LINK_IFELSE( [ AC_LANG_PROGRAM( [ $5 ], [ $6; ] )], [ PBX_$1=1 AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 headers.]) ], [] ) CPPFLAGS="${saved_cppflags}" LDFLAGS="${saved_ldflags}" else PBX_$1=1 AC_DEFINE([HAVE_$1], 1, [Define if your system has the $1 libraries.]) fi fi fi ]) AC_DEFUN([AST_CHECK_GNU_MAKE], [AC_CACHE_CHECK([for GNU make], [ac_cv_GNU_MAKE], ac_cv_GNU_MAKE='Not Found' ; ac_cv_GNU_MAKE_VERSION_MAJOR=0 ; ac_cv_GNU_MAKE_VERSION_MINOR=0 ; for a in make gmake gnumake ; do if test -z "$a" ; then continue ; fi ; if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then ac_cv_GNU_MAKE=$a ; ac_cv_GNU_MAKE_VERSION_MAJOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f3 -d' ' | cut -f1 -d'.'` ac_cv_GNU_MAKE_VERSION_MINOR=`$ac_cv_GNU_MAKE --version | grep "GNU Make" | cut -f2 -d'.' | cut -c1-2` break; fi done ; ) ; if test "x$ac_cv_GNU_MAKE" = "xNot Found" ; then AC_MSG_ERROR( *** Please install GNU make. It is required to build Asterisk!) exit 1 fi AC_SUBST([GNU_MAKE], [$ac_cv_GNU_MAKE]) ]) AC_DEFUN( [AST_CHECK_PWLIB], [ PWLIB_INCDIR= PWLIB_LIBDIR= AC_LANG_PUSH([C++]) if test "${PWLIBDIR:-unset}" != "unset" ; then AC_CHECK_HEADER(${PWLIBDIR}/version.h, HAS_PWLIB=1, ) fi if test "${HAS_PWLIB:-unset}" = "unset" ; then if test "${OPENH323DIR:-unset}" != "unset"; then AC_CHECK_HEADER(${OPENH323DIR}/../pwlib/version.h, HAS_PWLIB=1, ) fi if test "${HAS_PWLIB:-unset}" != "unset" ; then PWLIBDIR="${OPENH323DIR}/../pwlib" else AC_CHECK_HEADER(${HOME}/pwlib/include/ptlib.h, HAS_PWLIB=1, ) if test "${HAS_PWLIB:-unset}" != "unset" ; then PWLIBDIR="${HOME}/pwlib" else AC_CHECK_HEADER(/usr/local/include/ptlib.h, HAS_PWLIB=1, ) if test "${HAS_PWLIB:-unset}" != "unset" ; then AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/bin) if test "${PTLIB_CONFIG:-unset}" = "unset" ; then AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/local/share/pwlib/make) fi PWLIB_INCDIR="/usr/local/include" PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir` if test "${PWLIB_LIBDIR:-unset}" = "unset"; then if test "x$LIB64" != "x"; then PWLIB_LIBDIR="/usr/local/lib64" else PWLIB_LIBDIR="/usr/local/lib" fi fi PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs` PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`" else AC_CHECK_HEADER(/usr/include/ptlib.h, HAS_PWLIB=1, ) if test "${HAS_PWLIB:-unset}" != "unset" ; then AC_PATH_PROG(PTLIB_CONFIG, ptlib-config, , /usr/share/pwlib/make) PWLIB_INCDIR="/usr/include" PWLIB_LIBDIR=`${PTLIB_CONFIG} --pwlibdir` if test "${PWLIB_LIBDIR:-unset}" = "unset"; then if test "x$LIB64" != "x"; then PWLIB_LIBDIR="/usr/lib64" else PWLIB_LIBDIR="/usr/lib" fi fi PWLIB_LIB=`${PTLIB_CONFIG} --ldflags --libs` PWLIB_LIB="-L${PWLIB_LIBDIR} `echo ${PWLIB_LIB}`" fi fi fi fi fi #if test "${HAS_PWLIB:-unset}" = "unset" ; then # echo "Cannot find pwlib - please install or set PWLIBDIR and try again" # exit #fi if test "${HAS_PWLIB:-unset}" != "unset" ; then if test "${PWLIBDIR:-unset}" = "unset" ; then if test "${PTLIB_CONFIG:-unset}" != "unset" ; then PWLIBDIR=`$PTLIB_CONFIG --prefix` else echo "Cannot find ptlib-config - please install and try again" exit fi fi if test "x$PWLIBDIR" = "x/usr" -o "x$PWLIBDIR" = "x/usr/"; then PWLIBDIR="/usr/share/pwlib" PWLIB_INCDIR="/usr/include" if test "x$LIB64" != "x"; then PWLIB_LIBDIR="/usr/lib64" else PWLIB_LIBDIR="/usr/lib" fi fi if test "x$PWLIBDIR" = "x/usr/local" -o "x$PWLIBDIR" = "x/usr/"; then PWLIBDIR="/usr/local/share/pwlib" PWLIB_INCDIR="/usr/local/include" if test "x$LIB64" != "x"; then PWLIB_LIBDIR="/usr/local/lib64" else PWLIB_LIBDIR="/usr/local/lib" fi fi if test "${PWLIB_INCDIR:-unset}" = "unset"; then PWLIB_INCDIR="${PWLIBDIR}/include" fi if test "${PWLIB_LIBDIR:-unset}" = "unset"; then PWLIB_LIBDIR="${PWLIBDIR}/lib" fi AC_SUBST([PWLIBDIR]) AC_SUBST([PWLIB_INCDIR]) AC_SUBST([PWLIB_LIBDIR]) fi AC_LANG_POP([C++]) ]) AC_DEFUN( [AST_CHECK_OPENH323_PLATFORM], [ PWLIB_OSTYPE= case "$host_os" in linux*) PWLIB_OSTYPE=linux ; ;; freebsd* ) PWLIB_OSTYPE=FreeBSD ; ;; openbsd* ) PWLIB_OSTYPE=OpenBSD ; ENDLDLIBS="-lossaudio" ; ;; netbsd* ) PWLIB_OSTYPE=NetBSD ; ENDLDLIBS="-lossaudio" ; ;; solaris* | sunos* ) PWLIB_OSTYPE=solaris ; ;; darwin* ) PWLIB_OSTYPE=Darwin ; ;; beos*) PWLIB_OSTYPE=beos ; STDCCFLAGS="$STDCCFLAGS -D__BEOS__" ;; cygwin*) PWLIB_OSTYPE=cygwin ; ;; mingw*) PWLIB_OSTYPE=mingw ; STDCCFLAGS="$STDCCFLAGS -mms-bitfields" ; ENDLDLIBS="-lwinmm -lwsock32 -lsnmpapi -lmpr -lcomdlg32 -lgdi32 -lavicap32" ; ;; * ) PWLIB_OSTYPE="$host_os" ; AC_MSG_WARN("OS $PWLIB_OSTYPE not recognized - proceed with caution!") ; ;; esac PWLIB_MACHTYPE= case "$host_cpu" in x86 | i686 | i586 | i486 | i386 ) PWLIB_MACHTYPE=x86 ;; x86_64) PWLIB_MACHTYPE=x86_64 ; P_64BIT=1 ; LIB64=1 ; ;; alpha | alphaev56 | alphaev6 | alphaev67 | alphaev7) PWLIB_MACHTYPE=alpha ; P_64BIT=1 ; ;; sparc ) PWLIB_MACHTYPE=sparc ; ;; powerpc ) PWLIB_MACHTYPE=ppc ; ;; ppc ) PWLIB_MACHTYPE=ppc ; ;; powerpc64 ) PWLIB_MACHTYPE=ppc64 ; P_64BIT=1 ; LIB64=1 ; ;; ppc64 ) PWLIB_MACHTYPE=ppc64 ; P_64BIT=1 ; LIB64=1 ; ;; ia64) PWLIB_MACHTYPE=ia64 ; P_64BIT=1 ; ;; s390x) PWLIB_MACHTYPE=s390x ; P_64BIT=1 ; LIB64=1 ; ;; s390) PWLIB_MACHTYPE=s390 ; ;; * ) PWLIB_MACHTYPE="$host_cpu"; AC_MSG_WARN("CPU $PWLIB_MACHTYPE not recognized - proceed with caution!") ;; esac PWLIB_PLATFORM="${PWLIB_OSTYPE}_${PWLIB_MACHTYPE}" AC_SUBST([PWLIB_PLATFORM]) ]) AC_DEFUN( [AST_CHECK_OPENH323], [ OPENH323_INCDIR= OPENH323_LIBDIR= AC_LANG_PUSH([C++]) if test "${OPENH323DIR:-unset}" != "unset" ; then AC_CHECK_HEADER(${OPENH323DIR}/version.h, HAS_OPENH323=1, ) fi if test "${HAS_OPENH323:-unset}" = "unset" ; then AC_CHECK_HEADER(${PWLIBDIR}/../openh323/version.h, OPENH323DIR="${PWLIBDIR}/../openh323"; HAS_OPENH323=1, ) if test "${HAS_OPENH323:-unset}" != "unset" ; then OPENH323DIR="${PWLIBDIR}/../openh323" saved_cppflags="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} -I${PWLIB_INCDIR}/openh323 -I${PWLIB_INCDIR}" AC_CHECK_HEADER(${OPENH323DIR}/include/h323.h, , OPENH323_INCDIR="${PWLIB_INCDIR}/openh323"; OPENH323_LIBDIR="${PWLIB_LIBDIR}", [#include ]) CPPFLAGS="${saved_cppflags}" else saved_cppflags="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} -I${HOME}/openh323/include -I${PWLIB_INCDIR}" AC_CHECK_HEADER(${HOME}/openh323/include/h323.h, HAS_OPENH323=1, ) CPPFLAGS="${saved_cppflags}" if test "${HAS_OPENH323:-unset}" != "unset" ; then OPENH323DIR="${HOME}/openh323" else saved_cppflags="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} -I/usr/local/include/openh323 -I${PWLIB_INCDIR}" AC_CHECK_HEADER(/usr/local/include/openh323/h323.h, HAS_OPENH323=1, ) CPPFLAGS="${saved_cppflags}" if test "${HAS_OPENH323:-unset}" != "unset" ; then OPENH323DIR="/usr/local/share/openh323" OPENH323_INCDIR="/usr/local/include/openh323" if test "x$LIB64" != "x"; then OPENH323_LIBDIR="/usr/local/lib64" else OPENH323_LIBDIR="/usr/local/lib" fi else saved_cppflags="${CPPFLAGS}" CPPFLAGS="${CPPFLAGS} -I/usr/include/openh323 -I${PWLIB_INCDIR}" AC_CHECK_HEADER(/usr/include/openh323/h323.h, HAS_OPENH323=1, , [#include ]) CPPFLAGS="${saved_cppflags}" if test "${HAS_OPENH323:-unset}" != "unset" ; then OPENH323DIR="/usr/share/openh323" OPENH323_INCDIR="/usr/include/openh323" if test "x$LIB64" != "x"; then OPENH323_LIBDIR="/usr/lib64" else OPENH323_LIBDIR="/usr/lib" fi fi fi fi fi fi if test "${HAS_OPENH323:-unset}" != "unset" ; then if test "${OPENH323_INCDIR:-unset}" = "unset"; then OPENH323_INCDIR="${OPENH323DIR}/include" fi if test "${OPENH323_LIBDIR:-unset}" = "unset"; then OPENH323_LIBDIR="${OPENH323DIR}/lib" fi OPENH323_LIBDIR="`cd ${OPENH323_LIBDIR}; pwd`" OPENH323_INCDIR="`cd ${OPENH323_INCDIR}; pwd`" OPENH323DIR="`cd ${OPENH323DIR}; pwd`" AC_SUBST([OPENH323DIR]) AC_SUBST([OPENH323_INCDIR]) AC_SUBST([OPENH323_LIBDIR]) fi AC_LANG_POP([C++]) ]) AC_DEFUN( [AST_CHECK_PWLIB_VERSION], [ if test "${HAS_$2:-unset}" != "unset"; then $2_VERSION=`grep "$2_VERSION" ${$2_INCDIR}/$3 | cut -f2 -d ' ' | sed -e 's/"//g'` $2_MAJOR_VERSION=`echo ${$2_VERSION} | cut -f1 -d.` $2_MINOR_VERSION=`echo ${$2_VERSION} | cut -f2 -d.` $2_BUILD_NUMBER=`echo ${$2_VERSION} | cut -f3 -d.` let $2_VER=${$2_MAJOR_VERSION}*10000+${$2_MINOR_VERSION}*100+${$2_BUILD_NUMBER} let $2_REQ=$4*10000+$5*100+$6 AC_MSG_CHECKING(if $1 version ${$2_VERSION} is compatible with chan_h323) if test ${$2_VER} -lt ${$2_REQ}; then AC_MSG_RESULT(no) unset HAS_$2 else AC_MSG_RESULT(yes) fi fi ]) AC_DEFUN( [AST_CHECK_PWLIB_BUILD], [ if test "${HAS_$2:-unset}" != "unset"; then AC_MSG_CHECKING($1 installation validity) saved_cppflags="${CPPFLAGS}" saved_libs="${LIBS}" if test "${$2_LIB:-unset}" != "unset"; then LIBS="${LIBS} ${$2_LIB} $7" else LIBS="${LIBS} -L${$2_LIBDIR} -l${PLATFORM_$2} $7" fi CPPFLAGS="${CPPFLAGS} -I${$2_INCDIR} $6" AC_LANG_PUSH([C++]) AC_LINK_IFELSE( [AC_LANG_PROGRAM([$4],[$5])], [ AC_MSG_RESULT(yes) ac_cv_lib_$2="yes" ], [ AC_MSG_RESULT(no) ac_cv_lib_$2="no" ] ) AC_LANG_POP([C++]) LIBS="${saved_libs}" CPPFLAGS="${saved_cppflags}" if test "${ac_cv_lib_$2}" = "yes"; then if test "${$2_LIB:-undef}" = "undef"; then if test "${$2_LIBDIR}" != "" -a "${$2_LIBDIR}" != "/usr/lib"; then $2_LIB="-L${$2_LIBDIR} -l${PLATFORM_$2}" else $2_LIB="-l${PLATFORM_$2}" fi fi if test "${$2_INCDIR}" != "" -a "${$2_INCDIR}" != "/usr/include"; then $2_INCLUDE="-I${$2_INCDIR}" fi PBX_$2=1 AC_DEFINE([HAVE_$2], 1, [$3]) fi fi ]) AC_DEFUN( [AST_CHECK_OPENH323_BUILD], [ if test "${HAS_OPENH323:-unset}" != "unset"; then AC_MSG_CHECKING(OpenH323 build option) OPENH323_SUFFIX= prefixes="h323_${PWLIB_PLATFORM}_ h323_ openh323" for pfx in $prefixes; do files=`ls -l ${OPENH323_LIBDIR}/lib${pfx}*.so* 2>/dev/null` libfile= if test -n "$files"; then for f in $files; do if test -f $f -a ! -L $f; then libfile=`basename $f` break; fi done fi if test -n "$libfile"; then OPENH323_PREFIX=$pfx break; fi done if test "${libfile:-unset}" != "unset"; then OPENH323_SUFFIX=`eval "echo ${libfile} | sed -e 's/lib${OPENH323_PREFIX}\(@<:@^.@:>@*\)\..*/\1/'"` fi case "${OPENH323_SUFFIX}" in n) OPENH323_BUILD="notrace";; r) OPENH323_BUILD="opt";; d) OPENH323_BUILD="debug";; *) if test "${OPENH323_PREFIX:-undef}" = "openh323"; then notrace=`eval "grep NOTRACE ${OPENH323DIR}/openh323u.mak | grep = | sed -e 's/@<:@A-Z0-9_@:>@*@<:@ @:>@*=@<:@ @:>@*//'"` if test "x$notrace" = "x"; then notrace="0" fi if test "$notrace" -ne 0; then OPENH323_BUILD="notrace" else OPENH323_BUILD="opt" fi OPENH323_LIB="-l${OPENH323_PREFIX}" else OPENH323_BUILD="notrace" fi ;; esac AC_MSG_RESULT(${OPENH323_BUILD}) AC_SUBST([OPENH323_SUFFIX]) AC_SUBST([OPENH323_BUILD]) fi ]) # AST_FUNC_FORK # ------------- AN_FUNCTION([fork], [AST_FUNC_FORK]) AN_FUNCTION([vfork], [AST_FUNC_FORK]) AC_DEFUN([AST_FUNC_FORK], [AC_REQUIRE([AC_TYPE_PID_T])dnl AC_CHECK_HEADERS(vfork.h) AC_CHECK_FUNCS(fork vfork) if test "x$ac_cv_func_fork" = xyes; then _AST_FUNC_FORK 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* | *-*-linux-uclibc* ) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac AC_MSG_WARN([result $ac_cv_func_fork_works guessed because of cross compilation]) fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then _AC_FUNC_VFORK fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork AC_MSG_WARN([result $ac_cv_func_vfork_works guessed because of cross compilation]) fi if test "x$ac_cv_func_vfork_works" = xyes; then AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define to 1 if `vfork' works.]) else AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.]) fi if test "x$ac_cv_func_fork_works" = xyes; then AC_DEFINE(HAVE_WORKING_FORK, 1, [Define to 1 if `fork' works.]) fi ])# AST_FUNC_FORK # _AST_FUNC_FORK # ------------- AC_DEFUN([_AST_FUNC_FORK], [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works, [AC_RUN_IFELSE( [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [ /* By Ruediger Kuhlmann. */ return fork () < 0; ])], [ac_cv_func_fork_works=yes], [ac_cv_func_fork_works=no], [ac_cv_func_fork_works=cross])])] )# _AST_FUNC_FORK # AST_PROG_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([AST_PROG_LD], [AC_ARG_WITH([gnu-ld], [AC_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no]) AC_REQUIRE([AST_PROG_SED])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi]) EGREP=$ac_cv_prog_egrep AC_SUBST([EGREP]) ])]) # AST_PROG_EGREP # AST_PROG_SED # ----------- # Check for a fully functional sed program that truncates # as few characters as possible. Prefer GNU sed if found. AC_DEFUN([AST_PROG_SED], [AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED, [dnl ac_script should not contain more than 99 commands (for HP-UX sed), dnl but more than about 7000 bytes, to catch a limit in Solaris 8 /usr/ucb/sed. ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" | sed 99q >conftest.sed $as_unset ac_script || ac_script= _AC_PATH_PROG_FEATURE_CHECK(SED, [sed gsed], [_AC_FEATURE_CHECK_LENGTH([ac_path_SED], [ac_cv_path_SED], ["$ac_path_SED" -f conftest.sed])])]) SED="$ac_cv_path_SED" AC_SUBST([SED])dnl rm -f conftest.sed ])# AST_PROG_SED dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) dnl dnl @summary figure out how to build C programs using POSIX threads dnl dnl This macro figures out how to build C programs using POSIX threads. dnl It sets the PTHREAD_LIBS output variable to the threads library and dnl linker flags, and the PTHREAD_CFLAGS output variable to any special dnl C compiler flags that are needed. (The user can also force certain dnl compiler flags/libs to be tested by setting these environment dnl variables.) dnl dnl Also sets PTHREAD_CC to any special C compiler that is needed for dnl multi-threaded programs (defaults to the value of CC otherwise). dnl (This is necessary on AIX to use the special cc_r compiler alias.) dnl dnl NOTE: You are assumed to not only compile your program with these dnl flags, but also link it with them as well. e.g. you should link dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS dnl $LIBS dnl dnl If you are only building threads programs, you may wish to use dnl these variables in your default LIBS, CFLAGS, and CC: dnl dnl LIBS="$PTHREAD_LIBS $LIBS" dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS" dnl CC="$PTHREAD_CC" dnl dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). dnl dnl ACTION-IF-FOUND is a list of shell commands to run if a threads dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the dnl default action will define HAVE_PTHREAD. dnl dnl Please let the authors know if this macro fails on any platform, or dnl if you have any other suggestions or comments. This macro was based dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros dnl posted by Alejandro Forero Cuervo to the autoconf macro repository. dnl We are also grateful for the helpful feedback of numerous users. dnl dnl @category InstalledPackages dnl @author Steven G. Johnson dnl @version 2006-05-29 dnl @license GPLWithACException AC_DEFUN([ACX_PTHREAD], [ AC_REQUIRE([AC_CANONICAL_HOST]) AC_LANG_SAVE AC_LANG_C acx_pthread_ok=no # We used to check for pthread.h first, but this fails if pthread.h # requires special compiler flags (e.g. on True64 or Sequent). # It gets checked for in the link test anyway. # First of all, check if the user has set any of the PTHREAD_LIBS, # etcetera environment variables, and if threads linking works using # them: if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS]) AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes) AC_MSG_RESULT($acx_pthread_ok) if test x"$acx_pthread_ok" = xno; then PTHREAD_LIBS="" PTHREAD_CFLAGS="" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" fi # We must check for the threads library under a number of different # names; the ordering is very important because some systems # (e.g. DEC) have both -lpthread and -lpthreads, where one of the # libraries is broken (non-POSIX). # Create a list of thread flags to try. Items starting with a "-" are # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all, and "pthread-config" # which is a program returning the flags for the Pth emulation library. acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: # pthreads: AIX (must check this before -lpthread) # none: in case threads are in libc; should be tried before -Kthread and # other compiler flags to prevent continual compiler warnings # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads) # -pthreads: Solaris/gcc # -mthreads: Mingw32/gcc, Lynx/gcc # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it # doesn't hurt to check since this sometimes defines pthreads too; # also defines -D_REENTRANT) # ... -mt is also the pthreads flag for HP/aCC # pthread: Linux, etcetera # --thread-safe: KAI C++ # pthread-config: use pthread-config program (for GNU Pth library) case "${host_cpu}-${host_os}" in *solaris*) # On Solaris (at least, for some versions), libc contains stubbed # (non-functional) versions of the pthreads routines, so link-based # tests will erroneously succeed. (We need to link with -pthreads/-mt/ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather # a function called by this macro, so we could check for that, but # who knows whether they'll stub that too in a future libc.) So, # we'll just look for -pthreads and -lpthread first: acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" ;; esac if test x"$acx_pthread_ok" = xno; then for flag in $acx_pthread_flags; do case $flag in none) AC_MSG_CHECKING([whether pthreads work without any flags]) ;; -*) AC_MSG_CHECKING([whether pthreads work with $flag]) PTHREAD_CFLAGS="$flag" ;; pthread-config) AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no) if test x"$acx_pthread_config" = xno; then continue; fi PTHREAD_CFLAGS="`pthread-config --cflags`" PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" ;; *) AC_MSG_CHECKING([for the pthreads library -l$flag]) PTHREAD_LIBS="-l$flag" ;; esac save_LIBS="$LIBS" save_CFLAGS="$CFLAGS" LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Check for various functions. We must include pthread.h, # since some functions may be macros. (On the Sequent, we # need a special flag -Kthread to make this header compile.) # We check for pthread_join because it is in -lpthread on IRIX # while pthread_create is in libc. We check for pthread_attr_init # due to DEC craziness with -lpthreads. We check for # 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. AC_TRY_LINK([#include ], [pthread_t th; pthread_join(th, 0); pthread_attr_init(0); pthread_cleanup_push(0, 0); pthread_create(0,0,0,0); pthread_cleanup_pop(0); ], [acx_pthread_ok=yes]) LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" AC_MSG_RESULT($acx_pthread_ok) if test "x$acx_pthread_ok" = xyes; then break; fi PTHREAD_LIBS="" PTHREAD_CFLAGS="" done fi # Various other checks: if test "x$acx_pthread_ok" = xyes; then save_LIBS="$LIBS" LIBS="$PTHREAD_LIBS $LIBS" save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS" # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. AC_MSG_CHECKING([for joinable pthread attribute]) attr_name=unknown for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do AC_TRY_LINK([#include ], [int attr=$attr; return attr;], [attr_name=$attr; break]) done AC_MSG_RESULT($attr_name) if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name, [Define to necessary symbol if this constant uses a non-standard name on your system.]) fi AC_MSG_CHECKING([if more special flags are required for pthreads]) flag=no case "${host_cpu}-${host_os}" in *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";; *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";; esac AC_MSG_RESULT(${flag}) if test "x$flag" != xno; then PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS" fi LIBS="$save_LIBS" CFLAGS="$save_CFLAGS" # More AIX lossage: must compile with xlc_r or cc_r if test x"$GCC" != xyes; then AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC}) else PTHREAD_CC=$CC fi else PTHREAD_CC="$CC" fi AC_SUBST(PTHREAD_LIBS) AC_SUBST(PTHREAD_CFLAGS) AC_SUBST(PTHREAD_CC) # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: if test x"$acx_pthread_ok" = xyes; then ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1]) : else acx_pthread_ok=no $2 fi AC_LANG_RESTORE ])dnl ACX_PTHREAD dahdi-tools-2.2.0-rc2/LICENSE0000664000000000000000000004313011046162606014116 0ustar rootroot GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. dahdi-tools-2.2.0-rc2/LICENSE.LGPL0000664000000000000000000006346711046162606014672 0ustar rootroot GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! dahdi-tools-2.2.0-rc2/hdlctest.c0000664000000000000000000002060111133442672015066 0ustar rootroot/* * Written by Mark Spencer * Based on previous works, designs, and architectures conceived and * written by Jim Dixon . * * Copyright (C) 2001 Jim Dixon / Zapata Telephony. * Copyright (C) 2001-2008 Digium, Inc. * * All rights reserved. * * Primary Author: Mark Spencer * Radio Support by Jim Dixon */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ #include #include #include #include #include #include #include #include #include #include #include #define FAST_HDLC_NEED_TABLES #include #include "bittest.h" #include "dahdi_tools_version.h" #define BLOCK_SIZE 2039 static unsigned short fcstab[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 }; #define PPP_INITFCS 0xffff /* Initial FCS value */ #define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ #define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) void print_packet(unsigned char *buf, int len) { int x; printf("{ "); for (x = 0; x < len; x++) { printf("%02x ", buf[x]); } printf("}\n"); } static int bytes; static int errors; static int c; void dump_bits(unsigned char *outbuf, int len) { int x, i; for (x = 0; x < len; x++) { for (i = 0; i < 8; i++) { if (outbuf[x] & (1 << (7 - i))) { printf("1"); } else { printf("0"); } } } printf("\n"); } void dump_bitslong(unsigned int outbuf, int bits) { int i; printf("Dumping %d bits from %04x\n", bits, outbuf); for (i = 0; i < bits; i++) { if (outbuf & (1 << (31 - i))) { printf("1"); } else { printf("0"); } } printf("\n"); } int check_frame(unsigned char *outbuf, int res) { static int setup = 0; int x; unsigned short fcs = PPP_INITFCS; if (c < 1) { c = 1; } if (!setup) { c = outbuf[0]; setup++; } for (x = 0; x < res; x++) { if (outbuf[x] != c && (x < res - 2)) { printf("(Error %d): Unexpected result, %d != %d, position %d %d bytes since last error.\n", ++errors, outbuf[x], c, x, bytes); if (!x) { c = outbuf[0]; } bytes = 0; } else { bytes++; } fcs = PPP_FCS(fcs, outbuf[x]); } if (fcs != PPP_GOODFCS) { printf("FCS Check failed :( (%04x != %04x)\n", fcs, PPP_GOODFCS); } #if 0 if (res != c) { printf("Res is %d, expected %d\n", res, c+2); } #endif c = bit_next(c); return 0; } int main(int argc, char *argv[]) { int fd; int res, x; struct dahdi_params tp; struct dahdi_bufferinfo bi; int bs = BLOCK_SIZE; int pos = 0; unsigned char inbuf[BLOCK_SIZE]; unsigned char outbuf[BLOCK_SIZE]; int bytes = 0; int out; unsigned int olddata1; int oldones1; int oldbits1; unsigned int olddata = 0; int oldones = 0; int oldbits = 0; int hdlcmode = 0; struct fasthdlc_state fs; if (argc < 2) { fprintf(stderr, "Usage: %s \n", argv[0]); exit(1); } fd = open(argv[1], O_RDWR, 0600); if (fd < 0) { fprintf(stderr, "Unable to open %s: %s\n", argv[1], strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_SET_BLOCKSIZE, &bs)) { fprintf(stderr, "Unable to set block size to %d: %s\n", bs, strerror(errno)); exit(1); } if (ioctl(fd, DAHDI_GET_PARAMS, &tp)) { fprintf(stderr, "Unable to get channel parameters\n"); exit(1); } if ((tp.sigtype & DAHDI_SIG_HDLCRAW) == DAHDI_SIG_HDLCRAW) { printf("In HDLC mode\n"); hdlcmode = 1; } else if ((tp.sigtype & DAHDI_SIG_CLEAR) == DAHDI_SIG_CLEAR) { printf("In CLEAR mode\n"); hdlcmode = 0; } else { fprintf(stderr, "Not in a reasonable mode\n"); exit(1); } res = ioctl(fd, DAHDI_GET_BUFINFO, &bi); if (!res) { bi.txbufpolicy = DAHDI_POLICY_IMMEDIATE; bi.rxbufpolicy = DAHDI_POLICY_IMMEDIATE; bi.numbufs = 4; res = ioctl(fd, DAHDI_SET_BUFINFO, &bi); if (res < 0) { fprintf(stderr, "Unable to set buf info: %s\n", strerror(errno)); exit(1); } } else { fprintf(stderr, "Unable to get buf info: %s\n", strerror(errno)); exit(1); } ioctl(fd, DAHDI_GETEVENT); fasthdlc_precalc(); fasthdlc_init(&fs, FASTHDLC_MODE_64); for (;;) { res = read(fd, outbuf, sizeof(outbuf)); if (hdlcmode) { if (res < 0) { if (errno == ELAST) { if (ioctl(fd, DAHDI_GETEVENT, &x) < 0) { fprintf(stderr, "Unaable to get event: %s\n", strerror(errno)); exit(1); } fprintf(stderr, "Event: %d (%d bytes since last error)\n", x, bytes); bytes = 0; continue; } else { fprintf(stderr, "Error: %s\n", strerror(errno)); exit(1); } } #if 0 printf("Res is %d, buf0 is %d, buf1 is %d\n", res, outbuf[0], outbuf[1]); #endif if (res < 2) { fprintf(stderr, "Too small? Only got %d bytes\n", res); } check_frame(outbuf, res); } else { for (x = 0; x < res; x++) { oldones1 = oldones; oldbits1 = oldbits; olddata1 = olddata; oldones = fs.ones; oldbits = fs.bits; olddata = fs.data; fasthdlc_rx_load(&fs, outbuf[x]); out = fasthdlc_rx_run(&fs); if (out & RETURN_EMPTY_FLAG) { /* Empty */ } else if (out & RETURN_COMPLETE_FLAG) { if (pos && (pos < 2)) { printf("Too short? (%d)\n", pos); } else if (pos) { check_frame(inbuf, pos); } pos = 0; } else if (out & RETURN_DISCARD_FLAG) { printf("Discard (search = %d, len = %d, buf = %d, x=%d, res=%d, oldones: %d, oldbits: %d)\n", c, pos, inbuf[0], x, res, oldones, oldbits); dump_bitslong(olddata, oldbits); printf("Discard oldones: %d, oldbits: %d)\n", oldones1, oldbits1); dump_bitslong(olddata1, oldbits1); if (x > 64) { dump_bits(outbuf + x - 64, 64); dump_bits(outbuf + x, 64); } pos = 0; } else { if ((out != c) && (pos < c) && !pos) { printf("Warning: Expecting %d at pos %d, got %d (x =%d)\n", c, pos, out, x); if (x > 64) { dump_bits(outbuf + x - 64, 64); dump_bits(outbuf + x, 64); } } inbuf[pos++] = out; } } } } } dahdi-tools-2.2.0-rc2/modules.sample0000664000000000000000000000240111117544725015765 0ustar rootroot# Contains the list of modules to be loaded / unloaded by /etc/init.d/dahdi. # # NOTE: Please add/edit /etc/modprobe.d/dahdi or /etc/modprobe.conf if you # would like to add any module parameters. # # Format of this file: list of modules, each in its own line. # Anything after a '#' is ignore, likewise trailing and leading # whitespaces and empty lines. # Digium TE205P/TE207P/TE210P/TE212P: PCI dual-port T1/E1/J1 # Digium TE405P/TE407P/TE410P/TE412P: PCI quad-port T1/E1/J1 # Digium TE220: PCI-Express dual-port T1/E1/J1 # Digium TE420: PCI-Express quad-port T1/E1/J1 wct4xxp # Digium TE120P: PCI single-port T1/E1/J1 # Digium TE121: PCI-Express single-port T1/E1/J1 # Digium TE122: PCI single-port T1/E1/J1 wcte12xp # Digium T100P: PCI single-port T1 # Digium E100P: PCI single-port E1 wct1xxp # Digium TE110P: PCI single-port T1/E1/J1 wcte11xp # Digium TDM2400P/AEX2400: up to 24 analog ports # Digium TDM800P/AEX800: up to 8 analog ports # Digium TDM410P/AEX410: up to 4 analog ports wctdm24xxp # X100P - Single port FXO interface # X101P - Single port FXO interface wcfxo # Digium TDM400P: up to 4 analog ports wctdm # Digium B410P: 4 NT/TE BRI ports wcb4xxp # Digium TC400B: G729 / G723 Transcoding Engine wctc4xxp # Xorcom Astribank Devices xpp_usb dahdi-tools-2.2.0-rc2/modprobe.conf.sample0000664000000000000000000000016211034763261017046 0ustar rootroot# You should place any module parameters for your DAHDI modules here # Example: # # options wctdm24xxp latency=6 dahdi-tools-2.2.0-rc2/dahdi_tools_version.h0000664000000000000000000000114011046162606017313 0ustar rootroot/* * Copyright (C) 2008 Digium, Inc. * * All rights reserved. * */ /* * 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 as published by the * Free Software Foundation. See the LICENSE file included with * this program for more details. */ extern const char dahdi_tools_version[]; dahdi-tools-2.2.0-rc2/xpp/0000775000000000000000000000000011176143301013712 5ustar rootrootdahdi-tools-2.2.0-rc2/xpp/astribank_usb.h0000664000000000000000000000532411165223212016714 0ustar rootroot#ifndef ASTRIBANK_USB_H #define ASTRIBANK_USB_H /* * Written by Oron Peled * Copyright (C) 2008, Xorcom * * All rights reserved. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include "mpp.h" /* * Astribank handling */ #define PACKET_SIZE 512 /* USB Endpoints */ #define MP_EP_OUT 0x04 /* Managment processor */ #define MP_EP_IN 0x88 /* Managment processor */ #define XPP_EP_OUT 0x02 /* XPP */ #define XPP_EP_IN 0x86 /* XPP */ /* USB firmware types */ #define USB_11xx 0 #define USB_FIRMWARE_II 1 #define USB_PIC 2 struct interface_type { int type_code; int num_interfaces; int my_interface_num; int num_endpoints; int my_ep_out; int my_ep_in; char *name; int endpoints[4]; /* for matching */ }; enum eeprom_burn_state { BURN_STATE_NONE = 0, BURN_STATE_STARTED = 1, BURN_STATE_ENDED = 2, BURN_STATE_FAILED = 3, }; struct astribank_device { struct usb_device *dev; usb_dev_handle *handle; int my_interface_num; int my_ep_out; int my_ep_in; char iManufacturer[BUFSIZ]; char iProduct[BUFSIZ]; char iSerialNumber[BUFSIZ]; char iInterface[BUFSIZ]; int is_usb2; enum eeprom_type eeprom_type; enum eeprom_burn_state burn_state; uint8_t status; uint8_t mpp_proto_version; struct eeprom_table *eeprom; const struct interface_type *fwtype; uint16_t tx_sequenceno; }; /* * Prototypes */ struct astribank_device *astribank_open(const char devpath[], int iface_num); void astribank_close(struct astribank_device *astribank, int disconnected); void show_astribank_info(const struct astribank_device *astribank); int send_usb(struct astribank_device *astribank, char *buf, int len, int timeout); int recv_usb(struct astribank_device *astribank, char *buf, size_t len, int timeout); int flush_read(struct astribank_device *astribank); int eeprom_fill(struct eeprom_table *eprm, const char *vendor, const char *product, const char *release, const char *label); int astribank_has_twinstar(struct astribank_device *astribank); int label_isvalid(const char *label); #endif /* ASTRIBANK_USB_H */ dahdi-tools-2.2.0-rc2/xpp/mpp_funcs.h0000664000000000000000000000646111165223212016062 0ustar rootroot#ifndef MPP_FUNCS_H #define MPP_FUNCS_H /* * Written by Oron Peled * Copyright (C) 2008, Xorcom * * All rights reserved. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include "mpp.h" #include "astribank_usb.h" #define TIMEOUT 2000 /* high-level */ struct astribank_device *mpp_init(const char devpath[]); void mpp_exit(struct astribank_device *astribank); int mpp_proto_query(struct astribank_device *astribank); int mpp_status_query(struct astribank_device *astribank); int mpp_eeprom_set(struct astribank_device *astribank, const struct eeprom_table *et); int mpp_renumerate(struct astribank_device *astribank); int mpp_caps_get(struct astribank_device *astribank, struct eeprom_table *et, struct capabilities *cap, struct capkey *key); int mpp_caps_set(struct astribank_device *astribank, const struct eeprom_table *eeprom_table, const struct capabilities *capabilities, const struct capkey *key); int mpp_extrainfo_get(struct astribank_device *astribank, struct extrainfo *info); int mpp_extrainfo_set(struct astribank_device *astribank, const struct extrainfo *info); int mpp_eeprom_blk_rd(struct astribank_device *astribank, uint8_t *buf, uint16_t offset, uint16_t len); int mpp_send_start(struct astribank_device *astribank, enum dev_dest dest); int mpp_send_end(struct astribank_device *astribank); int mpp_send_seg(struct astribank_device *astribank, const uint8_t *data, uint16_t offset, uint16_t len); int mpp_reset(struct astribank_device *astribank, int full_reset); int mpp_serial_cmd(struct astribank_device *astribank, const uint8_t *in, uint8_t *out, uint16_t len); void show_eeprom(const struct eeprom_table *eprm, FILE *fp); void show_capabilities(const struct capabilities *capabilities, FILE *fp); void show_astribank_status(struct astribank_device *astribank, FILE *fp); void show_extrainfo(const struct extrainfo *extrainfo, FILE *fp); int twinstar_show(struct astribank_device *astribank, FILE *fp); /* * Serial commands to FPGA */ int mpps_card_info(struct astribank_device *astribank, int unit, uint8_t *card_type, uint8_t *card_status); /* * Twinstar */ int mpp_tws_watchdog(struct astribank_device *astribank); int mpp_tws_setwatchdog(struct astribank_device *astribank, int yes); int mpp_tws_powerstate(struct astribank_device *astribank); int mpp_tws_portnum(struct astribank_device *astribank); int mpp_tws_setportnum(struct astribank_device *astribank, uint8_t portnum); /* low-level */ int process_command(struct astribank_device *astribank, struct mpp_command *cmd, struct mpp_command **reply_ref); struct mpp_command *new_command(uint8_t op, uint16_t extra_data); void free_command(struct mpp_command *cmd); #endif /* MPP_FUNCS_H */ dahdi-tools-2.2.0-rc2/xpp/genconf_parameters0000664000000000000000000001051611153311554017504 0ustar rootroot# # /etc/dahdi/genconf_parameters # # This file contains parameters that affect the # dahdi_genconf configurator generator. # # Syntax: # * A comment from '#' to end of line # * Blank lines ignored # * Whitespace at end of line trimmed # * Single valued items: # key value # * List valued items: # key # value1 # value2 # ... # # When generating extensions for chan_dahdi.conf or users.conf etc: the # extension number will be channel_number+base_exten . The default is: #base_exten 4000 # # Make FXS (analog phones) extentions answer immediately (sets # 'immediate = yes' for them in chan_dahdi.conf). Don't enable this before # you're read documentation about this option. #fxs_immediate yes # # For FXS (analog phones) - use KS or LS? ks is the only method for # Asterisk to provide disconnect supervision and thus it would normally # be preffered and is the default. #fxs_default_start ls # # For FXO (analog lines) - use KS or LS? KS is the default and is # normally the better choice as it allows detecting handups on many # lines. #fxo_default_start ls # Set tone zone values. This is used for playing tones (busy, dialtone # and such). The default is 'us'. This sets the value for both loadzone # and defaultzone in system.conf . #lc_country il # The dialplan contenxt into which to send trunks in chan_dahdi.conf or # users.conf. The default value is: #context_lines from-pstn # # The dialplan context into which to send extensions in chan_dahdi.conf or # users.conf. The default value is: #context_phones from-internal # # Two extea contexts for the input ports and output ports of an # Astribank. Default values are: #context_input astbank-input #context_output astbank-output # A group to put all analog phones in. By default 0, so you can dial to # the 'first phone available' using Dahdi/g5 . #group_phones 5 # # A group in which to put all the channels belonging to some trunk. # Thus you can dial through "some trunk" using Dahdi/G0/NUMBER #group_lines 0 # Channels of digital trunk of span N are also added to group 10+N (that # is: 14 for channels of span 4). # Do we want to use PtP ('bri') or PtMP ('bri_ptmp') for BRI? PtMP # allows connecting several CPE devices on the same network device # (several BRI phones on the same line, kind of like several analog # phones on the same analog line). However it is generally brings # unnecessary complexity for a pbx-pbx connection. It is still the # default as this is normally what you get for a BRI PSTN connection. #bri_sig_style bri # # If this option is set (that is: not remmed-out), BRI NT ports will # also be set as overlap. This is useful if you want to connect ISDN # phones. #brint_overlap # The echo canceller to use. If you have a hardware echo canceller, just # leave it be, as this one won't be used anyway. # # The default is mg2, but it may change in the future. E.g: a packager # that bundles a better echo canceller may set it as the default, or # dahdi_genconf will scan for the "best" echo canceller. # #echo_can hpec #echo_can oslec #echo_can none # to aboid echo cancellers altogether # bri_hardhdlc: If this parameter is set to 'yes', in the entries for # BRI cards 'hardhdlc' will be used instead of 'dchan' (an alias for # 'fcshdlc'). #bri_hardhdlc yes # For MFC/R2 Support: 'R2' will make E1 spans CAS and with the # 'r2_idle_bits' bit in system.conf . It will also make dahdi_genconf default # to generating the channels of this card in unicall.conf rather than in # chan_dahdi.conf . The meaning of this may be extended somehow to support # R2 through openr2/chan_dahdi later on. #pri_connection_type R2 #r2_idle_bits 1101 # pri_termtype contains a list of settings: # Currently the only setting is for TE or NT (the default is TE). This # sets two different but normally related configuration items: # # A TE span will have *_cpe signalling in Asterisk and will also get # timing from the remote party. # # A NT span will have *_new signalling in Asterisk and will provide # timing to the remote party. # # pri_termtype is a list if span specs and configuration (TE/NT) for # them. The first spec that matches is used. The matching is of perl # regular expressions, but with '*' and '?' have their meaning from # basic regular expressions. #pri_termtype # SPAN/2 NT # SPAN/4 NT # #pri_termtype # SPAN/* NT # dahdi-tools-2.2.0-rc2/xpp/debug.c0000664000000000000000000000262011165223212015142 0ustar rootroot/* * Written by Oron Peled * Copyright (C) 2008, Xorcom * * All rights reserved. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include "debug.h" int verbose = LOG_DEBUG; int debug_mask = 0; void log_function(int level, int mask, const char *msg, ...) { va_list ap; va_start(ap, msg); if(verbose >= level) { if(level < LOG_DEBUG || (mask & debug_mask)) vfprintf(stderr, msg, ap); } va_end(ap); } void dump_packet(int loglevel, const char *msg, const char *buf, int len) { int i; log_function(loglevel, ~0, "%-15s:", msg); for(i = 0; i < len; i++) log_function(loglevel, ~0, " %02X", (uint8_t)buf[i]); log_function(loglevel, ~0, "\n"); } dahdi-tools-2.2.0-rc2/xpp/perl_modules/0000775000000000000000000000000011176143301016404 5ustar rootrootdahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/0000775000000000000000000000000011176143301017415 5ustar rootrootdahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Hardware/0000775000000000000000000000000011176143301021152 5ustar rootrootdahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Hardware/USB.pm0000664000000000000000000001142511165223212022142 0ustar rootrootpackage Dahdi::Hardware::USB; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: USB.pm 6313 2009-04-02 20:56:42Z tzafrir $ # use strict; use Dahdi::Utils; use Dahdi::Hardware; use Dahdi::Xpp::Mpp; our @ISA = qw(Dahdi::Hardware); my %usb_ids = ( # from wcusb '06e6:831c' => { DRIVER => 'wcusb', DESCRIPTION => 'Wildcard S100U USB FXS Interface' }, '06e6:831e' => { DRIVER => 'wcusb2', DESCRIPTION => 'Wildcard S110U USB FXS Interface' }, '06e6:b210' => { DRIVER => 'wc_usb_phone', DESCRIPTION => 'Wildcard Phone Test driver' }, # from xpp_usb 'e4e4:1130' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-8/16 no-firmware' }, 'e4e4:1131' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-8/16 USB-firmware' }, 'e4e4:1132' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-8/16 FPGA-firmware' }, 'e4e4:1140' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-BRI no-firmware' }, 'e4e4:1141' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-BRI USB-firmware' }, 'e4e4:1142' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-BRI FPGA-firmware' }, 'e4e4:1150' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi no-firmware' }, 'e4e4:1151' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi USB-firmware' }, 'e4e4:1152' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-multi FPGA-firmware' }, 'e4e4:1160' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular no-firmware' }, 'e4e4:1161' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular USB-firmware' }, 'e4e4:1162' => { DRIVER => 'xpp_usb', DESCRIPTION => 'Astribank-modular FPGA-firmware' }, # Sangoma USB FXO: '10c4:8461' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma WANPIPE USB-FXO Device' }, ); $ENV{PATH} .= ":/usr/sbin:/sbin:/usr/bin:/bin"; sub usb_sorter() { return $a->hardware_name cmp $b->hardware_name; } sub mpp_addinfo($) { my $self = shift || die; my $mppinfo = Dahdi::Xpp::Mpp->new($self); $self->{MPPINFO} = $mppinfo if defined $mppinfo; } sub new($@) { my $pack = shift or die "Wasn't called as a class method\n"; my %attr = @_; my $name = sprintf("usb:%s", $attr{PRIV_DEVICE_NAME}); my $self = Dahdi::Hardware->new($name, 'USB'); %{$self} = (%{$self}, %attr); bless $self, $pack; return $self; } sub readval($) { my $fname = shift || warn; open(F, $fname) || warn "Failed opening '$fname': $!"; my $val = ; close F; chomp $val; warn "$fname is empty" unless defined $val and $val; return $val; } sub set_transport($$) { my $pack = shift || die; my $xbus = shift || die; my $xbus_dir = shift; my $transportdir = "$xbus_dir/transport"; my $hwdev; if(! -e "$transportdir/ep_00") { warn "A trasnport in '$transportdir' is not USB"; return undef; } my ($usbdev) = glob("$transportdir/usb_device:*"); my $busnum; my $devnum; # Different kernels... if(defined $usbdev) { # It's USB if($usbdev =~ /.*usb_device:usbdev(\d+)\.(\d+)/) { $busnum = $1; $devnum = $2; } else { warn "Bad USB transportdir='$transportdir' usbdev='$usbdev'\n"; } } elsif(-d "$transportdir/usb_endpoint") { $busnum = readval("$transportdir/busnum"); $devnum = readval("$transportdir/devnum"); } my $usbname = sprintf("%03d/%03d", $busnum, $devnum); #printf STDERR "DEBUG: %03d/%03d\n", $busnum, $devnum; $xbus->{USB_DEVNAME} = $usbname; $hwdev = Dahdi::Hardware->device_by_hwname("usb:$usbname"); #print "set_transport: ", $hwdev, "\n"; $xbus->{TRANSPORT} = $hwdev; $hwdev->{XBUS} = $xbus; $hwdev->{LOADED} = 'xpp_usb'; $xbus->{IS_TWINSTAR} = $hwdev->is_twinstar; return $hwdev; } sub scan_devices($) { my $pack = shift || die; my $usb_device_list = "/proc/bus/usb/devices"; return unless (-r $usb_device_list); my @devices; open(F, $usb_device_list) || die "Failed to open $usb_device_list: $!"; local $/ = ''; while() { my @lines = split(/\n/); my ($tline) = grep(/^T/, @lines); my ($pline) = grep(/^P/, @lines); my ($sline) = grep(/^S:.*SerialNumber=/, @lines); my ($busnum,$devnum) = ($tline =~ /Bus=(\w+)\W.*Dev#=\s*(\w+)\W/); my $devname = sprintf("%03d/%03d", $busnum, $devnum); my ($vendor,$product) = ($pline =~ /Vendor=(\w+)\W.*ProdID=(\w+)\W/); my $serial; if(defined $sline) { $sline =~ /SerialNumber=(.*)/; $serial = $1; #$serial =~ s/[[:^print:]]/_/g; } my $model = $usb_ids{"$vendor:$product"}; next unless defined $model; my $d = Dahdi::Hardware::USB->new( IS_ASTRIBANK => ($model->{DRIVER} eq 'xpp_usb')?1:0, PRIV_DEVICE_NAME => $devname, VENDOR => $vendor, PRODUCT => $product, SERIAL => $serial, DESCRIPTION => $model->{DESCRIPTION}, DRIVER => $model->{DRIVER}, ); push(@devices, $d); } close F; @devices = sort usb_sorter @devices; return @devices; } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Hardware/PCI.pm0000664000000000000000000002356511165223212022134 0ustar rootrootpackage Dahdi::Hardware::PCI; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: PCI.pm 6313 2009-04-02 20:56:42Z tzafrir $ # use strict; use Dahdi::Utils; use Dahdi::Hardware; our @ISA = qw(Dahdi::Hardware); # Lookup algorithm: # First match 'vendor:product/subvendor:subproduct' key # Else match 'vendor:product/subvendor' key # Else match 'vendor:product' key # Else not a dahdi hardware. my %pci_ids = ( # from wct4xxp '10ee:0314' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P/TE405P (1st Gen)' }, 'd161:0420/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE420 (4th Gen)' }, 'd161:0410/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P (4th Gen)' }, 'd161:0405/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE405P (4th Gen)' }, 'd161:0410/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P (3rd Gen)' }, 'd161:0405/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE405P (3rd Gen)' }, 'd161:0410' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE410P (2nd Gen)' }, 'd161:0405' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE405P (2nd Gen)' }, 'd161:0220/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE220 (4th Gen)' }, 'd161:0205/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE205P (4th Gen)' }, 'd161:0210/0004' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P (4th Gen)' }, 'd161:0205/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE205P (3rd Gen)' }, 'd161:0210/0003' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P (3rd Gen)' }, 'd161:0205' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE205P ' }, 'd161:0210' => { DRIVER => 'wct4xxp', DESCRIPTION => 'Wildcard TE210P ' }, # from wctdm24xxp 'd161:2400' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM2400P' }, 'd161:0800' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM800P' }, 'd161:8002' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX800' }, 'd161:8003' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX2400' }, 'd161:8005' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard TDM410P' }, 'd161:8006' => { DRIVER => 'wctdm24xxp', DESCRIPTION => 'Wildcard AEX410P' }, # from pciradio 'e159:0001/e16b' => { DRIVER => 'pciradio', DESCRIPTION => 'PCIRADIO' }, # from wcfxo 'e159:0001/8084' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P clone' }, 'e159:0001/8085' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P' }, 'e159:0001/8086' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P clone' }, 'e159:0001/8087' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X101P clone' }, '1057:5608' => { DRIVER => 'wcfxo', DESCRIPTION => 'Wildcard X100P' }, # from wct1xxp 'e159:0001/6159' => { DRIVER => 'wct1xxp', DESCRIPTION => 'Digium Wildcard T100P T1/PRI or E100P E1/PRA Board' }, # from wctdm 'e159:0001/a159' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard S400P Prototype' }, 'e159:0001/e159' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard S400P Prototype' }, 'e159:0001/b100' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV E/F' }, 'e159:0001/b1d9' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV I' }, 'e159:0001/b118' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV I' }, 'e159:0001/b119' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV I' }, 'e159:0001/a9fd' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, 'e159:0001/a8fd' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, 'e159:0001/a800' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, 'e159:0001/a801' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, 'e159:0001/a908' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, 'e159:0001/a901' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, #'e159:0001' => { DRIVER => 'wctdm', DESCRIPTION => 'Wildcard TDM400P REV H' }, # from wcte11xp 'e159:0001/71fe' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, 'e159:0001/79fe' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, 'e159:0001/795e' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, 'e159:0001/79de' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, 'e159:0001/797e' => { DRIVER => 'wcte11xp', DESCRIPTION => 'Digium Wildcard TE110P T1/E1 Board' }, # from wcte12xp 'd161:0120' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE12xP' }, 'd161:8000' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE121' }, 'd161:8001' => { DRIVER => 'wcte12xp', DESCRIPTION => 'Wildcard TE122' }, # from wcb4xxp 'd161:b410' => { DRIVER => 'wcb4xxp', DESCRIPTION => 'Digium Wildcard B410P' }, # from tor2 '10b5:9030' => { DRIVER => 'tor2', DESCRIPTION => 'PLX 9030' }, '10b5:3001' => { DRIVER => 'tor2', DESCRIPTION => 'PLX Development Board' }, '10b5:d00d' => { DRIVER => 'tor2', DESCRIPTION => 'Tormenta 2 Quad T1/PRI or E1/PRA' }, '10b5:4000' => { DRIVER => 'tor2', DESCRIPTION => 'Tormenta 2 Quad T1/E1 (non-Digium clone)' }, # Cologne Chips: # (Still a partial list) '1397:08b4/b556' => { DRIVER => 'qozap', DESCRIPTION => 'Junghanns DuoBRI ISDN card' }, '1397:08b4' => { DRIVER => 'qozap', DESCRIPTION => 'Junghanns QuadBRI ISDN card' }, '1397:16b8' => { DRIVER => 'qozap', DESCRIPTION => 'Junghanns OctoBRI ISDN card' }, '1397:30b1' => { DRIVER => 'cwain', DESCRIPTION => 'HFC-E1 ISDN E1 card' }, '1397:2bd0' => { DRIVER => 'zaphfc', DESCRIPTION => 'HFC-S ISDN BRI card' }, # Has three submodels. Tested with 0675:1704: '1043:0675' => { DRIVER => 'zaphfc', DESCRIPTION => 'ASUSTeK Computer Inc. ISDNLink P-IN100-ST-D' }, '1397:f001' => { DRIVER => 'ztgsm', DESCRIPTION => 'HFC-GSM Cologne Chips GSM' }, # Rhino cards (based on pci.ids) '0b0b:0105' => { DRIVER => 'r1t1', DESCRIPTION => 'Rhino R1T1' }, '0b0b:0205' => { DRIVER => 'r4fxo', DESCRIPTION => 'Rhino R14FXO' }, '0b0b:0206' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB4FXO 4-channel FXO analog telphony card' }, '0b0b:0305' => { DRIVER => 'r1t1', DESCRIPTION => 'Rhino R1T1' }, '0b0b:0405' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R8FXX' }, '0b0b:0406' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB8FXX 8-channel modular analog telphony card' }, '0b0b:0505' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R24FXX' }, '0b0b:0506' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB24FXS 24-Channel FXS analog telphony card' }, '0b0b:0605' => { DRIVER => 'rxt1', DESCRIPTION => 'Rhino R2T1' }, '0b0b:0705' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino R24FXS' }, '0b0b:0706' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB24FXO 24-Channel FXO analog telphony card' }, '0b0b:0906' => { DRIVER => 'rcbfx', DESCRIPTION => 'Rhino RCB24FXX 24-channel modular analog telphony card' }, # Sangoma cards (based on pci.ids) '1923:0040' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A200/Remora FXO/FXS Analog AFT card' }, '1923:0100' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A104d QUAD T1/E1 AFT card' }, '1923:0300' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A101 single-port T1/E1' }, '1923:0400' => { DRIVER => 'wanpipe', DESCRIPTION => 'Sangoma Technologies Corp. A104u Quad T1/E1 AFT' }, # Yeastar (from output of modinfo): 'e159:0001/2151' => { DRIVER => 'ystdm8xx', DESCRIPTION => 'Yeastar YSTDM8xx'}, ); $ENV{PATH} .= ":/usr/sbin:/sbin:/usr/bin:/bin"; sub pci_sorter { return $a->priv_device_name() cmp $b->priv_device_name(); } sub new($@) { my $pack = shift || die "Wasn't called as a class method\n"; my %attr = @_; my $name = sprintf("pci:%s", $attr{PRIV_DEVICE_NAME}); my $self = Dahdi::Hardware->new($name, 'PCI'); %{$self} = (%{$self}, %attr); bless $self, $pack; return $self; } my %pci_devs; sub readfile($) { my $name = shift || die; open(F, $name) || die "Failed to open '$name': $!"; my $str = ; close F; chomp($str); return $str; } sub scan_devices($) { my @devices; while() { m,([^/]+)$,,; my $name = $1; my $l = readlink $_ || die; $pci_devs{$name}{PRIV_DEVICE_NAME} = $name; $pci_devs{$name}{DEVICE} = $l; $pci_devs{$name}{VENDOR} = readfile "$_/vendor"; $pci_devs{$name}{PRODUCT} = readfile "$_/device"; $pci_devs{$name}{SUBVENDOR} = readfile "$_/subsystem_vendor"; $pci_devs{$name}{SUBPRODUCT} = readfile "$_/subsystem_device"; my $dev = $pci_devs{$name}; grep(s/0x//, $dev->{VENDOR}, $dev->{PRODUCT}, $dev->{SUBVENDOR}, $dev->{SUBPRODUCT}); $pci_devs{$name}{DRIVER} = ''; } while() { m,^(.*?)/([^/]+)/([^/]+)$,; my $prefix = $1; my $drvname = $2; my $id = $3; my $l = readlink "$prefix/$drvname/module"; # Find the real module name (if we can). if(defined $l) { my $moduledir = "$prefix/$drvname/$l"; my $modname = $moduledir; $modname =~ s:^.*/::; $drvname = $modname; } $pci_devs{$id}{LOADED} = $drvname; } foreach (sort keys %pci_devs) { my $dev = $pci_devs{$_}; my $key; # Try to match $key = "$dev->{VENDOR}:$dev->{PRODUCT}/$dev->{SUBVENDOR}:$dev->{SUBPRODUCT}"; $key = "$dev->{VENDOR}:$dev->{PRODUCT}/$dev->{SUBVENDOR}" if !defined($pci_ids{$key}); $key = "$dev->{VENDOR}:$dev->{PRODUCT}" if !defined($pci_ids{$key}); next unless defined $pci_ids{$key}; my $d = Dahdi::Hardware::PCI->new( PRIV_DEVICE_NAME => $dev->{PRIV_DEVICE_NAME}, VENDOR => $dev->{VENDOR}, PRODUCT => $dev->{PRODUCT}, SUBVENDOR => $dev->{SUBVENDOR}, SUBPRODUCT => $dev->{SUBPRODUCT}, LOADED => $dev->{LOADED}, DRIVER => $pci_ids{$key}{DRIVER}, DESCRIPTION => $pci_ids{$key}{DESCRIPTION}, ); push(@devices, $d); } @devices = sort pci_sorter @devices; return @devices; } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Xpp/0000775000000000000000000000000011176143301020164 5ustar rootrootdahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Xpp/Xbus.pm0000664000000000000000000001256611173076103021457 0ustar rootrootpackage Dahdi::Xpp::Xbus; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Xbus.pm 6417 2009-04-20 13:44:35Z tzafrir $ # use strict; use Dahdi::Utils; use Dahdi::Hardware; use Dahdi::Xpp::Xpd; my $proc_base = "/proc/xpp"; sub xpds($) { my $xbus = shift; return @{$xbus->{XPDS}}; } sub by_number($) { my $busnumber = shift; die "Missing xbus number parameter" unless defined $busnumber; my @xbuses = Dahdi::Xpp::xbuses(); my ($xbus) = grep { $_->num == $busnumber } @xbuses; return $xbus; } sub by_label($) { my $label = shift; die "Missing xbus label parameter" unless defined $label; my @xbuses = Dahdi::Xpp::xbuses(); my ($xbus) = grep { $_->label eq $label } @xbuses; return $xbus; } sub get_xpd_by_number($$) { my $xbus = shift; my $xpdid = shift; die "Missing XPD id parameter" unless defined $xpdid; $xpdid = sprintf("%02d", $xpdid); my @xpds = $xbus->xpds; my ($wanted) = grep { $_->id eq $xpdid } @xpds; return $wanted; } my %file_warned; # Prevent duplicate warnings about same file. sub xbus_attr_path($$) { my ($busnum, @attr) = @_; foreach my $attr (@attr) { my $file = sprintf "$Dahdi::Xpp::sysfs_astribanks/xbus-%02d/$attr", $busnum; unless(-f $file) { my $procfile = sprintf "/proc/xpp/XBUS-%02d/$attr", $busnum; warn "$0: warning - OLD DRIVER: missing '$file'. Fall back to '$procfile'\n" unless $file_warned{$attr}++; $file = $procfile; } next unless -f $file; return $file; } return undef; } sub xbus_getattr($$) { my $xbus = shift || die; my $attr = shift || die; $attr = lc($attr); my $file = xbus_attr_path($xbus->num, lc($attr)); open(F, $file) || die "Failed opening '$file': $!"; my $val = ; close F; chomp $val; return $val; } sub read_attrs() { my $xbus = shift || die; my @attrnames = qw(CONNECTOR LABEL STATUS); my @attrs; foreach my $attr (@attrnames) { my $val = xbus_getattr($xbus, $attr); if($attr eq 'STATUS') { # Some values are in all caps as well $val = uc($val); } elsif($attr eq 'CONNECTOR') { $val =~ s/^/@/; # Add prefix } elsif($attr eq 'LABEL') { # Fix badly burned labels. $val =~ s/[[:^print:]]/_/g; } $xbus->{$attr} = $val; } } sub transport_type($$) { my $xbus = shift || die; my $xbus_dir = shift; my $transport = "$xbus_dir/transport"; if(-e "$transport/ep_00") { # It's USB $xbus->{TRANSPORT_TYPE} = 'USB'; } else { warn "Unkown transport in $xbus_dir\n"; undef $xbus->{TRANSPORT_TYPE}; } return $xbus->{TRANSPORT_TYPE}; } sub read_xpdnames_old($) { my $xbus_num = shift || die; my $pat = sprintf "/proc/xpp/XBUS-%02d/XPD-[0-9][0-9]", $xbus_num; my @xpdnames; #print STDERR "read_xpdnames_old($xbus_num): $pat\n"; foreach (glob $pat) { die "Bad /proc entry: '$_'" unless /^.*XPD-([0-9])([0-9])$/; my $name = sprintf("%02d:%1d:%1d", $xbus_num, $1, $2); #print STDERR "\t> $_ ($name)\n"; push(@xpdnames, $name); } return @xpdnames; } sub read_xpdnames($) { my $xbus_num = shift || die; my $xbus_dir = "$Dahdi::Xpp::sysfs_astribanks/xbus-$xbus_num"; my $pat = sprintf "%s/xbus-%02d/[0-9][0-9]:[0-9]:[0-9]", $Dahdi::Xpp::sysfs_astribanks, $xbus_num; my @xpdnames; #print STDERR "read_xpdnames($xbus_num): $pat\n"; foreach (glob $pat) { die "Bad /sys entry: '$_'" unless m/^.*\/([0-9][0-9]):([0-9]):([0-9])$/; my ($busnum, $unit, $subunit) = ($1, $2, $3); my $name = sprintf("%02d:%1d:%1d", $1, $2, $3); #print STDERR "\t> $_ ($name)\n"; push(@xpdnames, $name); } return @xpdnames; } my $warned_notransport = 0; sub new($$) { my $pack = shift or die "Wasn't called as a class method\n"; my $num = shift; my $xbus_dir = "$Dahdi::Xpp::sysfs_astribanks/xbus-$num"; my $self = { NUM => $num, NAME => "XBUS-$num", SYSFS_DIR => $xbus_dir, }; bless $self, $pack; $self->read_attrs; # Get transport related info my $transport = "$xbus_dir/transport"; my $transport_type = $self->transport_type($xbus_dir); if(defined $transport_type) { my $tt = "Dahdi::Hardware::$transport_type"; my $hw = $tt->set_transport($self, $xbus_dir); #printf STDERR "Xbus::new transport($transport_type): %s\n", $hw->{HARDWARE_NAME}; } my @xpdnames; my @xpds; if(-e $transport) { @xpdnames = read_xpdnames($num); } else { @xpdnames = read_xpdnames_old($num); warn "$0: warning - OLD DRIVER: missing '$transport'. Fall back to /proc\n" unless $warned_notransport++; } foreach my $xpdstr (@xpdnames) { my ($busnum, $unit, $subunit) = split(/:/, $xpdstr); my $procdir = "/proc/xpp/XBUS-$busnum/XPD-$unit$subunit"; my $xpd = Dahdi::Xpp::Xpd->new($self, $unit, $subunit, $procdir, "$xbus_dir/$xpdstr"); push(@xpds, $xpd); } @{$self->{XPDS}} = sort { $a->id <=> $b->id } @xpds; return $self; } sub pretty_xpds($) { my $xbus = shift; my @xpds = sort { $a->id <=> $b->id } $xbus->xpds(); my @xpd_types = map { $_->type } @xpds; my $last_type = ''; my $mult = 0; my $xpdstr = ''; foreach my $curr (@xpd_types) { if(!$last_type || ($curr eq $last_type)) { $mult++; } else { if($mult == 1) { $xpdstr .= "$last_type "; } elsif($mult) { $xpdstr .= "$last_type*$mult "; } $mult = 1; } $last_type = $curr; } if($mult == 1) { $xpdstr .= "$last_type "; } elsif($mult) { $xpdstr .= "$last_type*$mult "; } $xpdstr =~ s/\s*$//; # trim trailing space return $xpdstr; } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Xpp/Mpp.pm0000664000000000000000000001316311173076103021264 0ustar rootrootpackage Dahdi::Xpp::Mpp; # # Written by Oron Peled # Copyright (C) 2009, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Mpp.pm 6417 2009-04-20 13:44:35Z tzafrir $ # use strict; use File::Basename; use Getopt::Std; BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); } use Dahdi::Utils; =head1 NAME Dahdi::Xpp::Mpp - Perl interface to C =head1 DESCRIPTION This package uses C to collect information about Astribanks via MPP (Managment Processor Protocol). The binary default location is F. It may be overridden via module parameter C and the C environment variable (higher priority). It may also be set/unset from code via the set_astribank_tool() method. =head1 METHODS =head2 mpp_addinfo() Called with a list of C objects and augment their data with C objects. This method is the normal external interface of this class. =head2 new() Constructor. Receive as parameter an instance of C class and return a C object. Normally, used indirectly via the mpp_addinfo() method. =head2 set_astribank_tool() Override default location of astribank_tool(8). It is legal to set it to C. =head2 showinfo() Dump an C object for debugging. =cut my $astribank_tool = '/usr/sbin/astribank_tool'; sub set_astribank_tool($$) { my $pack = shift || die; $pack eq 'Dahdi::Xpp::Mpp' or die "$0: Called from wrong package? ($pack)"; my $arg = shift; $astribank_tool = $arg; #print STDERR "Setting astribank_tool='$astribank_tool'\n"; } sub import { my ($param) = grep(/^astribank_tool=/, @_); if(defined $param) { $param =~ s/^astribank_tool=//; $astribank_tool = $param; } if(defined $ENV{ASTRIBANK_TOOL}) { $astribank_tool = $ENV{ASTRIBANK_TOOL}; } } sub showinfo($$) { my $self = shift || die; my $prefix = shift || die; return unless defined $self; foreach my $k (sort keys %{$self}) { my $v = $self->{$k}; if(ref($v) eq 'ARRAY') { my @a = @{$v}; my $i; my $ki; for($i = 0; $i < @a; $i++) { $ki = sprintf "%s[%d]", $k, $i; printf "$prefix%-20s %s\n", $ki, $a[$i]; } } else { if($k eq 'DEV') { printf "$prefix%-20s -> %s\n", $k, $v->hardware_name; } else { printf "$prefix%-20s %s\n", $k, $v; } } } } sub astribank_tool_cmd($) { my $dev = shift || die; my $usb_top; # Find USB bus toplevel $usb_top = '/dev/bus/usb'; $usb_top = '/proc/bus/usb' unless -d $usb_top; die "No USB toplevel found\n" unless -d $usb_top; my $name = $dev->priv_device_name(); die "$0: Unkown private device name" unless defined $name; my $path = "$usb_top/$name"; return ($astribank_tool, '-D', "$path"); } sub new($$$) { my $pack = shift || die; my $dev = shift || die; my $product = $dev->product; return undef unless $dev->is_astribank; return undef unless $dev->bus_type eq 'USB'; return undef unless $product =~ /116./; my $mppinfo = { DEV => $dev, HAS_MPP => 1, }; bless $mppinfo, $pack; #print STDERR "$astribank_tool($path) -- '$product'\n"; if(! -x $astribank_tool) { warn "Could not run '$astribank_tool'\n"; return $mppinfo; } return $mppinfo unless $product =~ /116[12]/; $mppinfo->{'MPP_TALK'} = 1; my @cmd = astribank_tool_cmd($dev); my $name = $dev->priv_device_name(); my $dbg_file = "$name"; $dbg_file =~ s/\W/_/g; #$dbg_file = "/tmp/twinstar-debug-$dbg_file"; $dbg_file = "/dev/null"; unless(open(F, "@cmd 2> '$dbg_file' |")) { warn "Failed running '$astribank_tool': $!"; return undef; } local $/ = "\n"; local $_; while() { chomp; #printf STDERR "'%s'\n", $_; if(s/^INFO:\s*//) { $mppinfo->{'PROTOCOL'} = $1 if /^protocol\s+version:\s*(\d+)/i; } elsif(s/^EEPROM:\s*//) { $mppinfo->{'EEPROM_RELEASE'} = $1 if /^release\s*:\s*([\d\.]+)/i; $mppinfo->{'EEPROM_LABEL'} = $1 if /^label\s*:\s*([\w._'-]+)/i; } elsif(s/^Extrainfo:\s+:\s*(.+?)$//) { $mppinfo->{'EEPROM_EXTRAINFO'} = $1; } elsif(s/^Capabilities:\s*TwinStar\s*:\s*(.+?)$//) { my $cap = $1; $mppinfo->{'TWINSTAR_CAPABLE'} = ($cap =~ /yes/i) ? 1 : 0; } elsif(s/^TwinStar:\s*//) { $mppinfo->{'TWINSTAR_PORT'} = $1 if /^connected\s+to\s*:\s*usb-(\d+)/i; if(s/^USB-(\d+)\s*POWER\s*:\s*//) { my $v = ($_ eq 'ON') ? 1 : 0; $mppinfo->{'TWINSTAR_POWER'}->[$1] = $v; } if(s/^Watchdog[^:]+:\s*//) { my $v = ($_ eq 'on-guard') ? 1 : 0; $mppinfo->{'TWINSTAR_WATCHDOG'} = $v; } #printf STDERR "\t%s\n", $_; } else { #printf STDERR "\t%s\n", $_; } } unless(close F) { warn "Failed running '$astribank_tool': $!"; return undef; } #$mppinfo->showinfo; return $mppinfo; } sub mpp_setwatchdog($$) { my $mppinfo = shift || die; my $on = shift; die "$0: Bad value '$on'" unless defined($on) && $on =~ /^[0-1]$/; my $dev = $mppinfo->dev || die; return undef unless defined $mppinfo->mpp_talk; my $old = $mppinfo->tws_watchdog; my @cmd = astribank_tool_cmd($dev); print STDERR "DEBUG($on): '@cmd'\n"; system(@cmd, '-w', $on); die "Running $astribank_tool failed: $?" if $?; } sub mpp_jump($) { my $mppinfo = shift || die; my $dev = $mppinfo->dev || die; return undef unless defined $mppinfo->mpp_talk; my $port = $mppinfo->twinstar_port; $port = ($port == 1) ? 0 : 1; die "Unknown TwinStar port" unless defined $port; my @cmd = astribank_tool_cmd($dev); system(@cmd, '-p', $port); die "Running $astribank_tool failed: $?" if $?; } sub mpp_addinfo($@) { my $pack = shift || die; my @devlist = @_; foreach my $dev (@devlist) { $dev->{MPPINFO} = $pack->new($dev); } } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Xpp/Line.pm0000664000000000000000000000411011134601343021404 0ustar rootrootpackage Dahdi::Xpp::Line; # # Written by Oron Peled # Copyright (C) 2008, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Line.pm 5671 2009-01-18 10:22:27Z tzafrir $ # use strict; use Dahdi::Utils; sub new($$$) { my $pack = shift or die "Wasn't called as a class method\n"; my $xpd = shift or die; my $index = shift; defined $index or die; my $self = {}; bless $self, $pack; $self->{XPD} = $xpd; $self->{INDEX} = $index; return $self; } sub blink($$) { my $self = shift; my $on = shift; my $xpd = $self->xpd; my $result = $xpd->xpd_getattr("blink"); $result = hex($result); if(defined($on)) { # Now change my $onbitmask = 1 << $self->index; my $offbitmask = $result & ~$onbitmask; $result = $offbitmask; $result |= $onbitmask if $on; $result = $xpd->xpd_setattr("blink", $result); } return $result; } sub create_all($$) { my $pack = shift or die "Wasn't called as a class method\n"; my $xpd = shift || die; my $procdir = shift || die; local $/ = "\n"; my @lines; for(my $i = 0; $i < $xpd->{CHANNELS}; $i++) { my $line = Dahdi::Xpp::Line->new($xpd, $i); push(@lines, $line); } $xpd->{LINES} = \@lines; if($xpd->type eq 'FXO') { my $battery = $xpd->xpd_getattr("fxo_battery"); if(defined $battery) { my @batt = split(/\s+/, $battery); foreach my $l (@lines) { die unless @batt; my $state = shift @batt; $l->{BATTERY} = ($state eq '+') ? 1 : 0; } } else { # Fallback to old interface my ($infofile) = glob "$procdir/*_info"; die "Failed globbing '$procdir/*_info'" unless defined $infofile; open(F, "$infofile") || die "Failed opening '$infofile': $!"; my $battery_info = 0; while () { chomp; $battery_info = 1 if /^Battery:/; if($battery_info && s/^\s*on\s*:\s*//) { my @batt = split; foreach my $l (@lines) { die unless @batt; my $state = shift @batt; $l->{BATTERY} = ($state eq '+') ? 1 : 0; } $battery_info = 0; die if @batt; } } close F; } } close F; } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Xpp/Xpd.pm0000664000000000000000000001455511165223212021265 0ustar rootrootpackage Dahdi::Xpp::Xpd; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Xpd.pm 6313 2009-04-02 20:56:42Z tzafrir $ # use strict; use Dahdi::Utils; use Dahdi::Xpp; use Dahdi::Xpp::Line; my %file_warned; # Prevent duplicate warnings about same file. sub xpd_attr_path($@) { my $self = shift || die; my ($busnum, $unitnum, $subunitnum, @attr) = ( $self->xbus->num, $self->unit, $self->subunit, @_); foreach my $attr (@attr) { my $file = sprintf "$Dahdi::Xpp::sysfs_xpds/%02d:%1d:%1d/$attr", $busnum, $unitnum, $subunitnum; unless(-f $file) { my $procfile = sprintf "/proc/xpp/XBUS-%02d/XPD-%1d%1d/$attr", $busnum, $unitnum, $subunitnum; warn "$0: warning - OLD DRIVER: missing '$file'. Fall back to /proc\n" unless $file_warned{$attr}++; $file = $procfile; } next unless -f $file; return $file; } return undef; } # Backward compat plug for old /proc interface... sub xpd_old_gettype($) { my $xpd = shift || die; my $summary = "/proc/xpp/" . $xpd->fqn . "/summary"; open(F, $summary) or die "Failed to open '$summary': $!"; my $head = ; close F; chomp $head; $head =~ s/^XPD-\d+\s+\(//; $head =~ s/,.*//; return $head; } sub xpd_old_getspan($) { my $xpd = shift || die; my $dahdi_registration = "/proc/xpp/" . $xpd->fqn . "/dahdi_registration"; open(F, $dahdi_registration) or die "Failed to open '$dahdi_registration': $!"; my $head = ; close F; chomp $head; return $head; } sub xpd_old_getoffhook($) { my $xpd = shift || die; my $summary = "/proc/xpp/" . $xpd->fqn . "/summary"; my $channels; local $/ = "\n"; open(F, "$summary") || die "Failed opening $summary: $!\n"; my $head = ; chomp $head; # "XPD-00 (BRI_TE ,card present, span 3)" my $offhook; while() { chomp; if(s/^\s*offhook\s*:\s*//) { s/\s*$//; $offhook = $_; $offhook || die "No channels in '$summary'"; last; } } close F; return $offhook; } my %attr_missing_warned; # Prevent duplicate warnings sub xpd_getattr($$) { my $xpd = shift || die; my $attr = shift || die; $attr = lc($attr); my $file = $xpd->xpd_attr_path(lc($attr)); # Handle special cases for backward compat return xpd_old_gettype($xpd) if $attr eq 'type' and !defined $file; return xpd_old_getspan($xpd) if $attr eq 'span' and !defined $file; return xpd_old_getoffhook($xpd) if $attr eq 'offhook' and !defined $file; if(!defined($file)) { warn "$0: xpd_getattr($attr) -- Missing attribute.\n" if $attr_missing_warned{$attr}; return undef; } open(F, $file) || return undef; my $val = ; close F; chomp $val; return $val; } sub xpd_setattr($$$) { my $xpd = shift || die; my $attr = shift || die; my $val = shift; $attr = lc($attr); my $file = xpd_attr_path($xpd, $attr); my $oldval = $xpd->xpd_getattr($attr); open(F, ">$file") or die "Failed to open $file for writing: $!"; print F "$val"; if(!close(F)) { if($! == 17) { # EEXISTS # good } else { return undef; } } return $oldval; } sub blink($$) { my $self = shift; my $on = shift; my $result = $self->xpd_getattr("blink"); if(defined($on)) { # Now change $self->xpd_setattr("blink", ($on)?"0xFFFF":"0"); } return $result; } sub dahdi_registration($$) { my $self = shift; my $on = shift; my $result; my $file = $self->xpd_attr_path("span", "dahdi_registration"); die "$file is missing" unless -f $file; # First query open(F, "$file") or die "Failed to open $file for reading: $!"; $result = ; chomp $result; close F; if(defined($on) and $on ne $result) { # Now change open(F, ">$file") or die "Failed to open $file for writing: $!"; print F ($on)?"1":"0"; if(!close(F)) { if($! == 17) { # EEXISTS # good } else { undef $result; } } } return $result; } sub xpds_by_spanno() { my @xbuses = Dahdi::Xpp::xbuses(); my @xpds = map { $_->xpds } @xbuses; @xpds = grep { $_->spanno } @xpds; @xpds = sort { $a->spanno <=> $b->spanno } @xpds; my @spanno = map { $_->spanno } @xpds; my @idx; @idx[@spanno] = @xpds; # The spanno is the index now return @idx; } sub new($$$$$) { my $pack = shift or die "Wasn't called as a class method\n"; my $xbus = shift || die; my $unit = shift; # May be zero my $subunit = shift; # May be zero my $procdir = shift || die; my $sysfsdir = shift || die; my $self = { XBUS => $xbus, ID => sprintf("%1d%1d", $unit, $subunit), FQN => $xbus->name . "/" . "XPD-$unit$subunit", UNIT => $unit, SUBUNIT => $subunit, DIR => $procdir, SYSFS_DIR => $sysfsdir, }; bless $self, $pack; my @offhook = split / /, ($self->xpd_getattr('offhook')); $self->{CHANNELS} = @offhook; my $type = $self->xpd_getattr('type'); my $span = $self->xpd_getattr('span'); $self->{SPANNO} = $span; $self->{TYPE} = $type; if($type =~ /BRI_(NT|TE)/) { $self->{IS_BRI} = 1; $self->{TERMTYPE} = $1; } $self->{IS_PRI} = ($type =~ /[ETJ]1/); $self->{IS_DIGITAL} = ( $self->{IS_BRI} || $self->{IS_PRI} ); Dahdi::Xpp::Line->create_all($self, $procdir); return $self; } #------------------------------------ # static xpd related helper functions #------------------------------------ sub sync_priority_rank($) { my $xpd = shift || die; # The @rank array is ordered by priority of sync (good to bad) my @rank = ( ($xpd->is_pri and defined($xpd->termtype) and $xpd->termtype eq 'TE'), ($xpd->is_bri and defined($xpd->termtype) and $xpd->termtype eq 'TE'), ($xpd->is_pri), ($xpd->type eq 'FXO'), ($xpd->is_bri), ($xpd->type eq 'FXS'), ); for(my $i = 0; $i < @rank; $i++) { return $i if $rank[$i]; } return @rank + 1; } # An XPD sync priority comparator for sort() sub sync_priority_compare() { my $rank_a = sync_priority_rank($a); my $rank_b = sync_priority_rank($b); #print STDERR "DEBUG: $rank_a (", $a->fqn, ") $rank_b (", $b->fqn, ")\n"; return $a->fqn cmp $b->fqn if $rank_a == $rank_b; return $rank_a <=> $rank_b; } # For debugging: show a list of XPD's with relevant sync info. sub show_xpd_rank(@) { print STDERR "XPD's by rank\n"; foreach my $xpd (@_) { my $type = $xpd->type; my $rank = sync_priority_rank($xpd); if($xpd->is_digital) { $type .= " (TERMTYPE " . ($xpd->termtype || "UNKNOWN") . ")"; } printf STDERR "%3d %-15s %s\n", $rank, $xpd->fqn, $type; } } sub xpds_by_rank(@) { my @xpd_prio = sort sync_priority_compare @_; #show_xpd_rank(@xpd_prio); return @xpd_prio; } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Utils.pm0000664000000000000000000000225111026514254021056 0ustar rootrootpackage Dahdi::Utils; # Accessors (miniperl does not have Class:Accessor) our $AUTOLOAD; sub AUTOLOAD { my $self = shift; my $name = $AUTOLOAD; $name =~ s/.*://; # strip fully-qualified portion return if $name =~ /^[A-Z_]+$/; # ignore special methods (DESTROY) my $key = uc($name); my $val = shift; if (defined $val) { #print STDERR "set: $key = $val\n"; return $self->{$key} = $val; } else { if(!exists $self->{$key}) { #$self->xpp_dump; #die "Trying to get uninitialized '$key'"; } my $val = $self->{$key}; #print STDERR "get: $key ($val)\n"; return $val; } } sub xpp_dump($) { my $self = shift || die; printf STDERR "Dump a %s\n", ref($self); foreach my $k (sort keys %{$self}) { my $val = $self->{$k}; $val = '**UNDEF**' if !defined $val; printf STDERR " %-20s %s\n", $k, $val; } } # Based on Autoloader sub import { my $pkg = shift; my $callpkg = caller; #print STDERR "import: $pkg, $callpkg\n"; # # Export symbols, but not by accident of inheritance. # die "Sombody inherited Dahdi::Utils" if $pkg ne 'Dahdi::Utils'; no strict 'refs'; *{ $callpkg . '::AUTOLOAD' } = \&AUTOLOAD; *{ $callpkg . '::xpp_dump' } = \&xpp_dump; } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Chans.pm0000664000000000000000000001405111155242054021012 0ustar rootrootpackage Dahdi::Chans; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Chans.pm 6110 2009-03-09 16:30:36Z tzafrir $ # use strict; use Dahdi::Utils; =head1 NAME Dahdi::Chans - Perl interface to a Dahdi channel information This package allows access from perl to information about a Dahdi channel. It is part of the Dahdi Perl package. =head1 alarms() In an array context returns a list of alarm strings (RED, BLUE, etc.) for this channel (an empty list == false if there are no alarms). In scalar context returns the number of alarms for a specific channel. =head1 battery() Returns 1 if channel reports to have battery (A remote PBX connected to an FXO port), 0 if channel reports to not have battery and C otherwise. Currently only wcfxo and Astribank FXO modules report battery. For the rest of the channels =head1 fqn() (Fully Qualified Name) Returns the full "name" of the channel. =head1 index() Returns the number of this channel (in the span). =head1 num() Returns the number of this channel as a Dahdi channel. =head signalling() Returns the signalling set for this channel through /etc/dahdi/system.conf . This is always empty before dahdi_cfg was run. And shows the "other" type for FXS and for FXO. =head1 span() Returns a reference to the span to which this channel belongs. =head1 type() Returns the type of the channel: 'FXS', 'FXO', 'EMPTY', etc. =cut my @alarm_types = qw(BLUE YELLOW RED LOOP RECOVERING NOTOPEN); # Taken from dahdi-base.c my @sigtypes = ( "FXSLS", "FXSKS", "FXSGS", "FXOLS", "FXOKS", "FXOGS", "E&M", "E&M-E1", "Clear", "HDLCRAW", "HDLCFCS", "HDLCNET", "Hardware-assisted HDLC", "MTP2", "Slave", "CAS", "DACS", "DACS+RBS", "SF (ToneOnly)", "Unconfigured" ); sub new($$$$$$) { my $pack = shift or die "Wasn't called as a class method\n"; my $span = shift or die "Missing a span parameter\n"; my $index = shift; my $line = shift or die "Missing an input line\n"; defined $index or die "Missing an index parameter\n"; my $self = { 'SPAN' => $span, 'INDEX' => $index, }; bless $self, $pack; my ($num, $fqn, $rest) = split(/\s+/, $line, 3); $num or die "Missing a channel number parameter\n"; $fqn or die "Missing a channel fqn parameter\n"; my $signalling = ''; my @alarms = (); my $info = ''; if(defined $rest) { # remarks in parenthesis (In use), (no pcm) while($rest =~ s/\s*(\([^)]+\))\s*/ /) { $info .= " $1"; } # Alarms foreach my $alarm (@alarm_types) { if($rest =~ s/\s*(\b${alarm}\b)\s*/ /) { push(@alarms, $1); } } foreach my $sig (@sigtypes) { if($rest =~ s/^\Q$sig\E/ /) { $signalling = $sig; last; } } warn "Unrecognized garbage '$rest' in $fqn\n" if $rest =~ /\S/; } $self->{NUM} = $num; $self->{FQN} = $fqn; $self->{SIGNALLING} = $signalling; $self->{ALARMS} = \@alarms; $self->{INFO} = $info; my $type; if($fqn =~ m|\bXPP_(\w+)/.*$|) { $type = $1; # An Astribank } elsif ($fqn =~ m{\bWCFXO/.*}) { $type = "FXO"; # wcfxo - x100p and relatives. # A single port card. The driver issue RED alarm when # There's no better $self->{BATTERY} = !($span->description =~ /\bRED\b/); } elsif ($fqn =~ m{\bFXS/.*}) { $type = "FXS"; # likely Rhino } elsif ($fqn =~ m{\bFXO/.*}) { $type = "FXO"; # likely Rhino } elsif ($fqn =~ m{\b---/.*}) { $type = "EMPTY"; # likely Rhino, empty slot. } elsif ($fqn =~ m{\b(TE[24]|WCT1|Tor2|TorISA|WP[TE]1|cwain[12])/.*}) { # TE[24]: Digium wct4xxp # WCT1: Digium single span card drivers? # Tor2: Tor PCI cards # TorISA: ISA ones (still used?) # WP[TE]1: Sangoma. TODO: this one tells us if it is TE or NT. # cwain: Junghanns E1 card. $type = "PRI"; } elsif ($fqn =~ m{\b(B4|ZTHFC\d*|ztqoz\d*)/.*}) { # B4: The Digium wcb4xxp DAHDI driver # ZTHFC: HFC-s single-port card (zaphfc/vzaphfc) # ztqoz: qozap (Junghanns) multi-port HFC card $type = "BRI"; } elsif ($fqn =~ m{\bDYN/.*}) { # DYN : Dynamic span (TDMOE) $type = "DYN" } elsif ($fqn =~ m{\bztgsm/.*}) { # Junghanns GSM card $type = "GSM"; } elsif($signalling ne '') { $type = 'FXO' if $signalling =~ /^FXS/; $type = 'FXS' if $signalling =~ /^FXO/; } else { $type = $self->probe_type(); } $self->type($type); $self->span()->type($type) if ! defined($self->span()->type()) || $self->span()->type() eq 'UNKNOWN'; return $self; } =head1 probe_type() In the case of some cards, the information in /proc/dahdi is not good enough to tell the type of each channel. In this case an extra explicit probe is needed. Currently this is implemented by using some invocations of dahdi_cfg(8). It may later be replaced by dahdi_scan(8). =cut my $dahdi_cfg = $ENV{DAHDI_CFG} || '/usr/sbin/dahdi_cfg'; sub probe_type($) { my $self = shift; my $fqn = $self->fqn; my $num = $self->num; my $type; if($fqn =~ m:WCTDM/|WRTDM/|OPVXA1200/:) { my %maybe; undef %maybe; foreach my $sig (qw(fxo fxs)) { my $cmd = "echo ${sig}ks=$num | $dahdi_cfg -c /dev/fd/0"; $maybe{$sig} = system("$cmd >/dev/null 2>&1") == 0; } if($maybe{fxo} and $maybe{fxs}) { $type = 'EMPTY'; } elsif($maybe{fxo}) { $type = 'FXS'; } elsif($maybe{fxs}) { $type = 'FXO'; } else { $type = 'EMPTY'; } } else { $type = $self->type; } return $type; } sub battery($) { my $self = shift or die; my $span = $self->span or die; return undef unless defined $self->type && $self->type eq 'FXO'; return $self->{BATTERY} if defined $self->{BATTERY}; my $xpd = $span->xpd; my $index = $self->index; return undef if !$xpd; # It's an XPD (FXO) my @lines = @{$xpd->lines}; my $line = $lines[$index]; return $line->battery; } sub alarms($) { my $self = shift or die; my @alarms = @{$self->{ALARMS}}; return @alarms; } sub blink($$) { my $self = shift or die; my $on = shift; my $span = $self->span or die; my $xpd = $span->xpd; my $index = $self->index; return undef if !$xpd; my @lines = @{$xpd->lines}; my $line = $lines[$index]; return $line->blink($on); } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/0000775000000000000000000000000011176143301020622 5ustar rootrootdahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen/0000775000000000000000000000000011176143301021333 5ustar rootrootdahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen/Users.pm0000664000000000000000000000760611161411555023006 0ustar rootrootpackage Dahdi::Config::Gen::Users; use strict; use File::Basename; use Dahdi::Config::Gen qw(is_true); sub new($$$) { my $pack = shift || die; my $gconfig = shift || die; my $genopts = shift || die; my $file = $ENV{USERS_FILE} || "/etc/asterisk/users.conf"; my $self = { FILE => $file, GCONFIG => $gconfig, GENOPTS => $genopts, }; bless $self, $pack; return $self; } sub gen_channel($) { my $self = shift || die; my $chan = shift || die; my $gconfig = $self->{GCONFIG}; my $type = $chan->type; my $num = $chan->num; die "channel $num type $type is not an analog channel\n" if $chan->span->is_digital(); my $exten = $gconfig->{'base_exten'} + $num; my $sig = $gconfig->{'chan_dahdi_signalling'}{$type}; my $full_name = "$type $num"; die "missing default_chan_dahdi_signalling for chan #$num type $type" unless $sig; print << "EOF"; [$exten] callwaiting = yes context = numberplan-custom-1 fullname = $full_name cid_number = $exten hasagent = no hasdirectory = no hasiax = no hasmanager = no hassip = no hasvoicemail = yes host = dynamic mailbox = $exten threewaycalling = yes vmsecret = 1234 secret = 1234 signalling = $sig dahdichan = $num registeriax = no registersip = no canreinvite = no nat = no dtmfmode = rfc2833 disallow = all allow = all EOF } # generate users.conf . The specific users.conf is strictly oriented # towards using with the asterisk-gui . # # This code could have generated a much simpler and smaller # configuration file, had there been minimal level of support for # configuration templates in the asterisk configuration rewriting. Right # now Asterisk's configuration rewriting simply freaks out in the face # of templates: http://bugs.digium.com/11442 . sub generate($) { my $self = shift || die; my $file = $self->{FILE}; my $gconfig = $self->{GCONFIG}; my $genopts = $self->{GENOPTS}; #$gconfig->dump; my @spans = @_; warn "Empty configuration -- no spans\n" unless @spans; rename "$file", "$file.bak" or $! == 2 # ENOENT (No dependency on Errno.pm) or die "Failed to backup old config: $!\n"; print "Generating $file\n" if $genopts->{verbose}; open(F, ">$file") || die "$0: Failed to open $file: $!\n"; my $old = select F; print <<"HEAD"; ;! ;! Automatically generated configuration file ;! Filename: @{[basename($file)]} ($file) ;! Generator: $0 ;! Creation Date: @{[scalar(localtime)]} ;! If you edit this file and execute $0 again,\n"; ;! your manual changes will be LOST.\n"; ;! [general] ; ; Full name of a user ; fullname = New User ; ; Starting point of allocation of extensions ; userbase = @{[$gconfig->{'base_exten'}+1]} ; ; Create voicemail mailbox and use use macro-stdexten ; hasvoicemail = yes ; ; Set voicemail mailbox @{[$gconfig->{'base_exten'}+1]} password to 1234 ; vmsecret = 1234 ; ; Create SIP Peer ; hassip = no ; ; Create IAX friend ; hasiax = no ; ; Create Agent friend ; hasagent = no ; ; Create H.323 friend ; ;hash323 = yes ; ; Create manager entry ; hasmanager = no ; ; Remaining options are not specific to users.conf entries but are general. ; callwaiting = yes threewaycalling = yes callwaitingcallerid = yes transfer = yes canpark = yes cancallforward = yes callreturn = yes callgroup = 1 pickupgroup = 1 localextenlength = @{[length($gconfig->{'base_exten'})]} HEAD foreach my $span (@spans) { next unless grep { $_ eq $span->type} ( 'FXS', 'IN', 'OUT' ); printf "; Span %d: %s %s\n", $span->num, $span->name, $span->description; foreach my $chan ($span->chans()) { $self->gen_channel($chan); } print "\n"; } close F; select $old; } 1; __END__ =head1 NAME users - Generate configuration for users.conf. =head1 SYNOPSIS use Dahdi::Config::Gen::Users; my $cfg = new Dahdi::Config::Gen::Users(\%global_config, \%genopts); $cfg->generate(@span_list); =head1 DESCRIPTION Generate the F which is used by asterisk(1) and AsteriskGUI. Its location may be overriden via the environment variable F. dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen/Xpporder.pm0000664000000000000000000000730511173425774023517 0ustar rootrootpackage Dahdi::Config::Gen::Xpporder; use strict; use Dahdi::Config::Gen qw(is_true); sub new($$$) { my $pack = shift || die; my $gconfig = shift || die; my $genopts = shift || die; my $file = $ENV{XPPORDER_CONF} || "/etc/dahdi/xpp_order"; my $self = { FILE => $file, GCONFIG => $gconfig, GENOPTS => $genopts, }; bless $self, $pack; return $self; } # # Returns list of xbuses sorted by the span numbers assigned # to their XPD's. Also checks that each XBUS span numbers are sequential. sub get_sorted_xbuses(@) { my @spans = @_; # Verify our spans my @xbuses = Dahdi::Xpp::xbuses; my %xbus_of_span; my %xbus_beginning; my %seen_spans; my @sorted_xbuses; foreach my $xbus (@xbuses) { my $last_spanno; foreach my $xpd ($xbus->xpds) { my $spanno = $xpd->spanno; if(!$spanno) { printf STDERR "%s: Is not registered. Skipping.\n", $xpd->fqn; next; } $seen_spans{$spanno}++; if($xbus_of_span{$spanno}) { printf STDERR "%s: Span %d already seen on %s\n", $xpd->fqn, $spanno, $xbus_of_span{$spanno}->name; die; } $xbus_of_span{$spanno} = $xbus; # Check XPD's sequential numbering if(defined $last_spanno) { if($last_spanno + 1 != $spanno) { printf STDERR "%s: Bad span numbers (%d, %d)\n", $xpd->fqn, $last_spanno, $spanno; die; } } else { $xbus_beginning{$xbus} = $spanno; } $last_spanno = $spanno; } } foreach my $span (@spans) { my $spanno = $span->num; if(!defined($seen_spans{$spanno})) { warn "Span $spanno: Ignored: Does not belong to any XPD\n"; } } @sorted_xbuses = sort { $xbus_beginning{$a} <=> $xbus_beginning{$b} } @xbuses; return @sorted_xbuses; } sub generate($$$) { my $self = shift || die; my $file = $self->{FILE}; my $gconfig = $self->{GCONFIG}; my $genopts = $self->{GENOPTS}; my @spans = @_; # Verify it's all our spans my @xbuses = get_sorted_xbuses(@spans); warn "Empty configuration -- no xbuses\n" unless @xbuses; rename "$file", "$file.bak" or $! == 2 # ENOENT (No dependency on Errno.pm) or die "Failed to backup old config: $!\n"; #$gconfig->dump; print "Generating $file\n" if $genopts->{verbose}; open(F, ">$file") || die "$0: Failed to open $file: $!\n"; my $old = select F; printf "# Autogenerated by $0 on %s\n", scalar(localtime); print "# If you edit this file and execute $0 again,\n"; print "# your manual changes will be LOST.\n"; print <<'HEAD'; # # This is an optional configuration file for ordering # Dahdi registration. # # It is read from /etc/dahdi/xpp_order. This location # may be overriden via the environment variable XPPORDER_CONF # # Lines may contain: # - The Astribank label (verbatim) # - The Astribank connector string (prefixed with @) # Ordering number of each listed Astribank is determined # by its position in this file. # Astribanks not listed in this file, get an ordering # number of 999 (last). # # Astribanks with same ordering number are sorted by their # connectors (to preserve legacy behaviour). # # Examples: #usb:TWS-08 #@usb-0000:06:02.2-2 HEAD foreach my $xbus (@xbuses) { my $label = $xbus->label; my $connector = $xbus->connector; my $name = $xbus->name; printf "%s\t# %s (%s)\n", $label, $connector, $name; } close F; select $old; } 1; __END__ =head1 NAME Xpporder - Generate Astribank ordering information for dahdi_registration. =head1 SYNOPSIS use Dahdi::Config::Gen::Xpporder; my $cfg = new Dahdi::Config::Gen::Xpporder(\%global_config, \%genopts); $cfg->generate; =head1 DESCRIPTION Generate the F. This is the configuration for dahdi_registration(1). The order is determined according to current Dahdi registration order. Its location may be overriden via the environment variable F. dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen/Modules.pm0000664000000000000000000000301211164643365023311 0ustar rootrootpackage Dahdi::Config::Gen::Modules; use strict; use Dahdi::Config::Gen qw(is_true); sub new($$$) { my $pack = shift || die; my $gconfig = shift || die; my $genopts = shift || die; my $file = $ENV{DAHDI_MODULES_FILE} || "/etc/dahdi/modules"; my $self = { FILE => $file, GCONFIG => $gconfig, GENOPTS => $genopts, }; bless $self, $pack; return $self; } sub generate($$$) { my $self = shift || die; my $file = $self->{FILE}; my $gconfig = $self->{GCONFIG}; my $genopts = $self->{GENOPTS}; rename "$file", "$file.bak" or $! == 2 # ENOENT (No dependency on Errno.pm) or die "Failed to backup old config: $!\n"; #$gconfig->dump; print "Generating $file\n" if $genopts->{verbose}; open(F, ">$file") || die "$0: Failed to open $file: $!\n"; my $old = select F; printf "# Autogenerated by $0 (%s) on %s\n", __PACKAGE__, scalar(localtime); print "# If you edit this file and execute $0 again,\n"; print "# your manual changes will be LOST.\n"; my @drivers = Dahdi::Hardware->drivers; print join("\n", @drivers),"\n"; close F; select $old; } 1; __END__ =head1 NAME modules - Generate list of dahdi drivers to load at startup =head1 SYNOPSIS use Dahdi::Config::Gen::Dahdi; my $cfg = new Dahdi::Config::Gen::Modules(\%global_config, \%genopts); $cfg->generate(@span_list); =head1 DESCRIPTION Generate the F. This is a list of modules, one per line. This list is normally used by F. Its location may be overriden via the environment variable F. dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen/Chandahdi.pm0000664000000000000000000001450111161411555023540 0ustar rootrootpackage Dahdi::Config::Gen::Chandahdi; use strict; use Dahdi::Config::Gen qw(is_true); sub new($$$) { my $pack = shift || die; my $gconfig = shift || die; my $genopts = shift || die; my $file = $ENV{CHAN_DAHDI_CHANNELS_FILE} || "/etc/asterisk/dahdi-channels.conf"; my $self = { FILE => $file, GCONFIG => $gconfig, GENOPTS => $genopts, }; bless $self, $pack; return $self; } # Since chan_dahdi definitions "leak" to the next ones, we try # To reset some important definitions to their chan_dahdi defaults. my %chan_dahdi_defaults = ( context => 'default', group => '63', # FIXME: should not be needed. overlapdial => 'no', busydetect => 'no', rxgain => 0, txgain => 0, ); sub reset_chandahdi_values { foreach my $arg (@_) { if (exists $chan_dahdi_defaults{$arg}) { print "$arg = $chan_dahdi_defaults{$arg}\n"; } else { print "$arg =\n"; } } } sub gen_digital($$) { my $self = shift || die; my $span = shift || die; my $gconfig = $self->{GCONFIG}; my $num = $span->num() || die; die "Span #$num is analog" unless $span->is_digital(); if($span->is_pri && $gconfig->{'pri_connection_type'} eq 'R2') { printf "; Skipped: $gconfig->{'pri_connection_type'}\n\n"; return; } my $type = $span->type() || die "$0: Span #$num -- unkown type\n"; my $termtype = $span->termtype() || die "$0: Span #$num -- unkown termtype [NT/TE]\n"; my $group = $gconfig->{'group'}{"$type"}; my $context = $gconfig->{'context'}{"$type"}; my @to_reset = qw/context group/; die "$0: missing default group (termtype=$termtype)\n" unless defined($group); die "$0: missing default context\n" unless $context; my $sig = $span->signalling || die "missing signalling info for span #$num type $type"; grep($gconfig->{'bri_sig_style'} eq $_, 'bri', 'bri_ptmp', 'pri') or die "unknown signalling style for BRI"; if($span->is_bri() and $gconfig->{'bri_sig_style'} eq 'bri_ptmp') { $sig .= '_ptmp'; } if ($span->is_bri() && $termtype eq 'NT' && is_true($gconfig->{'brint_overlap'})) { print "overlapdial = yes\n"; push(@to_reset, qw/overlapdial/); } $group .= "," . (10 + $num); # Invent unique group per span printf "group=$group\n"; printf "context=$context\n"; printf "switchtype = %s\n", $span->switchtype; printf "signalling = %s\n", $sig; printf "channel => %s\n", Dahdi::Config::Gen::bchan_range($span); reset_chandahdi_values(@to_reset); } sub gen_channel($$) { my $self = shift || die; my $chan = shift || die; my $gconfig = $self->{GCONFIG}; my $type = $chan->type; my $num = $chan->num; die "channel $num type $type is not an analog channel\n" if $chan->span->is_digital(); my $exten = $gconfig->{'base_exten'} + $num; my $sig = $gconfig->{'chan_dahdi_signalling'}{$type}; my $context = $gconfig->{'context'}{$type}; my $group = $gconfig->{'group'}{$type}; my $callerid; my $immediate; return if $type eq 'EMPTY'; die "missing default_chan_dahdi_signalling for chan #$num type $type" unless $sig; $callerid = ($type eq 'FXO') ? 'asreceived' : sprintf "\"Channel %d\" <%04d>", $num, $exten; if($type eq 'IN') { $immediate = 'yes'; } # FIXME: $immediage should not be set for 'OUT' channels, but meanwhile # it's better to be compatible with genzaptelconf $immediate = 'yes' if $gconfig->{'fxs_immediate'} eq 'yes' and $sig =~ /^fxo_/; my $signalling = $chan->signalling; $signalling = " " . $signalling if $signalling; my $info = $chan->info; $info = " " . $info if $info; printf ";;; line=\"%d %s%s%s\"\n", $num, $chan->fqn, $signalling, $info; printf "signalling=$sig\n"; printf "callerid=$callerid\n"; printf "mailbox=%04d\n", $exten unless $type eq 'FXO'; if(defined $group) { printf "group=$group\n"; } printf "context=$context\n"; printf "immediate=$immediate\n" if defined $immediate; printf "channel => %d\n", $num; # Reset following values to default printf "callerid=\n"; printf "mailbox=\n" unless $type eq 'FXO'; if(defined $group) { printf "group=\n"; } printf "context=default\n"; printf "immediate=no\n" if defined $immediate; print "\n"; } sub generate($) { my $self = shift || die; my $file = $self->{FILE}; my $gconfig = $self->{GCONFIG}; my $genopts = $self->{GENOPTS}; #$gconfig->dump; my @spans = @_; warn "Empty configuration -- no spans\n" unless @spans; rename "$file", "$file.bak" or $! == 2 # ENOENT (No dependency on Errno.pm) or die "Failed to backup old config: $!\n"; print "Generating $file\n" if $genopts->{verbose}; open(F, ">$file") || die "$0: Failed to open $file: $!\n"; my $old = select F; printf "; Autogenerated by $0 on %s\n", scalar(localtime); print "; If you edit this file and execute $0 again,\n"; print "; your manual changes will be LOST.\n"; print <<"HEAD"; ; Dahdi Channels Configurations (chan_dahdi.conf) ; ; This is not intended to be a complete chan_dahdi.conf. Rather, it is intended ; to be #include-d by /etc/chan_dahdi.conf that will include the global settings ; HEAD foreach my $span (@spans) { printf "; Span %d: %s %s\n", $span->num, $span->name, $span->description; if($span->is_digital()) { $self->gen_digital($span); } else { foreach my $chan ($span->chans()) { if(is_true($genopts->{'freepbx'}) || is_true($gconfig->{'freepbx'})) { # Freepbx has its own idea about channels my $type = $chan->type; if($type eq 'FXS' || $type eq 'OUT' || $type eq 'IN') { printf "; Skip channel=%s($type) -- freepbx option.\n", $chan->num; next; } } $self->gen_channel($chan); } } print "\n"; } close F; select $old; } 1; __END__ =head1 NAME chandahdi - Generate configuration for chan_dahdi channels. =head1 SYNOPSIS use Dahdi::Config::Gen::Chandahdi; my $cfg = new Dahdi::Config::Gen::Chandahdi(\%global_config, \%genopts); $cfg->generate(@span_list); =head1 DESCRIPTION Generate the F This is used as a configuration for asterisk(1). It should be included in the main F. Its location may be overriden via the environment variable C. =head1 OPTIONS =over 4 =item freepbx With this option we do not generate channel definitions for FXS, Input and Output ports. This is done because these channel definitions need to be generated and inserted into I database anyway. =back The I option may be activated also by adding a C line to the C file. dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen/System.pm0000664000000000000000000001120511161411555023157 0ustar rootrootpackage Dahdi::Config::Gen::System; use strict; use Dahdi::Config::Gen qw(is_true); sub new($$$) { my $pack = shift || die; my $gconfig = shift || die; my $genopts = shift || die; my $file = $ENV{DAHDI_CONF_FILE} || "/etc/dahdi/system.conf"; my $self = { FILE => $file, GCONFIG => $gconfig, GENOPTS => $genopts, }; bless $self, $pack; return $self; } my $bri_te_last_timing = 1; sub print_echo_can($$) { my $gconfig = shift || die; my $chans = shift || die; # channel or range of channels. my $echo_can = $gconfig->{'echo_can'}; return if !defined($echo_can) || $echo_can eq 'none'; print "echocanceller=$echo_can,$chans\n"; } sub gen_digital($$) { my $gconfig = shift || die; my $span = shift || die; my $num = $span->num() || die; die "Span #$num is analog" unless $span->is_digital(); my $termtype = $span->termtype() || die "$0: Span #$num -- unkown termtype [NT/TE]\n"; my $timing; my $lbo = 0; my $framing = $span->framing() || die "$0: No framing information for span #$num\n"; my $coding = $span->coding() || die "$0: No coding information for span #$num\n"; my $span_crc4 = $span->crc4(); $span_crc4 = (defined $span_crc4) ? ",$span_crc4" : ''; my $span_yellow = $span->yellow(); $span_yellow = (defined $span_yellow) ? ",$span_yellow" : ''; # "MFC/R2 does not normally use CRC4" # FIXME: a finer way to override: if ($gconfig->{'pri_connection_type'} eq 'R2') { $span_crc4 = ''; $framing = 'cas'; } my $dchan_type = 'dchan'; if ($span->is_bri() && is_true($gconfig->{'bri_hardhdlc'})) { $dchan_type = 'hardhdlc'; } $timing = ($termtype eq 'NT') ? 0 : $bri_te_last_timing++; printf "span=%d,%d,%d,%s,%s%s%s\n", $num, $timing, $lbo, $framing, $coding, $span_crc4, $span_yellow; printf "# termtype: %s\n", lc($termtype); if ($gconfig->{'pri_connection_type'} eq 'PRI') { printf "bchan=%s\n", Dahdi::Config::Gen::bchan_range($span); my $dchan = $span->dchan(); printf "$dchan_type=%d\n", $dchan->num(); } elsif ($gconfig->{'pri_connection_type'} eq 'R2' ) { my $idle_bits = $gconfig->{'r2_idle_bits'}; printf "cas=%s:$idle_bits\n", Dahdi::Config::Gen::bchan_range($span); printf "dchan=%d\n", $span->dchan()->num(); } print_echo_can($gconfig, Dahdi::Config::Gen::bchan_range($span)); } sub gen_signalling($$) { my $gconfig = shift || die; my $chan = shift || die; my $type = $chan->type; my $num = $chan->num; die "channel $num type $type is not an analog channel\n" if $chan->span->is_digital(); if($type eq 'EMPTY') { printf "# channel %d, %s, no module.\n", $num, $chan->fqn; return; } my $signalling = $gconfig->{'dahdi_signalling'}; my $sig = $signalling->{$type} || die "unknown default dahdi signalling for chan $num type $type"; if ($type eq 'IN') { printf "# astbanktype: input\n"; } elsif ($type eq 'OUT') { printf "# astbanktype: output\n"; } printf "$sig=$num\n"; print_echo_can($gconfig, $num); } sub generate($$$) { my $self = shift || die; my $file = $self->{FILE}; my $gconfig = $self->{GCONFIG}; my $genopts = $self->{GENOPTS}; my @spans = @_; warn "Empty configuration -- no spans\n" unless @spans; rename "$file", "$file.bak" or $! == 2 # ENOENT (No dependency on Errno.pm) or die "Failed to backup old config: $!\n"; #$gconfig->dump; print "Generating $file\n" if $genopts->{verbose}; open(F, ">$file") || die "$0: Failed to open $file: $!\n"; my $old = select F; printf "# Autogenerated by $0 on %s\n", scalar(localtime); print "# If you edit this file and execute $0 again,\n"; print "# your manual changes will be LOST.\n"; print <<"HEAD"; # Dahdi Configuration File # # This file is parsed by the Dahdi Configurator, dahdi_cfg # HEAD foreach my $span (@spans) { printf "# Span %d: %s %s\n", $span->num, $span->name, $span->description; if($span->is_digital()) { gen_digital($gconfig, $span); } else { foreach my $chan ($span->chans()) { if(1 || !defined $chan->type) { my $type = $chan->probe_type; my $num = $chan->num; die "Failed probing type for channel $num" unless defined $type; $chan->type($type); } gen_signalling($gconfig, $chan); } } print "\n"; } print <<"TAIL"; # Global data loadzone = $gconfig->{'loadzone'} defaultzone = $gconfig->{'defaultzone'} TAIL close F; select $old; } 1; __END__ =head1 NAME dahdi - Generate configuration for dahdi drivers. =head1 SYNOPSIS use Dahdi::Config::Gen::Dahdi; my $cfg = new Dahdi::Config::Gen::Dahdi(\%global_config, \%genopts); $cfg->generate(@span_list); =head1 DESCRIPTION Generate the F. This is the configuration for dahdi_cfg(1). Its location may be overriden via the environment variable F. dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen/Unicall.pm0000664000000000000000000000371011161411555023264 0ustar rootrootpackage Dahdi::Config::Gen::Unicall; use strict; use Dahdi::Config::Gen qw(is_true); sub new($$$) { my $pack = shift || die; my $gconfig = shift || die; my $genopts = shift || die; my $file = $ENV{UNICALL_CHANNELS_FILE} || "/etc/asterisk/unicall-channels.conf"; my $self = { FILE => $file, GCONFIG => $gconfig, GENOPTS => $genopts, }; bless $self, $pack; return $self; } sub generate($) { my $self = shift || die; my $file = $self->{FILE}; my $gconfig = $self->{GCONFIG}; my $genopts = $self->{GENOPTS}; #$gconfig->dump; my @spans = @_; warn "Empty configuration -- no spans\n" unless @spans; die "Only for R2" unless $gconfig->{'pri_connection_type'} eq 'R2'; rename "$file", "$file.bak" or $! == 2 # ENOENT (No dependency on Errno.pm) or die "Failed to backup old config: $!\n"; print "Generating $file\n" if $genopts->{verbose}; open(F, ">$file") || die "$0: Failed to open $file: $!\n"; my $old = select F; printf "; Autogenerated by $0 on %s\n", scalar(localtime); print "; If you edit this file and execute $0 again,\n"; print "; your manual changes will be LOST.\n"; print "; This file should be #included in unicall.conf\n\n"; foreach my $span (@spans) { next unless $span->is_digital(); printf "; Span %d: %s %s\n", $span->num, $span->name, $span->description; my $idle_bits = $gconfig->{'r2_idle_bits'}; printf "protocolend=%s\n", ($span->termtype() eq 'TE') ? 'cpe' : 'co'; printf "channel=%s\n", Dahdi::Config::Gen::bchan_range($span); print "\n"; } close F; select $old; } 1; __END__ =head1 NAME unicall - Generate configuration for unicall channels. =head1 SYNOPSIS use Dahdi::Config::Gen::Unicall; my $cfg = new Dahdi::Config::Gen::Unicall(\%global_config, \%genopts); $cfg->generate(@span_list); =head1 DESCRIPTION Generate the F to be included in F Its location may be overriden via the environment variable C. dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Gen.pm0000664000000000000000000001312011163741616021677 0ustar rootrootpackage Dahdi::Config::Gen; # # Written by Oron Peled # Copyright (C) 2009, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Gen.pm 6272 2009-03-29 18:53:02Z tzafrir $ # =head1 NAME Dahdi::Config::Gen -- Wrapper class for configuration generators. =head1 SYNOPSIS use Dahdi::Config::Gen qw(is_true); my $params = Dahdi::Config::Params->new('the-config-file'); my $gconfig = Dahdi::Config::Gen->new($params); my $num = $gconfig->{'base_exten'}; my $overlap = is_true($gconfig->{'brint_overlap'}); $gconfig->dump; # For debugging $gconfig->run_generator('system', {}, @spans); =head1 DESCRIPTION The constructor must be given an C object. The returned object contains all data required for generation in the form of a hash. The constructor maps the Cs from the parameter object into semantic configuration keys. E.g: the C item is mapped to C and C keys. The actual generation is done by delegation to one of the generators. This is done via the C method which receive the generator name, a generator specific options hash and a list of span objects (from C) for which to generate configuration. This module contains few helper functions. E.g: C, C. =cut require Exporter; @ISA = qw(Exporter); @EXPORT_OK = qw(is_true); use strict; # Parse values as true/false sub is_true($) { my $val = shift; return undef unless defined $val; return $val =~ /^(1|y|yes)$/i; } # Generate channel range strings from span objects # E.g: "63-77,79-93" sub bchan_range($) { my $span = shift || die; my $first_chan = ($span->chans())[0]; my $first_num = $first_chan->num(); my $range_start = $first_num; my @range; my $prev = undef; die unless $span->is_digital(); foreach my $c (@{$span->bchan_list()}) { my $curr = $c + $first_num; if(!defined($prev)) { $prev = $curr; } elsif($curr != $prev + 1) { push(@range, sprintf("%d-%d", $range_start, $prev)); $range_start = $curr; } $prev = $curr; } if($prev >= $first_num) { push(@range, sprintf("%d-%d", $range_start, $prev)); } return join(',', @range); } sub new($) { my $pack = shift || die "$0: Missing package argument"; my $p = shift || die "$0: Missing parameters argument"; # Set defaults my $fxs_default_start = $p->item('fxs_default_start'); my $fxo_default_start = $p->item('fxo_default_start'); my %default_context = ( FXO => $p->item('context_lines'), FXS => $p->item('context_phones'), IN => $p->item('context_input'), OUT => $p->item('context_output'), BRI_TE => $p->item('context_lines'), BRI_NT => $p->item('context_lines'), E1_TE => $p->item('context_lines'), T1_TE => $p->item('context_lines'), J1_TE => $p->item('context_lines'), E1_NT => $p->item('context_lines'), T1_NT => $p->item('context_lines'), J1_NT => $p->item('context_lines'), ); my %default_group = ( FXO => $p->item('group_lines'), FXS => $p->item('group_phones'), IN => '', OUT => '', BRI_TE => $p->item('group_lines'), BRI_NT => $p->item('group_lines'), E1_TE => $p->item('group_lines'), T1_TE => $p->item('group_lines'), J1_TE => $p->item('group_lines'), E1_NT => $p->item('group_lines'), T1_NT => $p->item('group_lines'), J1_NT => $p->item('group_lines'), ); my %default_dahdi_signalling = ( FXO => "fxs$fxo_default_start", FXS => "fxo$fxs_default_start", IN => "fxo$fxs_default_start", OUT => "fxo$fxs_default_start", ); my %default_chan_dahdi_signalling = ( FXO => "fxs_$fxo_default_start", FXS => "fxo_$fxs_default_start", IN => "fxo_$fxs_default_start", OUT => "fxo_$fxs_default_start", ); # First complex mapping my $gconfig = { PARAMETERS => $p, 'loadzone' => $p->item('lc_country'), 'defaultzone' => $p->item('lc_country'), 'context' => \%default_context, 'group' => \%default_group, 'dahdi_signalling' => \%default_dahdi_signalling, 'chan_dahdi_signalling' => \%default_chan_dahdi_signalling, }; # Now add trivial mappings my @trivial = qw( base_exten freepbx fxs_immediate bri_hardhdlc bri_sig_style r2_idle_bits echo_can brint_overlap pri_termtype pri_connection_type ); foreach my $k (@trivial) { $gconfig->{$k} = $p->item($k); } bless $gconfig,$pack; return $gconfig; } sub run_generator($$@) { my $gconfig = shift || die; my $name = shift || die "$0: Missing generator name argument"; my $genopts = shift || die "$0: Missing genopts argument"; ref($genopts) eq 'HASH' or die "$0: Bad genopts argument"; my @spans = @_; my $module = "Dahdi::Config::Gen::$name"; #print STDERR "DEBUG: $module\n"; eval "use $module"; if($@) { die "Failed to load configuration generator for '$name'\n"; } my $cfg = $module->new($gconfig, $genopts); $cfg->generate(@spans); } sub dump($) { my $self = shift || die; printf STDERR "%s dump:\n", ref $self; my $width = 30; foreach my $k (sort keys %$self) { my $val = $self->{$k}; my $ref = ref $val; #print STDERR "DEBUG: '$k', '$ref', '$val'\n"; if($ref eq '') { printf STDERR "%-${width}s %s\n", $k, $val; } elsif($ref eq 'SCALAR') { printf STDERR "%-${width}s %s\n", $k, ${$val}; } elsif($ref eq 'ARRAY') { #printf STDERR "%s:\n", $k; my $i = 0; foreach my $v (@{$val}) { printf STDERR "%-${width}s %s\n", "$k\->[$i]", $v; $i++; } } elsif($ref eq 'HASH') { #printf STDERR "%s:\n", $k; foreach my $k1 (keys %{$val}) { printf STDERR "%-${width}s %s\n", "$k\->\{$k1\}", ${$val}{$k1}; } } else { printf STDERR "%-${width}s (-> %s)\n", $k, $ref; } } } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Config/Params.pm0000664000000000000000000000663511153311554022417 0ustar rootrootpackage Dahdi::Config::Params; # # Written by Oron Peled # Copyright (C) 2009, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Params.pm 6077 2009-03-03 20:30:36Z tzafrir $ # use strict; =head1 NAME Dahdi::Config::Params -- Object oriented representation of F file. =head1 SYNOPSIS use Dahdi::Config::Params; my $params = Dahdi::Config::Params->new('the-config-file'); print $params->item{'some-key'}; $params->dump; # For debugging =head1 DESCRIPTION The constructor must be given a configuration file name: =over 4 =item * Missing file is B an error. =item * Other opening errors cause a C to be thrown. =item * The file name is saved as the value of C key. =back The access to config keys should only be done via the C method: =over 4 =item * It contains all hard-coded defaults. =item * All these values are overriden by directives in the config file. =back =cut sub new($$) { my $pack = shift || die; my $cfg_file = shift || die; my $self = { GENCONF_FILE => $cfg_file, }; bless $self, $pack; if(!open(F, $cfg_file)) { if(defined($!{ENOENT})) { #print STDERR "No $cfg_file. Assume empty config\n"; return $self; # Empty configuration } die "$pack: Failed to open '$cfg_file': $!\n"; } #print STDERR "$pack: $cfg_file\n"; my $array_key; while() { my ($key, $val); chomp; s/#.*$//; s/\s+$//; # trim tail whitespace next unless /\S/; if(defined $array_key && /^\s+/) { s/^\s+//; # trim beginning whitespace push(@{$self->{$array_key}}, $_); next; } undef $array_key; ($key, $val) = split(/\s+/, $_, 2); $key = lc($key); if(! defined $val) { $array_key = $key; next; } die "$cfg_file:$.: Duplicate key '$key'\n", if exists $self->{$key}; $self->{$key} = $val; } close F; return $self; } sub item($$) { my $self = shift || die; my $key = shift || die; my %defaults = ( base_exten => '4000', freepbx => 'no', # Better via -F command line fxs_immediate => 'no', fxs_default_start => 'ks', fxo_default_start => 'ks', lc_country => 'us', context_lines => 'from-pstn', context_phones => 'from-internal', context_input => 'astbank-input', context_output => 'astbank-output', group_phones => '5', group_lines => '0', brint_overlap => 'no', bri_sig_style => 'bri_ptmp', echo_can => 'mg2', bri_hardhdlc => 'no', pri_connection_type => 'PRI', r2_idle_bits => '1101', 'pri_termtype' => [ 'SPAN/* TE' ], ); return (exists($self->{$key})) ? $self->{$key} :$defaults{$key}; } sub dump($) { my $self = shift || die; printf STDERR "%s dump:\n", ref $self; my $width = 30; foreach my $k (sort keys %$self) { my $val = $self->{$k}; my $ref = ref $val; #print STDERR "DEBUG: '$k', '$ref', '$val'\n"; if($ref eq '') { printf STDERR "%-${width}s %s\n", $k, $val; } elsif($ref eq 'SCALAR') { printf STDERR "%-${width}s %s\n", $k, ${$val}; } elsif($ref eq 'ARRAY') { #printf STDERR "%s:\n", $k; my $i = 0; foreach my $v (@{$val}) { printf STDERR "%-${width}s %s\n", "$k\->[$i]", $v; $i++; } } elsif($ref eq 'HASH') { #printf STDERR "%s:\n", $k; foreach my $k1 (keys %{$val}) { printf STDERR "%-${width}s %s\n", "$k\->\{$k1\}", ${$val}{$k1}; } } else { printf STDERR "%-${width}s (-> %s)\n", $k, $ref; } } } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Hardware.pm0000664000000000000000000001075011165223212021511 0ustar rootrootpackage Dahdi::Hardware; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Hardware.pm 6313 2009-04-02 20:56:42Z tzafrir $ # use strict; =head1 NAME Dahdi::Hardware - Perl interface to a Dahdi devices listing use Dahdi::Hardware; my $hardware = Dahdi::Hardware->scan; # mini dahdi_hardware: foreach my $device ($hardware->device_list) { print "Vendor: device->{VENDOR}, Product: $device->{PRODUCT}\n" } # let's see if there are devices without loaded drivers, and sugggest # drivers to load: my @to_load = (); foreach my $device ($hardware->device_list) { if (! $device->{LOADED} ) { push @to_load, ($device->${DRIVER}); } } if (@to_load) { print "To support the extra devices you probably need to run:\n" print " modprobe ". (join ' ', @to_load). "\n"; } This module provides information about available Dahdi devices on the system. It identifies devices by (USB/PCI) bus IDs. =head1 Device Attributes As usual, object attributes can be used in either upp-case or lower-case, or lower-case functions. =head2 bus_type 'PCI' or 'USB'. =head2 description A one-line description of the device. =head2 driver Name of a Dahdi device driver that should handle this device. This is based on a pre-made list. =head2 vendor, product, subvendor, subproduct The PCI and USB vendor ID, product ID, sub-vendor ID and sub-product ID. (The standard short lspci and lsusb listings show only vendor and product IDs). =head2 loaded If the device is handled by a module - the name of the module. Else - undef. =head2 priv_device_name A string that shows the "location" of that device on the bus. =head2 is_astribank True if the device is a Xorcom Astribank (which may provide some extra attributes). =head2 serial (Astribank-specific attrribute) - the serial number string of the Astribank. =cut # # A global hardware handle # my %hardware_list = ( 'PCI' => [], 'USB' => [], ); sub new($$) { my $pack = shift || die "Wasn't called as a class method\n"; my $name = shift || die "$0: Missing device name"; my $type = shift || die "$0: Missing device type"; my $dev = {}; $dev->{'BUS_TYPE'} = $type; $dev->{IS_ASTRIBANK} = 0 unless defined $dev->{'IS_ASTRIBANK'}; $dev->{'HARDWARE_NAME'} = $name; return $dev; } =head1 device_list() Returns a list of the hardware devices on the system. You must run scan() first for this function to run meaningful output. =cut sub device_list($) { my $pack = shift || die; my @types = @_; my @list; @types = qw(USB PCI) unless @types; foreach my $t (@types) { my $lst = $hardware_list{$t}; @list = ( @list, @{$lst} ); } return @list; } sub device_by_hwname($$) { my $pack = shift || die; my $name = shift || die; my @list = device_list('localcall'); my @good = grep { $_->hardware_name eq $name } @list; return undef unless @good; @good > 1 && die "$pack: Multiple matches for '$name': @good"; return $good[0]; } =head1 drivers() Returns a list of drivers (currently sorted by name) that are used by the devices in the current system (regardless to whether or not they are loaded. =cut sub drivers($) { my $self = shift || die; my @devs = device_list('localcall'); my @drvs = map { $_->{DRIVER} } @devs; # Make unique my %drivers; @drivers{@drvs} = 1; return sort keys %drivers; } =head1 scan() Scan the system for Dahdi devices (PCI and USB). Returns nothing but must be run to initialize the module. =cut my $hardware_scanned; sub scan($) { my $pack = shift || die; return if $hardware_scanned++; foreach my $type (qw(PCI USB)) { eval "use Dahdi::Hardware::$type"; die $@ if $@; $hardware_list{$type} = [ "Dahdi::Hardware::$type"->scan_devices ]; } } sub import { Dahdi::Hardware->scan unless grep(/\bnoscan\b/i, @_); } sub showall { my $pack = shift || die; my @devs; my $printer = sub { my $title = shift; my @devs = @_; return unless @devs; printf "%s:\n", $title; foreach my $dev (@devs) { printf "\t%s\n", $dev->hardware_name; foreach my $k (sort keys %{$dev}) { my $v = $dev->{$k}; if($k eq 'MPPINFO') { printf "\t\tMPPINFO:\n"; eval "use Dahdi::Xpp::Mpp"; die $@ if $@; $v->showinfo("\t\t "); } else { printf "\t\t%-20s %s\n", $k, $v; } } } }; foreach my $type (qw(USB PCI)) { my $lst = $hardware_list{$type}; &$printer("$type devices", @{$lst}); } } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Xpp.pm0000664000000000000000000001741311165223212020526 0ustar rootrootpackage Dahdi::Xpp; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Xpp.pm 6313 2009-04-02 20:56:42Z tzafrir $ # use strict; use Dahdi::Hardware; use Dahdi::Xpp::Xbus; =head1 NAME Dahdi::Xpp - Perl interface to the Xorcom Astribank drivers. =head1 SYNOPSIS # Listing all Astribanks: use Dahdi::Xpp; # scans hardware: my @xbuses = Dahdi::Xpp::xbuses("SORT_CONNECTOR"); for my $xbus (@xbuses) { print $xbus->name." (".$xbus->label .", ". $xbus->connector .")\n"; for my $xpd ($xbus->xpds) { print " - ".$xpd->fqn,"\n"; } } =cut # # A global handle for all xbuses # my @xbuses; my $proc_base = "/proc/xpp"; our $sysfs_astribanks = "/sys/bus/astribanks/devices"; our $sysfs_xpds = "/sys/bus/xpds/devices"; our $sysfs_ab_driver = "/sys/bus/astribanks/drivers/xppdrv"; sub scan($) { my $pack = shift || die; opendir(D, $sysfs_astribanks) || return(); while(my $entry = readdir D) { next unless $entry =~ /xbus-(\d+)/; my $xbus = Dahdi::Xpp::Xbus->new($1); push(@xbuses, $xbus); } closedir D; return @xbuses; } # Nominal sorters for xbuses sub by_name { return $a->name cmp $b->name; } sub by_connector { return $a->connector cmp $b->connector; } sub by_label { my $cmp = $a->label cmp $b->label; return $cmp if $cmp != 0; return $a->connector cmp $b->connector; } sub score_type { my $score; return 1 if grep(/\b[ETJ]1/, @_); return 2 if grep(/\bBRI/, @_); return 3 if grep(/\bFXO/, @_); return 4; # FXS } sub by_type { my @a_types = map { $_->type } $a->xpds(); my @b_types = map { $_->type } $b->xpds(); my $res; my $a_score = score_type(@a_types); my $b_score = score_type(@b_types); #printf STDERR "DEBUG-a: %s %s %s\n", $a->name, $a_score, join(',',@a_types); #printf STDERR "DEBUG-b: %s %s %s\n", $b->name, $b_score, join(',',@b_types); $res = $a_score <=> $b_score; $res = $a->connector cmp $b->connector if $res == 0; return $res; } sub by_xpporder { my $cmp = $a->xpporder cmp $b->xpporder; return $cmp if $cmp != 0; return $a->connector cmp $b->connector; } =head1 xbuses([sort_order]) Scans system (/proc and /sys) and returns a list of Astribank (Xbus) objects. The optional parameter sort_order is the order in which the Astribanks will be returns: =head1 sorters([sort_order]) With no parameters, returns the names of built in sorters. With a single parameter, returns a reference to the requested built in sorter. Also, for convenience, a reference to a custom sorter function may be passed and returned as is. The built in sorters are: =over =item SORT_XPPORDER Sort by ordering defined in F file. Astribanks can be listed in this file by their label or by their connector string (prefixed with <@>). Astribanks not listed in the F file are sorted via ordering number 999 -- So they come after the Astribanks that are listed. Astribanks with same ordering number (e.g: 999) are sorted by their connector string (to preserve legacy behaviour). =item SORT_CONNECTOR Sort by the connector string. For USB this defines the "path" to get to the device through controllers, hubs etc. =item SORT_LABEL Sorts by the label of the Astribank. The label field is unique to the Astribank. It can also be viewed through 'lsusb -v' without the drivers loaded (the iSerial field in the Device Descriptor). This is normally relieble, but some older Astribanks have an empty label. =item SORT_NAME Sort by the "name". e.g: "XBUS-00". The order of Astribank names depends on the load order, and hence may change between different runs. =item SORT_TYPE Sort by XPD types. First Astribanks with E1/T1/J1 XPDs, then with BRI, then with FXO, then ones with only FXS ports. Within each type they are sorted by the connector field (as in SORT_CONNECTOR above). =item custom function Instead of using a predefined sorter, you can pass your own sorting function. See the example sorters in the code of this module. =back =cut sub sorters { my %sorter_table = ( SORT_CONNECTOR => \&by_connector, SORT_NAME => \&by_name, SORT_LABEL => \&by_label, SORT_TYPE => \&by_type, SORT_XPPORDER => \&by_xpporder, # Aliases connector => \&by_connector, name => \&by_name, label => \&by_label, type => \&by_type, xpporder => \&by_xpporder, ); my $which_sorter = shift || return sort keys %sorter_table; return $which_sorter if ref($which_sorter) eq 'CODE'; return $sorter_table{$which_sorter}; } sub add_xpporder(@) { my @xbuses = @_; my $cfg = $ENV{XPPORDER_CONF} || '/etc/dahdi/xpp_order'; my %order; # Set defaults foreach my $xbus (@xbuses) { $xbus->{XPPORDER} = 99; } # Read from optional config file if(!open(F, $cfg)) { warn "$0: Failed opening '$cfg': $!" unless $! == 2; # ENOENT return; } my $count = 1; while() { chomp; s/#.*//; s/^\s*//; s/\s*$//; next unless /\S/; $order{$_} = $count++; } close F; # Overrides from config file foreach my $xbus (@xbuses) { my $label = $xbus->label; my $connector = '@' . $xbus->connector; my $val; $val = $order{$label}; $val = $order{$connector} unless defined $val; $xbus->{XPPORDER} = $val if defined $val; } } sub xbuses { my $optsort = shift || 'SORT_XPPORDER'; my @sorted_xbuses; if(! @xbuses) { @xbuses = Dahdi::Xpp->scan(); } add_xpporder(@xbuses); my $sorter = sorters($optsort); die "Unknown optional sorter '$optsort'" unless defined $sorter; @sorted_xbuses = sort $sorter @xbuses; return @sorted_xbuses; } sub xpd_of_span($) { my $span = shift or die "Missing span parameter"; return undef unless defined $span; foreach my $xbus (Dahdi::Xpp::xbuses) { foreach my $xpd ($xbus->xpds()) { return $xpd if $xpd->fqn eq $span->name; } } return undef; } =head1 sync([new_sync_source]) Gets (and optionally sets) the internal Astribanks synchronization source. When used to set sync source, returns the original sync source. A synchronization source is a value valid writing into /proc/xpp/sync . For more information read that file and see README.Astribank . =cut sub sync_via_proc { my $newsync = shift; my $result; my $newapi = 0; my $file = "$proc_base/sync"; return '' unless -f $file; # First query open(F, "$file") or die "Failed to open $file for reading: $!"; while() { chomp; /SYNC=/ and $newapi = 1; s/#.*//; if(/\S/) { # First non-comment line s/^SYNC=\D*// if $newapi; $result = $_; last; } } close F; if(defined($newsync)) { # Now change $newsync =~ s/.*/\U$&/; if($newsync =~ /^(\d+)$/) { $newsync = ($newapi)? "SYNC=$1" : "$1 0"; } elsif($newsync ne 'DAHDI') { die "Bad sync parameter '$newsync'"; } open(F, ">$file") or die "Failed to open $file for writing: $!"; print F $newsync; close(F) or die "Failed in closing $file: $!"; } return $result; } sub sync { my ($newsync) = @_; my $result; my $file = "$sysfs_ab_driver/sync"; if(! -f $file) { # Old /proc interface return sync_via_proc(@_); } open(F, "$file") or die "Failed to open $file for reading: $!"; $result = ; close F; chomp $result; $result =~ s/^SYNC=\D*//; if(defined $newsync) { # Now change $newsync =~ s/.*/\U$&/; if($newsync =~ /^(\d+)$/) { $newsync = "SYNC=$1"; } elsif($newsync ne 'DAHDI') { die "Bad sync parameter '$newsync'"; } open(F, ">$file") or die "Failed to open $file for writing: $!"; print F $newsync; close(F) or die "Failed in closing $file: $!"; } return $result; } =head1 SEE ALSO =over =item L Xbus (Astribank) object. =item L XPD (the rough equivalent of a Dahdi span) object. =item L Object for a line: an analog port or a time-slot in a adapter. Equivalent of a channel in Dahdi. =item L General documentation in the master package. =back =cut 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi/Span.pm0000664000000000000000000002167411135072675020700 0ustar rootrootpackage Dahdi::Span; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Span.pm 5705 2009-01-19 12:44:45Z tzafrir $ # use strict; use Dahdi::Utils; use Dahdi::Chans; use Dahdi::Xpp::Xpd; =head1 NAME Dahdi::Spans - Perl interface to a Dahdi span information This package allows access from perl to information about a Dahdi channel. It is part of the Dahdi Perl package. A span is a logical unit of Dahdi channels. Normally a port in a digital card or a whole analog card. See documentation of module L for usage example. Specifically C must be run initially. =head1 by_number() Get a span by its Dahdi span number. =head1 Span Properties =head2 num() The span number. =head2 name() The name field of a Dahdi span. E.g.: TE2/0/1 =head2 description() The description field of the span. e.g: "T2XXP (PCI) Card 0 Span 1" HDB3/CCS/CRC4 RED =head2 chans() The list of the channels (L objects) of this span. In a scalar context returns the number of channels this span has. =head2 bchans() Likewise a list of bchannels (or a count in a scalar context). =head2 is_sync_master() Is this span the source of timing for Dahdi? =head2 type() Type of span, or "UNKNOWN" if could not be detected. Current known types: BRI_TE, BRI_NT, E1_TE, E1_NT, J1_TE, J1_NT, T1_TE, T1_NT, FXS, FXO =head2 is_pri() Is this an E1/J1/T1 span? =head2 is_bri() Is this a BRI span? =head2 is_digital() Is this a digital (as opposed to analog) span? =head2 termtype() Set for digital spans. "TE" or "NT". Will probably be assumed to be "TE" if there's no information pointing either way. =head2 coding() Suggested sane coding type (e.g.: "hdb3", "b8zs") for this type of span. =head2 framing() Suggested sane framing type (e.g.: "ccs", "esf") for this type of span. =head2 yellow(), crc4() Likewise, suggestions ofr the respective fields in the span= line in /etc/dahdi/system.conf for this span. =head2 signalling() Suggested chan_dahdi.conf signalling for channels of this span. =head2 switchtype() Suggested chan_dahdi.conf switchtype for channels of this span. =head1 Note Most of those properties are normally used as lower-case functions, but actually set in the module as capital-letter propeties. To look at e.g. "signalling" is set, look for "SIGNALLING". =cut my $proc_base = "/proc/dahdi"; sub chans($) { my $span = shift; return @{$span->{CHANS}}; } sub by_number($) { my $span_number = shift; die "Missing span number" unless defined $span_number; my @spans = Dahdi::spans(); my ($span) = grep { $_->num == $span_number } @spans; return $span; } my @bri_strings = ( 'BRI_(NT|TE)', '(?:quad|octo)BRI PCI ISDN Card.* \[(NT|TE)\]\ ', 'octoBRI \[(NT|TE)\] ', 'HFC-S PCI A ISDN.* \[(NT|TE)\] ', '(B4XXP) \(PCI\) Card', # Does not expose NT/TE type ); my @pri_strings = ( 'Tormenta 2 .*Quad (E1|T1)', # tor2. 'Xorcom XPD.*: (E1|T1)', # Astribank PRI 'Digium Wildcard .100P (T1|E1)/', # wct1xxp 'ISA Tormenta Span 1', # torisa 'TE110P T1/E1', # wcte11xp 'Wildcard TE120P', # wcte12xp 'Wildcard TE121', # wcte12xp 'Wildcard TE122', # wcte12xp 'T[24]XXP \(PCI\) Card ', # wct4xxp ); our $DAHDI_BRI_NET = 'bri_net'; our $DAHDI_BRI_CPE = 'bri_cpe'; our $DAHDI_PRI_NET = 'pri_net'; our $DAHDI_PRI_CPE = 'pri_cpe'; sub init_proto($$) { my $self = shift; my $proto = shift; $self->{PROTO} = $proto; if($proto eq 'E1') { $self->{DCHAN_IDX} = 15; $self->{BCHAN_LIST} = [ 0 .. 14, 16 .. 30 ]; } elsif($proto eq 'T1') { $self->{DCHAN_IDX} = 23; $self->{BCHAN_LIST} = [ 0 .. 22 ]; } $self->{TYPE} = "${proto}_$self->{TERMTYPE}"; } sub new($$) { my $pack = shift or die "Wasn't called as a class method\n"; my $num = shift or die "Missing a span number parameter\n"; my $self = { NUM => $num }; bless $self, $pack; $self->{TYPE} = "UNKNOWN"; my @xpds = Dahdi::Xpp::Xpd::xpds_by_spanno; my $xpd = $xpds[$num]; if(defined $xpd) { die "Spanno mismatch: $xpd->spanno, $num" unless $xpd->spanno == $num; $self->{XPD} = $xpd; } open(F, "$proc_base/$num") or die "Failed to open '$proc_base/$num\n"; my $head = ; chomp $head; $self->{IS_DIGITAL} = 0; $self->{IS_BRI} = 0; $self->{IS_PRI} = 0; foreach my $cardtype (@bri_strings) { if($head =~ m/$cardtype/) { my $termtype = $1; $termtype = 'TE' if ( $1 eq 'B4XXP' ); $self->{IS_DIGITAL} = 1; $self->{IS_BRI} = 1; $self->{TERMTYPE} = $termtype; $self->{TYPE} = "BRI_$termtype"; $self->{DCHAN_IDX} = 2; $self->{BCHAN_LIST} = [ 0, 1 ]; last; } } foreach my $cardtype (@pri_strings) { if($head =~ m/$cardtype/) { my @info; push(@info, $1) if defined $1; push(@info, $2) if defined $2; my ($proto) = grep(/(E1|T1|J1)/, @info); $proto = 'UNKNOWN' unless defined $proto; my ($termtype) = grep(/(NT|TE)/, @info); $termtype = 'UNKNOWN' unless defined $termtype; $self->{IS_DIGITAL} = 1; $self->{IS_PRI} = 1; $self->{TERMTYPE} = $termtype; $self->init_proto($proto); last; } } ($self->{NAME}, $self->{DESCRIPTION}) = (split(/\s+/, $head, 4))[2, 3]; $self->{IS_DAHDI_SYNC_MASTER} = ($self->{DESCRIPTION} =~ /\(MASTER\)/) ? 1 : 0; $self->{CHANS} = []; my @channels; my $index = 0; while() { chomp; s/^\s*//; s/\s*$//; next unless /\S/; next unless /^\s*\d+/; # must be a real channel string. my $c = Dahdi::Chans->new($self, $index, $_); push(@channels, $c); $index++; } close F; if($self->is_pri()) { # Check for PRI with unknown type strings if($index == 31) { if($self->{PROTO} eq 'UNKNOWN') { $self->init_proto('E1'); } elsif($self->{PROTO} ne 'E1') { die "$index channels in a $self->{PROTO} span"; } } elsif($index == 24) { if($self->{PROTO} eq 'UNKNOWN') { $self->init_proto('T1'); # FIXME: J1? } elsif($self->{PROTO} ne 'T1') { die "$index channels in a $self->{PROTO} span"; } } } @channels = sort { $a->num <=> $b->num } @channels; $self->{CHANS} = \@channels; $self->{YELLOW} = undef; $self->{CRC4} = undef; if($self->is_bri()) { $self->{CODING} = 'ami'; $self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}]; $self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ]; # Infer some info from channel name: my $first_chan = ($self->chans())[0] || die "$0: No channels in span #$num\n"; my $chan_fqn = $first_chan->fqn(); if($chan_fqn =~ m(ZTHFC.*/|ztqoz.*/|XPP_BRI_.*|B4/.*)) { # BRI $self->{FRAMING} = 'ccs'; $self->{SWITCHTYPE} = 'euroisdn'; $self->{SIGNALLING} = ($self->{TERMTYPE} eq 'NT') ? $DAHDI_BRI_NET : $DAHDI_BRI_CPE ; } elsif($chan_fqn =~ m(ztgsm.*/)) { # Junghanns's GSM cards. $self->{FRAMING} = 'ccs'; $self->{SIGNALLING} = 'gsm'; } } if($self->is_pri()) { $self->{DCHAN} = ($self->chans())[$self->{DCHAN_IDX}]; $self->{BCHANS} = [ ($self->chans())[@{$self->{BCHAN_LIST}}] ]; if($self->{PROTO} eq 'E1') { $self->{CODING} = 'hdb3'; $self->{FRAMING} = 'ccs'; $self->{SWITCHTYPE} = 'euroisdn'; $self->{CRC4} = 'crc4'; } elsif($self->{PROTO} eq 'T1') { $self->{CODING} = 'b8zs'; $self->{FRAMING} = 'esf'; $self->{SWITCHTYPE} = 'national'; } else { die "'$self->{PROTO}' unsupported yet"; } } return $self; } sub bchans($) { my $self = shift || die; return @{$self->{BCHANS}}; } sub set_termtype($$) { my $span = shift || die; my $termtype = shift || die; $span->{TERMTYPE} = $termtype; $span->{SIGNALLING} = ($termtype eq 'NT') ? $DAHDI_PRI_NET : $DAHDI_PRI_CPE ; $span->{TYPE} = $span->proto . "_$termtype"; } sub pri_set_fromconfig($$) { my $span = shift || die; my $genconf = shift || die; my $name = $span->name; # if(defined $termtype) { # die "Termtype for $name already defined as $termtype\n"; # } my $pri_termtype = $genconf->{pri_termtype}; my @pri_specs; if(defined $pri_termtype) { @pri_specs = @{$pri_termtype}; } push(@pri_specs , 'SPAN/* TE'); # Default my @patlist = ( "SPAN/" . $span->num ); my ($xbus_name, $xpd_name) = ($name =~ m|(XBUS-\d+)/(XPD-\d+)|); if(defined $xbus_name) { push(@patlist, "NUM/$xbus_name/$xpd_name"); # push(@patlist, "CONNECTOR/$ENV{XBUS_CONNECTOR}/$xpd_name"); } #print STDERR "PATLIST=@patlist\n"; my $match_termtype; SPEC: for(my $i = 0; $i < @pri_specs; $i++) { my $spec = $pri_specs[$i]; #print STDERR "spec: $spec\n"; my ($match, $termtype) = split(/\s+/, $spec); next unless defined $match and defined $termtype; # Convert "globs" to regex $match =~ s/\*/.*/g; $match =~ s/\?/./g; #print STDERR "match: $match\n"; foreach my $pattern (@patlist) { #print STDERR "testmatch: $pattern =~ $match\n"; if($pattern =~ $match) { #print STDERR "$xpd_name: MATCH '$pattern' ~ '$match' termtype=$termtype\n"; $match_termtype = $termtype; last SPEC; } } } die "Unknown pri_termtype" unless defined $match_termtype; $span->set_termtype($match_termtype); } 1; dahdi-tools-2.2.0-rc2/xpp/perl_modules/Dahdi.pm0000664000000000000000000000255511152515056017766 0ustar rootrootpackage Dahdi; # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: Dahdi.pm 6055 2009-03-01 14:22:38Z tzafrir $ # use strict; use Dahdi::Span; =head1 NAME Dahdi - Perl interface to Dahdi information This package allows access from Perl to information about Dahdi hardware and loaded Dahdi devices. =head1 SYNOPSIS # Listing channels in analog spans: use Dahdi; # scans system: my @spans = Dahdi::spans(); for my $span (@spans) { next if ($span->is_digital); $span->num. " - [". $span->type ."] ". $span->name. "\n"; for my $chan ($span->chans) { print " - ".$chan->num . " - [". $chan->type. "] ". $chan->fqn". \n"; } } =cut my $proc_base = "/proc/dahdi"; =head1 spans() Returns a list of span objects, ordered by span number. =cut sub spans() { my @spans; -d $proc_base or return (); foreach my $zfile (glob "$proc_base/*") { $zfile =~ s:$proc_base/::; my $span = Dahdi::Span->new($zfile); push(@spans, $span); } @spans = sort { $a->num <=> $b->num } @spans; return @spans; } =head1 SEE ALSO Span objects: L. Dahdi channels objects: L. Dahdi hardware devices information: L. Xorcom Astribank -specific information: L. =cut 1; dahdi-tools-2.2.0-rc2/xpp/twinstar0000775000000000000000000000703411173076103015521 0ustar rootroot#! /usr/bin/perl -w # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: twinstar 6417 2009-04-20 13:44:35Z tzafrir $ # use strict; use File::Basename; use Getopt::Std; BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); } use Dahdi; use Dahdi::Hardware; use Dahdi::Span; use Dahdi::Xpp; use Dahdi::Xpp::Xbus; use Dahdi::Xpp::Mpp; sub usage { die "Usage: $0 {status|jump|enable-wd|disable-wd|ports}\n"; } our ($opt_v, $opt_x); getopts('vx') || usage; @ARGV == 1 or usage; # Find USB bus toplevel my $usb_top; $usb_top = '/dev/bus/usb'; $usb_top = '/proc/bus/usb' unless -d $usb_top; die "No USB toplevel found\n" unless -d $usb_top; sub tws_devs() { my @devs; foreach my $dev (Dahdi::Hardware->device_list) { next unless $dev->is_astribank; next unless $dev->product =~ /116./; push(@devs, $dev->hardware_name); } return @devs; } sub tws_usb_devfile($) { my $name = shift || die; # Remove prefix if($name !~ s/usb://) { die "$name is not a USB name\n"; } return "$usb_top/$name"; } sub tws_show(@) { my @usb_devs = @_; my $format = "%-15s %-10s %-15s %-10s %-10s\n"; printf $format, 'DEVICE', 'PORT', 'WATCHDOG', 'POWER0', 'POWER1'; foreach my $dev (@usb_devs) { my $mppinfo = $dev->mppinfo; if(!defined $mppinfo) { printf STDERR "%s: no MPP information\n", $dev->hardware_name; next; } if(!defined $mppinfo->{TWINSTAR_PORT}) { printf STDERR "%s: no TWINSTAR_PORT information\n", $dev->hardware_name; next; } my $power = $mppinfo->twinstar_power; printf $format, $dev->hardware_name, $mppinfo->twinstar_port, ($mppinfo->twinstar_watchdog) ? "on" : "off", ($power->[0]) ? "yes" : "no", ($power->[1]) ? "yes" : "no"; } } sub tws_portnum($) { my $dev = shift || die "Missing dev"; my $mppinfo = $dev->mppinfo; if(!defined $mppinfo) { printf STDERR "%s: no MPP information\n", $dev->hardware_name; return undef; } return $mppinfo->twinstar_port; } sub tws_showports(@) { my @usb_devs = @_; foreach my $dev (@usb_devs) { my $mppinfo = $dev->mppinfo; if(!defined $mppinfo) { printf STDERR "%s: no MPP information\n", $dev->hardware_name; next; } if(!defined $mppinfo->{TWINSTAR_PORT}) { printf STDERR "%s: no TWINSTAR_PORT information\n", $dev->hardware_name; next; } printf "%s\n", $mppinfo->{TWINSTAR_PORT}; } } sub tws_watchdog($@) { my $on = shift; die "tws_watchdog() on/off?" unless defined $on; my @usb_devs = @_; foreach my $dev (@usb_devs) { my $mppinfo = $dev->mppinfo; if(!defined $mppinfo) { printf STDERR "%s: no MPP information\n", $dev->hardware_name; next; } $mppinfo->mpp_setwatchdog($on); } } sub tws_jump(@) { my @usb_devs = @_; foreach my $dev (@usb_devs) { my $mppinfo = $dev->mppinfo; if(!defined $mppinfo) { printf STDERR "%s: no MPP information\n", $dev->hardware_name; next; } $mppinfo->mpp_jump; } } sub dev_list() { my @devs; foreach my $dev (Dahdi::Hardware->device_list) { next unless $dev->is_astribank; next unless $dev->product =~ /116./; Dahdi::Xpp::Mpp->mpp_addinfo($dev); push(@devs, $dev); } return @devs; } my @usb_devices = dev_list(); if($ARGV[0] eq 'status') { tws_show(@usb_devices); } elsif($ARGV[0] eq 'jump') { tws_jump(@usb_devices); } elsif($ARGV[0] eq 'disable-wd') { tws_watchdog(0, @usb_devices); } elsif($ARGV[0] eq 'enable-wd') { tws_watchdog(1, @usb_devices); } elsif($ARGV[0] eq 'ports') { tws_showports(@usb_devices); } __END__ dahdi-tools-2.2.0-rc2/xpp/xpp_fxloader0000664000000000000000000001750611171665712016353 0ustar rootroot#!/bin/bash # xpp_fxloader: load Xorcom Astribank (XPP) firmware # # Written by Tzafrir Cohen # Copyright (C) 2006, 2007, 2008, Xorcom # # All rights reserved. # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. # # # This script can be run manually or from hotplug/udev. # # Firmware files should be located in $FIRMWARE_DIR which defaults: # 1. /usr/share/dahdi # 2. Can be overidden by setting $FIRMWARE_DIR in the environment # 3. Can be overidden by setting $FIRMWARE_DIR in /etc/dahdi/init.conf # # Manual Run # ########## # # path/to/xpp_fxloader load # # Make sure the firmware files are in $FIRMWARE_DIR # # UDEV Installation # ################# # # Copy xpp.rules to /etc/udev/udev.d and xpp_fxloader to /etc/hotplug/usb/ . # # Hotplug Installation # #################### # # Copy this file and the file xpp_fxloader.usermap to /etc/hotplug/usb/ . # # # Written by Tzafrir Cohen # Copyright (C) 2006, Xorcom # # All rights reserved. # # 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., 675 Mass Ave, Cambridge, MA 02139, USA. set -e # Make sure fxload is in the path: PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin" export PATH me=`basename $0` DEFAULTS="/etc/dahdi/init.conf" if [ -t 2 ]; then LOGGER="logger -i -t '$me' -s" else LOGGER="logger -i -t '$me'" fi USBFS_PREFIX=/proc/bus/usb DEVUSB_PREFIX=/dev/bus/usb USB_PREFIX= FIRMWARE_DIR="${FIRMWARE_DIR:-/usr/share/dahdi}" ASTRIBANK_HEXLOAD=${ASTRIBANK_HEXLOAD:-/usr/sbin/astribank_hexload} ASTRIBANK_TOOL=${ASTRIBANK_TOOL:-/usr/sbin/astribank_tool} USB_FW="${USB_FW:-USB_FW.hex}" if [ -r "$DEFAULTS" ]; then . "$DEFAULTS" fi if [ "$USB_PREFIX" = '' ]; then if [ -d "$DEVUSB_PREFIX" ]; then USB_PREFIX=$DEVUSB_PREFIX elif [ -r "$USBFS_PREFIX/devices" ]; then USB_PREFIX=$USBFS_PREFIX fi fi # With Kernels older that 2.6.10 it seems to be possible # to trigger a race condition by running fxload or fpga_load # immediately after the detection of the device. KERNEL_HAS_USB_RACE=0 case "`uname -r`" in 2.6.[89]*) KERNEL_HAS_USB_RACE=1;; esac sleep_if_race() { if [ "$KERNEL_HAS_USB_RACE" = '1' ]; then sleep 2 fi } find_dev() { v_id=$1 p_id=$2 lsusb | tr -d : | awk "/ ID $v_id$p_id/{printf \"$USB_PREFIX/%s/%s \",\$2,\$4}" } run_fxload() { sleep_if_race fxload -t fx2 $* 2>&1 1>/dev/null | $LOGGER status=$PIPESTATUS if [ $status != 0 ]; then $LOGGER "fxload failed with status $status" exit 55 fi } run_astribank_hexload() { $LOGGER "Running: $ASTRIBANK_HEXLOAD $*" $ASTRIBANK_HEXLOAD "$@" | $LOGGER status=$PIPESTATUS if [ $status != 0 ]; then $LOGGER "$ASTRIBANK_HEXLOAD failed with status $status" exit 77 fi } run_astribank_tool() { $LOGGER "Running: $ASTRIBANK_TOOL $*" $ASTRIBANK_TOOL "$@" | $LOGGER status=$PIPESTATUS if [ $status != 0 ]; then $LOGGER "$ASTRIBANK_TOOL failed with status $status" exit 77 fi } load_usb_fw() { v_id=$1 p_id=$2 fw=$3 devices=`find_dev $v_id $p_id` for dev in $devices do ver=$(awk '/\$Id:/ { print $4 }' $FIRMWARE_DIR/$fw) $LOGGER "USB Firmware $FIRMWARE_DIR/$fw (Version=$ver) into $dev" run_fxload -D $dev -I $FIRMWARE_DIR/$fw || exit 1 done } load_fw_device() { dev=$1 fw=$2 $LOGGER "FPGA loading $fw into $dev" run_astribank_hexload -D "$dev" -F "$FIRMWARE_DIR/$fw" pic_files=`echo "$FIRMWARE_DIR"/PIC_TYPE_[1-4].hex` $LOGGER "PIC burning into $dev: $pic_files" run_astribank_hexload -D "$dev" -p $pic_files run_astribank_tool -D "$dev" -n # Do renumeration! $LOGGER "PIC burning finished $pic_files" } # # Use in manual loading. Parallelize loading # firmwares to all of our devices # firmware_by_id() { v_id=$1 p_id=$2 fw=$3 devices=`find_dev $v_id $p_id` childs="" for dev in $devices do ( set -e load_fw_device "$dev" "$fw" sleep_if_race ) & childs="$childs $!" sleep 0.4 done # Wait for specific childs to get their exit status wait $childs } numdevs() { v_ids="$1" p_ids="$2" for v in $v_ids do ( for p in $p_ids do find_dev $v $p done ) done | wc -w } wait_renumeration() { num="$1" v_ids="$2" p_ids="$3" while n=`numdevs "$v_ids" "$p_ids"` [ "$num" -gt "$n" ] do echo -n "." sleep 1 done echo "Got all $num devices" } reset_fpga() { totaldevs=`numdevs e4e4 '11[3456][012]'` devices=`find_dev e4e4 '11[3456][12]'` $LOGGER "Reseting devices [$totaldevs devices]" for dev in $devices do $LOGGER "Resetting FPGA Firmware on $dev" sleep_if_race run_astribank_tool -D "$dev" -r full 2>&1 >/dev/null done if [ "$1" = 'wait' ]; then wait_renumeration $totaldevs e4e4 '11[3456]0' fi } usage() { echo "$0: Astribank firmware loading script." echo "Usage: " echo "$0 load : manual firmware loading." echo "$0 usb : manual firmware loading: USB firmware only." echo "$0 help : this text." } ######################### ## ## Manual run ## # to run manually, pass the parameter 'xppdetect' case "$1" in udev) # the following emulate hotplug's environment from udev's environment: DEVICE="$DEVNAME" PRODUCT="$2" # skip on to the rest of the script. Don't exit. ;; reset-wait) reset_fpga wait ;; reset) reset_fpga ;; xppdetect|load|usb) numdevs=`numdevs e4e4 '11[3456][01]'` $LOGGER -- "--------- FIRMWARE LOADING: ($1) [$numdevs devices]" load_usb_fw e4e4 1130 $USB_FW load_usb_fw e4e4 1140 $USB_FW load_usb_fw e4e4 1150 $USB_FW load_usb_fw e4e4 1160 $USB_FW wait_renumeration $numdevs e4e4 '11[3456]1' if [ "$1" != 'usb' ] then firmware_by_id e4e4 1131 FPGA_FXS.hex firmware_by_id e4e4 1141 FPGA_1141.hex firmware_by_id e4e4 1151 FPGA_1151.hex firmware_by_id e4e4 1161 FPGA_1161.hex wait_renumeration $numdevs e4e4 '11[3456]2' fi sleep 3 # Let it stabilize $LOGGER -- "--------- FIRMWARE IS LOADED" exit 0 ;; help) usage exit 0 ;; *) if [ "$ACTION" = '' ]; then # not called from hotplug echo "$0: Error: unknown command \"$1\"" echo '' usage exit 1 fi ;; esac ######################### ## ## Hotplug run ## # allow disabling automatic hotplugging: if [ "$XPP_HOTPLUG_DISABLED" != '' ]; then $LOGGER -p kern.info "Exiting... XPP_HOTPLUG_DISABLED" exit 0 fi if [ "$ACTION" = "add" ] && [ -w "$DEVICE" ] then $LOGGER "Trying to find what to do for product $PRODUCT, device $DEVICE" prod_id=`echo "$PRODUCT" | cut -d/ -f2` case "$PRODUCT" in e4e4/11[3456]0/*) FIRM_USB="$FIRMWARE_DIR/$USB_FW" $LOGGER "Loading firmware '$FIRM_USB' into '$DEVICE'" run_fxload -D "$DEVICE" -I "$FIRM_USB" ;; e4e4/11[3456]1/*) if [ "$prod_id" = 1131 ]; then FIRM_FPGA="FPGA_FXS.hex" # Legacy else FIRM_FPGA="FPGA_$prod_id.hex" fi sleep_if_race load_fw_device "$DEVICE" "$FIRM_FPGA" ;; esac fi dahdi-tools-2.2.0-rc2/xpp/hexfile.c0000664000000000000000000003341211166605502015512 0ustar rootroot/* * Written by Oron Peled * Copyright (C) 2006, 2007, 2008, Xorcom * * All rights reserved. * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include #include #include "hexfile.h" static const char rcsid[] = "$Id: hexfile.c 6337 2009-04-07 08:13:54Z tzafrir $"; static parse_hexfile_report_func_t report_func = NULL; parse_hexfile_report_func_t parse_hexfile_set_reporting(parse_hexfile_report_func_t rf) { parse_hexfile_report_func_t old_rf = report_func; report_func = rf; return old_rf; } static void chomp(char buf[]) { size_t last = strlen(buf) - 1; while(last >= 0 && isspace(buf[last])) buf[last--] = '\0'; } static int hexline_checksum(struct hexline *hexline) { unsigned int i; unsigned int chksm = 0; int ll = hexline->d.content.header.ll; for(i = 0; i <= sizeof(hexline->d.content.header) + ll; i++) { chksm += hexline->d.raw[i]; } return chksm & 0xFF; } int dump_hexline(int recordno, struct hexline *line, FILE *fp) { uint8_t ll; uint16_t offset; uint8_t tt; uint8_t old_chksum; uint8_t new_chksum; uint8_t *data; unsigned int i; ll = line->d.content.header.ll; offset = line->d.content.header.offset; tt = line->d.content.header.tt; fprintf(fp, ":%02X%04X%02X", ll, offset, tt); data = line->d.content.tt_data.data; for(i = 0; i < ll; i++) { fprintf(fp, "%02X", data[i]); } old_chksum = data[ll]; data[ll] = 0; new_chksum = 0xFF - hexline_checksum(line) + 1; data[ll] = old_chksum; fprintf(fp, "%02X\n", new_chksum); if(new_chksum != old_chksum) { if(report_func) report_func(LOG_ERR, "record #%d: new_chksum(%02X) != old_chksum(%02X)\n", recordno, new_chksum, old_chksum); return 0; } return 1; } struct hexline *new_hexline(uint8_t datalen, uint16_t offset, uint8_t tt) { struct hexline *hexline; size_t allocsize; allocsize = sizeof(struct hexline) + datalen + 1; /* checksum byte */ if((hexline = malloc(allocsize)) == NULL) { if(report_func) report_func(LOG_ERR, "No more memory\n"); return NULL; } memset(hexline, 0, allocsize); hexline->d.content.header.ll = datalen; hexline->d.content.header.offset = offset; hexline->d.content.header.tt = tt; return hexline; } static int append_hexline(struct hexdata *hexdata, char *buf) { int ret; unsigned int ll, offset, tt; char *p; struct hexline *hexline; unsigned int i; if(hexdata->got_eof) { if(report_func) report_func(LOG_ERR, "Extranous data after EOF record\n"); return -EINVAL; } if(hexdata->last_line >= hexdata->maxlines) { if(report_func) report_func(LOG_ERR, "Hexfile too large (maxline %d)\n", hexdata->maxlines); return -ENOMEM; } ret = sscanf(buf, "%02X%04X%02X", &ll, &offset, &tt); if(ret != 3) { if(report_func) report_func(LOG_ERR, "Bad line header (only %d items out of 3 parsed)\n", ret); return -EINVAL; } switch(tt) { case TT_DATA: break; case TT_EOF: if(ll != 0) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EOF): Bad len = %d\n", hexdata->last_line, tt, ll); return -EINVAL; } if(offset != 0) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EOF): Bad offset = %d\n", hexdata->last_line, tt, offset); return -EINVAL; } hexdata->got_eof = 1; break; case TT_EXT_SEG: if(ll != 2) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EXT_SEG): Bad len = %d\n", hexdata->last_line, tt, ll); return -EINVAL; } if(offset != 0) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EXT_SEG): Bad offset = %d\n", hexdata->last_line, tt, offset); return -EINVAL; } break; case TT_START_SEG: if(ll != 4) { if(report_func) report_func(LOG_ERR, "%d: Record %d(START_SEG): Bad len = %d\n", hexdata->last_line, tt, ll); return -EINVAL; } if(offset != 0) { if(report_func) report_func(LOG_ERR, "%d: Record %d(START_SEG): Bad offset = %d\n", hexdata->last_line, tt, offset); return -EINVAL; } break; case TT_EXT_LIN: if(ll != 2) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EXT_LIN): Bad len = %d\n", hexdata->last_line, tt, ll); return -EINVAL; } if(offset != 0) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EXT_LIN): Bad offset = %d\n", hexdata->last_line, tt, ll); return -EINVAL; } break; case TT_START_LIN: /* Unimplemented */ if(ll != 4) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EXT_LIN): Bad len = %d\n", hexdata->last_line, tt, ll); return -EINVAL; } if(offset != 0) { if(report_func) report_func(LOG_ERR, "%d: Record %d(EXT_LIN): Bad offset = %d\n", hexdata->last_line, tt, ll); return -EINVAL; } break; default: if(report_func) report_func(LOG_ERR, "%d: Unimplemented record type %d: %s\n", hexdata->last_line, tt, buf); return -EINVAL; } buf += 8; /* Skip header */ if((hexline = new_hexline(ll, offset, tt)) == NULL) { if(report_func) report_func(LOG_ERR, "No more memory for hexfile lines\n"); return -EINVAL; } p = buf; for(i = 0; i < ll + 1; i++) { /* include checksum */ unsigned int val; if((*p == '\0') || (*(p+1) == '\0')) { if(report_func) report_func(LOG_ERR, "Short data string '%s'\n", buf); return -EINVAL; } ret = sscanf(p, "%02X", &val); if(ret != 1) { if(report_func) report_func(LOG_ERR, "Bad data byte #%d\n", i); return -EINVAL; } hexline->d.content.tt_data.data[i] = val; p += 2; } if(hexline_checksum(hexline) != 0) { if(report_func) { report_func(LOG_ERR, "Bad checksum (%d instead of 0)\n", hexline_checksum(hexline)); dump_hexline(hexdata->last_line, hexline, stderr); } return -EINVAL; } hexdata->lines[hexdata->last_line] = hexline; if(hexdata->got_eof) return 0; hexdata->last_line++; return 1; } void free_hexdata(struct hexdata *hexdata) { if(hexdata) { unsigned int i; for(i = 0; i < hexdata->maxlines; i++) if(hexdata->lines[i] != NULL) free(hexdata->lines[i]); free(hexdata); } } int dump_hexfile(struct hexdata *hexdata, const char *outfile) { FILE *fp; unsigned int i; if(report_func) report_func(LOG_INFO, "Dumping hex data into '%s'\n", outfile); if(!outfile || strcmp(outfile, "-") == 0) fp = stdout; else if((fp = fopen(outfile, "w")) == NULL) { perror(outfile); exit(1); } for(i = 0; i <= hexdata->last_line; i++) { struct hexline *line = hexdata->lines[i]; if(!line) { if(report_func) report_func(LOG_ERR, "Missing line at #%d\n", i); return -EINVAL; } if(!dump_hexline(i, line, fp)) return -EINVAL; } return 0; } int dump_hexfile2(struct hexdata *hexdata, const char *outfile, uint8_t maxwidth) { FILE *fp; uint8_t tt; unsigned int i; struct hexline *line; if(report_func) report_func(LOG_INFO, "Dumping hex data into '%s' (maxwidth=%d)\n", outfile, maxwidth); if(!outfile || strcmp(outfile, "-") == 0) fp = stdout; else if((fp = fopen(outfile, "w")) == NULL) { perror(outfile); exit(1); } if(maxwidth == 0) maxwidth = UINT8_MAX; for(i = 0; i <= hexdata->last_line; i++) { int bytesleft = 0; int extra_offset = 0; int base_offset; uint8_t *base_data; line = hexdata->lines[i]; if(!line) { if(report_func) report_func(LOG_ERR, "Missing line at #%d\n", i); return -EINVAL; } bytesleft = line->d.content.header.ll; /* split the line into several lines */ tt = line->d.content.header.tt; base_offset = line->d.content.header.offset; base_data = line->d.content.tt_data.data; while (bytesleft > 0) { struct hexline *extraline; uint8_t new_chksum; unsigned int curr_bytes = (bytesleft >= maxwidth) ? maxwidth : bytesleft; /* generate the new line */ if((extraline = new_hexline(curr_bytes, base_offset + extra_offset, tt)) == NULL) { if(report_func) report_func(LOG_ERR, "No more memory for hexfile lines\n"); return -EINVAL; } memcpy(extraline->d.content.tt_data.data, base_data + extra_offset, curr_bytes); new_chksum = 0xFF - hexline_checksum(extraline) + 1; extraline->d.content.tt_data.data[curr_bytes] = new_chksum; /* print it */ dump_hexline(i, extraline, fp); /* cleanups */ free(extraline); extra_offset += curr_bytes; bytesleft -= curr_bytes; } } if(tt != TT_EOF) { if(report_func) report_func(LOG_ERR, "Missing EOF record\n"); return -EINVAL; } dump_hexline(i, line, fp); return 0; } void process_comment(struct hexdata *hexdata, char buf[]) { char *dollar_start; char *dollar_end; const char id_prefix[] = "Id: "; char tmp[BUFSIZ]; char *p; int len; if(report_func) report_func(LOG_INFO, "Comment: %s\n", buf + 1); /* Search for RCS keywords */ if((dollar_start = strchr(buf, '$')) == NULL) return; if((dollar_end = strchr(dollar_start + 1, '$')) == NULL) return; /* Crop the '$' signs */ len = dollar_end - dollar_start; len -= 2; memcpy(tmp, dollar_start + 1, len); tmp[len] = '\0'; p = tmp; if(strstr(tmp, id_prefix) == NULL) return; p += strlen(id_prefix); if((p = strchr(p, ' ')) == NULL) return; p++; snprintf(hexdata->version_info, BUFSIZ, "%s", p); if((p = strchr(hexdata->version_info, ' ')) != NULL) *p = '\0'; } struct hexdata *parse_hexfile(const char *fname, unsigned int maxlines) { FILE *fp; struct hexdata *hexdata = NULL; int datasize; char buf[BUFSIZ]; int line; int dos_eof = 0; int ret; assert(fname != NULL); if(report_func) report_func(LOG_INFO, "Parsing %s\n", fname); datasize = sizeof(struct hexdata) + maxlines * sizeof(char *); hexdata = (struct hexdata *)malloc(datasize); if(!hexdata) { if(report_func) report_func(LOG_ERR, "Failed to allocate %d bytes for hexfile contents\n", datasize); goto err; } memset(hexdata, 0, datasize); hexdata->maxlines = maxlines; if((fp = fopen(fname, "r")) == NULL) { if(report_func) report_func(LOG_ERR, "Failed to open hexfile '%s'\n", fname); goto err; } snprintf(hexdata->fname, PATH_MAX, "%s", fname); for(line = 1; fgets(buf, BUFSIZ, fp); line++) { if(dos_eof) { if(report_func) report_func(LOG_ERR, "%s:%d - Got DOS EOF character before true EOF\n", fname, line); goto err; } if(buf[0] == 0x1A && buf[1] == '\0') { /* DOS EOF char */ dos_eof = 1; continue; } chomp(buf); if(buf[0] == '\0') { if(report_func) report_func(LOG_ERR, "%s:%d - Short line\n", fname, line); goto err; } if(buf[0] == '#') { process_comment(hexdata, buf); continue; } if(buf[0] != ':') { if(report_func) report_func(LOG_ERR, "%s:%d - Line begins with 0x%X\n", fname, line, buf[0]); goto err; } if((ret = append_hexline(hexdata, buf + 1)) < 0) { if(report_func) report_func(LOG_ERR, "%s:%d - Failed parsing.\n", fname, line); goto err; } } fclose(fp); if(report_func) report_func(LOG_INFO, "%s parsed OK\n", fname); return hexdata; err: free_hexdata(hexdata); return NULL; } void dump_binary(struct hexdata *hexdata, const char *outfile) { FILE *fp; unsigned int i; size_t len; if(report_func) report_func(LOG_INFO, "Dumping binary data into '%s'\n", outfile); if((fp = fopen(outfile, "w")) == NULL) { perror(outfile); exit(1); } for(i = 0; i < hexdata->maxlines; i++) { struct hexline *hexline = hexdata->lines[i]; if(!hexline) break; switch(hexline->d.content.header.tt) { case TT_EOF: if(report_func) report_func(LOG_INFO, "\ndump: good EOF record"); break; case TT_DATA: if(report_func) report_func(LOG_INFO, "dump: %6d\r", i); len = hexline->d.content.header.ll; if(fwrite(hexline->d.content.tt_data.data, 1, len, fp) != len) { perror("write"); exit(1); } break; case TT_EXT_SEG: case TT_START_SEG: case TT_EXT_LIN: case TT_START_LIN: if(report_func) report_func(LOG_INFO, "\ndump(%d): ignored record type %d", i, hexline->d.content.header.tt); break; default: if(report_func) report_func(LOG_ERR, "dump: Unknown record type %d\n", hexline->d.content.header.tt); exit(1); } } if(report_func) report_func(LOG_INFO, "\nDump finished\n"); fclose(fp); } void gen_hexline(const uint8_t *data, uint16_t addr, size_t len, FILE *output) { struct hexline *hexline; if(!data) { fprintf(output, ":%02X%04X%02XFF\n", 0, 0, TT_EOF); return; } if((hexline = new_hexline(len, addr, (!data) ? TT_EOF : TT_DATA)) == NULL) { if(report_func) report_func(LOG_ERR, "No more memory\n"); return; } if(data) memcpy(&hexline->d.content.tt_data, data, len); dump_hexline(0, hexline, output); free(hexline); } /* * Algorithm lifted of sum(1) implementation from coreutils. * We chose the default algorithm (BSD style). */ int bsd_checksum(struct hexdata *hexdata) { unsigned int i; size_t len; int ck = 0; for(i = 0; i < hexdata->maxlines; i++) { struct hexline *hexline = hexdata->lines[i]; unsigned char *p; if(!hexline) break; if(hexline->d.content.header.tt == TT_EOF) continue; len = hexline->d.content.header.ll; p = hexline->d.content.tt_data.data; for(; len; p++, len--) { ck = (ck >> 1) + ((ck & 1) << 15); ck += *p; ck &= 0xffff; /* Keep it within bounds. */ } } return ck; } dahdi-tools-2.2.0-rc2/xpp/xpp_blink0000775000000000000000000001022111026514254015625 0ustar rootroot#! /usr/bin/perl -w # # Written by Oron Peled # Copyright (C) 2007, Xorcom # This program is free software; you can redistribute and/or # modify it under the same terms as Perl itself. # # $Id: xpp_blink 4416 2008-06-19 17:34:36Z tzafrir $ # use strict; use File::Basename; BEGIN { my $dir = dirname($0); unshift(@INC, "$dir", "$dir/perl_modules"); } use Dahdi; use Dahdi::Span; use Dahdi::Xpp; use Dahdi::Xpp::Xbus; sub usage { die "Usage: $0 {on|off|bzzt} {span | chan | xpd [] | label